[svn-commits] file: branch group/dns_pjsip r434283 - in /team/group/dns_pjsip: ./ include/a...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Apr 8 06:10:12 CDT 2015


Author: file
Date: Wed Apr  8 06:10:06 2015
New Revision: 434283

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=434283
Log:
Add support for using the official PJSIP external resolver API, and provide notice about falling back to built-in if unavailable.

Modified:
    team/group/dns_pjsip/configure
    team/group/dns_pjsip/configure.ac
    team/group/dns_pjsip/include/asterisk/autoconfig.h.in
    team/group/dns_pjsip/res/res_pjsip/pjsip_resolver.c

Modified: team/group/dns_pjsip/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/group/dns_pjsip/configure.ac?view=diff&rev=434283&r1=434282&r2=434283
==============================================================================
--- team/group/dns_pjsip/configure.ac (original)
+++ team/group/dns_pjsip/configure.ac Wed Apr  8 06:10:06 2015
@@ -458,6 +458,7 @@
 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_REPLACE_MEDIA_STREAM], [PJSIP Media Stream Replacement Support], [PJPROJECT], [pjsip])
 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_GET_DEST_INFO], [pjsip_get_dest_info support], [PJPROJECT], [pjsip])
 AST_EXT_LIB_SETUP_OPTIONAL([PJ_SSL_CERT_LOAD_FROM_FILES2], [pj_ssl_cert_load_from_files2 support], [PJPROJECT], [pjsip])
+AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_EXTERNAL_RESOLVER], [PJSIP External Resolver Support], [PJPROJECT], [pjsip])
 AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
 AST_EXT_LIB_SETUP_OPTIONAL([PRI_SETUP_ACK_INBAND], [ISDN PRI progress inband ie in SETUP ACK], [PRI], [pri])
@@ -2124,6 +2125,7 @@
 
 AST_EXT_LIB_CHECK([PJSIP_GET_DEST_INFO], [pjsip], [pjsip_get_dest_info], [pjsip.h], [$PJPROJECT_LIBS], [$PJPROJECT_CFLAGS])
 AST_EXT_LIB_CHECK([PJ_SSL_CERT_LOAD_FROM_FILES2], [pj], [pj_ssl_cert_load_from_files2], [pjlib.h], [$PJPROJECT_LIBS], [$PJPROJECT_CFLAGS])
+AST_EXT_LIB_CHECK([PJSIP_EXTERNAL_RESOLVER], [pjsip], [pjsip_endpt_set_ext_resolver], [pjsip.h], [$PJPROJECT_LIBS], [$PJPROJECT_CFLAGS])
 
 AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
 

Modified: team/group/dns_pjsip/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/team/group/dns_pjsip/include/asterisk/autoconfig.h.in?view=diff&rev=434283&r1=434282&r2=434283
==============================================================================
--- team/group/dns_pjsip/include/asterisk/autoconfig.h.in (original)
+++ team/group/dns_pjsip/include/asterisk/autoconfig.h.in Wed Apr  8 06:10:06 2015
@@ -577,6 +577,10 @@
 
 /* Define if your system has the PJPROJECT libraries. */
 #undef HAVE_PJPROJECT
+
+/* Define to 1 if PJPROJECT has the PJSIP External Resolver Support feature.
+   */
+#undef HAVE_PJSIP_EXTERNAL_RESOLVER
 
 /* Define to 1 if PJPROJECT has the pjsip_get_dest_info support feature. */
 #undef HAVE_PJSIP_GET_DEST_INFO

Modified: team/group/dns_pjsip/res/res_pjsip/pjsip_resolver.c
URL: http://svnview.digium.com/svn/asterisk/team/group/dns_pjsip/res/res_pjsip/pjsip_resolver.c?view=diff&rev=434283&r1=434282&r2=434283
==============================================================================
--- team/group/dns_pjsip/res/res_pjsip/pjsip_resolver.c (original)
+++ team/group/dns_pjsip/res/res_pjsip/pjsip_resolver.c Wed Apr  8 06:10:06 2015
@@ -29,6 +29,8 @@
 #include "asterisk/dns_naptr.h"
 #include "asterisk/res_pjsip.h"
 #include "include/res_pjsip_private.h"
+
+#ifdef HAVE_PJSIP_EXTERNAL_RESOLVER
 
 /*! \brief Structure which contains transport+port information for an active query */
 struct sip_target {
@@ -472,6 +474,11 @@
 	}
 }
 
+/*! \brief External resolver implementation for PJSIP */
+static pjsip_ext_resolver resolver = {
+	.resolve = sip_resolve,
+};
+
 static int sip_replace_resolver(void *data)
 {
 	pj_pool_t *pool;
@@ -493,7 +500,7 @@
 	pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);
 
 	/* Replace the PJSIP resolver with our own implementation */
-	pjsip_endpt_set_resolver_implementation(ast_sip_get_pjsip_endpoint(), sip_resolve);
+	pjsip_endpt_set_ext_resolver(ast_sip_get_pjsip_endpoint(), &resolver);
 	return 0;
 }
 
@@ -502,3 +509,13 @@
 	/* Replace the existing PJSIP resolver with our own implementation */
 	ast_sip_push_task_synchronous(NULL, sip_replace_resolver, NULL);
 }
+
+#else
+
+void ast_sip_initialize_resolver(void)
+{
+	/* External resolver support does not exist in the version of PJSIP in use */
+	ast_log(LOG_NOTICE, "The version of PJSIP in use does not support external resolvers, using PJSIP provided resolver\n");
+}
+
+#endif




More information about the svn-commits mailing list