Asterisk modify headers - header

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"

Related

Login with Selenium + Chrome driver + Browsermob Proxy only works if I add another proxy -> why?

I have the code below to initialise a setup of Selenium + Chrome driver + Browsermob Proxy to login to a certain website.
If I just use the setup above, the login fails with HTTP 403. However, if I had another Proxy (Selenium + Chrome driver + Browsermob Proxy + e.g. Fiddler Everywhere, see lines after "to pass requests from proxy server to Fiddler Everywhere") and force the requests from Browsermob Proxy to be proxied by Fiddler Everywhere, then the login works well.
Can anyone provide me a hint on how to debug and/or clear this problem?
I have investigated the headers between all legs:
"Via: 1.1 browsermobproxy" is being added by Browsermob but I replayed a login request after removing "Via" header from Browsermob, and did not have any effect.
BrowserMob is removing "Connection:keep-alive". Could this be the cause (or hint at the cause) ?
I also checked:
The body of the request is not changed across the full chain.
HTTP protocol version does not change across the full chain (HTTP/1.1).
Here is a detailed log of the request without Fiddler:
POST /api/sts/v2/oauth/auth?client_request_id=34634696-b122-40de-b144-ab812a4b3784 HTTP/1.1
Host: www.example.com
Connection: keep-alive
Content-Length: 147
AccountType: Real
X-STS-ClientTime: 2020-08-27T18:10:51
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
X-STS-AppDomain: https://www.example.com
Content-Type: application/json;charset=UTF-8
Accept: application/json, text/plain, */*
X-STS-GatewayAppId: 90631448-9A01-4860-9FA5-B4EBCDE5EA1D
ApplicationIdentifier: Rexample
ApplicationVersion: 268.0.1
X-DEVICE-ID: 77f281a4-7914-4417-b144-4811998c3e5b
Origin: https://www.example.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://www.example.com/login
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cookie: __cfduid=d722b1913f887e5df9b0c740ccef4744a1598548223; exampleLocale=en-gb; TS01047baf=01f1b32d7e1354b9f541c1bab1a81960be72277a638bce5a4865b5b1d5b2e0a9cfddddbcba0d21185b68a7d599391e972d5f065031; __cflb=02DiuEAg8LPSYevHEYiyx9rnANkoz3ETfpNySVtv8fQVr; TMIS2=9a74f2a90237486aab4dcb9d44dec14a0520aaf521b9e87e81f271264e25038c2919d29ee219162aa2ad6bdb68fbe78a86ce282ef510aa77456a3876e4e790d3fdbb0ca31af4d206c67f7b9b5fda93e11b80782ed9095c6a7d8766b4642a69785e7ba9d0a86cd98f3b42c2172a8821bbe6906b6fafc8178f0d742271591193; __cf_bm=50d03de4ce1301af67fa03c59387373fba4d8b3e-1598548241-1800-AZ39AzpjNXxDQ+qFhgfI0OYbMauZ3vXOA1MUejwqJsfE3kOEmEVmKXtsstKg5vZZ5ie/d3yHbgzM8RzzLqqSQEVnd5Vy+l06FUm5Z90kFf54ffUqgq+ywM4EOcGhdP22aetxTezQvFieWgfScPvH0SzqDmFpvrmZJmRuLvnywgcLX14Ys9uA2tMCLWSlDesiQA==; mp_dbbd7bd9566da85f012f7ca5d8c6c944_mixpanel=%7B%22distinct_id%22%3A%20%2217430e66d1679d-015c94d6c30eda-31647304-fa000-17430e66d17591%22%2C%22%24device_id%22%3A%20%2217430e66d1679d-015c94d6c30eda-31647304-fa000-17430e66d17591%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D; _gcl_au=1.1.706805090.1598548242; G_ENABLED_IDPS=google; _uetsid=5c779e7394432399f739848297b9a350; _uetvid=d421e48c4acc1f88b81573014b4fa429; _fbp=fb.1.1598548244752.1489311425; __adal_ses=*; __adal_id=c4b052ee-96b4-4643-b30e-af4af0f7460d.1598548246.1.1598548246.1598548246.2a5a85bd-5415-4275-942c-e02a8048acc2; __adal_ca=so%3Ddirect%26me%3Dnone%26ca%3Ddirect%26co%3D%28not%2520set%29%26ke%3D%28not%2520set%29; __adal_cw=1598548245533; _ga=GA1.2.436171435.1598548249; _gid=GA1.2.1493657885.1598548249; _gat=1; _gat_UA-2056847-65=1
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ClientToProxyConnection.java:183) - (AWAITING_INITIAL) [id: 0x367d8cd0, L:/[0:0:0:0:0:0:0:1]:64108 - R:/[0:0:0:0:0:0:0:1]:64132]: Received raw request: DefaultHttpRequest(decodeResult: success, version: HTTP/1.1)
POST /api/sts/v2/oauth/auth?client_request_id=34634696-b122-40de-b144-ab812a4b3784 HTTP/1.1
Host: www.example.com
Connection: keep-alive
Content-Length: 147
AccountType: Real
X-STS-ClientTime: 2020-08-27T18:10:51
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
X-STS-AppDomain: https://www.example.com
Content-Type: application/json;charset=UTF-8
Accept: application/json, text/plain, */*
X-STS-GatewayAppId: 90631448-9A01-4860-9FA5-B4EBCDE5EA1D
ApplicationIdentifier: Rexample
ApplicationVersion: 268.0.1
X-DEVICE-ID: 77f281a4-7914-4417-b144-4811998c3e5b
Origin: https://www.example.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://www.example.com/login
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cookie: __cfduid=d722b1913f887e5df9b0c740ccef4744a1598548223; exampleLocale=en-gb; TS01047baf=01f1b32d7e1354b9f541c1bab1a81960be72277a638bce5a4865b5b1d5b2e0a9cfddddbcba0d21185b68a7d599391e972d5f065031; __cflb=02DiuEAg8LPSYevHEYiyx9rnANkoz3ETfpNySVtv8fQVr; TMIS2=9a74f2a90237486aab4dcb9d44dec14a0520aaf521b9e87e81f271264e25038c2919d29ee219162aa2ad6bdb68fbe78a86ce282ef510aa77456a3876e4e790d3fdbb0ca31af4d206c67f7b9b5fda93e11b80782ed9095c6a7d8766b4642a69785e7ba9d0a86cd98f3b42c2172a8821bbe6906b6fafc8178f0d742271591193; __cf_bm=50d03de4ce1301af67fa03c59387373fba4d8b3e-1598548241-1800-AZ39AzpjNXxDQ+qFhgfI0OYbMauZ3vXOA1MUejwqJsfE3kOEmEVmKXtsstKg5vZZ5ie/d3yHbgzM8RzzLqqSQEVnd5Vy+l06FUm5Z90kFf54ffUqgq+ywM4EOcGhdP22aetxTezQvFieWgfScPvH0SzqDmFpvrmZJmRuLvnywgcLX14Ys9uA2tMCLWSlDesiQA==; mp_dbbd7bd9566da85f012f7ca5d8c6c944_mixpanel=%7B%22distinct_id%22%3A%20%2217430e66d1679d-015c94d6c30eda-31647304-fa000-17430e66d17591%22%2C%22%24device_id%22%3A%20%2217430e66d1679d-015c94d6c30eda-31647304-fa000-17430e66d17591%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D; _gcl_au=1.1.706805090.1598548242; G_ENABLED_IDPS=google; _uetsid=5c779e7394432399f739848297b9a350; _uetvid=d421e48c4acc1f88b81573014b4fa429; _fbp=fb.1.1598548244752.1489311425; __adal_ses=*; __adal_id=c4b052ee-96b4-4643-b30e-af4af0f7460d.1598548246.1.1598548246.1598548246.2a5a85bd-5415-4275-942c-e02a8048acc2; __adal_ca=so%3Ddirect%26me%3Dnone%26ca%3Ddirect%26co%3D%28not%2520set%29%26ke%3D%28not%2520set%29; __adal_cw=1598548245533; _ga=GA1.2.436171435.1598548249; _gid=GA1.2.1493657885.1598548249; _gat=1; _gat_UA-2056847-65=1
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ClientToProxyConnection.java:269) - (AWAITING_INITIAL) [id: 0x367d8cd0, L:/[0:0:0:0:0:0:0:1]:64108 - R:/[0:0:0:0:0:0:0:1]:64132]: Ensuring that hostAndPort are available in /api/sts/v2/oauth/auth?client_request_id=34634696-b122-40de-b144-ab812a4b3784
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ClientToProxyConnection.java:281) - (AWAITING_INITIAL) [id: 0x367d8cd0, L:/[0:0:0:0:0:0:0:1]:64108 - R:/[0:0:0:0:0:0:0:1]:64132]: Finding ProxyToServerConnection for: www.example.com
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ClientToProxyConnection.java:331) - (AWAITING_INITIAL) [id: 0x367d8cd0, L:/[0:0:0:0:0:0:0:1]:64108 - R:/[0:0:0:0:0:0:0:1]:64132]: Reusing existing server connection: org.littleshoot.proxy.impl.ProxyToServerConnection#7c392fd2
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ClientToProxyConnection.java:1084) - (AWAITING_INITIAL) [id: 0x367d8cd0, L:/[0:0:0:0:0:0:0:1]:64108 - R:/[0:0:0:0:0:0:0:1]:64132]: Modifying request for proxy chaining
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ClientToProxyConnection.java:1088) - (AWAITING_INITIAL) [id: 0x367d8cd0, L:/[0:0:0:0:0:0:0:1]:64108 - R:/[0:0:0:0:0:0:0:1]:64132]: Stripped host from uri: /api/sts/v2/oauth/auth?client_request_id=34634696-b122-40de-b144-ab812a4b3784 yielding: /api/sts/v2/oauth/auth?client_request_id=34634696-b122-40de-b144-ab812a4b3784
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ClientToProxyConnection.java:1093) - (AWAITING_INITIAL) [id: 0x367d8cd0, L:/[0:0:0:0:0:0:0:1]:64108 - R:/[0:0:0:0:0:0:0:1]:64132]: Modifying request headers for proxying
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ClientToProxyConnection.java:350) - (AWAITING_INITIAL) [id: 0x367d8cd0, L:/[0:0:0:0:0:0:0:1]:64108 - R:/[0:0:0:0:0:0:0:1]:64132]: Writing request to ProxyToServerConnection
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ProxyToServerConnection.java:316) - (AWAITING_INITIAL) [id: 0xba528f83, L:/172.20.10.2:64134 - R:www.example.com/104.18.19.67:443]: Requested write of DefaultHttpRequest(decodeResult: success, version: HTTP/1.1)
POST /api/sts/v2/oauth/auth?client_request_id=34634696-b122-40de-b144-ab812a4b3784 HTTP/1.1
Host: www.example.com
Content-Length: 147
AccountType: Real
X-STS-ClientTime: 2020-08-27T18:10:51
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
X-STS-AppDomain: https://www.example.com
Content-Type: application/json;charset=UTF-8
Accept: application/json, text/plain, */*
X-STS-GatewayAppId: 90631448-9A01-4860-9FA5-B4EBCDE5EA1D
ApplicationIdentifier: Rexample
ApplicationVersion: 268.0.1
X-DEVICE-ID: 77f281a4-7914-4417-b144-4811998c3e5b
Origin: https://www.example.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://www.example.com/login
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cookie: __cfduid=d722b1913f887e5df9b0c740ccef4744a1598548223; exampleLocale=en-gb; TS01047baf=01f1b32d7e1354b9f541c1bab1a81960be72277a638bce5a4865b5b1d5b2e0a9cfddddbcba0d21185b68a7d599391e972d5f065031; __cflb=02DiuEAg8LPSYevHEYiyx9rnANkoz3ETfpNySVtv8fQVr; TMIS2=9a74f2a90237486aab4dcb9d44dec14a0520aaf521b9e87e81f271264e25038c2919d29ee219162aa2ad6bdb68fbe78a86ce282ef510aa77456a3876e4e790d3fdbb0ca31af4d206c67f7b9b5fda93e11b80782ed9095c6a7d8766b4642a69785e7ba9d0a86cd98f3b42c2172a8821bbe6906b6fafc8178f0d742271591193; __cf_bm=50d03de4ce1301af67fa03c59387373fba4d8b3e-1598548241-1800-AZ39AzpjNXxDQ+qFhgfI0OYbMauZ3vXOA1MUejwqJsfE3kOEmEVmKXtsstKg5vZZ5ie/d3yHbgzM8RzzLqqSQEVnd5Vy+l06FUm5Z90kFf54ffUqgq+ywM4EOcGhdP22aetxTezQvFieWgfScPvH0SzqDmFpvrmZJmRuLvnywgcLX14Ys9uA2tMCLWSlDesiQA==; mp_dbbd7bd9566da85f012f7ca5d8c6c944_mixpanel=%7B%22distinct_id%22%3A%20%2217430e66d1679d-015c94d6c30eda-31647304-fa000-17430e66d17591%22%2C%22%24device_id%22%3A%20%2217430e66d1679d-015c94d6c30eda-31647304-fa000-17430e66d17591%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D; _gcl_au=1.1.706805090.1598548242; G_ENABLED_IDPS=google; _uetsid=5c779e7394432399f739848297b9a350; _uetvid=d421e48c4acc1f88b81573014b4fa429; _fbp=fb.1.1598548244752.1489311425; __adal_ses=*; __adal_id=c4b052ee-96b4-4643-b30e-af4af0f7460d.1598548246.1.1598548246.1598548246.2a5a85bd-5415-4275-942c-e02a8048acc2; __adal_ca=so%3Ddirect%26me%3Dnone%26ca%3Ddirect%26co%3D%28not%2520set%29%26ke%3D%28not%2520set%29; __adal_cw=1598548245533; _ga=GA1.2.436171435.1598548249; _gid=GA1.2.1493657885.1598548249; _gat=1; _gat_UA-2056847-65=1
Accept-Encoding: gzip, deflate, br
Via: 1.1 browsermobproxy
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ProxyToServerConnection.java:348) - (AWAITING_INITIAL) [id: 0xba528f83, L:/172.20.10.2:64134 - R:www.example.com/104.18.19.67:443]: Using existing connection to: www.example.com/104.18.19.67:443
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ProxyConnection.java:228) - (AWAITING_INITIAL) [id: 0xba528f83, L:/172.20.10.2:64134 - R:www.example.com/104.18.19.67:443]: Writing: DefaultHttpRequest(decodeResult: success, version: HTTP/1.1)
POST /api/sts/v2/oauth/auth?client_request_id=34634696-b122-40de-b144-ab812a4b3784 HTTP/1.1
Host: www.example.com
Content-Length: 147
AccountType: Real
X-STS-ClientTime: 2020-08-27T18:10:51
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
X-STS-AppDomain: https://www.example.com
Content-Type: application/json;charset=UTF-8
Accept: application/json, text/plain, */*
X-STS-GatewayAppId: 90631448-9A01-4860-9FA5-B4EBCDE5EA1D
ApplicationIdentifier: Rexample
ApplicationVersion: 268.0.1
X-DEVICE-ID: 77f281a4-7914-4417-b144-4811998c3e5b
Origin: https://www.example.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://www.example.com/login
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cookie: __cfduid=d722b1913f887e5df9b0c740ccef4744a1598548223; exampleLocale=en-gb; TS01047baf=01f1b32d7e1354b9f541c1bab1a81960be72277a638bce5a4865b5b1d5b2e0a9cfddddbcba0d21185b68a7d599391e972d5f065031; __cflb=02DiuEAg8LPSYevHEYiyx9rnANkoz3ETfpNySVtv8fQVr; TMIS2=9a74f2a90237486aab4dcb9d44dec14a0520aaf521b9e87e81f271264e25038c2919d29ee219162aa2ad6bdb68fbe78a86ce282ef510aa77456a3876e4e790d3fdbb0ca31af4d206c67f7b9b5fda93e11b80782ed9095c6a7d8766b4642a69785e7ba9d0a86cd98f3b42c2172a8821bbe6906b6fafc8178f0d742271591193; __cf_bm=50d03de4ce1301af67fa03c59387373fba4d8b3e-1598548241-1800-AZ39AzpjNXxDQ+qFhgfI0OYbMauZ3vXOA1MUejwqJsfE3kOEmEVmKXtsstKg5vZZ5ie/d3yHbgzM8RzzLqqSQEVnd5Vy+l06FUm5Z90kFf54ffUqgq+ywM4EOcGhdP22aetxTezQvFieWgfScPvH0SzqDmFpvrmZJmRuLvnywgcLX14Ys9uA2tMCLWSlDesiQA==; mp_dbbd7bd9566da85f012f7ca5d8c6c944_mixpanel=%7B%22distinct_id%22%3A%20%2217430e66d1679d-015c94d6c30eda-31647304-fa000-17430e66d17591%22%2C%22%24device_id%22%3A%20%2217430e66d1679d-015c94d6c30eda-31647304-fa000-17430e66d17591%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D; _gcl_au=1.1.706805090.1598548242; G_ENABLED_IDPS=google; _uetsid=5c779e7394432399f739848297b9a350; _uetvid=d421e48c4acc1f88b81573014b4fa429; _fbp=fb.1.1598548244752.1489311425; __adal_ses=*; __adal_id=c4b052ee-96b4-4643-b30e-af4af0f7460d.1598548246.1.1598548246.1598548246.2a5a85bd-5415-4275-942c-e02a8048acc2; __adal_ca=so%3Ddirect%26me%3Dnone%26ca%3Ddirect%26co%3D%28not%2520set%29%26ke%3D%28not%2520set%29; __adal_cw=1598548245533; _ga=GA1.2.436171435.1598548249; _gid=GA1.2.1493657885.1598548249; _gat=1; _gat_UA-2056847-65=1
Accept-Encoding: gzip, deflate, br
Via: 1.1 browsermobproxy
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ProxyConnection.java:237) - (AWAITING_INITIAL) [id: 0xba528f83, L:/172.20.10.2:64134 - R:www.example.com/104.18.19.67:443]: Wrote: DefaultHttpRequest(decodeResult: success, version: HTTP/1.1)
POST /api/sts/v2/oauth/auth?client_request_id=34634696-b122-40de-b144-ab812a4b3784 HTTP/1.1
Host: www.example.com
Content-Length: 147
AccountType: Real
X-STS-ClientTime: 2020-08-27T18:10:51
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
X-STS-AppDomain: https://www.example.com
Content-Type: application/json;charset=UTF-8
Accept: application/json, text/plain, */*
X-STS-GatewayAppId: 90631448-9A01-4860-9FA5-B4EBCDE5EA1D
ApplicationIdentifier: Rexample
ApplicationVersion: 268.0.1
X-DEVICE-ID: 77f281a4-7914-4417-b144-4811998c3e5b
Origin: https://www.example.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://www.example.com/login
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cookie: __cfduid=d722b1913f887e5df9b0c740ccef4744a1598548223; exampleLocale=en-gb; TS01047baf=01f1b32d7e1354b9f541c1bab1a81960be72277a638bce5a4865b5b1d5b2e0a9cfddddbcba0d21185b68a7d599391e972d5f065031; __cflb=02DiuEAg8LPSYevHEYiyx9rnANkoz3ETfpNySVtv8fQVr; TMIS2=9a74f2a90237486aab4dcb9d44dec14a0520aaf521b9e87e81f271264e25038c2919d29ee219162aa2ad6bdb68fbe78a86ce282ef510aa77456a3876e4e790d3fdbb0ca31af4d206c67f7b9b5fda93e11b80782ed9095c6a7d8766b4642a69785e7ba9d0a86cd98f3b42c2172a8821bbe6906b6fafc8178f0d742271591193; __cf_bm=50d03de4ce1301af67fa03c59387373fba4d8b3e-1598548241-1800-AZ39AzpjNXxDQ+qFhgfI0OYbMauZ3vXOA1MUejwqJsfE3kOEmEVmKXtsstKg5vZZ5ie/d3yHbgzM8RzzLqqSQEVnd5Vy+l06FUm5Z90kFf54ffUqgq+ywM4EOcGhdP22aetxTezQvFieWgfScPvH0SzqDmFpvrmZJmRuLvnywgcLX14Ys9uA2tMCLWSlDesiQA==; mp_dbbd7bd9566da85f012f7ca5d8c6c944_mixpanel=%7B%22distinct_id%22%3A%20%2217430e66d1679d-015c94d6c30eda-31647304-fa000-17430e66d17591%22%2C%22%24device_id%22%3A%20%2217430e66d1679d-015c94d6c30eda-31647304-fa000-17430e66d17591%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D; _gcl_au=1.1.706805090.1598548242; G_ENABLED_IDPS=google; _uetsid=5c779e7394432399f739848297b9a350; _uetvid=d421e48c4acc1f88b81573014b4fa429; _fbp=fb.1.1598548244752.1489311425; __adal_ses=*; __adal_id=c4b052ee-96b4-4643-b30e-af4af0f7460d.1598548246.1.1598548246.1598548246.2a5a85bd-5415-4275-942c-e02a8048acc2; __adal_ca=so%3Ddirect%26me%3Dnone%26ca%3Ddirect%26co%3D%28not%2520set%29%26ke%3D%28not%2520set%29; __adal_cw=1598548245533; _ga=GA1.2.436171435.1598548249; _gid=GA1.2.1493657885.1598548249; _gat=1; _gat_UA-2056847-65=1
Accept-Encoding: gzip, deflate, br
Via: 1.1 browsermobproxy
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ProxyConnection.java:111) - (AWAITING_CHUNK) [id: 0x367d8cd0, L:/[0:0:0:0:0:0:0:1]:64108 - R:/[0:0:0:0:0:0:0:1]:64132]: Reading: DefaultLastHttpContent(data: SlicedAbstractByteBuf(ridx: 0, widx: 147, cap: 147/147, unwrapped: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeNoCleanerDirectByteBuf(ridx: 147, widx: 147, cap: 176)), decoderResult: success)
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ProxyToServerConnection.java:316) - (AWAITING_INITIAL) [id: 0xba528f83, L:/172.20.10.2:64134 - R:www.example.com/104.18.19.67:443]: Requested write of DefaultLastHttpContent(data: SlicedAbstractByteBuf(ridx: 0, widx: 147, cap: 147/147, unwrapped: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeNoCleanerDirectByteBuf(ridx: 147, widx: 147, cap: 176)), decoderResult: success)
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ProxyToServerConnection.java:319) - (AWAITING_INITIAL) [id: 0xba528f83, L:/172.20.10.2:64134 - R:www.example.com/104.18.19.67:443]: Retaining reference counted message
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ProxyToServerConnection.java:348) - (AWAITING_INITIAL) [id: 0xba528f83, L:/172.20.10.2:64134 - R:www.example.com/104.18.19.67:443]: Using existing connection to: www.example.com/104.18.19.67:443
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ProxyConnection.java:228) - (AWAITING_INITIAL) [id: 0xba528f83, L:/172.20.10.2:64134 - R:www.example.com/104.18.19.67:443]: Writing: DefaultLastHttpContent(data: SlicedAbstractByteBuf(ridx: 0, widx: 147, cap: 147/147, unwrapped: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeNoCleanerDirectByteBuf(ridx: 147, widx: 147, cap: 176)), decoderResult: success)
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ProxyConnection.java:249) - (AWAITING_INITIAL) [id: 0xba528f83, L:/172.20.10.2:64134 - R:www.example.com/104.18.19.67:443]: Writing an empty buffer to signal the end of our chunked transfer
DEBUG [LittleProxy-0-ClientToProxyWorker-2] (ProxyConnection.java:237) - (AWAITING_INITIAL) [id: 0xba528f83, L:/172.20.10.2:64134 - R:www.example.com/104.18.19.67:443]: Wrote: DefaultLastHttpContent(data: SlicedAbstractByteBuf(ridx: 0, widx: 147, cap: 147/147, unwrapped: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeNoCleanerDirectByteBuf(ridx: 147, widx: 147, cap: 176)), decoderResult: success)
DEBUG [LittleProxy-0-ProxyToServerWorker-0] (ProxyConnection.java:111) - (AWAITING_INITIAL) [id: 0xba528f83, L:/172.20.10.2:64134 - R:www.example.com/104.18.19.67:443]: Reading: DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 403 Forbidden
Date: Thu, 27 Aug 2020 17:10:51 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Frame-Options: SAMEORIGIN
Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Thu, 01 Jan 1970 00:00:01 GMT
cf-request-id: 04d27fab5700001bfece21f200000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Vary: Accept-Encoding
Strict-Transport-Security: max-age=15552000; includeSubDomains; preload
X-Content-Type-Options: nosniff
Server: cloudflare
CF-RAY: 5c97688bbb9f1bfe-OSL
Content-Encoding: br
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400
DEBUG [LittleProxy-0-ProxyToServerWorker-0] (ProxyToServerConnection.java:220) - (AWAITING_INITIAL) [id: 0xba528f83, L:/172.20.10.2:64134 - R:www.example.com/104.18.19.67:443]: Received raw response: DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
Thank you!
System.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedriver");
System.setProperty("webdriver.chrome.silentOutput", "true");
System.setProperty("webdriver.chrome.verboseLogging", "false");
ChromeOptions options = new ChromeOptions();
// route Chrome requests to proxy server
proxy = new BrowserMobProxyServer();
// to pass requests from proxy server to Fiddler Everywhere
// InetSocketAddress inetsockaddr = new InetSocketAddress('localhost', 8866);
// proxy.setTrustAllServers(true);
// proxy.setChainedProxy(inetsockaddr);
// start proxy server
proxy.start(0);
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
seleniumProxy.setHttpProxy("localhost:"+ proxy.getPort());
seleniumProxy.setSslProxy("localhost:"+ proxy.getPort());
options.setCapability(CapabilityType.PROXY, seleniumProxy);
options.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
options.setCapability (CapabilityType.ACCEPT_INSECURE_CERTS, true);
//options.addArguments("headless");
//options.addArguments("window-size=1200x600");
options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
options.setExperimentalOption("useAutomationExtension", false);
options.addArguments("--disable-blink-features=AutomationControlled");
driver = new ChromeDriver(options);`
Solved this by replacing the JDK, from OpenJDK to Oracle

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 !

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

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

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!

So nginx is not interpreting folded headers correctly?

HTTP/1.1 header field values can be
folded onto multiple lines if the
continuation line begins with a space
or horizontal tab. All linear white
space, including folding, has the same
semantics as SP. A recipient MAY
replace any linear white space with a
single SP before interpreting the
field value or forwarding the message
downstream.(quoted from here)
Here's my server side script,which just dumps the cookie content:
var_dump($_COOKIE);exit;
Here comes my test,please pay attention to the cookie part:
GET /logtest.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.17) Gecko/20110420 AlexaToolbar/alxf-2.11 Firefox/3.6.17
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Cookie: A=t;
artDate=t
Cache-Control: max-age=0
HTTP/1.1 200 OK
Server: iis/8.0
Date: Mon, 23 May 2011 12:38:00 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=20
X-Powered-By: PHP/5.3.2
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
27
array(1) {
["A"]=>
string(1) "t"
}
0
GET /logtest.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.17) Gecko/20110420 AlexaToolbar/alxf-2.11 Firefox/3.6.17
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Cookie: A=t;
artDate=t
Cache-Control: max-age=0
HTTP/1.1 200 OK
Server: iis/8.0
Date: Mon, 23 May 2011 12:38:11 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=20
X-Powered-By: PHP/5.3.2
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
27
array(1) {
["A"]=>
string(1) "t"
}
0
GET /logtest.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.17) Gecko/20110420 AlexaToolbar/alxf-2.11 Firefox/3.6.17
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Cookie: A=t;artDate=t
Cache-Control: max-age=0
HTTP/1.1 200 OK
Server: iis/8.0
Date: Mon, 23 May 2011 12:38:55 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=20
X-Powered-By: PHP/5.3.2
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
47
array(2) {
["A"]=>
string(1) "t"
["artDate"]=>
string(1) "t"
}
0
It's a known issue that doesn't have a high priority.