Fax-process.pl not executing under 1.6.2.2

For those of you who this is failing…

can you try the following patch:

functions.inc.php in fax module:

Index: functions.inc.php
===================================================================
--- functions.inc.php   (revision 9055)
+++ functions.inc.php   (working copy)
@@ -265,7 +265,8 @@
     }
     $exten = 'h';
                $ext->add($context, $exten, '', new ext_gotoif('$["${FAXSTATUS:0:6}" = "FAILED"]', 'failed'));
-    $ext->add($context, $exten, 'process', new ext_execif('$["${FAX_RX_EMAIL}" != ""]','system','${ASTVARLIBDIR}/bin/fax-process.pl --to ${FAX_RX_EMAIL} --from "'.$sender_address['0'].'" --dest "${FROM_DID}" --subject "New fax from ${URIENCODE(${CALLERID(name)})} ${URIENCODE(<${CALLERID(number)}>)}" --attachment fax_${URIENCODE(${CALLERID(number)})}.pdf --type application/pdf --file ${ASTSPOOLDIR}/fax/${UNIQUEID}.tif'));
+    $ext->add($context, $exten, 'process', new ext_gotoif('$["${FAX_RX_EMAIL}" = ""]','end'));
+    $ext->add($context, $exten, '', new ext_system('${ASTVARLIBDIR}/bin/fax-process.pl --to ${FAX_RX_EMAIL} --from "'.$sender_address['0'].'" --dest "${FROM_DID}" --subject "New fax from ${URIENCODE(${CALLERID(name)})} ${URIENCODE(<${CALLERID(number)}>)}" --attachment fax_${URIENCODE(${CALLERID(number)})}.pdf --type application/pdf --file ${ASTSPOOLDIR}/fax/${UNIQUEID}.tif'));
 
          $ext->add($context, $exten, 'end', new ext_macro('hangupcall'));
     $ext->add($context, $exten, 'failed', new ext_noop('FAX ${FAXSTATUS} for: ${FAX_RX_EMAIL} , From: ${CALLERID(all)}'),'process',101);

My fax machine is at home so I’ll test this evening. I did apply the patch and the generated dialplan looks good. Will post my results here.

I can’t explain why the ExecIf fails in 1.6.2 but the revised GotoIf worked perfectly.

Thanks!

ok well go and hammer on the Asterisk team to figure out what is up. In the mean time, if you could, open a new bug about the failure mode on 1.6.2 mentioning it is an * issue, and I’ll get this checked in against that bug and we’ll just compensate for the fact that * has issues for now on some versions.

I put your patch and opened ticket 4096. I’ll reopen my ticket again at digium. I’m going to put in the exact generated dialplan and tell them it is broken. They’ve been a pain to get to accept the ticket before but I’ll do what I can.

the patch did not work for me.
maybe i didnt apply it well?

anyway the asterisk log file full shows
cd /var/www/freepbx/admin/modules
WARNING[3680] ast_expr2.fl: ast_yyerror(): syntax error: syntax error, unexpected ‘’, expecting $end; Input:
""[email protected]"" = “”
^

I hope you ll make an update to fax module, if your patch works for most people

kartaka,

can you paste a few lines before and after that warning so we can see where it came from please.

solved
resolved with your latest fax module update
thanks

can u give me the URL of this ticket?
where i can follow the developments and news for this problem?

thanks a lot

I posted a bug and after looking through it extensively it appears the dialplan from FreePBX is correct. The problem now looks like it is in the ExecIf statement of 1.6.2. I reopened a ticket with Asterisk which can be followed on Asterisk issue tracker. I’m going to run a few more tests to verify the issue and post more information to that ticket.

OK, I did something very simple. I replaced the fax-process.pl line generated from the dialplan and replaced it with a simple script. That script executes.

fax-process.pl is not working in 1.6.2. I don’t know why and give up. It has taken way too much of my time already.

it’s not working?

or it’s not working when called form an ExecIf?

If just the latter, as mentioned in the ticket, we can change how we call it if need be if the issue is a general issue and we resolve it down to not working when called by ExecIf, until we get to root cause of why in that scenario.

The ExecIf is working. I created simple scripts (below). When I call the script with the ExecIf in lieu of the fax-process.pl generated statement, it all works fine. But for some reason the ExecIf statement with fax-process.pl is not working.

So this points back to something in the generated statement that 1.6.2 doesn’t like. Philippe, you’ve spent a lot of time on this already. I’m not sure you want to spend any more time on it…I know not excited about it!

Just as an FYI, here was the dialplan I created which worked.

exten => 9999,n,Set(FAX_RX_EMAIL="[email protected]")
exten => 9999,n(process),System(/usr/src/temp.sh)
exten => 9999,n(process),ExecIf($["${FAX_RX_EMAIL}" != “”]?system(/usr/src/temp2.sh)

temp.sh is
#!/bin/bash
ls -l /tmp > /tmp/temp.txt

temp2.sh is
#!/bin/bash
ls -l /tmp > /tmp/temp2.txt

When this dialplan executes both temp.txt and temp2.txt exist in /tmp. This indicates the ExecIf is working ok. I did make sure I purged /tmp before calling the extension.

ip-rob,

but my question is does the faxprocess.pl work when called just from a a System call?

In other words, if we change the dialplan to this, would it work:

exten => h,n,GotoIf($["${FAX_RX_EMAIL}" != ""]?noemail)
exten => h,n,System(fax-process.pl command here)
exten => h(noemail),MacroExit()

or something like that…

I’ve been able to get fax-process.pl to work without the ExecIf. So that should work.

actually i had applied tha patch manually.
maybe i did not apply it well.
it was a copy paste.

After updating the fax module, i have no issues, so i cannot reproduce it

thanks

The quote issue has been resolved by asterisk. The ticket, 0016842, has a patch attached that resolves the quoting problem. I tested the patch and it worked fine. I’m getting ready to test the patch for the ExecIf to see if that resolves the problem.

Rob

Their fix for the ExecIf problem also worked. Ticket 0016905 fixes the issue related to ExecIf’s in 1.6.2.2.

thanks for staying on top of this. We’ll probably leave the code as is in FreePBX for quite some time as it will take a long time for that bug to works its way out of installed Asterisk systems and the current dialplan works just fine, one extra instruction isn’t going to hurt anything :slight_smile: