Page tree
Skip to end of metadata
Go to start of metadata

About

You will frequently find the terms Channel, Call, Call Leg  (the A leg and the B Leg) and Bridged Call. We will explain these terms here.

When you place a phone call to another phone number, from the perspective of the switch that's handling the call there are 2 parts to the call. First, when you dial the number, your phone starts a connection with the switch and notifies the switch of the number you are trying to reach. Next, the switch will process the dialplan for the dialed number and start a connection to the other party. So there are now 2 separate connections to the switch, the first one is the incoming connection from the originator (caller), this is sometimes called  an ingress. The second connection is the outbound connection to the recipient of the call (callee), this is sometimes called the egress. Each of these 2 connections is referred to as a Call Leg, in FreeSWITCH a Channel represents a call leg. Channels are controlled using the dialplan, in addition each channel has a UUID that can be used  to programatically manipulate the call, or reported on in call detail records. 

In this scenario where the dialplan setup a call that connects an inbound channel with an outbound channel we call this a Bridged Call. 

FreeSWITCH supports many different protocols, the 2 legs of a call can be using different protocols, for example if you are using FreeTDM with a Digium board for PRI you can have the incoming leg on SIP and the outgoing leg on TDM, also some protocols can connect using the web browser instead of a phone. One of the powerful features of FreeSWITCH is that it bridge 2 channels even if they are using different protocols.

In this scenario we used a phone call where there is only 1 switch involved, in reality most often you will receive the phone call from your SIP Provider not directly from the originator, so there might be multiple switches involved in getting the call from the originator to the recipient, however the same concept applies. The incoming leg in this case would be the connection from your SIP provider to your FreeSWITCH, Your FreeSWITCH iso nly aware of the call legs it handles directly.

 

 Click here to expand Table of Contents

A leg vs B leg

The terminology of A Leg and B Leg can sometimes be confusing. In the strictest technical sense, the A leg represents ingress (the incoming call leg) to the switch while the B leg represents egress (the outgoing call leg) from the switch. In most cases this means that the originator of the call is the A leg and the recipient of the call is the B leg.

One legged calls

In some situations an incoming call has only one call leg, some examples would be checking your voicemail, calling in to an IVR menu, etc. These types of callse are called one legged calls. In this scenario, there is no B leg as the call is handled entirely on the switch with no need to bridge the call to another party.

Bridged calls

Once an A leg is connected to a B leg, the channels are bridged. Usually this means that if one leg hangs up the other leg continues with the dialplan (unless it doesn't have any more actions, or a dialplan at all). Bridges can be broken in other ways too (like intercept, or transferring one leg somewhere else, or bridging a leg to something else). Variables that affect what happens to the other leg when the bridge ends include hangup_after_bridge,park_after_bridge and transfer_after_bridge.

Channels vs Calls

The term Channel in FreeSWITCH refers to a call-leg. The term Call refers to the end-to-end connection from the originator to the recipient (although technically each call leg is also a call). Therefore, in a bridged call the 2 legs will be counted as 1 call. A one legged call (IVR, Voicemail, Conference etc.) will also be counted as a call.

This explains why when you run "show calls" and "show channels" from the CLI, you will see different information. In an extreme, why "show calls" may return 0 while there are active calls, this will explain the difference.

So, dialing from one phone to another phone will yield 2 channels and 1 call.

You homework assignment tonight is to make several calls and experiment with these commands:

  • show calls
  • show channels 

Try calling from phone to phone as well as trying things like calling voicemail.

Propagating variables from the A leg to the B leg

Sometimes you want to propagate variables from the A leg to the B leg or set new variables there. From the dialplan this can be done via the export command.

  • No labels