Hi<div><br></div><div>I&#39;m trying to send fax from FreeSWITCH to PSTN using T.38. FS is connected to Broadsoft softswitch. The softswitch is connected to PSTN using SIP-trunk to external provider. Apparently there is no T.38 on Broadsoft and it is provided by the external provider (i.e. Broadsoft provides only T.38 pass-through).</div>

<div><br></div><div>I can receive faxes destined at FS without a problem. I call rxfax and FS sends re-INVITE to Broadsoft and T.38 transmission begins.</div><div><br></div><div>However, when I want to send fax, I can&#39;t get re-INVITE from Broadsoft with T.38. From the company that operates the Broadsoft softswitch I received a PCAP of working transmission with Linksys/SPA2102-5.2.10: SPA2102 issues re-INVITE itself when sending fax and T.38 is negotiated correctly. Unfortunately I can&#39;t get FS to issue the re-INVITE.</div>

<div><br></div><div>I thought that a part of the problem is that FS receives from Broadsoft RTP-event Fax ANS (32) messages and it somehow interferes with fax-detecting routing in spandsp. Unfortunately, disabling telephone-event altogether didn&#39;t help - Broadsoft does not sent RTP-event packets but still FS does not re-INVITE.</div>

<div><br></div><div>My sending script is as follows:</div><div><br></div><div><div>    var variables = &quot;{&quot;;</div><div>    variables += &quot;loopback_bowout=false,&quot;;</div><div>    variables += &quot;ignore_early_media=true,&quot;;</div>

<div>    variables += &quot;origination_caller_id_number=&#39;&quot; + callerid + &quot;&#39;,&quot;;</div><div>    variables += &quot;origination_caller_id_name=&#39;&quot; + callername + &quot;&#39;,&quot;;</div><div><br>

</div><div>    variables += &quot;fax_ident=&#39;&quot; + callerid + &quot;&#39;,&quot;;</div><div>    variables += &quot;fax_header=&#39;&quot; + callername + &quot;&#39;,&quot;;</div><div>    variables += &quot;fax_email=&#39;&quot; + email + &quot;&#39;,&quot;;</div>

<div>    variables += &quot;fax_dest=&#39;&quot; + dest + &quot;&#39;,&quot;;</div><div>    variables += &quot;fax_tiff=&#39;&quot; + tiff + &quot;&#39;,&quot;;</div><div>    variables += &quot;fax_attempt=&#39;&quot; + attempt + &quot;&#39;,&quot;;</div>

<div>    variables += &quot;fax_max_attempts=&#39;&quot; + max_attempts + &quot;&#39;,&quot;;</div><div>    variables += &quot;fax_delay=&#39;&quot; + delay + &quot;&#39;,&quot;;</div><div><br></div><div>    variables += &quot;fax_enable_t38=true,&quot;;</div>

<div>    variables += &quot;fax_enable_t38_insist=true,&quot;;</div><div>    variables += &quot;fax_enable_t38_request=true,&quot;;</div><div>    variables += &quot;fax_disable_v17=false,&quot;;</div><div>    variables += &quot;fax_use_ecm=true,&quot;;</div>

<div>    //variables += &quot;fax_force_caller=true,&quot;;</div><div>    variables += &quot;fax_verbose=true&quot;;</div><div>    variables += &quot;}&quot;;</div></div><div><br></div><div><div>    var s = new Session(variables + &quot;loopback/&quot;+dest+&quot;/pbx/XML&quot;);</div>

<div><br></div><div>    hook_run = 0;</div><div>    s.setHangupHook(hangup_hook);</div><div>    if (s.ready()) {</div><div>        console_log(&quot;DEBUG&quot;, &quot;calling txfax\n&quot;);</div><div>        s.execute(&quot;txfax&quot;, tiff);</div>

<div>        console_log(&quot;DEBUG&quot;, &quot;returning from txfax&quot; + &quot;\n&quot;);</div><div>    } else {</div><div>        console_log(&quot;INFO&quot;, &quot;sending fax from &quot; + callerid + &quot; to &quot; + dest + &quot;: could not connect: &quot; + s.cause + &quot;(&quot; + s.causecode + &quot;)&quot; + &quot;\n&quot;);</div>

<div>        return;</div><div>    }</div></div><div><br></div><div>I do send the fax through loopback as I need it to establish rating session. I have experimented with various settings in fax_* variables. The only combination where anything happens (there is some T.30 negotiation in the logs) is when I set fax_enable_t38_request to false - then FS tries to negotiate T.30 transmission over G.711. I&#39;ve never observed T.38 connection when sending fax, but it always ends with (20) Received no response to DCS or TCF. </div>

<div><br></div><div>Usually the only thing there is in the logs is:</div><div><br></div><div><div>2012-05-16 17:27:19.824842 [DEBUG] mod_spandsp_fax.c:1357 Raw read codec activation Success L16 20000</div><div>2012-05-16 17:27:19.824842 [DEBUG] mod_spandsp_fax.c:1373 Raw write codec activation Success L16</div>

<div>2012-05-16 17:27:22.124834 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier up (-2) in state 18</div></div><div><div>2012-05-16 17:27:22.884832 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier down (-1) in state 18</div>

<div>2012-05-16 17:27:23.444834 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier up (-2) in state 18</div><div>2012-05-16 17:27:23.784833 [DEBUG] switch_rtp.c:3452 RTP RECV DTMF 2012-05-16 17:27:23.804833 [DEBUG] switch_rtp.c:3452 RTP RECV DTMF 2012-05-16 17:27:26.544834 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC sig</div>

<div>nal status is Carrier down (-1) in state 18</div><div>2012-05-16 17:27:26.544834 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier up (-2) in state 18</div><div>2012-05-16 17:27:27.264833 [DEBUG] switch_rtp.c:3452 RTP RECV DTMF 2012-05-16 17:27:27.284873 [DEBUG] switch_rtp.c:3452 RTP RECV DTMF 2012-05-16 17:27:27.604841 [DEBUG] switch_rtp.c:3452 RTP RECV DTMF 2012-05-</div>

<div>16 17:27:28.884836 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Abort (-8) in state 18</div><div>2012-05-16 17:27:28.884836 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier down (-1) in state 18</div>

<div>2012-05-16 17:27:30.704933 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier up (-2) in state 18</div><div>2012-05-16 17:27:30.764833 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier down (-1) in state 18</div>

<div>2012-05-16 17:27:31.904833 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier up (-2) in state 18</div><div>2012-05-16 17:27:34.544835 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier down (-1) in state 18</div>

<div>2012-05-16 17:27:37.544837 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier up (-2) in state 18</div><div>2012-05-16 17:27:40.164835 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier down (-1) in state 18</div>

<div>2012-05-16 17:27:41.184835 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier up (-2) in state 18</div><div>2012-05-16 17:27:41.224837 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Abort (-8) in state 18</div>

<div>2012-05-16 17:27:41.224837 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier down (-1) in state 18</div><div>2012-05-16 17:27:43.184834 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier up (-2) in state 18</div>

<div>2012-05-16 17:27:44.824838 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier down (-1) in state 18</div><div>2012-05-16 17:27:45.664833 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier up (-2) in state 18</div>

<div>2012-05-16 17:27:45.664833 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier down (-1) in state 18</div><div>2012-05-16 17:27:45.724837 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier up (-2) in state 18</div>

<div>2012-05-16 17:27:45.724837 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier down (-1) in state 18</div><div>2012-05-16 17:27:45.784837 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier up (-2) in state 18</div>

<div>2012-05-16 17:27:45.804837 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 HDLC signal status is Carrier down (-1) in state 18</div><div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 Status changing to &#39;The call dropped prematurely&#39;</div>

<div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:491 ==============================================================================</div><div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:504 Fax processing not successful - result (49) The call dropped prematurely.</div>

<div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:509 Remote station id: </div><div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:510 Local station id: </div><div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:511 Pages transferred: 0</div>

<div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:513 Total fax pages:   0</div><div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:514 Image resolution:  0x0</div><div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:515 Transfer Rate:     14400</div>

<div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:517 ECM status         off</div><div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:518 remote country:   </div><div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:519 remote vendor:    </div>

<div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:520 remote model:     </div><div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:522 ==============================================================================</div>

<div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 Changing from state 18 to 32</div><div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:286 FLOW T.30 Changing from phase T30_PHASE_A_CNG to T30_PHASE_CALL_FINISHED</div>

<div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:286 FLOW FAX Set rx type 9</div><div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:286 FLOW FAX FAX exchange complete</div><div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:286 FLOW FAX Set tx type 9</div>

<div>2012-05-16 17:27:46.304847 [DEBUG] mod_spandsp_fax.c:286 FLOW FAX FAX exchange complete</div></div><div><br></div><div>The same script transmits faxes correctly with Cisco gateway, but Cisco correctly re-INVITEs FS when FS is transmitting fax.</div>

<div><br></div><div>PCAP dumps available, but I&#39;d like to keep them private and not post on public pastebin.</div><div><br></div><div>I&#39;d appreciate any help on this issue.</div><div><br></div><div>Best regards</div>

<div><div><br></div>-- <br>Marcin Gozdalik<br>
</div>