Automatically create Destination/Inbound Route for DIDs

Status
Not open for further replies.

trey168

New Member
Apr 14, 2020
8
0
1
36
Hello all,

Last year I moved our company PBX from FreePBX to FusionPBX. While much tougher to get going at the start, Fusion is ROCK solid - we love it. We are an ISP and still use FreePBX for our customer's VoIP. I'd like to migrate this to FusionPBX and simplify much of the configuration/setup.

For our basic VoIP customers, they just have one or two DIDs and their router has a built in ATA - so these are nothing but a DID as an extension along with an inbound route. Has anyone done anything to automate the creation of a Destination/Inbound Route when an extension is created? Its not much extra work doing them manually but I'd like to simplify everything as much as possible before I start migrating customers over. Mainly to allow less experienced staff to provision VoIP service... I understand the concept of routing calls but something as simple as that can be overwhelming to a non-VoIP person.

I'm decent at programming and we also have a Python programmer on staff - was just looking for a starting point if anyone has done something like this.

Thanks!
 

atmosphere617

Member
May 19, 2018
31
4
8
The DB schema is pretty simple, most fields are just text fields. I once wrote a similar feature that created the inbound_route when a customers port order entered FOC status in a separate number porting app.

If you have a web app you can just setup a DB connection to the fusion database and map your ORM to the neccassry tables from the fusion database. Then you should be able to manipulate fusion data from your web app.

You'll just want to make sure you to create a row in both the
v_destinations and v_dialplans table for each inbound route. You can just setup a route from the fusion GUI the way you normally would, then emulate that data from your web app. Then you can fire off the creation of routes whenever your conditions are met.

I've also done this with some bash scripts in the past for a more manual method, when moving from other PBXs and parsing CSVs of 100s of numbers. In those cases I just manually write the SQL and use the psql client.

You'll also want to make sure to flush the public context cache whenever you modify/create an inbound route. I think by default it's in "/var/cache/fusionpbx/dialplan.public". For a simple deployment I would just do this over the freeswitch event socket by running "api system rm var/cache/fusionpbx/dialplan.public". If you are using memcachd, I'm sure there are tons of libraries for connecting to that in whatever language you use.
 
Last edited:

trey168

New Member
Apr 14, 2020
8
0
1
36
Awesome! That is a big help, thanks so much. I'll just make a simple web app to handle new numbers, looking up SIP credentials, and disconnections for my CSRs... I can login to Fusion for troubleshooting & more advanced things.
 
Status
Not open for further replies.