Monday, October 7, 2019

Asterisk - limit extension total usage duration

Here's how you an limit the extension duration based on values in a PINSET in the GUI.
This will use a PINSET with the description of "extenmaxduration" (system is hardcoded to this description for this example)
LIMITATION.
This code works with FOUR DIGIT extensions ONLY
Create a PINSET with the description "extensionduration"
In the pins put in pins using the SYNTAX:
Extension*Minutes
Example:
1005*00500
1006*01500
1103*99999
EXPLAINED:
PINSET values are stored in the database using "carriage return" delimitation within the actual column, so we need to parse the data returned by the SQL statement. This means the data MUST be a consistent length for my select statement..
This is why we have leading zero's ( 00 ) in the duration to maintain the length for the SQL script i have. I'm sure there are far smarter people than me who can work this out, but this is what I was able to make work.
In my example,
extension 1005 is allowed 500 minutes "1005*00500"
extension 1006 is allowed 1500 minutes "1006*01500"
extension 1103 is allowed 99999 minutes "1103*99999"
Extensions that are NOT in the list, the code will simply bypass them and allow those calls to continue.
So here is the entire code. Again the "outrt-X" heading will need to be altered to suit your environment.
[outrt-2] ; limit by extensions
include => outrt-2-custom
exten => _.,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _.,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _.,n,Set(_NODEST=)
exten => _.,n,Gosub(sub-record-check,s,1(out,${EXTEN},))

;open connection to ASTERISK table to get the pinset data
exten => _.,n,MYSQL(Connect connid localhost root PBXPASS asterisk)
exten => _.,n,MYSQL(Query resultid ${connid} select MID((select passwords from pinsets where description = 'extensionduration'), INSTR ((select passwords from pinsets), "${ampuser}"),10) from pinsets)
exten => _.,n,MYSQL(Fetch fetchid ${resultid} extenmaxduration)
exten => _.,n,MYSQL(Clear ${resultid})
exten => _.,n,MYSQL(Disconnect ${connid})

;If we dont find a matching extension, we'll skip the rest of the checks and just let it dial out.
exten => _.,n,GotoIf($["${extenmaxduration}" = ""]?continue)

;parse the return using an * as the delimiter between extension and minute values
exten => _.,n,Set(extenmaxduration=${CUT(extenmaxduration,*,2)})

;change mins to seconds
exten => _.,n,Set(extenmaxduration=${MATH(${extenmaxduration}*60,int)})

;open a new connection CDR table
exten => _.,n,MYSQL(Connect connid localhost root PBXPASS asteriskcdrdb)
exten => _.,n,MYSQL(Query resultid ${connid} SELECT if(sum(duration) < ${extenmaxduration}, 1, 0) FROM cdr WHERE (calldate between DATE_FORMAT(NOW() ,'%Y-%m-01') AND NOW() ) and src like '${AMPUSER}')
exten => _.,n,MYSQL(Fetch fetchid ${resultid} extenmaxduration)
exten => _.,n,MYSQL(Clear ${resultid})
exten => _.,n,MYSQL(Disconnect ${connid})

;if we dont find any value in pinset, we'll default allow this call to go through.
exten => _.,n(continue),execif($["${extenmaxduration}" = ""]?set(extenmaxduration=1))

;if montly duration is less than pinset duration, go out trunk, else say "time" and hangup
exten => _.,n,execif($["${extenmaxduration}" = "1"]?macro(dialout-trunk,1,${EXTEN},,off))
exten => _.,n,execif($["${extenmaxduration}" = "0"]?playback(time))
exten => _.,n,Macro(outisbusy,)
Save your changes and reload your configs.
Give it a try!

Remember that your values for your extensions need a leading zereo, and those values are stored in MINUTES. The script will do the calculation to change it to SECONDS which the CDR table uses.
In this example, if the extension has not exceed its maximum, the call will proceed out the trunk.
If it has exceeded the max, you will hear the voice "TIME" and then a "all circuits busy"

Thursday, October 3, 2019

Asterisk Balancing outbound calls across multiple random trunks

This code will send calls out trunks via a random generator

HOW IT WORKS
It adds a random generator and then will send calls across multiple trunks
(GUI) PBX -> Outbound Routes
Open the route you want to apply this random trunk
1: Under "Trunk Sequence" you want the first route to be the one if the time limit is NOT exceeded
2: The next route is the one ff the time IS exceeded. (you can have as many more as you want)
Make sure those changes are saved
Now open up /etc/asterisk/extensions_additional.conf
Find your route in the dialplan. it will look SOMETHING like the one below. Yours maybe different heading and number of trunks, so just use mine as an example only, modify your file.
This is mine, and i have TWO Destinations

[outrt-2] ; randomtrunk
include => outrt-2-custom
exten => _.,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _.,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _.,n,Set(_NODEST=)
exten => _.,n,Gosub(sub-record-check,s,1(out,${EXTEN},))
exten => _.,n,Macro(dialout-trunk,1,${EXTEN},,off)
exten => _.,n,Macro(dialout-trunk,2,${EXTEN},,off)
exten => _.,n,Macro(outisbusy,)
;--== end of [outrt-2] ==--;

Copy and paste the entire section
open up /etc/asterisk/extensions_override_issabelpbx.conf  (if you are using a different deployment "extensions_custom.conf" should work as well
Go to the bottom of the file, and PASTE it

Now under the line with "GOSUB" put this value in

exten => _.,n,Set(randomtrunk=${RAND(1,2)});

The 1 and 2 signify the low and high number.  So if you have 2 trunks, it would be 1 & 2.  If you had 4, it would be 1 & 4.

These are the trunks are called. 
In my example two trunks are called, and if they do not work, "outisbusy" is run which is "all circuits are busy" message. You'll notice in my example it has "..trunk, 1, $ ..." and followed by "... trunk, 2, $ ...".
exten => _.,n,Macro(dialout-trunk,1,${EXTEN},,off)
exten => _.,n,Macro(dialout-trunk,2,${EXTEN},,off)
exten => _.,n,Macro(outisbusy,)
;--== end of [outrt-2] ==--;

It IS possible that, although mine are in numeric order, yours may not be. So just make note of that when you see the modification example
Change the first line to look like this instead. Just note if your 1 or 2 values ​​are in a different order and adjust accordingly.

execif($["${randomtrunk}" = "X"]?......

exten => _.,n,execif($["${randomtrunk}" = "1"]?macro(dialout-trunk,1,${EXTEN},,off))
exten => _.,n,execif($["${randomtrunk}" = "2"]?macro(dialout-trunk,2,${EXTEN},,off))


Just change the "X" value to be the match to one of your randomly generated values.

Heres what it will look like when you are done.

[outrt-2] ; randomtrunk
include => outrt-2-custom
exten => _.,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _.,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _.,n,Set(_NODEST=)
exten => _.,n,Gosub(sub-record-check,s,1(out,${EXTEN},))

exten => _.,n,Set(randomtrunk=${RAND(1,2)});
exten => _.,n,execif($["${randomtrunk}" = "1"]?macro(dialout-trunk,1,${EXTEN},,off))
exten => _.,n,execif($["${randomtrunk}" = "2"]?macro(dialout-trunk,2,${EXTEN},,off))

exten => _.,n,Macro(outisbusy,)
;--== end of [outrt-2] ==--;

From the command line type
asterisk -rx 'core reload'
Test and try!
Please note that once this code is in place, you can't change the trunk order in the GUI for this outbound route. This code will over-ride the GUI for that. So if you DO need to make changes, you can make the change the GUI, but you will need to re-perform these custom modifications for it to work.
Anyone who is trying this, and you should only do this in a test server if you aren't familiar, but if you DO have problems and its messing up your PBX, in the "extensions_override_issabelpbx.conf" file. You can just erase these changes and save / reload the file and your pBX will revert to its original config for this rule.

Asterisk - limit total time usage of a trunk

Here's how you can limit the amount of time used on a particular trunk by looking up the time in SQL.
I tested this in the ISSABEL deployment of asterisk, but should work in any.

Once the time is exceeded on a trunk, the dialplan will skip to subsequent trunks.
(scroll to the bottom for advanced users for the completed code, the next bit I'm showing how to make the code change for users unfamiliar with dialplan changes)

HOW IT WORKS
The way this works is upon making a call that would use a particular trunk, the system does an SQL query on total outbound seconds used for the last 30 days.  It selects it by looking at the trunk name and adding up the values.
Then depending if you've reached your maximum or not, it will send the call to trunks accordingly.
(GUI) PBX -> Outbound Routes
Open the route you want to apply this "time limit" rule and verify at least these TWO conditions
1: Under "Trunk Sequence" you want the first route to be the one if the time limit is NOT exceeded
2: The next route is the one ff the time IS exceeded. (you can have as many more as you want)
Make sure those changes are saved
Now open up /etc/asterisk/extensions_additional.conf
Find your route in the dialplan. it will look SOMETHING like the one below. Yours maybe different heading and number of trunks, so just use mine as an example only, modify your file.
This is mine, and i have TWO Destinations
[outrt-2] ; 1000minlimitroute
include => outrt-2-custom
exten => _.,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _.,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _.,n,Set(_NODEST=)
exten => _.,n,Gosub(sub-record-check,s,1(out,${EXTEN},))
exten => _.,n,Macro(dialout-trunk,1,${EXTEN},,off)
exten => _.,n,Macro(dialout-trunk,2,${EXTEN},,off)
exten => _.,n,Macro(outisbusy,)
;--== end of [outrt-2] ==--;
Copy and paste the entire section
open up /etc/asterisk/extensions_override_issabelpbx.conf  (if you are using a different deployment "extensions_custom.conf" should work as well
Go to the bottom of the file, and PASTE it
Now we'll modify this file.
First we'll add the database lookup, insert this code. Change USERNAME and PASSWORD to be your database:
Change TRUNKNAME to be the trunk name you want to check against.
Change "30" to be the number of days you want to look back on
Change 60000 to be the number of seconds you want to limit to
exten => _.,n,MYSQL(Connect connid localhost USERNAME PASSWORD asteriskcdrdb)
exten => _.,n,MYSQL(Query resultid ${connid} SELECT if(sum(duration) < 60000, 1, 0) FROM cdr WHERE DATE(calldate) >= DATE(NOW()) - INTERVAL 30 DAY and dstchannel like '%TRUNKNAME%')
exten => _.,n,MYSQL(Fetch fetchid ${resultid} dynroute)
exten => _.,n,MYSQL(Clear ${resultid})
exten => _.,n,MYSQL(Disconnect ${connid})
Put it under the GOSUB statement in the base dialplan code:
It will look like this:
[outrt-2] ; 1000minlimitroute
include => outrt-2-custom
exten => _.,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _.,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _.,n,Set(_NODEST=)
exten => _.,n,Gosub(sub-record-check,s,1(out,${EXTEN},))

exten => _.,n,MYSQL(Connect connid localhost user password asteriskcdrdb)
exten => _.,n,MYSQL(Query resultid ${connid} SELECT if(sum(duration) < 60000, 1, 0) FROM cdr WHERE DATE(calldate) >= DATE(NOW()) - INTERVAL 30 DAY and dstchannel like '%trunkname%')
exten => _.,n,MYSQL(Fetch fetchid ${resultid} dynroute)
exten => _.,n,MYSQL(Clear ${resultid})
exten => _.,n,MYSQL(Disconnect ${connid})
Now, we'll modify the trunk to be dialed. Your code will look like something like this.
These are the trunks are called. In my example two trunks are called, and if they do not work, "outisbusy" is run which is "all circuits are busy" message. You'll notice in my example it has "..trunk, 1, $ ..." and followed by "... trunk, 2, $ ...".
exten => _.,n,Macro(dialout-trunk,1,${EXTEN},,off)
exten => _.,n,Macro(dialout-trunk,2,${EXTEN},,off)
exten => _.,n,Macro(outisbusy,)
;--== end of [outrt-2] ==--;
It IS possible that, although mine are in numeric order, yours may not be. So just make note of that when you see the modification example
Change the first line to look like this instead. Just note if your 1 or 2 values ​​are in a different order and adjust accordingly.
exten => _.,n,execif($["${dynroute}" = "0"]?macro(dialout-trunk,1,${EXTEN},,off))
This will tell the dialplan that IF the total time in SQL is NOT 1000 minutes (60000 seconds) then use the first trunk.
IF the dialplan is told by SQL IS more than 1000 minutes, the dialplan will execute the remaining trunk (s) in the order you have them.
Now your code will look something like this when completed:
username / password are you MYsql credentials
TRUNKNAME = trunk name in GUI (can be partial).
Change "30" to be the number of days you want to look back on
Change 60000 to be the number of seconds you want to limit to
[outrt-2] ; 1000minlimitroute
include => outrt-2-custom
exten => _.,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _.,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _.,n,Set(_NODEST=)
exten => _.,n,Gosub(sub-record-check,s,1(out,${EXTEN},))

exten => _.,n,MYSQL(Connect connid localhost username password asteriskcdrdb)
exten => _.,n,MYSQL(Query resultid ${connid} SELECT if(sum(duration) < 60000, 1, 0) FROM cdr WHERE DATE(calldate) >= DATE(NOW()) - INTERVAL 30 DAY and dstchannel like '%trunkname%')
exten => _.,n,MYSQL(Fetch fetchid ${resultid} dynroute)
exten => _.,n,MYSQL(Clear ${resultid})
exten => _.,n,MYSQL(Disconnect ${connid})

exten => _.,n,execif($["${dynroute}" = "0"]?macro(dialout-trunk,1,${EXTEN},,off))

exten => _.,n,Macro(dialout-trunk,2,${EXTEN},,off)   
exten => _.,n,Macro(outisbusy,)
;--== end of [outrt-2] ==--;
From the command line type
asterisk -rx 'core reload'
Test and try!
Please note that once this code is in place, you can't change the trunk order in the GUI for this outbound route. This code will over-ride the GUI for that. So if you DO need to make changes, you can make the change the GUI, but you will need to re-perform these custom modifications for it to work.
Anyone who is trying this, and you should only do this in a test server if you aren't familiar, but if you DO have problems and its messing up your PBX, in the "extensions_override_issabelpbx.conf" file. You can just erase these changes and save / reload the file and your pBX will revert to its original config for this rule.

Thursday, September 5, 2019

Modify Asterisk Queue members via SQL

It is possible to add static agents to a queue via a SQL statement.
Here you see the static members of a queue 
https://imgur.com/a/vzEgDLv
In the table "queues_details" in the database "asterisk" this select will show you all your configured queues.
MariaDB [asterisk]> select * from queues_details;
+------+-----------------------------+---------------------------+-------+
| id   | keyword                     | data                      | flags |
+------+-----------------------------+---------------------------+-------+
| 2001 | member                      | Local/1005@from-queue/n,0 |     3 |
| 2001 | member                      | Local/1006@from-queue/n,0 |     4 |
| 2001 | member                      | Local/1004@from-queue/n,0 |     2 |
| 2001 | member                      | Local/1002@from-queue/n,0 |     1 |
| 2001 | member                      | Local/1001@from-queue/n,0 |     0 |
| 2001 | answered_elsewhere          | 0                         |     0 |
| 2001 | penaltymemberslimit         | 0                         |     0 |
| 2001 | timeoutpriority             | app                       |     0 |
My example shows Queue (ID) 2001 with static members 1001-1006 (1003 is missing)
You can add a member (which will show up in the GUI if you edit it too) using this command. I'm adding extension "1003" into queue 2001.
MariaDB [asterisk]> insert into `queues_details` (`id`,`keyword`,`data`,`flags`) values (2001,'member','Local/1003@from-queue/n,0',100);
Query OK, 1 row affected (0.00 sec)

MariaDB [asterisk]> select * from queues_details;
+------+-----------------------------+---------------------------+-------+
| id   | keyword                     | data                      | flags |
+------+-----------------------------+---------------------------+-------+
| 2001 | member                      | Local/1005@from-queue/n,0 |     3 |
| 2001 | member                      | Local/1006@from-queue/n,0 |     4 |
| 2001 | member                      | Local/1004@from-queue/n,0 |     2 |
| 2001 | member                      | Local/1002@from-queue/n,0 |     1 |
| 2001 | member                      | Local/1001@from-queue/n,0 |     0 |
| 2001 | answered_elsewhere          | 0                         |     0 |
| 2001 | maxlen                      | 0                         |     0 |
| 2001 | member                      | Local/1003@from-queue/n,0 |   100 |
+------+-----------------------------+---------------------------+-------+
42 rows in set (0.00 sec)
What you have to do is set the "FLAG" value to a high value (higher than any current) when you enter it, and you have increment it. My example uses 100.
If you look in the GUI, you'll see it shows up there as well now.

Wednesday, September 4, 2019

Modify FreePBX IVR via commandline

Sometimes you need to modify your IVR by another application.  Maybe you need to remove or add features on the fly, pin numbers, change destinations.  Sometimes its just not convenient to do via the GUI, and you want to do it through a command line or some other method.  Heres two ways.


1 -> Dialplan
2 -> MySQL Database

EXAMPLE 1:

DIALPLAN
Create the ivr in PBX GUI

Open "extensions_additional.conf"
and find your IVR. It will start with a name like
[ivr-X]

Example IVR i created. When you open your file you see very similar code. Copy the entire code in your .conf file and paste it into the bottom of /etc/asterisk/extensions_custom.conf

[ivr-4] ; testivr
include => ivr-4-custom
exten => s,1,Set(TIMEOUT_LOOPCOUNT=0)
exten => s,n,Set(INVALID_LOOPCOUNT=0)
exten => s,n,Set(_IVR_CONTEXT_${CONTEXT}=${IVR_CONTEXT})
exten => s,n,Set(_IVR_CONTEXT=${CONTEXT})
exten => s,n,Set(__IVR_RETVM=)
exten => s,n,GotoIf($["${CDR(disposition)}" = "ANSWERED"]?skip)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n(skip),Set(IVR_MSG=)
exten => s,n(start),Set(TIMEOUT(digit)=3)
exten => s,n,ExecIf($["${IVR_MSG}" != ""]?Background(${IVR_MSG}))
exten => s,n,WaitExten(10,)

exten => 3,1,Set(__IVR_DIGIT_PRESSED=3)
exten => 3,n(ivrsel-3),Goto(app-blackhole,hangup,1)

exten => 2,1,Set(__IVR_DIGIT_PRESSED=2)
exten => 2,n(ivrsel-2),Goto(app-blackhole,hangup,1)

exten => 1,1,Set(__IVR_DIGIT_PRESSED=1)
exten => 1,n(ivrsel-1),Goto(app-blackhole,hangup,1)

exten => h,1,Hangup

exten => hang,1,Playback(vm-goodbye)
exten => hang,n,Hangup

;--== end of [ivr-4] ==--;
copy and paste into /etc/asterisk/extensions.conf

now you can manually edit the file here through code. BUT you can't edit in the GUI. Changes will NOT reflect on the PBX that are done in the GUI.

Example, i've added option # 4 and #5 in the code. (my example IVR had option 1-3)

exten => 4,1,Set(__IVR_DIGIT_PRESSED=3)
exten => 4,n(ivrsel-3),Goto(app-blackhole,hangup,1)

exten => 5,1,Set(__IVR_DIGIT_PRESSED=3)
exten => 5,n(ivrsel-3),Goto(app-blackhole,hangup,1)

exten => 3,1,Set(__IVR_DIGIT_PRESSED=3)
exten => 3,n(ivrsel-3),Goto(app-blackhole,hangup,1)

exten => 2,1,Set(__IVR_DIGIT_PRESSED=2)
exten => 2,n(ivrsel-2),Goto(app-blackhole,hangup,1)
  
exten => 1,1,Set(__IVR_DIGIT_PRESSED=1)
exten => 1,n(ivrsel-1),Goto(app-blackhole,hangup,1)


EXAMPLE 2

SQL commands

You can update/modify using SQL.
If you open up the database table "asterisk" and look at the table called "ivr_entries"

My IVR has 3 entries in the GUI



MariaDB [asterisk]> select * from ivr_entries;
+--------+-----------+------------------------+---------+
| ivr_id | selection | dest                   | ivr_ret |
+--------+-----------+------------------------+---------+
|      5 | 3         | app-blackhole,hangup,1 |       0 |
|      5 | 2         | ivr-3,s,1              |       0 |
|      5 | 1         | from-did-direct,1000,1 |       0 |
+--------+-----------+------------------------+---------+

3 rows in set (0.00 sec)

This IVR you see i created in the GUI. Now you want to add an option? Just update this table, maintain the "IVR_ID" to keep the right IVR and you should be good. This example, i'm going to add option 4, and have it goto extension 2105

MariaDB [asterisk]> insert into ivr_entries (ivr_id,selection,dest,ivr_ret) values (5,4,'from-did-direct,2105,1',0);
Query OK, 1 row affected (0.00 sec)
MariaDB [asterisk]> select * from ivr_entries;
+--------+-----------+------------------------+---------+
| ivr_id | selection | dest                   | ivr_ret |
+--------+-----------+------------------------+---------+
|      5 | 4         | from-did-direct,2104,1 |       0 |
|      5 | 3         | app-blackhole,hangup,1 |       0 |
|      5 | 2         | ivr-3,s,1              |       0 |
|      5 | 1         | from-did-direct,1000,1 |       0 |
+--------+-----------+------------------------+---------+
4 rows in set (0.00 sec)
MariaDB [asterisk]>

Now you've added the entry to the database, if you were to look at this IVR in the GUI, you will see option "4" is now showing.

EXAMPLE 3

Call center uses an IVR to verify customer PIN numbers.  They can manually enter them in via the GUI, but in some cases, during an onboarding processess, they want it to be somewhat automated.
Each customer PIN number is just an IVR entry, and points to a queue if entered properly.
Insted of just using digits 0-9 you can use pretty much any digit length you want.
IVR - "Please enter your pin number"
0 = go to operator
558939 = customer #1 support
443223 = customer #2 support
993828 = customer #83 support
746236 = customer #154 support
After 3 failed tries it hangsup.
FreePBX stores all PBX GUI related information in the MySQL database name "asterisk".
All IVR data is stored in the table "ivr_entries".
In the example below, this shows the IVR entries.
0= play phonebooook
12244 = Customer #12244 send call to queue#2001 (support gold queue)
MariaDB [asterisk]> select * from ivr_entries;
+--------+-----------+-------------------------------+---------+
| ivr_id | selection | dest                          | ivr_ret |
+--------+-----------+-------------------------------+---------+
|      3 | 0         | app-pbdirectory,pbdirectory,1 |       0 |
|      3 | 12244     | ext-queues,2001,1             |       0 |
+--------+-----------+-------------------------------+---------+
2 rows in set (0.00 sec)

If you wanted to automate adding customers, you could do it with a MYSQL command below.
This will add the customer pin 45657 into the IVR id#3 and send it to queue# 2001
Syntax
insert into TABLENAME (Column 1 name,Column 2 name,Column 3 name,Column 4 name) values (IVRID,CustomerPIN,'DESTINATION',"RETURN-IVR");
So adding a customer number of "45657" would look like this:
insert into `ivr_entries` (`ivr_id`,`selection`,`dest`,`ivr_ret`) values (3,45657,'ext-queues,2001,1',0);
EXAMPLE;
 MariaDB [asterisk]> insert into `ivr_entries` (`ivr_id`,`selection`,`dest`,`vr_ret`) values (3,45657,'ext-queues,2001,1',0);
 Query OK, 1 row affected (0.00 sec)

 MariaDB [asterisk]> select * from ivr_entries;                              
 +--------+-----------+-------------------------------+---------+
 | ivr_id | selection | dest                          | ivr_ret |
 +--------+-----------+-------------------------------+---------+
 |      3 | 45657     | ext-queues,2001,1             |       0 |
 |      3 | 0         | app-pbdirectory,pbdirectory,1 |       0 |
 |      3 | 12244     | ext-queues,2001,1             |       0 |
 +--------+-----------+-------------------------------+---------+
 3 rows in set (0.00 sec)
The above example shows entering that data in from a sql statement.
Customer 45657 is now entered into the IVR
This will also update in the PBX GUI if you look at it with your web browser.