最後更新: 2015-08-18
介紹
Local Channels provide a channel type for calling back into Asterisk itself.
The "Local" channel driver allows you to convert an arbitrary extension into a channel. It is used in a variety of places, including agents, etc.
Useful for recursive routing;
it is able to return to the dialplan after call completion.
Usage
Local/extension@context[/n]
Configure File
modules.conf
preload => chan_local.so
* In Asterisk 12, chan_local was moved into the Asterisk system core
* The use of Local channels as queue members is a popular way of executing parts of the dialplan and
performing checks prior to dialing the actual agent’s device.
Modifier (/n)
Default Channel Optimization
By default, the Local channel will try to optimize itself out of the call path. This means that once the Local channel has established the call between the destination and Asterisk, the Local channel will get out of the way and let Asterisk and the end point talk directly, instead of flowing through the Local channel.)
/n
We can force the Local channel to remain in the call path
i.e.
[internal]
exten => 4,1,Dial(Local/2@services/n)
Example
Example 1
exten => 201,1,Verbose(1,Call desk phone and cellphone but with delay) exten => 201,n,Dial(Local/deskphone-201@extensions,30) exten => 201,n,Hangup()
Example 2
; ring both the desk phone and their cellphone [devices] exten => 201,1,Verbose(2,Call desk phone and cellphone but with delay) exten => 201,n,Dial(Local/deskphone-201@extensions&Local/cellphone-201@extensions,30) exten => 201,n,Voicemail(201@default,${IF($[${DIALSTATUS} = BUSY]?b:u)}) exten => 201,n,Hangup() [extensions] ; Dial the desk phone exten => deskphone-201,1,Verbose(2,Dialing desk phone of extension 201) exten => deskphone-201,n,Dial(SIP/0004f2040001) ; SIP device with MAC address of 0004f2040001 ; Dial the cellphone exten => cellphone-201,1,Verbose(2,Dialing cellphone of extension 201) exten => cellphone-201,n,Verbose(2,-- Waiting 6 seconds before dialing) ; doesn't want to wait for the full ring cycle to execute on their desk phone before rolling over to their cellphone. exten => cellphone-201,n,Wait(6) exten => cellphone-201,n,Dial(DAHDI/g0/14165551212)
DOC
https://wiki.asterisk.org/wiki/display/AST/Local+Channel