Ok - This may be obvious to some but I searched and searched to make this work.
The Setup - I have BluIP Trunks (Fabulous by the way - http://www.bluip.com) and I wanted to use HylaFAX with my Asterisk 10 box to send outbound FAXes through the BluIP SIP Trunk.
But every time I tried to send one, it would start the negotiation and then try and re-invite (even though canreinvite=no was set in the trunk) and then fail.
I knew that Asterisk 10 would Gateway, but no matter where I put it in the Dialplan, it never worked - until the lightbulb finally went off and I added the code to the [macro-dialout-trunk-predial-hook] in /etc/asterisk/extensions_custom.conf - I already had to have it to set P-Asserted-Identity to control caller ID - Here is what mine looks like:
[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(Adding P-Asserted-Identity)
exten => s,n,SipAddHeader(P-Asserted-Identity: )
exten => s,n,Set(FAXOPT(gateway)=yes)
exten => s,n,MacroExit()
And then it started working!!!! Woot! If you don't need the P-Asserted part, it should look like this:
[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(Enabling FAX Gateway Mode)
exten => s,n,Set(FAXOPT(gateway)=yes)
exten => s,n,MacroExit()
In case anyone else stumbles across this you will need the above in your /etc/asterisk/extensions_custom.conf - You will also need to enable T.38 in SIP Settings - Here also is my SIP Trunk definition in case anyone else wonders:
qualify=no&no
nat=yes
secret=SecretSquirrel
fromdomain=somewhere.com
host=lax-sbc-iad.bluip.com
outboundproxy=lax-sbc-iad.bluip.com
username=xxxxxxxxxx
dtmfmode=rfc2833
type=peer
sendrpid=yes
trustrpid=yes
canreinvite=yes
faxdetect=both
directmedia=no
t38pt_udptl=yes,redundancy,maxdatagram=400
jbenable=no
The last three lines are from here: http://www.asterisk-pbx.hk/2012/08/working-with-asterisk-10-t38-gateway.html - They don't seem to be necessary but in sending LOTS of faxes, they seem to help.
Greg
T.38 FAX Outbound Gateway FreePBX SIP Trunks