Advertisement
Guest User

Untitled

a guest
Jun 25th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. route{
  2. setflag(LOG_FLAG);
  3. sip_trace();
  4.  
  5. if (!mf_process_maxfwd_header("10")) {
  6. send_reply("483","Too Many Hops");
  7. exit;
  8. }
  9.  
  10. # requests for my domain
  11.  
  12. if (is_method("REGISTER")) {
  13. # authenticate the REGISTER requests
  14. if (!www_authorize("", "subscriber")) {
  15. www_challenge("", "0");
  16. exit;
  17. }
  18. if (!db_check_to()) {
  19. send_reply("403","Forbidden auth ID");
  20. exit;
  21. }
  22.  
  23. if (!save("location"))
  24. sl_reply_error();
  25.  
  26. exit;
  27. }
  28.  
  29. if ($rU==NULL) {
  30. # request with no Username in RURI
  31. send_reply("484","Address Incomplete");
  32. exit;
  33. }
  34.  
  35. if (lb_is_destination("$si","$sp") ) {
  36. # request from a LB destination
  37. # we should look to see where this call should be sent
  38. lookup("location");
  39. route(1);
  40. }
  41.  
  42. if (is_method("INVITE")) {
  43. setflag(CDR_FLAG);
  44.  
  45. }
  46.  
  47. # detect resources and do balancing
  48. # PSTN call, but the GWs supports only G711
  49. # for calls without G711, transcoding will be used on the GW
  50. if ( !search_body("G711") ) {
  51. load_balance("1","transc;pstn");
  52. } else {
  53. load_balance("1","pstn");
  54. }
  55.  
  56.  
  57. # LB function returns negative if no suitable destination (for requested resources) is found,
  58. # or if all destinations are full
  59. if ($retcode<0) {
  60. sl_send_reply("500","Service full");
  61. exit;
  62. }
  63.  
  64. # send it out
  65. if (!t_relay()) {
  66. sl_reply_error();
  67. }
  68. }
  69.  
  70. route[1] {
  71. if (!t_relay()) {
  72. sl_reply_error();
  73. };
  74. exit;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement