[asterisk-commits] kmoore: branch kmoore/stasis-bridge_events r385980 - in /team/kmoore/stasis-b...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Apr 17 13:41:25 CDT 2013
Author: kmoore
Date: Wed Apr 17 13:41:22 2013
New Revision: 385980
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385980
Log:
Factor out some common functions
........
Merged revisions 385978 from http://svn.asterisk.org/svn/asterisk/team/kmoore/stasis-bridging-channel_events
Modified:
team/kmoore/stasis-bridge_events/ (props changed)
team/kmoore/stasis-bridge_events/include/asterisk/stasis_channels.h
team/kmoore/stasis-bridge_events/main/manager_channels.c
team/kmoore/stasis-bridge_events/main/stasis_channels.c
team/kmoore/stasis-bridge_events/res/res_stasis.c
Propchange: team/kmoore/stasis-bridge_events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr 17 13:41:22 2013
@@ -1,1 +1,1 @@
-/team/kmoore/stasis-bridging-channel_events:1-385977
+/team/kmoore/stasis-bridging-channel_events:1-385979
Modified: team/kmoore/stasis-bridge_events/include/asterisk/stasis_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/include/asterisk/stasis_channels.h?view=diff&rev=385980&r1=385979&r2=385980
==============================================================================
--- team/kmoore/stasis-bridge_events/include/asterisk/stasis_channels.h (original)
+++ team/kmoore/stasis-bridge_events/include/asterisk/stasis_channels.h Wed Apr 17 13:41:22 2013
@@ -299,6 +299,34 @@
struct ast_json *ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot);
/*!
+ * \brief Compares the context, exten and priority of two snapshots.
+ * \since 12
+ *
+ * \param old_snapshot Old snapshot
+ * \param new_snapshot New snapshot
+ *
+ * \return True (non-zero) if context, exten or priority are identical.
+ * \return False (zero) if context, exten and priority changed.
+ */
+int ast_channel_snapshot_cep_equal(
+ const struct ast_channel_snapshot *old_snapshot,
+ const struct ast_channel_snapshot *new_snapshot);
+
+/*!
+ * \brief Compares the callerid info of two snapshots.
+ * \since 12
+ *
+ * \param old_snapshot Old snapshot
+ * \param new_snapshot New snapshot
+ *
+ * \return True (non-zero) if callerid are identical.
+ * \return False (zero) if callerid changed.
+ */
+int ast_channel_snapshot_caller_id_equal(
+ const struct ast_channel_snapshot *old_snapshot,
+ const struct ast_channel_snapshot *new_snapshot);
+
+/*!
* \brief Dispose of the stasis channel topics and message types
*/
void ast_stasis_channels_shutdown(void);
Modified: team/kmoore/stasis-bridge_events/main/manager_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/manager_channels.c?view=diff&rev=385980&r1=385979&r2=385980
==============================================================================
--- team/kmoore/stasis-bridge_events/main/manager_channels.c (original)
+++ team/kmoore/stasis-bridge_events/main/manager_channels.c Wed Apr 17 13:41:22 2013
@@ -337,34 +337,6 @@
return NULL;
}
-/*!
- * \brief Compares the context, exten and priority of two snapshots.
- * \param old_snapshot Old snapshot
- * \param new_snapshot New snapshot
- * \return True (non-zero) if context, exten or priority are identical.
- * \return False (zero) if context, exten and priority changed.
- */
-static inline int cep_equal(
- const struct ast_channel_snapshot *old_snapshot,
- const struct ast_channel_snapshot *new_snapshot)
-{
- ast_assert(old_snapshot != NULL);
- ast_assert(new_snapshot != NULL);
-
- /* We actually get some snapshots with CEP set, but before the
- * application is set. Since empty application is invalid, we treat
- * setting the application from nothing as a CEP change.
- */
- if (ast_strlen_zero(old_snapshot->appl) &&
- !ast_strlen_zero(new_snapshot->appl)) {
- return 0;
- }
-
- return old_snapshot->priority == new_snapshot->priority &&
- strcmp(old_snapshot->context, new_snapshot->context) == 0 &&
- strcmp(old_snapshot->exten, new_snapshot->exten) == 0;
-}
-
static struct ast_manager_event_blob *channel_newexten(
struct ast_channel_snapshot *old_snapshot,
struct ast_channel_snapshot *new_snapshot)
@@ -379,7 +351,7 @@
return NULL;
}
- if (old_snapshot && cep_equal(old_snapshot, new_snapshot)) {
+ if (old_snapshot && ast_channel_snapshot_cep_equal(old_snapshot, new_snapshot)) {
return NULL;
}
@@ -394,23 +366,6 @@
new_snapshot->data);
}
-/*!
- * \brief Compares the callerid info of two snapshots.
- * \param old_snapshot Old snapshot
- * \param new_snapshot New snapshot
- * \return True (non-zero) if callerid are identical.
- * \return False (zero) if callerid changed.
- */
-static inline int caller_id_equal(
- const struct ast_channel_snapshot *old_snapshot,
- const struct ast_channel_snapshot *new_snapshot)
-{
- ast_assert(old_snapshot != NULL);
- ast_assert(new_snapshot != NULL);
- return strcmp(old_snapshot->caller_number, new_snapshot->caller_number) == 0 &&
- strcmp(old_snapshot->caller_name, new_snapshot->caller_name) == 0;
-}
-
static struct ast_manager_event_blob *channel_new_callerid(
struct ast_channel_snapshot *old_snapshot,
struct ast_channel_snapshot *new_snapshot)
@@ -420,7 +375,7 @@
return NULL;
}
- if (caller_id_equal(old_snapshot, new_snapshot)) {
+ if (ast_channel_snapshot_caller_id_equal(old_snapshot, new_snapshot)) {
return NULL;
}
Modified: team/kmoore/stasis-bridge_events/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/stasis_channels.c?view=diff&rev=385980&r1=385979&r2=385980
==============================================================================
--- team/kmoore/stasis-bridge_events/main/stasis_channels.c (original)
+++ team/kmoore/stasis-bridge_events/main/stasis_channels.c Wed Apr 17 13:41:22 2013
@@ -489,6 +489,37 @@
return ast_json_ref(json_chan);
}
+int ast_channel_snapshot_cep_equal(
+ const struct ast_channel_snapshot *old_snapshot,
+ const struct ast_channel_snapshot *new_snapshot)
+{
+ ast_assert(old_snapshot != NULL);
+ ast_assert(new_snapshot != NULL);
+
+ /* We actually get some snapshots with CEP set, but before the
+ * application is set. Since empty application is invalid, we treat
+ * setting the application from nothing as a CEP change.
+ */
+ if (ast_strlen_zero(old_snapshot->appl) &&
+ !ast_strlen_zero(new_snapshot->appl)) {
+ return 0;
+ }
+
+ return old_snapshot->priority == new_snapshot->priority &&
+ strcmp(old_snapshot->context, new_snapshot->context) == 0 &&
+ strcmp(old_snapshot->exten, new_snapshot->exten) == 0;
+}
+
+int ast_channel_snapshot_caller_id_equal(
+ const struct ast_channel_snapshot *old_snapshot,
+ const struct ast_channel_snapshot *new_snapshot)
+{
+ ast_assert(old_snapshot != NULL);
+ ast_assert(new_snapshot != NULL);
+ return strcmp(old_snapshot->caller_number, new_snapshot->caller_number) == 0 &&
+ strcmp(old_snapshot->caller_name, new_snapshot->caller_name) == 0;
+}
+
void ast_stasis_channels_shutdown(void)
{
ao2_cleanup(channel_snapshot_type);
Modified: team/kmoore/stasis-bridge_events/res/res_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/res/res_stasis.c?view=diff&rev=385980&r1=385979&r2=385980
==============================================================================
--- team/kmoore/stasis-bridge_events/res/res_stasis.c (original)
+++ team/kmoore/stasis-bridge_events/res/res_stasis.c Wed Apr 17 13:41:22 2013
@@ -669,34 +669,6 @@
return app_channel_event_create(event_name, new_snapshot ? new_snapshot : old_snapshot, json);
}
-/*!
- * \brief Compares the context, exten and priority of two snapshots.
- * \param old_snapshot Old snapshot
- * \param new_snapshot New snapshot
- * \return True (non-zero) if context, exten or priority are identical.
- * \return False (zero) if context, exten and priority changed.
- */
-static inline int cep_equal(
- const struct ast_channel_snapshot *old_snapshot,
- const struct ast_channel_snapshot *new_snapshot)
-{
- ast_assert(old_snapshot != NULL);
- ast_assert(new_snapshot != NULL);
-
- /* We actually get some snapshots with CEP set, but before the
- * application is set. Since empty application is invalid, we treat
- * setting the application from nothing as a CEP change.
- */
- if (ast_strlen_zero(old_snapshot->appl) &&
- !ast_strlen_zero(new_snapshot->appl)) {
- return 0;
- }
-
- return old_snapshot->priority == new_snapshot->priority &&
- strcmp(old_snapshot->context, new_snapshot->context) == 0 &&
- strcmp(old_snapshot->exten, new_snapshot->exten) == 0;
-}
-
static struct ast_json *channel_dialplan(
struct ast_channel_snapshot *old_snapshot,
struct ast_channel_snapshot *new_snapshot)
@@ -713,7 +685,7 @@
return NULL;
}
- if (old_snapshot && cep_equal(old_snapshot, new_snapshot)) {
+ if (old_snapshot && ast_channel_snapshot_cep_equal(old_snapshot, new_snapshot)) {
return NULL;
}
@@ -727,23 +699,6 @@
return app_channel_event_create("channel-event-dialplan", new_snapshot, json);
}
-/*!
- * \brief Compares the callerid info of two snapshots.
- * \param old_snapshot Old snapshot
- * \param new_snapshot New snapshot
- * \return True (non-zero) if callerid are identical.
- * \return False (zero) if callerid changed.
- */
-static inline int caller_id_equal(
- const struct ast_channel_snapshot *old_snapshot,
- const struct ast_channel_snapshot *new_snapshot)
-{
- ast_assert(old_snapshot != NULL);
- ast_assert(new_snapshot != NULL);
- return strcmp(old_snapshot->caller_number, new_snapshot->caller_number) == 0 &&
- strcmp(old_snapshot->caller_name, new_snapshot->caller_name) == 0;
-}
-
static struct ast_json *channel_callerid(
struct ast_channel_snapshot *old_snapshot,
struct ast_channel_snapshot *new_snapshot)
@@ -755,7 +710,7 @@
return NULL;
}
- if (caller_id_equal(old_snapshot, new_snapshot)) {
+ if (ast_channel_snapshot_caller_id_equal(old_snapshot, new_snapshot)) {
return NULL;
}
More information about the asterisk-commits
mailing list