We have set up a few Outbound Routes, some of which are used for failover scenarios. Whenever needed, we change the relative position of the route entries through the web interface. Is there a way to accomplish this adjustment by using AMI, or any other API-based technique?
AMI wouldn’t be an appropriate way of doing this as, routes, and their orders are FreePBX constructs, so will be regenerated into the dialplan when FreePBX restarts. I don’t know if there is a FreePBX API for this.
Yes, but you would be manipulating implementation details which are likely to get re-instated without warning. You would need to modify information that is covered by the Do not edit this file warning, albeit you are only manipulating the memory copy.
It is also possible that this is actually done by AstDB entries. My key point is that there is no such thing as route, let alone an order for routes, in Asterisk, so you are playing with code generated by FreePBX.
But he also asked about using AMI and editing the dialplan directly. These are only easy to do when you are manipulating constructs that are native to Asterisk. I was pointing out that the constructs weren’t native to Asterisk, so you have to take into account how FreePBX implements them.
I think people sometimes think that the GUI is just a thin veneer and all the abstractions actually exist in Asterisk.
Thank you all very much. I also thought that FreePBX was just a GUI for Asterisk. Unfortunately, I have to alter the configuration through a sort of API call and not through the console. I found an unorthodox solution. I cloned the HTTP POST requests that FreePBX is making to achieve the changes I am interested in. I also cloned the login POST requests since it is a prerequisite. I tested it on Postman and it works like a charm.