Summary:ASTERISK-15732: app_fax exits with returncode -1, transmission error, although fax is sent correctly, AGI aborts execution
Reporter:chrisde (chrisde)Labels:
Date Opened:2010-03-02 15:12:07.000-0600Date Closed:2015-02-25 22:19:57.000-0600
Versions:Frequency of
Environment:Attachments:( 0) faxagidebug.txt
( 1) faxlogcomplete.txt
Description:After several tests I figured out a problem with app_fax and probably another problem with AGI.

First, as can be seen in the logs, app_fax always terminates with

app_fax.c:764 transmit: Transmission error

Although the fax always goes through and is received correctly by the remote fax. As can be seen in the logs the remote side sends a sip 'BYE' message (probably because the fax has gone through?). Probably this is not correclty handled by app_fax and causes the transmission error?

This is the first part of the problem. The second part is that app_fax then returns '-1'. This causes the AGI script to be aborted. This is very bad behavior since then it is not possible to handle further processing (read variables set by app_fax like 'FAXSTATUS', 'FAXPAGES', etc.).

In some cases of my trials (also with old phpagi 1.6 instead of 2.14) the AGI script had not been terminated immediately but continued making the next steps (read variables). There I saw that return value of app_fax was also FAXSTATUS=SUCCESS.

So I think this time there is really something wrong with app_fax.c and not in spandsp. And also the way res_agi.c handles returnvalues in case of 'EXEC' could be wrong OR app_fax should never return '-1' to cause the agi script to be aborted.
Comments:By: chrisde (chrisde) 2010-03-03 01:20:50.000-0600

faxagidebug.txt shows agi debug output of a phpagi 1.6 script. Interesting here are the variables that are successfully read:
<SIP/sipcall-00000001>AGI Tx >> 200 result=1
<SIP/sipcall-00000001>AGI Rx << GET VARIABLE FAXSTATUS
<SIP/sipcall-00000001>AGI Tx >> 200 result=1 (SUCCESS)
<SIP/sipcall-00000001>AGI Rx <<

By: Leif Madsen (lmadsen) 2010-03-03 08:31:07.000-0600

Can you try with the latest 1.6.0 branch? We'll be having a new set of release candidates here shortly, but is based on which is at least a couple of months old now, and I know a lot of work has been going on with T.38 and fax transmissions.

svn co http://svn.asterisk.org/svn/asterisk/branches/1.6.0

By: chrisde (chrisde) 2010-03-03 09:23:29.000-0600

exactly the same debug output with version
Asterisk SVN-branch-1.6.0-r250265, Copyright (C) 1999 - 2010 Digium, Inc. and ot

also I tried with not The version was just not available in bugtracker.

By: Matt Jordan (mjordan) 2015-02-25 22:19:44.871-0600

Per the Asterisk versions page [1], the maintenance (bug fix) support for the Asterisk branch you are using has ended. For continued maintenance support please move to a supported branch of Asterisk. After testing with a supported branch, if you find this problem has not been resolved, please open a new issue against the latest version of that Asterisk branch.


[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions

Please note that {{app_fax}} is an extended support module. The preferred Fax applications to use are now provided by {{res_fax}}. You may want to use that module, as issues reported against {{app_fax}} are unlikely to receive the same amount of attention.