[asterisk-commits] file: branch 12 r427300 - /branches/12/res/res_pjsip_multihomed.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 5 06:17:02 CST 2014


Author: file
Date: Wed Nov  5 06:16:54 2014
New Revision: 427300

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=427300
Log:
res_pjsip_multihomed: Add logging during startup to aid debugging if local DNS is misbehaving.

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/

Modified:
    branches/12/res/res_pjsip_multihomed.c

Modified: branches/12/res/res_pjsip_multihomed.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_multihomed.c?view=diff&rev=427300&r1=427299&r2=427300
==============================================================================
--- branches/12/res/res_pjsip_multihomed.c (original)
+++ branches/12/res/res_pjsip_multihomed.c Wed Nov  5 06:16:54 2014
@@ -199,16 +199,24 @@
 
 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)) {




More information about the asterisk-commits mailing list