Transfer to fax

Home » Asterisk Users » Transfer to fax
Asterisk Users 18 Comments

Hi all,

I’ve got a user that has one phone number an wants to be able to us it for
both voice and fax.

When a fax call comes in, he wants to do some incantation on the keypad and
have the call go to the fax machine.

As I see it, he has 3 options.

1. (blind?) Transfer it to the fax extension.

2. Use features.conf to create a key sequence, say *2, to dial/transfer to a
fax extension.

3. Use fax detect (SIP) to do it automatically. However I’m also using FFA,
so I suspect these are mutually exclusive.

Does anyone have any insight as to which would work better?


18 thoughts on - Transfer to fax

  • On second though, I think my suggestion that FFA and fax detect were mutually
    exclusive stemmed from the idea that a call that was being
    originated/answered/handled by FFA would have it’s call disconnected and
    redirected by fax detect.

    If this is the case, it changes my dial plan logic, and I’m not sure I fully
    understand what changes I’ll need to make.

    For all I know, it might even simplify things by isolating all fax handling in
    one block.


  • Well, first you should not have faxdetect enabled on outbound channels.
    That takes care of the ‘originating’ part.

    If you have an inbound channel that you *know* you are sending to
    ReceiveFAX, then you can just disable faxdetect on that channel before
    doing so (this is why we made ‘faxdetect’ configurable from the
    dialplan). Alternatively, you can just let calls that you *know* are
    going to go to ReceiveFAX (dedicated FAX DIDs, for example) just ‘idle’
    in the dialplan listening to silence until faxdetect kicks in and sends
    them to ReceiveFAX.

    Note that the usage of FFA is not relevant here; whether you are using
    Fax for Asterisk, the free version of it, or res_fax_spandsp, the
    behavior and scenarios would be the same.

  • Very nice.

    Sounds like I need to add a faxdetect column to my SIP real-time configuration.
    Once I’ve done a sip reload or pruned/loaded my user agents, I should be good
    to go!

    Didn’t know faxdetect was configurable in the dialplan… Pointer to how to do

    BTW, FFA rocks!

  • The CHANNEL() dialplan function with the ‘faxdetect’ option. Not sure
    which releases have it; it might only be Asterisk 10.

  • Version 10 is on my radar, but I’m using 1.6.3 now. I’ll do some research. If
    it’s not in 1.6, I’ll just try to make this work in the sip config, for now.

    Thanks for your time.

  • So I’m still trying to get this to work… (I’m top posting, but the details
    are below, if you want/need background info)

    I’d like Asterisk to detect incoming faxes and redirect them elsewhere. The
    details aren’t important, as long as I get the detection working.

    I’ve added this to my sip.conf file. Probably overkill, but I’ll tune it once
    it works:


    My sip registrations are all in a Mysql RT database, so I added this column to
    my table:

    faxdetect char(3) default ‘no’

    I’ve set faxdetect to ‘yes’ for the devices that I expect to be receiving fax

    I did a sip reload from the console after adding and updating this column.

    I’ve added a fax extension to the appropriate context in extensions.conf:
    exten => fax,1,noop(I hear a fax!)

    Since most of my dialplan is in an AGI script, I’ve added this to the code
    that handles my test number:


    So, now that all of this is in place, I call the extension from my fax
    machine… and I don’t get any indication on the console that Asterisk heard a
    fax. My extension simply rings and I answer it.

    What am missing?

    Mike Diehl.

  • #1 you might need a progress() statement after answer
    #2 what does sip show peer xxx look like on this peer?

  • I’ll try that. Thank you.

    I’m testing against my office phone, a Polycom 501:

    * Name : 0004F211F1D0-2
    Realtime peer: Yes, cached
    Secret :
    MD5Secret :
    Remote Secret:

    Context : customers
    Subscr.Cont. :

    Language :
    Accountcode : 1
    AMA flags : Unknown
    Transfer mode: open
    CallingPres : Presentation Allowed, Not Screened
    Callgroup :
    Pickupgroup :
    Mailbox : 7001@context
    VM Extension : asterisk
    LastMsgsSent : 32767/65535
    Call limit : 0
    Dynamic : Yes
    Callerid : “Mike Diehl” <5051234567>
    MaxCallBR : 384 kbps
    Expire : 172
    Insecure : no
    Nat : Always
    ACL : Yes
    T.38 support : Yes
    T.38 EC mode : FEC
    T.38 MaxDtgrm: -1
    DirectMedia : Yes
    PromiscRedir : No
    User=Phone : No
    Video Support: Yes
    Text Support : No
    Ign SDP ver : Yes
    Trust RPID : No
    Send RPID : No
    Subscriptions: Yes
    Overlap dial : Yes
    DTMFmode : rfc2833
    Timer T1 : 500
    Timer B : 32000
    ToHost :
    Addr->IP : Port 1811
    Defaddr->IP : Port 5060
    Prim.Transp. : UDP
    Allowed.Trsp : UDP
    Def. Username: 0004F211F1D0-2
    SIP Options : (none)
    Codecs : 0x4 (ulaw)
    Codec Order : (ulaw:20)
    Auto-Framing : No
    100 on REG : Yes
    Status : OK (88 ms)
    Useragent : PolycomSoundPointIP-SPIP_501-UA/
    Reg. Contact : sip:0004F211F1D0-2@
    Qualify Freq : 60000 ms
    Variables :
    line_id = 0004F211F1D0-2
    Sess-Timers : Accept
    Sess-Refresh : uas
    Sess-Expires : 1800 secs
    Min-Sess : 90 secs
    Parkinglot :

  • This will have no effect; see below.

    ‘faxdetect’ is not a chan_sip configuration option (unlike chan_dahdi).
    It’s a feature that can be enabled on a channel via the CHANNEL()
    dialplan function. In the dialplan itself, you’d use something like this:

    exten => 1234,5,Set(CHANNEL(faxdetect)=yes)

    To do this in a configuration file, so that it will be applied to
    channels as soon as they are created, use ‘setvar’:


    I’m not sure how this would be done using Realtime configuration, but it
    should be possible. I’d encourage you to test it out using a
    non-Realtime peer first, just to make sure that it works the way you expect.

  • This function was implemented somewhere in the 10.x code base, I believe. I’m
    running 1.6.x. So, it sounds like I need to plan an upgrade in order to get
    this to work.

    I’ve used setvar in my RT config and it works very well.

    WRT the upgrade, I’ve gone in and made some code changes to the voicemail
    module which I’ll have to port over to version 10.x. Sounds like I should
    sign up to be a developer so I can pass those patches on…

  • In your peer config set directmedia=no and faxdetect=cng, Asterisk needs
    to be in the path to hear the CNG tones.


  • Right, so prior to that version, the *only* channel driver that had
    ‘faxdetect’ functionality was chan_dahdi.

  • Right, I forgot about that. Now I’ve really confused things.

    /me heads back to his hole

  • It was actually added to chan sip in 1.6.2, I remember that being a selling
    point on a 1.6.2 upgrade for a client of mine about a year and a half ago.