I have a working FreePBX system, that is working just great.
I have about 30 extensions, all with 3-digit numbers.
For example, I have the extension 120, 121, 250, 251 etc
I have also a trunk configured, for outgoing and incoming calls.
This trunk is a connection with another PBX system, which I don’t have administrative access to it.
All the incoming calls from this trunk, has as DID a prefixed version of my extensions.
For example:
the incoming call for 333120 has to be routed to my extension 120.
the incoming call for 333250 has to be routed to my extension 250.
The current setup, has about 30 inbound routes (one for each extension), in the following format: DID 333120, Destination extension 120.
What I am asking, is if I can replace all those inbound routes, with 1 rule, that will strip the prefix (333) from the incoming calls, only from the specific trunk.
You can do that with a custom context on your trunk. Change the context to something like this: from-other-pbx and add this context to your extensions_custom.conf file:
[from-other-pbx]
exten => _333XXX,1,Log(NOTICE, Incoming call from other pbx:${EXTEN})
same => n,Goto(from-internal,${EXTEN:3},1)
Reload you dialplan from the linux console like that: rasterisk -x'dialplan reload'
If you do not want to do that with this method, you can add a custom destination and use this context like that: from-other-pbx,${EXTEN},1
and add a general inbound route like that: _333XXX that would route to the custom destination that you created.
You can delete your specific inbound route to test this general inbound route, and if it will work you will be able to delete the rest of the specific inbound routes.
Thank you,
Thank you for the tip of using the from-did-direct context in the custom destinations module. I just wish that the GUI was way more flexible than today. It would have been much more easier to manage the Asterisk servers with the Freepbx framework.
Now I have another issue that I have to figure out.
For all the extensions (I have 3-digit extensions), whenever a call is placed, and the call is leaving from the trunk “toOtherPBX”, I want to prepend my site’s prefix, which is “333” to the outgoing CallerID.
So, for example, if a call is placed from extension 120, I want to set the CallerID to 333120.
I don’t want to use the “Outbound CID” field, because I use it to set the CallerID for the Public Outside Phone Network, which is reachable with another trunk named “toOutsideWorld”.
So, what I am asking is how can I prepend to the CallerID, my site’s prefix (which is “333”) to all my extensions, when a call is being placed through a specific trunk.
[from-old-pbx]
exten => _333XXX,1,Log(NOTICE, Incoming call from OldPBX:${EXTEN})
same => n,Set(CALLERID(all)=333${EXTEN:3:3})
same => n,Goto(from-internal,${EXTEN:3:3},1)
Thanks @danielf for your fast reply. I appreciate your help.
Although, the line you provided: same => n,Set(CALLERID(all)=333${EXTEN:3:3})
changes the CallerId for the incoming calls (from the specific trunk), and what it actually do, is set as CallerID the Called Number.
For example:
If an external extension (ex: 444220) calls my extension (ex: 333120), it sets as CallerID the called extension (ex: 333120)
What I am trying to do is, to set the CallerID for the outgoing calls.
So for example, if my extension (ex: 120) calls an external extension (ex: 444220), I want to set the CallerID to 333120.
Is there any way I can do that for all my extensions at once?
Can you send me a verbose log of an external call to the other pbx (444XXX) ? I will write you a special context to change the outbound called id for your other pbx trunk.