Authenticate into a fresh call

We’ve recently switched our pbx system from a Mitel based system to and Asterisk based system. We’re running Asterisk 11.

We’ve reused all the Mitel handsets which are the 5224 and the 5340 phones.

So far, the system is running well and I’ve been trying to replicate the way certain things work with the new system so that the transition isn’t too bad for the users.

One of the features on the Mitel system was related to making outgoing calls. Every single non-executive user is assigned a pin code that is used to make outgoing calls. When the 67 extension is dialled, the user inputs their pin and they are then taken to the appropriate Context that allows them to make a call, whether local, mobile, international or otherwise.

So far, I’ve managed to replicate this feature in the Asterisk setup with one caveat - the users only see the 67 extension on their handset display once they have authenticated. They are not seeing a blank prompt and the new numbers they are entering once they have been authenticated and taken to their appropriate context.

Is this possible with Asterisk? Did I miss an application that allows me to achieve this?

For a bit more detail on how I’ve handled the authentication. All the pins are stored in the Asterisk DB. I use the Authenticate application to verify the code that the user entered. Upon valid code entry, the accountcode is set to the code that they entered. I use the account code to read the context that belongs to that code along with the call time limits from the Asterisk DB as well. I then goto the context read from the database and play a dial tone with the background application while they enter the numbers.

Have you tried with DISA application.

I have considered the DISA application. It doesn’t seem to be able to authenticate from the database as an option. Can it and the documentation just doesn’t mention it? Or can it not?

A few months ago i did an script using the the PHPAGI class for authenticated callers who make International calls using a MYSQL DB.

The user dial 605, then the Asterisk ask for a pass,
The user input the pass the AGI query the MYSQL DB and check if the pass is correct , If the pass is correct sent the user to the International calls context. It was not a perfect system but it work flawless.

[agi]
exten=>_605,1,Agi(pass.php)
same=>n,verbose(This is the pass ${code})
same=>n,Set(CDR(accountcode)=${code}) Set accountcode equal to the user pass for CDR records.
same => n,Goto(func,*54,1) Go to the Context Where you can make International calls.

[func]
exten=>*54,1,answer()
same=>n,Disa(no-password,intcallscontext)

THE AGI

[quote]#!/usr/bin/php -q

<? set_time_limit(30); require('phpagi.php'); require('conect.php'); //Include your DB connection error_reporting(E_ALL); $agi = new AGI(); $agi->answer(); $result = $agi->get_data('agent-pass',8000); $keys = $result['result']; $query = mysql_query("SELECT * FROM `users` WHERE password='$keys' LIMIT 1"); if ($query) { if($row = mysql_fetch_array($query)) { $agi->set_variable("code",$row[password]); $agi->stream_file('auth-thankyou'); } else { $agi->stream_file("vm-invalidpassword","#"); $agi->stream_file("goodbye","#"); $agi->hangup(); } } mysql_close($con); ?>[/quote]

here is the original link of my blog

Thank you for all of the replies so far.

This is interesting usage. With what you demonstrated, it would be possible for me to authenticate from the database and then pass that on so that DISA can handle the dial tone. This makes it so I don’t have to simulate a dial tone of my own.

In my testing, it works exactly as I have describe.

The one thing that still doesn’t work is that after dialing the initial extension to authenticate for a call out, the dial out extension stays active on the phone’s lcd and the phone accepts all numbers dialed after that as dtmf.