Sort dialing

Sir,

I have working asterisk 1.4.1 and its working perfectly now i want to create sort dialing no. suppose if any one dial *123 than it will search from database and in database we have define *123 represent number 01213291999 and it will dial that number. and i have a program in which we have create sort dialing number and program to search from datafile but i donot know how to pass dialing code to that program and return dialing number which is dialed by asterisk.

Please help how to pass dialing number from asterisk and capture return number.

Rajeev.

I’m not sure, I’ve understood you correctly. So you do smthing like
/ael syntax/:

_***XXX*XXXXXXXXXXX => {
    /*here should probably be a test if a number is valid*/
    DB(somedb/${EXTEN:3:3})=${EXTEN:7};
}

to store number into database ‘somedb’…

_XXX => {
    Dial(DB(somedb/${EXTEN}),,);
}

to call an entry from database somedb…

?

Sir, i want to know search in database and if number found than dial number from database.

Rajeev

“to search a database” means “to search an AstDB” or you mean some external database engines like MySQL / MSSQL / something_else ? :open_mouth:

in AstDB.

Rajeev.

So, someones dials 123

_XXX => {
    Dial(DB(somedb/${EXTEN}),,);
}
  • will call a number in DB(somedb/123)

:question:

Sir,

I am not aware how to create AstDB and how to store number in AstDB will you please guide me step by step how to create AstDB than how to add number in AstDB and how to search and dial number in AstDB.

Thanks for your help and time.

Rajeev

if you have module app_db.so (? not too sure) loaded, you’ll get file /var/lib/asterisk/astdb…

using it is very simple:

DB(databasename/somekey)=somevalue will SET value of somekey in database databasename to value somevalue
you can GET this value at any time - use variable ${DB(databasename/somekey)}

voip-info.org/wiki/view/Asterisk+func+db

Now, please, reread my first post here :smiley:

Sir,

thanks for your help now i am able to understand but only one thing i want to ask how to store number means *123 represent number 1213291888 and *1 represent 33607903469
*1 => {
Dial(DB(mobile_phone/daddy),);

mean to say how to store *123 to represent number 1213291888

Rajeev.

So, if you have

   _***XXX*XXXXXXXXXXX => {
       /*here should probably be a test if a number is valid*/
       DB(somedb/${EXTEN:3:3})=${EXTEN:7};
   }

in your extensions.ael (or something similar in extensions.conf) - if someone DIALs “**1231213291888” from his phone, it will set

   DB(somedb/123)=1213291888

Sir,

It’s working thanks for your help.

Sir, there is any way to get printout of all store information in astdb.

Rajeev.

You can print any variable, using, for example

   Noop ( ${DB(aaa/bbb)} ); // print to asterisk console if 'core verbose' set >= 3

or

   Verbose (|${DB(aaa/bbb)}); // always print to asterisk console