T38 Gatway help

I have been trying to get t38 gateway mode to work on freepbx for a while now. On my first setup I was able to get get it to work, now even on a new install I can not get it to gateway.

Let me start off with my setup.

Hylafax client -> Hylafax -> Iaxmodem -> Freepbx -> Carrier.

Inside freepbx I have added the follow trigger for gateway mode. into extension_custom.conf

[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(Enabling FAX Gateway Mode)
exten => s,n,Set(FAXOPT(gateway)=yes)
exten => s,n,MacroExit()

I then add to my outbound trunk peer

faxdetect=both
directmedia=no
t38pt_udptl=yes,redundancy,maxdatagram=400
jbenable=no

The problem that I am facing is the the call is setup and the invite is sent to my peers as G711 and then the carrier sends an invite back to to free pbx to setup T38. Freepbx responds with the 200 Ok, but my carrier says it does not send the correct info back

They say the max datagram is wrong, in turn the fax fails with no carrier detected after the invite. If I turn off the t38 module, faxes complete. Below is a sip debug

I would like to have asterisk gateway and send the invite out rather than wait for the reinvite. I had this working in the past for a bit but cant seem to get back to it.

Audio is at 11934
Adding codec 100003 (ulaw) to SDP
Adding codec 100004 (alaw) to SDP
Adding codec 100002 (gsm) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to x.x.x.125:5060:
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP x.x.x.76:5060;branch=z9hG4bK44239bb3;rport
Max-Forwards: 70
From: “MOI” sip:[email protected];tag=as7a8740f2
To: sip:[email protected]
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: FPBX-2.11.0(11.7.0)
Date: Tue, 31 Dec 2013 14:34:34 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 284

v=0
o=root 2010543355 2010543355 IN IP4 x.x.x.76
s=Asterisk PBX 11.7.0
c=IN IP4 x.x.x.76
t=0 0
m=audio 11934 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv


<— SIP read from UDP:x.x.x.125:5060 —>
SIP/2.0 100 Trying
Call-ID: [email protected]:5060
CSeq: 102 INVITE
From: “MOI” sip:[email protected];tag=as7a8740f2
To: sip:[email protected];tag=sip+1+7d46000a+7d5e303b
Via: SIP/2.0/UDP x.x.x.76:5060;received=x.x.x.76;rport=5060;branch=z9hG4bK44239bb3
Server: SIP/2.0
Content-Length: 0

<------------->
— (8 headers 0 lines) —

<— SIP read from UDP:x.x.x.125:5060 —>
SIP/2.0 200 OK
Call-ID: [email protected]:5060
CSeq: 102 INVITE
From: “MOI” sip:[email protected];tag=as7a8740f2
To: sip:[email protected];tag=sip+1+7d46000a+7d5e303b
Via: SIP/2.0/UDP x.x.x.76:5060;received=x.x.x.76;rport=5060;branch=z9hG4bK44239bb3
Server: SIP/2.0
Content-Length: 237
Contact: sip:[email protected]:5060
Content-Type: application/sdp
Accept: application/sdp, application/isup, application/dtmf,multipart/mixed
Allow: INVITE,ACK,CANCEL,BYE,PRACK,UPDATE

v=0
o=Sonus_UAC 61784250123813 61784250123813 IN IP4 x.x.x.125
s=-
c=IN IP4 x.x.x.125
t=0 0
m=audio 58136 RTP/AVP 0 101
a=sendrecv
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=maxptime:20
<------------->
— (12 headers 11 lines) —
Found RTP audio format 0
Found RTP audio format 101
Found audio description format PCMU for ID 0
Found audio description format telephone-event for ID 101
Capabilities: us - (gsm|ulaw|alaw), peer - audio=(ulaw)/video=(nothing)/text=(nothing), combined - (ulaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port x.x.x.125:58136
list_route: hop: sip:[email protected]:5060
set_destination: Parsing sip:[email protected]:5060 for address/port to send to
set_destination: set destination to x.x.x.125:5060
Transmitting (NAT) to x.x.x.125:5060:
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP x.x.x.76:5060;branch=z9hG4bK2c5d1b3c;rport
Max-Forwards: 70
From: “MOI” sip:[email protected];tag=as7a8740f2
To: sip:[email protected];tag=sip+1+7d46000a+7d5e303b
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 ACK
User-Agent: FPBX-2.11.0(11.7.0)
Content-Length: 0


[2013-12-31 08:34:36] NOTICE[15504][C-00000012]: res_fax.c:3404 fax_detect_framehook: FAX CNG detected but no fax extension in context (from-internal)
[2013-12-31 08:34:36] WARNING[15504][C-00000012]: res_rtp_asterisk.c:1982 ast_rtp_dtmf_begin: Don’t know how to represent ‘f’
[2013-12-31 08:34:36] WARNING[15504][C-00000012]: res_rtp_asterisk.c:2109 ast_rtp_dtmf_end_with_duration: Don’t know how to represent ‘f’

<— SIP read from UDP:x.x.x.125:5060 —>
INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP x.x.x.125:5060;branch=z9hG4bK+d6e33784c12d0287d75236a2c80765111+sip+1+a6ad3ed0
Call-ID: [email protected]:5060
From: sip:[email protected];tag=sip+1+7d46000a+7d5e303b
To: “MOI” sip:[email protected];tag=as7a8740f2
CSeq: 1020362154 INVITE
Expires: 180
Content-Length: 305
Contact: sip:[email protected]:5060
Content-Type: application/sdp
Max-Forwards: 69
Allow: INVITE,ACK,CANCEL,BYE,PRACK,UPDATE
Accept: application/sdp, application/isup, application/dtmf,multipart/mixed

v=0
o=Sonus_UAC 61784250123813 61784250123814 IN IP4 x.x.x.125
s=-
c=IN IP4 x.x.x.125
t=0 0
m=image 58136 udptl t38
a=sendrecv
a=T38FaxVersion:0
a=T38MaxBitRate:14400
a=T38FaxRateManagement:transferredTCF
a=T38FaxMaxBuffer:262
a=T38FaxMaxDatagram:176
a=T38FaxUdpEC:t38UDPRedundancy
<------------->
— (13 headers 13 lines) —
Sending to x.x.x.125:5060 (NAT)
Got T.38 offer in SDP in dialog [email protected]:5060
Capabilities: us - (gsm|ulaw|alaw), peer - audio=(nothing)/video=(nothing)/text=(nothing), combined - (nothing)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x0 (nothing), combined - 0x0 (nothing)
Got T.38 Re-invite without audio. Keeping RTP active during T.38 session.

<— Transmitting (NAT) to x.x.x.125:5060 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP x.x.x.125:5060;branch=z9hG4bK+d6e33784c12d0287d75236a2c80765111+sip+1+a6ad3ed0;received=x.x.x.125;rport=5060
From: sip:[email protected];tag=sip+1+7d46000a+7d5e303b
To: “MOI” sip:[email protected];tag=as7a8740f2
Call-ID: [email protected]:5060
CSeq: 1020362154 INVITE
Server: FPBX-2.11.0(11.7.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: sip:[email protected]:5060
Content-Length: 0

<------------>

<— Reliably Transmitting (NAT) to x.x.x.125:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP x.x.x.125:5060;branch=z9hG4bK+d6e33784c12d0287d75236a2c80765111+sip+1+a6ad3ed0;received=x.x.x.125;rport=5060
From: sip:[email protected];tag=sip+1+7d46000a+7d5e303b
To: “MOI” sip:[email protected];tag=as7a8740f2
Call-ID: [email protected]:5060
CSeq: 1020362154 INVITE
Server: FPBX-2.11.0(11.7.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: sip:[email protected]:5060
Content-Type: application/sdp
Content-Length: 297

v=0
o=root 2010543355 2010543356 IN IP4 x.x.x.76
s=Asterisk PBX 11.7.0
c=IN IP4 x.x.x.76
t=0 0
m=image 4847 udptl t38
c=IN IP4 x.x.x.76
a=T38FaxVersion:0
a=T38MaxBitRate:14400
a=T38FaxRateManagement:transferredTCF
a=T38FaxMaxDatagram:1400
a=T38FaxUdpEC:t38UDPRedundancy

<------------>

<— SIP read from UDP:x.x.x.125:5060 —>
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP x.x.x.125:5060;branch=z9hG4bK+211d01b0da62dd1eedcec555ef94c9101+sip+1+a6ad3ed1
Call-ID: [email protected]:5060
From: sip:[email protected];tag=sip+1+7d46000a+7d5e303b
To: “MOI” sip:[email protected];tag=as7a8740f2
CSeq: 1020362154 ACK
Contact: sip:[email protected]:5060
Content-Length: 0
Max-Forwards: 69

IN gateway mode Asterisk will not send a T38 options. It ways tell something else ask for it. Its stupid but its how it works. Secondly I dont think you can add the T38 settings at a trunk level. They have to be added in the correct sip.conf which you can do in the SIP Settings module by enabling T38 option.

So in short, your saying the options messages I was seeing when it was sending t38 was passthrough and not gateway?

I guess I will change some things around and see what happens.

No I am saying the options will always happen after some device or endpoint tells asterisk to use T38. It wont on its own say hey lets use T38. Something tells it.

I became crazy again. Can you specify me each configuration that I have to set for using fax over ip t38? Right now I have faxes going on pstn line using hylafax and iaxmodem. Thanks

You could keep all your hard work by building and deploying t38modem’s to your system, it is trivial in Debian, (there’s and apt for that) a little tricky in Not-Centos as you will need to roll up your sleeves and build your oewn, but well worth the effort IMHO. As an added bonus, perhaps add Avantfax for an inbound outbound html based gui interface to faxes and users local and remote.

I have an installation with raspberry pi asterisk version 11 with freepbx, hylafax and iaxmodem. I thought that support for T38 is already included into asterisk 11

Set it/them up as extensions on the asterisk box (much like an IAX2 modem) and use it in hylafax. Configure asterisk to passthrough T38

I found many post with different manuals for configuring it, but someone says this, someone says that. Where can I found a comprehensive tutorial or step list for configuring T38 fax with asterisk 11, hylafax and freepbx?
Thanks

heh :slight_smile: On google of course, you will probably need to read and digest them all, good luck.

not so simple. I 've not found a complete guide that covers a common setup on asterisk and freepbx with T38 support…
someone says a thing, someone says other things. Basically I enable T38 pass-through and then?
What I have to configure on hylafax?
On extensions?
On trunks PEER?

I didn’t say it was simple, and I am not aware of any “complete guide” either but:-

http://www.voip-info.org/wiki/view/T38modem+configuration+with+Asterisk

should be enough for you to get it working. Some bits like the hylafax config.ttyT38modem you will need to get from the source code.

No Pain, No Gain :wink:

No, I think is not necessary all that configuration because I’ve Asterisk 11.5 with native T38 Gateway support

My solution is for hylafax, if you want to abandon that software, then you can do it your way, but I can assure you that sending faxes will be a problem. Either way, Good Luck.