[asterisk-commits] mmichelson: branch group/pimp_my_sip r386532 - in /team/group/pimp_my_sip: in...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 25 12:44:46 CDT 2013


Author: mmichelson
Date: Thu Apr 25 12:44:41 2013
New Revision: 386532

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386532
Log:
Merge SUBSCRIBE/NOTIFY support and MWI support.

(closes ASTERISK-21259)
(closes ASTERISK-21260)

Review: https://reviewboard.asterisk.org/r/2456


Added:
    team/group/pimp_my_sip/include/asterisk/res_sip_pubsub.h
      - copied unchanged from r386530, team/mmichelson/pub_sub/include/asterisk/res_sip_pubsub.h
    team/group/pimp_my_sip/res/res_sip_mwi.c
      - copied unchanged from r386530, team/mmichelson/pub_sub/res/res_sip_mwi.c
    team/group/pimp_my_sip/res/res_sip_pubsub.c
      - copied unchanged from r386530, team/mmichelson/pub_sub/res/res_sip_pubsub.c
    team/group/pimp_my_sip/res/res_sip_pubsub.exports.in
      - copied unchanged from r386530, team/mmichelson/pub_sub/res/res_sip_pubsub.exports.in
Modified:
    team/group/pimp_my_sip/include/asterisk/res_sip.h
    team/group/pimp_my_sip/res/res_sip/location.c
    team/group/pimp_my_sip/res/res_sip/sip_configuration.c
    team/group/pimp_my_sip/res/res_sip/sip_distributor.c

Modified: team/group/pimp_my_sip/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/include/asterisk/res_sip.h?view=diff&rev=386532&r1=386531&r2=386532
==============================================================================
--- team/group/pimp_my_sip/include/asterisk/res_sip.h (original)
+++ team/group/pimp_my_sip/include/asterisk/res_sip.h Thu Apr 25 12:44:41 2013
@@ -155,6 +155,10 @@
 struct ast_sip_aor {
 	/*! Sorcery object details, the id is the AOR name */
 	SORCERY_OBJECT(details);
+	AST_DECLARE_STRING_FIELDS(
+		/*! Voicemail boxes for this AOR */
+		AST_STRING_FIELD(mailboxes);
+	);
 	/*! Minimum expiration time */
 	unsigned int minimum_expiration;
 	/*! Maximum expiration time */
@@ -267,6 +271,8 @@
                 AST_STRING_FIELD(mohsuggest);
 		/*! Optional external media address to use in SDP */
 		AST_STRING_FIELD(external_media_address);
+		/*! Configured voicemail boxes for this endpoint. Used for MWI */
+		AST_STRING_FIELD(mailboxes);
 	);
 	/*! Identification information for this endpoint */
 	struct ast_party_id id;
@@ -328,6 +334,8 @@
 	unsigned int send_pai;
 	/*! Do we send Remote-Party-ID headers to this endpoint? */
 	unsigned int send_rpid;
+	/*! Should unsolicited MWI be aggregated into a single NOTIFY? */
+	unsigned int aggregate_mwi;
 };
 
 /*!
@@ -779,6 +787,8 @@
 /*!
  * \brief Set a serializer on a SIP dialog so requests and responses are automatically serialized
  *
+ * Passing a NULL serializer is a way to remove a serializer from a dialog.
+ *
  * \param dlg The SIP dialog itself
  * \param serializer The serializer to use
  */

Modified: team/group/pimp_my_sip/res/res_sip/location.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip/location.c?view=diff&rev=386532&r1=386531&r2=386532
==============================================================================
--- team/group/pimp_my_sip/res/res_sip/location.c (original)
+++ team/group/pimp_my_sip/res/res_sip/location.c Thu Apr 25 12:44:41 2013
@@ -31,12 +31,18 @@
 	struct ast_sip_aor *aor = obj;
 
 	ao2_cleanup(aor->permanent_contacts);
+	ast_string_field_free_memory(aor);
 }
 
 /*! \brief Allocator for AOR */
 static void *aor_alloc(const char *name)
 {
-	return ao2_alloc_options(sizeof(struct ast_sip_aor), aor_destroy, AO2_ALLOC_OPT_LOCK_NOLOCK);
+	struct ast_sip_aor *aor = ao2_alloc_options(sizeof(struct ast_sip_aor), aor_destroy, AO2_ALLOC_OPT_LOCK_NOLOCK);
+	if (!aor) {
+		return NULL;
+	}
+	ast_string_field_init(aor, 128);
+	return aor;
 }
 
 /*! \brief Destructor for contact */
@@ -250,6 +256,7 @@
 	ast_sorcery_object_field_register(sorcery, "aor", "max_contacts", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_aor, max_contacts));
 	ast_sorcery_object_field_register(sorcery, "aor", "remove_existing", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_aor, remove_existing));
 	ast_sorcery_object_field_register_custom(sorcery, "aor", "contact", "", permanent_uri_handler, NULL, 0, 0);
+	ast_sorcery_object_field_register(sorcery, "aor", "mailboxes", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_aor, mailboxes));
 
 	return 0;
 }

Modified: team/group/pimp_my_sip/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip/sip_configuration.c?view=diff&rev=386532&r1=386531&r2=386532
==============================================================================
--- team/group/pimp_my_sip/res/res_sip/sip_configuration.c (original)
+++ team/group/pimp_my_sip/res/res_sip/sip_configuration.c Thu Apr 25 12:44:41 2013
@@ -349,6 +349,8 @@
 	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));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "aggregate_mwi", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, aggregate_mwi));
 
 	if (ast_sip_initialize_sorcery_transport(sip_sorcery)) {
 		ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");

Modified: team/group/pimp_my_sip/res/res_sip/sip_distributor.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip/sip_distributor.c?view=diff&rev=386532&r1=386531&r2=386532
==============================================================================
--- team/group/pimp_my_sip/res/res_sip/sip_distributor.c (original)
+++ team/group/pimp_my_sip/res/res_sip/sip_distributor.c Thu Apr 25 12:44:41 2013
@@ -40,21 +40,27 @@
 	struct ast_sip_endpoint *endpoint;
 };
 
+/*!
+ * \internal
+ *
+ * \note Call this with the dialog locked
+ */
 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)
 {
-	struct distributor_dialog_data *dist = pjsip_dlg_get_mod_data(dlg, distributor_mod.id);
+	struct distributor_dialog_data *dist;
+	SCOPED_LOCK(lock, dlg, pjsip_dlg_inc_lock, pjsip_dlg_dec_lock);
+	
+	dist = pjsip_dlg_get_mod_data(dlg, distributor_mod.id);
 	if (!dist) {
 		dist = distributor_dialog_data_alloc(dlg);
 	}
@@ -63,7 +69,10 @@
 
 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);
+	struct distributor_dialog_data *dist;
+	SCOPED_LOCK(lock, dlg, pjsip_dlg_inc_lock, pjsip_dlg_dec_lock);
+	
+	dist = pjsip_dlg_get_mod_data(dlg, distributor_mod.id);
 	if (!dist) {
 		dist = distributor_dialog_data_alloc(dlg);
 	}
@@ -72,7 +81,10 @@
 
 struct ast_sip_endpoint *ast_sip_dialog_get_endpoint(pjsip_dialog *dlg)
 {
-	struct distributor_dialog_data *dist = pjsip_dlg_get_mod_data(dlg, distributor_mod.id);
+	struct distributor_dialog_data *dist;
+	SCOPED_LOCK(lock, dlg, pjsip_dlg_inc_lock, pjsip_dlg_dec_lock);
+
+	dist = pjsip_dlg_get_mod_data(dlg, distributor_mod.id);
 	if (!dist || !dist->endpoint) {
 		return NULL;
 	}




More information about the asterisk-commits mailing list