Queue Failover Destination Automation (Solved)

Hello all, I am in need of some pointing in the right direction. I have been given a task to allow one of our queues fail over destination to be changed through automation(back-end, server side manipulation not through the GUI). I was wondering if someone could point me in the right direction on how I can make a change to our queues configurable fields through some type of script or file that is read/write.

I have provided an example of what I am talking about below.

In step 1 on the link above I want to be able to change the fail over-destination options
I am also looking on step 3 to change the Timing and Agent Options- Max Wait Time.
I want to be able to change these through a script or CLI. I have not had any luck finding these variables in configuration files to edit. Can anyone please point me in the right direction to automate this fail over destination.


Solution:
I want to thank everyone for their help. I was able to come up with a solution. With our workflow software I was able to have it execute a powershell code using plink over SSH-CLI to change the extensions_custom.conf and have it force copy over preset configs and then force a fwconsole reload. I have it tied to an extension through our inbound route config. Inbound route number gets called, it then passes to an automated extension handler where my custom dial plan is, from there it passes it to the queue. Authorized users can now change queue wait times and re-route to other destinations based on variables in our workflow software. It’s a nice touch for our IT team as we’d always be asked to make changes. Now they can do it.


You can point the queue failover destination to a custom destination and then write a custom dialplan which will handle your custom routing.

2 Likes

If you understand the contents of the database.table.field asterisk.queues_config.dest you can directly update that field and reload FreePBX programmatically.

If that route is chosen, I’d go with something that using FreePBX Internals (search the forums) and see if there’s some PHP code that can help you with that. @jfinstrom is pretty good about suggesting code to do this, so look for posts where he’s responded.

2nd this approach, messing with the DB directly can have unintended consequences if you do not understand 100% of the connections.

https://wiki.freepbx.org/display/FPG/Custom+Destinations+User+Guide

Thank you for the input, I like this idea. But I am having trouble understanding how I can use this to automate. I have an external software that I want to send a web request or something along those lines to the pbx server to initiate the fail over change to happen without me having to do anything on the PBX. User submits form, form sends webrequest to PBX, PBX automatically fails over to custom destination and vice versa to turn it back again.

How can I access this, where is it located?

In the custom dialplan connect to the external Server and get the data.

You can do it multiple way, one way is using AGI.

I’ve never written anything in AGI. I do not see where to connect to get the data or even where the data to change is at. I have found an AGI-BIN container that contained some AGI scripts but nothing that seemed to be helpful. Do I need a module attached to see custom dial plans? What are you referring to as the external server?

Custom dialplan usually goes in extensions_custom.conf

AGI scripts are usually in the AGI container you mentioned. Read more on AGI: https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=32375589

Once you have your custom dialplan, you can setup a record in the custom destination module and then point your queue failover to that record.

Please explain ‘container’

Assuming OP meant /var/lib/asterisk/agi-bin

How do you reload it programmatically?

Yes that is what I meant.

Add the appropriate fwconsole command to your script to reload (refresh the running system according to what is in the DB).

https://wiki.freepbx.org/pages/viewpage.action?pageId=37912685

I want to thank everyone for their help. I was able to come up with a solution. With our workflow software I was able to have it execute a powershell code using plink over SSH-CLI to change the extensions_custom.conf and have it force copy over preset configs and then force a fwconsole reload. I have it tied to an extension through our inbound route config. Inbound route number gets called, it then passes to an automated extension handler where my custom dial plan is, from there it passes it to the queue. Authorized users can now change queue wait times and re-route to other destinations based on variables in our workflow software. It’s a nice touch for our IT team as we’d always be asked to make changes. Now they can do it.

1 Like

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