Dial an Internal Extension if Certain PSTN Number is Dialed

Working with an older PBX system (Elastix) for a client. They have two branch offices. These are connected via IAX trunk configured in Asterisk. When a user in branch A wants to call a user in branch B they just dial the extension number. But on occasion, an internal user dials the main PSTN number of the other branch. The calls made like this never complete…due to EOL issues I’m told. But what I’d like to try before we replace this system is to make an entry in the right conf file which will dial the receptionist’s extension instead of the PSTN phone number. The two branches have two SIP trunks provided by AT&T and an IAX trunk connecting the PBX servers.

So if someone in branch A dial 435-334-2233 I would like the call to be routed to the extension 6311 at the other branch on lieu of using the outbound SIP trunk to the PSTN.

It’s been so long since I hacked around with Asterisk dial plans so any advice would be helpful.

You would set that up as an inbound route in the elastix UI. How, I don’t know, look in the elastix documentation. Most of those distros providing a UI, will completely wipe your custom configuration if not done right, and the right way depends on the UI. There’s usually a configuration file the UI will never touch, that’s included in the other config files.

It sounds like you want to do this within the Elastix framework, in which case you are asking in the wrong place.

In Asterisk, you can do it with something similar to one of the following, placed in the context used by trusted local callers:

exten => 4343342233, 1, Dial ({trunk-technology}/6311@${trunkname})

or

exten => 4343342233, 1, Goto(${trunkaccesscode}6311)

or

exten => 4343342233, 1, Dial (Local/${trunkaccesscode}6311@{context for trusted local callers})

Note that dial string syntax is technology dependent.

Thanks for the prompt replies. I’m thinking this might work:

exten => 4343342233, 1, Dial (IAX, 6311)

If I added this to the extensions_custom.conf file and then restart Asterisk it should pickup when an internal user is trying to call the other branch using the PSTN line. Why the users need this is not something they can fully explain. When asked “Why don’t they just call the extension of the front desk?” since calls made extension to extension are working. But for some instances they tell me this ability to dial in using the main number is needed.

Or would this syntax work as well?
exten => 4343342233, 1, Dial (6311)

and the extensions_custom.conf file is the proper place to do this?

IAX is an incomplete dial string, and 6311 is a rather long call timeout. 6311 is not a valid dial string.

extensions_custom.conf is part of FreePBX.

David,

Sorry to be so clueless but I’m not quite following you on this one. 6311 is the extension number I want to the call to be sent to when a user at branch A wants to call branch B but uses the PSTN number in lieu of the extension number 6311. My syntax in this example may not be correct.

Perhaps it needs to be something like:

exten => 4343342233, 1, Dial (IAX,/6311,20)

exten => 4343342233, 1, Dial (IAX2/6311,20,)

Surely he wants some digits to forwards as well as his IAX2 link is a to another PBX, not direct to the phone. I’ve only used SIP for tie lines, so I don’t know the fine details.

Of course the OP may be clutching at straws by even mentioning IAX, and expecting not to have to configure IAX.

Thanks again. And again, my apologies for my newbie status. The current setup works fine. The only issue is that some of the users tell me they sometimes need to call the front desk at the other branch by using the PSTN number. Why, they cannot say, they only tell me that they need it and it used to work. I think the “it used to work” part may be a pipe dream. And the IT people who setup the original are long gone.

When I call the front desk extension (6311) at the other branch from my desktop voip phone the call goes through. But when I call the direct main telephone number from my phone it goes into silence. The lady at the front desk over there tells me she sees the call, hears it ring but when she picks it up it’s only silence.

A successful call goes through and is placed in the CDR report like this:

2023-10-06 14:26:28 6305 6311 SIP/6305-00000136 IAX2/LZoo-16421 ANSWERED 40s

When I try to call the main number, the call shows up like this in the CDR report:

2023-10-06 13:56:26 6305 95614484976 SIP/6305-00000114 SIP/ATT1_OUT-00000115 ANSWERED 7s

Both calls show they were answered but the second call is only silence for both me and the front desk over at the other branch.

You haven’t included all the fields from the CDR, so I can’t tell what was dialled. However, it looks, like 6311 is configured to to dial the right thing, in which case you should look at my second and third options, with the access code being empty. Probably just use Local/6311@from_internal with Dial, or from_internal,6311,1 with GoTo. (These are based on my understanding of FreePBX and are dependant on its use.)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.