S
S
Sergey Ryzhkin2019-02-14 15:16:27
Asterisk
Sergey Ryzhkin, 2019-02-14 15:16:27

Translation from external to external, how to implement on Asterisk?

Comrades!
Help answer for a beginner in telephony.
The network has three-digit numbers. When the secretary calls an external number, makes a transfer and transfers to an internal one, everything works fine.
But when she calls to an external one and tries to transfer to a mobile, an error is generated. I understand that the problem is in DialPlan, but I can't correct it.

Dial plan
;
; extensions.conf - the Asterisk dial plan
;
[general]
static=yes
writeprotect=no
[globals]
TRANSFER_CONTEXT=local
[default]
[phones]
include => local
include => outgoing
[local]
exten => 900,1,Answer()
exten => 900,n,ConfBridge(1,confer)
exten => 133,1,Dial(SIP/198&SIP/199,60)
exten => _XXX,1,Dial(SIP/${EXTEN},60,tT)
exten => _XXX,n,Hangup()
[outgoing]
exten => _XXX.,1,Gosub(trunk_check,s,1(${EXTEN}))
;Dial plan "Incoming"
[incoming]
exten => ***,1,Dial(SIP/150,,t)
exten => ***,1,Goto(ivr-main-1,s,1)
exten => ***,1,Goto(ivr-main-1,s,1)
exten => ***,1,Goto(ivr-main-1,s,1)
exten => ***,1,Goto(ivr-main-1,s,1)
exten => ***,1,Dial(SIP/122,,t)
exten => ***,1,Dial(SIP/145,,t)
exten => ***,1,Goto(ivr-main-1,s,1)
[trunk_check]
exten => s,1,Dial(SIP/${ARG1}@213153,45,T)
same => n,Dial(SIP/${ARG1}@213135,45,T)
same => n,Dial(SIP/${ARG1}@213136,45,T)
same => n,Dial(SIP/${ARG1}@213157,45,T)
same => n,Dial(SIP/${ARG1}@213158,45,T)
same => n,Dial(SIP/${ARG1}@213159,45,T)
same => n,Dial(SIP/${ARG1}@213162,45,T)
same => n,Hangup()
[ivr-main-1]
exten => s,1,Answer()
exten => s,2,Background(/etc/asterisk/ivr/ivr-welcome-02)
exten => s,3,WaitExten(5)
exten => #900,1,Goto(local,${EXTEN:1},1)
exten => _XXX,1,Dial(SIP/${EXTEN},15)
;Check status peer: exists or not
exten => _XXX,n,GotoIf($["${SIPPEER(${EXTEN},status)}" = ""]?num-not-exist,1)
;Check status peer: enable or not
exten => _XXX,n,GotoIf($["${SIPPEER(${EXTEN},status):0:2}" = "UN"]?num-not-connected,1)
;Check channel
exten => _XXX,n,ChanIsAvail(SIP/${EXTEN},s)
;If 2 or 3 - Busy
exten => _XXX,n,GoToIf($[${AVAILSTATUS} = 2]?num-BUSY,1)
exten => _XXX,n,GoToIf($[${AVAILSTATUS} = 3]?num-BUSY,1)
;other statuses
exten => _XXX,n,Goto(num-${DIALSTATUS},1)
;Say - Try again
exten => num-not-exist,1,Wait(2)
exten => num-not-exist,n,Playback(invalid)
;Say - check number
exten => num-not-connected,1,Wait(2)
exten => num-not-connected,n,Playback(ss-noservice)
;Say - Busy
exten => num-BUSY,1,Wait(2)
exten => num-BUSY,n,Playback(vm-isonphone)
;Say - not available
exten => num-NOANSWER,1,Wait(2)
exten => num-NOANSWER,n,Playback(vm-isunavail)
;status CHANUNAVAIL,say - disabled
exten => num-CHANUNAVAIL,1,Wait(2)
exten => num-CHANUNAVAIL,n,Playback(vm-isunavail)
;return Secretariat
exten => t,1,Dial(SIP/101,15)

I understand that in theory the problem is in [local], I change _XXX to _XXX there. - as I understand it, this allows you to dial a number with 3 or more digits, i.e. mobile is suitable.
But when I dial an internal number consisting of 3 digits, it swears, and in the Aster console it says that this was not found in the [phones] context.
Help with advice. Doesn't it need to be done separately? In the [outgoing] context, it already defaults to _XXX., changing it to local does not help.
Update^
If you do not edit the dialplan and call as it is, then the log is below:
log image
5c657694b6eb5269780476.png

Those. the log shows that when I call outside and dial *2, for a directed transfer, then after dialing three digits 886 in this case, he tries to look for this internal number, does not find it and the call returns.
You need to understand how to make sure that he does not drop the call and then listen to the dialing.
Update 2
And also look in the title it says:
[globals]
TRANSFER_CONTEXT=local

Maybe you need to specify some other transfer here, which will also work for the exterior?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2019-02-14
@Franciz

_XXX is strictly three digits
_XXX. is three digits and at least one character.
_XXX! is at least three digits

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question