[asterisk-commits] mmichelson: branch mmichelson/outbound_auth r383315 - in /team/mmichelson/out...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 18 10:08:39 CDT 2013


Author: mmichelson
Date: Mon Mar 18 10:08:34 2013
New Revision: 383315

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383315
Log:
Resolve conflict and reset automerge.


Modified:
    team/mmichelson/outbound_auth/   (props changed)
    team/mmichelson/outbound_auth/include/asterisk/res_sip.h
    team/mmichelson/outbound_auth/res/res_sip.exports.in
    team/mmichelson/outbound_auth/res/res_sip/sip_distributor.c
    team/mmichelson/outbound_auth/res/res_sip_session.c

Propchange: team/mmichelson/outbound_auth/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/mmichelson/outbound_auth/
------------------------------------------------------------------------------
--- outbound_auth-integrated (original)
+++ outbound_auth-integrated Mon Mar 18 10:08:34 2013
@@ -1,1 +1,1 @@
-/team/group/pimp_my_sip:1-383307
+/team/group/pimp_my_sip:1-383314

Modified: team/mmichelson/outbound_auth/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/outbound_auth/include/asterisk/res_sip.h?view=diff&rev=383315&r1=383314&r2=383315
==============================================================================
--- team/mmichelson/outbound_auth/include/asterisk/res_sip.h (original)
+++ team/mmichelson/outbound_auth/include/asterisk/res_sip.h Mon Mar 18 10:08:34 2013
@@ -660,6 +660,14 @@
 void ast_sip_dialog_set_serializer(pjsip_dialog *dlg, struct ast_taskprocessor *serializer);
 
 /*!
+ * \brief Set an endpoint on a SIP dialog so in-dialog requests do not undergo endpoint lookup.
+ *
+ * \param dlg The SIP dialog itself
+ * \param endpoint The endpoint that this dialog is communicating with
+ */
+void ast_sip_dialog_set_endpoint(pjsip_dialog *dlg, struct ast_sip_endpoint *endpoint);
+
+/*!
  * \brief Pushes a task to SIP servants
  *
  * This uses the serializer provided to determine how to push the task.

Modified: team/mmichelson/outbound_auth/res/res_sip.exports.in
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/outbound_auth/res/res_sip.exports.in?view=diff&rev=383315&r1=383314&r2=383315
==============================================================================
--- team/mmichelson/outbound_auth/res/res_sip.exports.in (original)
+++ team/mmichelson/outbound_auth/res/res_sip.exports.in Mon Mar 18 10:08:34 2013
@@ -36,6 +36,7 @@
 		LINKER_SYMBOL_PREFIXast_pjsip_rdata_get_endpoint;
 		LINKER_SYMBOL_PREFIXast_sip_thread_is_servant;
 		LINKER_SYMBOL_PREFIXast_sip_dialog_set_serializer;
+		LINKER_SYMBOL_PREFIXast_sip_dialog_set_endpoint;
 		LINKER_SYMBOL_PREFIXast_sip_retrieve_auths;
 		LINKER_SYMBOL_PREFIXast_sip_cleanup_auths;
 	local:

Modified: team/mmichelson/outbound_auth/res/res_sip/sip_distributor.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/outbound_auth/res/res_sip/sip_distributor.c?view=diff&rev=383315&r1=383314&r2=383315
==============================================================================
--- team/mmichelson/outbound_auth/res/res_sip/sip_distributor.c (original)
+++ team/mmichelson/outbound_auth/res/res_sip/sip_distributor.c Mon Mar 18 10:08:34 2013
@@ -32,24 +32,60 @@
 	.on_rx_response = distributor,
 };
 
+/*! Dialog-specific information the distributor uses */
+struct distributor_dialog_data {
+	/* Serializer to distribute tasks to for this dialog */
+	struct ast_taskprocessor *serializer;
+	/* Endpoint associated with this dialog */
+	struct ast_sip_endpoint *endpoint;
+};
+
+static struct distributor_dialog_data *distributor_dialog_data_alloc(pjsip_dialog *dlg)
+{
+	struct distributor_dialog_data *dist;
+
+	pjsip_dlg_inc_lock(dlg);
+	dist = PJ_POOL_ZALLOC_T(dlg->pool, struct distributor_dialog_data);
+	pjsip_dlg_set_mod_data(dlg, distributor_mod.id, dist);
+	pjsip_dlg_dec_lock(dlg);
+
+	return dist;
+}
+
 void ast_sip_dialog_set_serializer(pjsip_dialog *dlg, struct ast_taskprocessor *serializer)
 {
-	pjsip_dlg_inc_lock(dlg);
-	pjsip_dlg_set_mod_data(dlg, distributor_mod.id, serializer);
-	pjsip_dlg_dec_lock(dlg);
+	struct distributor_dialog_data *dist = pjsip_dlg_get_mod_data(dlg, distributor_mod.id);
+	if (!dist) {
+		dist = distributor_dialog_data_alloc(dlg);
+	}
+	dist->serializer = serializer;
+}
+
+void ast_sip_dialog_set_endpoint(pjsip_dialog *dlg, struct ast_sip_endpoint *endpoint)
+{
+	struct distributor_dialog_data *dist = pjsip_dlg_get_mod_data(dlg, distributor_mod.id);
+	if (!dist) {
+		dist = distributor_dialog_data_alloc(dlg);
+	}
+	dist->endpoint = endpoint;
 }
 
 static pj_bool_t distributor(pjsip_rx_data *rdata)
 {
 	pjsip_dialog *dlg = pjsip_ua_find_dialog(&rdata->msg_info.cid->id, &rdata->msg_info.to->tag, &rdata->msg_info.from->tag, PJ_TRUE);
+	struct distributor_dialog_data *dist = NULL;
 	struct ast_taskprocessor *serializer = NULL;
 	pjsip_rx_data *clone;
 
+	pjsip_rx_data_clone(rdata, 0, &clone);
 	if (dlg) {
-		serializer = pjsip_dlg_get_mod_data(dlg, distributor_mod.id);
-	}
-
-	pjsip_rx_data_clone(rdata, 0, &clone);
+		dist = pjsip_dlg_get_mod_data(dlg, distributor_mod.id);
+		if (dist) {
+			serializer = dist->serializer;
+			clone->endpt_info.mod_data[distributor_mod.id] = dist->endpoint;
+		}
+	}
+
 	ast_sip_push_task(serializer, distribute, clone);
 
 	if (dlg) {
@@ -69,8 +105,17 @@
 
 static pj_bool_t endpoint_lookup(pjsip_rx_data *rdata)
 {
-	struct ast_sip_endpoint *endpoint = ast_sip_identify_endpoint(rdata);
+	struct ast_sip_endpoint *endpoint;
 	int is_ack = rdata->msg_info.msg->line.req.method.id == PJSIP_ACK_METHOD;
+
+	endpoint = rdata->endpt_info.mod_data[distributor_mod.id];
+	if (endpoint) {
+		/* Bumping the refcount makes refcounting consistent whether an endpoint
+		 * is looked up or not */
+		ao2_ref(endpoint, +1);
+	} else {
+		endpoint = ast_sip_identify_endpoint(rdata);
+	}
 
 	if (!endpoint && !is_ack) {
 		/* XXX When we do an alwaysauthreject-like option, we'll need to take that into account

Modified: team/mmichelson/outbound_auth/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/outbound_auth/res/res_sip_session.c?view=diff&rev=383315&r1=383314&r2=383315
==============================================================================
--- team/mmichelson/outbound_auth/res/res_sip_session.c (original)
+++ team/mmichelson/outbound_auth/res/res_sip_session.c Mon Mar 18 10:08:34 2013
@@ -756,6 +756,7 @@
 		return NULL;
 	}
 	ast_sip_dialog_set_serializer(inv_session->dlg, session->serializer);
+	ast_sip_dialog_set_endpoint(inv_session->dlg, endpoint);
 	ao2_ref(endpoint, +1);
 	inv_session->mod_data[session_module.id] = session;
 	session->endpoint = endpoint;
@@ -1181,6 +1182,7 @@
 
 	session->inv_session->mod_data[session_module.id] = NULL;
 	ast_sip_dialog_set_serializer(session->inv_session->dlg, NULL);
+	ast_sip_dialog_set_endpoint(session->inv_session->dlg, NULL);
 	ao2_cleanup(session);
 	return 0;
 }




More information about the asterisk-commits mailing list