Here it goes again, still the same problems for detecting voice based fax calls on Asterisk 1.6.
I know that « we should use T38 » or « get a decent SIP provider » are all along the way but hey! I’m using Free with it’s freephonie service in France and we’re even getting multiple ADSL connections (from different companies that are in the same building) and bridged them together to an Asterisk server.
It’s very handy, we get SIP trunking for a very small fee : free 🙂 but in fact it’s in a whole package for 30€ per month : ADSL2+, Free telephony, HD TV (tax included)
So, I wanted to post about the recent « patch » I prepared after upgrading to Asterisk 188.8.131.52-beta2.
Why upgrade to a beta version ? Simple, since there was advertised Fax detection support for T38 (which should work, I didn’t test since I don’t have a decent provider with T38 support 😉 ).
Looking at the chan_sip.c code I figured out it was very easy to tweak the fax detection code to also do detection on SIP audio channels,but … I was plain wrong ! In fact it could have worked but it’s much more difficult than it seems. To make a long story short, I looked more deeply at the NV Faxdetect applications (from Justin Newman) and in fact they use a similar approach that the one I finally got through : use Asterisk DSP to actually do the detection and then branch on the dialplan to « fax » extension (code already done in 1.6.2 for T38 only).
Removing specific T38 tests I almost got through after spending 3 hours to finally get to a point that was very near NV Faxdetect : I first had to switch to slinear before using DSP (or it wouldn’t detect faxes at all, if someone knows why please tell me 🙂 ) and then switch back to alaw or ulaw (what came first) to get the call through.
Seing that I needed to patch chan_sip.c alot with very dirty hacks I finally decided to go back on app_nv_faxdetect.c and app_nv_backgrounddetect.c and simply patch them (with very little effort surprisingly) and got them to work perfectly with Asterisk 184.108.40.206-beta2 (the patch should certainly apply to later 1.6.2.x version relatively cleanly, just make sure to apply it on vanilla sources *before* ./configure and make menuselect ; issue a make distclean if you didn’t)
I remembered I used to leave some mails to Justin, asking me to wait for a new version to come out and many people on http://www.voip-info.org seemed to have tried to patch it (or at least asked to) and noone managed to get a working version for 1.6.x.
Here it goes, but I’m very surprised I had to change very little portions of code (nothing really important, only definition and variable name changes) and everything has been working very well here for more than 2 weeks, with more than a dozen faxes correctly detected.
If you need to, leave me a comment since I started to test at home (yes I also have an Asterisk box at home 😉 ) and I patched a version for Asterisk 220.127.116.11 that compiled and worked flawlessly.
Be sure to grab the patch attached here and enjoy your fax detection on voice part of SIP channels 🙂
See you for other Asterisk weirdnesses, I have some more to post !!