Hello All,
Sorry that the first post on this list is with a problem, but well, I am using ser for only 2 days.
The problem is the following: I have configured ser using t_on_failure to send a call for PSTN towards a secondary gateway if the first one is failed. These two gateway IP addresses were replaced with gateway1 and gateway2 in config and the ngrep dump, in order to make everything more readable. Everything is fine, except for the following scenario:
- a user, from the device "ata" calls a PSTN number - during the ringing phase, it closes the call - the normal behavior (i think) should be to close the call in ser - what happens in reality is that (as I see in the ngrep log) the call is sent to the failure_route and altough the ata user closed the call, the pstn user is ringed again. of course, if at the second try it answers, the call is closed as the caller is no longer present in the call.
What I want to do was just to send the call to the secondary gateway if the first one does not answer (is dead), but it seems that I got some side effects like the one described there, and probably a few more (like redialing a call that was busy and so on).
Is there any way to try the failure route only when the first route timed out, but not for normal errors (like no answer, busy, hang-up from the caller before answer and so on?). If the first answer is yes, can I add behind the timeout some specific failure causes (like the one that will be sent when the ISDN in the gateway is down?), but not all cancel causes (because a busy for example should not be retried over the backup gateway).
I have attached my config and a ngrep dump.
sip2:/opt/ser/sbin # ser -V version: ser 0.9.4 (i386/linux) flags: STATS: Off, USE_IPV6, USE_TCP, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535 @(#) $Id: main.c,v 1.197.2.1 2005/07/25 16:56:24 andrei Exp $ main.c compiled on 10:24:39 Oct 12 2005 with gcc 3.3.5
-- Victor Stanescu GTS Telecom Romania Senior R&D Engineer [t] +40-31-2200239, +40-31-2200200 [t] +40-21-4025539, +40-21-4100100 [f] +40-31-2200222, +40-21-4103883 [i] http://www.gtstelecom.ro/
# U ata:5060 -> ser:5060 INVITE sip:12345%230312299998@ser:5060 SIP/2.0. Via: SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. Content-Length: 230. To: sip:12345%230312299998@ser:5060. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. CSeq: 613426530 INVITE. Route: sip:ser:5060;lr. Supported: timer. Min-SE: 1800. Session-Expires: 3600. Allow: INVITE, ACK, BYE, CANCEL, REFER, NOTIFY. Content-Type: application/sdp. Contact: victor-sip-line1 sip:0330229998@ata:5060. Supported: replaces. User-Agent: MxSipApp/5.0.7.59 MxSF/v3.2.7.44. . v=0. o=MxSIP 1161439858835651694 777463051104361766 IN IP4 ata. s=-. c=IN IP4 ata. t=0 0. a=sendrecv. m=audio 5004 RTP/AVP 4 8 111. a=rtpmap:4 G723/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:111 X-nt-inforeq/8000.
# U ser:5060 -> ata:5060 SIP/2.0 100 trying -- your call is important to us. Via: SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. To: sip:12345%230312299998@ser:5060. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. CSeq: 613426530 INVITE. Server: Sip EXpress router (0.9.4 (i386/linux)). Content-Length: 0. Warning: 392 ser:5060 "Noisy feedback tells: pid=18625 req_src_ip=ata req_src_port=5060 in_uri=sip:12345%230312299998@ser:5060 out_uri=sip:12345%230312299998@gateway1:5060 via_cnt==1". .
# U ser2:5060 -> gateway1:5060 INVITE sip:12345%230312299998@gateway1:5060 SIP/2.0. Max-Forwards: 10. Record-Route: sip:ser2;r2=on;ftag=8cd4af6254d7f35;lr=on. Record-Route: sip:ser;r2=on;ftag=8cd4af6254d7f35;lr=on. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.0. Via: SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. Content-Length: 230. To: sip:12345%230312299998@ser:5060. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. CSeq: 613426530 INVITE. Supported: timer. Min-SE: 1800. Session-Expires: 3600. Allow: INVITE, ACK, BYE, CANCEL, REFER, NOTIFY. Content-Type: application/sdp. Contact: victor-sip-line1 sip:0330229998@ata:5060. Supported: replaces. User-Agent: MxSipApp/5.0.7.59 MxSF/v3.2.7.44. P-hint: main PSTN route. . v=0. o=MxSIP 1161439858835651694 777463051104361766 IN IP4 ata. s=-. c=IN IP4 ata. t=0 0. a=sendrecv. m=audio 5004 RTP/AVP 4 8 111. a=rtpmap:4 G723/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:111 X-nt-inforeq/8000.
# U gateway1:5060 -> ser2:5060 SIP/2.0 100 Trying. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.0,SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060;tag=95509674-1ABE. Date: Thu, 13 Oct 2005 08:37:05 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 613426530 INVITE. Allow-Events: telephone-event. Content-Length: 0. .
# U gateway1:5060 -> ser2:5060 SIP/2.0 183 Session Progress. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.0,SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060;tag=95509674-1ABE. Date: Thu, 13 Oct 2005 08:37:05 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 613426530 INVITE. Allow-Events: telephone-event. Contact: sip:12345%230312299998@gateway1:5060. Record-Route: sip:ser2;r2=on;ftag=8cd4af6254d7f35;lr=on,sip:ser;r2=on;ftag=8cd4af6254d7f35;lr=on. Content-Disposition: session;handling=required. Content-Type: application/sdp. Content-Length: 206. . v=0. o=CiscoSystemsSIP-GW-UserAgent 6300 8439 IN IP4 gateway1. s=SIP Call. c=IN IP4 gateway1. t=0 0. m=audio 19264 RTP/AVP 4. c=IN IP4 gateway1. a=rtpmap:4 G723/8000. a=fmtp:4 annexa=yes.
# U ser:5060 -> ata:5060 SIP/2.0 183 Session Progress. Via: SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060;tag=95509674-1ABE. Date: Thu, 13 Oct 2005 08:37:05 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 613426530 INVITE. Allow-Events: telephone-event. Contact: sip:12345%230312299998@gateway1:5060. Record-Route: sip:ser2;r2=on;ftag=8cd4af6254d7f35;lr=on,sip:ser;r2=on;ftag=8cd4af6254d7f35;lr=on. Content-Disposition: session;handling=required. Content-Type: application/sdp. Content-Length: 206. . v=0. o=CiscoSystemsSIP-GW-UserAgent 6300 8439 IN IP4 gateway1. s=SIP Call. c=IN IP4 gateway1. t=0 0. m=audio 19264 RTP/AVP 4. c=IN IP4 gateway1. a=rtpmap:4 G723/8000. a=fmtp:4 annexa=yes.
# U gateway1:5060 -> ser2:5060 SIP/2.0 180 Ringing. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.0,SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060;tag=95509674-1ABE. Date: Thu, 13 Oct 2005 08:37:05 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 613426530 INVITE. Allow-Events: telephone-event. Contact: sip:12345%230312299998@gateway1:5060. Record-Route: sip:ser2;r2=on;ftag=8cd4af6254d7f35;lr=on,sip:ser;r2=on;ftag=8cd4af6254d7f35;lr=on. Content-Length: 0. .
# U ser:5060 -> ata:5060 SIP/2.0 180 Ringing. Via: SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060;tag=95509674-1ABE. Date: Thu, 13 Oct 2005 08:37:05 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 613426530 INVITE. Allow-Events: telephone-event. Contact: sip:12345%230312299998@gateway1:5060. Record-Route: sip:ser2;r2=on;ftag=8cd4af6254d7f35;lr=on,sip:ser;r2=on;ftag=8cd4af6254d7f35;lr=on. Content-Length: 0. .
# U ata:5060 -> ser:5060 CANCEL sip:12345%230312299998@ser:5060 SIP/2.0. Via: SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. Content-Length: 0. To: sip:12345%230312299998@ser:5060. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. CSeq: 613426530 CANCEL. Route: sip:ser:5060;lr. Supported: timer. Supported: replaces. User-Agent: MxSipApp/5.0.7.59 MxSF/v3.2.7.44. .
# U ser2:5060 -> gateway1:5060 CANCEL sip:12345%230312299998@gateway1:5060 SIP/2.0. Max-Forwards: 10. Record-Route: sip:ser2;r2=on;ftag=8cd4af6254d7f35;lr=on. Record-Route: sip:ser;r2=on;ftag=8cd4af6254d7f35;lr=on. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.0. Via: SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. Content-Length: 0. To: sip:12345%230312299998@ser:5060. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. CSeq: 613426530 CANCEL. Supported: timer. Supported: replaces. User-Agent: MxSipApp/5.0.7.59 MxSF/v3.2.7.44. P-hint: main PSTN route. .
# U ser:5060 -> ata:5060 SIP/2.0 200 canceling. Via: SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. To: sip:12345%230312299998@ser:5060;tag=a6a1c5f60faecf035a1ae5b6e96e979a-7882. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. CSeq: 613426530 CANCEL. Server: Sip EXpress router (0.9.4 (i386/linux)). Content-Length: 0. Warning: 392 ser:5060 "Noisy feedback tells: pid=18615 req_src_ip=ata req_src_port=5060 in_uri=sip:12345%230312299998@ser:5060 out_uri=sip:12345%230312299998@gateway1:5060 via_cnt==1". .
# U gateway1:5060 -> ser2:5060 SIP/2.0 200 OK. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.0,SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060. Date: Thu, 13 Oct 2005 08:37:18 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Content-Length: 0. CSeq: 613426530 CANCEL. .
# U gateway1:5060 -> ser2:5060 SIP/2.0 487 Request Cancelled. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.0,SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060;tag=95509674-1ABE. Date: Thu, 13 Oct 2005 08:37:18 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 613426530 INVITE. Allow-Events: telephone-event. Content-Length: 0. .
# U ser2:5060 -> gateway1:5060 ACK sip:12345%230312299998@gateway1:5060 SIP/2.0. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.0. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. To: sip:12345%230312299998@ser:5060;tag=95509674-1ABE. CSeq: 613426530 ACK. Route: sip:ser:5060;lr. User-Agent: Sip EXpress router(0.9.4 (i386/linux)). Content-Length: 0. .
# U ser2:5060 -> gateway2:5060 INVITE sip:12345%230312299998@gateway2:5060 SIP/2.0. Max-Forwards: 10. Record-Route: sip:ser2;r2=on;ftag=8cd4af6254d7f35;lr=on. Record-Route: sip:ser;r2=on;ftag=8cd4af6254d7f35;lr=on. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.1. Via: SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. Content-Length: 230. To: sip:12345%230312299998@ser:5060. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. CSeq: 613426530 INVITE. Supported: timer. Min-SE: 1800. Session-Expires: 3600. Allow: INVITE, ACK, BYE, CANCEL, REFER, NOTIFY. Content-Type: application/sdp. Contact: victor-sip-line1 sip:0330229998@ata:5060. Supported: replaces. User-Agent: MxSipApp/5.0.7.59 MxSF/v3.2.7.44. P-hint: main PSTN route. P-hint: backup PSTN route. . v=0. o=MxSIP 1161439858835651694 777463051104361766 IN IP4 ata. s=-. c=IN IP4 ata. t=0 0. a=sendrecv. m=audio 5004 RTP/AVP 4 8 111. a=rtpmap:4 G723/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:111 X-nt-inforeq/8000.
# U gateway2:5060 -> ser2:5060 SIP/2.0 100 Trying. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.1,SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060;tag=8B304160-442. Date: Thu, 13 Oct 2005 08:37:18 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 613426530 INVITE. Allow-Events: telephone-event. Content-Length: 0. .
# U gateway2:5060 -> ser2:5060 SIP/2.0 183 Session Progress. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.1,SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060;tag=8B304160-442. Date: Thu, 13 Oct 2005 08:37:18 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 613426530 INVITE. Allow-Events: telephone-event. Contact: sip:12345%230312299998@gateway2:5060. Record-Route: sip:ser2;r2=on;ftag=8cd4af6254d7f35;lr=on,sip:ser;r2=on;ftag=8cd4af6254d7f35;lr=on. Content-Disposition: session;handling=required. Content-Type: application/sdp. Content-Length: 206. . v=0. o=CiscoSystemsSIP-GW-UserAgent 4972 1735 IN IP4 gateway2. s=SIP Call. c=IN IP4 gateway2. t=0 0. m=audio 17972 RTP/AVP 4. c=IN IP4 gateway2. a=rtpmap:4 G723/8000. a=fmtp:4 annexa=yes.
# U ser:5060 -> ata:5060 SIP/2.0 183 Session Progress. Via: SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060;tag=8B304160-442. Date: Thu, 13 Oct 2005 08:37:18 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 613426530 INVITE. Allow-Events: telephone-event. Contact: sip:12345%230312299998@gateway2:5060. Record-Route: sip:ser2;r2=on;ftag=8cd4af6254d7f35;lr=on,sip:ser;r2=on;ftag=8cd4af6254d7f35;lr=on. Content-Disposition: session;handling=required. Content-Type: application/sdp. Content-Length: 206. . v=0. o=CiscoSystemsSIP-GW-UserAgent 4972 1735 IN IP4 gateway2. s=SIP Call. c=IN IP4 gateway2. t=0 0. m=audio 17972 RTP/AVP 4. c=IN IP4 gateway2. a=rtpmap:4 G723/8000. a=fmtp:4 annexa=yes.
# U gateway2:5060 -> ser2:5060 SIP/2.0 180 Ringing. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.1,SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060;tag=8B304160-442. Date: Thu, 13 Oct 2005 08:37:18 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 613426530 INVITE. Allow-Events: telephone-event. Contact: sip:12345%230312299998@gateway2:5060. Record-Route: sip:ser2;r2=on;ftag=8cd4af6254d7f35;lr=on,sip:ser;r2=on;ftag=8cd4af6254d7f35;lr=on. Content-Length: 0. .
# U ser:5060 -> ata:5060 SIP/2.0 180 Ringing. Via: SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060;tag=8B304160-442. Date: Thu, 13 Oct 2005 08:37:18 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 613426530 INVITE. Allow-Events: telephone-event. Contact: sip:12345%230312299998@gateway2:5060. Record-Route: sip:ser2;r2=on;ftag=8cd4af6254d7f35;lr=on,sip:ser;r2=on;ftag=8cd4af6254d7f35;lr=on. Content-Length: 0. .
# U gateway2:5060 -> ser2:5060 SIP/2.0 486 Busy here. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.1,SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060;tag=8B304160-442. Date: Thu, 13 Oct 2005 08:37:18 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 613426530 INVITE. Allow-Events: telephone-event. Content-Length: 0. .
# U ser2:5060 -> gateway2:5060 ACK sip:12345%230312299998@gateway2:5060 SIP/2.0. Via: SIP/2.0/UDP ser2;branch=z9hG4bKd333.8a811104.1. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. To: sip:12345%230312299998@ser:5060;tag=8B304160-442. CSeq: 613426530 ACK. Route: sip:ser:5060;lr. User-Agent: Sip EXpress router(0.9.4 (i386/linux)). Content-Length: 0. .
# U ser:5060 -> ata:5060 SIP/2.0 486 Busy here. Via: SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. To: sip:12345%230312299998@ser:5060;tag=8B304160-442. Date: Thu, 13 Oct 2005 08:37:18 GMT. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 613426530 INVITE. Allow-Events: telephone-event. Content-Length: 0. .
# U ata:5060 -> ser:5060 ACK sip:12345%230312299998@ser:5060 SIP/2.0. Via: SIP/2.0/UDP ata:5060;branch=z9hG4bK5ff8a4489. Content-Length: 0. To: sip:12345%230312299998@ser:5060;tag=8B304160-442. From: victor-sip-line1 sip:0330229998@ser:5060;tag=8cd4af6254d7f35. Call-ID: 82e11618a9116e2353f0e5904525db55@ser. CSeq: 613426530 ACK. Route: sip:ser:5060;lr. User-Agent: MxSipApp/5.0.7.59 MxSF/v3.2.7.44. .
route{ if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); break; }; if (msg:len >= 2048 ) { sl_send_reply("513", "Message too big"); break; };
if (!method=="REGISTER") record_route();
if (loose_route()) { # mark routing logic in request append_hf("P-hint: rr-enforced\r\n"); route(1); break; };
if (!uri==myself) { # mark routing logic in request append_hf("P-hint: outbound\r\n"); route(1); break; };
if (uri==myself) {
if (method=="REGISTER") {
# Uncomment this if you want to use digest authentication if(!src_ip=="other") { if (!www_authorize("gtstelecom.ro", "subscriber")) { www_challenge("gtstelecom.ro", "0"); break; }; save("location"); log("Replicating REGISTER\n"); t_replicate("other", "5060"); } else { save("location"); }; break; };
if (uri=~"^sip:[1-9][0-9]{4}%23[0-9]*" || uri=~"^sip:[1-9][0-9]{4}#[0-9]*") { log("Forwarding to PSTN\n"); rewritehostport("gateway1:5060"); route(2); break; };
lookup("aliases"); if (!uri==myself) { append_hf("P-hint: outbound alias\r\n"); route(1); break; };
# native SIP destinations are handled using our USRLOC DB if (!lookup("location")) { sl_send_reply("404", "Not Found"); break; }; }; append_hf("P-hint: usrloc applied\r\n"); route(1); }
route[1] { # subscribers route setflag(1); if (!t_relay()) { sl_reply_error(); }; }
route[2] { # main PSTN route append_hf("P-hint: main PSTN route\r\n"); t_on_failure("1"); if (!t_relay()) { sl_reply_error(); break; }; }
failure_route[1] { # backup PSTN route append_hf("P-hint: backup PSTN route\r\n"); rewritehostport("gateway2:5060"); append_branch(); t_relay(); }