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@xyz:1] NoOp("PJSIP/poly_650_2_01-0000006f", "Call-ID:
[email protected]") in new stack
-- Executing [999@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@_pre_dial:1] NoOp("PJSIP/xyz011101-00000070", "Call-ID: ")
in new stack
-- Executing [s@_pre_dial:2] Set("PJSIP/xyz011101-00000070",
"CHANNEL(hangup_handler_push)=_hangup,s,1()") in new stack
-- Executing [s@_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@_hangup:1] NoOp("PJSIP/xyz011101-00000070", "Call-ID: ") in
new stack
-- Executing [s@_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@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
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users