[svn-commits] kmoore: branch kmoore/pjsip_path_support r405250 - /team/kmoore/pjsip_path_su...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jan 9 11:34:03 CST 2014


Author: kmoore
Date: Thu Jan  9 11:34:00 2014
New Revision: 405250

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=405250
Log:
Address Joshua's comments

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

Modified: team/kmoore/pjsip_path_support/res/res_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/res/res_pjsip.c?view=diff&rev=405250&r1=405249&r2=405250
==============================================================================
--- team/kmoore/pjsip_path_support/res/res_pjsip.c (original)
+++ team/kmoore/pjsip_path_support/res/res_pjsip.c Thu Jan  9 11:34:00 2014
@@ -992,7 +992,7 @@
 				<configOption name="support_path">
 					<synopsis>Enables Path support for REGISTER requests and Route support for other requests.</synopsis>
 					<description><para>
-						When this option is enabled, the Path header in register requests will be saved
+						When this option is enabled, the Path headers in register requests will be saved
 						and its contents will be used in Route headers for outbound out-of-dialog requests
 						and in Path headers for outbound 200 responses. Path support will also be indicated
 						in the Supported header.
@@ -2162,7 +2162,7 @@
 
 	AST_RWLIST_RDLOCK(&supplements);
 	AST_LIST_TRAVERSE(&supplements, supplement, next) {
-		if (supplement->incoming_request && does_method_match(&rdata->msg_info.cseq->method.name, supplement->method)) {
+		if (supplement->incoming_request && does_method_match(&rdata->msg_info.msg->line.req.method.name, supplement->method)) {
 			supplement->incoming_request(ast_pjsip_rdata_get_endpoint(rdata), rdata);
 		}
 	}

Modified: team/kmoore/pjsip_path_support/res/res_pjsip_outbound_registration.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/res/res_pjsip_outbound_registration.c?view=diff&rev=405250&r1=405249&r2=405250
==============================================================================
--- team/kmoore/pjsip_path_support/res/res_pjsip_outbound_registration.c (original)
+++ team/kmoore/pjsip_path_support/res/res_pjsip_outbound_registration.c Thu Jan  9 11:34:00 2014
@@ -257,6 +257,8 @@
 	}
 }
 
+static pj_str_t PATH_NAME = { "path", 4 };
+
 /*! \brief Callback function for registering */
 static int handle_client_registration(void *data)
 {
@@ -279,7 +281,6 @@
 		  client_state->retries + 1, server_uri, client_uri);
 
 	if (client_state->support_path) {
-		pj_str_t path_name = { "path", 4 };
 		pjsip_supported_hdr *hdr;
 
 		hdr = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_SUPPORTED, NULL);
@@ -294,7 +295,7 @@
 		}
 
 		/* add on to the existing Supported header */
-		pj_strdup(tdata->pool, &hdr->values[hdr->count++], &path_name);
+		pj_strassign(&hdr->values[hdr->count++], &PATH_NAME);
 	}
 
 	/* Due to the registration the callback may now get called, so bump the ref count */

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=405250&r1=405249&r2=405250
==============================================================================
--- team/kmoore/pjsip_path_support/res/res_pjsip_path.c (original)
+++ team/kmoore/pjsip_path_support/res/res_pjsip_path.c Thu Jan  9 11:34:00 2014
@@ -32,9 +32,8 @@
 #include "asterisk/module.h"
 #include "asterisk/strings.h"
 
-static const pj_str_t path_name = { "Path", 4 };
-static const pj_str_t path_supported_name = { "path", 4 };
-static const pj_str_t route_name = { "Route", 5 };
+static const pj_str_t PATH_NAME = { "Path", 4 };
+static pj_str_t PATH_SUPPORTED_NAME = { "path", 4 };
 
 static struct ast_sip_aor *find_aor(struct ast_sip_endpoint *endpoint, pjsip_uri *uri)
 {
@@ -87,7 +86,7 @@
 }
 
 /*!
- * \brief Get the path string associated with this endpoint and tdata
+ * \brief Get the path string associated with this contact and tdata
  *
  * \param endpoint The endpoint from which to pull associated path data
  * \param contact_uri The URI identifying the associated contact
@@ -122,7 +121,7 @@
 	}
 
 	/* add on to the existing Supported header */
-	pj_strdup(tdata->pool, &hdr->values[hdr->count++], &path_supported_name);
+	pj_strassign(&hdr->values[hdr->count++], &PATH_SUPPORTED_NAME);
 
 	return 0;
 }
@@ -138,8 +137,6 @@
  */
 static void path_outgoing_request(struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, pjsip_tx_data *tdata)
 {
-	pj_str_t path_dup;
-	pjsip_generic_string_hdr *route_hdr;
 	RAII_VAR(struct ast_sip_aor *, aor, NULL, ao2_cleanup);
 
 	if (!endpoint) {
@@ -155,16 +152,9 @@
 		return;
 	}
 
-	if (path_get_string(tdata->pool, contact, &path_dup)) {
-		return;
-	}
-
-	route_hdr = pjsip_generic_string_hdr_create(tdata->pool, &route_name, &path_dup);
-	if (!route_hdr) {
-		return;
-	}
-
-	pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)route_hdr);
+	if (contact && !ast_strlen_zero(contact->path)) {
+		ast_sip_set_outbound_proxy(tdata, contact->path);
+	}
 }
 
 static void path_session_outgoing_request(struct ast_sip_session *session, pjsip_tx_data *tdata)
@@ -207,7 +197,7 @@
 		return;
 	}
 
-	path_hdr = pjsip_generic_string_hdr_create(tdata->pool, &path_name, &path_dup);
+	path_hdr = pjsip_generic_string_hdr_create(tdata->pool, &PATH_NAME, &path_dup);
 	if (!path_hdr) {
 		return;
 	}




More information about the svn-commits mailing list