Upgrading Asterisk from 1.4 with app_rtxfax to 1.6 with app_fax
Last week I upgraded our companies Asterisk from 1.4 to 1.6. The thing that kept my busy for the most time was upgrading the fax application. To make things easier I try to write down what I found out.
First of all: app_rtxfax does not work with 1.6 anymore. Luckily app_fax now exists which is an internal module of the core asterisk package instead of an external module which makes things much easier in the future. You (still) need spandsp installed for it to work. A note for Gentoo users (like me in this case): don't forget to add the "span" use flag to net-misc/asterisk or you wont get it.
Ok, now you have an asterisk that can do what you want to but you have to tell him how. Time to change your dialplan! That part is rather simple: replace any "rxfax(foo)" by "ReceiveFAX(foo)" and any "txfax(foo|caller)" by "SendFAX(foo)". I had the additional problem that "System" did not work for me anymore to call my externals scripts so I changed that to AGI scripts, but that's probably my own fault because I did something wrong. Works anyway ;)
So, now your machine should be able to send and receive faxes again. To more problems may bite you: when your asterisk crashes every time you receive a fax you have triggered Asterisk bug 16374. Adding "-I" to the Asterisk commandline options like suggested in one comment helped for me. The other problem was that the page number in the emails generated by fax2mail script was always 0. The point is that my tiffinfo has "Page Number" instead of "Page" in it's output and the usage of "grep -c" there is simply wrong. My fix is:
PAGES=$(tiffinfo $SOURCEFILE | grep "^[ ]*Page Number:" | sed 's/.*:[ ]*//')