Is there any way to bulk modify/create misc destinations and applications?

modules
freepbx
Tags: #<Tag:0x00007f702c66ded0> #<Tag:0x00007f702c66db88>

(Lonely Admin) #1

I have quite a few of these to create, are there any cli commands or API/DB fu to help with this? Momma always said if you have to do it more than three times, write a script.

I see some of the definitions in /etc/asterisk/extensions_additional.conf, but there’s a big mean warning about voiding the warranty if I change that file.


(Lorne Gaetz) #2

If you know php you can use the FreePBX bootstrap env to script them like is done here for DND: https://gist.github.com/lgaetz/b350b9fa9ac18730150b387a1525aa4e

The pragmatist in me wonders what you’re trying to do, I’ve never run into this request before.


(Lonely Admin) #3

TL;DR;
Trying to send old extensions native to old PBX to avoid user confusion. Old extensions have to mapped to DID to be sent to gateway/analog PBX.

I’ve got an old PBX sitting behind a Vega gateway. I’m in that ugly area transitioning to the IP PBX. I’ve trying to make it to where users on the IP PBX can dial the 3 digit extensions they know and love to get back to the old PBX.

For example, phone number 111-123-4567 comes in to teleco, that gets sent to vega gateway as 567. Dial plan on gateway sends any unknown 3 digit extensions to old PBX. On gateway I have dial plan for any non emergency 3 digit extension from SIP interface to be sent to old PBX interface. On old PBX extension that maps to 567 is 853…they don’t match up…I didn’t set that up :slight_smile: .

On freepbx I setup a misc application with feature code of 853 to be sent to misc destination with a definition that dials 567. I have an outbound route defined for non-emergency 3 digit extensions to be sent to the Vega. I setup two of them so far.

It works…but ick. I’m new here, so feel free to yell at me and tell me I’m doing it wrong, this is just what I have found to work. I’m really trying to not make any changes on old Toshiba Strata. I don’t know that system and the sooner I decommission it and toss it into the dumpster fire the better.


#4

Offhand I think you could put these in /etc/asterisk/extensions_custom.conf which (as is a custom file) will not be overwritten by FPBX. For each extension (i.e. 853) make the dialplan lines to dial the number on the old toshiba pbx (i.e. 567).


(Lonely Admin) #5

Are there any docs for the file syntax? Or is this a “use the source, Luke” type of things?

Currently I guess I’d add:

[app-miscapps]
exten => 853,1,Set(__COS_DEST=miscapp_1)
exten => 853,n,Set(__COS_TYPE=FC)
exten => 853,n,Macro(user-callerid,)
exten => 853,n,Noop(Running miscapp 1: DID853_x567)
exten => 853,n,Macro(user-callerid,)
exten => 853,n,Goto(ext-miscdests,1,1)
;--== end of [app-miscapps] ==--;

[ext-miscdests]
include => ext-miscdests-custom
exten => 1,1,Noop(MiscDest: LegacyPBX DID853_x567)
exten => 1,n,Goto(from-internal,567,1)
;--== end of [ext-miscdests] ==--;

(Lorne Gaetz) #6

This is prob a good application for custom dialplan. If you want to redirect the dial strings 853 to 567, the dialplan in extensions_custom.conf to do that looks like:

[from-internal-custom]
exten => 853,1,Goto(from-internal,567,1)

you can just add additional lines as required updating the digits as appropriate. There are two potential problems with this approach of which you’ll want to be aware:

  1. future admins will not know you’ve done the custom dialplan and will run into issues when they create extension 853 and get unpredictable results
  2. if you are not disciplined with your dialplan you could get an infinite loop

The Config edit module makes this pretty simple.


(Lonely Admin) #7

Cool, that seems to function well. Just added quite a few, easily imported from csv. Thanks!

Trying to keep it simple, old PBX 3 digit, new one 4 digit, hopefully it’ll make sense to someone.

Are there any modules in the GUI that edit extensions_custom.conf? Besides config edit? Wasn’t sure if there were any other options to define.

I was wondering if I can set any CID info on these calls to the old PBX, right now they just show the 4 digit extension of the IP PBX.


(Lorne Gaetz) #8

This is done with RPID, remote party ID. If your remote PBX supports it, and the trunk is configured to accept RPID and the dialing extension is configured on the pbx with rpid enabled and the dialing device supports and is configured to display rpid, then the caller ID name of the remote party is displayed when they answer.