Problem resolving IP for hostname

Hi!

I have the following problem (on asterisk 1.8.7.1 and 1.8.8.0 rc2) -
When Register String is specified for a trunk error occurs ( in getaddrinfo function).

Steps to reproduce

  1. Create new trunk (was created using FreePBX)
  2. Specify Register String (user:password@­hostname e.g. my hostname is ­sip.zadarma.com)
  3. Reload configuration
    Expected Results
  4. Trunk was activated normally
    Actual Results
  5. Following error occurred -
    ERROR[24151]: netsock2.c:263 ast_sockaddr_resolve: getaddrinfo(“­sip.zadarma.com”, “(null)”, …): No address associated with hostname
    WARNING[24151]: acl.c:579 resolve_first: Unable to lookup '­sip.zadarma.com
    WARNING[24151]: acl.c:708 ast_ouraddrfor: Cannot connect
    WARNING[24151]: chan_sip.c:3352 __sip_xmit: sip_xmit of 0x8a9d328 (len 398) to (null) returned -1: Invalid argument

What kind of problem is it? Should a report bug?

Bad workaround.

Add to /etc/hosts for hostname. Error disappears. I’ve also trie to run function getaddrinfo and it works fine for me even if the host is not specified in /etc/hosts. But it doesn’t work in asterisk.

P.S. OS Ubuntu 11.10

Some ideas ?

Do you have a valid (and confirmed working) DNS? In the register string you have to use remote host name (or IP address) and not yours.

Hi, nighthare.
I tried your solution in CentOS and Asterisk 10.2.0 - it’s work.
Thank you,
Oleg
BTW, is “zadarma” it “darom” -:slight_smile: