ast: mobile ext must have a number

This commit is contained in:
mpmc 2023-07-06 17:33:28 +01:00
parent bab554ea81
commit cd66c0a782
1 changed files with 29 additions and 5 deletions

View File

@ -11,17 +11,23 @@ VOICEMAIL_BOX = 1000@default
; Trunk numbers.
TRUNK_ONE_CID = +447123456789
TRUNK_TWO_CID = +447987654321
; First, some safeguards against abuse of the built-in contexts.
[default]
exten => s,1,Verbose(1, "info: ${CALLERID(num)} was passed to default")
exten => s,1, Verbose(1, "info: ${CALLERID(num)} passed to default")
same => n,Answer(1)
same => n,PlayTones(info)
same => n,Wait(2)
same => n,Playback(cannot-complete-as-dialed&check-number-dial-again)
same => n,PlayTones(info)
same => n,Hangup(3)
[presence]
exten => _X.,hint,PJSIP/${EXTEN}
[app-lastcallreturn]
exten => 1471,1,Verbose(1, "info: ${CALLERID(num)} dialed app-lastcallreturn.")
exten => 1471,1,Verbose(1, "info: ${CALLERID(num)} dialed app-lastcallreturn")
same => n,Set(number=${DB(lastcaller/${CALLERID(num)})})
same => n,Answer(2)
same => n,GotoIf($["${number}" = ""]?nonum,1)
@ -49,16 +55,34 @@ exten = 1571,1,Verbose(1, "info: ${CALLERID(num)} dialed voicemail")
same = n,Hangup()
[from-quectel0]
exten => ${TRUNK_ONE_CID},1,Queue(${QUEUE_ONE},nr,,,50)
exten => ${TRUNK_ONE_CID},1,Queue(${QUEUE_ONE},nr,,,120)
same => n,Answer(500)
same => n,Voicemail(${VOICEMAIL_BOX},su)
same => n,Hangup()
[outbound-one]
exten => _X.,1,Verbose(1, "info: using ${TRUNK_ONE_CID} for ${EXTEN}")
same => n,Set(CALLERID(all)=${TRUNK_ONE_CID})
same => n,Dial(Quectel/quectel0/${EXTEN},,r)
same => n,GotoIf($["${DIALSTATUS}"="CONGESTION"]?outbound-two,${EXTEN},1)
same => n,GotoIf($["${DIALSTATUS}"="CHANUNAVAIL"]?outbound-two,${EXTEN},1)
same => n,Hangup()
[outbound-two]
exten => _X.,1,Verbose(1, "info: using ${TRUNK_TWO_CID} for ${EXTEN}")
same => n,Set(CALLERID(all)=${TRUNK_TWO_CID})
same => n,Dial(PJSIP/${EXTEN}@trunk-two,,r)
same => n,GotoIf($["${DIALSTATUS}"="CONGESTION"]?default,s,1)
same => n,GotoIf($["${DIALSTATUS}"="CHANUNAVAIL"]?default,s,1)
same => n,Hangup()
[from-ext]
exten => 123,1,Goto(i,1)
same => n,Hangup()
exten => _XX.,1,Dial(Quectel/quectel0/${EXTEN},,r)
exten => _XX.,1,Goto(outbound-one,${EXTEN},1)
same => n,GotoIf($["${DIALSTATUS}"="CONGESTION"]?outbound-two,${EXTEN},1)
same => n,GotoIf($["${DIALSTATUS}"="CHANUNAVAIL"]?outbound-two,${EXTEN},1)
same => n,Hangup()
exten => 1471,1,Goto(app-lastcallreturn,${EXTEN},1)
@ -78,6 +102,6 @@ exten => i,1,Answer(1)
same => n,Hangup()
[to-ext]
exten => s,1,Set(DB(lastcaller/${EXTEN})=${CALLERID(num)})
exten => _X.,1,Set(DB(lastcaller/${EXTEN})=${CALLERID(num)})
same => n,Dial(PJSIP/${EXTEN},,r)
same => n,Hangup()