Thanks for the quick reply.
Setting the context to from-pstn-toheader still fails with the below verbose output
Connected to Asterisk 13.22.0 currently running on IT-FE-PBX-1 (pid = 2750)
== Setting global variable ‘SIPDOMAIN’ to ‘3907751437197.corporate.vodafone.it’
– Executing [+3907751437197;trunk-context=3907751437197.ims.vf.it;tgrp=tg3907751437197@from-pstn-toheader:1] NoOp(“PJSIP/vodafone_pjsip_1-0000007e”, “Attempting to extract DID from SIP To header”) in new stack
– Executing [+3907751437197;trunk-context=3907751437197.ims.vf.it;tgrp=tg3907751437197@from-pstn-toheader:2] GotoIf(“PJSIP/vodafone_pjsip_1-0000007e”, “0?SIP”) in new stack
– Executing [+3907751437197;trunk-context=3907751437197.ims.vf.it;tgrp=tg3907751437197@from-pstn-toheader:3] GotoIf(“PJSIP/vodafone_pjsip_1-0000007e”, “1?PJSIP”) in new stack
– Goto (from-pstn-toheader,+3907751437197;trunk-context=3907751437197.ims.vf.it;tgrp=tg3907751437197,7)
– Executing [+3907751437197;trunk-context=3907751437197.ims.vf.it;tgrp=tg3907751437197@from-pstn-toheader:7] Goto(“PJSIP/vodafone_pjsip_1-0000007e”, “from-pstn,+3907751437197,1”) in new stack
– Goto (from-pstn,+3907751437197,1)
– Executing [+3907751437197@from-pstn:1] Set(“PJSIP/vodafone_pjsip_1-0000007e”, “__FROM_DID=+3907751437197”) in new stack
– Executing [+3907751437197@from-pstn:2] NoOp(“PJSIP/vodafone_pjsip_1-0000007e”, “Received an unknown call with DID set to +3907751437197”) in new stack
– Executing [+3907751437197@from-pstn:3] Goto(“PJSIP/vodafone_pjsip_1-0000007e”, “s,a2”) in new stack
– Goto (from-pstn,s,2)
– Executing [s@from-pstn:2] Answer(“PJSIP/vodafone_pjsip_1-0000007e”, “”) in new stack
> 0x7f52987be760 – Strict RTP learning after remote address set to: 192.168.100.3:19814
> 0x7f52987be760 – Strict RTP learning after remote address set to: 192.168.100.3:19814
[2018-12-19 12:48:45] WARNING[28879][C-0000004b]: chan_sip.c:22996 func_header_read: This function can only be used on SIP channels.
– Executing [s@from-pstn:3] Log(“PJSIP/vodafone_pjsip_1-0000007e”, "WARNING,Friendly Scanner from ") in new stack
[2018-12-19 12:48:45] WARNING[28879][C-0000004b]: Ext. s:3 @ from-pstn: Friendly Scanner from
– Executing [s@from-pstn:4] Wait(“PJSIP/vodafone_pjsip_1-0000007e”, “2”) in new stack
> 0x7f52987be760 – Strict RTP switching to RTP target address 192.168.100.3:19814 as source
– Executing [s@from-pstn:5] Playback(“PJSIP/vodafone_pjsip_1-0000007e”, “ss-noservice”) in new stack
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘ss-noservice.slin16’ (language ‘en’)
> 0x7f52987be760 – Strict RTP learning complete - Locking on source address 192.168.100.3:19814
– Executing [s@from-pstn:6] SayAlpha(“PJSIP/vodafone_pjsip_1-0000007e”, “+3907751437197”) in new stack
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘letters/plus.slin16’ (language ‘en’)
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘digits/3.slin16’ (language ‘en’)
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘digits/9.slin16’ (language ‘en’)
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘digits/0.slin16’ (language ‘en’)
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘digits/7.slin16’ (language ‘en’)
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘digits/7.slin16’ (language ‘en’)
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘digits/5.slin16’ (language ‘en’)
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘digits/1.slin16’ (language ‘en’)
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘digits/4.slin16’ (language ‘en’)
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘digits/3.slin16’ (language ‘en’)
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘digits/7.slin16’ (language ‘en’)
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘digits/1.slin16’ (language ‘en’)
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘digits/9.slin16’ (language ‘en’)
– <PJSIP/vodafone_pjsip_1-0000007e> Playing ‘digits/7.slin16’ (language ‘en’)
– Executing [s@from-pstn:7] Hangup(“PJSIP/vodafone_pjsip_1-0000007e”, “”) in new stack
== Spawn extension (from-pstn, s, 7) exited non-zero on ‘PJSIP/vodafone_pjsip_1-0000007e’
– Executing [h@from-pstn:1] Macro(“PJSIP/vodafone_pjsip_1-0000007e”, “hangupcall,”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“PJSIP/vodafone_pjsip_1-0000007e”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [s@macro-hangupcall:3] ExecIf(“PJSIP/vodafone_pjsip_1-0000007e”, “0?Set(CDR(recordingfile)=)”) in new stack
– Executing [s@macro-hangupcall:4] NoOp(“PJSIP/vodafone_pjsip_1-0000007e”, " monior file= ") in new stack
– Executing [s@macro-hangupcall:5] AGI(“PJSIP/vodafone_pjsip_1-0000007e”, “attendedtransfer-rec-restart.php,”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/attendedtransfer-rec-restart.php
– <PJSIP/vodafone_pjsip_1-0000007e>AGI Script attendedtransfer-rec-restart.php completed, returning 0
– Executing [s@macro-hangupcall:6] Hangup(“PJSIP/vodafone_pjsip_1-0000007e”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 6) exited non-zero on ‘PJSIP/vodafone_pjsip_1-0000007e’ in macro ‘hangupcall’
== Spawn extension (from-pstn, h, 1) exited non-zero on ‘PJSIP/vodafone_pjsip_1-0000007e’
Can you please help me creating the context?
Is it possible to pass regular expression commands to strip out the text or will it have to be in the format as per below:
;-------------------------------------------------------------------------------
; from-pstn-to-did:
;
; The context is designed for providers who send the DID in the TO: SIP header
; only. The format of this header is:
;
; To: sip:[email protected]
;
; So the DID must be extracted between the sip: and the @, which this does
;
[from-pstn-toheader]
exten => _.,1,NoOp(Attempting to extract DID from SIP To header)
exten => _.,n,gotoif($["${CHANNEL(channeltype)}"=“SIP”]?SIP)
exten => _.,n,gotoif($["${CHANNEL(channeltype)}"=“PJSIP”]?PJSIP)
exten => _.,n,NoOp(Unable to determine SIP channel type)
exten => _.,n,goto(from-pstn,${EXTEN},1))
exten => _.,n(SIP),Goto(from-pstn,${CUT(CUT(SIP_HEADER(To),@,1),:,2)},1)
exten => _.,n(PJSIP),Goto(from-pstn,${CUT(CUT(PJSIP_HEADER(read,To),@,1),:,2)},1)
;-------------------------------------------------------------------------------