VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
mulitskiy at acedsl.com Guest
|
Posted: Tue Oct 06, 2015 3:26 pm Post subject: [asterisk-users] PJSIP: how to retrieve underlying SIP Call- |
|
|
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: e3e249e5-7e8941dd-da386565@192.168.100.238") 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 |
|
Back to top |
|
|
mjordan at digium.com Guest
|
Posted: Tue Oct 06, 2015 5:07 pm Post subject: [asterisk-users] PJSIP: how to retrieve underlying SIP Call- |
|
|
On Tue, Oct 6, 2015 at 3:25 PM, Michael Ulitskiy <mulitskiy@acedsl.com> wrote:
Quote: | 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:
e3e249e5-7e8941dd-da386565@192.168.100.238") 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?
|
Hi Michael -
While you can use PJSIP_HEADER, the ability to retrieve the SIP
Call-ID through the CHANNEL function on a PJSIP channel was actually
just added in 13.6.0, and should be in the latest RC (13.6.0-rc2 [2]).
In either case, you're using a function as opposed to some
application, which means you do need to call the functions on the
specific channel. To get access to the outbound channel, you can use a
pre-dial handler's 'b' option [3]. The Call-ID *should* be set up on
the underlying invite session in the PJSIP dialog, even though it
hasn't been transmitted yet.
Matt
[1] https://gerrit.asterisk.org/#/c/1204/
[2] http://downloads.asterisk.org/pub/telephony/asterisk/ChangeLog-13.6.0-rc2
[3] https://wiki.asterisk.org/wiki/display/AST/Pre-Dial+Handlers
--
Matthew Jordan
Digium, Inc. | Director of Technology
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- 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 |
|
Back to top |
|
|
mulitskiy at acedsl.com Guest
|
Posted: Wed Oct 07, 2015 11:29 am Post subject: [asterisk-users] PJSIP: how to retrieve underlying SIP Call- |
|
|
Hello Matt,
That works (CHANNEL(pjsip,call-id)). Thanks.
I'm still interested to know if PJSIP_HEADER is supposed to be able to read headers of the outbound channel.
I'm also very interested to know if there's any way in asterisk to access headers received in "200 OK" reply,
as my proxy returns some important information there.
Thanks a lot,
Michael
On Tuesday, October 06, 2015 05:06:34 PM Matthew Jordan wrote:
Quote: | On Tue, Oct 6, 2015 at 3:25 PM, Michael Ulitskiy <mulitskiy@acedsl.com> wrote:
Quote: | 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:
e3e249e5-7e8941dd-da386565@192.168.100.238") 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?
|
Hi Michael -
While you can use PJSIP_HEADER, the ability to retrieve the SIP
Call-ID through the CHANNEL function on a PJSIP channel was actually
just added in 13.6.0, and should be in the latest RC (13.6.0-rc2 [2]).
In either case, you're using a function as opposed to some
application, which means you do need to call the functions on the
specific channel. To get access to the outbound channel, you can use a
pre-dial handler's 'b' option [3]. The Call-ID *should* be set up on
the underlying invite session in the PJSIP dialog, even though it
hasn't been transmitted yet.
Matt
[1] https://gerrit.asterisk.org/#/c/1204/
[2] http://downloads.asterisk.org/pub/telephony/asterisk/ChangeLog-13.6.0-rc2
[3] https://wiki.asterisk.org/wiki/display/AST/Pre-Dial+Handlers
|
|
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|