Hi all, I am trying to best handle in a best way following scenario.
Using asterisk 22 and PJSIP tech.
Given following dialplan it’s working great, but happend that some called endpoint are forwarded and I receive following error:
-- Now forwarding PJSIP/trunk-audiocodes-0000002e to 'Local/+44xxxxxxxx@from-trunk' (thanks to PJSIP/trunk-audiocodes-00000035) -- Not accepting call completion offers from call-forward recipient Local/+44xxxxxxxx@from-trunk-00000000;1
[Jul 29 11:46:55] NOTICE[562054][C-00000006]: core_local.c:753 local_call: No such extension/context +44xxxxxxxx@from-trunk while calling Local channel
[Jul 29 11:46:55] NOTICE[562054][C-00000006]: app_dial.c:1122 do_forward: Forwarding failed to dial ‘+44xxxxxxxx@from-trunk’
I understand that asterisk cannot handle it because cannot find “new destination” in any context.
Should be a good Idea modify [from-trunk] context adding at the end following code:
exten => _+X.,1,NoOp(Handle all other incoming calls)
same => n,Dial(PJSIP/${EXTEN}@${TRUNK_1},${TIMEOUT},rtT)
same => n,Hangup()
Or are there other way more effective?
below is the current code
[from-trunk]
exten => +4499999991,1,NoOp(Incoming call to TEST from ${CALLERID(num)} to ${EXTEN})
same => n,Set(GROUP_NAME=TEST)
same => n,GoTo(fork-call,${EXTEN},1)exten => +4499999992,1,NoOp(Incoming call to QAuditor-245 from ${CALLERID(num)} to ${EXTEN})
same => n,Set(GROUP_NAME=QAUDITOR_245)
same => n,GoTo(fork-call,${EXTEN},1)exten => +4499999993,1,NoOp(Incoming call to QAuditor-246-CQ from ${CALLERID(num)} to ${EXTEN})
same => n,Set(GROUP_NAME=QAUDITOR_246)
same => n,GoTo(fork-call,${EXTEN},1)exten => +4499999994,1,NoOp(Incoming call to Emergency from ${CALLERID(num)} to ${EXTEN})
same => n,Set(GROUP_NAME=EMERGENCY)
same => n,GoTo(fork-call,${EXTEN},1)exten => +4499999995,1,NoOp(Incoming call to Emergency from ${CALLERID(num)} to ${EXTEN})
same => n,Set(GROUP_NAME=ADE_EMERGENCY)
same => n,GoTo(fork-call,${EXTEN},1)[fork-call]
exten => +X.,1,NoOp(Forking call to group ${GROUP_NAME} for ${EXTEN})
same => n,Set(DIAL_STRING=)
same => n,Set(COUNTER=1)
same => n,While(${EXISTS(${ENDPOINTS${GROUP_NAME}[${COUNTER}]})})
same => n,Set(DIAL_STRING=${DIAL_STRING}PJSIP/${ENDPOINTS_${GROUP_NAME}[${COUNTER}]}@${TRUNK_1}&)
same => n,Set(COUNTER=$[${COUNTER} + 1])
same => n,EndWhile()
same => n,ExecIf(${LEN(${DIAL_STRING})}?Dial(${DIAL_STRING:0:-1},${TIMEOUT},rtT))
same => n,Verbose(0, Dial status: ${DIALSTATUS}, Hangup cause: ${HANGUPCAUSE})
same => n,GotoIf($[“${DIALSTATUS}” = “BUSY”]?busy)
same => n,GotoIf($[“${DIALSTATUS}” = “NOANSWER”]?noanswer)
same => n,GotoIf($[“${DIALSTATUS}” = “CONGESTION”]?congestion)
same => n,GotoIf($[“${DIALSTATUS}” = “CHANUNAVAIL”]?chanunavail)
same => n,Hangup()
same => n(busy),Verbose(0, **** Call was busy ****)
same => n,Hangup(17)
same => n(noanswer),Verbose(0, **** Call not answered ****)
same => n,Hangup(16)
same => n(congestion),Verbose(0, **** Call failed due to congestion ****)
same => n,Hangup(21)
same => n(chanunavail),Verbose(0, **** Channel unavailable ****)
same => n,Hangup(21)