[asterisk-commits] file: branch group/pimp_my_sip r379453 - /team/group/pimp_my_sip/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 18 11:12:13 CST 2013


Author: file
Date: Fri Jan 18 11:12:10 2013
New Revision: 379453

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379453
Log:
Make some callbacks optional, create a format capabilities structure on the endpoint, and don't crash if no SDP handlers exist for a media type.

Modified:
    team/group/pimp_my_sip/res/res_sip.c
    team/group/pimp_my_sip/res/res_sip.exports.in
    team/group/pimp_my_sip/res/res_sip_session.c

Modified: team/group/pimp_my_sip/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip.c?view=diff&rev=379453&r1=379452&r2=379453
==============================================================================
--- team/group/pimp_my_sip/res/res_sip.c (original)
+++ team/group/pimp_my_sip/res/res_sip.c Fri Jan 18 11:12:10 2013
@@ -197,7 +197,13 @@
 static void endpoint_destructor(void* obj)
 {
 	struct ast_sip_endpoint *endpoint = obj;
+
 	ast_string_field_free_memory(endpoint);
+
+	if (endpoint->codecs) {
+		ast_format_cap_destroy(endpoint->codecs);
+	}
+
 	/* XXX Will likely need to destroy a bunch
 	 * more other endpoint data too.
 	 */
@@ -210,6 +216,10 @@
 		return NULL;
 	}
 	if (ast_string_field_init(endpoint, 64)) {
+		ao2_cleanup(endpoint);
+		return NULL;
+	}
+	if (!(endpoint->codecs = ast_format_cap_alloc_nolock())) {
 		ao2_cleanup(endpoint);
 		return NULL;
 	}
@@ -413,6 +423,7 @@
 	pjsip_transport *hardcoded_transport = NULL;
 	pj_sockaddr addr;
 	pj_str_t home = { "127.0.0.1:5060", 14 };
+
 	if (pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &home, &addr) != PJ_SUCCESS) {
 		return -1;
 	}

Modified: team/group/pimp_my_sip/res/res_sip.exports.in
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip.exports.in?view=diff&rev=379453&r1=379452&r2=379453
==============================================================================
--- team/group/pimp_my_sip/res/res_sip.exports.in (original)
+++ team/group/pimp_my_sip/res/res_sip.exports.in Fri Jan 18 11:12:10 2013
@@ -21,6 +21,7 @@
 		LINKER_SYMBOL_PREFIXast_sip_add_body_multipart;
 		LINKER_SYMBOL_PREFIXast_sip_append_body;
 		LINKER_SYMBOL_PREFIXast_sip_get_pjsip_endpoint;
+		LINKER_SYMBOL_PREFIXast_sip_endpoint_alloc;
 		LINKER_SYMBOL_PREFIXpj_*;
 		LINKER_SYMBOL_PREFIXpjsip_*;
 	local:

Modified: team/group/pimp_my_sip/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip_session.c?view=diff&rev=379453&r1=379452&r2=379453
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_session.c (original)
+++ team/group/pimp_my_sip/res/res_sip_session.c Fri Jan 18 11:12:10 2013
@@ -164,6 +164,7 @@
 		handler_list = ao2_find(sdp_handlers, pj_strbuf(&media), OBJ_KEY);
 		if (!handler_list) {
 			ast_debug(1, "No registered SDP handlers for media type '%s'\n", pj_strbuf(&media));
+			continue;
 		}
 		AST_LIST_TRAVERSE(&handler_list->list, handler, next) {
 			int res = handler->handle_incoming_sdp_stream(session, sdp_info->sdp, sdp_info->sdp->media[i]);
@@ -315,7 +316,9 @@
 {
 	struct ast_sip_session_supplement *supplement;
 	AST_LIST_TRAVERSE(&session->supplements, supplement, next) {
-		supplement->outgoing_response(session, tdata);
+		if (supplement->outgoing_response) {
+			supplement->outgoing_response(session, tdata);
+		}
 	}
 	pjsip_inv_send_msg(session->inv_session, tdata);
 	return;




More information about the asterisk-commits mailing list