[Freeswitch-users] CNG Detection for T.38 <--> G.711 Transcoding

Gabriel Kuri gkuri at ieee.org
Mon Aug 31 20:42:31 UTC 2020

Hi All:

Trying to do T.38 <--> G.711 transcoding using "t38_gateway=self cng" in
the dialplan.

Here's the scenario...

A-leg: Analog Telephone Adapter (T.38)
FS in the middle
B-leg: Out to Carrier/Provider (G.711u)

The ATA initiates the call outbound to the carrier/provider. The far end
FAX machine picks up and the call begins.

I'm wanting FS to Re-INVITE T.38 to the ATA on the a-leg when it detects a
CNG tone. That seems to work about 50% of the time (on average). The other
50% of the time, it doesn't seem to detect the FAX tone and the call stays
as G.711u and eventually fails. Below is the dialplan for reference.

I'm guessing the CNG tone detection on FS is hit and miss because of a
timing issue, but I'm not really sure. Is it possible to detect the CED,
V.21 Preamble, or /ANSAM of the receiving fax (far-end), in order to try
and make the switchover more reliable? Or am I barking up the wrong tree
here and/or possibly doing something wrong?

For what it's worth, I've also tried changing the dialplan to have FS force
the T.38 Re-INVITE "nocng" (ie execute_on_answer=t38_gateway self nocng),
and FS Re-INVITEs T.38 immediately after the 200 OK. While the ATA seems to
accept the T.38 Re-INVITE, it then stops sending RTP/UDPTL traffic entirely
and the call eventually fails. It doesn't seem to like the Re-INVITE when
it occurs that fast. I've also tried this on multiple ATAs with the same


        <extension name="to_fax_dest">
          <condition field="destination_number" expression="^\+\d{11}$">
            <action application="set" data="hangup_after_bridge=true"/>
            <action application="set" data="t38_passthru=false"/>
            <action application="set" data="fax_verbose=true"/>
            <action application="set" data="fax_enable_t38_request=true"/>
            <action application="set" data="execute_on_answer=t38_gateway
self cng"/>
            <action application="bridge"
data="{refuse_t38=true}sofia/sip/xxxxx at aa.bb.cc.dd"/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20200831/b48172bf/attachment.html>

More information about the FreeSWITCH-users mailing list