[asterisk-users] Asterisk 14.2.1 PJSIP - is it possible to retrieve a PJSIP header To field for the SIP OK response to Trying?

Dan Cropp dan at amtelco.com
Tue Jan 24 11:25:17 CST 2017


I place a call into Asterisk (from SIP phone) and the To header does not have a tag.  Asterisk then sends it's Trying response, still no tag in the To header.  The phone then replies with OK, this time the To header includes a tag.

Is there any way to retrieve this response To header (including the tag field) from the dial plan?
I have tried the PJSIP-HEADER read of the To header, but it seems to only have access to the initial To header.
I even tried reading multiple layers of the To header, but it still didn't retrieve the newer dialog To headers.

I am including the SIP messages reported by Asterisk for the call coming in...

*** Phone sends INVITE to Asterisk ***

INVITE sip:333 at xxx.xxx.xxx.xxx SIP/2.0^M
Via: SIP/2.0/UDP yyy.yyy.yyy.yyy:5063;branch=z9hG4bK-18e552c3^M
From: "1004" <sip:1004 at xxx.xxx.xxx.xxx>;tag=79e7940882a792ao2^M
To: <sip:333 at xxx.xxx.xxx.xxx>^M
Call-ID: 3162d378-ea2b2452 at yyy.yyy.yyy.yyy^M
CSeq: 102 INVITE^M
Max-Forwards: 70^M
Authorization: Digest username="1004",realm="asterisk",nonce="1485271992/b1bebde5cb4a763ed85b1d8e52c8e30d",uri="sip:333 at xxx.xxx.xxx.xxx",algorithm=MD5,response="8dd827e9910c2446fb0b8497f5944b81",opaque="66e52\
68a2111e777",qop=auth,nc=00000001,cnonce="9dda9e0d"^M
Contact: "1004" <sip:1004 at yyy.yyy.yyy.yyy:5063>^M
Expires: 240^M
User-Agent: Cisco/SPA504G-7.4.8a^M
Content-Length: 401^M
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER, UPDATE^M
Supported: replaces^M
Content-Type: application/sdp^M
^M
v=0^M
o=- 32730859 32730859 IN IP4 yyy.yyy.yyy.yyy^M
s=-^M
c=IN IP4 yyy.yyy.yyy.yyy^M
t=0 0^M
m=audio 16436 RTP/AVP 0 2 8 9 18 96 97 98 101^M
a=rtpmap:0 PCMU/8000^M
a=rtpmap:2 G726-32/8000^M
a=rtpmap:8 PCMA/8000^M
a=rtpmap:9 G722/8000^M
a=rtpmap:18 G729a/8000^M
a=rtpmap:96 G726-40/8000^M
a=rtpmap:97 G726-24/8000^M
a=rtpmap:98 G726-16/8000^M
a=rtpmap:101 telephone-event/8000^M
a=fmtp:101 0-15^M
a=ptime:30^M
a=sendrecv^M

*** reply from Asterisk to phone ***

SIP/2.0 100 Trying^M
Via: SIP/2.0/UDP yyy.yyy.yyy.yyy:5063;received=yyy.yyy.yyy.yyy;branch=z9hG4bK-18e552c3^M
Call-ID: 3162d378-ea2b2452 at yyy.yyy.yyy.yyy^M
From: "1004" <sip:1004 at xxx.xxx.xxx.xxx>;tag=79e7940882a792ao2^M
To: <sip:333 at xxx.xxx.xxx.xxx>^M
CSeq: 102 INVITE^M
Server: Asterisk PBX 14.2.1^M
Content-Length:  0^M
^M


******
Asterisk receives this packet in response to the Trying.
Is it possible to retrieve this To header via the dial plan?  Specifically, I need the tag portion of the From
******

SIP/2.0 200 OK^M
Via: SIP/2.0/UDP yyy.yyy.yyy.yyy:5063;received=yyy.yyy.yyy.yyy;branch=z9hG4bK-18e552c3^M
Call-ID: 3162d378-ea2b2452 at yyy.yyy.yyy.yyy^M
From: "1004" <sip:1004 at xxx.xxx.xxx.xxx>;tag=79e7940882a792ao2^M
To: <sip:333 at xxx.xxx.xxx.xxx>;tag=96156bd7-9e8e-4077-b6e4-f3eb12e39069^M
CSeq: 102 INVITE^M
Server: Asterisk PBX 14.2.1^M
Contact: <sip:xxx.xxx.xxx.xxx:5060>^M
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER^M
Supported: 100rel, timer, replaces, norefersub^M
Content-Type: application/sdp^M
Content-Length:   179^M
^M
v=0^M
o=- 32730859 32730861 IN IP4 xxx.xxx.xxx.xxx^M
s=Asterisk^M
c=IN IP4 xxx.xxx.xxx.xxx^M
t=0 0^M
m=audio 19384 RTP/AVP 0^M
a=rtpmap:0 PCMU/8000^M
a=ptime:20^M
a=maxptime:150^M
a=sendrecv^M


ACK sip:xxx.xxx.xxx.xxx:5060 SIP/2.0^M
Via: SIP/2.0/UDP yyy.yyy.yyy.yyy:5063;branch=z9hG4bK-c38362b^M
From: "1004" <sip:1004 at xxx.xxx.xxx.xxx>;tag=79e7940882a792ao2^M
To: <sip:333 at xxx.xxx.xxx.xxx>;tag=96156bd7-9e8e-4077-b6e4-f3eb12e39069^M
Call-ID: 3162d378-ea2b2452 at yyy.yyy.yyy.yyy^M
CSeq: 102 ACK^M
Max-Forwards: 70^M
Authorization: Digest username="1004",realm="asterisk",nonce="1485271992/b1bebde5cb4a763ed85b1d8e52c8e30d",uri="sip:333 at xxx.xxx.xxx.xxx",algorithm=MD5,response="8dd827e9910c2446fb0b8497f5944b81",opaque="66e52\
68a2111e777",qop=auth,nc=00000001,cnonce="9dda9e0d"^M
Contact: "1004" <sip:1004 at yyy.yyy.yyy.yyy:5063>^M
User-Agent: Cisco/SPA504G-7.4.8a^M
Content-Length: 0^M
^M

SIP/2.0 200 OK^M
Via: SIP/2.0/UDP 192.168.35.91:5063;received=192.168.35.91;branch=z9hG4bK-18e552c3^M
Call-ID: 3162d378-ea2b2452 at 192.168.35.91^M
From: "1004" <sip:1004 at 192.168.33.30>;tag=79e7940882a792ao2^M
To: <sip:333 at 192.168.33.30>;tag=96156bd7-9e8e-4077-b6e4-f3eb12e39069^M
CSeq: 102 INVITE^M
Server: Asterisk PBX 14.2.1^M
Contact: <sip:192.168.33.30:5060>^M
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER^M
Supported: 100rel, timer, replaces, norefersub^M
Content-Type: application/sdp^M
Content-Length:   179^M
^M
v=0^M
o=- 32730859 32730861 IN IP4 192.168.33.30^M
s=Asterisk^M
c=IN IP4 192.168.33.30^M
t=0 0^M
m=audio 19384 RTP/AVP 0^M
a=rtpmap:0 PCMU/8000^M
a=ptime:20^M
a=maxptime:150^M
a=sendrecv^M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20170124/58273828/attachment.html>


More information about the asterisk-users mailing list