PDA

View Full Version : How to receive a fax on the PIKA Warp appliance in Asterisk?



epretlac
04-28-09, 10:14 AM
Solution:

There are many ways to do this, but the simplest is to make small modification to the default dialplan. (I used a Warp with the 2.0.2.5 images.)

The only change I made was to add this line…
exten => fax,1,goto(fax-rx,s,1)

…to the [demo] context after this line…
exten => s,n,WaitExten ; Wait for an extension to be dialed.

Here’s what the demo context looks like now…

[demo]
;
; We start with what to do when a call first comes in.
;
exten => s,1,Wait(1) ; Wait a second, just for fun
exten => s,n,Answer ; Answer the line
exten => s,n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds
exten => s,n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds
exten => s,n(restart),BackGround(demo-congrats) ; Play a congratulatory message
exten => s,n(instruct),BackGround(demo-instruct) ; Play some instructions
exten => s,n,WaitExten ; Wait for an extension to be dialed.
exten => fax,1,goto(fax-rx,s,1) ;***** I ADDED THIS LINE ******
exten => 2,1,BackGround(demo-moreinfo) ; Give some more information.
exten => 2,n,Goto(s,instruct)
exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french
exten => 3,n,Goto(s,restart) ; Start with the congratulations

In other words, now if we detect a fax calling tone on the line, we direct the call to the [fax-rx] context which then receives the fax. I’ve included the [fax-rx] context below for illustration purposes only -- I haven’t made any changes to it.

; FAX Send and Recv Rules (see below for extensions)
[fax-rx]
exten => s,1,Set(LOCALSTATIONID=123456789)
exten => s,n,Set(LOCALHEADERINFO="Warp Rx Fax Test Page %P Time: %H:%M To: %l From: %r")
exten => s,n,Set(FAXFILE=/tmp/warpfax-${UNIQUEID}.tif)
exten => s,n,Wait(1)
exten => s,n,PIKARxFax(${FAXFILE})
exten => s,n,NoOp(${REMOTESTATIONID})
exten => s,n,NoOp(${FAXPAGES})
exten => s,n,NoOp(${FAXBITRATE})
exten => s,n,NoOp(${FAXRESOLUTION})

By the way, the line I added already exists in the default dialplan at line 545...I just moved it up into the [demo] context. Previously, by default Asterisk plays the standard “demo-congrats” message. Now, we can handle either voice or fax calls on the same line (as I said, if we detect a fax calling tone on the line, we direct the call to the [fax-rx] context which then receives the fax.)

Eric Pretlac
Technical Support Specialist
PIKA Technologies

lawsonmike
06-18-10, 01:59 AM
Hi
I have a problem with Free PBX ver 2.7.0.0, runnig on a PIKA Warp device, I have configured the fax options and set autodetect fax, i have set up a recipitent email address for the fax number and routed the incomming DID to the fax.
I have tested the email settings and can confirm that I get voicemail messages to my email but when recieving a fax nothing turns up in my email, the sender sends the fax and gets a successfull report on his fax.
The faxes just seem to go into a hole!!

Any ideas please anyone?

lawsonmike
06-18-10, 02:06 AM
further to this, the faxes do turn up in /persistent1/var/spool/asterisk/fax as tif files and I expect is correct, but the do not get forwarded to mail relay, the same relay that handles voicemail messages successfully.

skar
06-18-10, 10:45 AM
I will assume that you have configured the smtp server on the WARP correctly since you are getting emails for voice mail.

There are two things to check here. First check that the /persistent1/var/lib/asterisk/bin/fax-process.pl file exists. If not, you should create a link to it as follows:


# cd /persistent1/var/lib/asterisk/bin/
# ln -sf /persistent1/var/www/html/admin/modules/fax/bin/fax-process.pl fax-process.pl
The second thing is to edit the /persistent1/var/www/html/admin/modules/fax/bin/fax-process.pl file. What you need to do is look for the line, near bottom of file that says


SMTP-> new("127.0.0.1", Debug => 0) or
die "Net::SMTP::new: $!";
You need to change the 127.0.0.1 to point to the smtp server you have configured.

lawsonmike
06-20-10, 08:07 PM
Thanks for that, it fixed the problem.

goodmanuel
12-07-10, 12:59 PM
Trying to get fax and send to email but tif file seems not to be converted in pdf. tif file is okay so I guess fax part is okay.
But never get any email and start to think something wrong with pdf conversion
That is what I read in CLI during the fax receiving progress:

sh: convert: not found

more exactly (I've just changed personal data like phone numbers and emails):

-- Executing [h@ext-fax:3] System("PIKA/digital/1", "/var/lib/asterisk/bin/fax-process.pl --to myself@mycompany.com --from "fax@mycompany.com" --dest "XXXXXXXXX" --subject "New fax from XXXXXXXXXX <XXXXXXXXXX>" --attachment fax_XXXXXXXXX.pdf --type application/pdf --file /var/spool/asterisk/fax/1291742963.0.tif") in new stack
warp*CLI> sh: convert: not found
-- Executing [h@ext-fax:4] Macro("PIKA/digital/1", "hangupcall|") in new stack
-- Executing [s@macro-hangupcall:1] GotoIf("PIKA/digital/1", "1?skiprg") in new stack
-- Goto (macro-hangupcall,s,4)
-- Executing [s@macro-hangupcall:4] GotoIf("PIKA/digital/1", "1?skipblkvm") in new stack
-- Goto (macro-hangupcall,s,7)
-- Executing [s@macro-hangupcall:7] GotoIf("PIKA/digital/1", "1?theend") in new stack
-- Goto (macro-hangupcall,s,9)
-- Executing [s@macro-hangupcall:9] Hangup("PIKA/digital/1", "") in new stack
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on 'PIKA/digital/1' in macro 'hangupcall'
== Spawn extension (ext-fax, h, 4) exited non-zero on 'PIKA/digital/1'


thank you for any help

Manuel

mrecoskie
12-16-10, 02:23 PM
Hi Manual,

I have seen the 'sh: convert: not found' message as well. I don't believe it is something to really worry about although it may affect some document conversations. It does not seem to affect tif or pdf however. I think the root cause of this message is a missing package on Warp. If you were really motivated I think you could comment this line out of the '/persistent1/var/lib/asterisk/bin/fax-process.pl' file.

In the case of your failure have you confirmed that email from your Warp is properly working? This requires proper smtp configuration and then you can use something like the following command.

cat /var/log/messages | (echo ; cat - ) | sendmail -f myemail@mydomain.com myemail@mydomain.com

\Mark

josecanuc
02-16-11, 04:10 PM
I'm using image 2.2.7. Does the fax-rx context definition already exist somewhere? I can't seem to find it to make sure the adding of the line:


exten => fax,1,goto(fax-rx,s,1)

to the default dialplan doesn't result in directing to a context that does not exist.

mrecoskie
02-16-11, 05:00 PM
Hi josecanuc,

I don't have a FreePBX on hand right now but I don't think there is a fax-rx definition.

If using the 2.7 FreePBX image I think you can direct to the [ext-fax] context instead like the following?

exten => fax,1,goto(ext-fax,s,1)

Otherwise here is a definition for [fax-rx] you can possibly use in extension_custom.conf

; FAX Send and Recv Rules
[fax-rx]
exten => s,1,Set(LOCALSTATIONID=123456789)
exten => s,n,Set(LOCALHEADERINFO="Warp Rx Fax Test Page %P Time: %H:%M To: %l From: %r")
exten => s,n,Set(FAXFILE=/tmp/warpfax-${UNIQUEID}.tif)
exten => s,n,Wait(1)
exten => s,n,PIKARxFax(${FAXFILE})
exten => s,n,NoOp(${REMOTESTATIONID})
exten => s,n,NoOp(${FAXPAGES})
exten => s,n,NoOp(${FAXBITRATE})
exten => s,n,NoOp(${FAXRESOLUTION})


Hope it helps.

josecanuc
02-16-11, 05:08 PM
Thanks. I did some more testing and found that the system already works fine as is with no more changes.