ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Duplicating IVR entries in FreePBX 13

    IT Discussion
    freepbx freepbx 13 freepbx setup ivr hacking
    3
    15
    3.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • bigbearB
      bigbear @JaredBusch
      last edited by

      @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.

      JaredBuschJ 1 Reply Last reply Reply Quote 0
      • JaredBuschJ
        JaredBusch @bigbear
        last edited by

        @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.

        bigbearB 1 Reply Last reply Reply Quote 0
        • bigbearB
          bigbear @JaredBusch
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • JaredBuschJ
            JaredBusch
            last edited by JaredBusch

            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');

            1 Reply Last reply Reply Quote 2
            • T
              table
              last edited by

              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.

              JaredBuschJ 1 Reply Last reply Reply Quote 1
              • JaredBuschJ
                JaredBusch @table
                last edited by

                @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.

                T 1 Reply Last reply Reply Quote 1
                • T
                  table @JaredBusch
                  last edited by table

                  @jaredbusch

                  <?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.

                  JaredBuschJ 1 Reply Last reply Reply Quote 0
                  • JaredBuschJ
                    JaredBusch @table
                    last edited by

                    @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.

                    1 Reply Last reply Reply Quote 0
                    • JaredBuschJ
                      JaredBusch
                      last edited by JaredBusch

                      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.

                      T 1 Reply Last reply Reply Quote 0
                      • T
                        table @JaredBusch
                        last edited by table

                        @jaredbusch

                        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.

                        JaredBuschJ 1 Reply Last reply Reply Quote 0
                        • JaredBuschJ
                          JaredBusch @table
                          last edited by

                          @table said in Duplicating IVR entries in FreePBX 13:

                          @jaredbusch

                          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 the id and name from ivr_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.

                          1 Reply Last reply Reply Quote 0
                          • 1 / 1
                          • First post
                            Last post