res_pjsip_multihomed: Add logging during startup to aid debugging if local DNS is...
authorJoshua Colp <jcolp@digium.com>
Wed, 5 Nov 2014 12:19:09 +0000 (12:19 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 5 Nov 2014 12:19:09 +0000 (12:19 +0000)
This change adds a bit of logging so if the local DNS is misbehaving it is easier
to track down what is going on and where Asterisk may be hanging.

ASTERISK-24438 #close
Reported by: Melissa Shepherd

Review: https://reviewboard.asterisk.org/r/4148/
........

Merged revisions 427300 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 427303 from http://svn.asterisk.org/svn/asterisk/branches/13

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@427306 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_pjsip_multihomed.c

index 38824da..e0ee53e 100644 (file)
@@ -199,16 +199,24 @@ static int unload_module(void)
 
 static int load_module(void)
 {
+       char hostname[MAXHOSTNAMELEN] = "";
        pj_sockaddr addr;
 
        CHECK_PJSIP_MODULE_LOADED();
 
+       if (!gethostname(hostname, sizeof(hostname) - 1)) {
+               ast_verb(2, "Performing DNS resolution of local hostname '%s' to get local IPv4 and IPv6 address\n",
+                       hostname);
+       }
+
        if (!pj_gethostip(pj_AF_INET(), &addr)) {
                pj_sockaddr_print(&addr, host_ipv4, sizeof(host_ipv4), 2);
+               ast_verb(3, "Local IPv4 address determined to be: %s\n", host_ipv4);
        }
 
        if (!pj_gethostip(pj_AF_INET6(), &addr)) {
                pj_sockaddr_print(&addr, host_ipv6, sizeof(host_ipv6), 2);
+               ast_verb(3, "Local IPv6 address determined to be: %s\n", host_ipv6);
        }
 
        if (ast_sip_register_service(&multihomed_module)) {