[asterisk-commits] mmichelson: branch mmichelson/pub_sub r385312 - in /team/mmichelson/pub_sub: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 11 10:50:48 CDT 2013


Author: mmichelson
Date: Thu Apr 11 10:50:47 2013
New Revision: 385312

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


Added:
    team/mmichelson/pub_sub/res/res_sip_caller_id.c
      - copied unchanged from r385305, team/group/pimp_my_sip/res/res_sip_caller_id.c
Modified:
    team/mmichelson/pub_sub/   (props changed)
    team/mmichelson/pub_sub/channels/chan_gulp.c
    team/mmichelson/pub_sub/include/asterisk/res_sip.h
    team/mmichelson/pub_sub/include/asterisk/res_sip_session.h
    team/mmichelson/pub_sub/res/res_sip/sip_configuration.c
    team/mmichelson/pub_sub/res/res_sip_session.c

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

Propchange: team/mmichelson/pub_sub/
------------------------------------------------------------------------------
--- pub_sub-integrated (original)
+++ pub_sub-integrated Thu Apr 11 10:50:47 2013
@@ -1,1 +1,1 @@
-/team/group/pimp_my_sip:1-385287
+/team/group/pimp_my_sip:1-385311

Modified: team/mmichelson/pub_sub/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pub_sub/channels/chan_gulp.c?view=diff&rev=385312&r1=385311&r2=385312
==============================================================================
--- team/mmichelson/pub_sub/channels/chan_gulp.c (original)
+++ team/mmichelson/pub_sub/channels/chan_gulp.c Thu Apr 11 10:50:47 2013
@@ -154,6 +154,7 @@
 /*! \brief SIP session supplement structure */
 static struct ast_sip_session_supplement gulp_supplement = {
 	.method = "INVITE",
+	.priority = AST_SIP_SESSION_SUPPLEMENT_PRIORITY_CHANNEL,
 	.session_begin = gulp_session_begin,
 	.session_end = gulp_session_end,
 	.incoming_request = gulp_incoming_request,
@@ -164,6 +165,7 @@
 
 static struct ast_sip_session_supplement gulp_ack_supplement = {
 	.method = "ACK",
+	.priority = AST_SIP_SESSION_SUPPLEMENT_PRIORITY_CHANNEL,
 	.incoming_request = gulp_incoming_ack,
 };
 
@@ -415,7 +417,7 @@
 		return NULL;
 	}
 
-	if (!(chan = ast_channel_alloc(1, state, "", S_OR(cid_name, ""), "", "", "", linkedid, 0, "Gulp/%s-%.*s", ast_sorcery_object_get_id(session->endpoint),
+	if (!(chan = ast_channel_alloc(1, state, S_OR(session->id.number.str, ""), S_OR(session->id.name.str, ""), "", "", "", linkedid, 0, "Gulp/%s-%.*s", ast_sorcery_object_get_id(session->endpoint),
 		(int)session->inv_session->dlg->call_id->id.slen, session->inv_session->dlg->call_id->id.ptr))) {
 		ao2_cleanup(pvt);
 		return NULL;

Modified: team/mmichelson/pub_sub/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pub_sub/include/asterisk/res_sip.h?view=diff&rev=385312&r1=385311&r2=385312
==============================================================================
--- team/mmichelson/pub_sub/include/asterisk/res_sip.h (original)
+++ team/mmichelson/pub_sub/include/asterisk/res_sip.h Thu Apr 11 10:50:47 2013
@@ -322,6 +322,14 @@
 	enum ast_sip_direct_media_glare_mitigation direct_media_glare_mitigation;
 	/*! Do not attempt direct media session refreshes if a media NAT is detected */
 	unsigned int disable_direct_media_on_nat;
+	/*! Do we trust the endpoint with our outbound identity? */
+	unsigned int trust_id_outbound;
+	/*! Do we trust identity information that originates externally (e.g. P-Asserted-Identity header)? */
+	unsigned int trust_id_inbound;
+	/*! Do we send P-Asserted-Identity headers to this endpoint? */
+	unsigned int send_pai;
+	/*! Do we send Remote-Party-ID headers to this endpoint? */
+	unsigned int send_rpid;
 };
 
 /*!

Modified: team/mmichelson/pub_sub/include/asterisk/res_sip_session.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pub_sub/include/asterisk/res_sip_session.h?view=diff&rev=385312&r1=385311&r2=385312
==============================================================================
--- team/mmichelson/pub_sub/include/asterisk/res_sip_session.h (original)
+++ team/mmichelson/pub_sub/include/asterisk/res_sip_session.h Thu Apr 11 10:50:47 2013
@@ -97,6 +97,8 @@
 	pj_timer_entry rescheduled_reinvite;
 	/* Format capabilities pertaining to direct media */
 	struct ast_format_cap *direct_media_cap;
+	/* Identity of endpoint this session deals with */
+	struct ast_party_id id;
 	/* Requested capabilities */
 	struct ast_format_cap *req_caps;
 };
@@ -104,6 +106,18 @@
 typedef int (*ast_sip_session_request_creation_cb)(struct ast_sip_session *session, pjsip_tx_data *tdata);
 typedef int (*ast_sip_session_response_cb)(struct ast_sip_session *session, pjsip_rx_data *rdata);
 
+enum ast_sip_session_supplement_priority {
+	/*! Top priority. Supplements with this priority are those that need to run before any others */
+	AST_SIP_SESSION_SUPPLEMENT_PRIORITY_FIRST = 0,
+	/*! Channel creation priority.
+	 * chan_gulp creates a channel at this priority. If your supplement depends on being run before
+	 * or after channel creation, then set your priority to be lower or higher than this value.
+	 */
+	AST_SIP_SESSION_SUPPLEMENT_PRIORITY_CHANNEL = 1000000,
+	/*! Lowest priority. Supplements with this priority should be run after all other supplements */
+	AST_SIP_SESSION_SUPPLEMENT_PRIORITY_LAST = INT_MAX,
+};
+
 /*!
  * \brief A supplement to SIP message processing
  *
@@ -113,6 +127,8 @@
 struct ast_sip_session_supplement {
     /*! Method on which to call the callbacks. If NULL, call on all methods */
     const char *method;
+	/*! Priority for this supplement. Lower numbers are visited before higher numbers */
+	enum ast_sip_session_supplement_priority priority;
     /*!
 	 * \brief Notification that the session has begun
 	 * This method will always be called from a SIP servant thread.

Modified: team/mmichelson/pub_sub/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pub_sub/res/res_sip/sip_configuration.c?view=diff&rev=385312&r1=385311&r2=385312
==============================================================================
--- team/mmichelson/pub_sub/res/res_sip/sip_configuration.c (original)
+++ team/mmichelson/pub_sub/res/res_sip/sip_configuration.c Thu Apr 11 10:50:47 2013
@@ -16,6 +16,7 @@
 #include "asterisk/astobj2.h"
 #include "asterisk/utils.h"
 #include "asterisk/sorcery.h"
+#include "asterisk/callerid.h"
 
 static struct ast_sorcery *sip_sorcery;
 
@@ -230,6 +231,49 @@
 	}
 
 	return 0;
+}
+
+static int caller_id_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
+{
+	struct ast_sip_endpoint *endpoint = obj;
+	char cid_name[80] = { '\0' };
+	char cid_num[80] = { '\0' };
+
+	ast_callerid_split(var->value, cid_name, sizeof(cid_name), cid_num, sizeof(cid_num));
+	if (!ast_strlen_zero(cid_name)) {
+		endpoint->id.name.str = ast_strdup(cid_name);
+		if (!endpoint->id.name.str) {
+			return -1;
+		}
+		endpoint->id.name.valid = 1;
+	}
+	if (!ast_strlen_zero(cid_num)) {
+		endpoint->id.number.str = ast_strdup(cid_num);
+		if (!endpoint->id.number.str) {
+			return -1;
+		}
+		endpoint->id.number.valid = 1;
+	}
+	return 0;
+}
+
+static int caller_id_privacy_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
+{
+	struct ast_sip_endpoint *endpoint = obj;
+	int callingpres = ast_parse_caller_presentation(var->value);
+	if (callingpres == -1 && sscanf(var->value, "%d", &callingpres) != 1) {
+		return -1;
+	}
+	endpoint->id.number.presentation = callingpres;
+	endpoint->id.name.presentation = callingpres;
+	return 0;
+}
+
+static int caller_id_tag_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
+{
+	struct ast_sip_endpoint *endpoint = obj;
+	endpoint->id.tag = ast_strdup(var->value);
+	return endpoint->id.tag ? 0 : -1;
 }
 
 static void *sip_nat_hook_alloc(const char *name)
@@ -298,6 +342,13 @@
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "direct_media_method", "invite", direct_media_method_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "direct_media_glare_mitigation", "none", direct_media_glare_mitigation_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "disable_direct_media_on_nat", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, disable_direct_media_on_nat));
+	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callerid", "", caller_id_handler, NULL, 0, 0);
+	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callerid_privacy", "", caller_id_privacy_handler, NULL, 0, 0);
+	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callerid_tag", "", caller_id_tag_handler, NULL, 0, 0);
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_id_inbound", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, trust_id_inbound));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_id_outbound", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, trust_id_outbound));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_pai", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_pai));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_rpid", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_rpid));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "mailboxes", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, mailboxes));
 
 	if (ast_sip_initialize_sorcery_transport(sip_sorcery)) {
@@ -351,6 +402,7 @@
 	}
 	destroy_auths(endpoint->sip_inbound_auths, endpoint->num_inbound_auths);
 	destroy_auths(endpoint->sip_outbound_auths, endpoint->num_outbound_auths);
+	ast_party_id_free(&endpoint->id);
 }
 
 void *ast_sip_endpoint_alloc(const char *name)
@@ -367,6 +419,7 @@
 		ao2_cleanup(endpoint);
 		return NULL;
 	}
+	ast_party_id_init(&endpoint->id);
 	return endpoint;
 }
 

Modified: team/mmichelson/pub_sub/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pub_sub/res/res_sip_session.c?view=diff&rev=385312&r1=385311&r2=385312
==============================================================================
--- team/mmichelson/pub_sub/res/res_sip_session.c (original)
+++ team/mmichelson/pub_sub/res/res_sip_session.c Thu Apr 11 10:50:47 2013
@@ -448,8 +448,22 @@
 
 int ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement)
 {
+	struct ast_sip_session_supplement *iter;
+	int inserted = 0;
 	SCOPED_LOCK(lock, &session_supplements, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
-	AST_RWLIST_INSERT_TAIL(&session_supplements, supplement, next);
+
+	AST_RWLIST_TRAVERSE_SAFE_BEGIN(&session_supplements, iter, next) {
+		if (iter->priority > supplement->priority) {
+			AST_RWLIST_INSERT_BEFORE_CURRENT(supplement, next);
+			inserted = 1;
+			break;
+		}
+	}
+	AST_RWLIST_TRAVERSE_SAFE_END;
+
+	if (!inserted) {
+		AST_RWLIST_INSERT_TAIL(&session_supplements, supplement, next);
+	}
 	ast_module_ref(ast_module_info->self);
 	return 0;
 }
@@ -870,6 +884,7 @@
 	while ((delay = AST_LIST_REMOVE_HEAD(&session->delayed_requests, next))) {
 		ast_free(delay);
 	}
+	ast_party_id_free(&session->id);
 	ao2_cleanup(session->endpoint);
 	ast_format_cap_destroy(session->req_caps);
 }
@@ -946,6 +961,7 @@
 	}
 	session->direct_media_cap = ast_format_cap_alloc_nolock();
 	AST_LIST_HEAD_INIT_NOLOCK(&session->delayed_requests);
+	ast_party_id_init(&session->id);
 	ao2_ref(session, +1);
 	return session;
 }




More information about the asterisk-commits mailing list