[Kamailio-Users] finding out which gw id was used

Daniel-Constantin Mierla miconda at gmail.com
Mon Dec 7 10:21:37 CET 2009



On 12/4/09 12:48 AM, Anders wrote:
> Hi,
>
> I would like to know which gw was used for a call. Right now, it is doing this:
>
> sql_query("cb", "select id from gw where ip_addr='$rd'", "rb");
>
> ...in route[1], but that's not good enough, because I have more than
> one gw with the same IP, so it just takes the first one available. If
> I could do something like "select id from gw where
> grp_id='grp_id_from_lcr'" , where grp_id_from_lcr is the the grp_id in
> the lcr table, which lead to the gw used... then I'd have the right id
> of the gw, since I use unique numbers for the grp_id in the gw table.
>
> How do I do this?
>    
if you want to use sql query, then check the mysql manual for joins - 
you can select data using two tables.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
* http://www.asipto.com/




More information about the Users mailing list