9 To dial Out


i have a question and couldent find a solution for it i wonder if you can help.

im using

To dial out to the fxo ports on my card and it works which is great but when you press 9 you don’t get a dial tone now i was wondering if it was possible to dial 9 and then get a external dial tone from one of the ports, and then the user can dial as normal?



ignorepat => 9
needs to be in your context in extensions.conf

I don’t believe ignorepat is relevant.

First question is why would you want to do this. Most people prefer otherwise, and it makes call logging difficult if you do what you want. In fact, the ability to get PSTN dialtone has a potential for toll fraud.

The setup is potentially complicated, and will depend on the channel technologies. If the calling party is SIP, the phone’s diaplan will need to be set to consider 9 a complete number.

I am fairly sure that you will need to configure the outgoing side to answer the call without waiting for an answer indication from the network.

You may need to enable overlap dialling, in some cases, and you may need to make 9 an exact number, rather than a wildcard, in others

All in all, there is a lot of detail here which goes against what most people want to do, and you haven’t told people enough about your configuration for you to get an answer that will work for it, except by luck.

Thanks David

The only numbers that will be dialled via sip are the connected phones. But to make an call to any other telephone number the call is passed through the fxo card.

On a standard pbx you can press 9 then you get a new dial tone, then you dial the external number and that is what im trying to achieve

Here’s an option:


exten => 9,1,Answer()
exten => 9,n,Goto(localnext,s,1)


exten => s,1,Playtones(dial)
exten => s,n,WaitExten(30)
exten => s,n,StopPlayTones()
exten => s,n,Hangup()

exten => 100,1,Background(demo-congrats)

In this example, the SIP phone is assigned to the local context. The SIP phone dials 9, it gets sent to the localnext context. There, dialtone is played back to the SIP phone, we wait for the user to enter an extension for 30 seconds, and then we stop playing the tone. If the SIP phone dials extension 100, they hear the demo-congrats file.

Malcolm’s solution is faking the original user experience, without actually playing network dialtone, or even waiting for it.

The behaviour you want really arises from technical limitations in mechanical and electromechanical PABXes, and most people prefer to dial the whole number in one go.

In particular, Strowger PABXes had no memory, so could not delay out-dialing until the central office had allocated resources to accept the number. They therefore immediately seized an outgoing line when 9 was dialled and let the user determine when it was safe to continue dialing.

Malcolm: on a real legacy system, dialtone would be broken by the first forwarded digit. Your solution maintains dialtone until the complete number is dialed and requires the callers phone to send the number in one go.


Yes, it’s faking it. :smile: To further improve the fakery, one could do:

exten => 9,1,Answer()
exten => 9,n,Playtones(dial)
exten => 9,n,Read(firstdigit,,1,,,30)
exten => 9,n,GoToIf($[${LEN(${firstdigit})} > 0]?true:false)
exten => 9,n(true),StopPlayTones()
exten => 9,n,WaitExten(30)
exten => 9,n,Hangup()
exten => 9,n(false),Hangup()
exten => _XXXXXXXXX,1,SayDigits(${firstdigit}${EXTEN})

Your first dialtone comes from the SIP phone.
The user dials 9.
Asterisk Answer’s the call, then starts playing back local dialtone (this is not the telco’s dialtone).
We then use the Read application to read one digit into the variable firstdigit, with a timeout of 30 seconds.
We then evaluate the length of firstdigit and if there’s no length (meaning the user entered nothing in the 30 seconds), we jump to a priority that calls the Hangup command.
If the user entered a digit (the expression evaluated to true), we jump to the true priority and we execute StopPlayTones.
Then, we wait another 30 seconds for the user to enter an extension, using the WaitExten application.
If the user enters nothing, we Hangup the call.
If the user enters something that’s got 9 digits in it, like a PSTN phone number for example, we then playback the value of firstdigit and the value of the 9 digits the user entered.