Asterisk CLI dial

General usage


The dial command can be used at the Asterisk CLI to place a call from the console.

The dial command has the following syntax:

dial [<extension>]

If an <extension> follows "dial", and there is presently no call on the console, the specified extension will be dialed in the console's dialing context. The dialing context for the console is specified in either alsa.conf or oss.conf, depending on which console driver (chan_alsa or chan_oss) is being used.

If an <extension> follows "dial", but there's already a call on the console, the specified <extension> will be transmitted as DTMF digits.

If no <extension> is specified, the default extension in the console's dialing context will be dialed. Again, the default extension is specified in the respective console channel driver configuration file (alsa.conf or oss.conf).

A call on the console can be hung up at any time using the Asterisk CLI hangup CLI command.

Note: The dial command is only available at the Asterisk CLI if a console driver has been successfully loaded. If you type "dial 123" and receive the error:

No such command 'dial' (type 'help' for help)

then either the channel driver (chan_alsa.so or chan_oss.so) isn't loaded or it wasn't properly initialized. If this happens, check the settings in modules.conf and alsa.conf or oss.conf.

Specifying alternate contexts for console calls


Unfortunately, the CLI dial command won't let you specify the context in which the console dials - that's specified in the channel driver configuration file (alsa.conf or oss.conf). If you want to be able to dial multiple contexts from the console, and you don't wan't to have to edit your config each time, there's a workaround you can use: creating special extensions in your dialplan.

Suppose, for example, you're using the ALSA channel driver, and have the following in your alsa.conf:

[general]
autoanswer=no
context=consolecontext
extension=100

and the following in extensions.conf:

[consolecontext]
exten => 100,1,Dial($DEMO)

[home]
exten => 100,1,Dial($HOME1)
exten => 123,1,Dial($HOME2)
exten => 199,1,Dial($HOME3)

[work]
exten => 100,1,Dial($WORK1)
exten => 101,1,Dial($WORK2)
exten => 123,1,Dial($WORK3)

If you want console calls to be able to reach extensions in the "home" and "work" contexts, you can add a dialing prefix for each of those contexts:

[consolecontext]
exten => 100,1,Dial($DEMO)
exten => _9001.,1,Goto(home,${EXTEN:4},1)
exten => _9002.,1,Goto(work,${EXTEN:4},1)

This way, issuing the CLI command "dial 9001123" will dial extension 123 in the "home" context, while "dial 9002123" will dial extension 123 in the "work" context. Of course, "dial 100" will dial extension 100 in "consolecontext" as usual.

Specifying Dial options for console calls


Unfortunately, the CLI dial command won't let you specify dial options for calls placed from the console either. Fortunately, there's a workaround for this, too: using local channels in your dialplan.

Suppose, for example, you're using the ALSA channel driver, and have the following in your alsa.conf:

[general]
autoanswer=no
context=consolecontext
extension=100

and the following in extensions.conf:

[consolecontext]
exten => 100,1,Dial($DEMO)

Now suppose that you want to place a call to $DEMO with the Dial option "T" (so that you can later transfer the call). The dial command alone doesn't let you do that. But you can route the call through a local channel:

[consolecontext]
exten => 100,1,Dial($DEMO)
exten => _9.,1,Dial(Local/${EXTEN:1}@consolecontext,,T)

This way, issuing "dial 9100" at the CLI prompt will place the same call as "dial 100" would, but with the addition of the Dial option "T". Dialing prefixes can be created in a similar manner for any desired combination of Dial options.

See also

  • Asterisk CLI answer
  • Asterisk CLI hangup

Created by: voipdog, Last modification: Tue 02 of Sep, 2008 (05:23 UTC)


Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+

Page Changes | Comments

 

Featured -

Search: