Fax not sending | Basic Questions

My endpoint is using TLS transport with SRTP. Is it Ok or do I have to use UDP/RTP?


If you are referring to T.38, it doesn’t use RTP and doesn’t care if SRTP or RTP was initially used.

Thanks, jcolp.

What about TLS? I have learned that TLS relies on TCP, so I guess I have to configure a transport using UDP to my provider to get my fax working? Is that right?

Just asking since I udptl set debug on and did not see one single package transfering.

The signaling doesn’t matter, it’s just how the SIP traffic is exchanged. It has no impact on the T.38 UDPTL side. You would need to provide an actual SIP trace, configuration, and confirmation that your ITSP supports T.38.

My ITSP supports T.38, this is confirmed.

Just to make clear what I try to archive:
I want to use asterisk as an endpoint, not pass through another device/ata.

The extension used was just dialed from a SIP phone (Grandstream).

Here is my config:

direct_media=no ; Determines whether media may flow directly between endpoints.
timers=no ;neu
;FAX support

My SIP trace:
sip_trace_fax_not_working.txt (15.0 KB)


I guess my context is wrong - should have added t38_* options to context internal, right?

They go in the endpoint section of pjsip.conf that is being used for the session. In this case I think it is 3456?

Yes, which is in context “internal”

3456 is a regular sip phone. I guess this makes no sense at all…

Your dialplan appears to send it to the SendFAX application.

The relevant part of the dialplan:

exten = _0401X.,1,NoOp(hello fax)
same = n,wait(6)
;same = n,Set(FAXFILE=${TIFF_2_SEND})
same = n,Set(FAXFILE=/opt/asterisk/var/fax/FaxTestGS.tiff)
same = n,NoOp(**** SETTING FAXOPT )
same = n,Set(FAXOPT(ecm)=yes)
same = n,Set(FAXOPT(headerinfo)=“Test”)
same = n,Set(FAXOPT(localstationid)=123456)
same = n,Set(FAXOPT(maxrate)=14400)
same = n,Set(FAXOPT(minrate)=2400)
same = n,NoOp(
same = n,SendFAX(${FAXFILE},dfzs)
;same = n,SendFAX(${FAXFILE})

exten = h,1,NoOp(FaxStatus : ${FAXSTATUS})
same = n,NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)})
same = n,NoOp(FAXOPT(filename) : ${FAXOPT(filename)})
same = n,NoOp(FAXOPT(headerinfo) : ${FAXOPT(headerinfo)})
same = n,NoOp(FAXOPT(localstationid) : ${FAXOPT(localstationid)})
same = n,NoOp(FAXOPT(maxrate) : ${FAXOPT(maxrate)})
same = n,NoOp(FAXOPT(minrate) : ${FAXOPT(minrate)})
same = n,NoOp(FAXOPT(pages) : ${FAXOPT(pages)})
same = n,NoOp(FAXOPT(rate) : ${FAXOPT(rate)})
same = n,NoOp(FAXOPT(remotestationid) : ${FAXOPT(remotestationid)})
same = n,NoOp(FAXOPT(resolution) : ${FAXOPT(resolution)})
same = n,NoOp(FAXOPT(status) : ${FAXOPT(status)})
same = n,NoOp(FAXOPT(statusstr) : ${FAXOPT(statusstr)})
same = n,NoOp(FAXOPT(error) : ${FAXOPT(error)})
same = n,NoOp(DNIS: ${RECEIVER})

Meanwhile I added the options to the endpoint definition of the sip phone like that:

type = endpoint
transport = tls-natted ;TLS
context = internal
disallow = all
allow = alaw ;entspricht g711a
;allow = ulaw
media_encryption=sdes ; für SRTP - mögliche Optionen sind hier “no”, dtls oder sdes
; Determines whether res_pjsip will use and enforce usage of media encryption for this endpoint.
; Note the media_encryption option for the endpoint. In this case, we’ve configured an endpoint that will be using SDES encryption for RTP.
; You might be tempted to add a transport=transport-tls to the endpoint but in pjproject versions at least as late as 2.4.5, this will cause issues like Connection refused in a few situations. Let pjproject do the transport selection on its own. If you still see issues, set rewrite_contact = yes in the endpoint configuration.
;FAX support

I get this:

res_fax.c:2414 sendfax_t38_init: channel ‘PJSIP/3456-0000000e’ refused to negotiate T.38

Your SIP phone is unlikely to do T.38. Based on the way you are configuring Asterisk you are attempting to send a TIFF fax document to your desk phone. What do you actually want to do?

I want to use the so called Virtual Fax which was mentioned in the docs to send and receive fax and store it in the file system as tif. To accomplish this I have this:

asterisk-2018*CLI> module show like fax
Module Description Use Count Status Support Level
res_fax.so Generic FAX Applications 1 Running core
res_fax_spandsp.so Spandsp G.711 and T.38 FAX Technologies 0 Running extended
2 modules loaded

asterisk-2018*CLI> fax show capabilities
Registered FAX Technology Modules:

Type : Spandsp
Description : Spandsp FAX Driver
Capabilities : SEND RECEIVE T.38 G.711 GATEWAY
1 registered modules

Once I got it working I will write a small application which takes care about converting to pdf and delivering to users mailboxes (for incoming faxes) and will provide a small gui to users for outgoing messages.

I don’t know what virtual fax is I’m afraid or what it means.

Maybe I am slowly driving mad on this and do not remember well. I am trying to get relevant information on the internet and reading whatever I can get but still have no clue how to set up what I try to archvie…

I don’t know what to do.

Is asterisk able to emulate a fax machine?

The SendFAX and ReceiveFAX applications can be used to send and receive faxes. T.38 passthrough is also supported so a device calling another device can use it.

So in my case I won’t use T.38?

I can only provide information about what Asterisk is capable of and how it can be used. It’s up to you to use that information, experiment, and create what you want.