# Asterisk Project : Trivial Local Channel Example

Added by mdavenport , edited by mdavenport on Aug 31, 2010

In our dialplan (extensions.conf), we can Dial() another part of the dialplan through the use Local channels. To do this, we can use the following dialplan:

    [devices]
    exten => 201,1,Verbose(2,Dial another part of the dialplan via the Local chan)
    exten => 201,n,Verbose(2,Outside channel: ${CHANNEL})
    exten => 201,n,Dial(Local/201@extensions)
    exten => 201,n,Hangup()

    [extensions]
    exten => 201,1,Verbose(2,Made it to the Local channel)
    exten => 201,n,Verbose(2,Inside channel: ${CHANNEL})
    exten => 201,n,Dial(SIP/some-named-extension,30)
    exten => 201,n,Hangup()

The output of the dialplan would look something like the following. The output has been broken up with some commentary to explain what we're looking at.

    – Executing [201@devices:1] Verbose("SIP/my_desk_phone-00000014", "2,Dial another part of the dialplan via the
                Local chan") in new stack
    == Dial another part of the dialplan via the Local chan

We dial extension 201 from SIP/my_desk_phone which has entered the [devices] context. The first line simply outputs some information via the Verbose() application.

    – Executing [201@devices:2] Verbose("SIP/my_desk_phone-00000014",
                     "2,Outside channel: SIP/my_desk_phone-00000014") in new stack
    == Outside channel: SIP/my_desk_phone-00000014

The next line is another Verbose() application statement that tells us our current channel name. We can see that the channel executing the current dialplan is a desk phone (aptly named 'my_desk_phone').

    – Executing [201@devices:3] Dial("SIP/my_desk_phone-00000014", "Local/201@extensions") in new stack
    – Called 201@extensions

Now the third step in our dialplan executes the Dial() application which calls extension 201 in the [extensions] context of our dialplan. There is no requirement that we use the same extension number - we could have just as easily used a named extension, or some other number. Remember that we're dialing another channel, but instead of dialing a device, we're "dialing" another part of the dialplan.

    – Executing [201@extensions:1] Verbose("Local/201@extensions-7cf4;2", "2,Made it to the Local
                 channel") in new stack == Made it to the Local channel

Now we've verified we've dialed another part of the dialplan. We can see the channel executing the dialplan has changed to Local/201@extensions-7cf4;2. The part '-7cf4;2' is just the unique identifier, and will be different for you.

    – Executing [201@extensions:2] Verbose("Local/201@extensions-7cf4;2", "2,Inside channel:
                 Local/201@extensions-7cf4;2") in new stack
    == Inside channel: Local/201@extensions-7cf4;2

Here we use the Verbose() application to see what our current channel name is. As you can see the current channel is a Local channel which we created from our SIP channel.

    – Executing [201@extensions:3] Dial("Local/201@extensions-7cf4;2", "SIP/some-named-extension,30") in new stack

And from here, we're using another Dial() application to call a SIP device configured in sip.conf as [some-named-extension].

Now that we understand a simple example of calling the Local channel, let's expand upon this example by using Local channels to call two devices at the same time, but delay calling one of the devices.