Hello,

On 14/04/15 21:46, Mickael Marrache wrote:

Hi,

 

I sometimes get the following errors:

 

kamailio[16098]: ERROR: <core> [resolve.c:1693]: sip_hostport2su(): could not resolve hostname: "mycompany.com"

kamailio[16098]: ERROR: tm [ut.h:319]: uri2dst2(): failed to resolve "mycompany.com"

 

mycompany.com cannot be resolved using DNS (there is no corresponding DNS entry). I use this as a logical domain and I don't expect Kamailio to resolve it. Also, I set use_domain (usrloc module) to 0 so only the RURI username is used when searching locations.

 

The flow is as follows:

 

-the proxy receives the INVITE with sip:<user>@myloadbalancerip:5060 which then forwards the INVITE to a proxy

-the proxy looks for <user> internally and finds that this user has multiple subscribers (endpoints)

-for each subscriber, a branch is appended using append_branch (or the RURI is replaced for the first subscriber) – the new RURI for each branch is sip:<subscriber>@mycompany.com

-finally, lookup_branches is called to look for locations for every subscriber

 

lookup_branches only uses the subscriber (RURI username) for searching locations since use_domain is set to 0.

 

However, I sometimes get the errors I mentioned.

 

Any idea why Kamailio sometimes tries to resolve the domain name?

the dns is done before relaying, unless you have some explicit actions or expressions in the configuration file that involve dns. Maybe there are cases when you try to send out before changing the domain part. You have to identify the function that is resulting in this errors.

One way to troubleshoot is to use log_prefix core parameter -- some mode details about it here:

  - http://by-miconda.blogspot.de/2014/10/kamailio-42-tips-1-log-message-prefix.html

With printing $cfg(line). Then each log message from a config function should have the associated line in config printed in the log.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - http://www.kamailioworld.com