30.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/bash
  2. # do some routing with carrierroute route sets from a config file
  3. # Copyright (C) 2007 1&1 Internet AG
  4. #
  5. # This file is part of Kamailio, a free SIP server.
  6. #
  7. # Kamailio is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version
  11. #
  12. # Kamailio is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  20. . include/common
  21. . include/require.sh
  22. if ! (check_sipp && check_kamailio && check_module "carrierroute"); then
  23. exit 0
  24. fi ;
  25. CFG=30.cfg
  26. cp $CFG $CFG.bak
  27. # set up config
  28. echo "modparam(\"carrierroute\", \"config_file\", \"carrierroute-2.cfg\")" >> $CFG
  29. $BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null
  30. ret=$?
  31. sleep 1
  32. if [ "$ret" -eq 0 ] ; then
  33. # the distribution is not perfect
  34. sipp -sn uas -bg -i localhost -m 12 -p 7000 &> /dev/null
  35. sipp -sn uas -bg -i localhost -m 12 -p 8000 &> /dev/null
  36. sipp -sn uac -s 49721123456787 127.0.0.1:5060 -i 127.0.0.1 -m 20 -p 5061 &> /dev/null
  37. ret=$?
  38. killall sipp &> /dev/null
  39. fi;
  40. if [ "$ret" -eq 0 ] ; then
  41. sipp -sn uas -bg -i localhost -m 10 -p 9000 &> /dev/null
  42. sipp -sn uac -s 49721123456786 127.0.0.1:5060 -i 127.0.0.1 -m 10 -p 5061 &> /dev/null
  43. ret=$?
  44. fi;
  45. if [ "$ret" -eq 0 ] ; then
  46. sipp -sn uas -bg -i localhost -m 10 -p 10000 &> /dev/null
  47. sipp -sn uac -s 49721123456785 127.0.0.1:5060 -i 127.0.0.1 -m 10 -p 5061 &> /dev/null
  48. ret=$?
  49. fi;
  50. kill_kamailio
  51. killall -9 sipp
  52. mv $CFG.bak $CFG
  53. exit $ret