#++++++++++++++++++++++++++++++++++++++++++++ # # opensips IP = xx.xx.xx.23 # # PSTN IP = 12.34.56.78 # # gateways = dd.dd.dd.250 dd.dd.dd.251 # #++++++++++++++++++++++++++++++++++++++++++++ # # PSTN sends voip calls (sip2) to me with ... # # tech prefix = 1000 # destination = 12121112222 # cli = 12125551212 # # [NOTE: destination is local PSTN DID. PSTN has tech prefix 1000. # cli can by from office PBX, so could have 23 calls with # same origination information and termination information.] # #++++++++++++++++++++++++++++++++++++++++++++ # # select * from load_balancer; # +----+----------+------------------+-----------+------------+-------------+ # | id | group_id | dst_uri | resources | probe_mode | description | # +----+----------+------------------+-----------+------------+-------------+ # | 1 | 1 | sip:dd.dd.dd.250 | amity=23 | 2 | amity1 | # | 2 | 1 | sip:dd.dd.dd.251 | amity=23 | 2 | amity2 | # +----+----------+------------------+-----------+------------+-------------+ # #++++++++++++++++++++++++++++++++++++++++++++ # - - - - - - - - - - - - - - - - - - # BEGIN Route Script # - - - - - - - - - - - - - - - - - - route{ if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; } if (has_totag()) { loose_route(); t_relay(); exit; } record_route(); if (is_method("CANCEL")) { if (t_check_trans()) t_relay(); exit; } if (!is_method("INVITE")) { send_reply("405","Not Allowed"); exit; } # Routing based on load_balancer and probing (pinging). if (is_method("INVITE")) { if ( load_balance("1","amity") ) { t_on_failure("1"); xlog("...route[]...Sending Call To: $du\n"); t_relay(); } else { xlog("...route[]...Load Balance Returned Full or Error\n"); t_reply("500","Service Full"); } } } failure_route[1] { if (t_was_cancelled()) { exit; } # There was a failure... Disable the GW and grab an available GW. if (t_check_status("[3-6][0-9][0-9]")) { lb_disable(); if ( load_balance("1","amity") ) { t_on_failure("1"); xlog("...failure_route[1]...Sending Call To: $du\n"); t_relay(); } else { xlog("Load Balance Returned Full or Error\n"); xlog("...failure_route[1]...Load Balance Returned Full or Error\n"); t_reply("500","Service Full"); } } } # - - - - - - - - - - - - - - - - - - # END Route Script # - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - # BEGIN opensips trace # - - - - - - - - - - - - - - - - - - # U 2012/01/11 21:51:05.619802 12.34.56.78:49697 -> xx.xx.xx.23:5060 INVITE sip:100012121112222@xx.xx.xx.23:5060 SIP/2.0. Via: SIP/2.0/UDP 12.34.56.78:5060. From: ;tag=F08DF710-E74. To: . Date: Fri, 26 Aug 1994 19:31:45 GMT. Call-ID: 2F60A9CA-C04311CD-9FD5A686-5E9CD136@12.34.56.78. Supported: timer,100rel. Min-SE: 1800. Cisco-Guid: 794784122-3225620941-2681382534-1587335478. User-Agent: Cisco-SIPGateway/IOS-12.x. Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO. CSeq: 101 INVITE. Max-Forwards: 6. Remote-Party-ID: ;party=calling;screen=yes;privacy=off. Timestamp: 777929505. Contact: . Expires: 180. Allow-Events: telephone-event. Content-Type: application/sdp. Content-Length: 325. . v=0. o=CiscoSystemsSIP-GW-UserAgent 8155 801 IN IP4 12.34.56.78. s=SIP Call. c=IN IP4 12.34.56.78. t=0 0. m=audio 16918 RTP/AVP 0 8 18 100 19. c=IN IP4 12.34.56.78. a=rtpmap:0 PCMU/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:18 G729/8000. a=fmtp:18 annexb=no. a=rtpmap:100 X-NSE/8000. a=fmtp:100 192-194. a=rtpmap:19 CN/8000. # U 2012/01/11 21:51:05.620004 xx.xx.xx.23:5060 -> 12.34.56.78:5060 SIP/2.0 100 Giving a try. Via: SIP/2.0/UDP 12.34.56.78:5060. From: ;tag=F08DF710-E74. To: . Call-ID: 2F60A9CA-C04311CD-9FD5A686-5E9CD136@12.34.56.78. CSeq: 101 INVITE. Server: OpenSIPS Proxy Test 1.7.1. Content-Length: 0. . # U 2012/01/11 21:51:05.620052 xx.xx.xx.23:5060 -> dd.dd.dd.250:5060 INVITE sip:100012121112222@xx.xx.xx.23:5060 SIP/2.0. Record-Route: . Via: SIP/2.0/UDP xx.xx.xx.23;branch=z9hG4bK5d6.445830c1.0. Via: SIP/2.0/UDP 12.34.56.78:5060. From: ;tag=F08DF710-E74. To: . Date: Fri, 26 Aug 1994 19:31:45 GMT. Call-ID: 2F60A9CA-C04311CD-9FD5A686-5E9CD136@12.34.56.78. Supported: timer,100rel. Min-SE: 1800. Cisco-Guid: 794784122-3225620941-2681382534-1587335478. User-Agent: Cisco-SIPGateway/IOS-12.x. Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO. CSeq: 101 INVITE. Max-Forwards: 5. Remote-Party-ID: ;party=calling;screen=yes;privacy=off. Timestamp: 777929505. Contact: . Expires: 180. Allow-Events: telephone-event. Content-Type: application/sdp. Content-Length: 325. . v=0. o=CiscoSystemsSIP-GW-UserAgent 8155 801 IN IP4 12.34.56.78. s=SIP Call. c=IN IP4 12.34.56.78. t=0 0. m=audio 16918 RTP/AVP 0 8 18 100 19. c=IN IP4 12.34.56.78. a=rtpmap:0 PCMU/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:18 G729/8000. a=fmtp:18 annexb=no. a=rtpmap:100 X-NSE/8000. a=fmtp:100 192-194. a=rtpmap:19 CN/8000. # U 2012/01/11 21:51:05.682477 dd.dd.dd.250:5060 -> xx.xx.xx.23:5060 SIP/2.0 400 Bad Request - 'Invalid IP Address'. Via: SIP/2.0/UDP xx.xx.xx.23;branch=z9hG4bK5d6.445830c1.0,SIP/2.0/UDP 12.34.56.78:5060. From: ;tag=F08DF710-E74. To: . Date: Fri, 07 Jan 2000 09:46:16 GMT. Call-ID: 2F60A9CA-C04311CD-9FD5A686-5E9CD136@12.34.56.78. Timestamp: 777929505. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 101 INVITE. Allow-Events: telephone-event. Content-Length: 0. . # U 2012/01/11 21:51:05.682524 xx.xx.xx.23:5060 -> dd.dd.dd.250:5060 ACK sip:100012121112222@xx.xx.xx.23:5060 SIP/2.0. Via: SIP/2.0/UDP xx.xx.xx.23;branch=z9hG4bK5d6.445830c1.0. From: ;tag=F08DF710-E74. Call-ID: 2F60A9CA-C04311CD-9FD5A686-5E9CD136@12.34.56.78. To: . CSeq: 101 ACK. Max-Forwards: 70. User-Agent: OpenSIPS Proxy Test 1.7.1. Content-Length: 0. . # U 2012/01/11 21:51:05.682601 xx.xx.xx.23:5060 -> dd.dd.dd.251:5060 INVITE sip:100012121112222@xx.xx.xx.23:5060 SIP/2.0. Record-Route: . Via: SIP/2.0/UDP xx.xx.xx.23;branch=z9hG4bK5d6.445830c1.1. Via: SIP/2.0/UDP 12.34.56.78:5060. From: ;tag=F08DF710-E74. To: . Date: Fri, 26 Aug 1994 19:31:45 GMT. Call-ID: 2F60A9CA-C04311CD-9FD5A686-5E9CD136@12.34.56.78. Supported: timer,100rel. Min-SE: 1800. Cisco-Guid: 794784122-3225620941-2681382534-1587335478. User-Agent: Cisco-SIPGateway/IOS-12.x. Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO. CSeq: 101 INVITE. Max-Forwards: 5. Remote-Party-ID: ;party=calling;screen=yes;privacy=off. Timestamp: 777929505. Contact: . Expires: 180. Allow-Events: telephone-event. Content-Type: application/sdp. Content-Length: 325. . v=0. o=CiscoSystemsSIP-GW-UserAgent 8155 801 IN IP4 12.34.56.78. s=SIP Call. c=IN IP4 12.34.56.78. t=0 0. m=audio 16918 RTP/AVP 0 8 18 100 19. c=IN IP4 12.34.56.78. a=rtpmap:0 PCMU/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:18 G729/8000. a=fmtp:18 annexb=no. a=rtpmap:100 X-NSE/8000. a=fmtp:100 192-194. a=rtpmap:19 CN/8000. # U 2012/01/11 21:51:05.744753 dd.dd.dd.251:5060 -> xx.xx.xx.23:5060 SIP/2.0 400 Bad Request - 'Invalid IP Address'. Via: SIP/2.0/UDP xx.xx.xx.23;branch=z9hG4bK5d6.445830c1.1,SIP/2.0/UDP 12.34.56.78:5060. From: ;tag=F08DF710-E74. To: . Date: Wed, 11 Jan 2012 21:50:03 GMT. Call-ID: 2F60A9CA-C04311CD-9FD5A686-5E9CD136@12.34.56.78. Timestamp: 777929505. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 101 INVITE. Content-Length: 0. . # U 2012/01/11 21:51:05.744796 xx.xx.xx.23:5060 -> dd.dd.dd.251:5060 ACK sip:100012121112222@xx.xx.xx.23:5060 SIP/2.0. Via: SIP/2.0/UDP xx.xx.xx.23;branch=z9hG4bK5d6.445830c1.1. From: ;tag=F08DF710-E74. Call-ID: 2F60A9CA-C04311CD-9FD5A686-5E9CD136@12.34.56.78. To: . CSeq: 101 ACK. Max-Forwards: 70. User-Agent: OpenSIPS Proxy Test 1.7.1. Content-Length: 0. . # U 2012/01/11 21:51:05.744863 xx.xx.xx.23:5060 -> 12.34.56.78:5060 SIP/2.0 500 Service Full. Via: SIP/2.0/UDP 12.34.56.78:5060. From: ;tag=F08DF710-E74. To: ;tag=5cc68c45a4c31281edfbc625b2edf160-f742. Call-ID: 2F60A9CA-C04311CD-9FD5A686-5E9CD136@12.34.56.78. CSeq: 101 INVITE. Server: OpenSIPS Proxy Test 1.7.1. Content-Length: 0. . # - - - - - - - - - - - - - - - - - - # END opensips trace # - - - - - - - - - - - - - - - - - -