[asterisk-commits] kharwell: branch kharwell/pimp_sip_video r384367 - in /team/kharwell/pimp_sip...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 29 15:06:49 CDT 2013


Author: kharwell
Date: Fri Mar 29 15:06:45 2013
New Revision: 384367

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384367
Log:
Multiple revisions 384201,384219,384261,384302,384327

........
  r384201 | dlee | 2013-03-27 16:52:43 -0500 (Wed, 27 Mar 2013) | 1 line
  
  Added a doxygen group for Stasis messages and topics
........
  r384219 | kmoore | 2013-03-27 17:42:06 -0500 (Wed, 27 Mar 2013) | 2 lines
  
  Convert MWI state message type to the new stasis naming convention
........
  r384261 | kmoore | 2013-03-28 10:45:18 -0500 (Thu, 28 Mar 2013) | 2 lines
  
  Break the world. Stasis message type accessors should now all be named correctly.
........
  r384302 | rmudgett | 2013-03-28 18:59:20 -0500 (Thu, 28 Mar 2013) | 16 lines
  
  Add uuid wrapper API call ast_uuid_generate_str().
  
  * Updated test_uuid.c to test the new API call.
  
  * Made system use the new API call to eliminate "10's of lines" where
  used.
  
  * Fixed untested ast_strdup() return in stasis_subscribe() by eliminating
  the need for it.  struct stasis_subscription now contains the uniqueid[]
  string.
  
  * Fixed some issues in exchangecal_write_event():
    Create uid with enough space for a UUID string to avoid a realloc.
    Fix off by one error if the calendar event provided a UUID string.
    There is no need to check for NULL before calling ast_free().
........
  r384327 | jrose | 2013-03-29 11:37:23 -0500 (Fri, 29 Mar 2013) | 19 lines
  
  app_voicemail: Add blank argument to externnotify if no context argument
  
  At least one call to run_externnotify provides a NULL context parameter and
  because the snprintf statement doesn't account for a NULL context parameter,
  it simply writes '(null)' to the arguments string instead. This patch makes
  it write two quotes back to back for that argument instead in the event of
  a NULL context.
  
  (closes issue ASTERISK-18207)
  Reported by: Barry L. Kline
  Patches:
  	modified from patch-20130306 uploaded by Karsten Wemheuer (License 5930)
  ........
  
  Merged revisions 384325 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 384326 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 384201,384219,384261,384302,384327 from http://svn.asterisk.org/svn/asterisk/trunk

Modified:
    team/kharwell/pimp_sip_video/   (props changed)
    team/kharwell/pimp_sip_video/apps/app_voicemail.c
    team/kharwell/pimp_sip_video/channels/chan_dahdi.c
    team/kharwell/pimp_sip_video/channels/chan_iax2.c
    team/kharwell/pimp_sip_video/channels/chan_mgcp.c
    team/kharwell/pimp_sip_video/channels/chan_sip.c
    team/kharwell/pimp_sip_video/channels/chan_skinny.c
    team/kharwell/pimp_sip_video/channels/chan_unistim.c
    team/kharwell/pimp_sip_video/channels/sig_pri.c
    team/kharwell/pimp_sip_video/include/asterisk/app.h
    team/kharwell/pimp_sip_video/include/asterisk/channel.h
    team/kharwell/pimp_sip_video/include/asterisk/stasis.h
    team/kharwell/pimp_sip_video/include/asterisk/uuid.h
    team/kharwell/pimp_sip_video/main/app.c
    team/kharwell/pimp_sip_video/main/channel.c
    team/kharwell/pimp_sip_video/main/manager_channels.c
    team/kharwell/pimp_sip_video/main/pbx.c
    team/kharwell/pimp_sip_video/main/sorcery.c
    team/kharwell/pimp_sip_video/main/stasis.c
    team/kharwell/pimp_sip_video/main/stasis_cache.c
    team/kharwell/pimp_sip_video/main/uuid.c
    team/kharwell/pimp_sip_video/pbx/pbx_realtime.c
    team/kharwell/pimp_sip_video/res/res_calendar_exchange.c
    team/kharwell/pimp_sip_video/res/res_jabber.c
    team/kharwell/pimp_sip_video/res/res_sorcery_config.c
    team/kharwell/pimp_sip_video/res/res_xmpp.c
    team/kharwell/pimp_sip_video/tests/test_stasis.c
    team/kharwell/pimp_sip_video/tests/test_uuid.c

Propchange: team/kharwell/pimp_sip_video/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Mar 29 15:06:45 2013
@@ -1,1 +1,1 @@
-/trunk:1-384200
+/trunk:1-384366

Modified: team/kharwell/pimp_sip_video/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/apps/app_voicemail.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/apps/app_voicemail.c (original)
+++ team/kharwell/pimp_sip_video/apps/app_voicemail.c Fri Mar 29 15:06:45 2013
@@ -5944,7 +5944,10 @@
 		if (inboxcount2(ext_context, &urgentvoicemails, &newvoicemails, &oldvoicemails)) {
 			ast_log(AST_LOG_ERROR, "Problem in calculating number of voicemail messages available for extension %s\n", extension);
 		} else {
-			snprintf(arguments, sizeof(arguments), "%s %s %s %d %d %d &", externnotify, context, extension, newvoicemails, oldvoicemails, urgentvoicemails);
+			snprintf(arguments, sizeof(arguments), "%s %s %s %d %d %d &",
+				externnotify, S_OR(context, "\"\""),
+				extension, newvoicemails,
+				oldvoicemails, urgentvoicemails);
 			ast_debug(1, "Executing %s\n", arguments);
 			ast_safe_system(arguments);
 		}
@@ -12627,7 +12630,7 @@
 {
 	struct stasis_subscription_change *change;
 	/* Only looking for subscription change notices here */
-	if (stasis_message_type(msg) != stasis_subscription_change()) {
+	if (stasis_message_type(msg) != stasis_subscription_change_type()) {
 		return;
 	}
 
@@ -12656,7 +12659,7 @@
 	mwi_sub_sub = stasis_subscribe(stasis_mwi_topic_all(), mwi_event_cb, NULL);
 
 	if (mwi_sub_sub) {
-		struct ao2_container *cached = stasis_cache_dump(stasis_mwi_topic_cached(), stasis_subscription_change());
+		struct ao2_container *cached = stasis_cache_dump(stasis_mwi_topic_cached(), stasis_subscription_change_type());
 		if (cached) {
 			ao2_callback(cached, OBJ_MULTIPLE | OBJ_NODATA, dump_cache, NULL);
 		}

Modified: team/kharwell/pimp_sip_video/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/chan_dahdi.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/channels/chan_dahdi.c (original)
+++ team/kharwell/pimp_sip_video/channels/chan_dahdi.c Fri Mar 29 15:06:45 2013
@@ -5414,7 +5414,7 @@
 	}
 
 	ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
-	mwi_message = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
+	mwi_message = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
 
 	if (mwi_message) {
 		struct stasis_mwi_state *mwi_state = stasis_message_data(mwi_message);

Modified: team/kharwell/pimp_sip_video/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/chan_iax2.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/channels/chan_iax2.c (original)
+++ team/kharwell/pimp_sip_video/channels/chan_iax2.c Fri Mar 29 15:06:45 2013
@@ -8755,7 +8755,7 @@
 			}
 
 			ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
-			msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
+			msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
 
 			if (msg) {
 				struct stasis_mwi_state *mwi_state = stasis_message_data(msg);

Modified: team/kharwell/pimp_sip_video/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/chan_mgcp.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/channels/chan_mgcp.c (original)
+++ team/kharwell/pimp_sip_video/channels/chan_mgcp.c Fri Mar 29 15:06:45 2013
@@ -507,7 +507,7 @@
 
 	ast_str_set(&uniqueid, 0, "%s@%s", mbox, cntx);
 
-	msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
+	msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
 
 	if (msg) {
 		struct stasis_mwi_state *mwi_state = stasis_message_data(msg);

Modified: team/kharwell/pimp_sip_video/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/chan_sip.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/channels/chan_sip.c (original)
+++ team/kharwell/pimp_sip_video/channels/chan_sip.c Fri Mar 29 15:06:45 2013
@@ -16668,7 +16668,7 @@
 		ao2_cleanup(peer);
 		return;
 	}
-	if (stasis_mwi_state_message() == stasis_message_type(msg)) {
+	if (stasis_mwi_state_type() == stasis_message_type(msg)) {
 		sip_send_mwi_to_peer(peer, 0);
 	}
 }
@@ -28849,7 +28849,7 @@
 		ast_str_reset(uniqueid);
 		ast_str_set(&uniqueid, 0, "%s@%s", mailbox->mailbox, S_OR(mailbox->context, "default"));
 
-		msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
+		msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
 		if (!msg) {
 			continue;
 		}

Modified: team/kharwell/pimp_sip_video/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/chan_skinny.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/channels/chan_skinny.c (original)
+++ team/kharwell/pimp_sip_video/channels/chan_skinny.c Fri Mar 29 15:06:45 2013
@@ -3518,7 +3518,7 @@
 		return;
 	}
 
-	if (msg && stasis_mwi_state_message() == stasis_message_type(msg)) {
+	if (msg && stasis_mwi_state_type() == stasis_message_type(msg)) {
 		struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
 		l->newmsgs = mwi_state->new_msgs;
 	}

Modified: team/kharwell/pimp_sip_video/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/chan_unistim.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/channels/chan_unistim.c (original)
+++ team/kharwell/pimp_sip_video/channels/chan_unistim.c Fri Mar 29 15:06:45 2013
@@ -5513,7 +5513,7 @@
 
 	ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
 
-	msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
+	msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
 
 	if (msg) {
 		struct stasis_mwi_state *mwi_state = stasis_message_data(msg);

Modified: team/kharwell/pimp_sip_video/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/sig_pri.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/channels/sig_pri.c (original)
+++ team/kharwell/pimp_sip_video/channels/sig_pri.c Fri Mar 29 15:06:45 2013
@@ -8768,7 +8768,7 @@
 	int idx;
 	struct stasis_mwi_state *mwi_state;
 
-	if (stasis_mwi_state_message() != stasis_message_type(msg)) {
+	if (stasis_mwi_state_type() != stasis_message_type(msg)) {
 		return;
 	}
 
@@ -8826,7 +8826,7 @@
 		ast_str_reset(uniqueid);
 		ast_str_set(&uniqueid, 0, "%s@%s", pri->mbox[idx].number, pri->mbox[idx].context);
 
-		msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
+		msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
 		if (!msg) {
 			/* No cached event for this mailbox. */
 			continue;

Modified: team/kharwell/pimp_sip_video/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/include/asterisk/app.h?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/include/asterisk/app.h (original)
+++ team/kharwell/pimp_sip_video/include/asterisk/app.h Fri Mar 29 15:06:45 2013
@@ -1120,6 +1120,10 @@
 			int old_msgs,
 			struct ast_eid *eid);
 
+/*! \addtogroup StasisTopicsAndMessages
+ * @{
+ */
+
 /*!
  * \brief The structure that contains MWI state
  * \since 12
@@ -1166,7 +1170,9 @@
  * \retval NULL if it has not been allocated
  * \since 12
  */
-struct stasis_message_type *stasis_mwi_state_message(void);
+struct stasis_message_type *stasis_mwi_state_type(void);
+
+/*! @} */
 
 /*!
  * \brief Initialize the application core

Modified: team/kharwell/pimp_sip_video/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/include/asterisk/channel.h?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/include/asterisk/channel.h (original)
+++ team/kharwell/pimp_sip_video/include/asterisk/channel.h Fri Mar 29 15:06:45 2013
@@ -4106,6 +4106,31 @@
 
 /*!
  * \since 12
+ * \brief Sets the variables to be stored in the \a manager_vars field of all
+ * snapshots.
+ * \param varc Number of variable names.
+ * \param vars Array of variable names.
+ */
+void ast_channel_set_manager_vars(size_t varc, char **vars);
+
+/*!
+ * \since 12
+ * \brief Gets the variables for a given channel, as specified by ast_channel_set_manager_vars().
+ *
+ * The returned variable list is an AO2 object, so ao2_cleanup() to free it.
+ *
+ * \param chan Channel to get variables for.
+ * \return List of channel variables.
+ * \return \c NULL on error
+ */
+struct varshead *ast_channel_get_manager_vars(struct ast_channel *chan);
+
+/*! \addtogroup StasisTopicsAndMessages
+ * @{
+ */
+
+/*!
+ * \since 12
  * \brief Structure representing a snapshot of channel state.
  *
  * While not enforced programmatically, this object is shared across multiple
@@ -4157,32 +4182,11 @@
 
 /*!
  * \since 12
- * \brief Sets the variables to be stored in the \a manager_vars field of all
- * snapshots.
- * \param varc Number of variable names.
- * \param vars Array of variable names.
- */
-void ast_channel_set_manager_vars(size_t varc, char **vars);
-
-/*!
- * \since 12
- * \brief Gets the variables for a given channel, as specified by ast_channel_set_manager_vars().
- *
- * The returned variable list is an AO2 object, so ao2_cleanup() to free it.
- *
- * \param chan Channel to get variables for.
- * \return List of channel variables.
- * \return \c NULL on error
- */
-struct varshead *ast_channel_get_manager_vars(struct ast_channel *chan);
-
-/*!
- * \since 12
  * \brief Message type for \ref ast_channel_snapshot.
  *
  * \retval Message type for \ref ast_channel_snapshot.
  */
-struct stasis_message_type *ast_channel_snapshot(void);
+struct stasis_message_type *ast_channel_snapshot_type(void);
 
 /*!
  * \since 12
@@ -4233,7 +4237,7 @@
  *
  * \retval Message type for \ref ast_channel_blob messages.
  */
-struct stasis_message_type *ast_channel_blob(void);
+struct stasis_message_type *ast_channel_blob_type(void);
 
 /*!
  * \since 12
@@ -4243,7 +4247,7 @@
  * \return Type field value from the blob.
  * \return \c NULL on error.
  */
-const char *ast_channel_blob_type(struct ast_channel_blob *obj);
+const char *ast_channel_blob_json_type(struct ast_channel_blob *obj);
 
 /*!
  * \since 12
@@ -4261,6 +4265,8 @@
 struct stasis_message *ast_channel_blob_create(struct ast_channel *chan,
 					       struct ast_json *blob);
 
+/*! @} */
+
 /*!
  * \since 12
  * \brief Publish a \ref ast_channel_varset for a channel.

Modified: team/kharwell/pimp_sip_video/include/asterisk/stasis.h
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/include/asterisk/stasis.h?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/include/asterisk/stasis.h (original)
+++ team/kharwell/pimp_sip_video/include/asterisk/stasis.h Fri Mar 29 15:06:45 2013
@@ -356,6 +356,10 @@
  */
 int stasis_subscription_final_message(struct stasis_subscription *sub, struct stasis_message *msg);
 
+/*! \addtogroup StasisTopicsAndMessages
+ * @{
+ */
+
 /*!
  * \brief Holds details about changes to subscriptions for the specified topic
  * \since 12
@@ -373,7 +377,9 @@
  * \return The stasis_message_type for subscription change notices
  * \since 12
  */
-struct stasis_message_type *stasis_subscription_change(void);
+struct stasis_message_type *stasis_subscription_change_type(void);
+
+/*! @} */
 
 /*!
  * \brief Pool for topic aggregation
@@ -398,20 +404,16 @@
 
 /*! @} */
 
-/*! @{ */
-
-/*!
- * \brief A topic wrapper, which caches certain messages.
- * \since 12
- */
-struct stasis_caching_topic;
+/*! \addtogroup StasisTopicsAndMessages
+ * @{
+ */
 
 /*!
  * \brief Message type for cache update messages.
  * \return Message type for cache update messages.
  * \since 12
  */
-struct stasis_message_type *stasis_cache_update(void);
+struct stasis_message_type *stasis_cache_update_type(void);
 
 /*!
  * \brief Cache update message
@@ -438,6 +440,16 @@
  */
 struct stasis_message *stasis_cache_clear_create(struct stasis_message_type *type, const char *id);
 
+/*! @} */
+
+/*! @{ */
+
+/*!
+ * \brief A topic wrapper, which caches certain messages.
+ * \since 12
+ */
+struct stasis_caching_topic;
+
 /*!
  * \brief Callback extract a unique identity from a snapshot message.
  *
@@ -533,4 +545,11 @@
 
 /*! @} */
 
+/*!
+ * \defgroup StasisTopicsAndMessages Stasis topics, and their messages.
+ *
+ * This group contains the topics, messages and corresponding message types
+ * found within Asterisk.
+ */
+
 #endif /* _ASTERISK_STASIS_H */

Modified: team/kharwell/pimp_sip_video/include/asterisk/uuid.h
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/include/asterisk/uuid.h?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/include/asterisk/uuid.h (original)
+++ team/kharwell/pimp_sip_video/include/asterisk/uuid.h Fri Mar 29 15:06:45 2013
@@ -24,7 +24,7 @@
 #define _ASTERISK_UUID_H
 
 /* Size of an RFC 4122 UUID string plus terminating null byte */
-#define AST_UUID_STR_LEN 37
+#define AST_UUID_STR_LEN (36 + 1)
 
 struct ast_uuid;
 
@@ -50,9 +50,20 @@
  * \param uuid The UUID to convert to a string
  * \param[out] buf The buffer where the UUID string will be stored
  * \param size The size of the buffer. Must be at least AST_UUID_STR_LEN.
- * \returns The UUID string (a pointer to buf)
+ * \return The UUID string (a pointer to buf)
  */
 char *ast_uuid_to_str(const struct ast_uuid *uuid, char *buf, size_t size);
+
+/*!
+ * \brief Generate a UUID string.
+ * \since 12.0.0
+ *
+ * \param buf The buffer where the UUID string will be stored
+ * \param size The size of the buffer. Must be at least AST_UUID_STR_LEN.
+ *
+ * \return The UUID string (a pointer to buf)
+ */
+char *ast_uuid_generate_str(char *buf, size_t size);
 
 /*!
  * \brief Convert a string to a UUID

Modified: team/kharwell/pimp_sip_video/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/main/app.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/main/app.c (original)
+++ team/kharwell/pimp_sip_video/main/app.c Fri Mar 29 15:06:45 2013
@@ -84,7 +84,7 @@
 
 static struct stasis_topic *mwi_topic_all;
 static struct stasis_caching_topic *mwi_topic_cached;
-static struct stasis_message_type *mwi_message_type;
+static struct stasis_message_type *mwi_state_type;
 static struct stasis_topic_pool *mwi_topic_pool;
 
 static void *shaun_of_the_dead(void *data)
@@ -2659,9 +2659,9 @@
 	return mwi_topic_cached;
 }
 
-struct stasis_message_type *stasis_mwi_state_message(void)
-{
-	return mwi_message_type;
+struct stasis_message_type *stasis_mwi_state_type(void)
+{
+	return mwi_state_type;
 }
 
 struct stasis_topic *stasis_mwi_topic(const char *uniqueid)
@@ -2702,7 +2702,7 @@
 		ast_set_default_eid(&mwi_state->eid);
 	}
 
-	message = stasis_message_create(stasis_mwi_state_message(), mwi_state);
+	message = stasis_message_create(stasis_mwi_state_type(), mwi_state);
 
 	mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
 	if (!mailbox_specific_topic) {
@@ -2716,10 +2716,10 @@
 
 static const char *mwi_state_get_id(struct stasis_message *message)
 {
-	if (stasis_mwi_state_message() == stasis_message_type(message)) {
+	if (stasis_mwi_state_type() == stasis_message_type(message)) {
 		struct stasis_mwi_state *mwi_state = stasis_message_data(message);
 		return mwi_state->uniqueid;
-	} else if (stasis_subscription_change() == stasis_message_type(message)) {
+	} else if (stasis_subscription_change_type() == stasis_message_type(message)) {
 		struct stasis_subscription_change *change = stasis_message_data(message);
 		return change->uniqueid;
 	}
@@ -2732,8 +2732,8 @@
 	ao2_cleanup(mwi_topic_all);
 	mwi_topic_all = NULL;
 	mwi_topic_cached = stasis_caching_unsubscribe(mwi_topic_cached);
-	ao2_cleanup(mwi_message_type);
-	mwi_message_type = NULL;
+	ao2_cleanup(mwi_state_type);
+	mwi_state_type = NULL;
 	ao2_cleanup(mwi_topic_pool);
 	mwi_topic_pool = NULL;
 }
@@ -2748,8 +2748,8 @@
 	if (!mwi_topic_cached) {
 		return -1;
 	}
-	mwi_message_type = stasis_message_type_create("stasis_mwi_state");
-	if (!mwi_message_type) {
+	mwi_state_type = stasis_message_type_create("stasis_mwi_state");
+	if (!mwi_state_type) {
 		return -1;
 	}
 	mwi_topic_pool = stasis_topic_pool_create(mwi_topic_all);

Modified: team/kharwell/pimp_sip_video/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/main/channel.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/main/channel.c (original)
+++ team/kharwell/pimp_sip_video/main/channel.c Fri Mar 29 15:06:45 2013
@@ -153,13 +153,13 @@
 static struct ao2_container *channels;
 
 /*! \brief Message type for channel snapshot events */
-static struct stasis_message_type *__channel_snapshot;
-
-static struct stasis_message_type *__channel_blob;
-
-struct stasis_topic *__channel_topic_all;
-
-struct stasis_caching_topic *__channel_topic_all_cached;
+static struct stasis_message_type *channel_snapshot_type;
+
+static struct stasis_message_type *channel_blob_type;
+
+struct stasis_topic *channel_topic_all;
+
+struct stasis_caching_topic *channel_topic_all_cached;
 
 /*! \brief map AST_CAUSE's to readable string representations
  *
@@ -234,7 +234,7 @@
 		return;
 	}
 
-	message = stasis_message_create(ast_channel_snapshot(), snapshot);
+	message = stasis_message_create(ast_channel_snapshot_type(), snapshot);
 	if (!message) {
 		return;
 	}
@@ -291,7 +291,7 @@
 
 	obj->blob = ast_json_ref(blob);
 
-	msg = stasis_message_create(ast_channel_blob(), obj);
+	msg = stasis_message_create(ast_channel_blob_type(), obj);
 	if (!msg) {
 		return NULL;
 	}
@@ -300,7 +300,7 @@
 	return msg;
 }
 
-const char *ast_channel_blob_type(struct ast_channel_blob *obj)
+const char *ast_channel_blob_json_type(struct ast_channel_blob *obj)
 {
 	if (obj == NULL) {
 		return NULL;
@@ -329,7 +329,7 @@
 {
 	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
 
-	message = stasis_cache_clear_create(ast_channel_snapshot(), ast_channel_uniqueid(chan));
+	message = stasis_cache_clear_create(ast_channel_snapshot_type(), ast_channel_uniqueid(chan));
 	stasis_publish(ast_channel_topic(chan), message);
 }
 
@@ -8701,13 +8701,13 @@
 static void channels_shutdown(void)
 {
 	free_channelvars();
-	ao2_cleanup(__channel_snapshot);
-	__channel_snapshot = NULL;
-	ao2_cleanup(__channel_blob);
-	__channel_blob = NULL;
-	ao2_cleanup(__channel_topic_all);
-	__channel_topic_all = NULL;
-	__channel_topic_all_cached = stasis_caching_unsubscribe(__channel_topic_all_cached);
+	ao2_cleanup(channel_snapshot_type);
+	channel_snapshot_type = NULL;
+	ao2_cleanup(channel_blob_type);
+	channel_blob_type = NULL;
+	ao2_cleanup(channel_topic_all);
+	channel_topic_all = NULL;
+	channel_topic_all_cached = stasis_caching_unsubscribe(channel_topic_all_cached);
 	ast_data_unregister(NULL);
 	ast_cli_unregister_multiple(cli_channel, ARRAY_LEN(cli_channel));
 	if (channels) {
@@ -8720,7 +8720,7 @@
 static const char *channel_snapshot_get_id(struct stasis_message *message)
 {
 	struct ast_channel_snapshot *snapshot;
-	if (ast_channel_snapshot() != stasis_message_type(message)) {
+	if (ast_channel_snapshot_type() != stasis_message_type(message)) {
 		return NULL;
 	}
 	snapshot = stasis_message_data(message);
@@ -8735,11 +8735,11 @@
 		ao2_container_register("channels", channels, prnt_channel_key);
 	}
 
-	__channel_snapshot = stasis_message_type_create("ast_channel_snapshot");
-	__channel_blob = stasis_message_type_create("ast_channel_blob");
-
-	__channel_topic_all = stasis_topic_create("ast_channel_topic_all");
-	__channel_topic_all_cached = stasis_caching_topic_create(__channel_topic_all, channel_snapshot_get_id);
+	channel_snapshot_type = stasis_message_type_create("ast_channel_snapshot");
+	channel_blob_type = stasis_message_type_create("ast_channel_blob");
+
+	channel_topic_all = stasis_topic_create("ast_channel_topic_all");
+	channel_topic_all_cached = stasis_caching_topic_create(channel_topic_all, channel_snapshot_get_id);
 
 	ast_cli_register_multiple(cli_channel, ARRAY_LEN(cli_channel));
 
@@ -11379,24 +11379,24 @@
 	return snapshot;
 }
 
-struct stasis_message_type *ast_channel_blob(void)
-{
-	return __channel_blob;
-}
-
-struct stasis_message_type *ast_channel_snapshot(void)
-{
-	return __channel_snapshot;
+struct stasis_message_type *ast_channel_blob_type(void)
+{
+	return channel_blob_type;
+}
+
+struct stasis_message_type *ast_channel_snapshot_type(void)
+{
+	return channel_snapshot_type;
 }
 
 struct stasis_topic *ast_channel_topic_all(void)
 {
-	return __channel_topic_all;
+	return channel_topic_all;
 }
 
 struct stasis_caching_topic *ast_channel_topic_all_cached(void)
 {
-	return __channel_topic_all_cached;
+	return channel_topic_all_cached;
 }
 
 /* DO NOT PUT ADDITIONAL FUNCTIONS BELOW THIS BOUNDARY

Modified: team/kharwell/pimp_sip_video/main/manager_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/main/manager_channels.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/main/manager_channels.c (original)
+++ team/kharwell/pimp_sip_video/main/manager_channels.c Fri Mar 29 15:06:45 2013
@@ -441,7 +441,7 @@
 
 	update = stasis_message_data(message);
 
-	if (ast_channel_snapshot() != update->type) {
+	if (ast_channel_snapshot_type() != update->type) {
 		return;
 	}
 
@@ -593,11 +593,11 @@
 {
 	struct ast_channel_blob *obj = stasis_message_data(message);
 
-	if (strcmp("varset", ast_channel_blob_type(obj)) == 0) {
+	if (strcmp("varset", ast_channel_blob_json_type(obj)) == 0) {
 		channel_varset(obj);
-	} else if (strcmp("userevent", ast_channel_blob_type(obj)) == 0) {
+	} else if (strcmp("userevent", ast_channel_blob_json_type(obj)) == 0) {
 		channel_userevent(obj);
-	} else if (strcmp("hangup_request", ast_channel_blob_type(obj)) == 0) {
+	} else if (strcmp("hangup_request", ast_channel_blob_json_type(obj)) == 0) {
 		channel_hangup_request(obj);
 	}
 }
@@ -627,12 +627,12 @@
 	}
 
 	ret |= stasis_message_router_add(channel_state_router,
-					 stasis_cache_update(),
+					 stasis_cache_update_type(),
 					 channel_snapshot_update,
 					 NULL);
 
 	ret |= stasis_message_router_add(channel_state_router,
-					 ast_channel_blob(),
+					 ast_channel_blob_type(),
 					 channel_blob_cb,
 					 NULL);
 

Modified: team/kharwell/pimp_sip_video/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/main/pbx.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/main/pbx.c (original)
+++ team/kharwell/pimp_sip_video/main/pbx.c Fri Mar 29 15:06:45 2013
@@ -4708,7 +4708,7 @@
 				 */
 				ast_string_field_set(snapshot, appl, app->name);
 				ast_string_field_set(snapshot, data, passdata);
-				msg = stasis_message_create(ast_channel_snapshot(), snapshot);
+				msg = stasis_message_create(ast_channel_snapshot_type(), snapshot);
 				if (msg) {
 					stasis_publish(ast_channel_topic(c), msg);
 				}

Modified: team/kharwell/pimp_sip_video/main/sorcery.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/main/sorcery.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/main/sorcery.c (original)
+++ team/kharwell/pimp_sip_video/main/sorcery.c Fri Mar 29 15:06:45 2013
@@ -807,15 +807,7 @@
 	}
 
 	if (ast_strlen_zero(id)) {
-		struct ast_uuid *uuid = ast_uuid_generate();
-
-		if (!uuid) {
-			ao2_ref(details, -1);
-			return NULL;
-		}
-
-		ast_uuid_to_str(uuid, details->id, AST_UUID_STR_LEN);
-		ast_free(uuid);
+		ast_uuid_generate_str(details->id, sizeof(details->id));
 	} else {
 		ast_copy_string(details->id, id, sizeof(details->id));
 	}

Modified: team/kharwell/pimp_sip_video/main/stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/main/stasis.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/main/stasis.c (original)
+++ team/kharwell/pimp_sip_video/main/stasis.c Fri Mar 29 15:06:45 2013
@@ -106,7 +106,7 @@
 /*! \internal */
 struct stasis_subscription {
 	/*! Unique ID for this subscription */
-	char *uniqueid;
+	char uniqueid[AST_UUID_STR_LEN];
 	/*! Topic subscribed to. */
 	struct stasis_topic *topic;
 	/*! Mailbox for processing incoming messages. */
@@ -121,8 +121,6 @@
 {
 	struct stasis_subscription *sub = obj;
 	ast_assert(!stasis_subscription_is_subscribed(sub));
-	ast_free(sub->uniqueid);
-	sub->uniqueid = NULL;
 	ao2_cleanup(sub->topic);
 	sub->topic = NULL;
 	ast_taskprocessor_unreference(sub->mailbox);
@@ -134,27 +132,19 @@
 struct stasis_subscription *stasis_subscribe(struct stasis_topic *topic, stasis_subscription_cb callback, void *data)
 {
 	RAII_VAR(struct stasis_subscription *, sub, NULL, ao2_cleanup);
-	RAII_VAR(struct ast_uuid *, id, NULL, ast_free);
-	char uniqueid[AST_UUID_STR_LEN];
 
 	sub = ao2_alloc(sizeof(*sub), subscription_dtor);
 	if (!sub) {
 		return NULL;
 	}
 
-	id = ast_uuid_generate();
-	if (!id) {
-		ast_log(LOG_ERROR, "UUID generation failed\n");
-		return NULL;
-	}
-	ast_uuid_to_str(id, uniqueid, sizeof(uniqueid));
-
-	sub->mailbox = ast_threadpool_serializer(uniqueid, pool);
+	ast_uuid_generate_str(sub->uniqueid, sizeof(sub->uniqueid));
+
+	sub->mailbox = ast_threadpool_serializer(sub->uniqueid, pool);
 	if (!sub->mailbox) {
 		return NULL;
 	}
 
-	sub->uniqueid = ast_strdup(uniqueid);
 	ao2_ref(topic, +1);
 	sub->topic = topic;
 	sub->callback = callback;
@@ -163,7 +153,7 @@
 	if (topic_add_subscription(topic, sub) != 0) {
 		return NULL;
 	}
-	send_subscription_change_message(topic, uniqueid, "Subscribe");
+	send_subscription_change_message(topic, sub->uniqueid, "Subscribe");
 
 	ao2_ref(sub, +1);
 	return sub;
@@ -217,7 +207,7 @@
 int stasis_subscription_final_message(struct stasis_subscription *sub, struct stasis_message *msg)
 {
 	struct stasis_subscription_change *change;
-	if (stasis_message_type(msg) != stasis_subscription_change()) {
+	if (stasis_message_type(msg) != stasis_subscription_change_type()) {
 		return 0;
 	}
 
@@ -413,7 +403,7 @@
 	return change;
 }
 
-struct stasis_message_type *stasis_subscription_change(void)
+struct stasis_message_type *stasis_subscription_change_type(void)
 {
 	return __subscription_change_message_type;
 }
@@ -429,7 +419,7 @@
 		return;
 	}
 
-	msg = stasis_message_create(stasis_subscription_change(), change);
+	msg = stasis_message_create(stasis_subscription_change_type(), change);
 
 	if (!msg) {
 		return;

Modified: team/kharwell/pimp_sip_video/main/stasis_cache.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/main/stasis_cache.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/main/stasis_cache.c (original)
+++ team/kharwell/pimp_sip_video/main/stasis_cache.c Fri Mar 29 15:06:45 2013
@@ -250,7 +250,7 @@
 
 static struct stasis_message_type *__cache_update;
 
-struct stasis_message_type *stasis_cache_update(void)
+struct stasis_message_type *stasis_cache_update_type(void)
 {
 	ast_assert(__cache_update != NULL);
 	return __cache_update;
@@ -340,7 +340,7 @@
 		update->type = stasis_message_type(new_snapshot);
 	}
 
-	msg = stasis_message_create(stasis_cache_update(), update);
+	msg = stasis_message_create(stasis_cache_update_type(), update);
 	if (!msg) {
 		return NULL;
 	}

Modified: team/kharwell/pimp_sip_video/main/uuid.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/main/uuid.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/main/uuid.c (original)
+++ team/kharwell/pimp_sip_video/main/uuid.c Fri Mar 29 15:06:45 2013
@@ -38,13 +38,17 @@
 	uuid_t uu;
 };
 
-struct ast_uuid *ast_uuid_generate(void)
-{
-	struct ast_uuid *uuid = ast_malloc(sizeof(*uuid));
-
-	if (!uuid) {
-		return NULL;
-	}
+/*!
+ * \internal
+ * \brief Generate a UUID.
+ * \since 12.0.0
+ *
+ * \param uuid Fill this with a generated UUID.
+ *
+ * \return Nothing
+ */
+static void generate_uuid(struct ast_uuid *uuid)
+{
 	/* libuuid provides three methods of generating uuids,
 	 * uuid_generate(), uuid_generate_random(), and uuid_generate_time().
 	 *
@@ -114,6 +118,16 @@
 	if (!has_dev_urandom) {
 		ast_mutex_unlock(&uuid_lock);
 	}
+}
+
+struct ast_uuid *ast_uuid_generate(void)
+{
+	struct ast_uuid *uuid = ast_malloc(sizeof(*uuid));
+
+	if (!uuid) {
+		return NULL;
+	}
+	generate_uuid(uuid);
 	return uuid;
 }
 
@@ -124,10 +138,19 @@
 	return buf;
 }
 
+char *ast_uuid_generate_str(char *buf, size_t size)
+{
+	struct ast_uuid uuid;
+
+	generate_uuid(&uuid);
+	return ast_uuid_to_str(&uuid, buf, size);
+}
+
 struct ast_uuid *ast_str_to_uuid(const char *str)
 {
 	struct ast_uuid *uuid = ast_malloc(sizeof(*uuid));
 	int res;
+
 	if (!uuid) {
 		return NULL;
 	}
@@ -143,6 +166,7 @@
 struct ast_uuid *ast_uuid_copy(const struct ast_uuid *src)
 {
 	struct ast_uuid *dst = ast_malloc(sizeof(*dst));
+
 	if (!dst) {
 		return NULL;
 	}
@@ -202,5 +226,4 @@
 	uuid_generate_random(uu);
 
 	ast_debug(1, "UUID system initiated\n");
-	return;
-}
+}

Modified: team/kharwell/pimp_sip_video/pbx/pbx_realtime.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/pbx/pbx_realtime.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/pbx/pbx_realtime.c (original)
+++ team/kharwell/pimp_sip_video/pbx/pbx_realtime.c Fri Mar 29 15:06:45 2013
@@ -363,7 +363,7 @@
 					 */
 					ast_string_field_set(snapshot, appl, app);
 					ast_string_field_set(snapshot, data, !ast_strlen_zero(appdata) ? appdata : "(NULL)");
-					msg = stasis_message_create(ast_channel_snapshot(), snapshot);
+					msg = stasis_message_create(ast_channel_snapshot_type(), snapshot);
 					if (msg) {
 						stasis_publish(ast_channel_topic(chan), msg);
 					}

Modified: team/kharwell/pimp_sip_video/res/res_calendar_exchange.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/res/res_calendar_exchange.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/res/res_calendar_exchange.c (original)
+++ team/kharwell/pimp_sip_video/res/res_calendar_exchange.c Fri Mar 29 15:06:45 2013
@@ -243,17 +243,9 @@
 static struct ast_str *generate_exchange_uuid(struct ast_str *uid)
 {
 	char buffer[AST_UUID_STR_LEN];
-	struct ast_uuid *uuid = ast_uuid_generate();
-
-	if (!uuid) {
-		ast_str_set(&uid, 0, "%s", "");
-		return uid;
-	}
-
-	ast_str_set(&uid, 0, "%s", ast_uuid_to_str(uuid, buffer, AST_UUID_STR_LEN));
-
-	ast_free(uuid);
-
+
+	ast_uuid_generate_str(buffer, sizeof(buffer));
+	ast_str_set(&uid, 0, "%s", buffer);
 	return uid;
 }
 
@@ -414,9 +406,17 @@
 
 static int exchangecal_write_event(struct ast_calendar_event *event)
 {
-	struct ast_str *body = NULL, *response = NULL, *subdir = NULL;
-	struct ast_str *uid = NULL, *summary = NULL, *description = NULL, *organizer = NULL,
-	               *location = NULL, *start = NULL, *end = NULL, *busystate = NULL;
+	struct ast_str *body = NULL;
+	struct ast_str *response = NULL;
+	struct ast_str *subdir = NULL;
+	struct ast_str *uid = NULL;
+	struct ast_str *summary = NULL;
+	struct ast_str *description = NULL;
+	struct ast_str *organizer = NULL;
+	struct ast_str *location = NULL;
+	struct ast_str *start = NULL;
+	struct ast_str *end = NULL;
+	struct ast_str *busystate = NULL;
 	int ret = -1;
 
 	if (!event) {
@@ -434,7 +434,7 @@
 		goto write_cleanup;
 	}
 
-	if (!(uid = ast_str_create(32)) ||
+	if (!(uid = ast_str_create(AST_UUID_STR_LEN)) ||
 		!(summary = ast_str_create(32)) ||
 		!(description = ast_str_create(32)) ||
 		!(organizer = ast_str_create(32)) ||
@@ -449,7 +449,7 @@
 	if (ast_strlen_zero(event->uid)) {
 		uid = generate_exchange_uuid(uid);
 	} else {
-		ast_str_set(&uid, 36, "%s", event->uid);
+		ast_str_set(&uid, AST_UUID_STR_LEN, "%s", event->uid);
 	}
 
 	if (!is_valid_uuid(uid)) {
@@ -496,7 +496,14 @@
 		"      </a:prop>\n"
 		"    </a:set>\n"
 		"</a:propertyupdate>\n",
-		ast_str_buffer(uid), ast_str_buffer(summary), ast_str_buffer(description), ast_str_buffer(organizer), ast_str_buffer(location), ast_str_buffer(start), ast_str_buffer(end), ast_str_buffer(busystate));
+		ast_str_buffer(uid),
+		ast_str_buffer(summary),
+		ast_str_buffer(description),
+		ast_str_buffer(organizer),
+		ast_str_buffer(location),
+		ast_str_buffer(start),
+		ast_str_buffer(end),
+		ast_str_buffer(busystate));
 	ast_verb(0, "\n\n%s\n\n", ast_str_buffer(body));
 	ast_str_set(&subdir, 0, "/Calendar/%s.eml", ast_str_buffer(uid));
 
@@ -505,39 +512,17 @@
 	}
 
 write_cleanup:
-	if (uid) {
-		ast_free(uid);
-	}
-	if (summary) {
-		ast_free(summary);
-	}
-	if (description) {
-		ast_free(description);
-	}
-	if (organizer) {
-		ast_free(organizer);
-	}
-	if (location) {
-		ast_free(location);
-	}
-	if (start) {
-		ast_free(start);
-	}
-	if (end) {
-		ast_free(end);
-	}
-	if (busystate) {
-		ast_free(busystate);
-	}
-	if (body) {
-		ast_free(body);
-	}
-	if (response) {
-		ast_free(response);
-	}
-	if (subdir) {
-		ast_free(subdir);
-	}
+	ast_free(uid);
+	ast_free(summary);
+	ast_free(description);
+	ast_free(organizer);
+	ast_free(location);
+	ast_free(start);
+	ast_free(end);
+	ast_free(busystate);
+	ast_free(body);
+	ast_free(response);
+	ast_free(subdir);
 
 	return ret;
 }

Modified: team/kharwell/pimp_sip_video/res/res_jabber.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/res/res_jabber.c?view=diff&rev=384367&r1=384366&r2=384367
==============================================================================
--- team/kharwell/pimp_sip_video/res/res_jabber.c (original)
+++ team/kharwell/pimp_sip_video/res/res_jabber.c Fri Mar 29 15:06:45 2013
@@ -3249,7 +3249,7 @@
 	struct aji_client *client = data;
 	struct stasis_mwi_state *mwi_state;
 

[... 141 lines stripped ...]



More information about the asterisk-commits mailing list