Use the power of local channels
When you run :
Type Description Devicestate Indications Transfer
———- ———– ———– ———– ——–
Gtalk Gtalk Channel Driver no yes no
IAX2 Inter Asterisk eXchange Driver (Ver 2) yes yes yes
Zap Zapata Telephony Driver w/PRI no yes no
SIP Session Initiation Protocol (SIP) yes yes yes
Phone Standard Linux Telephony API Driver no yes no
MGCP Media Gateway Control Protocol (MGCP) yes yes no
Console OSS Console Channel Driver no yes no
Skinny Skinny Client Control Protocol (Skinny) no yes no
Agent Call Agent Proxy Channel yes yes no
Local Local Proxy Channel Driver yes yes no
———-
You can see here the Local channel type on the list.
This channel purpose is preatty simple. When you dial SIP/ressource, or IAX2/ressource,
asterisk will try to reach the sip or iax end point.
Local channels will send a channel that will goes through the dialplan and execute whatever is at the given extension.
Syntax : Dial(Local/extension@context)
Of course, you can add any options to the dial
Since nobody needs to answer any phone when using the Local channel, you can use it to query asterisk, send outbound calls to an extension that will dial an outbound number.
Example : Click to call
Let’s say you have a click to call application where from your website where somebody needs to click and a call will be place to a given extension 3000 and play the sounds file /var/lib/asterisk/sounds/my-click-message.gsm
- From your webserver, write a file local.call in /var/spool/asterisk/outgoing with the folowing content
Dial: Local/3000@default
Application : Playback
Data : my-click-message
This means, asterisk will create and launch the channel Local/3000@default so will send a Local channel to extension 3000 in default context. And if that call answers, asterisk will execute the application Playback with the message my-click-message.
Now, you just need to configure your dialplan (extensions.conf) to tell asterisk, what he has to do when a call comes in at extension 3000 in default context.
[default]
exten => 3000,1,Noop( Call comes in to extension ${EXTEN} )
exten => 3000,n,Dial(Zap/g1/4180000000) ; outbound dial to number 4180000000
exten => 3000,n,Hangup
Comments
Leave a Reply