[OpenSIPS-Users] question about avp DB querry

Travis Manson-Drake travism at simplybits.com
Wed Feb 24 16:20:36 CET 2016


Hello Ben and Rik,

First off thank you guys for your reply!

In regards to ben, the request domain should be set if there’s a value found in the cache_local. I went ahead and added another $rd = avp(PBX) and it still didn’t like it.

I also Xlogged each segment of the intial routing script. It looks like its returning the proper value

I’m still getting a bad host name error though, almost as if its not modifying the request uri’s domain


Feb 24 08:06:40 localhost /sbin/opensips[7661]: ERROR:tm:uri2proxy: bad host name in URI <sip:5204991249@<null>:5060>

even though im telling it what to set in my logic.

if (cache_fetch("local",'$fU',$avp(PBX)))
                {
                        $rd = $avp(PBX);
                                xlog("this is the Value of the Cache_local r-uri domain: $avp(PBX) for $fU");
                }
        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)");

                        $rd = $avp(PBX);
                        xlog("this is the Value of the AVP_DB_Querry r-uri domain: $rd");
                        xlog("this is the Value of the AVP_DB_Querry pseudo variable: $avp(PBX) for $fU");

                }



From: users-bounces at lists.opensips.org [mailto:users-bounces at lists.opensips.org] On Behalf Of Newlin, Ben
Sent: Wednesday, February 24, 2016 7:09 AM
To: OpenSIPS users mailling list <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] question about avp DB querry

In the case where you perform the SQL query I don’t see where you are actually setting the result into the Request-URI. You seem to only be storing it in the cache. I think you need to add:

$rd = $avp(PBX);

to the else leg.

Ben Newlin

From: <users-bounces at lists.opensips.org<mailto:users-bounces at lists.opensips.org>> on behalf of Travis Manson-Drake <travism at simplybits.com<mailto:travism at simplybits.com>>
Reply-To: OpenSIPS users mailling list <users at lists.opensips.org<mailto:users at lists.opensips.org>>
Date: Tuesday, February 23, 2016 at 6:21 PM
To: OpenSIPS users mailling list <users at lists.opensips.org<mailto:users at lists.opensips.org>>
Subject: [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:travism at simplybits.com<mailto:travism at simplybits.com>
5225 N. Sabino Canyon Road
Tucson, AZ 85750
Support Hotline: 520.545.0333



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160224/c88a8d49/attachment-0001.htm>


More information about the Users mailing list