Dialling certain extensions based oncoming caller ID string

Hi,
Does anyone know of a way of way of directing incoming calls to certain local extensions based on incoming Caller ID?

I would really like to be able to look up Caller ID numbers from an SQL database, but this would be a valhalla solution. Speed of the lookup may be a problem, but I am open to suggestions.

Thanks,

Rob.

Few different ways to go about it.

  1. Match in the dialplan based on the callerid such as:
    exten => _NXXNXXXXXX/8005551212,1,Goto(some,place)
    Which will be used if the 8005551212 calls into that pattern match extension.

  2. Store the lookups in the AstDB
    exten => <your_did>,1,GotoIf(${DB_EXISTS(whitelist/${CALLERID(num)})}?connect)
    Which the example will jump to the connect label on the current extension if the callerid is in the whitelist family.
    From the CLI you can add numbers via "database put whitelist 8005551212 1"
    You can also use the DB() function to retrieve the target extensions etc from astdb…

  3. Use an ODBC function to select the target from a db. (See func_odbc.conf and res_odbc.conf)

  4. Write an AGI in the language of your choosing to do the lookups for you.

Hi,
Thanks for reply. I would imagine that it looks easier to do this via AGI. I do not know about PHP programming but have done a lot of C and C++. Is there anyway I can use C to process my AGI scripts?

Should I bite the bullet and learn PHP. I’ve been putting it off for years and now may be a good time.

Cheers,

Rob.

You can program the AGI in pretty much any language. This link may give you some pointers/direction:
voip-info.org/wiki-Asterisk+AGI