FreeSWITCH 1.8
上QQ阅读APP看书,第一时间看更新

Call Legs

Call legs are what we people in the Real Time Communication field live and die for. It is a concept that can be confusing at first, but will become a second nature as time goes and you continue to work with FreeSWITCH.

Let's start with an example: we are in an office, and we have a PBX. Francesca wants to phone Giovanni. She dial Giovanni's extension. A call is established between Francesca's phone and the PBX, Francesca will hear the ringback (or a message if Giovanni is away). This call, from Francesca to the PBX, is known as "A" leg in telco jargon. Then, the PBX knows from its configuration that it must connect this A leg to Giovanni's phone, so Francesca and Giovanni can talk. PBX will originate a new call, known in lingo as "B" leg, from itself to Giovanni's phone. If Giovanni answers his ringing phone, PBX will join ("bridge" in telco lingo) the A leg with the B leg, and let the media (audio, video, whatever) flow back and forth from Francesca to Giovanni.

So: from the point of view of FreeSWITCH "A leg" is the original, initial, inbound, incoming call. "B leg" is the derivative, PBX originated, outbound call. From the point of view of the end user (Francesca), her call is successful (that is, she talks with Giovanni), if PBX successfully bridges A leg and B leg, after B leg has been answered by Giovanni. They can talk, eventually!

Let's suppose Giovanni is not there, and Francesca gets connected to the voicemail system (so, she is still only in touch with the office PBX): this is a "call" that is composed only by an "A leg", there is only one set, the inbound Francesca<=>PBX, of media streams.

There are cases where there are more than two legs, for example if Francesca calls Giovanni, and then she invites a third person to join, in a three-way call. In this case the lingo goes: from Francesca to the PBX, is the "A leg". All others legs that are originated because of Francesca call, in this case both the call leg from PBX to Giovanni and the call leg from PBX to the third person, all those are B legs (that is, there is no concept of a "C leg", "D leg", etc. They are all "B" legs).