Duplicating IVR entries in FreePBX 13
-
@JaredBusch and we are actually a voip provider. We have are own interconnects in local markets. About 10 years running now.
This was originally a service we only provided WISP and Fiber customers. A lot of market competition has kicked up over the last 2 years so we are splitting our business up. Some guys are staying with VSAT/WISP company and the rest are going with expanding VoIP services.
-
@bigbear said in Duplicating IVR entries in FreePBX 13:
@JaredBusch and we are actually a voip provider. We have are own interconnects in local markets. About 10 years running now.
This was originally a service we only provided WISP and Fiber customers. A lot of market competition has kicked up over the last 2 years so we are splitting our business up. Some guys are staying with VSAT/WISP company and the rest are going with expanding VoIP services.
Okay, I was wondering WTF you were doing. As a provider I get that. This will be an entire side conversation, but that answer is yes.
Remember FreePBX is not a PBX itself, it is simply a management layer on top of Asterisk. Everything you do in FreePBX writes to the database and then when you click the apply button, it rewrites the asterisk files and restarts asterisk.
Probably some random exception to the rule, but this is how FreePBX is designed. It never writes directly to the Asterisk configs.
As a provider, why would you be using FreePBX anyway? If I was going to be providing SIP service with Asterisk, I would be doing it straight from Asterisk, or my own tools wrote to configure Asterisk.
-
@JaredBusch we aren't. It's a long story. We have about 8 years invested in FreeSwitch, OpenSips and Kamailio. A lot of custom development.
A couple years ago I had looked to leave our setup and we deployed Broadsoft. The grass wasnt greener on the other side so we doubled down on our platform.
Will back channel you sometime about the FreePBX use. Its caught my attention because they seem to be pulling way ahead of all the other legacy vendors who are dropping out of the market.
We are more focused right now on SMS/MMS integration and cellular.
-
For the curious, here is an example of inserting a pair of new IVR's.
insert into ivr_details (name,description,alertinfo,announcement,directdial,invalid_loops,invalid_retry_recording,invalid_destination,timeout_enabled,invalid_recording,retvm,timeout_time,timeout_recording,timeout_retry_recording,timeout_destination,timeout_loops,timeout_append_announce,invalid_append_announce,timeout_ivr_ret,invalid_ivr_ret,rvolume) values ('Jeff City','General IVR for Jeff City','',1,'ext-local','3','default','app-blackhole,hangup,1',NULL,'default','',10,'default','default','app-blackhole,hangup,1','3',0,0,0,0,'0'),('Jeff City - Night','IVR for Jeff City after hours','',2,'ext-local','3','default','app-blackhole,hangup,1',NULL,'default','',10,'default','default','app-blackhole,hangup,1','3',0,0,0,0,'0');
insert into ivr_details (name,description,alertinfo,announcement,directdial,invalid_loops,invalid_retry_recording,invalid_destination,timeout_enabled,invalid_recording,retvm,timeout_time,timeout_recording,timeout_retry_recording,timeout_destination,timeout_loops,timeout_append_announce,invalid_append_announce,timeout_ivr_ret,invalid_ivr_ret,rvolume) values ('Jeff City','General IVR for Jeff City','',1,'ext-local','3','default','app-blackhole,hangup,1',NULL,'default','',10,'default','default','app-blackhole,hangup,1','3',0,0,0,0,'0'),('Jeff City - Night','IVR for Jeff City after hours','',2,'ext-local','3','default','app-blackhole,hangup,1',NULL,'default','',10,'default','default','app-blackhole,hangup,1','3',0,0,0,0,'0');
-
I'm currently trying to edit the dest in ivr_entries based off a couple variables from another table with php. Am I going about this the wrong way? Is there a simpler way to do this? I know post is old but thanks for taking time to read.
-
@table said in Duplicating IVR entries in FreePBX 13:
I'm currently trying to edit the dest in ivr_entries based off a couple variables from another table with php. Am I going about this the wrong way? Is there a simpler way to do this? I know post is old but thanks for taking time to read.
You are looking in the right place.
Can you post a little more detail? These examples are extremely high level just to show people where to look really.
-
<?php
$servername = "";
$username = "";
$password = "";
$dbname = "asterisk";// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}$sql = "INSERT INTO ivr_entries (ivr_id, selection, dest)
VALUES ('25', '43156', 'from-did-direct,820,1');";if ($conn->multi_query($sql) === TRUE) {
echo "New records created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}$conn->close();
?>The script was just a proof of concept to see if I could make the changes without breaking freepbx. I'm now trying to include logic to process data from another table and adjuct the dest fields in the other table accordingly.
I'm trying to make a php script that updates the table ivr_id dest (different queues) base on information from another table called ivr3
mysql> describe ivr3;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| useridefin | mediumint(6) | NO | | NULL | |
| officetype | varchar(14) | NO | | NULL | |
| producttype | varchar(7) | NO | | NULL | |
| language | varchar(3) | NO | | eng | |
| new | varchar(3) | NO | | NULL | |
| pk_column | int(11) | NO | PRI | NULL | auto_increment |I added the pk_column for auto_increment. Should I add this into the ivr_entries also? I'd like to use these four fields for routing the call via ivr to certain dest based on rules. I'm not sure the logic of the rules though. Would I use weight and add a total or something. I've started code academy because my google fu has failed me as of yet.
Thanks for quick reply and taking the time to read that.
-
@table said in Duplicating IVR entries in FreePBX 13:
Should I add this into the ivr_entries also?
Never. You will totally break updates if one of them looks at the table.
-
Ok, this is definitely complicated.
You will want to make your own tables and use something to reference back.
The part that makes this hard is that if anyone makes a change to an IVR outside of your tool, the references could get changed.
FreePBX does not have any type of unique keys since it is designed with being the master in mind.
-
Is there a better way to do this with whats included in freepbx or commercial modules? I was thinking just putting the script in cron and just have it run every so many hours. Then eventually making a form to add or modify the data.
-
@table said in Duplicating IVR entries in FreePBX 13:
Is there a better way to do this with whats included in freepbx or commercial modules? I was thinking just putting the script in cron and just have it run every so many hours. Then eventually making a form to add or modify the data.
What I would do is update your
ivr3
to include theid
andname
fromivr_details
and think of those as the unique key. Or add them to a separate cross reference table, however you want to handle it.Then add logic to your system to fail and notify if there is a mismatch (aka someone changed it in FreePBX).
There is no way to do this in FreePBX itself.
Once you change the database, you will have to reload everything.
You can issue the
fwconsole reload
command from your script. That is the same as clicking the red "Apply Config" button.