[asterisk-users] MYSQL Query --> PAGE
Remco Post
remco at pipsworld.nl
Tue May 8 11:40:14 MST 2007
Forrest Beck wrote:
> I have all my SIP users in a realtime database. I would like to use
> MySQL command to query the database and use the results from the query
> to page all the phones found in the query.
>
> The results from the MySQL query will be multiple rows of extension:
> Something like:
>
> mysql> Select extension from sip where extension like '6%'
> 6001
> 6002
> 6003
> ex....
>
> I need to put all the results into a variable that would equal something
> like:
>
> SIP/6001&SIP/6002&SIP/6003
>
> I have setup a couple basic MYSQL Query's for my dialplan. Mostly
> just looking up a DID to Extension Mapping for setting callerid on
> outbound and inbound calls.
>
> How does asterisk handle the multiple results. Is there a way to loop
> until there are no more rows?
>
> Something like Set(devices=${devices}&${newrow_result})
>
> I looked at the example on
> http://www.voip-info.org/wiki/view/Asterisk+cmd+MYSQL but that doesn't
> seem to be accurate.
>
> Thanks all!!
>
What I've done in postgresql is to build an pl/pgsql procedure that
returns the desired dialstring. So the procedure does the select and
then concats them.
--
Remco Post
"I didn't write all this code, and I can't even pretend that all of it
makes sense." -- Glen Hattrup
More information about the asterisk-users
mailing list