MySQL query in a Macro

Hello all,

I need to write a macro that will get run on certain outgoing calls, based on destination area code. The macro needs to query a mysql table for the destination phone number, and change the caller ID if a match is found.

I don’t want to create a new connection to the local mysql server every time this is run… but I’d like to check for an existing MySQL connection ID and use it if it exists, and if it doesn’t exists, create a new one and use that each time.

Does anyone know of an article online that talks about doing something like this?

The queries execute very quickly on the mysql server when I’ve done test queries.

Any help would be appreciated.


I think that you will find everything that you need to accomplish this here: