[asterisk-commits] kmoore: branch kmoore/pjsip_path_support r403395 - /team/kmoore/pjsip_path_su...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 5 11:10:55 CST 2013


Author: kmoore
Date: Thu Dec  5 11:10:54 2013
New Revision: 403395

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=403395
Log:
Add a session supplement with stubs

Modified:
    team/kmoore/pjsip_path_support/res/res_pjsip_path.c

Modified: team/kmoore/pjsip_path_support/res/res_pjsip_path.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/res/res_pjsip_path.c?view=diff&rev=403395&r1=403394&r2=403395
==============================================================================
--- team/kmoore/pjsip_path_support/res/res_pjsip_path.c (original)
+++ team/kmoore/pjsip_path_support/res/res_pjsip_path.c Thu Dec  5 11:10:54 2013
@@ -28,6 +28,7 @@
 #include <pjsip_ua.h>
 
 #include "asterisk/res_pjsip.h"
+#include "asterisk/res_pjsip_session.h"
 #include "asterisk/module.h"
 #include "asterisk/strings.h"
 
@@ -182,6 +183,11 @@
 	}
 
 	pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)route_hdr);
+}
+
+static void path_session_outgoing_request(struct ast_sip_session *session, pjsip_tx_data *tdata)
+{
+	path_outgoing_request(session->endpoint, tdata);
 }
 
 /*!
@@ -234,24 +240,41 @@
 
 }
 
+static void path_session_outgoing_response(struct ast_sip_session *session, pjsip_tx_data *tdata)
+{
+	path_outgoing_response(session->endpoint, tdata);
+}
+
 static struct ast_sip_supplement path_supplement = {
 	.priority = AST_SIP_SUPPLEMENT_PRIORITY_CHANNEL - 100,
 	.outgoing_request = path_outgoing_request,
 	.outgoing_response = path_outgoing_response,
 };
 
+static struct ast_sip_session_supplement path_session_supplement = {
+	.priority = AST_SIP_SUPPLEMENT_PRIORITY_CHANNEL - 100,
+	.outgoing_request = path_session_outgoing_request,
+	.outgoing_response = path_session_outgoing_response,
+};
+
 static int load_module(void)
 {
 	if (ast_sip_register_supplement(&path_supplement)) {
 		return AST_MODULE_LOAD_DECLINE;
 	}
 
+	if (ast_sip_session_register_supplement(&path_session_supplement)) {
+		ast_sip_unregister_supplement(&path_supplement);
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
 	ast_sip_unregister_supplement(&path_supplement);
+	ast_sip_session_unregister_supplement(&path_session_supplement);
 	return 0;
 }
 




More information about the asterisk-commits mailing list