How-to: Use Dial and Another Application at the Same Time

I spend a lot of time on IRC talking about Asterisk. A lot of questions get answered there but those answers are not archived as well as they are when questions are answered on mailing lists or forums. So, I’ll start posting some questions and answers that come from IRC discussions.

This one is a simple example that shows the usefulness of Local channels in Asterisk.

In #asterisk:

Question: How can I run the Dial() and FollowMe() applications at the same time?

My Answer: It is quite simple. The Dial() application allows you to call multiple channels at the same time. If you use a Local channel, one of the things that you are dialing can be another chunk of dialplan. For example, call 1234:


[default]
exten => 1234,1,Dial(SIP/myphone&Local/followme@default)
exten => followme,1,FollowMe(default)

Here is another common question that can be answered by the use of Local channels:

Question: How do I call a second phone after a first phone has been ringing for some period of time, while still allowing the first phone to ring?

Answer: This can be accomplished by the use of Local channels. Let’s say you want to ring phone2 after phone1 has been ringing for 10 seconds, while still allowing phone1 to ring, as well.


[default]
exten => 1234,1,Dial(SIP/phone1&Local/call_phone2@default)
exten => call_phone2,1,Wait(10)
exten => call_phone2,n,Dial(SIP/phone2)

17 thoughts on “How-to: Use Dial and Another Application at the Same Time

  1. Russell, is it possible to dial from the CLI with the originate command without having to define a extension in the dialplan first?

    I know there is the “originate” command, but I don’t know how to use it, could you be so kind to give me an example of how to do this?

    Thanks, and keep up the great work!

  2. Yeah. Thought, you may need to specify what exactly you want to dial.

    Here’s an example of originating a call between 2 phones from the CLI without any extensions in the dialplan:

    *CLI> originate SIP/phone1 application Dial SIP/phone2

    Here’s an example of originating a call to a phone and then playing it a message:

    *CLI> originate SIP/phone1 application Playback message-of-some-kind

  3. Hi Russell,

    Is it any possibility of Hold & Transfer functionality on PRI using such mixing of application with Dial ??

    By Hold & Transfer, i mean flash the current channel and transfer it to any local number in PBX and the current channel gets free after transfer.

    Hold & Transfer working fine with Analog extension but is it feasible on PRI, as traditional PBX provides this feature?

    Thanks.

  4. Hi there;
    Great website!
    You mention, “I spend a lot of time on IRC talking about Asterisk.”
    Can you tell me the places where you talked about this?

  5. Russell: I need your help with this issue:
    I need to call two externals phones through sip or zap trunks and after they answer I have to playback a message prior they can start speaking interacting.

    Something like this:
    trixbox1*CLI> originate zap/g0/54567890 application Dial SIP/CyberVOIP2/12345678

    Thank you very much!

  6. Julian, you could do something like this:

    *CLI> originate Zap/g0/54567890 extension foo@default

    [default]

    exten => foo,1,Answer
    exten => foo,n,Playback(some-file)
    exten => foo,n,Dial(SIP/12345678@CyberVOIP2,,M(bar))

    [macro-bar]

    exten => s,1,Playback(some-file)

  7. Russel: Thank you very much for your help and for your time, your solution works perfect but is possible to pass a variable to the exten => foo,n,Dial(SIP/VARIABLE@CyberVOIP2,,M(bar)) command? the problem is that the phone number is not static
    Thanks again!

  8. Russell: I found the solution, with asterisk-java I send a variable
    originateAction.setVariable(“DESTINO”,destino ); and in the context I made this change:

    [test-custom4]

    exten => foo,1,Answer
    exten => foo,n,Playback(some-file)
    exten => foo,n,Dial(SIP/${DESTINO}@CyberVOIP2,,M(bar))

    Thank you very much for your help!

  9. I’m using asterisk 1.6.
    When I do as instructed in the sample above and add the option to call a macro in the Dial app, it does not call the macro upon answer.
    Any reason why this would not work.
    exten = s,n,Dial(SIP/456789,30,M(ProcessOnAnswer))

    [macro-ProcessOnAnswer]

  10. Hi
    I have a requirement, whenever there is an incoming call to asterisk which works as IVR, it should playback a message asking the user to input for extension. then should contact a http server to translate that extn to another number. and then asterisk must send the translated number using MESSAGE: back to the client.
    Can someone suggest me?. is thr support for http transport in asterisk.
    Thanks.

  11. I am using asterisk 1.4.x.x, I want to capture the DTMF digits of the called party, i am not using any SIP configuration, i am just making the call through my ZAP channels.. I also want to know is there any way to use dial application with other application at the same time?????

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s