[OpenSIPS-Users] Problems with goes_to_gw Drouting

Sven Schulz svens at psu.edu
Wed Nov 3 13:56:52 CET 2010


Thanks Bogdan.
If it only works with IP adrress, then I can accept that. I was just
confused at first when I had a host name in dr_gateways and the goes_to_gw
function wasn't acting the way I thought it would.

Here's my reason for checking goes_to_gw after do_routing...

I have a number of gateways in the dr-gateways table that are on my internal
network and also on external network. The ones on the external network can
only be reached through a SBC. So I use the "type" field in dr_gateways to
handle this. If a gateway is type 1, just t_relay it normally. If it is a
type 2 then t-relay through my SBC... t_relay("IP of SBC").

Does my method above seem "correct"? Or is there a more elegant way to
handle this?


On 11/3/10 5:36 AM, "Bogdan-Andrei Iancu" <bogdan at voice-system.ro> wrote:

> Got it - it looks like the problem is that  goes_to_gw() checks IP
> versus IP - the IP from RURI versus the IPs of the GWs.........But in
> your case the RURI does not have an IP in the RURI, but a name, so the
> function fails without doing any kind of checks.
> 
> goes_to_gw() was mainly designed for checking the destination of the
> sequential requests where IPs are involved.
> 
> May I ask why do you call goes_to_gw() after do_routing() ? I mean,
> after do_routing() it is pretty sure the call will go to a gw.
> 
> Regards,
> Bogdan
> 
> 
> Sven Schulz wrote:
>> After hitting do_routing, the RURI contains the DNS name of the selected gw.
>> Because I have the DNS name entered in dr_gateways. If I change the DNS name
>> in dr_gateways to the correct IP, the goes_to_gw function works.
>> 
>> 
>> On 11/2/10 8:34 AM, "Bogdan-Andrei Iancu" <bogdan at voice-system.ro> wrote:
>> 
>>   
>>> and when calling goes_to_gw(), what the current RURI contains: the IP or
>>> the name ?
>>> 
>>> Bogdan
>>> 
>>> Sven Schulz wrote:
>>>     
>>>> Yes that is the correct IP. But the IP address works fine, its the DNS name
>>>> shown in the output below that doesn't work in goes_to_gw.
>>>> 
>>>> 
>>>> On 11/2/10 5:21 AM, "Bogdan-Andrei Iancu" <bogdan at voice-system.ro> wrote:
>>>> 
>>>>   
>>>>       
>>>>> Hi Sven,
>>>>> 
>>>>> So the IP 146.186.136.146 is the correct one you are trying to detect
>>>>> via goes_to_gw() and does not work? If so, I can provide you a small
>>>>> patch for extra debugging to doublechecks the checks in goes_to_gw()
>>>>> 
>>>>> Regards,
>>>>> Bogdan
>>>>> 
>>>>> Sven Schulz wrote:
>>>>>     
>>>>>         
>>>>>> Yes I believe Im seeing it resolve when I reload drouting:
>>>>>> 
>>>>>> Oct 29 13:22:14 testsipcore1 /sbin/opensips[9313]: DBG:core:get_record:
>>>>>> lookup(sbcma.sip.psu.edu, 35) failed
>>>>>> Oct 29 13:22:14 testsipcore1 /sbin/opensips[9313]:
>>>>>> DBG:core:sip_resolvehost:
>>>>>> no valid NAPTR record found for sbcma.sip.psu.edu, trying direct SRV
>>>>>> lookup... 
>>>>>> Oct 29 13:22:14 testsipcore1 /sbin/opensips[9313]: DBG:core:get_record:
>>>>>> lookup(_sip._udp.sbcma.sip.psu.edu, 33) failed
>>>>>> Oct 29 13:22:14 testsipcore1 /sbin/opensips[9313]:
>>>>>> DBG:core:sip_resolvehost:
>>>>>> no valid SRV record found for _sip._udp.sbcma.sip.psu.edu, trying A
>>>>>> record
>>>>>> lookup... 
>>>>>> Oct 29 13:22:14 testsipcore1 /sbin/opensips[9313]: DBG:drouting:add_dst:
>>>>>> first gw ip addr [146.186.136.146]
>>>>>> 
>>>>>> BTW, reloading drouting with 30,000+ routes and debug=6 takes a little
>>>>>> while
>>>>>> :)
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On 10/29/10 11:58 AM, "Bogdan-Andrei Iancu" <bogdan at voice-system.ro>
>>>>>> wrote:
>>>>>> 
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> Hi Sven,
>>>>>>> 
>>>>>>> and it debug=6 do you see in the logs the messages I mentioned ?
>>>>>>> 
>>>>>>> Regards,
>>>>>>> Bogdan
>>>>>>> 
>>>>>>> Sven Schulz wrote:
>>>>>>>     
>>>>>>>         
>>>>>>>            
>>>>>>>> HI Bogden,
>>>>>>>> 
>>>>>>>> I thought this param was enabled by default? But I set it anyways and
>>>>>>>> it
>>>>>>>> doesn't make a difference.
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On 10/23/10 6:57 AM, "Bogdan-Andrei Iancu" <bogdan at voice-system.ro>
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>           
>>>>>>>>> Hi Steven,
>>>>>>>>> 
>>>>>>>>> do you have enabled the "force_dns" param:
>>>>>>>>> http://www.opensips.org/html/docs/modules/1.6.x/drouting.html#id294469
>>>>>>>>> ?
>>>>>>>>> 
>>>>>>>>> in latest SVN 1.6.3, in debug mode, you should see some messages (at
>>>>>>>>> startup) like :
>>>>>>>>> first gw ip addr [xxxxx]
>>>>>>>>> additional gw ip addr [xxxx]
>>>>>>>>> 
>>>>>>>>> indicating the DNS resolving of GWs defined by names.
>>>>>>>>> 
>>>>>>>>> Regards,
>>>>>>>>> Bogdan
>>>>>>>>> 
>>>>>>>>> Sven Schulz wrote:
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>          
>>>>>>>>>          
>>>>>>>>>> Using opensips 1.6.3 SVN # 7282
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> I noticed that if I have a gateway defined in the dr_gateways tables
>>>>>>>>>> as a hostname, the goes_to_gw function never works (it gets skipped).
>>>>>>>>>> But if I change that hostname to an IP address, the function works
>>>>>>>>>> properly. Is this how its supposed to function or is it a bug?
>>>>>>>>>> 
>>>>>>>>>> do_routing()
>>>>>>>>>> if (goes_to_gw("2")) {
>>>>>>>>>> xlog ("the GW type is 2");
>>>>>>>>>> setflag(10);
>>>>>>>>>> route(4);
>>>>>>>>>> exit;
>>>>>>>>>> }
>>>>>>>>>> 
>>>>>>>>>> For example, the above code only works if the gateway is defined as
>>>>>>>>>> ³10.1.1.5² not ³test.something.com². The gw type field is always set
>>>>>>>>>> to ³2².
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>         
> 




More information about the Users mailing list