[globals] ; General internal dialing options used in context Internal at ; extension dial_internal_exten. See the Dial app documentation for options. INTERNAL_DIAL_OPT=,10 [Hints] ;Allow dynamic hint creation for every extension. exten = _11XX,hint,PJSIP/${EXTEN} [Features] ;Extension to check user voicemail. exten = 8000,1,Verbose(1, "User ${CALLERID(num)} dialed the voicemail feature.") same = n,VoiceMailMain(${CALLERID(num)}@example,s) same = n,Hangup() [DialingErrors] ; Handle any extensions dialed that don't otherwise exist. ; Comment out or remove this extension if you would rather have the calls ; ignored. exten = _X.,1,Verbose(1, "User ${CALLERID(num)} dialed an invalid number.") same = n,Playback(pbx-invalid) same = n,Hangup() [Internal] ; Include other contexts providing specific functionality for internal users. include = Hints include = Features include = DialingErrors ; Handle internal calling between user extensions. exten = _11XX,1,Verbose(1, "User ${CALLERID(num)} dialed internally to ${EXTEN}.") same = n,Gosub(Internal,dial_internal_exten,1(${EXTEN})) same = n,Hangup() ; Internal Dialing Subroutine ; ; ARG1 will be the extension number dialed. exten = dial_internal_exten,1,Verbose(1, "Entering internal dialing gosub.") same = n,Gotoif($[${DEVICE_STATE(PJSIP/${ARG1})} = BUSY]?dialed-BUSY,1:) same = n,Dial(PJSIP/${ARG1}${INTERNAL_DIAL_OPT}) same = n,Goto(dialed-${DIALSTATUS},1) exten = dialed-NOANSWER,1,NoOp() same = n,Voicemail(${ARG1}@example,u) same = n,Return() exten = dialed-BUSY,1,NoOp() same = n,Voicemail(${ARG1}@example,b) same = n,Return() exten = dialed-CHANUNAVAIL,1,NoOp() same = n,Playback(pbx-invalid) same = n,Return() exten = _dialed-.,1,Goto(dialed-NOANSWER,1) exten = h,1,Hangup()