Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: some bridge links went to wrong page
Warning

Under Construction

Topics

* Asterisk Channels (What is a channel?)
** Common Asterisk Channels (SIP, DAHDI, Local?)
* Configuring Channels (explanation and link to channel drivers configuration )
* Using, Controlling, Routing Channels (explanation of when a channel is created and interaction with dialplan)
** Calls create channels
** Driver config plus dialplan tells channels how to behave.
** APIs can affect and inspect channels (and other things)
** Channels talk to other channels - Bridges (links to Bridging concepts page)

Other topics:

Inbound versus Outbound
Children

Note
Section
Column

Asterisk Channels

Almost nothing happens in Asterisk without a channel being involved. A channel is an entity inside Asterisk that acts as a channel of communication between Asterisk and another device. That is, a phone, a PBX, another Asterisk system, or even Asterisk itself (in the case of a local channel).

Our documentation and many Asterisk users speak about channels in terms of "calls". A call can be one or more channels creating a path of communication or activity through the Asterisk system.

To give you an idea about what channels do, here are a few facts about them:

  • Channel Drivers provide channels in Asterisk.
  • Channels can interface with each other through bridges.
  • Applications and functions can affect the state or attributes of a channel or its media stream.
  • Channels are commonly passing audio between communication endpoints, but can pass other data, such as video or text messages.
  • Channels execute instructions with dialplan, but can be controlled by other APIs (AGI,AMI,ARI) or interfaces (CLI). 

Common Asterisk Channels

One of the many benefits of Asterisk is the capability to interface with as many different technologies as you have channel drivers! However, most administrators will only make use of a few types at a time.

Here are a few commonly used channel types:

...

...

  • Local channels

...

  • provided by chan_local. (This was moved into the core in Asterisk 12)

SIP channels are used to interface with SIP capable VOIP devices, such as phones, channel banks, other PBXs or Internet Telephony Service Providers.

DAHDI channels are used to interface with DAHDI drivers and PRI libraries. In this case chan_dahdi allows you to use any DAHDI capable devices, such as Digium's line of T1/E1/J1 interface cards.

Local channels are used for dialing inward to the system itself, allowing any Asterisk component that can dial to call directly into dialplan. This provides a sort of "fake" call that still executes real instructions.

Column
Panel

Table of Contents
maxLevel1

Configuring Channels

Text File Configuration

...

Once channels are established and communicating between devices and Asterisk; where that data flows to depends on the channel type itself, its overall configuration, device specific configuration, signaling sent by the originating mechanism (a device, a command, an API call) and associated bridges. One or more channels could be talking to one or more channels over various bridges. What specifically Asterisk talks to on each channel is limited only by the technology implemented by the channel driver.

...

The primary exception is with Local Channels. In the case of local channels, you'll typically have two local channel legs, one that is treated as outbound and the other as inbound. In this case both are really inside Asterisk, but one is executing dialplan and the other is not. The leg executing dialplan is the one treated as inbound.

Below we'll diagram some examples to make things cleara few examples for clarity.

 

Gliffy Diagram
nameInboundOutboundChannels

Example explanations:

Channels and Variable Inheritance

The figures have been kept somewhat generic and should apply to most channel types. Each figure shows the final state of the call, rather than a sequence of events.

Below are explanations of the various figures.

Fig 1

One phone dials another phone; about as simple as it gets.

The inbound channel is created from Alice's phone calling Asterisk. Asterisk then calls the extension dialed by Alice by creating an outbound channel to talk to Bob. Once the call is established the two channels are put into a bridgeBridges.

Fig 2

A user runs the originate command from AMI, or maybe something like "channel originate SIP/Alice application playback demo-congrats" from the CLI. Asterisk creates an outbound channel to call the device specified (SIP/Alice). When answered, Asterisk begins treating the channel like an inbound channel and connects it to the specified dialplan application.

Fig 3

Perhaps a user runs originate again - but this time "channel originate SIP/Alice extension [email protected]" from the CLI. Where [email protected] contains dialplan telling Asterisk to dial outbound to SIP/Bob. At first, the created outbound channel would look like Fig 2 where it begins to be treated as inbound after the device answers the call. At that point, a number of things happen:

  • Asterisk creates an outbound local channel into Asterisk and bridges it with the now inbound channel to Alice.
  • Asterisk creates another leg of local channel as "inbound" into Asterisk to execute the dialplan at the extension specified with the originate. This local channel is essentially bridged with some magic to the other local channel.
  • In our case the dialplan executes something like Dial(SIP/Bob), so the new SIP channel is created to communicate with SIP/Bob and is then bridged with the inbound local channel. Now communication flows across the whole path.

For this example demonstrating relationships between channels and other elements we used non-optimized local channels. If the local channels are optimized, then they will optimize themselves out of this mix and Alice and Bob's channels would be bridged together directly.

Channel Variable Inheritance

When working with channels you'll almost certainly be touching channel variables. It is useful to note that upon setting a channel variable the level of inheritance between channels can be defined. This is discussed in the Channel Variables sub-section Variable Inheritance.