[Users] Gateway disconnects call after about 10 seconds

Cameron Beattie kjcsb at orcon.net.nz
Thu Apr 13 11:52:28 CEST 2006


I am forwarding calls to a PSTN gateway with authentication provided by the 
UAC module.

The call connects and two-way audio is heard. Then, after about 10 seconds, 
the call is disconnected. If I register a UAC directly with the gateway the 
call continues until either party hangs up but when openSER is in the path 
(just the signalling, not the audio) the call gets disconnected. The gateway 
is reported as Cisco-SIPGateway/IOS-12.x but SER is in front of that i.e. 
(Grandstream<->openSER)<->(SER<->Cisco).

The SIP traffic from the INVITE until the call disconnects is as follows. 
Note that no SIP traffic is seen at the openSER proxy at the point of 
disconnect and the disconnect happens a few seconds after the final ACK:
U 60.234.100.100:5060 -> 147.202.100.100:5060
INVITE sip:006495551122 at beta.domain.co.nz SIP/2.0
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:6495551122 at beta.domain.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>
Contact: <sip:6495551122 at 60.234.100.100>
Supported: replaces
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 INVITE
User-Agent: Grandstream BT100 1.0.6.7
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Type: application/sdp
Content-Length: 360

v=0
o=6495551122 8000 8000 IN IP4 60.234.100.100
s=SIP Call
c=IN IP4 60.234.100.100
t=0 0
m=audio 5004 RTP/AVP 0 8 4 18 2 15 99 9
a=sendrecv
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:4 G723/8000
a=rtpmap:18 G729/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:15 G728/8000
a=rtpmap:99 iLBC/8000
a=fmtp:99 mode=20
a=rtpmap:9 G722/16000
a=ptime:20
 #U 147.202.100.100:5060 -> 60.234.100.100:5060SIP/2.0 100 trying -- your 
call is important to us
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:6495551122 at beta.domain.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 INVITE
Server: OpenSer (1.0.1 (i386/linux))
Content-Length: 0
Warning: 392 147.202.100.100:5060 "Noisy feedback tells:pid=4622 
req_src_ip=60.234.100.100 req_src_port=5060 
in_uri=sip:006495551122 at beta.domain.co.nz 
out_uri=sip:006495551122 at 203.184.100.100 via_cnt==1"

##U 147.202.100.100:5060 -> 203.184.100.100:5060
INVITE sip:006495551122 at 203.184.100.100 SIP/2.0
Record-Route: <sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Via: SIP/2.0/UDP 147.202.100.100;branch=z9hG4bK5493.591f2534.0
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>
Contact: <sip:6495551122 at 60.234.100.100>
Supported: replaces
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 INVITE
User-Agent: Grandstream BT100 1.0.6.7
Max-Forwards: 69
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Type: application/sdp
Content-Length: 360

v=0
o=6495551122 8000 8000 IN IP4 60.234.100.100
s=SIP Call
c=IN IP4 60.234.100.100
t=0 0
m=audio 5004 RTP/AVP 0 8 4 18 2 15 99 9
a=sendrecv
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:4 G723/8000
a=rtpmap:18 G729/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:15 G728/8000
a=rtpmap:99 iLBC/8000
a=fmtp:99 mode=20
a=rtpmap:9 G722/16000
a=ptime:20
####

U 203.184.100.100:5060 -> 147.202.100.100:5060
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 147.202.100.100;branch=z9hG4bK5493.591f2534.0
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: 
<sip:006495551122 at beta.domain.co.nz>;tag=df74dfb1855fc2bffa5454d042443f01.b99c
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 INVITE
Proxy-Authenticate: Digest realm="gateway.co.nz", 
nonce="443b3239652d054daebf907b011b989f20f71fd5"
Server: Sip EXpress router (0.8.14-6 (i386/linux))
Content-Length: 0
Warning: 392 203.184.100.100:5060 "Noisy feedback tells:pid=18054 
req_src_ip=147.202.100.100 req_src_port=5060 
in_uri=sip:006495551122 at 203.184.100.100 
out_uri=sip:006495551122 at gateway.co.nz:5060 via_cnt==2"

#U 147.202.100.100:5060 -> 203.184.100.100:5060
ACK sip:006495551122 at 203.184.100.100 SIP/2.0
Via: SIP/2.0/UDP 147.202.100.100;branch=z9hG4bK5493.591f2534.0
From: <sip:6495551122 at beta.domain.co.nz>;tag=17f4875c4046b39d
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
To: 
<sip:006495551122 at beta.domain.co.nz>;tag=df74dfb1855fc2bffa5454d042443f01.b99c
CSeq: 52471 ACK
User-Agent: OpenSer (1.0.1 (i386/linux))
Content-Length: 0

#U 147.202.100.100:5060 -> 203.184.100.100:5060
INVITE sip:006495551122 at 203.184.100.100 SIP/2.0
Record-Route: <sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Via: SIP/2.0/UDP 147.202.100.100;branch=z9hG4bK5493.591f2534.1
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>
Contact: <sip:6495551122 at 60.234.100.100>
Supported: replaces
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 INVITE
User-Agent: Grandstream BT100 1.0.6.7
Max-Forwards: 69
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Type: application/sdp
Content-Length: 360
Proxy-Authorization: Digest username="645566778", realm="gateway.co.nz", 
nonce="443b3239652d054daebf907b011b989f20f71fd5", 
uri="sip:006495551122 at 203.184.100.100", 
response="8a49e7678e33108ac0771c7eaf60b7ad", algorithm="MD5"

v=0
o=6495551122 8000 8000 IN IP4 60.234.100.100
s=SIP Call
c=IN IP4 60.234.100.100
t=0 0
m=audio 5004 RTP/AVP 0 8 4 18 2 15 99 9
a=sendrecv
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:4 G723/8000
a=rtpmap:18 G729/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:15 G728/8000
a=rtpmap:99 iLBC/8000
a=fmtp:99 mode=20
a=rtpmap:9 G722/16000
a=ptime:20
#####U 203.184.100.100:5060 -> 147.202.100.100:5060
SIP/2.0 100 trying -- your call is important to us
Via: SIP/2.0/UDP 147.202.100.100;branch=z9hG4bK5493.591f2534.1
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 INVITE
Server: Sip EXpress router (0.8.14-6 (i386/linux))
Content-Length: 0
Warning: 392 203.184.100.100:5060 "Noisy feedback tells:pid=18064 
req_src_ip=147.202.100.100 req_src_port=5060 
in_uri=sip:006495551122 at 203.184.100.100 
out_uri=sip:8888095551122 at 202.180.100.100:5060 via_cnt==2"

########U 203.184.100.100:5060 -> 147.202.100.100:5060
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 147.202.100.100;branch=z9hG4bK5493.591f2534.1,SIP/2.0/UDP 
60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Date: Tue, 11 Apr 2006 04:31:09 GMT
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
Server: Cisco-SIPGateway/IOS-12.x
CSeq: 52471 INVITE
Allow-Events: telephone-event
Contact: <sip:8888095551122 at 202.180.100.100:5060>
Record-Route: 
<sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>,<sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Content-Disposition: session;handling=required
Content-Type: application/sdp
Content-Length: 211

v=0
o=CiscoSystemsSIP-GW-UserAgent 8327 3527 IN IP4 202.180.100.100
s=SIP Call
c=IN IP4 203.184.100.100
t=0 0
m=audio 35366 RTP/AVP 0
c=IN IP4 203.184.100.100
a=rtpmap:0 PCMU/8000
a=ptime:20
a=nortpproxy:yes
#U 147.202.100.100:5060 -> 60.234.100.100:5060
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Date: Tue, 11 Apr 2006 04:31:09 GMT
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
Server: Cisco-SIPGateway/IOS-12.x
CSeq: 52471 INVITE
Allow-Events: telephone-event
Contact: <sip:8888095551122 at 202.180.100.100:5060>
Record-Route: 
<sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>,<sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Content-Disposition: session;handling=required
Content-Type: application/sdp
Content-Length: 211

v=0
o=CiscoSystemsSIP-GW-UserAgent 8327 3527 IN IP4 202.180.100.100
s=SIP Call
c=IN IP4 203.184.100.100
t=0 0
m=audio 35366 RTP/AVP 0
c=IN IP4 203.184.100.100
a=rtpmap:0 PCMU/8000
a=ptime:20
a=nortpproxy:yes
 #############################################

U 203.184.100.100:5060 -> 147.202.100.100:5060
SIP/2.0 200 OK
Via: SIP/2.0/UDP 147.202.100.100;branch=z9hG4bK5493.591f2534.1,SIP/2.0/UDP 
60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Date: Tue, 11 Apr 2006 04:31:09 GMT
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
Server: Cisco-SIPGateway/IOS-12.x
CSeq: 52471 INVITE
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, 
NOTIFY, INFO
Allow-Events: telephone-event
Contact: <sip:8888095551122 at 202.180.100.100:5060>
Record-Route: 
<sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>,<sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Content-Type: application/sdp
Content-Length: 211

v=0
o=CiscoSystemsSIP-GW-UserAgent 8327 3527 IN IP4 202.180.100.100
s=SIP Call
c=IN IP4 203.184.100.100
t=0 0
m=audio 35366 RTP/AVP 0
c=IN IP4 203.184.100.100
a=rtpmap:0 PCMU/8000
a=ptime:20
a=nortpproxy:yes

#U 147.202.100.100:5060 -> 60.234.100.100:5060
SIP/2.0 200 OK
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Date: Tue, 11 Apr 2006 04:31:09 GMT
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
Server: Cisco-SIPGateway/IOS-12.x
CSeq: 52471 INVITE
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, 
NOTIFY, INFO
Allow-Events: telephone-event
Contact: <sip:8888095551122 at 202.180.100.100:5060>
Record-Route: 
<sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>,<sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Content-Type: application/sdp
Content-Length: 211

v=0
o=CiscoSystemsSIP-GW-UserAgent 8327 3527 IN IP4 202.180.100.100
s=SIP Call
c=IN IP4 203.184.100.100
t=0 0
m=audio 35366 RTP/AVP 0
c=IN IP4 203.184.100.100
a=rtpmap:0 PCMU/8000
a=ptime:20
a=nortpproxy:yes
 #####
U 60.234.100.100:5060 -> 147.202.100.100:5060
ACK sip:8888095551122 at 202.180.100.100:5060 SIP/2.0
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK0f1649effc02b74c
Route: <sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Route: <sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>
From: <sip:6495551122 at beta.domain.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Contact: <sip:6495551122 at 60.234.100.100>
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 ACK
User-Agent: Grandstream BT100 1.0.6.7
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Length: 0

 #U 147.202.100.100:5060 -> 203.184.100.100:5060
ACK sip:8888095551122 at 202.180.100.100:5060 SIP/2.0
Record-Route: <sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Via: SIP/2.0/UDP 147.202.100.100;branch=0
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK0f1649effc02b74c
Route: <sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>
From: <sip:6495551122 at beta.domain.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Contact: <sip:6495551122 at 60.234.100.100>
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 ACK
User-Agent: Grandstream BT100 1.0.6.7
Max-Forwards: 69
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Length: 0

####U 203.184.100.100:5060 -> 147.202.100.100:5060
SIP/2.0 200 OK
Via: SIP/2.0/UDP 147.202.100.100;branch=z9hG4bK5493.591f2534.1,SIP/2.0/UDP 
60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Date: Tue, 11 Apr 2006 04:31:09 GMT
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
Server: Cisco-SIPGateway/IOS-12.x
CSeq: 52471 INVITE
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, 
NOTIFY, INFO
Allow-Events: telephone-event
Contact: <sip:8888095551122 at 202.180.100.100:5060>
Record-Route: 
<sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>,<sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Content-Type: application/sdp
Content-Length: 211

v=0
o=CiscoSystemsSIP-GW-UserAgent 8327 3527 IN IP4 202.180.100.100
s=SIP Call
c=IN IP4 203.184.100.100
t=0 0
m=audio 35366 RTP/AVP 0
c=IN IP4 203.184.100.100
a=rtpmap:0 PCMU/8000
a=ptime:20
a=nortpproxy:yes
#U 147.202.100.100:5060 -> 60.234.100.100:5060
SIP/2.0 200 OK
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Date: Tue, 11 Apr 2006 04:31:09 GMT
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
Server: Cisco-SIPGateway/IOS-12.x
CSeq: 52471 INVITE
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, 
NOTIFY, INFO
Allow-Events: telephone-event
Contact: <sip:8888095551122 at 202.180.100.100:5060>
Record-Route: 
<sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>,<sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Content-Type: application/sdp
Content-Length: 211

v=0
o=CiscoSystemsSIP-GW-UserAgent 8327 3527 IN IP4 202.180.100.100
s=SIP Call
c=IN IP4 203.184.100.100
t=0 0
m=audio 35366 RTP/AVP 0
c=IN IP4 203.184.100.100
a=rtpmap:0 PCMU/8000
a=ptime:20
a=nortpproxy:yes

 ####U 60.234.100.100:5060 -> 147.202.100.100:5060
ACK sip:8888095551122 at 202.180.100.100:5060 SIP/2.0
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK3ef8f33855e9ca1f
Route: <sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Route: <sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>
From: <sip:6495551122 at beta.domain.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Contact: <sip:6495551122 at 60.234.100.100>
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 ACK
User-Agent: Grandstream BT100 1.0.6.7
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Length: 0

 #U 147.202.100.100:5060 -> 203.184.100.100:5060
ACK sip:8888095551122 at 202.180.100.100:5060 SIP/2.0
Record-Route: <sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Via: SIP/2.0/UDP 147.202.100.100;branch=0
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK3ef8f33855e9ca1f
Route: <sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>
From: <sip:6495551122 at beta.domain.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Contact: <sip:6495551122 at 60.234.100.100>
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 ACK
User-Agent: Grandstream BT100 1.0.6.7
Max-Forwards: 69
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Length: 0

#######

U 203.184.100.100:5060 -> 147.202.100.100:5060
SIP/2.0 200 OK
Via: SIP/2.0/UDP 147.202.100.100;branch=z9hG4bK5493.591f2534.1,SIP/2.0/UDP 
60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Date: Tue, 11 Apr 2006 04:31:09 GMT
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
Server: Cisco-SIPGateway/IOS-12.x
CSeq: 52471 INVITE
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, 
NOTIFY, INFO
Allow-Events: telephone-event
Contact: <sip:8888095551122 at 202.180.100.100:5060>
Record-Route: 
<sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>,<sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Content-Type: application/sdp
Content-Length: 211

v=0
o=CiscoSystemsSIP-GW-UserAgent 8327 3527 IN IP4 202.180.100.100
s=SIP Call
c=IN IP4 203.184.100.100
t=0 0
m=audio 35366 RTP/AVP 0
c=IN IP4 203.184.100.100
a=rtpmap:0 PCMU/8000
a=ptime:20
a=nortpproxy:yes

#U 147.202.100.100:5060 -> 60.234.100.100:5060
SIP/2.0 200 OK
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Date: Tue, 11 Apr 2006 04:31:09 GMT
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
Server: Cisco-SIPGateway/IOS-12.x
CSeq: 52471 INVITE
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, 
NOTIFY, INFO
Allow-Events: telephone-event
Contact: <sip:8888095551122 at 202.180.100.100:5060>
Record-Route: 
<sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>,<sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Content-Type: application/sdp
Content-Length: 211

v=0
o=CiscoSystemsSIP-GW-UserAgent 8327 3527 IN IP4 202.180.100.100
s=SIP Call
c=IN IP4 203.184.100.100
t=0 0
m=audio 35366 RTP/AVP 0
c=IN IP4 203.184.100.100
a=rtpmap:0 PCMU/8000
a=ptime:20
a=nortpproxy:yes

 ####U 60.234.100.100:5060 -> 147.202.100.100:5060
ACK sip:8888095551122 at 202.180.100.100:5060 SIP/2.0
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK66362c003682c65c
Route: <sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Route: <sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>
From: <sip:6495551122 at beta.domain.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Contact: <sip:6495551122 at 60.234.100.100>
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 ACK
User-Agent: Grandstream BT100 1.0.6.7
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Length: 0

 #U 147.202.100.100:5060 -> 203.184.100.100:5060
ACK sip:8888095551122 at 202.180.100.100:5060 SIP/2.0
Record-Route: <sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Via: SIP/2.0/UDP 147.202.100.100;branch=0
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK66362c003682c65c
Route: <sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>
From: <sip:6495551122 at beta.domain.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Contact: <sip:6495551122 at 60.234.100.100>
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 ACK
User-Agent: Grandstream BT100 1.0.6.7
Max-Forwards: 69
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Length: 0

##############

U 203.184.100.100:5060 -> 147.202.100.100:5060
SIP/2.0 200 OK
Via: SIP/2.0/UDP 147.202.100.100;branch=z9hG4bK5493.591f2534.1,SIP/2.0/UDP 
60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Date: Tue, 11 Apr 2006 04:31:09 GMT
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
Server: Cisco-SIPGateway/IOS-12.x
CSeq: 52471 INVITE
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, 
NOTIFY, INFO
Allow-Events: telephone-event
Contact: <sip:8888095551122 at 202.180.100.100:5060>
Record-Route: 
<sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>,<sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Content-Type: application/sdp
Content-Length: 211

v=0
o=CiscoSystemsSIP-GW-UserAgent 8327 3527 IN IP4 202.180.100.100
s=SIP Call
c=IN IP4 203.184.100.100
t=0 0
m=audio 35366 RTP/AVP 0
c=IN IP4 203.184.100.100
a=rtpmap:0 PCMU/8000
a=ptime:20
a=nortpproxy:yes
#U 147.202.100.100:5060 -> 60.234.100.100:5060
SIP/2.0 200 OK
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bK2936917715c397f4
From: <sip:645566778 at gateway.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Date: Tue, 11 Apr 2006 04:31:09 GMT
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
Server: Cisco-SIPGateway/IOS-12.x
CSeq: 52471 INVITE
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, 
NOTIFY, INFO
Allow-Events: telephone-event
Contact: <sip:8888095551122 at 202.180.100.100:5060>
Record-Route: 
<sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>,<sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Content-Type: application/sdp
Content-Length: 211

v=0
o=CiscoSystemsSIP-GW-UserAgent 8327 3527 IN IP4 202.180.100.100
s=SIP Call
c=IN IP4 203.184.100.100
t=0 0
m=audio 35366 RTP/AVP 0
c=IN IP4 203.184.100.100
a=rtpmap:0 PCMU/8000
a=ptime:20
a=nortpproxy:yes

 #####U 60.234.100.100:5060 -> 147.202.100.100:5060
ACK sip:8888095551122 at 202.180.100.100:5060 SIP/2.0
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bKf4eefea8493b1705
Route: <sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Route: <sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>
From: <sip:6495551122 at beta.domain.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Contact: <sip:6495551122 at 60.234.100.100>
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 ACK
User-Agent: Grandstream BT100 1.0.6.7
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Length: 0

 #U 147.202.100.100:5060 -> 203.184.100.100:5060
ACK sip:8888095551122 at 202.180.100.100:5060 SIP/2.0
Record-Route: <sip:147.202.100.100;ftag=17f4875c4046b39d;lr=on>
Via: SIP/2.0/UDP 147.202.100.100;branch=0
Via: SIP/2.0/UDP 60.234.100.100;branch=z9hG4bKf4eefea8493b1705
Route: <sip:006495551122 at 203.184.100.100;ftag=17f4875c4046b39d;lr=on>
From: <sip:6495551122 at beta.domain.co.nz>;tag=17f4875c4046b39d
To: <sip:006495551122 at beta.domain.co.nz>;tag=3DD382F8-2296
Contact: <sip:6495551122 at 60.234.100.100>
Call-ID: 90fb36fc2ad0ad5a at 192.168.0.11
CSeq: 52471 ACK
User-Agent: Grandstream BT100 1.0.6.7
Max-Forwards: 69
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Length: 0

Relevant parts of openSER.cfg:
route {

 # -----------------------------------------------------------------
 # Sanity Check Section
 # -----------------------------------------------------------------
 if (!mf_process_maxfwd_header("10")) {
  sl_send_reply("483", "Too Many Hops");
  return;
 };

 if (msg:len > max_len) {
  sl_send_reply("513", "Message Overflow");
  return;
 };

 # -----------------------------------------------------------------
 # Record Route Section
 # -----------------------------------------------------------------
 #If it's an INVITE & client is NATed,
 #f (method=="INVITE" && client_nat_test("3")) {
  #Record-route and specify the record-route header explicitly
  record_route_preset("147.202.100.100:5060;nat=yes"); # insert IP address
 #If not Nated and not REGISTER then normal record-route
 } else if (method!="REGISTER") {
  record_route();
 };

 # -----------------------------------------------------------------
 # Call Tear Down Section
 # -----------------------------------------------------------------
 if (method=="BYE" || method=="CANCEL") {
  setflag(1);
  #call end_media_session in case we're proxying media
  end_media_session();
 };

 # -----------------------------------------------------------------
 # Loose Route Section
 # -----------------------------------------------------------------
 if (loose_route()) {
  #Ensure we are dealing with a re-INVITE. Only connected calls have tag=
  if (has_totag() && (method=="INVITE"  || method=="ACK")) {
   #check client is nated or that we've already identified it's nated
   if (client_nat_test("3") || search("^Route:.*;nat=yes")) {
    setflag(6);
    use_media_proxy();
   };
  };

  route(1);
  return;
 };

 # -----------------------------------------------------------------
 # Call Type Processing Section
 # -----------------------------------------------------------------

 if (uri!=myself) {
  route(5);
  route(1);
  return;
 };

 if (uri==myself) {

  if (method=="ACK") {
   route(6);
   return;
  } else if (method=="CANCEL") {
   route(1);
   return;
  } else if (method=="INVITE") {
   route(3);
   return;
  } else  if (method=="REGISTER") {
   route(2);
   return;
  };

  lookup("aliases");
  if (uri!=myself) {
   route(5);
   route(1);
   return;
  };

  if (!lookup("location")) {
   sl_send_reply("404", "User Not Found");
   return;
  };
 };

 route(1);

}

route[1] {

 # -----------------------------------------------------------------
 # Default Message Handler
 # -----------------------------------------------------------------

 #Call reply_route(1) to intercept response messages heading to the client
 t_on_reply("1");
 #Try to relay the message
 if (!t_relay()) {
  #If it can't and it's an INVITE or ACK end the media proxying
  if (method=="INVITE" || method=="ACK") {
   end_media_session();
  };

  sl_reply_error();
 };
}

route[2] {

 # -----------------------------------------------------------------
 # REGISTER Message Handler
 # ----------------------------------------------------------------

 sl_send_reply("100", "Trying");
 log(1,"route[2] (Register handler");

 #Ensure that the SIP message contains a Contact: header
 #If so and client is Nated
 if (!search("^Contact:[ ]*\*") && client_nat_test("7")) {
  setflag(6);
  #Appends parameters to Contact header URI
  fix_nated_register();
  #Adds received IP port to top most via header
  #This enables subsequent SIP messages to return to the correct port
  force_rport();
 };

 if (!www_authorize("","subscriber")) {
  www_challenge("","0");
  return;
 };

 if (!check_to()) {
  sl_send_reply("401", "Unauthorized");
  return;
 };

 consume_credentials();

 if (!save("location")) {
  sl_reply_error();
 };
}

route[3] {

 # -----------------------------------------------------------------
 # INVITE Message Handler
 # -----------------------------------------------------------------

 #Is message sender behind NAT?
 if (client_nat_test("3")) {
  #If so then setflag7
  setflag(7);
  force_rport();
  #Rewrite Contact: header to contain Sip client's public IP:port
  fix_nated_contact();
 };

 if (!allow_trusted() && !is_uri_host_local()) {
# if (method=="INVITE") {
  if (!proxy_authorize("","subscriber")) {
   proxy_challenge("","0");
   return;
  } else if (!check_from()) {
   sl_send_reply("403", "Use From=ID");
   return;
  };

  consume_credentials();
 };

 lookup("aliases");
 if (uri!=myself) {
  #Enable mediaproxy if needed
  route(5);
  #Send message to destination
  route(1);
  return;
 };

 if (uri=~"^sip:(\+|00|011)[0-9]*@") { # International PSTN
  log(1,"international PSTN match");
  route(4);
  return;
 };

 if (!lookup("location")) {
  if (uri=~"^sip:[0-9]{11}@") { # Domestic(US) PSTN
   route(4);
   return;
  };

  sl_send_reply("404", "User Not Found");
  return;
 };

 if (method=="CANCEL") {
  route(1);
  return;
 };

 #Set accounting flags
 setflag(1);
 setflag(3);

 route(5);
        log(1,"route(5) called from from route(3)");
 route(1);
}

route[4] {

 # -----------------------------------------------------------------
 # PSTN Handler
 # -----------------------------------------------------------------

 #UAC module routing#
        t_on_failure("1");
        resetflag(9);
 log(1,"resetflag(9)");
 uac_replace_from("sip:645566778 at gateway.co.nz");
 rewritehost("203.184.100.100");
 log(1,"host rewritten");

 avp_write("i:45", "inv_timeout");

 setflag(1);
 setflag(3);

 route(5);
        log(1,"route(5) called from from route(4)");
 route(1);
}

route[5] {

 # -----------------------------------------------------------------
 # NAT traversal
 # -----------------------------------------------------------------

 #check whether message sender(7) or recipient(6) is Nated
 if (isflagset(6) || isflagset(7)) {
  #If so then proxy media
  log(1,"using media proxy in route(5)");
  use_media_proxy();
 };
}

route[6] {

 # ------------------------------------------------------------------------
 # ACK Handler
 # ------------------------------------------------------------------------

 # ------------------------------------------------------------------------
 # Aliases Section
 # ------------------------------------------------------------------------
 lookup("aliases");
 if (uri!=myself) {
  route(5);
  route(1);
  return;
 };

 lookup("location");

 route(1);
}

onreply_route[1]
#Handles message that are returned to the sender i.e. response to caller's 
original request
{
 if ((isflagset(6) || isflagset(7)) && (status=~"(180)|(183)|2[0-9][0-9]")) 
{

  #Check the SDP payload length. Assume if we have something we can call 
mediaproxy
  if (!search("^Content-Length:[ ]*0")) {
   log(1,"using media proxy in onreply_route(1)");
   use_media_proxy();
  };
 };

 if (client_nat_test("1")) {
  fix_nated_contact();
 };
}

failure_route[1]
{
 log(1,"hit failure_route[1]");
 if (t_check_status("401|407"))
 {
  log(1,"status is 401 or 407");
  if (isflagset(9))
  {
   log(1,"flag9 is set");
   t_reply("503","Authentication failed");
   return;
  }
  if (uac_auth())
  { log(1, "called uac_auth");
   setflag(9);
   t_on_failure("1");
   append_branch();
   #t_relay();
   log(1, "calling route(1) from failure_route");
   route(1);
  }
 }
}





More information about the Users mailing list