Answer the question
In order to leave comments, you need to log in
How to properly handle Asterisk line status?
Good day! In Asterisk, I'm newbie, please don't swear too much. Already been on google.
The point is this. There are 2 automatic telephone exchanges
1 aster on it the majority of users turns.
2 BIT.PBX to which external calls are directed.
Before connecting with BIT.ATS, if the destination phone is busy, disconnected, etc., the master spoke the appropriate phrases, now not, apparently I broke the dialplan for this case. Please help
[call-out]
;Applications
;Calling an extension
;Enable recording
exten => _5XXX,1,Dial(SIP/${EXTEN}@bit)
exten => _XXX,1,Macro(recording,${CALLERID( num)},${EXTEN})
;GROUPS
exten => 456,1,Dial(SIP/319&SIP/320&SIP/321,,m(default))
exten => 457,1,Dial(SIP/137&SIP/138&SIP/139 ,,m(default))
exten => 603,1,Dial(SIP/[email protected])
exten => 458,1,Dial(SIP/${EXTEN}@bit)
exten => _XXX,n,Dial(SIP/${EXTEN},15 )
exten => _XXXX,n,Dial(SIP/${EXTEN},15)
exten => _XXX,n,Set(dstNUM=${EXTEN})
;Check peer status, exists or not
exten => _XXX,n, GotoIf($["${SIPPEER(${EXTEN},status)}" = ""]?num-not-exist,1)
;Check peer status, connected or not
exten => _XXX,n,GotoIf($[ "${SIPPEER(${EXTEN},status):0:2}" = "UN"]?num-not-connected,1)
;Check if the channel is busy
exten => _XXX,n,ChanIsAvail(SIP/${ EXTEN},s)
;Output the value of the ChanIsAvail function to the log, only needed for debugging, you can delete the line
exten => _XXX,n,Verbose(=========== ChanIsAvail STATUS: ${AVAILSTATUS} ===========)
;If the function returns 2 or 3, then the subscriber is busy
exten => _XXX,n,GoToIf($[${AVAILSTATUS} = 2]?num-BUSY,1)
exten => _XXX,n,GoToIf($[${AVAILSTATUS } = 3]?num-BUSY,1)
exten => _XXX,n,GoToIf($[${AVAILSTATUS} = 6]?num-BUSY,1)
;Process other statuses
exten => _XXX,n,Goto(num -${DIALSTATUS},1)
;If the number doesn't exist, say "Wrong number, try again"
exten => num-not-exist,1,Wait(2)
exten => num-not-exist,n,Playback( invalid)
; If the number is not connected, say "The number you dialed is disconnected, check the number and try again
exten => num-not-connected,1,Wait(2)
exten => num-not-connected,n,Playback(ss- noservice)
; If the number is busy, say "Busy"
exten => num-BUSY,1,Wait(2)
exten => num-BUSY,n,Playback(vm-isonphone)
;If for some reason the status is CHANUNAVAIL, we say that the number is not available at the moment
exten => num-CHANUNAVAIL,1,Wait(2)
exten => num-CHANUNAVAIL,n,Playback(vm-isunavail)
;If for some reason the CHANUNAVAIL status is still there, we say that the number is not available at the moment
exten = > num-UNKNOWN,1,Wait(2)
exten => num-UNKNOWN,n,Playback(vm-isunavail)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question