- FreeSWITCH 1.8
- Anthony Minessale II Giovanni Maruzzelli
- 474字
- 2025-04-04 18:52:56
Call legs (channels)
Each industry has its own parlance and magic words. In telecommunication, whatever the underlying technology (SIP, WebRTC, TDM, etc), you will very often read about call "legs" and "channels".
First confusing fact: each "call leg" is actually a call in its own right. That is: a call is often said to be made by an "A-leg" and a "B-leg". In fact, "A-leg" and "B-leg" are proper calls.
Second confusing fact: each leg is a channel. So, most of the "calls" are consisting of two channels(A-leg and B-leg), while some (to IVRs, voicemail, and the like) are consisting of one only channel (A-leg).
The reason for this funny terminology is the fact that when people talk about "a call", they usually mean an end-to-end voice or video connection, from the caller to the callee. Also, and maybe more importantly, calls were billed this way, as a complete "circuit" established between caller and callee.
Such a complete "call" circuit, when you have a server in the middle (for example, FreeSWITCH) is actually made by two completely separate and independent calls (also known as channels): one from the caller to FreeSWITCH, and one from FreeSWITCH to callee.
To better understand this, think at when you check your voicemail. The call "circuit" is between you and the voicemail server. This is the "A-leg" of the call (and in this case, there is no "B-leg").
From the server (that is, FreeSWITCH) point of view, the "A-leg" is the "incoming" call, the call originated by the caller.
After an incoming call is received, depending on the dialplan, a second call leg (in fact, another independent channel) will be originated by FreeSWITCH. Is also possible that dialplan will originate many B-legs (for example, when you want one person to be called in parallel to its cellphone, deskphone and home phone). This newly originated call(s) is(are) the B-leg(s).

Consider a situation where an incoming call is arriving into FreeSWITCH. Inside FreeSWITCH this is allocated as one channel. This is the A-leg. Let's say destination_number of that call is 1010, it matches the "Local_Extension" extension in demo configuration dialplan.
FreeSWITCH originates another call(s) (allocated as channel(s) ) from itself to each of the internal phone(s) registered as "1010". This is/are B-leg(s) calls/channels.
If one phone answers, then FreeSWITCH will join (eg mix, bridge) the media streams of the two channels/calls, and they (the caller and callee) can talk to each other. Now the ongoing complete "call", is actually composed by two calls/channels: A-leg (from caller to FreeSWITCH) and B-leg (from FreeSWITCH to callee).
If nobody answers, after a timeout the B-leg(s) (calls/channels originated by FreeSWITCH to 1010 phones) will die (canceled by FreeSWITCH).
The A-leg will go to voicemail. The complete "call" is now composed by only one channel (also known as call), the A-leg, from the caller to FreeSWITCH.