FreePBX 2.6, NVFax Detection, Asterisk 1.6.1.6 and Digium FAX - Working!

52 posts / 0 new
Last post
GSnover
GSnover's picture
FreePBX 2.6, NVFax Detection, Asterisk 1.6.1.6 and Digium FAX - Working!

Woo Hoo!

Before you read any further, if you want to try this, you need a free license from Digium for a single port of FAX - the FFA - Free Fax for Asterisk - it's free, but it took them three days to get the license to me, so do this first!

I don't know, maybe I am dense, but I have been scouring the web for DAYS trying to get this working because I NEED to get to Asterisk 1.6 for the better CDR's, SIP-over-TCP and all the other goodness that 1.6 has to offer - but I also NEED to have NVFax Detection working because our customers demand it. I have read everything I can find, to no avail, so I finally started hacking - if someone else has done this and gotten it working, Google and Bing sure can't find it.

First the Obvious:

You will need the updated source for app_nv_faxdetect.c and app_nv_backgrounddetect.c - get them here if you don't already have them:

ftp://ftp.bdc-llc.com/sources-1.6

Once you have the files, they will need to go into the apps folder of the Asterisk source files before you compile them.

Now, the Non-Obvious Stuff (Again, maybe it's me...)

1) Remove app_fax.c from the apps folder in the Asterisk Source - this conflicts with res_fax and res_fax_digium that you need to download from Digium. This is probably the most counter-intuitive part of the install to me, and after reading over the docs several times, it's just not there to remove it - if you don't, Asterisk crashes when you try and load it. If it's already compiled, just remove the file from the /usr/lib/asterisk/modules folder - app_fax.so

2) You will need to compile spandsp-0.0.6pre12.tgz for the NVFax to use - it is also on my ftp server if you need it.

3) Get the FAX files from Digium - or get the files from me if you want the quick route. The have to go into /usr/lib/asterisk/modules also.

Now, for the last step, a comment, and then a question - you need to edit /etc/extensions.conf and search for 'rxfax' and replace it with 'ReceiveFAX' - case sensitive - this is the only Dialplan Change I made to be able to receive FAXes - in fact, while I have been typing this up and posting the files to my FTP server, I have received an 86 page FAX and a 116 Page FAX - I used my Wife's laptop and faxed myself two of the books she is working on - they went without a hitch. I also sent several 3-5 page faxes from web pages that were HEAVY with graphics and they worked fine also.

So here's the question - where is the template for extensions.conf so that as I update my FreePBX, I won't have to keep going back into that file and fixing it?

Greg

P.S. - I am working on a procedure to install a scratch-load CentOS 5.4/Asterisk 1.6/FreePBX 2.6 machine - including the instructions specific to the FAXing - I will post that also when it is complete.

mbrevda
mbrevda's picture
Greg, what function is

Greg, what function is NVfaxdetect playing in your setup? Arent you using FFA?

GSnover
GSnover's picture
Fax Detection

Yes, I am using FFA, but with FreePBX you have two choices on FAX detection on incoming calls if you are doing silent detection - i.e. listening for CNG tones on a call to determine if it is a FAX call - Zaptel and NVFax. Obviously Zaptel will not work with 1.6 - there is no Zaptel, only Dahdi. So if you want one-number setups for people on their DID's being able to receive FAX and Voice on the same number, you need to listen for faxes - hence the NVFax detection.

This is one of the more key features of using FreePBX and our customers are crazy about it - it has been (until now) holding us back from adopting 1.6.x - and we really want to get going with 1.6.x!

Greg

mbrevda
mbrevda's picture
hmm... Keep your eyes peel

hmm...
Keep your eyes peel for an easier 'built-in' solution

franklin
franklin's picture
FFA on FreePBX2.9

Hi Moshe, I got my free FFA channel. Can't make it work. I am using T.38 DIDs from VOIP Innovaitons. They work with Elastix no problem. On my 2.9 box, when I set T.38 passthrough to yes or no, and no fax detect on the incoming, and pass it to either an IAX or Virtual SIP, I get this:
[2011-09-05 08:19:46] NOTICE[6275]: pbx.c:4123 pbx_extension_helper: Cannot find extension context ''
[2011-09-05 08:19:46] WARNING[6275]: pbx.c:10244 pbx_parseable_goto: Priority '' must be a number > 0, or valid label
== Spawn extension (from-trunk, fax, 1) exited non-zero on 'SIP/VI-000000b7'
-- Executing [h@from-trunk:1] Macro("SIP/VI-000000b7", "hangupcall,") in new stack
-- Executing [s@macro-hangupcall:1] GotoIf("SIP/VI-000000b7", "1?theend") in new stack
-- Goto (macro-hangupcall,s,3)

It seems to answer the call but not know where to send it. ?

richardteachout
richardteachout's picture
extensions.conf Override = extensions_override_freepbx.conf ?!?!

I believe you can edit
/etc/asterisk/extensions_override_freepbx.conf
to override any built-in function
or
/etc/asterisk/extensions_custom.conf
to add your own custom dialplan rules...

so for your situation, try:
in /etc/asterisk/extensions_override_freepbx.conf replacing the built-in function [macro-faxreceive] with your updated one..

[macro-faxreceive]
exten => s,1,Set(FAXFILE=${ASTSPOOLDIR}/fax/${UNIQUEID}.tif)
exten => s,2,Set(EMAILADDR=${FAX_RX_EMAIL})
exten => s,3,RecieveFAX(${FAXFILE})
exten => s,103,Set(EMAILADDR=${FAX_RX_EMAIL})
exten => s,104,Goto(3)

and that should "override" the built-in function in the dialplan, and work for you with reloads.

Someone please correct me if I'm wrong.

note: I am doing a few other overrides like this in my 1.4 installation, and don't have a 1.6 to test it on atm, but I suspect the overriding works the same.

Let us know if that works for you. Smile

- Richard Teachout
www.teachout.com
RHCE, MCSA, MCP, MCTS: Hosting, CIW, and more..

ZystemsGo
ZystemsGo's picture
You spelled ReceiveFax incorrectly.

[macro-faxreceive]
exten => s,1,Set(FAXFILE=${ASTSPOOLDIR}/fax/${UNIQUEID}.tif)
exten => s,2,Set(EMAILADDR=${FAX_RX_EMAIL})
exten => s,3,ReceiveFAX(${FAXFILE})
exten => s,103,Set(EMAILADDR=${FAX_RX_EMAIL})
exten => s,104,Goto(3)

There's the fixed code. I was pulling my hair out trying to figure this out until I looked at the debug log.

GSnover
GSnover's picture
Hmmm

LazyTT - Please say it's true - that NVFax code is getting a little old - it works, but a solution that was part of the actual FreePBX code would be EVEN better.

Richard - Thanks, I know about putting custom contexts, but since it's just a single substitution in one place in the code, I would rather edit the FreePBX template so that whatever was changed, it would keep coming back when changes were applied - We had to modify the template for sip_general_additional.conf to be able to use Bandwidth.com trunks since the traffic comes at the box as anonymous traffic - the context=from-sip-external has to be instead context=from-bandwidth, otherwise you can't get traffic in.

rrb3942
rrb3942's picture
If you install spandsp

If you install spandsp (http://www.soft-switch.org/) you should be able to compile asterisk 1.6+ with the fax applications (SendFAX and ReceiveFAX) and not need the digium fax app.

wiseoldowl
wiseoldowl's picture
That makes no sense at all.

That makes no sense at all. The context is whatever you set it to be in your trunk configuration, so if you blindly follow someone else's setup instructions and set the context to from-bandwidth or from-sip-external, then of course it will not work without hacking the code. Instead, use context=from-trunk and it will work without hacking the code.

Now, if you are bringing calls in without going through a trunk, then all bets are off - but even then, you have to set the context somehow, so use from-trunk as your context.

GSnover
GSnover's picture
SendFAX and ReceiveFAX

rrb3942 - Are you talking about the built-in Digium app_fax.c? Or the old Newman FAX application? Because the applications that come with agx-ast-addons won't compile with 1.6 - I have tried and tried - but I am completely willing to believe that I am the weak link in that equation - my C++ skills are a little rusty...

wiseoldowl - that was kind of a grumpy response, but here is my response anyway - inbound traffic from Bandwidth.com comes in E.264 format - +15053430650 - leading +, country code, and then NPA and NXX - FreePBX chokes on that, so you HAVE to send the incoming traffic to a custom context to strip that + before you then pass on the resultant DID for processing - and Bandwidth.com does NOT support trunks registration - they just hose the traffic at the IP address that you tell them to, and it is up to you to process it on your end. Trunks that register would fix this problem, but repeated pleas to Bandwidth.com have gone unanswered. And no, I am not blindly following anybody's instructions - I had to figure it out for myself because the existing instructions didn't work!

Greg

wiseoldowl
wiseoldowl's picture
Sorry if I'm too "grumpy"

Sorry if I'm too "grumpy" for you, but I hate to see someone doing things wrong, and you are — you should NEVER edit a file that is "owned" by FreePBX, and I was just trying to say that you don't have to do that — there are ways to accomplish what you need to do without editing files owned by FreePBX. Of course, it's your system, so if you want to "break the rules" you can do so, but I would hate to see anyone else follow your lead.

Although I don't have any trunks from Bandwidth.com, I have a really hard time believing that the "proud sponsor of FreePBX" (to quote the small ad that is staring me in the face as I type this) would force you to do something that is totally against good practice — that really doesn't make sense to me. Maybe, instead of asking for help with faxing, you should have first asked how to set up a trunk for Bandwidth.com, and someone might have been able to help you with that.

And by the way, I'm quite familiar with having to strip a + from the incoming CallerID using a small bit of custom context (although I think that now, either of the third party modules Set CallerID or Caller ID Superfecta can also handle this — and yes, FreePBX probably should deal with the leading + gracefully, without the need of third-party modules). But after stripping the leading +, you can still send your calls to from-trunk rather than some other context.

Anyway, do what you want, but when someone's trying to explain to you that you are doing it wrong (without trying to make you look bad in the process) you might want to pay heed, because playing with FreePBX's "owned" files is very likely to come back and bite you (or your company, if you're doing this for a company) in the butt in the future. What if you get sick and someone else has to make changes on the system? That's all I'm saying.

rrb3942
rrb3942's picture
I am talking about the

I am talking about the built-in Digium app_fax.c. You can select to build it under 'make menuselect' -> applications -> app_fax, but it requires you have compiled and installed spandsp. This adds the SendFax and ReceiveFax applications to asterisk. I have done some testing with them and they seem to work as well as the old newman fax apps.

As far as I know these don't have any limit on the number of faxes and even have some t.38 support in them.

Paul Adams
Paul Adams's picture
'Lurking' Asterisk User...

GSnover - you are right - info on this is difficult to come by.

I've got Asterisk 1.6.1.6, iaxmodem & hylafax all working on the same CentOS 5.4 box.

I'd like to offer my users voice / fax service on their regular numbers - so I need to detect incoming faxes. I was Googling & found your posts...

I believe I just need NV Fax Detect & SPandSP to make this work - with detected faxes going out to the iaxmodem...

Eventually - I'd like to past the DID to hylafax as well so the faxes get routed to the right people - but I'm just trying to get detection working at the moment.

I would apprieciate any advice you could give...

Regards

Paul Adams

GSnover
GSnover's picture
Sometimes it's just not worth the effort....

Paul Adams: I have a public FTP server at ftp://ftp.bdc-llc.com/sources-1.6 that has all the files I used to get this working - you are free to take any that you need - I have wanted to play with Hylafax, but I needed to get reception going and I wanted to try the FAX-For-Asterisk - rrb3942 pointed out that maybe the built-in app_fax would receive - I will try this as soon as I can and post the results.

Also, in case somebody reads this thread and get's misled:

Bandwidth.com seems to now support trunks that register - this would eliminate the need to replace the from-sip-external for the inbound context - the last Bandwidth.com trunks I installed were about 18 months ago, and it looks like they do them correctly now - also, the Inbound Routes in FreePBX now accept a + in the string to match - I don't know when that changed, but as they say the proof is in the doing. Your inbound context should still strip the + out of the DID and the Caller ID - the phones don't like it for things like redial.

As to the template file for extensions.conf, from what I can figure out it is only written when FreePBX is installed, so the modification seems to be safe - I can't find a template file anywhere on my system that rewrites the file, but I may be missing something - the modification is necessary to get FAX-For-Asterisk working with FreePBX right now.

Paul Adams
Paul Adams's picture
THANKS!

GSnover: Followed your comments to place the 2 NV fax C files in the relevant apps directory - recompiled & reinstalled Asterisk. Changed my dialplan to use NVFaxDetect - worked perfectly! Thanks for the amended NV fax files.

As a comment - I 'think' you could do what I'm trying to do using the built-in app-fax (detect then receive, send to the right user depending on incoming DID).

Also - Hylafax is easy when it comes to sending - free desktop Windows fax printing clients makes it easy for my users to send AND Hylafax e-mails the sender an update letting them know it was sent OK.

I'm sure if you are clever with dialplan's & external commands - you could make all this happen within Asterisk / FreePBX - but I'm not, so I use Hylafax...

If you ever want some Hylafax pointers - just ask...

Thanks again,

Paul Adams

samba
samba's picture
hi Guys

This information is difficult to come by. I've been playing w/ Asterisk cvs versions and everything else w/ an SPA2102 SPA w/ the latest 5.2.10 firmware. I have outbound and inbound faxes working 80-90% of the time via pass-through T.38. This works for a hobbyist, but not a business. So here's my question. Is it possible to utilize the NV fax detect and the free asterisk plugin from digium to do pass-through? Right now my pass-through method works ok, but we need something better. The documentation from Digium looks like that module only works for termination and origination locally on the server; not pass-through or relay.

It seems that the closest thing out there for 100% is the AS5300 cisco w/ the SPA2102 w/ the proper configuration. There is a number I cannot ever fax to, but a regular landline works. I've tried asterisk 1.4.26, 1.6.0.10, 1.6.2-svn. Even though many T.38 improvements have been made, I think at this time the issue is more around fax tone detections w/ some strange fax machines. I'm not seeing the problem w/ T.38. I bet it's something in the DSP modules in terms of detection problems. I'm using the latest from the SPANDSP site too.

I am looking forward to discussing this stuff w/ anyone who has a serious interest in this. I'm the Veep for a technology company and having FoIP is becoming more critical to the business model. My e-mail - brock (at)digitalpath.net

I am looking for a FoIP solution that will be 99% or better. Not 80-90%.

Thanks

Brock

Ron Paul in 2012 - Liberty for America

GSnover
GSnover's picture
T.38 - Bring it on!

You know, it would be funny if it wasn't so annoying - I HATE FAX and yet it consumes probably 80% of my development time and 90% of my troubleshooting time for customers - people just will not let FAXing go no matter how many times you show them Scan-2-E-Mail - have I mentioned how much I HATE FAX!

That being said, T.38 is the solution for fax once it is properly implemented, I am just working on figuring out how to translate this into FreePBX and make it a workable solution for my customers.

For the record, here is what I have found works:

1) Outside-World to Asterisk - Inbound Reception: FAXes from the outside world coming in on a TRUE TDM PRI and received by Asterisk work 100% of the time - no adjustments on the sending machines, and no adjustments on the receiving machine - it just works. I have 100% success with Asterisk 1.4.26.2 and the current version of agx-ast-addons and spandsp-0.0.6pre12. I also have 100% success with Asterisk 1.6.1.8 and FAX-For-Asterisk from Digium with the modified app_nf_faxdetect.c and app_nv_backgrounddetect.c that I reference above. I also have had 100% success on the above configurations with SIP trunks from Paetec (formerly McLeod) delivered on a MPLS T1 (it's what we use in our office). I have had less than 90% with other SIP trunking providers, but I don't think it was their fault since I was getting them over the open Internet, and I don't think that is a fair comparison.

2) FAX Machines connected to Digium Hardware FXS Ports sending over TDM PRI - The only adjustment I have found that needed to be done was to turn off ECM - then this became a 100% proposition, but only with ECM turned off, and only on a TDM PRI.

3) FAX Machines connected to cheap ATA (Grandstream) sending over TDM PRI - in this case, I have to turn off ECM and also slow the machine down to 14.4 or less - sometimes even 9.6K - but if I slow the machine down enough, it works 100% of the time - I think the weakness is with the Grandstreams.

4) FAX Machines connected to Digium Hardware FXS Ports sending over SIP Trunks - Mixed Bag - sending to remote fax machines seems to work fine with ECM turned off, but to round-robin send to myself (people start using FAX-2-E-Mail as a Scanner!) you have to turn off ECM and slow the machine WAY down - 14.4K Max, 9.6K is more reliable - which makes faxing long documents SLOW.

5) FAX Machines connected to cheap ATA (Grandstream) sending over SIP Trunks - I have had no luck making this work at all - period.

Now, as I understand it (and I admit, I may be missing LOTS here) T.38 on the ATA's will allow a FAX machine to talk directly to the FAX machine and convert the FAX to a T.38 transmission (100% reliably) and then pass this stream to FAX-For-Asterisk which then (again 100% reliably) converts this to a TDM signal on your trunk of Choice (PRI or POTS) and transmits the FAX (reliably again!). If you are using a SIP trunking provider that supports T.38, then they are supposed to take the T.38 stream from you (again, supposedly 100% reliably) and their Border Session Controllers/Gateway Devices are supposed to reconstitute this into a TDM FAX again when it leaves their equipment and hits the PSTN - that's the theory as I understand it anyway.

Has anyone tried a range of ATA's and found one better than another? - we have tried the Cisco 186's and the Grandstreams - the Grandstreams seem to work fine with TDM PRI's, but we are doing 90% SIP Trunking now, and we need a reliable ATA - or we need to get the T.38 going and test the claims that T.38 works on these devices - I HATE FAX!

Greg

samba
samba's picture
Greg- thanks for this input.

You have given me a lot to think about. When you say no ECM, you are saying Error Correction Mode. What options do we have for T38FaxUdpEC?

I've only seen two: t38UDPRedudancy and t38UDPFEC. I guess I could take out the entire section for T38FaxUdpEC, but I don't know what would happen then. I'm using bleeding edge 1.6.2-rc code about a week old.

Please let me know how you accomplished this. For the time being, I'm using strictly a SPA2012. Have you seen better results w/ T.38 on grandstream & asterisk?

There should be an entire section of the support forum just dedicated to discussing T.38 faxing in my opinion.

Thanks

Brock

Ron Paul in 2012 - Liberty for America

GSnover
GSnover's picture
Boy, I feel a little dumb...

Ok, a couple of things right away - In reference to an earlier post, someone suggested that I could get FAX reception (G.711 - more on T.38 in a minute) working with the built-in app_fax.c - the one that I say to remove and since I wanted to upgrade to Asterisk 1.6.1.9, I figured it was as good a time as any - so I complied 1.6.1.9 with app_nv_faxdetect and app_nv_backgrounddetect.c, and with spandsp-0.0.6pre12.tgz already installed, and guess what - they were right - you don't need FAX-For-Asterisk - the built-in FAX (app_fax.c in apps) with the FreePBX dialplan mod application works great - I just sent two 115-Page FAXes, and 3 5-Page Graphics-Heavy faxes and they were received fine - if anything, it seems slightly faster (although I don't know why that would be?).

I am going to modify the original post to include this finding and update the instructions so you can go either way.

Here is a post from Russell Bryant that explains T.38 Origination, Termination, and Gateway:

http://lists.digium.com/pipermail/asterisk-users/2008-August/216517.html

So that clears it up as far as our predicament with T.38 FAXing on Asterisk 1.6 with FAX-For-Asterisk - we would either have to have a SIP Trunking provider that provided T.38 Gateway Services (they do the Packet-2-TDM conversion I was talking about before) or you would need your own T.38 Gateway - several threads say CallWeaver already does this, and it looks like some people are already doing it. So that's one possible route for successful T.38...

But, while researching that, I found this:

http://www.mail-archive.com/asterisk-dev@lists.digium.com/msg39318.html

This is someone that has ported a T.38 Gateway into the code of app_fax.c - it is a Patch, so I am going to apply it to my code and see how it works - If this code actually works, then the Public version of app_fax seems like a FAR superior version to FAX-For-Asterisk because in reading the app_fax.c, it seems to support T.38. If this code turns Asterisk into a T.38 Gateway, then we are home free!

I will post results as soon as I can test and verify.

Wow, I wish this were laid out somewhere in a straightforward manner - this is like solving a mystery blindfolded.

Greg

GSnover
GSnover's picture
Bwahahahahahah (Mad Scientist Laugh!)

Wow, this seems really bleeding-edge, but here it is:

To patch the code, download the patch and then go into the Asterisk source directory and apply it as follows (I put this here for those who don't know how to apply a patch - like me 15 minutes ago!):

assuming the patch is /usr/src/t38-gw-r222535.patch
cd /usr/src/asterisk-1.6.1.9
patch -p0 -i /usr/src/t38-gw-r222535.patch

This cleanly updates threee files:

app/app_fax.c
main/ast_expr2.c
main/ast_expr2.h

The patch referenced above will not compile cleanly against Astersk 1.6.1.9 - It throws the following errors during compilation:

app_fax.c: In function ât38gateway_execâ:
app_fax.c:1238: warning: passing argument 1 of âast_copy_stringâ discards qualifiers from pointer target type
app_fax.c: In function âload_moduleâ:
app_fax.c:1352: warning: implicit declaration of function âast_register_application_xmlâ

And then when you try and start Asterisk, looking at /var/log/asterisk/full, it says that it can't load app_fax.so because of the function ast_register_application - Maybe someone that is better with app_fax.c can shed some light on how to fix that against 1.6.1.x - but for now, that won't work.

Ok - It was written for Asterisk 1.6.2.0,rc4, so let's compile that:

app_fax.c: In function ât38gateway_execâ:
app_fax.c:1238: warning: passing argument 1 of âast_copy_stringâ discards qualifiers from pointer target type

Ok - well, it compiles and more importantly, it loads and as far as I can test so far, it still works for G.711 FAXes - I have sent 5 test faxes so far and they all seem to work perfectly.

I can't say I am happy to be running Release Candidate software on my test box (I am not that bleeding edge) but from what I read, 1.6.2.0 is VERY close to release - here's hoping that it is stable!

I am going to bed now (it's 10:15 pm and I am fried) and in the morning I am going to the office and get a couple of Grandstreams and do TONS of T.38 Gateway Tests tomorrow - I will post results (and probably ask questions) as soon as I know anything, but this is looking REALLY good!

Man I love Open Source Software!

Greg

P.S. - I think if I get this working completely with TDM and T.38, I will post a fresh thread with instructions and reference this thread as to how we got there - wish I had thought to grab the HandyTones before I left the office!

samba
samba's picture
tadpole... the mad scientist tag is funny.

That's what I told my wife I wanted to be when I don't have to work for a living someday.

Anyways, I found out my problem was with the sip carrier tonight. YEAH. After 2-3 weeks of work it was a SIP carrier termination problem. So now I can send 8-9 page faxes all day long. I'm wondering how many fax problems over IP are directly related to 3rd party carriers. (Pacwest)

We have used some grandstream devices. These things are so buggy in terms of saving new settings; we have to sometimes reflash the entire boards before they will work again once changes are made. The SPA2012 works incredibly well, and now i know my fax problems are not related to the SPA, but the frigging carrier and not asterisk!

I'm curious to see if the 1.6.2 actually has true gateway support on the fly. My understanding is that the gateway needs to recognize the call as a fax and then send the re-invite back to the sip trunk - > then ATA and re-negotiate T.38. BTW, I should mention I was able to send 9-10 pages twice w/o problems now too. So this is fairly reliable,and the SPA2012 shows T.38 in the log.

Those of us here on this board should setup a conference bridge and exchange numbers so we can all chat about this. There is very few people really into this stuff from my research.

530-571-7520 - work

Email - brock (@) digitalpath.net

Brock

Ron Paul in 2012 - Liberty for America

GSnover
GSnover's picture
Real Quick...

In searching for the SPA2012, the only things I see for sale are SPA2102 - Was that a Typo, or are these different - it that's the right ATA, I am going to order a couple of them for testing.

Greg

samba
samba's picture
Greg

That was a typo. It's the SPA 2102. What did you disable in terms of error correction? I'm currently using t38redudancy.

Ron Paul in 2012 - Liberty for America

GSnover
GSnover's picture
The ECM I was taking about is Analog ECM on the FAX machines

themselves - I have just gotten back with all of my ATA's - haven't done anything with T.38 yet - just getting started.

I wonder if I am going to need to put the ATA's in a Custom Context to make Asterisk negotiate the T.38 with them - I am still very fuzzy on the mechanics of how this will work - the concept seems fairly clear to me, but I am stumbling along blind as to what needs to be tweaked and where - since your SIP provider is acting as a T.38 gateway for you, did you have to change anything on the Extension definition for the ATA other than turning on re-invites?

I will post more as I test.

Greg

GSnover
GSnover's picture
I really need to start a clean-thread when I get this working...

I just noticed above that I was talking about applying the patch to 1.6.1.9 - this actually doesn't work at all - the patch complains loudly about this and that - the way I tested was to patch against 1.6.2.0.rc4 and then move the three files it patches into 1.6.1.9 before I tried to compile - Since the patch wasn't written for 1.6.1.9, I don't know if it is the patch or the difference in app_fax.c between 1.6.1.9 and 1.6.2.0.rc4 that is the problem - just don't want anyone trying to duplicate what I am doing to not be able to repeat my steps.

Greg

GSnover
GSnover's picture
Hmmmm....bummer distraction...

[2009-11-07 13:10:56] VERBOSE[21201] app_dial.c: -- SIP/Paetec-00000001 is making progress passing it to SIP/5480-00000000
[2009-11-07 13:10:57] VERBOSE[21201] app_dial.c: -- SIP/Paetec-00000001 answered SIP/5480-00000000
[2009-11-07 13:11:03] WARNING[21088] chan_sip.c: Autodestruct on dialog '1e389db860ef51ab02fd2da7452b6838@bwas3.global.voip.mcleodusa.net' with owner in place (Method: INVITE)
[2009-11-07 13:11:03] VERBOSE[21201] pbx.c: -- Executing [h@macro-dialout-trunk:1] ^[[1;36mMacro^[[0m("^[[1;35mSIP/5480-00000000^[[0m", "^[[1;35mhangupcall,^[[0m") in new st$

I was only testing inbound (which was working fine) but I sat down this morning to test outbound calls and they wouldn't work - my SIP trunk with Paetec hangs up right away - anyone seen this message before with SIP trunks? I think this is the line that is killing the call:

[2009-11-07 13:11:03] WARNING[21088] chan_sip.c: Autodestruct on dialog '1e389db860ef51ab02fd2da7452b6838@bwas3.global.voip.mcleodusa.net' with owner in place (Method: INVITE)

Can't test if I can't make outbound calls - I am going to troubleshoot this and post if I find anything.

Greg

GSnover
GSnover's picture
Ok - Back on the Train again...

removed disallow=all and allow=ulaw and then resubmitted the SIP trunk and I was fine - weird - back to testing.

Greg

GSnover
GSnover's picture
Something to figure out later...

Ok - got outbound calling working, but then inbound was being seen as Anonymous - looked at this post:

http://www.freepbx.org/forum/freepbx/users/allow-anonymous-inbound-sip-calls

And tried appending the IP address on to the Host line - then Inbound works but outbound fails.

I ended up copying the trunk definition but leaving the registration string off, and duplicating the peer details in the incoming settings - now both inbound and outbound work, but it seems like a kludge to me...

Back to FAXing...

Greg

samba
samba's picture
I faxed many congressman today about the healthcare bill.

And this setup works great. I had some busies and I probably had 30 successful faxes, with no faxes failing. Asterisk version 1.6.0.10-FONCORE (Trixbox 2.8)

I'm using my built-in laptop modem for the faxing via the SPA 2102 ATA. The laptop modem most likely does not have an ECM mode.

Brock

Ron Paul in 2012 - Liberty for America

GSnover
GSnover's picture
Progress!

I have been talking to DarkBasic (Strange Tag, but he seems very helpful) and I think we were having a Language-Barrier problem, but I finally explained it to him where he understood what is was I was trying to do with the Asterisk as the T.38 FAX Gateway and here is his response:

>>You have to use the FaxGateway() application instead of the Dial() application to make use of the t38 gateway patch!

>>Cheers,
>>Darkbasic

YES!!!!
Ok, this may be obvious to some, but it was the piece I was missing - So to get things started again, I think I need to call a Custom Context from the internal FAX machines that are connected this way, and then they should FAX out - I will post when I have some results!

Greg

samba
samba's picture
Greg - please post your results.

Please post how you use t38gateway in the syntax either within a context, etc.

I'll patch for my setup and give it a whirl this week. Do you have a phone number I could chat with you on this week?

Thanks

Brock

Ron Paul in 2012 - Liberty for America

GSnover
GSnover's picture
Looking for some advice here

The application is FaxGateway() and here is what the source code says:
application name="FaxGateway" language="en_US">
synopsis>
T.38 Gateway Handling
synopsis>
syntax>
parameter name="dialstring" required="true">
para>Filename of TIFF file save incoming fax
parameter>
parameter name="timeout" required="false">
para>Makes the application behave as the calling machine
para>(Default behavior is as answering machine)
parameter>
syntax>
description>
para>Receives a FAX from the channel into the given filename
overwriting the file if it already exists.
para>File created will be in TIFF format.

para>This application sets the following channel variables:
variablelist>
variable name="LOCALSTATIONID">
para>To identify itself to the remote end
variable>
variable name="LOCALHEADERINFO">
para>To generate a header line on each page
variable>
variable name="FAXSTATUS">
value name="SUCCESS"/>
value name="FAILED"/>
variable>
variable name="FAXERROR">
para>Cause of failure
variable>
variable name="REMOTESTATIONID">
para>The CSID of the remote side
variable>
variable name="FAXPAGES">
para>Number of pages sent
variable>
variable name="FAXBITRATE">
para>Transmission rate
variable>
variable name="FAXRESOLUTION">
para>Resolution of sent fax
variable>
variablelist>
description>
application>

So, unless I am misreading the code here, it says that it takes only two parameters - the dialstring (number to be dialed) and a File Name (What for?)

I tried executing this from a custom context as follows:

[custom-faxgateway]
exten => _X.,1,FaxGateway(SIP/Paetec/${EXTEN})

and it tries to route the traffic in that direction, but of course fails because the dial is not populated correctly with calling party ID and such, so here are the questions:

1) Even though it appears not to take the parameters I need such as Calling Party ID, can I append them in some order in the FaxGateway() such that Asterisk is pre-conditioned to accept, or is there no such thing?

2) It seems to me that the code needs to be modified to accept and pass through to the called channel this necessary information - POTS lines don't care, and some PRI's don't either, but my SIP trunks sure do - they fail the call, and I think they would pass it if I could populate the fields.

Any thoughts?

Greg

GSnover
GSnover's picture
OK - My first successful FAX transmission!!!!!!!!!

Alright, it seems like it worked - however, it was SLOW and it was only one page - it you want to try, here are a couple of suggestions:

1) I deleted extension 5487 and created extension 5059985487 - in looking at a sip debug, it showed that the function was actually passing my extension in the outbound SIP header - I figured that was what it was failing on, and on a hunch, switched it to the fully qualified number as my extension and wha-lah! Outbound calls were now working. This was necessary for my SIP trunk - you may have to get creative with your trunks. The function seems to pull the information from the device definition (we are in DeviceAndUser mode) so that answers my previous question.

2) Use a good ATA - While I was able to send the FAX, it was SLOW and it took a long time to sync-up - I don't know what the cause is, but I will have an SPA2102 here in a couple of days - this test was done with a GrandStream HandyTone-286 and I just don't trust it for this test. The first couple of times, the FAX failed, so I am still figuring out what is what.

That's it for tonight - more tomorrow!

Greg

samba
samba's picture
Greg - that's great.

I'm fortunate that I currently number extensions w/ the area code. It just makes the whole DID and long distance logic easier in our setup.

So... my understanding says that this should then behave in the following manner-

ATA sends fax to sip server; sip server recognizes the call as a fax and sends a re-invite to the ATA to start T.38.

The way this would have previously worked is the following w/ just pass-through:

ATA sends fax to sip server, sip server sends message over sip trunk to carrier, carrier detects T.38 and sends re-invite back to sip server, sip server sends re-invite back to T.38 capable ATA to start transmission.

In a pure SIP to SIP trunk environment (where the provider connects over a SIP trunk) - is there any advantage of having T.38 gateway support? I'm guessing that if we had a PRI coming into a digium or sangoma card then the asterisk box would just act like the carrier machine in my setup. Hopefully faxing would be near 100% reliability with this method.

BTW, I can send you a screenshot of my SPA2102 config screen in PDF when you get that box in-stock. this will save you lots of time tinkering.

I'm in the office tomorrow Greg. Feel free to call me. I might be busy in the morning but it would be good to touch base with you on this.

Brock
530-571-7520

Ron Paul in 2012 - Liberty for America

GSnover
GSnover's picture
Yup, that's my understanding also.

Here is what I found on Wikipedia:

http://en.wikipedia.org/wiki/T.38

Which show's a diagram of how T.38 is supposed to work. It also agrees conceptually with what I thought T.38 should do.

For someone reading this after the fact, here is what I have tested, and what I am trying to "Fix":

FAX just will not go away - therefore our Asterisk systems must allow FAX machines to be connected and function. With earlier versions of Asterisk, we were primarily connecting to TDM PRI's and in those situations, ATA's worked fine with an Analog FAX machine connected to them.

Now, we have switched to SIP trunking, and the ATA's that we had been using (Grandstream HandyTone 286 and 386) don't seem to work at all. We have had success with Digium Hardware FXS ports (Mostly TDM410b's) but it is MUCH more convenient to just pop an ATA next to where the FAX machine is and use that - to use Digium Hardware, we must have a Home-Run back to the box - not very handy at a lot of sites.

T.38 is supposed to give reliable FoIP - therefore that is what we are trying to make work.

More test results to follow!

Greg

samba
samba's picture
Greg -

Did you make any further progress on this? I'm thinking the T.38 gateway would also work great between sip to sip trunks. Local extensions who want to use T.38 to each other won't work properly w/o a gateway.

Ron Paul in 2012 - Liberty for America

GSnover
GSnover's picture
Whoah!

Well, I have made some progress, but I also had to back up a bit -

First, I got my SPA2102 in this afternoon, and I decided to try something that I know the Grandstream's fail miserably on - Analog FAX machine attached to ATA on a SIP Extension sending a FAX out on our SIP trunk - guess what - it works PERFECTLY!!!!!!! This is Analog Transmission in the RTP Audio Packets, not T.38 - and it still works perfectly!

Aughhhhhh - I can't believe how much time I have wasted trying to get those dang Grandstreams going, and thinking that it was Asterisk and our SIP trunks that were the problem - it was the Grandstreams! All right, fool me once shame on you, fool me twice, shame on me! Never again anything Grandstream! If anybody is interested in a bunch of HT-286, 386, and 503's let me know - you can have them CHEAP!

So, that is a Game-Changer for us - this SPA2102 works perfectly - I am at my house, so not only does it work, it works going from Comcast (No QOS at my house) to Paetec (QOS) out through the PSTN to remote FAX Machines - I have sent 15 FAXes so far, each at least 3 pages, loaded with graphics and some as long as 10 pages, and they all came in right the first time - I can even fax to myself - the only way I have ever been able to make that work was with Digium Hardware FXS ports in the box itself - Dang! Hope someone else finds this post and doesn't have to waste all the time that I have on these Grandstreams - Avoid them like the Plague!

Now the bad (sort of - I think I know what's wrong) news:

Monday, when I got to work, I still had Asterisk 1.6.2.0.rc4 up with the T.38 Gateway patch installed and I thought I had tested every scenario over the weekend, but I missed one - Remote Analog FAX trying to be received by Asterisk as an inbound FAX-2-EMail - Problem is that because our trunk is SIP, when the FAX detection saw CNG, it worked correctly in shifting to FAX reception mode, but it then (Because, I think, our trunk is SIP) It tried shifting the reception into T.38 which of course caused Paetec to immediately say "No Way - media not supported" and terminate the call.

I think the problem is the way I am calling FaxReceive() - I need to spend some time with the source and see if I can send an argument that says don't even try T.38 on inbound calls from my Paetec SIP trunk, because they will NEVER be T.38, even though it is a SIP trunk - and I bet that will not be a weird configuration until all the SIP trunk providers get there act together.

So, more testing this weekend when I can muck with our system without disrupting my company - I will post then!

Greg

samba
samba's picture
Greg

I'm curious to see how your faxing is going. I'm still having T.38 problems occasionally; mainly with pass-through. This is terribly problematic when the same server is doing T.38 faxing to another T.38 enabled client; it passes through but sometimes things get fairly fouled up. Then you have to switch back to G.711. This is why T.38 gatewaying is so important. In theory, the server should then act as a gateway and relay the info between the two locally connected clients.

How is your G.711 testing doing on the SPA2102? Any specific settings you have found?

Thanks

Brock

Ron Paul in 2012 - Liberty for America

GSnover
GSnover's picture
G.711 FAXing is going EXTREMELY well.

I didn't change any of the default settings on the SPA2102 other than the SIP settings we use and the RTP range (we like a Non-Standard range) - Those boxes are amazing and I would HEARTILY recommend them to anyone!

I am wondering if your T.38 Gateway (Your SIP Provider) is the problem - We are using Paetec, and since I have discovered the SPA2102, I have yet to have a FAX fail - And I have even cranked the settings that I used to turn off like V.34 and ECM - and it's still working - and this is all In-Band G.711 FAXing.

On another note, the current 1.6.2.0.rc4 seems very unstable with SIP trunks - as I posted before, I had to switch back to 1.6.1.9 - and since they released it today, I am going to upgrade to 1.6.1.10 tonight - the bug-fix list is HUGE.

Finally, I am going to post a cleaner How-To this weekend - this is now our standard build, and I want make it easy for anyone else to set it up like I did.

Greg

oderland-david
oderland-david's picture
Started reading up on fax

Started reading up on fax with asterisk last night and trying to get my head around how to get our fax machine up and running when we switch from PSTN to SIP trunk in a couple of weeks. Reading through this thread you're (Greg) mentioning the SPA 2102 from Linksys.. I fail to find much info on it though - could it be made to register as an extension on our Asterisk 1.6.0.10 server and be used to receive fax from our fax machine and send it out on a T38 channel (our Sip Trunk provider has full T.38 passthrough according to them).

Got the ReceiveFAX working last night with minimal hassle but the Sending part eludes me Wink

kjohnsoncda
kjohnsoncda's picture
Greg, Have you had any

Greg,

Have you had any experience with PAP2T's? If so, how does it compare to the SPA 2102? I've got over 20 analog faxes hanging off a mix of grandstream equipment, and I'm not having any luck with larger faxes, etc.

my setup is: fax----->Grandstream(486,386,286)-----Asterisk(digium210B)---XO-PRI

Grandstreams have all been configured for g711 with fax passthrough. (not using the t38 option. and dtmf is configured for inband on the ata and the extension in asterisk.)

I need to go readup on t38 some more, I was under the impression the fax machine had to be t38 fax aware for it to be of any use.

I'm in the middle of trying to cobble together 1.6.1.10 and NVfax as per your original post.

Thanks,

Kirk

kjohnsoncda
kjohnsoncda's picture
I got the Digium fax

I got the Digium fax receiving faxes now - was simple enough thanks to Gregs instructions. (on asterisk 1.6.1.10 FreePBX 2.6.)

Does anyone have any examples for sending a file out, and emailing the sender back the status report? I've successfully faxed out a .ps file using a call file in the /var/spool/asterisk/outgoing folder. I'm thinking I could try and accomplish this with either an email to fax gateway or perhaps an smb shared printer on the asterisk server that writes ps to a directory, and then processes the fax from there.

I have this mostly working now, but am fighting an issue when sending a fax out, and I'm getting two email notices.
http://www.freepbx.org/forum/freepbx/users/call-files-to-send-fax-out-via-new-context#comment-22739

Once I get that sorted, I could post up my "recipie" but it really wouldn't work without the pointers Greg started in this thread.

Daave
Daave's picture
To Greg

Greg, Brock, and Others that contributed firstly thanks for the leg work.

Second, Greg did you ever get a chance to make that How-To you were working on as of November 20th, 2009? If so can you post a fresh link in this thread?

Thank you,

Daave

rrb3942
rrb3942's picture
hmmmm

I have some experiencing in sending faxes out with asterisk, I did some testing on 1.4 and 1.6 and even worked a little on integration with the ARI for this purpose at my job, but that ended up going nowhere.

I might be willing to create a project for this. I could make a back-end server for managing a fax queue and handling format conversion, fax sending and email notification. I would need someone else to work on the gui and portal side.

How much interest is there for something like this?

anthony.callanan
anthony.callanan's picture
Inbound Fax on PIAF/FreePBX

Hi there

I hope someone can help me. I am very new to FreePBX and not very skilled with Linux. So I feel a bit out of my depth.

I have buil myself a vanilla PIAF with the latest available version. The output below is the output of my status screen
* Running Asterisk Version : Asterisk 1.6.2.6
* Asterisk Source Version : 1.6.2.6
* Dahdi Source Version : 2.2.1+2.2.1
* Libpri Source Version : 1.4.10.2
* Addons Source Version : 1.6.2.0
CentOS release 5.4 (Final) :32 Bit Kernel: 2.6.18-164.15.1.el5

Everything is working fine, even the Cisco 3911 Handset that I have, with one exception. I cannot get fax to work.

I tried to follow the instructions at the head of this post, but not sure that I did it properly. The result was that when I set the fax options, any inbound call gets NU tone (form the network).

I also tried the suggestions at http://nerdvittles.com/index.php?p=237. Both gave me the same outcome.

The asterisk trace of the calls is below;
pbx*CLI>
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
-- Executing [0390175566@from-sip-external:1] NoOp("SIP/engin-00000003", "Received incoming SIP connection from unknown peer to 0390175566") in new stack
-- Executing [0390175566@from-sip-external:2] Set("SIP/engin-00000003", "DID=0390175566") in new stack
-- Executing [0390175566@from-sip-external:3] Goto("SIP/engin-00000003", "s,1") in new stack
-- Goto (from-sip-external,s,1)
-- Executing [s@from-sip-external:1] GotoIf("SIP/engin-00000003", "1?from-trunk,0390175566,1") in new stack
-- Goto (from-trunk,0390186655,1)
-- Executing [0390186655@from-trunk:1] NoOp("SIP/engin-00000003", "Catch-All DID Match - Found 0390186655 - You probably want a DID for this.") in new stack
-- Executing [0390186655@from-trunk:2] Goto("SIP/engin-00000003", "ext-did,s,1") in new stack
-- Goto (ext-did,s,1)
-- Executing [s@ext-did:1] Set("SIP/engin-00000003", "__FROM_DID=s") in new stack
-- Executing [s@ext-did:2] ExecIf("SIP/engin-00000003", "0 ?Set(CALLERID(name)=0395256688)") in new stack
-- Executing [s@ext-did:3] Set("SIP/engin-00000003", "FAX_RX=system") in new stack
-- Executing [s@ext-did:4] Set("SIP/engin-00000003", "FAX_RX_EMAIL=ccomte41@bigpond.com.au") in new stack
-- Executing [s@ext-did:5] Answer("SIP/engin-00000003", "") in new stack
-- Executing [s@ext-did:6] PlayTones("SIP/engin-00000003", "ring") in new stack
== Spawn extension (ext-did, s, 6) exited non-zero on 'SIP/engin-00000003'

It would seem that whatever module the system is trying to pass to, to answer the call, is not present.

Is there a real dummies step by step procedure I can follow to get this going?

A step by step "type this command" then and "type this other command", given my almost total lack of confidence in my linux skills would be great.

Thanks

Anthony

p_lindheimer
p_lindheimer's picture
A guess

Here's a guess that might be confirmed if you check the Asterisk logs.

These last two lines:

-- Executing [s@ext-did:6] PlayTones("SIP/engin-00000003", "ring") in new stack
== Spawn extension (ext-did, s, 6) exited non-zero on 'SIP/engin-00000003' 

Tells me it dies right after the PlayTones and the log will tell you why it dies.

My speculation, you are trying to execute NVFaxDetect() on a system that does not have that that installed.

Now with all the above versions, you failed to mention what you are using with FreePBX but I will venture to guess from the dialplan that it is something prior to 2.7 and if that is the case, then FreePBX won't stop you form configuring this detection option. Later versions will.

So once again, the above is speculation on my part, go find out in the log why the call hangs up at that moment, that will be the first clue.

(If my speculation is correct, you may just want to upgrade to FreePBX 2.7 and take advantage of the SIP FAX detection which is available in Asterisk 1.6.2.X.)

anthony.callanan
anthony.callanan's picture
Inbound Fax on PIAF/FreePBX

Philippe

Thanks for your guesses. Yes I am running FreePBX 2.5. I found that if I changed the FaxDetect to ZAP, the system answered and waited, as shown below, but also threw up a warning regarding the Comfort noise. After the wait it went through to the extension, as expected.

[2010-05-10 08:26:37] VERBOSE[6218] pbx.c: -- Executing [s@ext-did:6] Wait("SIP/engin-00000000", "5") in new stack
[2010-05-10 08:26:40] NOTICE[6218] rtp.c: Comfort noise support incomplete in Asterisk (RFC 3389). Please turn off on client if possible. Client IP: 203.161.164.69
[2010-05-10 08:26:42] VERBOSE[6218] pbx.c: -- Executing [s@ext-did:7] Set("SIP/engin-00000000", "__CALLINGPRES_SV=allowed_not_screened") in new stack

I figured at this point to give up on 2.5 and take your advice and upgrade to v2.7 (though 2.6) using the module admin tools.

I went through the Upgrade pulling down the 2.6 upgrade tool, and then upgrading a module at a time starting with the FreePBX framework. Now all modules are 2.6, but FreePBX now cannot communicate with Asterisk. When I do a reload it times out and presents the following message.

Bootstrapping /etc/amportal.conf ..OK
Parsing /etc/amportal.conf ..OK
Parsing /etc/asterisk/asterisk.conf ..OK
Connecting to database..OK
Connecting to Asterisk manager interface..Mon, 10 May 2010 21:30:05 +1000 - Unable to connect to manager 127.0.0.1:5038 (110): Connection timed out
FAILED
[FATAL] Asterisk Manager Connection Failure Failed to connect to the Asterisk manager through port: 5038

If I login to Asterisk using putty and watch the exchange that way I see no indication that asterisk received any communication from FreePBX. Netstat shows a tcp listener on port 5038.

Is there something simple I have broken or overlooked during the upgrade?

Thanks

Anthony

anthony.callanan
anthony.callanan's picture
Inbound Fax on PIAF/FreePBX

I started again, I have rebuilt and successfully upgraded to FreePBX 2.7. I will try the fax with the new version.

Anthony

pwf1960
pwf1960's picture
Inbound faxes detected on SIP trunks but not PRI trunks

I believe this to be appropriate to this thread, but don't hesitate to disabuse me of that notion.

I am trying to get inbound fax detection to work on a client PRI trunk. I caught the RxFax for ReceiveFax problem, and also the fact that the arguments for NVFaxdetect seem to have changed in the most recent release (from n|t to n,t where n=delay for detection). The client has a DID setup for all user extensions, and in the current version (FreePBX 2.5 and Asterisk 1.4) this works fine. In the updated version (FreePBX 2.6 and Asterisk 1.6), inbound calls over the SIP trunk get dumped into a context that runs NVFaxdetect just fine. However, if the same orginator calls the same extension using a DID inbound route over the client PRI, NVFaxdetect doesn't run initially and fax detection seems to happen only after the destination extension rings, timesout, and goes to voicemail.

So, I changed the context for the PRI to from-pstn from from-zaptel, but saw no difference. I would appreciate some hints on where I should be looking for answers to this issue, particularly since the client has indicated that this is a show stopper feature that must work in the updated server.

Thanks in advance...

shyju
shyju's picture
FAX to email - custom

--
Shyju Kanaprath

Pages