FreeSWITCH transcoding
As seen in the diagram, when FreeSWITCH requires transcoding between its endpoints the transcoding codec module (codec_sangoma.so) first sends the transcoding request down to the sngtc_server serially in SOAP TCP protocol. This type of protocol is utilized so that application will be able to access the transcoder resources from other networks. This means that the codec module can be installed in a distributed format (is not required to be installed on the same machine as the sngtc_server). This makes it possible to use the transcoder when the Asterisk server is located in a remote location with respect to the sngtc_server/transcoder. Â
The sngtc_server is responsible for detecting, controlling, and setting up transcoding sessions with the transcoding module. The communication between the sngtc_server and transcoder is over Ethernet, which means both must be located on the same network (This requirement must be remembered if a distributed format will be used). When the sngtc_server receives a transcoding session request from the codec module, it sets up 2 RTP legs with the transcoder, sending codec and host port/ip information of the application (FreeSWITCH). The transcoder module replies with its own port/ip information to indicate where the application above should send the RTP media to. After this point, the sngtc_server is no longer required, and RTP media flows directly between the application and the transcoder card.
It is important to understand that FreeSWITCH understands only Linear codec and every other codec is translated to Linear in order for FreeSWITCH to interpret. So, in the above example, when Endpoint A sends audio to End point B, two transcoding sessions are requested by FreeSWITCH (alaw-> linear and linear-> G729). This creates 4 RTP legs between the transcoder and FreeSWITCH. The first 2 RTP legs are created when incoming audio in Alaw format is received by FreeSWITCH. Alaw->linear transcoding is requested in order for FreeSWITCH to interpret and use the audio. When FreeSWITCH receives the transcoded audio in Linear format it then must request another transcoding session to translate from Linear to G729. Steps 2 and 3 are then repeated (request is sent to sngtc_server to setup another 2 RTP legs). At this point, audio is flowing to Endpoint B. When End point B wants to sends audio back to  End point A, a G729->Linear and Linear->alaw transcoding session request is required. Since the opposite direction of all 4 RTP legs are un-used by the initial alaw->G729 transcoding request (yellow colour arrows) they are used for this audio flow.  This means, for one two-way call between two end points, 2 hardware transcoding sessions are required because the RTP sessions are re-used.