Auto-dial Long Distance Code for analog device

FreePBX and Asterisk 1.8.15-cert5.

I have some fax machines connected via an analog card and we use long distance codes with our provider. I’m looking for a way to have a long distance code automatically dialed for these.

What are my options?


Assuming that when an “ordinary” extension (IP phone, etc.) dials e.g. 12125551212, you send 12125551212 on trunk foo, but when extensions 201 through 204 (your fax machines) dial 12125551212, you want to send 101028812125551212 on trunk foo:

Edit the Outbound Route that sends calls to trunk foo, inserting at the top a Dial Pattern with prepend 1010288, prefix (blank), match pattern 1NXXNXXXXXX, CallerID 20[1-4]

If that’s not what you want, please give a specific example, showing what is dialed by the fax machine, what should get sent, and how that differs from dialing the same number from a desk phone.

Hi Stewart, thanks for your reply!

I wish it were that easy. The problem is we are prompted for the long distance code after dialing. So we would dial 12125551212, then almost immediately we hear a tone, dial 1234 and the call is connected. Right now, I have the fax machine (fax server, actually) dialing like this: 12125551212www1234 and that is working but requires an entry for each area code. Kind of a pain. Would be nice if there were an option to append on an Outbound Route, but doesn’t seem to be a common need. Appending to an Outbound Route is what I was hoping for. Be it an Override or custom entry.

I considering bringing this in-house and setting up PIN sets in FreePBX but I need to discuss with management and determine what kind of reports they get - and actually look at. But for now, still need a solution.

Thanks again, and hope all this makes sense.


This thread, or its link to may help you. However, it may not work if your provider doesn’t “answer” the call before prompting for the long distance code. What type of trunk (PRI, T1, SIP, analog) is this?

Sorry, I should have included that in my original post. It is a PRI.

If the code must be sent during early media, it should be possible to use the SendDTMF command, though I don’t know how to set the timing correctly. Perhaps another member can chime in here. Most IP phones won’t start counting call time until answer is signaled, so you can tell whether you’ll need to deal with early media DTMF.

Otherwise, maybe you can get the provider to accept the code as a prefix to the dialed number or caller ID.

Thanks for all your suggestions Stewart. I will play with the SendDTMF() command. I remember exploring this a few years back when I was integrating with a legacy PBX. I don’t recall if SendDTMF worked during early media or not. I’ll post back when I learn something.

Again, thanks for your help.

From what I can tell, there is no way for this to work since the telco doesn’t “answer” the call until the DTMF digits are sent, Asterisk does not continue to process the dialplan to play DTMF. Everything I have read on this subject suggests turning the feature off at the telco and using PIN sets in FreePBX. That is likely what I will do.

Thanks again.