9 To Select Outside Line

I’d like to configure pressing 9 to select an outside line. I have two PSTN Comcast lines and buttons configured on my phones to select them. I’d like to be able to press 9 to select the next unused line. How do I do that?

So thinking about this, how about a custom dial plan in extensions_custom.conf on 9 that will select my first trunk, if busy select the second trunk, and if busy play a busy tone and hang up. Does that make any sense? Any wizards here know how to write this?

I’m just a country chicken lawyer, but isn’t this the hard way?

Is there a problem with putting the lines into an outgoing group and using them as a single group trunk?

If there’s a reason not to do that, a different way (without custom code) is to set up a pair of outgoing routes, one that expects ‘9’ as the first digit and one without. Set up each port as a trunk (top and bottom of the card).

The ‘with 9’ route would point to Trunk Top then Trunk Bottom,
The ‘without 9’ route would point to Trunk Bottom then Trunk Top.

Like I said though, there are lots of hard ways to do this too, so knock yourself out and let us know how it went.

I’ve already got the outgoing routes. I’m not sure what you mean by a single group trunk.

I’m starting to see that asterisk people want you to just dial a number with a 9 in front of it while you have a system dial tone and that selecting an outside line is somehow “old” behavior. But this old behavior is what everyone expects. It’s how the brand new system in my wife’s office works. It’s what my housekeeper tried to do on this system before I gave her a tutorial.

A 9 for a real dial tone seems like a reasonable thing.

If you were giving them a “real dial tone”, I’d agree with you. It’s not the way a PBX works. No matter what they do, the dial tone is coming from the PBX. That’s why we don’t talk about “choosing your trunk” or “which line you are calling out on.” The PBX manages all of the outbound lines.

If you really want what you say you want, set up ‘9’ to dial your DISA interface and have them dial from there. It’s not a “real dial tone” either, but it gives them the appearance that they are using a system from the 1960s. If you’re really intent on giving them a retro experience, why not have them route every call to an operator who can ‘connect them’ to their call?

I don’t know of anyone that dials ‘9’ to make a call on their cell phone, their home phone. It’s time to get rid of this anachronism and drag the people into the 21st century. We recently upgraded our phone system here and instead of “dial the number you want and let the switch handle it” they decided that ‘99’ for an “outside line” and “94” for a “long distance” line made sense because they didn’t want to reprint the first page of the phone book.

1 Like

You can do it the FreePBX way (let the outgoing route hunt for an available trunk and return a congestion message if there’s none available) and set up a line in your outgoing route that takes an initial 9, if dialed, and throws it away.

Then you can do it the “right” way (not using silly exit codes) and the users can operate the system the “right” way (we must dial 9 because that is the way it is done!) and everyone is happy.

Got to agree with Dave here, move past the concept of selecting a line and leave it to the computers. Let the humans just dial their number and be done with it.

I’d just make the outbound route try one trunk, then the other if it is busy. People don’t seem to dial local numbers any more, so any external call starts with a 0 and the system matches on that.

1 Like

Of course, @billsimon is correct.

The system always works “the way you want it to”. Those stupid scientists and engineers can make things easier and more reliable, but By God, in our ignorance, we certainly know better. Why ever change anything if you want it all to be “the way it is.” I’m sure we can come up with a FreePBX bus-bar system simulator that accepts ring-and-tip patches so you can do this Old School.

In FreePBX, you can set up your system to demand users dial ‘9’ or ‘99’ or ‘9477836’ to get an outside line. You can make them dial PIN codes for outside lines. You can make them dial all 10 digits of an American phone number, even if you don’t have to in your local dialing area, or you can let them dial 4 digits and let the system figure it out. The first thing the system does is get rid of the prepended kruft and process the number. You can make it as hard as you want - that’s what we love about it.

As far as I’m concerned, there are only one ‘prefix’ that make sense:- 01 (for international calls). Everything else is “local” thanks to the Internet and my VOIP provider.

After that, you set up the rules so that no matter what the silly humans type, the system just figures out what they really meant and always just does the right thing.

I installed a system for a Doctor’s office in a hospital. He wanted all of his phones on his server, but still wanted to be able to dial ‘5’ and the last four digits of the hospital’s numbers. Of course I made that happen.

The point isn’t that there’s right or wrong way. The point is that there is no limit to the ease or hardship we can put our users through. Making people dial ‘9’ “for an outside line” is as ridiculous now as Exchange Names were 50 years ago. Cute, but not really very efficient.

I think what we have here is a failure to communicate :slight_smile: I think you’re talking about pure VOIP. That’s not what I have. I have two PSTN lines coming in through a couple of gateway devices (Grandstream HT-503s). In my case a “real dialtone” is a valid concept. It means taking the PSTN off-hook and talking to it alone. The PBX is out of the picture at that point. All it has done is provide a connection from the digital PBX to the analog line that Comcast gives me.

So wanting to dial 9 to get “out” is still valid. I want to talk to the PSTN. I get what you and billsimon and matphillips are saying: once I’ve got an all-digital pathway the dial tone to the PBX is all that matters.

I’m not there yet.

What do you think would happen if you did what we were suggesting?

It would look like this:

  • 2 trunks, one for each of your HT503 gateways. Each trunk is configured with maximum channels = 1.
  • 1 outbound route, with the two trunks listed as targets. Set optional destination on congestion = Terminate Call - Busy.

That makes sense. But I currently have two outbound routes, one for each trunk. I also have two extensions setup. One for each trunk. That’s what my buttons are programmed for on my phones. When I select them, I get a dial tone for each of the PSTN lines and can dial out.

What you describe sounds reasonable, but I still need to keep the two trunks separate. One happens to have upstream voicemail on it so we need to be able to select it separately. I hope to be able to talk my wife into using the Asterisk VM instead. So much more capable.

Still trying to figure out how to get 9 to fire off a dial plan without needing a following # though.

To ask my last question a bit more directly, how do you get Asterisk to respond immediately to a keypress? How do you get 9 to fire off a dialplan without needing a #? That is needing 9#?

Are you saying you want to press 9 on your phone, have Asterisk connect to your HT503 gateway and go off-hook, and present the upstream dial tone to you so that you can continue to dial the call?

I don’t think you can do that. It might be possible with a complex configuration of the HT503.

As for how to get the 9 processed immediately and sent to Asterisk, this configuration is done on your phone, not on Asterisk. You would set up dial plan on your phone that detects the single digit 9 and immediately sends the call. On some dial plans it would look like (9S0) meaning if the string “9” is dialed, "S"end with “0” delay.

Right now I have a two extensions connected to my two trunks. By “calling” those extensions the HT-503 goes off-hook and I get a dial tone. We then dial out. So I know this is doable. I just need to test the status of the extension.

Right you are. When I press 9 on my phone I see “On Hook Dialing” on the display. I did not notice this. I will see if this is configurable on Grandstream phones. Thanks for the pointer.

I think what we have here is a failure to communicate
I think you’re talking about pure VOIP. That’s not what I have. I have
two PSTN lines coming in through a couple of gateway devices
(Grandstream HT-503s). In my case a “real dialtone” is a valid concept.
It means taking the PSTN off-hook and talking to it alone. The PBX is
out of the picture at that point. All it has done is provide a
connection from the digital PBX to the analog line that Comcast gives
me.

Nope. We do understand. We all deal with systems like that too. Don’t take it personally, but we are trying to show you that your goal to emulate an ancient mechanical system with “dial 9” is wrong.

Your users should pick up the phone and enter the phone number they want to reach. No one should need to dial special codes. Just dial the number. That’s what a PBX is for. Eventually you will realize that you are wasting your time trying to make fake dial tones for “real lines” and stuff. Just dial the number and place the call.

That said, I’m all into antiques (ham radios and phone systems), so I do appreciate those old mechanical crossbar switches. But I don’t use them in production.

Groovy. Then what do I do on my end regarding selecting an outbound line? You suggested a combined outbound route using both trunks. Is that enough?

Now I still need to be able to select each trunk separately due to the separate Comcast voicemail issue on one line. I have two extensions configured connected, one to each trunk and theses are programmed to lines on the phones. Will there be any problem leaving this in place?

I currently have two outbound routes, one for each trunk. I just tried your scheme. I picked up the phone and just dialed. It rings but nothing answers. I checked “core show hints” in asterisk and neither of the trunks show in use. So a line was not picked up. I wonder what was ringing.

Do I have things misconfigured?

I haven’t seen your configuration (and it wasn’t me who suggested anything), however, you create “outbound routes” based on the what the traffic is, not based on the trunk.

For example, I have a route called “10 digits” which is hit when a phone dials a standard 10 digit number. This route then has 3 trunks in it, which get tried in order until an available trunk is found and the call is completed.

Typically, that is all you need unless you have really special needs. I want all 800 calls to use a particular trunk, so I have an outbound route called “toll free” that prefers that particular trunk. But that’s just me.

Eh, Basildane, Billsimon, a boy can get confused :slight_smile: In any case I clearly need to get my outbound routes figured out. As I said, it isn’t working. Ringing off into the ether right now.

So, let me ask you. My outbound routes have Dial Patterns. My trunks have Dialed Number Manipulation Rules. What are used when I dial into the PBX the way you describe?

I’ve tried modifying my setup. I now have one outbound route with both trunks in it. I have removed all number manipulation rules in both trunks. I have regenerated all dial patterns in the outbound route to include 7 digit, 10 digit etc.

But when I dial through the system, I get a ring but no trunk is picked up. I can confirm this through “core show hints”. Only the extension is in use. I have no idea what is being called.

Any ideas?