Dan Cropp
2017-Jan-24 17:25 UTC
[asterisk-users] Asterisk 14.2.1 PJSIP - is it possible to retrieve a PJSIP header To field for the SIP OK response to Trying?
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>
Joshua Colp
2017-Jan-24 17:27 UTC
[asterisk-users] Asterisk 14.2.1 PJSIP - is it possible to retrieve a PJSIP header To field for the SIP OK response to Trying?
On Tue, Jan 24, 2017, at 01:25 PM, Dan Cropp wrote:> 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.The PJSIP_HEADER dialplan function currently only looks at the initial message. It does not allow access to subsequent ones. -- Joshua Colp Digium, Inc. | Senior Software Developer 445 Jan Davis Drive NW - Huntsville, AL 35806 - US Check us out at: www.digium.com & www.asterisk.org
Dan Cropp
2017-Jan-24 17:41 UTC
[asterisk-users] Asterisk 14.2.1 PJSIP - is it possible to retrieve a PJSIP header To field for the SIP OK response to Trying?
Thank you Joshua. So there is no way to retrieve header information which may come in on subsequent packages? If not, is there any way to make an Attended Transfer following the RFC5589? https://tools.ietf.org/html/rfc5589 Asking because we have a hospital with a Cisco switch. Hospital has two calls from their Cisco switch into an Asterisk box. Operator handling the two calls and needs to transfer Call A to be connected to call B. Can obviously be patched inside of Asterisk. However, the hospital wants the call to be Attended Transferred. Basically, we need to send the Transfer (REFER) with the Replaces containing the call ID, From tag, and the To Tag. I am able to gather everything needed for the REFER field and pass that to the Transfer command (via AMI), except the To tag. -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Joshua Colp Sent: Tuesday, January 24, 2017 11:27 AM To: asterisk-users at lists.digium.com Subject: Re: [asterisk-users] Asterisk 14.2.1 PJSIP - is it possible to retrieve a PJSIP header To field for the SIP OK response to Trying? On Tue, Jan 24, 2017, at 01:25 PM, Dan Cropp wrote:> 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.The PJSIP_HEADER dialplan function currently only looks at the initial message. It does not allow access to subsequent ones. -- Joshua Colp Digium, Inc. | Senior Software Developer 445 Jan Davis Drive NW - Huntsville, AL 35806 - US Check us out at: www.digium.com & www.asterisk.org -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Reasonably Related Threads
- [Bug 99954] New: Errors when using VirtualBox with 3D acceleration: gr: ILLEGAL_CLASS ch 6 [007f7f8000 VirtualBox[5063]] subc 0 class c000 mthd 2390 data 00000000
- *8 and SIP
- Permission denied to access the email file
- Problems with chan_sip
- data file import - numbers and letters in a matrix(!)