[asterisk-users] PJSIP: how to retrieve underlying SIP Call-ID
Michael Ulitskiy
mulitskiy at acedsl.com
Tue Oct 6 15:25:37 CDT 2015
Hello,
I've started to play with PJSIP and got stuck at the following problem.
I need to retrieve SIP Call-ID associated with PJSIP channel.
For inbound channel I can use ${PJSIP_HEADER(read,Call-ID)}, but that doesn't work for
outbound channel even in pre-dial or hangup handler. Whatever I do PJSIP_HEADER
seem to be unable to read headers for outbound channel.
Here's what I do:
[xyz]
exten => 999,1,NoOp(Call-ID: ${PJSIP_HEADER(read,Call-ID)})
same => n,Dial(PJSIP/xyz011101/sip:xyz011101@<outbound_proxy>:5060,30,b(_pre_dial,s,1))
exten => h,1,NoOp()
[_pre_dial]
exten => s,1,NoOp(Call-ID: ${PJSIP_HEADER(read,Call-ID)})
same => n,Set(CHANNEL(hangup_handler_push)=_hangup,s,1())
same => n,Return
[_hangup]
exten => s,1,NoOp(Call-ID: ${PJSIP_HEADER(read,Call-ID)})
same => n,Return
Here's the result:
-- Executing [999 at xyz:1] NoOp("PJSIP/poly_650_2_01-0000006f", "Call-ID: e3e249e5-7e8941dd-da386565 at 192.168.100.238") in new stack
-- Executing [999 at xyz:2] Dial("PJSIP/poly_650_2_01-0000006f", "PJSIP/xyz011101/sip:xyz011101@<outbound_proxy>:5060,30,b(_pre_dial,s,1)") in new stack
-- PJSIP/xyz011101-00000070 Internal Gosub(_pre_dial,s,1) start
-- Executing [s at _pre_dial:1] NoOp("PJSIP/xyz011101-00000070", "Call-ID: ") in new stack
-- Executing [s at _pre_dial:2] Set("PJSIP/xyz011101-00000070", "CHANNEL(hangup_handler_push)=_hangup,s,1()") in new stack
-- Executing [s at _pre_dial:3] Return("PJSIP/xyz011101-00000070", "") in new stack
== Spawn extension (xyz, 999, 1) exited non-zero on 'PJSIP/xyz011101-00000070'
-- PJSIP/xyz011101-00000070 Internal Gosub(_pre_dial,s,1) complete GOSUB_RETVAL=
-- Called PJSIP/xyz011101/sip:xyz011101@<outbound_proxy>:5060
== Using SIP RTP Audio TOS bits 184
-- PJSIP/xyz011101-00000070 is ringing
-- PJSIP/xyz011101-00000070 Internal Gosub(_hangup,s,1) start
-- Executing [s at _hangup:1] NoOp("PJSIP/xyz011101-00000070", "Call-ID: ") in new stack
-- Executing [s at _hangup:2] Return("PJSIP/xyz011101-00000070", "") in new stack
== Spawn extension (xyz, 999, 1) exited non-zero on 'PJSIP/xyz011101-00000070'
-- PJSIP/xyz011101-00000070 Internal Gosub(_hangup,s,1) complete GOSUB_RETVAL=
== Spawn extension (xyz, 999, 2) exited non-zero on 'PJSIP/poly_650_2_01-0000006f'
-- Executing [h at xyz:1] NoOp("PJSIP/poly_650_2_01-0000006f", "") in new stack
As you can see I can get Call-ID of inbound channel, but I receive null for the outbound channel in both pre-dial and hangup handlers.
So my question is if there's a way to retrieve SIP Call-ID for outbound channels?
Also the 2nd question is if PJSIP_HEADER is supposed to be able to read headers of the outbound channel?
Thanks,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20151006/d90c5112/attachment.html>
More information about the asterisk-users
mailing list