Trying and ACK udp SIP packets ignored on call transfer (pjsip) - udp

I want to transfer the call from one AGI controlled context to another endpoint.
That is. I have a cisco gateway initiated call given to my asterisk configuration which handles some tree logic with AGI and eventually transfers the call to another endpoint (vbox)
cisco(62.15.164.62)->
asterisk(62.12.240.121)-> do some AGI then transfer to vbox
vbox(62.15.164.65)
The problem is when the transfer happens. Somehow the TRYING and OK SIP packets from vbox are ignored by asterisk as they are not shown in the CLI but are clearly received watching the udp tcpdump. And eventually after my asterisk re-issues the invite packets the call gets dropped as if no trying/ok was received when in fact it was sent and received at the interface level.
Asterisk version 15.5.0
pjsip.conf
[t-udp-m]
type=transport
protocol=udp
bind=62.12.240.121:5060
[gw1]
type=endpoint
transport=t-udp-m
context=civr
disallow=all
allow=ulaw,speex,gsm
aors=gw1
[gw1]
type=identify
endpoint=gw1
match=62.15.164.62
[gw1]
type=aor
max_contacts=2
remove_existing=yes
[vbox]
type=endpoint
transport=t-udp-m
context=civr
disallow=all
allow=ulaw,alaw,gsm,speex
aors=vbox
send_rpid=yes
[vbox]
type=identify
endpoint=vbox
match=62.15.164.65
[vbox]
type=aor
contact=sip:7011#62.15.164.65:5060
max_contacts=1
remove_existing=yes
extensions.conf
[civr]
exten => 7010,1,Answer()
same => n,Agi(/var/www/agi-bin/agi.php)
same => n,Hangup()
[call_center_altitude]
exten => 1,1,Dial(PJSIP/vbox)
same => n,Hangup()
tcpdump
IP 62.15.164.62.61396 > 62.12.240.121.sip: UDP, length 1159
INVITE sip:7010#62.12.240.121:5060 SIP/2.0
Via: SIP/2.0/UDP 62.15.164.62:5060;branch=z9hG4bK4CB8B17BE
From: <sip:0971110799#62.15.164.62>;tag=BD15CD5C-FC6
To: <sip:7010#62.12.240.121>
Date: Tue, 23 Oct 2018 02:00:59 GMT
Call-ID: 524DB3FB-D59E11E8-AAA1E790-46F000BF#62.15.164.62
Supported: 100rel,timer,replaces
Min-SE: 1800
Cisco-Guid: 1380744107-3583906280-2679701539-3944536960
User-Agent: Cisco-SIPGateway/IOS-12.x
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO, UPDATE, REGISTER
CSeq: 101 INVITE
Max-Forwards: 70
Remote-Party-ID: <sip:0971110799#62.15.164.62>;party=calling;screen=yes;privacy=off
Timestamp: 1540260059
Contact: <sip:0971110799#62.15.164.62:5060>
Call-Info: <sip:62.15.164.62:5060>;method="NOTIFY;Event=telephone-event;Duration=2000"
Expires: 180
Allow-Events: telephone-event
Content-Type: application/sdp
Content-Length: 247
v=0
o=CiscoSystemsSIP-GW-UserAgent 1066 6200 IN IP4 62.15.164.62
s=SIP Call
c=IN IP4 62.15.164.62
t=0 0
m=audio 16658 RTP/AVP 0 101
c=IN IP4 62.15.164.62
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
IP 62.12.240.121.sip > 62.15.164.62.61396: UDP, length 326
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 62.15.164.62:5060;rport=61396;received=62.15.164.62;branch=z9hG4bK4CB8B17BE
Call-ID: 524DB3FB-D59E11E8-AAA1E790-46F000BF#62.15.164.62
From: <sip:0971110799#62.15.164.62>;tag=BD15CD5C-FC6
To: <sip:7010#62.12.240.121>
CSeq: 101 INVITE
Server: Asterisk PBX 15.5.0
Content-Length: 0
IP 62.12.240.121.sip > 62.15.164.62.61396: UDP, length 818
SIP/2.0 200 OK
Via: SIP/2.0/UDP 62.15.164.62:5060;rport=61396;received=62.15.164.62;branch=z9hG4bK4CB8B17BE
Call-ID: 524DB3FB-D59E11E8-AAA1E790-46F000BF#62.15.164.62
From: <sip:0971110799#62.15.164.62>;tag=BD15CD5C-FC6
To: <sip:7010#62.12.240.121>;tag=3780211b-39df-482f-8b48-b0ca039a65b2
CSeq: 101 INVITE
Server: Asterisk PBX 15.5.0
Contact: <sip:62.12.240.121:5060>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length: 227
v=0
o=- 1066 6202 IN IP4 62.12.240.121
s=Asterisk
c=IN IP4 62.12.240.121
t=0 0
m=audio 26188 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
IP 62.15.164.62.61396 > 62.12.240.121.sip: UDP, length 371
ACK sip:62.12.240.121:5060 SIP/2.0
Via: SIP/2.0/UDP 62.15.164.62:5060;branch=z9hG4bK4CB8CF50
From: <sip:0971110799#62.15.164.62>;tag=BD15CD5C-FC6
To: <sip:7010#62.12.240.121>;tag=3780211b-39df-482f-8b48-b0ca039a65b2
Date: Tue, 23 Oct 2018 02:00:59 GMT
Call-ID: 524DB3FB-D59E11E8-AAA1E790-46F000BF#62.15.164.62
Max-Forwards: 70
CSeq: 101 ACK
Content-Length: 0
!!!! The problem starts here.....
IP 62.12.240.121.sip > 62.15.164.65.sip: UDP, length 1068
INVITE sip:7011#62.15.164.65:5060 SIP/2.0
Via: SIP/2.0/UDP 62.12.240.121:5060;rport;branch=z9hG4bKPj702bedc6-b346-44b2-8cc1-bbdffcb75a89
From: <sip:00008577751000971110799#62.12.240.121>;tag=b2e6cd02-127c-42ca-a51a-f98cb26329aa
To: <sip:7011#62.15.164.65>
Contact: <sip:asterisk#62.12.240.121:5060>
Call-ID: 6de2b47c-8264-452a-9656-d7d4ed6b731f
CSeq: 11604 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Remote-Party-ID: <sip:00008577751000971110799#62.12.240.121>;privacy=off;screen=no
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0
Content-Type: application/sdp
Content-Length: 312
v=0
o=- 272899537 272899537 IN IP4 62.12.240.121
s=Asterisk
c=IN IP4 62.12.240.121
t=0 0
m=audio 21388 RTP/AVP 0 8 3 110 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:110 speex/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:60
a=sendrecv
IP 62.15.164.65.sip > 62.12.240.121.58140: UDP, length 564
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 62.12.240.121:5060;branch=z9hG4bKPj702bedc6-b346-44b2-8cc1-bbdffcb75a89;received=62.12.240.121;rport=58140
From: <sip:00008577751000971110799#62.12.240.121>;tag=b2e6cd02-127c-42ca-a51a-f98cb26329aa
To: <sip:7011#62.15.164.65>
Call-ID: 6de2b47c-8264-452a-9656-d7d4ed6b731f
CSeq: 11604 INVITE
Server: Altitude vBox
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: <sip:7011#62.15.164.65:5060>
Content-Length: 0
IP 62.15.164.65.sip > 62.12.240.121.58140: UDP, length 859
SIP/2.0 200 OK
Via: SIP/2.0/UDP 62.12.240.121:5060;branch=z9hG4bKPj702bedc6-b346-44b2-8cc1-bbdffcb75a89;received=62.12.240.121;rport=58140
From: <sip:00008577751000971110799#62.12.240.121>;tag=b2e6cd02-127c-42ca-a51a-f98cb26329aa
To: <sip:7011#62.15.164.65>;tag=as1dce0520
Call-ID: 6de2b47c-8264-452a-9656-d7d4ed6b731f
CSeq: 11604 INVITE
Server: Altitude vBox
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: <sip:7011#62.15.164.65:5060>
Content-Type: application/sdp
Content-Length: 251
v=0
o=root 140358089 140358089 IN IP4 62.15.164.65
s=Altitude vBox
c=IN IP4 62.15.164.65
t=0 0
m=audio 25364 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
!!!! As you can see, the last 2 packets were ignored by my asterisk configuration and so it re-issued the INVITE packets...
IP 62.12.240.121.sip > 62.15.164.65.sip: UDP, length 1068
INVITE sip:7011#62.15.164.65:5060 SIP/2.0
Via: SIP/2.0/UDP 62.12.240.121:5060;rport;branch=z9hG4bKPj702bedc6-b346-44b2-8cc1-bbdffcb75a89
From: <sip:00008577751000971110799#62.12.240.121>;tag=b2e6cd02-127c-42ca-a51a-f98cb26329aa
To: <sip:7011#62.15.164.65>
Contact: <sip:asterisk#62.12.240.121:5060>
Call-ID: 6de2b47c-8264-452a-9656-d7d4ed6b731f
CSeq: 11604 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Remote-Party-ID: <sip:00008577751000971110799#62.12.240.121>;privacy=off;screen=no
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0
Content-Type: application/sdp
Content-Length: 312
v=0
o=- 272899537 272899537 IN IP4 62.12.240.121
s=Asterisk
c=IN IP4 62.12.240.121
t=0 0
m=audio 21388 RTP/AVP 0 8 3 110 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:110 speex/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:60
a=sendrecv
Which eventually led to a dropped call.
CLI Output
<--- Received SIP request (1159 bytes) from UDP:62.15.164.62:61396 --->
<INVITE data same as in tcpdump>
== Setting global variable 'SIPDOMAIN' to '62.12.240.121'
<--- Transmitting SIP response (326 bytes) to UDP:62.15.164.62:61396 --->
<TRYING data same as in tcpdump>
-- Executing [7010#civr:1] Answer("PJSIP/gw1-00000022", "") in new stack
> 0x7f707c019640 -- Strict RTP learning after remote address set to: 62.15.164.62:16658
<--- Transmitting SIP response (818 bytes) to UDP:62.15.164.62:61396 --->
<OK data same as in tcpdump>
<--- Received SIP request (371 bytes) from UDP:62.15.164.62:61396 --->
<ACK data same as in tcpdump>
> 0x7f707c019640 -- Strict RTP switching to RTP target address 62.15.164.62:16658 as source
-- Executing [7010#civr:8] AGI("PJSIP/gw1-00000022", "/var/www/agi-bin/agi.php") in new stack
-- Launched AGI Script /var/www/agi-bin/agi.php
<PJSIP/gw1-00000022>AGI Tx >> agi_request: /var/www/agi-bin/agi.php
<PJSIP/gw1-00000022>AGI Tx >> agi_channel: PJSIP/gw1-00000022
<PJSIP/gw1-00000022>AGI Tx >> agi_language: en
<PJSIP/gw1-00000022>AGI Tx >> agi_type: PJSIP
<PJSIP/gw1-00000022>AGI Tx >> agi_uniqueid: 1540257639.63
<PJSIP/gw1-00000022>AGI Tx >> agi_version: 15.5.0
<PJSIP/gw1-00000022>AGI Tx >> agi_callerid: 0971110799
<PJSIP/gw1-00000022>AGI Tx >> agi_calleridname: unknown
<PJSIP/gw1-00000022>AGI Tx >> agi_callingpres: 0
<PJSIP/gw1-00000022>AGI Tx >> agi_callingani2: 0
<PJSIP/gw1-00000022>AGI Tx >> agi_callington: 0
<PJSIP/gw1-00000022>AGI Tx >> agi_callingtns: 0
<PJSIP/gw1-00000022>AGI Tx >> agi_dnid: 7010
<PJSIP/gw1-00000022>AGI Tx >> agi_rdnis: unknown
<PJSIP/gw1-00000022>AGI Tx >> agi_context: civr
<PJSIP/gw1-00000022>AGI Tx >> agi_extension: 7010
<PJSIP/gw1-00000022>AGI Tx >> agi_priority: 8
<PJSIP/gw1-00000022>AGI Tx >> agi_enhanced: 0.0
<PJSIP/gw1-00000022>AGI Tx >> agi_accountcode:
<PJSIP/gw1-00000022>AGI Tx >> agi_threadid: 140122966906624
<PJSIP/gw1-00000022>AGI Tx >>
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-yVABhE ""
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-yVABhE.slin' (escape_digits=) (sample_offset 0) (language 'en')
> 0x7f707c019640 -- Strict RTP learning complete - Locking on source address 62.15.164.62:16658
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0 endpos=47554
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-9pPsxq "1234"
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-9pPsxq.slin' (escape_digits=1234) (sample_offset 0) (language 'en')
<PJSIP/gw1-00000022>AGI Tx >> 200 result=50 endpos=21920
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-zztyOj "12"
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-zztyOj.slin' (escape_digits=12) (sample_offset 0) (language 'en')
<PJSIP/gw1-00000022>AGI Tx >> 200 result=49 endpos=12320
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-FyUq0g "#*0123456789"
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-FyUq0g.slin' (escape_digits=#*0123456789) (sample_offset 0) (language 'en')
<PJSIP/gw1-00000022>AGI Tx >> 200 result=56 endpos=13440
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=53
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=55
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=55
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=55
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=53
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0
<PJSIP/gw1-00000022>AGI Rx << SET CONTEXT call_center_altitude
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0
<PJSIP/gw1-00000022>AGI Rx << SET CALLERID 00008577751000971110799
<PJSIP/gw1-00000022>AGI Tx >> 200 result=1
<PJSIP/gw1-00000022>AGI Rx << SET EXTENSION 1
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0
<PJSIP/gw1-00000022>AGI Rx << SET PRIORITY 1
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-e3ELZu ""
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-e3ELZu.slin' (escape_digits=) (sample_offset 0) (language 'en')
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0 endpos=34697
-- <PJSIP/gw1-00000022>AGI Script /var/www/agi-bin/agi.php completed, returning 0
-- Executing [1#call_center_altitude:1] Dial("PJSIP/gw1-00000022", "PJSIP/vbox") in new stack
-- Called PJSIP/vbox
<--- Transmitting SIP request (1068 bytes) to UDP:62.15.164.65:5060 --->
<INVITE same as in tcpdump>
!!! TRYING and OK SIP packets does not show in the CLI as shown in the tcpdump!!!
There may be something in my asterisk vbox endpoint configuration that I am having wrong.
tcpdump command is tcpdump -nqt -s 0 -A -i eth0 port 5060 where eth0 is the asterisk not receiving the trying/ack on the CLI 62.12.240.121
My... I'll pay you if you can help me here.

I was reading wrong the tcpdump log. It shows that there is NAT going on.
IP 62.12.240.121.sip > 62.15.164.65.sip: UDP, length 1068
IP 62.15.164.65.sip > 62.12.240.121.58140: UDP, length 564
So my asterisk configuration received the SIP packet on port 58140 instead of 5060

Related

One way audio with WebRTC and Asterisk 15

I have two ways audio when calling from a WebRTC client connected to Asterisk to my mobile phone, but when I call from the mobile phone to the WebRTC client the call is established and there is only one way audio: from the WebRTC client to the mobile phone.
I'm using Asterisk 15.6.1 installed on a VPS with static IP, the WebRTC client is a browser softphone using the SIP.js library, and I have a local phone number from Localphone.
My "pjsip.conf" relevant settings are:
[localphone]
type=registration
transport=transport-udp
outbound_auth=localphone
client_uri = sip:12345678#localphone.com:5060
server_uri = sip:localphone.com:5060
auth_rejection_permanent=no
contact_user=12345678
[localphone]
type=auth
auth_type=userpass
username=12345678
password=mypassword
[localphone]
type=aor
max_contacts=100
contact=sip:12345678#localphone.com
[localphone]
type=endpoint
transport=transport-udp
context=localphone-inc
disallow = all
allow = ulaw
allow = alaw
rtcp_mux=yes
ice_support=yes
direct_media=no
from_user=12345678
from_domain=localphone.com
outbound_auth=localphone
aors=localphone
[localphone]
type = identify
endpoint = localphone
match = 140.153.72.56
; This is the WebRTC client
[1652]
type=aor
max_contacts=100
[auth1652]
type=auth
auth_type=userpass
username=1652
password=complicatedpassword
[1652]
type=endpoint
context=localphone-pjsip
aors=1652
auth=auth1652
transport=transport-wss
webrtc=yes
disallow=all
allow=ulaw
allow=alaw
dtls_cert_file=/etc/asterisk/key/asterisk.pem
dtls_private_key=/etc/asterisk/key/asterisk.key
[1652]
type = identify
endpoint = 1652
match = 123.123.123.123 ; the public IP of the VPS
The Asterisk debug log doesn’t show errors. The SIP session looks like this:
<--- Received SIP request (1175 bytes) from UDP:140.153.72.56:5060 --->
INVITE sip:136.46.324.75:5060 SIP/2.0
Record-Route: <sip:140.153.72.56;lr=on;ftag=gK086bb5a7>
Record-Route: <sip:126.219.52.41;lr;ftag=gK086bb5a7>
Via: SIP/2.0/UDP 140.153.72.56;branch=z9hG4bK356c.5360dbb7.0
Via: SIP/2.0/UDP 126.219.52.41:5060;rport=5060;branch=z9hG4bK356c.10463da.0
From: <sip:10782172281#126.219.52.41>;tag=gK086bb5a7
To: <sip:13051079265#localphone.com>;tag=514dc3ba-68ed-42ff-9733-bd65b8ebb7c7
Call-ID: 793253110_109248450#199.199.12.56
CSeq: 63984 INVITE
Max-Forwards: 12
Allow: INVITE,ACK,CANCEL,BYE,REGISTER,REFER,INFO,SUBSCRIBE,NOTIFY,PRACK,UPDATE,OPTIONS,MESSAGE,PUBLISH
Accept: application/sdp, application/isup, application/dtmf, application/dtmf-relay, multipart/mixed
Contact: <sip:126.219.52.41;vbdid=941.29056c13>
Supported: timer
Session-Expires: 1800;refresher=uac
Min-SE: 90
Content-Length: 239
Content-Disposition: session; handling=required
Content-Type: application/sdp
v=0
o=Sonus_UAC 13229 650067 IN IP4 199.199.12.56
s=SIP Media Capabilities
c=IN IP4 199.199.12.54
t=0 0
m=audio 40808 RTP/AVP 0 100
a=rtpmap:0 PCMU/8000
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-15
a=sendrecv
a=maxptime:20
> 0x7fddf001b170 -- Strict RTP learning after remote address set to: 199.199.12.54:40808
<--- Transmitting SIP response (1062 bytes) to UDP:140.153.72.56:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 140.153.72.56;rport=5060;received=140.153.72.56;branch=z9hG4bK356c.5360dbb7.0
Via: SIP/2.0/UDP 126.219.52.41:5060;rport=5060;branch=z9hG4bK356c.10463da.0
Record-Route: <sip:140.153.72.56;lr;ftag=gK086bb5a7>
Record-Route: <sip:126.219.52.41;lr;ftag=gK086bb5a7>
Call-ID: 793253110_109248450#199.199.12.56
From: <sip:10782172281#126.219.52.41>;tag=gK086bb5a7
To: <sip:13051079265#localphone.com>;tag=514dc3ba-68ed-42ff-9733-bd65b8ebb7c7
CSeq: 63984 INVITE
Session-Expires: 1800;refresher=uac
Require: timer
Contact: <sip:136.46.324.75:5060>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, timer, replaces, norefersub
Server: Asterisk PBX 15.6.1
Content-Type: application/sdp
Content-Length: 234
v=0
o=- 13229 650069 IN IP4 136.46.324.75
s=Asterisk
c=IN IP4 136.46.324.75
t=0 0
m=audio 10010 RTP/AVP 0 100
a=rtpmap:0 PCMU/8000
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
> 0x7fddf001b170 -- Strict RTP switching to RTP target address 199.199.12.54:40808 as source
<--- Received SIP request (411 bytes) from UDP:140.153.72.56:5060 --->
ACK sip:136.46.324.75:5060 SIP/2.0
Via: SIP/2.0/UDP 140.153.72.56;branch=z9hG4bK356c.5360dbb7.2
Via: SIP/2.0/UDP 126.219.52.41:5060;rport=5060;branch=z9hG4bK356c.10463da.2
From: <sip:10782172281#126.219.52.41>;tag=gK086bb5a7
To: <sip:13051079265#localphone.com>;tag=514dc3ba-68ed-42ff-9733-bd65b8ebb7c7
Call-ID: 793253110_109248450#199.199.12.56
CSeq: 63984 ACK
Max-Forwards: 12
Content-Length: 0
<--- Received SIP request (428 bytes) from WSS:152.231.162.25:53283 --->
BYE sip:asterisk#mail.example.com:5060;transport=ws SIP/2.0
Via: SIP/2.0/WSS qae9g3ug98cm.invalid;branch=z9hG4bK8418203
Max-Forwards: 70
To: <sip:10782172281#mail.example.com>;tag=46b408fd-815a-49c1-b337-74ee894d6e44
From: "Grant Brandon" <sip:6l78pghi#152.231.162.25>;tag=1l7sldm3o2
Call-ID: 4b8d773b-243b-4e97-9962-efc4d55eb0de
CSeq: 27946 BYE
Supported: outbound
User-Agent: SIP.js/0.7.8
Content-Length: 0
<--- Transmitting SIP response (376 bytes) to WSS:152.231.162.25:53283 --->
SIP/2.0 200 OK
Via: SIP/2.0/WSS qae9g3ug98cm.invalid;rport=53283;received=152.231.162.25;branch=z9hG4bK8418203
Call-ID: 4b8d773b-243b-4e97-9962-efc4d55eb0de
From: "Grant Brandon" <sip:6l78pghi#152.231.162.25>;tag=1l7sldm3o2
To: <sip:10782172281#mail.example.com>;tag=46b408fd-815a-49c1-b337-74ee894d6e44
CSeq: 27946 BYE
Server: Asterisk PBX 15.6.1
Content-Length: 0
-- Channel PJSIP/601-00000003 left 'simple_bridge' basic-bridge <f59afd46-1e16-4f47-9a9d-59c11987cc77>
-- Channel PJSIP/localphone-00000002 left 'simple_bridge' basic-bridge <f59afd46-1e16-4f47-9a9d-59c11987cc77>
== Spawn extension (localphone-pjsip, 601, 1) exited non-zero on 'PJSIP/localphone-00000002'
<--- Transmitting SIP request (487 bytes) to UDP:140.153.72.56:5060 --->
BYE sip:126.219.52.41;vbdid=941.29056c13 SIP/2.0
Via: SIP/2.0/UDP 136.46.324.75:5060;rport;branch=z9hG4bKPjf05b6f33-c9d2-4606-80d5-1e54fc110d40
From: <sip:13051079265#localphone.com>;tag=514dc3ba-68ed-42ff-9733-bd65b8ebb7c7
To: <sip:10782172281#126.219.52.41>;tag=gK086bb5a7
Call-ID: 793253110_109248450#199.199.12.56
CSeq: 13266 BYE
Route: <sip:140.153.72.56;lr;ftag=gK086bb5a7>
Reason: Q.850;cause=16
Max-Forwards: 70
User-Agent: Asterisk PBX 15.6.1
Content-Length: 0
<--- Received SIP response (335 bytes) from UDP:140.153.72.56:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 136.46.324.75:5060;rport=5060;branch=z9hG4bKPjf05b6f33-c9d2-4606-80d5-1e54fc110d40
From: <sip:13051079265#localphone.com>;tag=514dc3ba-68ed-42ff-9733-bd65b8ebb7c7
To: <sip:10782172281#126.219.52.41>;tag=gK086bb5a7
Call-ID: 793253110_109248450#199.199.12.56
CSeq: 13266 BYE
Content-Length: 0
Your help will be appreciated !

Sip Servlet setAttribute mobicent

I'm facing on a problem with the set attribute of a Sip Servlet. I'm trying to send a 200 OK , when I receive another 200 OK from a different source. So I've thought to do in this way:
protected void doInvite(SipServletRequest req) throws ServletException, IOException {
//...
SipSession session = req.getSession();
SipServletResponse response = req.createResponse(200);
session.setAttribute("reqResponse", response);
/...
}
And so, when I receive the 200 ok from the other side:
protected void doSuccessResponse(SipServletResponse resp)
//...
throws ServletException, IOException {
SipServletResponse response = (SipServletResponse) session.getAttribute("reqResponse");
response.send();
//....
}
But when I try to do response.send() I have an error:
[0m[31m09:25:15,956 ERROR [org.mobicents.servlet.sip.core.dispatchers.DispatchTask] (Mobicents-SIP-Servlets-UDPMessageChannelThread-10) Unexpected exception while processing message SIP/2.0 200 Ok
Via: SIP/2.0/UDP localhost:5080;received=127.0.0.1;branch=z9hG4bKa76ae813-561c-40ec-90b3-0cb29839c16f_d9d5d8b1_b843c7c0-2c76-4a9a-87e2-3fd9959601ea
From: "x-lite" <sip:user2#127.0.0.1>;tag=15858376_d7e7552a_d9d5d8b1_a76ae813-561c-40ec-90b3-0cb29839c16f
To: <sip:user1#127.0.0.1:5061>;tag=qGnECUk
Call-ID: 31ad484919b40e2a20d2ef2d28468f8d#127.0.0.1
CSeq: 1 INVITE
User-Agent: Linphone/3.8.5 (belle-sip/1.4.1)
Supported: outbound
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,NOTIFY,MESSAGE,SUBSCRIBE,INFO,UPDATE
Contact: <sip:user1#127.0.0.1:5061>;+sip.instance="<urn:uuid:2fc1acc8-38e5-420e-981e-70d1c82d961f>"
Content-Type: application/sdp
Content-Length: 398
v=0
o=user1 3189 2578 IN IP4 10.1.2.214
s=Talk
c=IN IP4 10.1.2.214
t=0 0
m=audio 7078 RTP/AVPF 96 0
a=rtpmap:96 opus/48000/2
a=fmtp:96 useinbandfec=1; stereo=0; sprop-stereo=0
a=rtcp-fb:* trr-int 5000
m=video 9078 RTP/AVPF 102 103
a=rtpmap:102 VP8/90000
a=rtpmap:103 H264/90000
a=fmtp:103 profile-level-id=42801F
a=rtcp-fb:* trr-int 5000
a=rtcp-fb:102 ccm fir
a=rtcp-fb:103 ccm fir
: org.mobicents.servlet.sip.core.DispatcherException: Unexpected exception while processing response : SIP/2.0 200 Ok
Via: SIP/2.0/UDP localhost:5080;received=127.0.0.1;branch=z9hG4bKa76ae813-561c-40ec-90b3-0cb29839c16f_d9d5d8b1_b843c7c0-2c76-4a9a-87e2-3fd9959601ea
From: "x-lite" <sip:user2#127.0.0.1>;tag=15858376_d7e7552a_d9d5d8b1_a76ae813-561c-40ec-90b3-0cb29839c16f
To: <sip:user1#127.0.0.1:5061>;tag=qGnECUk
Call-ID: 31ad484919b40e2a20d2ef2d28468f8d#127.0.0.1
CSeq: 1 INVITE
User-Agent: Linphone/3.8.5 (belle-sip/1.4.1)
Supported: outbound
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,NOTIFY,MESSAGE,SUBSCRIBE,INFO,UPDATE
Contact: <sip:user1#127.0.0.1:5061>;+sip.instance="<urn:uuid:2fc1acc8-38e5-420e-981e-70d1c82d961f>"
Content-Type: application/sdp
Content-Length: 398
v=0
o=user1 3189 2578 IN IP4 10.1.2.214
s=Talk
c=IN IP4 10.1.2.214
t=0 0
m=audio 7078 RTP/AVPF 96 0
a=rtpmap:96 opus/48000/2
a=fmtp:96 useinbandfec=1; stereo=0; sprop-stereo=0
a=rtcp-fb:* trr-int 5000
m=video 9078 RTP/AVPF 102 103
a=rtpmap:102 VP8/90000
a=rtpmap:103 H264/90000
a=fmtp:103 profile-level-id=42801F
a=rtcp-fb:* trr-int 5000
a=rtcp-fb:102 ccm fir
a=rtcp-fb:103 ccm fir
at org.mobicents.servlet.sip.core.dispatchers.ResponseDispatcher$1.dispatch(ResponseDispatcher.java:491) [sip-servlets-impl-3.0.564.jar:3.0.564]
at org.mobicents.servlet.sip.core.dispatchers.DispatchTask.dispatchAndHandleExceptions(DispatchTask.java:61) [sip-servlets-impl-3.0.564.jar:3.0.564]
at org.mobicents.servlet.sip.core.dispatchers.ResponseDispatcher.dispatchMessage(ResponseDispatcher.java:512) [sip-servlets-impl-3.0.564.jar:3.0.564]
at org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl.processResponse(SipApplicationDispatcherImpl.java:1005) [sip-servlets-impl-3.0.564.jar:3.0.564]
at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:296) [jain-sip-ri-1.2.228.jar:1.2.228]
at gov.nist.javax.sip.SipProviderImpl.handleEvent(SipProviderImpl.java:185) [jain-sip-ri-1.2.228.jar:1.2.228]
at gov.nist.javax.sip.DialogFilter.processResponse(DialogFilter.java:1501) [jain-sip-ri-1.2.228.jar:1.2.228]
at gov.nist.javax.sip.stack.SIPClientTransactionImpl.inviteClientTransaction(SIPClientTransactionImpl.java:896) [jain-sip-ri-1.2.228.jar:1.2.228]
at gov.nist.javax.sip.stack.SIPClientTransactionImpl.processResponse(SIPClientTransactionImpl.java:532) [jain-sip-ri-1.2.228.jar:1.2.228]
at gov.nist.javax.sip.stack.SIPClientTransactionImpl.processResponse(SIPClientTransactionImpl.java:1604) [jain-sip-ri-1.2.228.jar:1.2.228]
at gov.nist.javax.sip.stack.UDPMessageChannel.processMessage(UDPMessageChannel.java:603) [jain-sip-ri-1.2.228.jar:1.2.228]
at gov.nist.javax.sip.stack.UDPMessageChannel.processIncomingDataPacket(UDPMessageChannel.java:512) [jain-sip-ri-1.2.228.jar:1.2.228]
at gov.nist.javax.sip.stack.UDPMessageChannel.run(UDPMessageChannel.java:317) [jain-sip-ri-1.2.228.jar:1.2.228]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_79]
Caused by: java.lang.NullPointerException
at org.mobicents.servlet.sip.example.SimpleSipServlet.doSuccessResponse(SimpleSipServlet.java:151)
at javax.servlet.sip.SipServlet.doResponse(SipServlet.java:274) [sip-servlets-spec-3.0.564.jar:3.0.564]
at org.mobicents.servlet.sip.example.SimpleSipServlet.doResponse(SimpleSipServlet.java:195)
at javax.servlet.sip.SipServlet.service(SipServlet.java:334) [sip-servlets-spec-3.0.564.jar:3.0.564]
at org.mobicents.servlet.sip.core.dispatchers.MessageDispatcher.callServlet(MessageDispatcher.java:458) [sip-servlets-impl-3.0.564.jar:3.0.564]
at org.mobicents.servlet.sip.core.dispatchers.ResponseDispatcher$1.dispatch(ResponseDispatcher.java:479) [sip-servlets-impl-3.0.564.jar:3.0.564]
... 13 more
Can somebody help me to understand where is the error?
Note: I've tried to print in log the 200 ok message and seems there isn't errors, I got it correctly!
Thank you for your help!

Single SIPp script for registration followed by SUBSCRIBE(tcp) wont work

I have call flow:
UAC(tcp) SIPp(tcp)
Regsiter (callid1)
---------------->
401
<---------------
Regsiter
---------------->
200 OK
<---------------
Subscribe (callid2)
-------------->
200 OK
<---------------
The issue is when tcp is enabled, SUBSCRIBE is not received by the SIPp. I can see the wireshark UE is sending SUBSCRIBE.
Also tried with separating the flows(Registration and Subscribe) into two script and with the option -m 1, it didnt work either.
Scripts and log attached.
<?xml version="1.0" encoding="us-ascii"?>
<!--FILE 1 REGISER LEG-->
<scenario name="Init_Reg">
<recv request="REGISTER" crlf="true" >
</recv>
<send>
<![CDATA[
SIP/2.0 401 Unauthorized
[last_Via:]
[last_From:]
[last_To:];tag=1234
[last_Call-ID:]
[last_CSeq:]
WWW-Authenticate:Digest realm="rer.com", nonce="o94MbTY+sd/jVd24yOzbEbIAdsfdAo98ObjI7tsQ=", opaque="drtysywwytewyweyewrterwer",algorithm=AKAv1-MD5, qop="auth"
Content-Length: 0
]]>
</send>
<recv request="REGISTER" crlf="true" >
</recv>
<send>
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=1234
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Expires: 600000
P-Associated-URI: <sip:55#172.16.103.54;user=phone>
Service-Route: 172.16.103.54:5060;lr
Content-Length: 0
]]>
</send>
</scenario>
<!--FILE 2 SUBSCRIBE LEG-->
<?xml version="1.0" encoding="us-ascii"?>
<scenario name="Init_Reg_Subscribe">
<recv request="SUBSCRIBE" crlf="true" >
</recv>
<send>
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=1234
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Expires: 0
Content-Length: 0
]]>
</send>
</scenario>
<!--SIPp Commands-->
#!/bin/bash
#REGISTER bob
./sipp -m 1 172.16.104.54:5060 -p 5060 -i 10.204.21.125 -t t1 -sf TC_8_1_TCP.xml -trace_err
./sipp -m 1 172.16.104.54:5060 -p 5060 -i 10.204.21.125 -t t1 -sf TC_8_1_TCP_SUBS.xml -trace_err

Sip Servlets - Control Not Passed to Next Servlet in Chain

I am working with Mobicents Sip Servlets 3.0.0-SNAPSHOT. I have two servlets configured in the DAR; one to check to see if a third party registration is being attempted, and a second to perform the actual registration. I am finding that when the REGISTER arrives, it is passed to the first servlet (BlockerApp); but when that servlet completes and proxies to the next, that the second servlet (RegApp) is not called. Instead, the first servlet is called again, with the routing directive set to NEW.
Any ideas? Am I missing something?
DAR configuration:
REGISTER=("RegApp","DAR\:From","ORIGINATING","","NO_ROUTE","1"),("BlockerApp","DAR\:From","ORIGINATING","","NO_ROUTE","0")
First Servlet:
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.sip.Proxy;
import javax.servlet.sip.SipServlet;
import javax.servlet.sip.SipServletRequest;
import javax.servlet.sip.SipServletResponse;
import javax.servlet.sip.SipURI;
import org.apache.log4j.Logger;
#javax.servlet.sip.annotation.SipServlet(name = "Blocker", loadOnStartup = 1)
public class Blocker extends SipServlet {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(Blocker.class);
private static final String LOOP_CHECK_HEADER = "X-looping";
#Override
protected void doRegister(SipServletRequest req) throws ServletException,
IOException {
logger.info("######################################################");
logger.info("Blocker");
logger.info("region:" + req.getRegion());
logger.info("routing directive:" + req.getRoutingDirective());
logger.info("subscriber uri:" + req.getSubscriberURI());
logger.info("popped route:" + req.getPoppedRoute());
logger.info("######################################################");
if (req.getHeader(LOOP_CHECK_HEADER) != null
&& !req.getHeader(LOOP_CHECK_HEADER).isEmpty()) {
SipServletResponse resp = req
.createResponse(SipServletResponse.SC_FORBIDDEN);
resp.send();
return;
}
req.addHeader(LOOP_CHECK_HEADER, "1");
String toUser = null;
if (req.getTo().getURI().isSipURI()) {
toUser = ((SipURI) req.getTo().getURI()).getUser();
}
String fromUser = null;
if (req.getFrom().getURI().isSipURI()) {
fromUser = ((SipURI) req.getFrom().getURI()).getUser();
}
if (toUser != null && fromUser != null && toUser.equals(fromUser)) {
Proxy proxy = req.getProxy();
proxy.proxyTo(req.getRequestURI());
} else {
SipServletResponse rsp = req.createResponse(
SipServletResponse.SC_DECLINE,
"No third party registrations accepted");
rsp.send();
}
}
}
Second Servlet:
import java.io.IOException;
import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.sip.Address;
import javax.servlet.sip.SipFactory;
import javax.servlet.sip.SipServlet;
import javax.servlet.sip.SipServletRequest;
import javax.servlet.sip.SipServletResponse;
import javax.servlet.sip.SipURI;
import org.apache.log4j.Logger;
import com.mcleodnet.registrar.business.ContactInformationService;
import com.mcleodnet.registrar.data.ContactUpdate;
#javax.servlet.sip.annotation.SipServlet(name = "Registrar", loadOnStartup = 1)
public class Registrar extends SipServlet {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(Registrar.class);
#EJB(lookup = "java:global/Registrar/RegistrarDatabase/ContactInformationServiceImpl!com.mcleodnet.registrar.business.ContactInformationServiceLocal")
private ContactInformationService cis;
#Resource
SipFactory sipFactory;
#Override
protected void doRegister(SipServletRequest req) throws ServletException,
IOException {
logger.info("######################################################");
logger.info("Registrar");
logger.info("region:" + req.getRegion());
logger.info("routing directive:" + req.getRoutingDirective());
logger.info("subscriber uri:" + req.getSubscriberURI());
logger.info("popped route:" + req.getPoppedRoute());
logger.info("######################################################");
SipServletResponse rsp = req.createResponse(SipServletResponse.SC_OK,
"OK");
Address contactHeader = req.getAddressHeader("contact");
String contactUri = contactHeader.getURI().toString();
String username = null;
if (req.getTo().getURI().isSipURI()) {
username = ((SipURI) req.getTo().getURI()).getUser();
}
int expires = req.getExpires();
if (expires == -1) {
expires = contactHeader.getExpires();
}
if (expires == 0) {
cis.deleteContactInformation(username);
} else {
cis.updateContactInformation(username, new ContactUpdate(
contactUri, expires));
}
rsp.send();
}
}
Log:
11:56:40,296 INFO [gov.nist.javax.sip.stack.SIPTransactionStack] (Mobicents-SIP-Servlets-UDPMessageChannelThread-3) <message
from="192.168.100.125:5090"
to="0.0.0.0:5080"
time="1399921000293"
isSender="false"
transactionId="z9hg4bk-d8754z-7178ee0abc532a51-1---d8754z-"
callId="NjU5YTg5OGRhZjg5YzVjNWEzOWFhYTIyZmJiYjMwZmE"
firstLine="REGISTER sip:192.168.100.136:5080 SIP/2.0"
>
<![CDATA[REGISTER sip:192.168.100.136:5080 SIP/2.0
Via: SIP/2.0/UDP 192.168.100.125:5090;branch=z9hG4bK-d8754z-7178ee0abc532a51-1---d8754z-
Max-Forwards: 70
Contact: <sip:110#192.168.100.125:5090;rinstance=664938eda63f586d;transport=udp>
To: "110" <sip:110#192.168.100.136:5080>
From: "110" <sip:110#192.168.100.136:5080>;tag=52ca933d
Call-ID: NjU5YTg5OGRhZjg5YzVjNWEzOWFhYTIyZmJiYjMwZmE
CSeq: 1 REGISTER
Expires: 60
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,NOTIFY,MESSAGE,SUBSCRIBE,INFO
User-Agent: X-Lite release 4.5.5 stamp 71236
Content-Length: 0
]]>
</message>
11:56:40,297 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-3) ######################################################
11:56:40,298 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-3) Blocker
11:56:40,298 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-3) region:ORIGINATING
11:56:40,298 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-3) routing directive:NEW
11:56:40,299 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-3) subscriber uri:sip:110#192.168.100.136:5080
11:56:40,299 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-3) popped route:null
11:56:40,299 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-3) ######################################################
11:56:40,302 INFO [gov.nist.javax.sip.stack.SIPTransactionStack] (Mobicents-SIP-Servlets-UDPMessageChannelThread-4) <message
from="192.168.100.136:5080"
to="0.0.0.0:5080"
time="1399921000301"
isSender="false"
transactionId="z9hg4bk6ef3edb8-3d39-4b3c-828d-5706b6bce40d_74a2f52c_8017367923679066"
callId="NjU5YTg5OGRhZjg5YzVjNWEzOWFhYTIyZmJiYjMwZmE"
firstLine="REGISTER sip:192.168.100.136:5080 SIP/2.0"
>
<![CDATA[REGISTER sip:192.168.100.136:5080 SIP/2.0
Via: SIP/2.0/UDP 192.168.100.136:5080;branch=z9hG4bK6ef3edb8-3d39-4b3c-828d-5706b6bce40d_74a2f52c_8017367923679066
Via: SIP/2.0/UDP 192.168.100.125:5090;branch=z9hG4bK-d8754z-7178ee0abc532a51-1---d8754z-
Max-Forwards: 69
Contact: <sip:110#192.168.100.125:5090;rinstance=664938eda63f586d;transport=udp>
To: "110" <sip:110#192.168.100.136:5080>
From: "110" <sip:110#192.168.100.136:5080>;tag=52ca933d
Call-ID: NjU5YTg5OGRhZjg5YzVjNWEzOWFhYTIyZmJiYjMwZmE
CSeq: 1 REGISTER
Expires: 60
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,NOTIFY,MESSAGE,SUBSCRIBE,INFO
User-Agent: X-Lite release 4.5.5 stamp 71236
X-looping: 1
Content-Length: 0
]]>
</message>
11:56:40,303 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-4) ######################################################
11:56:40,303 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-4) Blocker
11:56:40,303 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-4) region:ORIGINATING
11:56:40,304 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-4) routing directive:NEW
11:56:40,304 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-4) subscriber uri:sip:110#192.168.100.136:5080
11:56:40,304 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-4) popped route:null
11:56:40,304 INFO [com.mcleodnet.tpblockerapp.Blocker] (Mobicents-SIP-Servlets-UDPMessageChannelThread-4) ######################################################
11:56:40,305 INFO [gov.nist.javax.sip.stack.SIPTransactionStack] (Mobicents-SIP-Servlets-UDPMessageChannelThread-3) <message
from="0.0.0.0:5080"
to="192.168.100.136:5080"
time="1399921000300"
isSender="true"
transactionId="z9hg4bk6ef3edb8-3d39-4b3c-828d-5706b6bce40d_74a2f52c_8017367923679066"
callId="NjU5YTg5OGRhZjg5YzVjNWEzOWFhYTIyZmJiYjMwZmE"
firstLine="REGISTER sip:192.168.100.136:5080 SIP/2.0"
>
<![CDATA[REGISTER sip:192.168.100.136:5080 SIP/2.0
Via: SIP/2.0/UDP 192.168.100.136:5080;branch=z9hG4bK6ef3edb8-3d39-4b3c-828d-5706b6bce40d_74a2f52c_8017367923679066
Via: SIP/2.0/UDP 192.168.100.125:5090;branch=z9hG4bK-d8754z-7178ee0abc532a51-1---d8754z-
Max-Forwards: 69
Contact: <sip:110#192.168.100.125:5090;rinstance=664938eda63f586d;transport=udp>
To: "110" <sip:110#192.168.100.136:5080>
From: "110" <sip:110#192.168.100.136:5080>;tag=52ca933d
Call-ID: NjU5YTg5OGRhZjg5YzVjNWEzOWFhYTIyZmJiYjMwZmE
CSeq: 1 REGISTER
Expires: 60
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,NOTIFY,MESSAGE,SUBSCRIBE,INFO
User-Agent: X-Lite release 4.5.5 stamp 71236
X-looping: 1
Content-Length: 0
]]>
</message>
11:56:40,307 INFO [gov.nist.javax.sip.stack.SIPTransactionStack] (Mobicents-SIP-Servlets-UDPMessageChannelThread-5) <message
from="192.168.100.136:5080"
to="0.0.0.0:5080"
time="1399921000307"
isSender="false"
transactionId="z9hg4bk6ef3edb8-3d39-4b3c-828d-5706b6bce40d_74a2f52c_8017367923679066"
callId="NjU5YTg5OGRhZjg5YzVjNWEzOWFhYTIyZmJiYjMwZmE"
firstLine="SIP/2.0 403 Forbidden"
>
<![CDATA[SIP/2.0 403 Forbidden
To: "110" <sip:110#192.168.100.136:5080>;tag=27182159_74a2f52c_f3f49504-2264-4b83-bfe2-48103366fb36
Via: SIP/2.0/UDP 192.168.100.136:5080;branch=z9hG4bK6ef3edb8-3d39-4b3c-828d-5706b6bce40d_74a2f52c_8017367923679066
Via: SIP/2.0/UDP 192.168.100.125:5090;branch=z9hG4bK-d8754z-7178ee0abc532a51-1---d8754z-
CSeq: 1 REGISTER
Call-ID: NjU5YTg5OGRhZjg5YzVjNWEzOWFhYTIyZmJiYjMwZmE
From: "110" <sip:110#192.168.100.136:5080>;tag=52ca933d
Content-Length: 0
]]>
</message>
11:56:40,305 INFO [org.mobicents.servlet.sip.core.dispatchers.InitialRequestDispatcher] (Mobicents-SIP-Servlets-UDPMessageChannelThread-3) Request event dispatched to BlockerApp
11:56:40,308 INFO [gov.nist.javax.sip.stack.SIPTransactionStack] (Mobicents-SIP-Servlets-UDPMessageChannelThread-4) <message
from="0.0.0.0:5080"
to="192.168.100.136:5080"
time="1399921000306"
isSender="true"
transactionId="z9hg4bk6ef3edb8-3d39-4b3c-828d-5706b6bce40d_74a2f52c_8017367923679066"
callId="NjU5YTg5OGRhZjg5YzVjNWEzOWFhYTIyZmJiYjMwZmE"
firstLine="SIP/2.0 403 Forbidden"
>
<![CDATA[SIP/2.0 403 Forbidden
To: "110" <sip:110#192.168.100.136:5080>;tag=27182159_74a2f52c_f3f49504-2264-4b83-bfe2-48103366fb36
Via: SIP/2.0/UDP 192.168.100.136:5080;branch=z9hG4bK6ef3edb8-3d39-4b3c-828d-5706b6bce40d_74a2f52c_8017367923679066
Via: SIP/2.0/UDP 192.168.100.125:5090;branch=z9hG4bK-d8754z-7178ee0abc532a51-1---d8754z-
CSeq: 1 REGISTER
Call-ID: NjU5YTg5OGRhZjg5YzVjNWEzOWFhYTIyZmJiYjMwZmE
From: "110" <sip:110#192.168.100.136:5080>;tag=52ca933d
Content-Length: 0
]]>
</message>
11:56:40,308 INFO [org.mobicents.servlet.sip.core.dispatchers.InitialRequestDispatcher] (Mobicents-SIP-Servlets-UDPMessageChannelThread-4) Request event dispatched to BlockerApp
11:56:40,310 INFO [gov.nist.javax.sip.stack.SIPTransactionStack] (Mobicents-SIP-Servlets-UDPMessageChannelThread-5) <message
from="0.0.0.0:5080"
to="192.168.100.125:5090"
time="1399921000309"
isSender="true"
transactionId="z9hg4bk-d8754z-7178ee0abc532a51-1---d8754z-"
callId="NjU5YTg5OGRhZjg5YzVjNWEzOWFhYTIyZmJiYjMwZmE"
firstLine="SIP/2.0 403 Forbidden"
>
<![CDATA[SIP/2.0 403 Forbidden
To: "110" <sip:110#192.168.100.136:5080>;tag=27182159_74a2f52c_f3f49504-2264-4b83-bfe2-48103366fb36
Via: SIP/2.0/UDP 192.168.100.125:5090;branch=z9hG4bK-d8754z-7178ee0abc532a51-1---d8754z-
CSeq: 1 REGISTER
Call-ID: NjU5YTg5OGRhZjg5YzVjNWEzOWFhYTIyZmJiYjMwZmE
From: "110" <sip:110#192.168.100.136:5080>;tag=52ca933d
Content-Length: 0
]]>
</message>
I now understand why is was not working for me. SIP Servlet chaining using the DAR only works with methods which have dialogs usch as INVITE, SUBSCRIBE, NOTIFY, etc. I have tried using DAR with a multi-servlet application handling an INVITE, and it works as expected.
Application Routing for REGISTER is now fixed in the latest git HEAD

Asterisk modify headers

I want to replace my SPA2102 for asterisk. How can I modify headers, like From, To and Contact?
I need to replace headers, like
From: "asterisk" <sip:XXXX174264#ip.ip.ip.6>;tag=as1ea48bca
To headers, like SPA2102.
My SPA2102 sends it like
"XXXX174264" <sip:XXXX174264#ip.ip.ip.6>
How
# tcpdump -nAieth0 port 5060 and net ip.ip.ip.0/24
10:47:55.801914 IP 10.37.93.21.5060 > ip.ip.ip.6.5060: SIP, length: 906
E....j..#...
%].............INVITE sip:474264#ip.ip.ip.6 SIP/2.0
Via: SIP/2.0/UDP 10.37.93.21:5060;branch=z9hG4bK20d7bc88
Max-Forwards: 70
From: "asterisk" <sip:XXXX174264#ip.ip.ip.6>;tag=as1ea48bca
To: <sip:474264#ip.ip.ip.6>
Contact: <sip:XXXX174264#10.37.93.21:5060>
Call-ID: 6b4c893e70628a626286cd0a748f93de#ip.ip.ip.6
CSeq: 102 INVITE
User-Agent: Linksys/SPA2102-5.2.5
Date: Wed, 16 Jan 2013 04:47:55 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 333
v=0
o=- 233070007 233070007 IN IP4 10.37.93.21
s=Asterisk PBX 11.2.0
c=IN IP4 10.37.93.21
t=0 0
m=audio 10004 RTP/AVP 0 8 3 111 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
10:47:55.822359 IP ip.ip.ip.6.5060 > 10.37.93.21.5060: SIP, length: 348
E..x..#.>.#.....
%]......d.CSIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.37.93.21:5060;branch=z9hG4bK20d7bc88
From: "asterisk" <sip:XXXX174264#ip.ip.ip.6>;tag=as1ea48bca
To: <sip:474264#ip.ip.ip.6>
Call-ID: 6b4c893e70628a626286cd0a748f93de#ip.ip.ip.6
CSeq: 102 INVITE
Contact: <sip:474264#ip.ip.ip.6:5060>
Server: MERA MVTS3G v.4.3.0-38t
Content-Length: 0
I try to make call using SPA and Asterisk. Both register succes. But Asterisk can't make call.
Here is tcpdump from SPA:
00:58:00.778565 IP 10.37.93.23.5060 > ip.ip.ip.6.5060: SIP, length: 892
Eh..........
%].............INVITE sip:474264#ip.ip.ip.6 SIP/2.0
Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
From: XXXX174264 <sip:XXXX174264#ip.ip.ip.6>;tag=e9377d83dbc079fo0
To: <sip:474264#ip.ip.ip.6>
Remote-Party-ID: XXXX174264 <sip:XXXX174264#ip.ip.ip.6>;screen=yes;party=calling
Call-ID: 27e34e53-cdeded0f#10.37.93.23
CSeq: 101 INVITE
Max-Forwards: 70
Contact: XXXX174264 <sip:XXXX174264#10.37.93.23:5060>
Expires: 240
User-Agent: Linksys/SPA2102-5.2.5
Content-Length: 268
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER
Supported: x-sipura, replaces
Content-Type: application/sdp
v=0
o=- 93383 93383 IN IP4 10.37.93.23
s=-
c=IN IP4 10.37.93.23
t=0 0
m=audio 16186 RTP/AVP 8 0 18 4 100
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729a/8000
a=rtpmap:4 G723/8000
a=rtpmap:100 NSE/8000
a=fmtp:100 192-193
a=ptime:20
a=sendrecv
00:58:00.782580 IP ip.ip.ip.6.5060 > 10.37.93.23.5060: SIP, length: 342
....E..r..#.>.#.....
%]......^..SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
From: "XXXX174264" <sip:XXXX174264#ip.ip.ip.6>;tag=e9377d83dbc079fo0
To: <sip:474264#ip.ip.ip.6>
Call-ID: 27e34e53-cdeded0f#10.37.93.23
CSeq: 101 INVITE
Contact: <sip:474264#ip.ip.ip.6:5060>
Server: MERA MVTS3G v.4.3.0-38t
Content-Length: 0
00:58:02.479539 IP ip.ip.ip.6.5060 > 10.37.93.23.5060: SIP, length: 683
....E.....#.>."p....
%].......<.SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
From: "XXXX174264" <sip:XXXX174264#ip.ip.ip.6>;tag=e9377d83dbc079fo0
To: <sip:474264#ip.ip.ip.6>;tag=109877804-3792792162-4082950052-3026001148
Call-ID: 27e34e53-cdeded0f#10.37.93.23
CSeq: 101 INVITE
Contact: <sip:474264#ip.ip.ip.6:5060>
Content-Type: application/sdp
Server: MERA MVTS3G v.4.3.0-38t
Content-Length: 258
v=0
o=- 1358621882 1358621882 IN IP4 ip.ip.ip.5
s=-
c=IN IP4 ip.ip.ip.5
t=0 0
m=audio 39878 RTP/AVP 8 0 18
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=ptime:20
a=sendrecv
a=silenceSupp:off - - - -
00:58:30.832778 IP 10.37.93.23.5060 > ip.ip.ip.6.5060: SIP, length: 339
Eh.o........
%]..........[O.CANCEL sip:474264#ip.ip.ip.6 SIP/2.0
Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
From: XXXX174264 <sip:XXXX174264#ip.ip.ip.6>;tag=e9377d83dbc079fo0
To: <sip:474264#ip.ip.ip.6>
Call-ID: 27e34e53-cdeded0f#10.37.93.23
CSeq: 101 CANCEL
Max-Forwards: 70
User-Agent: Linksys/SPA2102-5.2.5
Content-Length: 0
00:58:30.836782 IP ip.ip.ip.6.5060 > 10.37.93.23.5060: SIP, length: 385
....E.....#.>.#.....
%].......7.SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
From: "XXXX174264" <sip:XXXX174264#ip.ip.ip.6>;tag=e9377d83dbc079fo0
To: <sip:474264#ip.ip.ip.6>;tag=109877804-3792792162-4082950052-3026001148
Call-ID: 27e34e53-cdeded0f#10.37.93.23
CSeq: 101 CANCEL
Contact: <sip:474264#ip.ip.ip.6:5060>
Server: MERA MVTS3G v.4.3.0-38t
Content-Length: 0
00:58:30.838775 IP ip.ip.ip.6.5060 > 10.37.93.23.5060: SIP, length: 450
....E.....#.>.#Y....
%].........SIP/2.0 487 Request Terminated
Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
From: "XXXX174264" <sip:XXXX174264#ip.ip.ip.6>;tag=e9377d83dbc079fo0
To: <sip:474264#ip.ip.ip.6>;tag=109877804-3792792162-4082950052-3026001148
Call-ID: 27e34e53-cdeded0f#10.37.93.23
CSeq: 101 INVITE
Contact: <sip:474264#ip.ip.ip.6:5060>
Server: MERA MVTS3G v.4.3.0-38t
Reason: SIP;cause=487;text="Request Terminated"
Content-Length: 0
00:58:30.845777 IP 10.37.93.23.5060 > ip.ip.ip.6.5060: SIP, length: 437
Eh.........&
%].............ACK sip:474264#ip.ip.ip.6 SIP/2.0
Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
From: XXXX174264 <sip:XXXX174264#ip.ip.ip.6>;tag=e9377d83dbc079fo0
To: <sip:474264#ip.ip.ip.6>;tag=109877804-3792792162-4082950052-3026001148
Call-ID: 27e34e53-cdeded0f#10.37.93.23
CSeq: 101 ACK
Max-Forwards: 70
Contact: XXXX174264 <sip:XXXX174264#10.37.93.23:5060>
User-Agent: Linksys/SPA2102-5.2.5
Content-Length: 0
And tcpdump from Asterisk:
E...W,..#. .
%].............INVITE sip:474264#ip.ip.ip.6 SIP/2.0
Via: SIP/2.0/UDP 10.37.93.21:5060;branch=z9hG4bK6422ee1e
Max-Forwards: 70
From: "asterisk" <sip:XXXX174264#ip.ip.ip.6>;tag=as43ada6c8
To: <sip:474264#ip.ip.ip.6>
Contact: <sip:XXXX174264#10.37.93.21:5060>
Call-ID: 6e8b22967d9c55ea349abb636c0e5263#ip.ip.ip.6
CSeq: 102 INVITE
User-Agent: Linksys/SPA2102-5.2.5
Date: Sat, 19 Jan 2013 18:49:27 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 333
v=0
o=- 413424664 413424664 IN IP4 10.37.93.21
s=Asterisk PBX 11.2.0
c=IN IP4 10.37.93.21
t=0 0
m=audio 10008 RTP/AVP 0 8 3 111 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
00:49:27.073977 IP ip.ip.ip.6.5060 > 10.37.93.21.5060: SIP, length: 348
E..x..#.>.#.....
%]......d..SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.37.93.21:5060;branch=z9hG4bK6422ee1e
From: "asterisk" <sip:XXXX174264#ip.ip.ip.6>;tag=as43ada6c8
To: <sip:474264#ip.ip.ip.6>
Call-ID: 6e8b22967d9c55ea349abb636c0e5263#ip.ip.ip.6
CSeq: 102 INVITE
Contact: <sip:474264#ip.ip.ip.6:5060>
Server: MERA MVTS3G v.4.3.0-38t
Content-Length: 0
00:49:27.100102 IP ip.ip.ip.6.5060 > 10.37.93.21.5060: SIP, length: 478
E.....#.>.#?....
%].........SIP/2.0 603 Subscriber account disabled
Via: SIP/2.0/UDP 10.37.93.21:5060;branch=z9hG4bK6422ee1e
From: "asterisk" <sip:XXXX174264#ip.ip.ip.6>;tag=as43ada6c8
To: <sip:474264#ip.ip.ip.6>;tag=179071226-3792791650-4082950052-3026001148
Call-ID: 6e8b22967d9c55ea349abb636c0e5263#ip.ip.ip.6
CSeq: 102 INVITE
Contact: <sip:474264#ip.ip.ip.6:5060>
Server: MERA MVTS3G v.4.3.0-38t
Reason: Centrex;cause=179;text="Subscriber account disabled"
Content-Length: 0
00:49:27.100295 IP 10.37.93.21.5060 > ip.ip.ip.6.5060: SIP, length: 433
E...W-..#.
.
%]...........#,ACK sip:474264#ip.ip.ip.6 SIP/2.0
Via: SIP/2.0/UDP 10.37.93.21:5060;branch=z9hG4bK6422ee1e
Max-Forwards: 70
From: "asterisk" <sip:XXXX174264#ip.ip.ip.6>;tag=as43ada6c8
To: <sip:474264#ip.ip.ip.6>;tag=179071226-3792791650-4082950052-3026001148
Contact: <sip:XXXX174264#10.37.93.21:5060>
Call-ID: 6e8b22967d9c55ea349abb636c0e5263#ip.ip.ip.6
CSeq: 102 ACK
User-Agent: Linksys/SPA2102-5.2.5
Content-Length: 0
Try change in sip.conf following:
[general]
realm=yourprovider-domain-here
useragent = Linksys/PAP2T-5.1.6(LS)
sdpsession= Linksys/PAP2T-5.1.6(LS)
you can use SipAddHeader in dialplan, like
SipAddHeader(P-Preferred-Identity: <sip:XXXXXX#10.0.10.10>
There are two places where you can change these headers.
In your PBX for calls in the sense PBX -> SPA you should modify your sip.conf file like that:
[general]
...
realm = my_realm.com ; This will substitute From: "asterisk"
In your SPA2102 for calls in the sense SPA -> PBX you have to enter the SPA configuration and change your subscriber information. This is step 5 of this guide: http://www.voipvoip.com/spa-2101/ where it says "Display Name"