Summary:ASTERISK-20919: Unable to send or receive faxes with Asterisk 11 using res_fax and spandsp-0.0.6 (Tar ball spandsp-20120415)
Reporter:NITESH BANSAL (nbansal)Labels:
Date Opened:2013-01-11 09:03:18.000-0600Date Closed:2013-02-28 12:09:23.000-0600
Versions:SVN Frequency of
Environment:Debian Squeeze x86_64Attachments:( 0) AST_RECEIVER.tar.gz
( 1) AST_SENDER.tar.gz
( 2) patch_ast_fax_spandsp.patch
( 3) run-test
I tried to test a basic T38 test case, using res_fax and spandsp.
I am using 2 Asterisk instances - 1 for sending the fax and other one for receiving the fax.
I observed that fax is failing. After enabling the debug option in both SendFAX and ReceiveFAX, i noticed that tx_packet_handler function call in SPANDSP is failing. This function calls translates into  t38_tx_packet_handler in res_fax_spandsp. This function is returning -1 if the following IF check isn't true:
"if (s->details->caps & AST_FAX_TECH_GATEWAY) {"
This check isn't true when Asterisk isn't running as a gateway and infact acting as an end point.
I simuated this case using Asterisk test suite framework. I am attached the run_test script.
In addition, i am attaching the sip.conf,extensions.conf of sending asterisk and sip.conf of the receiving Asterisk.
On the receiving asterisk, dialplan simply consist of Answer() followed by ReceiveFAX.
I have also attached the logs of Asterisk on both sides.

Comments:By: NITESH BANSAL (nbansal) 2013-01-11 09:18:43.672-0600

I have made a patch for this. I am returning a legal value from t38_tx_packet_handler when Asterisk isn't behaving as a gateway.
Please review this patch.
Open to your comments.

By: Matt Jordan (mjordan) 2013-01-14 16:40:41.620-0600

That patch looks 100% correct.

By: Matt Jordan (mjordan) 2013-01-14 16:41:48.201-0600

Also: *thank-you* for the test case. We'll be sure to incorporate that into the test suite.

By: Jonathan Rose (jrose) 2013-01-22 15:36:03.443-0600

Hey Nitesh, I was looking at the test you included and noticed a couple external perl scripts that weren't included with your attachments, particularly utils/agi_load_balance_emulator.pl and utils/vcc_emulator.pl.  I'm not entirely sure what the function of either of these scripts is, but do you think this test would effectively demonstrate your bug and the efficacy of your patch without these dependencies?  If not, do you think you could rework the test to not use the perl subprocesses and instead rely on something within python to perform the necessary checks you are wanting to observe?

I've already checked the patch and it seems correct from what I've tested.

By: NITESH BANSAL (nbansal) 2013-01-30 05:04:58.823-0600

Hi Jonathan,
These external scripts perform some properietry stuff. You can remove these dependancies and write a simple dialplan on the receiver side.
If you need any information from my side, do let me know.

Nitesh Bansal

By: Jonathan Rose (jrose) 2013-02-21 16:16:54.800-0600

Hey Nitesh, I've gotten the test working within our testsuite and made some edits to the test to get it formatted properly and other stuff like that. When you provided the run-test script, I noticed you didn't attribute yourself in the source, and I was wondering if you would like me to put your name (or a handle if you prefer) in the same section as Matt Nicholson's.

By: NITESH BANSAL (nbansal) 2013-02-26 02:14:05.577-0600

Hi Jonathan,
Thanks for taking a note of it, it would be nice if you could put my name.
Nitesh Bansal

By: Jonathan Rose (jrose) 2013-02-28 12:09:23.274-0600

Committed test with attributions. Thanks for the submissions.