[asterisk-users] Contact lookup

Ex Vito ex.vitorino at gmail.com
Wed Feb 4 16:17:28 CST 2009


  For a simple (but flexible) case I would consider ODBC + func_odbc.
  Here is the idea (in case you aren't aware of how it goes...)

  - Make a DB available (your choice as long as it is accessible via ODBC)
  - Create table in it with your contacts (say columns number and
name, maybe more)
  - Setup an ODBC connection for asterisk so that it can connect to that DB
    (res_odbc.conf)
  - Setup an ODBC func.This is basically an SQL query which will be
    "mapped" into a dialplan function. (func_odbc.conf) It is essentially
     something that states "my function ODBC_LOOKUP(arg) will give me
     the results of SELECT name FROM contactsTable WHERE number=${arg}"
     into the dialplan.
  - Then use it in the dialplan
     exten => _x.,n,Set(CALLERID(name)=${ODBC_LOOKUP(${EXTEN})})

  There! Your dialplan is "almost directly" executing SQL queries. :)

  Check both the sample asterisk configs + Asterisk TFOT, chapter 12.

  It may be a bit more work than using the Ast DB or other means, but it
  has the advantage of allowing the easy setup of any kind of frontend for
  contact management.

  Note: Check for the correctness of my filenames/syntax... They're shown
           just to fill in the idea with something resembing the reality!

  My 2c,
--
  exvito



More information about the asterisk-users mailing list