[HELP] custom dialplan with authenticate users

Hi guys,

I have to say that i`m relatively new to Trixbox/Asterisk/PBX but for the last couple of days(2 weeks almost) I watched videos and read tutorials about them.(almost all wiki pages from voip-info :confused:, Asterisk the Future of Telephony and many other links/sites)

I would like to ask some questions regarding what I need for my project.

But first I would like to tell what I need from asterisk:

I need an IVR to implement into my web project to serve me for this:

For some processes setup at some specific date/time the user can log in into IVR, enter pin# to authenticate, then enter work_order# and if the codes are valid user should be able to “Check In” into the system (and get a confirmation number) and after the job is done he must call again to IVR to “Check Out” with same previous steps.

On my web application the WO(work_order#) for scheduled process are stored into a mysql db along with all other info. Also in the same db I have saved the information regarding each user who should log in into IVR(name, email, address etc).

The web based application is done, and a user could login/logout manually from the site.

What I need is to check for Authenticate(pin#) and for WO#(work_order) the inputs (from a mysql database most required “desired” - my web application db - or other known db to fit my application). Is that possible with only asterisk? How can I do this? At this moment I can make some authentification but with db-key-family from asterisk berkeley database which doesn’t help me that much.(there are many process going on and the berkeley db doesnt seem to fit for this) Does this require Agi scripting(I think it is a must :-s )? Any userfull info I would appreciate about AGI implementation for this specific task. Also If there is a way to use php to help me on this process would be great. (php and mysql programing are not a problem for me)

After my research and documentation regarding Trixbox and Asterisk I come to this point:

I made the IVR schema(dialplan) which is 4-5 leves deeper only (Chose language -> Enter Pin# to Authenticate -> Enter WO# to select the services -> Check In/Out) with some logic in it (return to previous extension or call an operator extention for help etc).
I implemented a simple context with extensions to loop thro the ivr without authentification.

Regarding Authentification to the system:
I created a custom context(dialplan) which I can call with a predefined extension (123 for example).
After that I succeed to get an authenticate command(with password hard coded ex: “exten => 3,1,Authenticate(1111)” or after I populated the asterisk database(Berkeley) with “database put pass ACCOUNTCODE CALLERID” with “exten => 3,1,Authenticate(/pass|da)”). What I need is to check the authenticate password from a mysql table. For some reference I looked on this site voip-info.org/wiki/view/Asterisk+cmd+MYSQL.
It seems is displaying some mysql usage but not sure how I could implement/use them. In AGIscript I should check if there is that password inside db? or if fetch result is null or not?


  • Where should I store all the pin# for the users? Can I use mysql db tables to store pin/WO numbers?(each user has his own pin and can have multiple WO#). How can AGI help me in the process if I need agi scripting to do this? if yes could anyone point me some code snipets or examples of usage.
  • How can u manipulate the db data depending on the recieved inputs from TrixBox/Asterisk. (php scripts or mysql commands?) to change status on a process to Check In/Out.

I already lost 2 weeks almost with asterisk implementation for my project and I’m close to the edge of the clif :frowning: (being a student doesn’t secure my job spot inside the firm :frowning: )

I must excuse for my long message but if anyone could help me with some links, code snipets or anything else I would appreciate it.

Forgot to mention I’m using trixbox 2.6.1 and asterisk 1.4.10


Sounds interesting, below are a few links that may help.

Chapter 9 from this book TFOT

osdir.com/ml/telephony.pbx.aster … 00790.html