/var/www/html/admin/modules/fax/bin/fax-process.pl

I was getting FAXes with Subject Lines that looked like this:

New fax from US LECSTARNET %3C5052051648%3E

If you open the file /var/www/html/admin/modules/fax/bin/fax-process.pl you will see the following section:

Convert %2x to proper characters, leave anything else alone.

$subject =~ s/\%20/ /g;
$subject =~ s/\%21/\!/g;
$subject =~ s/\%22/\"/g;
$subject =~ s/\%23/\#/g;
$subject =~ s/\%24/\$/g;
$subject =~ s/\%25/\%/g;
$subject =~ s/\%26/\&/g;
$subject =~ s/\%27/\'/g;
$subject =~ s/\%28/\(/g;
$subject =~ s/\%29/\)/g;
$subject =~ s/\%2a/\*/g;
$subject =~ s/\%2A/\*/g;
$subject =~ s/\%2b/\+/g;
$subject =~ s/\%2B/\+/g;
$subject =~ s/\%2c/\,/g;
$subject =~ s/\%2C/\,/g;
$subject =~ s/\%2d/\-/g;
$subject =~ s/\%2D/\-/g;
$subject =~ s/\%2e/\./g;
$subject =~ s/\%2E/\./g;
$subject =~ s/\%2f/\//g;
$subject =~ s/\%2F/\//g;

Add the following two lines:

$subject =~ s/\%3C/\ /g;
$subject =~ s/\%3E/\ /g;

And then your subject line will look like this:

New fax from US LECSTARNET 5052051648

Can we make this a permanent feature of this file? It looks really wonky if you leave them in there.

Greg

Greg,
In 2.10 we have moved away from fax-process.pl to fax2mail.php which should resolve this issue. With that said, I’ve corrected the issue in 2.9 (see http://www.freepbx.org/trac/ticket/5435), which will be rolled when a new fax module is published.

Edit: I should also note that rather than converting them to spaces, we should be converting them to the correct character.

I set up faxes in freePBX 2.10.

I’m receiving them but in the email I see always:

New fax from: 1 (don’t know what 1 is)

Enclosed, please find a new fax from: 501 (my URI in voip trunk)
Received and processed: Thu, 29 Mar 2012 14:46:46 +0200
On: myhostname
Via: 501 (again my URI in voip trunk)
For extension: h (don’t know what h is)

My logs:

[2012-03-29 14:46:07] VERBOSE[2647] netsock2.c: == Using SIP RTP TOS bits 184
[2012-03-29 14:46:07] VERBOSE[2647] netsock2.c: == Using SIP RTP CoS mark 5
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:1] Set(“SIP/VoispeedCRV-0000000b”, “GROUP()=OUT_4”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:2] Goto(“SIP/VoispeedCRV-0000000b”, “from-trunk,501,1”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Goto (from-trunk,501,1)
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:1] Set(“SIP/VoispeedCRV-0000000b”, “__FROM_DID=501”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:2] Gosub(“SIP/VoispeedCRV-0000000b”, “app-blacklist-check,s,1()”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:1] GotoIf(“SIP/VoispeedCRV-0000000b”, “0?blacklisted”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:2] Set(“SIP/VoispeedCRV-0000000b”, “CALLED_BLACKLIST=1”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:3] Return(“SIP/VoispeedCRV-0000000b”, “”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:3] Set(“SIP/VoispeedCRV-0000000b”, “CDR(did)=501”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:4] ExecIf(“SIP/VoispeedCRV-0000000b”, “1 ?Set(CALLERID(name)=5556969696)”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:5] Set(“SIP/VoispeedCRV-0000000b”, “__CALLINGPRES_SV=allowed_not_screened”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:6] Set(“SIP/VoispeedCRV-0000000b”, “CALLERPRES()=allowed_not_screened”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:7] Set(“SIP/VoispeedCRV-0000000b”, “FAX_DEST=ext-featurecodes^666^1”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:8] Answer(“SIP/VoispeedCRV-0000000b”, “”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [[email protected]:9] Wait(“SIP/VoispeedCRV-0000000b”, “4”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] chan_sip.c: == Redirecting ‘SIP/VoispeedCRV-0000000b’ to fax extension due to CNG detection
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: == Spawn extension (from-trunk, fax, 1) exited non-zero on ‘SIP/VoispeedCRV-0000000b’
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:1] Goto(“SIP/VoispeedCRV-0000000b”, “ext-featurecodes,666,1”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Goto (ext-featurecodes,666,1)
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:1] Goto(“SIP/VoispeedCRV-0000000b”, “from-internal,666,1”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Goto (from-internal,666,1)
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:1] Set(“SIP/VoispeedCRV-0000000b”, "[email protected]") in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:2] Goto(“SIP/VoispeedCRV-0000000b”, “ext-fax,s,1”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Goto (ext-fax,s,1)
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:1] Macro(“SIP/VoispeedCRV-0000000b”, “user-callerid,”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:1] Set(“SIP/VoispeedCRV-0000000b”, “AMPUSER=5556969696”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:2] GotoIf(“SIP/VoispeedCRV-0000000b”, “0?report”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:3] ExecIf(“SIP/VoispeedCRV-0000000b”, “1?Set(REALCALLERIDNUM=5556969696)”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:4] Set(“SIP/VoispeedCRV-0000000b”, “AMPUSER=”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:5] Set(“SIP/VoispeedCRV-0000000b”, “AMPUSERCIDNAME=”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:6] GotoIf(“SIP/VoispeedCRV-0000000b”, “1?report”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Goto (macro-user-callerid,s,13)
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:13] GotoIf(“SIP/VoispeedCRV-0000000b”, “0?continue”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:14] Set(“SIP/VoispeedCRV-0000000b”, “__TTL=64”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:15] GotoIf(“SIP/VoispeedCRV-0000000b”, “1?continue”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Goto (macro-user-callerid,s,26)
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:26] Set(“SIP/VoispeedCRV-0000000b”, “CALLERID(number)=5556969696”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:27] Set(“SIP/VoispeedCRV-0000000b”, “CALLERID(name)=5556969696”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:28] Set(“SIP/VoispeedCRV-0000000b”, “CHANNEL(language)=it”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:2] NoOp(“SIP/VoispeedCRV-0000000b”, “Receiving Fax for: [email protected] , From: “5556969696” <5556969696>”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:3] StopPlayTones(“SIP/VoispeedCRV-0000000b”, “”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [[email protected]:4] ReceiveFAX(“SIP/VoispeedCRV-0000000b”, “/var/spool/asterisk/fax/1333025167.11.tif,f”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] res_fax.c: – Channel ‘SIP/VoispeedCRV-0000000b’ receiving FAX ‘/var/spool/asterisk/fax/1333025167.11.tif’
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: – Executing [[email protected]:5] ExecIf(“SIP/VoispeedCRV-0000000b”, “0?Set(FAXSTATUS=“FAILED: error: statusstr: OK”)”) in new stack
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: – Executing [[email protected]:6] Hangup(“SIP/VoispeedCRV-0000000b”, “”) in new stack
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: == Spawn extension (ext-fax, s, 6) exited non-zero on ‘SIP/VoispeedCRV-0000000b’
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: – Executing [[email protected]:1] GotoIf(“SIP/VoispeedCRV-0000000b”, “0?failed”) in new stack
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: – Executing [[email protected]:2] GotoIf(“SIP/VoispeedCRV-0000000b”, “0?noemail”) in new stack
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: – Executing [[email protected]:3] System(“SIP/VoispeedCRV-0000000b”, “/var/lib/asterisk/bin/fax2mail.php --to "[email protected]” --dest “501” --callerid --file /var/spool/asterisk/fax/1333025167.11.tif --exten “h”") in new stack
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: – Executing [[email protected]:4] Macro(“SIP/VoispeedCRV-0000000b”, “hangupcall,”) in new stack
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: – Executing [[email protected]:1] GotoIf(“SIP/VoispeedCRV-0000000b”, “1?theend”) in new stack
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: – Goto (macro-hangupcall,s,3)
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: – Executing [[email protected]:3] Hangup(“SIP/VoispeedCRV-0000000b”, “”) in new stack
[2012-03-29 14:46:46] VERBOSE[4140] app_macro.c: == Spawn extension (macro-hangupcall, s, 3) exited non-zero on ‘SIP/VoispeedCRV-0000000b’ in macro ‘hangupcall’
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: == Spawn extension (ext-fax, h, 4) exited non-zero on ‘SIP/VoispeedCRV-0000000b’

This has been fixed and checked into FreePBX already. Please make sure all your modules are updated.