Hello there,
i’m dealing with headache of configration when dealing with forwarded calls. I tried to put the case in the image above. From PSTN asterisk receives dial to number 1200 from number 1300 via sip, asterisk dials asterisk IVR via iax2, asterisk IVR in some cases forwards the call to number 1400 through iax2 to asterisk and asterisk then dials 1400 through sip to PSTN.
The catch here is that we need to initialize call from asterisk to number 1400 in PSTN with sip diversion header containing original caller 1200. I’ve tried to add diversion header on asterisk IVR but to no avail. When reviewing sip packets from asterisk to PSTN there is no such header. Below there are relevant logs from asterisk IVR regarding diversion header. I just can’t figure out how to transfer diversion information from asterisk IVR to asterisk, please help
VERBOSE[7780][C-000088d7] pbx.c: Executing [1200@from-pstn:1] Set("IAX2/asteriskIVR_asterisk-12588", "__DIRECTION=INBOUND") in new stack
VERBOSE[7780][C-000088d7] pbx.c: Executing [1200@from-pstn:2] Gosub("IAX2/asteriskIVR_asterisk-12588", "sub-record-check,s,1(in,1300,dontcare)") in new stack
VERBOSE[7780][C-000088d7] pbx.c: Executing [s@sub-record-check:1] GotoIf("IAX2/asteriskIVR_asterisk-12588", "0?initialized") in new stack
...
VERBOSE[7780][C-000088d7] pbx.c: Executing [072@ext-queues:51] Queue("IAX2/asteriskIVR_asterisk-12588", "072,t,,custom/ivr-072-112-operator-announcement,120,,,,,") in new stack
VERBOSE[7780][C-000088d7] res_musiconhold.c: Started music on hold, class 'default', on channel 'IAX2/asteriskIVR_asterisk-12588'
VERBOSE[7852][C-000088d7] app_mixmonitor.c: Begin MixMonitor Recording IAX2/asteriskIVR_asterisk-12588
VERBOSE[7780][C-000088d7] app_queue.c: Called Local/1400@from-queue/n
VERBOSE[7853][C-000088d7] pbx.c: Executing [1400@from-queue:1] Set("Local/1400@from-queue-000051b8;2", "QAGENT=1400") in new stack
...
VERBOSE[7853][C-000088d7] pbx.c: Executing [1400@from-internal:4] GosubIf("Local/1400@from-queue-000051b8;2", "1?sub-diversion-header,s,1()") in new stack
VERBOSE[7853][C-000088d7] pbx.c: Executing [s@sub-diversion-header:1] Set("Local/1400@from-queue-000051b8;2", "DIVERSION_REASON=no-answer") in new stack
VERBOSE[7853][C-000088d7] pbx.c: Executing [s@sub-diversion-header:2] Gosub("Local/1400@from-queue-000051b8;2", "func-set-sipheader,s,1(Diversion,<tel:1200>;reason=no-answer;screen=no;privacy=off)") in new stack
VERBOSE[7853][C-000088d7] pbx.c: Executing [s@func-set-sipheader:1] NoOp("Local/1400@from-queue-000051b8;2", "Sip Add Header function called. Adding Diversion = <tel:1200>;reason=no-answer;screen=no;privacy=off") in new stack
VERBOSE[7853][C-000088d7] pbx.c: Executing [s@func-set-sipheader:2] Set("Local/1400@from-queue-000051b8;2", "HASH(__SIPHEADERS,Diversion)=<tel:1200>;reason=no-answer;screen=no;privacy=off") in new stack
VERBOSE[7853][C-000088d7] pbx.c: Executing [s@func-set-sipheader:3] Return("Local/1400@from-queue-000051b8;2", "") in new stack
VERBOSE[7853][C-000088d7] pbx.c: Executing [s@sub-diversion-header:3] Return("Local/1400@from-queue-000051b8;2", "") in new stack
...
VERBOSE[7853][C-000088d7] app_stack.c: IAX2/asteriskIVR_asterisk-24725 Internal Gosub(func-apply-sipheaders,s,1(1)) start
VERBOSE[7853][C-000088d7] pbx.c: Executing [s@func-apply-sipheaders:1] NoOp("IAX2/asteriskIVR_asterisk-24725", "Applying SIP Headers to channel IAX2/asteriskIVR_asterisk-24725") in new stack
VERBOSE[7853][C-000088d7] pbx.c: Executing [s@func-apply-sipheaders:2] Set("IAX2/asteriskIVR_asterisk-24725", "TECH=IAX2") in new stack
VERBOSE[7853][C-000088d7] pbx.c: Executing [s@func-apply-sipheaders:3] Set("IAX2/asteriskIVR_asterisk-24725", "SIPHEADERKEYS=Alert-Info,Diversion") in new stack
VERBOSE[7853][C-000088d7] pbx.c: Executing [s@func-apply-sipheaders:4] While("IAX2/asteriskIVR_asterisk-24725", "1") in new stack
VERBOSE[7853][C-000088d7] pbx.c: Executing [s@func-apply-sipheaders:5] Set("IAX2/asteriskIVR_asterisk-24725", "sipheader=unset") in new stack
...
VERBOSE[7859][C-000088d7] pbx.c: Executing [s@macro-dialout-trunk:30] Dial("Local/1400@from-queue-000051b9;2", "IAX2/asteriskIVR_asterisk/1400,300,b(func-apply-sipheaders^s^1,(1))U(sub-send-obroute-email^1400^1400^1^1736763769^Q3 HSP L2:1300^1300)") in new stack
VERBOSE[7859][C-000088d7] app_stack.c: IAX2/asteriskIVR_asterisk-23271 Internal Gosub(func-apply-sipheaders,s,1(1)) start
VERBOSE[7859][C-000088d7] pbx.c: Executing [s@func-apply-sipheaders:1] NoOp("IAX2/asteriskIVR_asterisk-23271", "Applying SIP Headers to channel IAX2/asteriskIVR_asterisk-23271") in new stack
VERBOSE[7859][C-000088d7] pbx.c: Executing [s@func-apply-sipheaders:2] Set("IAX2/asteriskIVR_asterisk-23271", "TECH=IAX2") in new stack