/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 [501@from-trunk-sip-VoispeedCRV:1] Set(“SIP/VoispeedCRV-0000000b”, “GROUP()=OUT_4”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [501@from-trunk-sip-VoispeedCRV: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 [501@from-trunk:1] Set(“SIP/VoispeedCRV-0000000b”, “__FROM_DID=501”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [501@from-trunk:2] Gosub(“SIP/VoispeedCRV-0000000b”, “app-blacklist-check,s,1()”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [s@app-blacklist-check:1] GotoIf(“SIP/VoispeedCRV-0000000b”, “0?blacklisted”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [s@app-blacklist-check:2] Set(“SIP/VoispeedCRV-0000000b”, “CALLED_BLACKLIST=1”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [s@app-blacklist-check:3] Return(“SIP/VoispeedCRV-0000000b”, “”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [501@from-trunk:3] Set(“SIP/VoispeedCRV-0000000b”, “CDR(did)=501”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [501@from-trunk:4] ExecIf(“SIP/VoispeedCRV-0000000b”, “1 ?Set(CALLERID(name)=5556969696)”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [501@from-trunk:5] Set(“SIP/VoispeedCRV-0000000b”, “__CALLINGPRES_SV=allowed_not_screened”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [501@from-trunk:6] Set(“SIP/VoispeedCRV-0000000b”, “CALLERPRES()=allowed_not_screened”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [501@from-trunk: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 [501@from-trunk:8] Answer(“SIP/VoispeedCRV-0000000b”, “”) in new stack
[2012-03-29 14:46:07] VERBOSE[4140] pbx.c: – Executing [501@from-trunk: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 [fax@from-trunk: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 [666@ext-featurecodes: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 [666@from-internal:1] Set(“SIP/VoispeedCRV-0000000b”, "[email protected]") in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [666@from-internal: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 [s@ext-fax:1] Macro(“SIP/VoispeedCRV-0000000b”, “user-callerid,”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [s@macro-user-callerid:1] Set(“SIP/VoispeedCRV-0000000b”, “AMPUSER=5556969696”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [s@macro-user-callerid:2] GotoIf(“SIP/VoispeedCRV-0000000b”, “0?report”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [s@macro-user-callerid:3] ExecIf(“SIP/VoispeedCRV-0000000b”, “1?Set(REALCALLERIDNUM=5556969696)”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [s@macro-user-callerid:4] Set(“SIP/VoispeedCRV-0000000b”, “AMPUSER=”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [s@macro-user-callerid:5] Set(“SIP/VoispeedCRV-0000000b”, “AMPUSERCIDNAME=”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [s@macro-user-callerid: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 [s@macro-user-callerid:13] GotoIf(“SIP/VoispeedCRV-0000000b”, “0?continue”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [s@macro-user-callerid:14] Set(“SIP/VoispeedCRV-0000000b”, “__TTL=64”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [s@macro-user-callerid: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 [s@macro-user-callerid:26] Set(“SIP/VoispeedCRV-0000000b”, “CALLERID(number)=5556969696”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [s@macro-user-callerid:27] Set(“SIP/VoispeedCRV-0000000b”, “CALLERID(name)=5556969696”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [s@macro-user-callerid:28] Set(“SIP/VoispeedCRV-0000000b”, “CHANNEL(language)=it”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [s@ext-fax: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 [s@ext-fax:3] StopPlayTones(“SIP/VoispeedCRV-0000000b”, “”) in new stack
[2012-03-29 14:46:09] VERBOSE[4140] pbx.c: – Executing [s@ext-fax: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 [s@ext-fax: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 [s@ext-fax: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 [h@ext-fax:1] GotoIf(“SIP/VoispeedCRV-0000000b”, “0?failed”) in new stack
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: – Executing [h@ext-fax:2] GotoIf(“SIP/VoispeedCRV-0000000b”, “0?noemail”) in new stack
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: – Executing [h@ext-fax: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 [h@ext-fax:4] Macro(“SIP/VoispeedCRV-0000000b”, “hangupcall,”) in new stack
[2012-03-29 14:46:46] VERBOSE[4140] pbx.c: – Executing [s@macro-hangupcall: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 [s@macro-hangupcall: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.