Hi all,
I’m trying to rewrite Diversion header when call forwarding is done on
the phone. The phone sends "302 Moved Temporarily" response and sets
Diversion header to a local number, but before Asterisk sends this call
towards TSP provider I need to change Diversion header to a full PSTN
number. I am using PJSIP_HEADER in a pre-dial handler (configuration is
below). On the same call I can add some other custom headers (logs are
below).
Is there any chance I can rewrite Diversion header in this scenario with
PJSIP_HEADER function? Asterisk version is 16.0.1 built from source on
Debian 9.
Thank you
Davor
# Outgoing context - TSP provider
[outgoing]
exten =>
0123456789,1,Dial(PJSIP/${EXTEN}@${SBC_1},,b(add_diversion^FWDdiver^1))
same => n,Hangup()
# Diversion manipulation context
[add_diversion]
exten =>
FWDdiver,1,Set(PJSIP_HEADER(add,Diversion)=<sip:full_pstn...@example.com>\;reason=unconditional\;screen=yes\;privacy=off))
exten =>
FWDdiver,2,Set(PJSIP_HEADER(add,CustomOne)=<sip:custom_...@example.com>\;reason=unconditional\;screen=yes\;privacy=off))
exten =>
FWDdiver,3,Set(PJSIP_HEADER(add,CustomTwo)=<sip:custom_...@example.com>\;reason=unconditional\;screen=yes\;privacy=off))
exten => FWDdiver,4,Return()
Asterisk*CLI>
-- Now forwarding PJSIP/527-00000168 to 'Local/0123456789@outgoing'
(thanks to PJSIP/836-00000169)
[Dec 10 10:25:08] NOTICE[26309][C-000000c0]: app_dial.c:1005 do_forward:
Not accepting call completion offers from call-forward recipient
Local/0123456789@outgoing-0000002c;1
-- Executing [0123456789@outgoing:1]
Dial("Local/0123456789@outgoing-0000002c;2",
"PJSIP/0123456789@SBC1,,b(add_diversion^FWDdiver^1)") in new stack
-- PJSIP/SBC1-0000016a Internal Gosub(add_diversion,FWDdiver,1) start
-- Executing [FWDdiver@add_diversion:1] Set("PJSIP/SBC1-0000016a",
"PJSIP_HEADER(add,Diversion)=<sip:full_pstn...@example.com>;reason=unconditional;screen=yes;privacy=off)")
in new stack
-- Executing [FWDdiver@add_diversion:2] Set("PJSIP/SBC1-0000016a",
"PJSIP_HEADER(add,CustomOne)=<sip:custom_...@example.com>;reason=unconditional;screen=yes;privacy=off)")
in new stack
-- Executing [FWDdiver@add_diversion:3] Set("PJSIP/SBC1-0000016a",
"PJSIP_HEADER(add,CustomTwo)=<sip:custom_...@example.com>;reason=unconditional;screen=yes;privacy=off)")
in new stack
-- Executing [FWDdiver@add_diversion:4]
Return("PJSIP/SBC1-0000016a", "") in new stack
Phone => Asterisk
U 10.201.8.192:5060 -> 10.201.1.19:5060
SIP/2.0 302 Moved Temporarily.
Diversion: <sip:836@10.201.1.19>;reason=unconditional.
Asterisk => TSP provider
U 10.201.1.19:5060 -> 10.201.1.15:5060
CustomOne:
<sip:custom_...@example.com>;reason=unconditional;screen=yes;privacy=off.
CustomTwo:
<sip:custom_...@example.com>;reason=unconditional;screen=yes;privacy=off.
Diversion: <sip:836@192.168.1.101>;reason=unconditional.
--
_____________________________________________________________________
-- 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