Page 312 - Asterisk™: The Future of Telephony
P. 312

includes the context to handle the call with, where we perform a Goto() to the context
               we have been assigned (which controls our outbound access).
               If we try to dial a number that is not handled by our context (or one of the transitive
               contexts—i.e., international contains -> long distance, which also contains -> local),
               then the built-in extension i is executed which plays back a message stating the action
               cannot be performed, then hangs up the caller:
                   [hotdesk_outbound]
                   exten => _X.,1,NoOp()
                   exten => _X.,n,Set(LOCATION=${CUT(CHANNEL,/,2)})
                   exten => _X.,n,Set(LOCATION=${CUT(LOCATION,-,1)})
                   exten => _X.,n,Set(WHO=${HOTDESK_PHONE_STATUS(${LOCATION})})
                   exten => _X.,n,GotoIf($[${ISNULL(${WHO})}]?no_outgoing,1)
                   exten => _X.,n,Set(${WHO}_CID_NAME=${HOTDESK_INFO(cid_name,${WHO})})
                   exten => _X.,n,Set(${WHO}_CID_NUMBER=${HOTDESK_INFO(cid_number,${WHO})})
                   exten => _X.,n,Set(${WHO}_CONTEXT=${HOTDESK_INFO(context,${WHO})})
                   exten => _X.,n,Goto(${${WHO}_CONTEXT},${EXTEN},1)
                   [international]
                   exten => _011.,1,NoOp()
                   exten => _011.,n,Set(E=${EXTEN})
                   exten => _011.,n,Goto(outgoing,call,1)
                   exten => i,1,NoOp()
                   exten => i,n,Playback(silence/2&sorry-cant-let-you-do-that2)
                   exten => i,n,Hangup()
                   include => longdistance

                   [longdistance]
                   exten => _1NXXNXXXXXX,1,NoOp()
                   exten => _1NXXNXXXXXX,n,Set(E=${EXTEN})
                   exten => _1NXXNXXXXXX,n,Goto(outgoing,call,1)

                   exten => _NXXNXXXXXX,1,Goto(1${EXTEN},1)
                   exten => i,1,NoOp()
                   exten => i,n,Playback(silence/2&sorry-cant-let-you-do-that2)
                   exten => i,n,Hangup()

                   include => local
                   [local]
                   exten => _416NXXXXXX,1,NoOp()
                   exten => _416NXXXXXX,n,Set(E=${EXTEN})
                   exten => _416NXXXXXX,n,Goto(outgoing,call,1)
                   exten => i,1,NoOp()
                   exten => i,n,Playback(silence/2&sorry-cant-let-you-do-that2)
                   exten => i,n,Hangup()
               If the call is allowed to be executed, then the call is sent to the [outgoing] context for
               call processing, where the caller ID name and number are set with the  CALLERID()



               284 | Chapter 12: Relational Database Integration
   307   308   309   310   311   312   313   314   315   316   317