After your cache_fetch and db_query xlog the value to see what opensips gets as 
value.
For example:    xlog("value retrieved by db query is $avp(PBX) for $fU");

Regards,
Met vriendelijke groet,

Rik Broers
Voice Engineer
Van: [email protected] [mailto:[email protected]] 
Namens Travis Manson-Drake
Verzonden: woensdag 24 februari 2016 0:22
Aan: OpenSIPS users mailling list <[email protected]>
Onderwerp: [OpenSIPS-Users] question about avp DB querry

Hello Everyone.

For some reason whenever I try to call a host behind my proxy (who's a just a 
relay for the PBX) I get the following

Feb 23 16:10:40 localhost /sbin/opensips[6017]: ERROR:tm:uri2proxy: bad host 
name in URI <sip:5204991249@<null<sip:5204991249@%3cnull>>:5060>
Feb 23 16:10:40 localhost /sbin/opensips[6017]: ERROR:tm:t_forward_nonack: 
failure to add branches

I get that it cant route it because theres no valid domain.

However, in my logic I have it lookup the domain based on $fU and then append 
it to the request.


For example:


route
{


        if (cache_fetch("local",'$fU',$avp(PBX)))
                {
                        $rd = $avp(PBX);
                }
        else
                {

                        avp_db_query("select Servers.ipaddress from Servers 
where Servers.ID in (select phone.ServerID from phone where phone.mac in 
(select MAC FROM `phone_registrations` where auth_userid = 
'$(fU{s.escape.common})'))", "$avp(PBX)");
                        cache_store("local",'$fU',"$avp(PBX)");

                }

        if ($ct.fields(expires) == '0')
                {
                cache_remove("local",'$fU');
                exit;
                }

I can even see the query being run in my mysql.log. and its returning the 
correct result.

Any idea's on this one?

Travis Manson-Drake
Voice Systems Analyst


Simply Bits, LLC
T: 520.545.0311  F: 520.545.7252
E: [email protected]<mailto:[email protected]>
5225 N. Sabino Canyon Road
Tucson, AZ 85750
Support Hotline: 520.545.0333



_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to