[asterisk-commits] kmoore: branch kmoore/cel_backend_refactor r395852 - in /team/kmoore/cel_back...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 31 08:33:04 CDT 2013
Author: kmoore
Date: Wed Jul 31 08:33:02 2013
New Revision: 395852
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395852
Log:
Bring up to current
Added:
team/kmoore/cel_backend_refactor/channels/chan_pjsip.c
- copied unchanged from r395850, team/kmoore/event_system_strip/channels/chan_pjsip.c
team/kmoore/cel_backend_refactor/configs/pjsip.conf.sample
- copied unchanged from r395850, team/kmoore/event_system_strip/configs/pjsip.conf.sample
team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip.h
- copied unchanged from r395850, team/kmoore/event_system_strip/include/asterisk/res_pjsip.h
team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_exten_state.h
- copied unchanged from r395850, team/kmoore/event_system_strip/include/asterisk/res_pjsip_exten_state.h
team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_pubsub.h
- copied unchanged from r395850, team/kmoore/event_system_strip/include/asterisk/res_pjsip_pubsub.h
team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_session.h
- copied unchanged from r395850, team/kmoore/event_system_strip/include/asterisk/res_pjsip_session.h
team/kmoore/cel_backend_refactor/res/res_pjsip/ (props changed)
- copied from r395850, team/kmoore/event_system_strip/res/res_pjsip/
team/kmoore/cel_backend_refactor/res/res_pjsip.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip.c
team/kmoore/cel_backend_refactor/res/res_pjsip.exports.in
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip.exports.in
team/kmoore/cel_backend_refactor/res/res_pjsip_acl.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_acl.c
team/kmoore/cel_backend_refactor/res/res_pjsip_authenticator_digest.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_authenticator_digest.c
team/kmoore/cel_backend_refactor/res/res_pjsip_caller_id.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_caller_id.c
team/kmoore/cel_backend_refactor/res/res_pjsip_diversion.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_diversion.c
team/kmoore/cel_backend_refactor/res/res_pjsip_dtmf_info.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_dtmf_info.c
team/kmoore/cel_backend_refactor/res/res_pjsip_endpoint_identifier_anonymous.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_endpoint_identifier_anonymous.c
team/kmoore/cel_backend_refactor/res/res_pjsip_endpoint_identifier_constant.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_endpoint_identifier_constant.c
team/kmoore/cel_backend_refactor/res/res_pjsip_endpoint_identifier_ip.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_endpoint_identifier_ip.c
team/kmoore/cel_backend_refactor/res/res_pjsip_endpoint_identifier_user.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_endpoint_identifier_user.c
team/kmoore/cel_backend_refactor/res/res_pjsip_exten_state.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_exten_state.c
team/kmoore/cel_backend_refactor/res/res_pjsip_exten_state.exports.in
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_exten_state.exports.in
team/kmoore/cel_backend_refactor/res/res_pjsip_logger.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_logger.c
team/kmoore/cel_backend_refactor/res/res_pjsip_messaging.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_messaging.c
team/kmoore/cel_backend_refactor/res/res_pjsip_mwi.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_mwi.c
team/kmoore/cel_backend_refactor/res/res_pjsip_nat.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_nat.c
team/kmoore/cel_backend_refactor/res/res_pjsip_notify.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_notify.c
team/kmoore/cel_backend_refactor/res/res_pjsip_one_touch_record_info.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_one_touch_record_info.c
team/kmoore/cel_backend_refactor/res/res_pjsip_outbound_authenticator_digest.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_outbound_authenticator_digest.c
team/kmoore/cel_backend_refactor/res/res_pjsip_outbound_registration.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_outbound_registration.c
team/kmoore/cel_backend_refactor/res/res_pjsip_pidf.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_pidf.c
team/kmoore/cel_backend_refactor/res/res_pjsip_pubsub.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_pubsub.c
team/kmoore/cel_backend_refactor/res/res_pjsip_pubsub.exports.in
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_pubsub.exports.in
team/kmoore/cel_backend_refactor/res/res_pjsip_refer.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_refer.c
team/kmoore/cel_backend_refactor/res/res_pjsip_registrar.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_registrar.c
team/kmoore/cel_backend_refactor/res/res_pjsip_registrar_expire.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_registrar_expire.c
team/kmoore/cel_backend_refactor/res/res_pjsip_rfc3326.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_rfc3326.c
team/kmoore/cel_backend_refactor/res/res_pjsip_sdp_rtp.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_sdp_rtp.c
team/kmoore/cel_backend_refactor/res/res_pjsip_session.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_session.c
team/kmoore/cel_backend_refactor/res/res_pjsip_session.exports.in
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_session.exports.in
team/kmoore/cel_backend_refactor/res/res_pjsip_t38.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_t38.c
team/kmoore/cel_backend_refactor/res/res_pjsip_transport_websocket.c
- copied unchanged from r395850, team/kmoore/event_system_strip/res/res_pjsip_transport_websocket.c
Removed:
team/kmoore/cel_backend_refactor/channels/chan_gulp.c
team/kmoore/cel_backend_refactor/configs/res_sip.conf.sample
team/kmoore/cel_backend_refactor/include/asterisk/res_sip.h
team/kmoore/cel_backend_refactor/include/asterisk/res_sip_exten_state.h
team/kmoore/cel_backend_refactor/include/asterisk/res_sip_pubsub.h
team/kmoore/cel_backend_refactor/include/asterisk/res_sip_session.h
team/kmoore/cel_backend_refactor/res/res_sip/
team/kmoore/cel_backend_refactor/res/res_sip.c
team/kmoore/cel_backend_refactor/res/res_sip.exports.in
team/kmoore/cel_backend_refactor/res/res_sip_acl.c
team/kmoore/cel_backend_refactor/res/res_sip_authenticator_digest.c
team/kmoore/cel_backend_refactor/res/res_sip_caller_id.c
team/kmoore/cel_backend_refactor/res/res_sip_diversion.c
team/kmoore/cel_backend_refactor/res/res_sip_dtmf_info.c
team/kmoore/cel_backend_refactor/res/res_sip_endpoint_identifier_anonymous.c
team/kmoore/cel_backend_refactor/res/res_sip_endpoint_identifier_constant.c
team/kmoore/cel_backend_refactor/res/res_sip_endpoint_identifier_ip.c
team/kmoore/cel_backend_refactor/res/res_sip_endpoint_identifier_user.c
team/kmoore/cel_backend_refactor/res/res_sip_exten_state.c
team/kmoore/cel_backend_refactor/res/res_sip_exten_state.exports.in
team/kmoore/cel_backend_refactor/res/res_sip_logger.c
team/kmoore/cel_backend_refactor/res/res_sip_messaging.c
team/kmoore/cel_backend_refactor/res/res_sip_mwi.c
team/kmoore/cel_backend_refactor/res/res_sip_nat.c
team/kmoore/cel_backend_refactor/res/res_sip_notify.c
team/kmoore/cel_backend_refactor/res/res_sip_one_touch_record_info.c
team/kmoore/cel_backend_refactor/res/res_sip_outbound_authenticator_digest.c
team/kmoore/cel_backend_refactor/res/res_sip_outbound_registration.c
team/kmoore/cel_backend_refactor/res/res_sip_pidf.c
team/kmoore/cel_backend_refactor/res/res_sip_pubsub.c
team/kmoore/cel_backend_refactor/res/res_sip_pubsub.exports.in
team/kmoore/cel_backend_refactor/res/res_sip_refer.c
team/kmoore/cel_backend_refactor/res/res_sip_registrar.c
team/kmoore/cel_backend_refactor/res/res_sip_registrar_expire.c
team/kmoore/cel_backend_refactor/res/res_sip_rfc3326.c
team/kmoore/cel_backend_refactor/res/res_sip_sdp_rtp.c
team/kmoore/cel_backend_refactor/res/res_sip_session.c
team/kmoore/cel_backend_refactor/res/res_sip_session.exports.in
team/kmoore/cel_backend_refactor/res/res_sip_transport_websocket.c
Modified:
team/kmoore/cel_backend_refactor/ (props changed)
team/kmoore/cel_backend_refactor/include/asterisk/mixmonitor.h (props changed)
team/kmoore/cel_backend_refactor/main/abstract_jb.c
team/kmoore/cel_backend_refactor/main/loader.c
team/kmoore/cel_backend_refactor/main/mixmonitor.c (contents, props changed)
team/kmoore/cel_backend_refactor/res/Makefile
team/kmoore/cel_backend_refactor/res/parking/parking_devicestate.c (props changed)
team/kmoore/cel_backend_refactor/res/res_pktccops.c
team/kmoore/cel_backend_refactor/tests/test_cel.c
Propchange: team/kmoore/cel_backend_refactor/
------------------------------------------------------------------------------
automerge = *
Propchange: team/kmoore/cel_backend_refactor/
------------------------------------------------------------------------------
--- cel_integrated (original)
+++ cel_integrated Wed Jul 31 08:33:02 2013
@@ -1,1 +1,1 @@
-/team/kmoore/event_system_strip:1-395619
+/team/kmoore/event_system_strip:1-395850
Propchange: team/kmoore/cel_backend_refactor/include/asterisk/mixmonitor.h
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Jul 31 08:33:02 2013
@@ -1,1 +1,1 @@
-"Author Date Id Revision"
+Author Date Id Revision
Modified: team/kmoore/cel_backend_refactor/main/abstract_jb.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/main/abstract_jb.c?view=diff&rev=395852&r1=395851&r2=395852
==============================================================================
--- team/kmoore/cel_backend_refactor/main/abstract_jb.c (original)
+++ team/kmoore/cel_backend_refactor/main/abstract_jb.c Wed Jul 31 08:33:02 2013
@@ -409,7 +409,6 @@
struct ast_jb_conf *jbconf = &jb->conf;
const struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj;
- struct ast_channel *bridged;
long now;
char logfile_pathname[20 + AST_JB_IMPL_NAME_SIZE + 2*AST_CHANNEL_NAME + 1];
char name1[AST_CHANNEL_NAME], name2[AST_CHANNEL_NAME], *tmp;
@@ -442,14 +441,15 @@
/* Create a frame log file */
if (ast_test_flag(jbconf, AST_JB_LOG)) {
+ RAII_VAR(struct ast_channel *, bridged, ast_channel_bridge_peer(chan), ast_channel_cleanup);
char safe_logfile[30] = "/tmp/logfile-XXXXXX";
int safe_fd;
+
snprintf(name2, sizeof(name2), "%s", ast_channel_name(chan));
if ((tmp = strchr(name2, '/'))) {
*tmp = '#';
}
- bridged = ast_bridged_channel(chan);
/* We should always have bridged chan if a jitterbuffer is in use */
ast_assert(bridged != NULL);
Modified: team/kmoore/cel_backend_refactor/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/main/loader.c?view=diff&rev=395852&r1=395851&r2=395852
==============================================================================
--- team/kmoore/cel_backend_refactor/main/loader.c (original)
+++ team/kmoore/cel_backend_refactor/main/loader.c Wed Jul 31 08:33:02 2013
@@ -50,7 +50,7 @@
#include "asterisk/enum.h"
#include "asterisk/http.h"
#include "asterisk/lock.h"
-#include "asterisk/features.h"
+#include "asterisk/features_config.h"
#include "asterisk/dsp.h"
#include "asterisk/udptl.h"
#include "asterisk/heap.h"
@@ -313,7 +313,7 @@
{ "manager", reload_manager },
{ "http", ast_http_reload },
{ "logger", logger_reload },
- { "features", ast_features_reload },
+ { "features", ast_features_config_reload },
{ "dsp", ast_dsp_reload},
{ "udptl", ast_udptl_reload },
{ "indications", ast_indications_reload },
Modified: team/kmoore/cel_backend_refactor/main/mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/main/mixmonitor.c?view=diff&rev=395852&r1=395851&r2=395852
==============================================================================
--- team/kmoore/cel_backend_refactor/main/mixmonitor.c (original)
+++ team/kmoore/cel_backend_refactor/main/mixmonitor.c Wed Jul 31 08:33:02 2013
@@ -29,7 +29,7 @@
#include "asterisk.h"
-ASTERISK_FILE_VERSION(__FILE__, "$Revision: 390830 $")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/lock.h"
#include "asterisk/logger.h"
Propchange: team/kmoore/cel_backend_refactor/main/mixmonitor.c
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Jul 31 08:33:02 2013
@@ -1,1 +1,1 @@
-"Author Date Id Revision"
+Author Date Id Revision
Modified: team/kmoore/cel_backend_refactor/res/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/res/Makefile?view=diff&rev=395852&r1=395851&r2=395852
==============================================================================
--- team/kmoore/cel_backend_refactor/res/Makefile (original)
+++ team/kmoore/cel_backend_refactor/res/Makefile Wed Jul 31 08:33:02 2013
@@ -43,8 +43,8 @@
$(if $(filter res_ael_share,$(EMBEDDED_MODS)),modules.link,res_ael_share.so): ael/ael_lex.o ael/ael.tab.o ael/pval.o
ael/ael_lex.o ael/ael.tab.o ael/pval.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ael_share)
-$(if $(filter res_sip,$(EMBEDDED_MODS)),modules.link,res_sip.so): $(subst .c,.o,$(wildcard res_sip/*.c))
-$(subst .c,.o,$(wildcard res_sip/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_sip)
+$(if $(filter res_pjsip,$(EMBEDDED_MODS)),modules.link,res_pjsip.so): $(subst .c,.o,$(wildcard res_pjsip/*.c))
+$(subst .c,.o,$(wildcard res_pjsip/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_pjsip)
$(if $(filter res_stasis,$(EMBEDDED_MODS)),modules.link,res_stasis.so): $(subst .c,.o,$(wildcard stasis/*.c))
$(subst .c,.o,$(wildcard stasis/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis)
@@ -74,7 +74,7 @@
clean::
rm -f snmp/*.[oi] ael/*.[oi] ais/*.[oi] ari/*.[oi]
- rm -f res_sip/*.[oi] stasis/*.[oi]
+ rm -f res_pjsip/*.[oi] stasis/*.[oi]
rm -f parking/*.o parking/*.i
$(if $(filter res_parking,$(EMBEDDED_MODS)),modules.link,res_parking.so): $(subst .c,.o,$(wildcard parking/*.c))
Propchange: team/kmoore/cel_backend_refactor/res/parking/parking_devicestate.c
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Jul 31 08:33:02 2013
@@ -1,1 +1,1 @@
-"Author Date Id Revision"
+Author Date Id Revision
Propchange: team/kmoore/cel_backend_refactor/res/res_pjsip/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul 31 08:33:02 2013
@@ -1,0 +1,2 @@
+*.i
+*.o
Modified: team/kmoore/cel_backend_refactor/res/res_pktccops.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/res/res_pktccops.c?view=diff&rev=395852&r1=395851&r2=395852
==============================================================================
--- team/kmoore/cel_backend_refactor/res/res_pktccops.c (original)
+++ team/kmoore/cel_backend_refactor/res/res_pktccops.c Wed Jul 31 08:33:02 2013
@@ -1347,7 +1347,7 @@
if (a->argc < 9)
return CLI_SHOWUSAGE;
- if (!strncmp(a->argv[2], "null", sizeof(a->argv[2]))) {
+ if (!strcmp(a->argv[2], "null")) {
cmts = NULL;
} else {
AST_LIST_LOCK(&cmts_list);
Modified: team/kmoore/cel_backend_refactor/tests/test_cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/tests/test_cel.c?view=diff&rev=395852&r1=395851&r2=395852
==============================================================================
--- team/kmoore/cel_backend_refactor/tests/test_cel.c (original)
+++ team/kmoore/cel_backend_refactor/tests/test_cel.c Wed Jul 31 08:33:02 2013
@@ -61,6 +61,18 @@
/*! \brief The CEL config used for CEL unit tests */
static struct ast_cel_general_config *cel_test_config;
+/*! \brief Lock used for synchronizing test execution stages with received events */
+ast_mutex_t mid_test_sync_lock;
+
+/*! \brief Lock used with sync_out for checking the end of test execution */
+ast_mutex_t sync_lock;
+
+/*! \brief Condition used for checking the end of test execution */
+ast_cond_t sync_out;
+
+/*! \brief Flag used to trigger a mid-test synchronization, access controlled by mid_test_sync_lock */
+int do_mid_test_sync = 0;
+
/*! \brief A channel technology used for the unit tests */
static struct ast_channel_tech test_cel_chan_tech = {
.type = CHANNEL_TECH_NAME,
@@ -96,6 +108,7 @@
#define CONF_EXIT(channel, bridge) do { \
ast_test_validate(test, 0 == ast_bridge_depart(channel)); \
CONF_EXIT_EVENT(channel, bridge); \
+ mid_test_sync(); \
} while (0)
#define CONF_EXIT_EVENT(channel, bridge) do { \
@@ -160,12 +173,6 @@
/*! \brief David's Caller ID */
#define DAVID_CALLERID { .id.name.str = "David", .id.name.valid = 1, .id.number.str = "400", .id.number.valid = 1, }
-/*! \brief Eve's Caller ID */
-#define EVE_CALLERID { .id.name.str = "Eve", .id.name.valid = 1, .id.number.str = "500", .id.number.valid = 1, }
-
-/*! \brief Fred's Caller ID */
-#define FRED_CALLERID { .id.name.str = "Fred", .id.name.valid = 1, .id.number.str = "600", .id.number.valid = 1, }
-
/*! \brief Create a \ref test_cel_chan_tech for Alice. */
#define CREATE_ALICE_CHANNEL(channel_var, caller_id) do { \
(channel_var) = ast_channel_alloc(0, AST_STATE_DOWN, (caller_id)->id.number.str, (caller_id)->id.name.str, "100", "100", "default", NULL, 0, CHANNEL_TECH_NAME "/Alice"); \
@@ -187,18 +194,6 @@
/*! \brief Create a \ref test_cel_chan_tech for David. */
#define CREATE_DAVID_CHANNEL(channel_var, caller_id) do { \
(channel_var) = ast_channel_alloc(0, AST_STATE_DOWN, (caller_id)->id.number.str, (caller_id)->id.name.str, "400", "400", "default", NULL, 0, CHANNEL_TECH_NAME "/David"); \
- APPEND_EVENT(channel_var, AST_CEL_CHANNEL_START, NULL, NULL, NULL); \
- } while (0)
-
-/*! \brief Create a \ref test_cel_chan_tech for Eve. */
-#define CREATE_EVE_CHANNEL(channel_var, caller_id) do { \
- (channel_var) = ast_channel_alloc(0, AST_STATE_DOWN, (caller_id)->id.number.str, (caller_id)->id.name.str, "500", "500", "default", NULL, 0, CHANNEL_TECH_NAME "/Eve"); \
- APPEND_EVENT(channel_var, AST_CEL_CHANNEL_START, NULL, NULL, NULL); \
- } while (0)
-
-/*! \brief Create a \ref test_cel_chan_tech for Eve. */
-#define CREATE_FRED_CHANNEL(channel_var, caller_id) do { \
- (channel_var) = ast_channel_alloc(0, AST_STATE_DOWN, (caller_id)->id.number.str, (caller_id)->id.name.str, "600", "600", "default", NULL, 0, CHANNEL_TECH_NAME "/Fred"); \
APPEND_EVENT(channel_var, AST_CEL_CHANNEL_START, NULL, NULL, NULL); \
} while (0)
@@ -245,6 +240,8 @@
APPEND_EVENT(channel, AST_CEL_HANGUP, NULL, extra, NULL); \
} while (0)
+static void mid_test_sync(void);
+
static int append_expected_event(
struct ast_channel *chan,
enum ast_cel_event_type type,
@@ -609,6 +606,7 @@
ANSWER_CHANNEL(chan_charlie);
EMULATE_APP_DATA(chan_charlie, 2, "Bridge", "");
+ do_sleep();
ast_bridge_impart(bridge, chan_charlie, NULL, NULL, 0);
do_sleep();
BRIDGE_TO_CONF(chan_alice, chan_bob, chan_charlie, bridge);
@@ -1043,21 +1041,32 @@
EMULATE_DIAL(chan_alice, CHANNEL_TECH_NAME "/Bob");
START_DIALED(chan_alice, chan_bob);
+ do_sleep();
CREATE_CHARLIE_CHANNEL(chan_charlie, &charlie_caller);
+ do_sleep();
EMULATE_DIAL(chan_charlie, CHANNEL_TECH_NAME "/Bob");
+ do_sleep();
START_DIALED_FULL(chan_charlie, chan_david, "400", "David");
ast_channel_state_set(chan_alice, AST_STATE_RINGING);
+ do_sleep();
ast_channel_state_set(chan_charlie, AST_STATE_RINGING);
+ do_sleep();
ast_channel_publish_dial(chan_alice, chan_bob, NULL, "ANSWER");
+ do_sleep();
ast_channel_publish_dial(chan_charlie, chan_david, NULL, "ANSWER");
+ do_sleep();
ANSWER_NO_APP(chan_alice);
+ do_sleep();
ANSWER_NO_APP(chan_bob);
+ do_sleep();
ANSWER_NO_APP(chan_charlie);
+ do_sleep();
ANSWER_NO_APP(chan_david);
+ do_sleep();
do_sleep();
ast_test_validate(test, 0 == ast_bridge_impart(bridge, chan_charlie, NULL, NULL, 0));
@@ -1147,13 +1156,13 @@
RAII_VAR(struct ast_channel *, chan_alice, NULL, safe_channel_release);
RAII_VAR(struct ast_channel *, chan_bob, NULL, safe_channel_release);
RAII_VAR(struct ast_channel *, chan_charlie, NULL, safe_channel_release);
- RAII_VAR(struct ast_channel *, chan_fred, NULL, safe_channel_release);
+ RAII_VAR(struct ast_channel *, chan_david, NULL, safe_channel_release);
RAII_VAR(struct ast_bridge *, bridge1, NULL, ao2_cleanup);
RAII_VAR(struct ast_bridge *, bridge2, NULL, ao2_cleanup);
struct ast_party_caller alice_caller = ALICE_CALLERID;
struct ast_party_caller bob_caller = BOB_CALLERID;
struct ast_party_caller charlie_caller = CHARLIE_CALLERID;
- struct ast_party_caller fred_caller = ALICE_CALLERID;
+ struct ast_party_caller david_caller = ALICE_CALLERID;
switch (cmd) {
case TEST_INIT:
@@ -1188,39 +1197,37 @@
bridge2 = ast_bridge_basic_new();
ast_test_validate(test, bridge2 != NULL);
- CREATE_FRED_CHANNEL(chan_fred, &fred_caller);
+ CREATE_DAVID_CHANNEL(chan_david, &david_caller);
CREATE_CHARLIE_CHANNEL(chan_charlie, &charlie_caller);
- ANSWER_NO_APP(chan_fred);
+ ANSWER_NO_APP(chan_david);
ANSWER_NO_APP(chan_charlie);
ast_test_validate(test, 0 == ast_bridge_impart(bridge2, chan_charlie, NULL, NULL, 0));
do_sleep();
- ast_test_validate(test, 0 == ast_bridge_impart(bridge2, chan_fred, NULL, NULL, 0));
- do_sleep();
- APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_START, NULL, NULL, ast_channel_name(chan_fred));
+ ast_test_validate(test, 0 == ast_bridge_impart(bridge2, chan_david, NULL, NULL, 0));
+ do_sleep();
+ APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_START, NULL, NULL, ast_channel_name(chan_david));
/* Perform attended transfer */
APPEND_EVENT(chan_bob, AST_CEL_BRIDGE_END, NULL, NULL, ast_channel_name(chan_alice));
- ast_bridge_transfer_attended(chan_alice, chan_fred);
- do_sleep();
- BRIDGE_TO_CONF(chan_charlie, chan_fred, chan_bob, bridge2);
- CONF_EXIT_EVENT(chan_fred, bridge2);
-
- ATTENDEDTRANSFER_BRIDGE(chan_alice, bridge1, chan_fred, bridge2);
+ ast_bridge_transfer_attended(chan_alice, chan_david);
+ do_sleep();
+ BRIDGE_TO_CONF(chan_charlie, chan_david, chan_bob, bridge2);
+ CONF_EXIT_EVENT(chan_david, bridge2);
+
+ ATTENDEDTRANSFER_BRIDGE(chan_alice, bridge1, chan_david, bridge2);
do_sleep();
CONF_EXIT(chan_bob, bridge2);
- do_sleep();
CONF_EXIT(chan_charlie, bridge2);
- do_sleep();
HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "");
do_sleep();
HANGUP_CHANNEL(chan_bob, AST_CAUSE_NORMAL, "");
do_sleep();
- HANGUP_CHANNEL(chan_fred, AST_CAUSE_NORMAL, "");
+ HANGUP_CHANNEL(chan_david, AST_CAUSE_NORMAL, "");
do_sleep();
HANGUP_CHANNEL(chan_charlie, AST_CAUSE_NORMAL, "");
@@ -1233,19 +1240,12 @@
RAII_VAR(struct ast_channel *, chan_bob, NULL, safe_channel_release);
RAII_VAR(struct ast_channel *, chan_charlie, NULL, safe_channel_release);
RAII_VAR(struct ast_channel *, chan_david, NULL, safe_channel_release);
- RAII_VAR(struct ast_channel *, chan_eve, NULL, safe_channel_release);
- RAII_VAR(struct ast_channel *, chan_fred, NULL, safe_channel_release);
RAII_VAR(struct ast_bridge *, bridge1, NULL, ao2_cleanup);
RAII_VAR(struct ast_bridge *, bridge2, NULL, ao2_cleanup);
- RAII_VAR(struct ast_channel_snapshot *, eve_tmp_snapshot, NULL, ao2_cleanup);
struct ast_party_caller alice_caller = ALICE_CALLERID;
struct ast_party_caller bob_caller = BOB_CALLERID;
struct ast_party_caller charlie_caller = CHARLIE_CALLERID;
- struct ast_party_caller david_caller = DAVID_CALLERID;
- struct ast_party_caller eve_caller = EVE_CALLERID;
- struct ast_party_caller fred_caller = EVE_CALLERID;
- struct ast_bridge_channel_pair transferee;
- struct ast_bridge_channel_pair target;
+ struct ast_party_caller david_caller = ALICE_CALLERID;
switch (cmd) {
case TEST_INIT:
@@ -1254,7 +1254,7 @@
info->summary = "Test attended transfers between two pairs of"
" bridged parties that results in a bridge merge";
info->description =
- "This test creates six channels, places each triplet"
+ "This test creates four channels, places each pair"
" in a bridge, and then attended transfers the bridges"
" together causing a bridge merge.\n";
return AST_TEST_NOT_RUN;
@@ -1262,99 +1262,60 @@
break;
}
/* Create first set of bridged parties */
- bridge1 = ast_bridge_basic_new();
+ bridge1 = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE | AST_BRIDGE_CAPABILITY_MULTIMIX,
+ AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM | AST_BRIDGE_FLAG_TRANSFER_PROHIBITED | AST_BRIDGE_FLAG_SMART);
ast_test_validate(test, bridge1 != NULL);
CREATE_ALICE_CHANNEL(chan_alice, &alice_caller);
CREATE_BOB_CHANNEL(chan_bob, &bob_caller);
- CREATE_DAVID_CHANNEL(chan_david, &david_caller);
ANSWER_NO_APP(chan_alice);
ANSWER_NO_APP(chan_bob);
+
+ ast_test_validate(test, 0 == ast_bridge_impart(bridge1, chan_bob, NULL, NULL, 0));
+ do_sleep();
+
+ ast_test_validate(test, 0 == ast_bridge_impart(bridge1, chan_alice, NULL, NULL, 0));
+ do_sleep();
+ APPEND_EVENT(chan_bob, AST_CEL_BRIDGE_START, NULL, NULL, ast_channel_name(chan_alice));
+
+ /* Create second set of bridged parties */
+ bridge2 = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE | AST_BRIDGE_CAPABILITY_MULTIMIX,
+ AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM | AST_BRIDGE_FLAG_TRANSFER_PROHIBITED | AST_BRIDGE_FLAG_SMART);
+ ast_test_validate(test, bridge2 != NULL);
+
+ CREATE_DAVID_CHANNEL(chan_david, &david_caller);
+ CREATE_CHARLIE_CHANNEL(chan_charlie, &charlie_caller);
ANSWER_NO_APP(chan_david);
-
- ast_test_validate(test, 0 == ast_bridge_impart(bridge1, chan_bob, NULL, NULL, 0));
- do_sleep();
-
- ast_test_validate(test, 0 == ast_bridge_impart(bridge1, chan_alice, NULL, NULL, 0));
- do_sleep();
- APPEND_EVENT(chan_bob, AST_CEL_BRIDGE_START, NULL, NULL, ast_channel_name(chan_alice));
-
- ast_test_validate(test, 0 == ast_bridge_impart(bridge1, chan_david, NULL, NULL, 0));
- do_sleep();
- BRIDGE_TO_CONF(chan_bob, chan_alice, chan_david, bridge1);
-
- /* Create second set of bridged parties */
- bridge2 = ast_bridge_basic_new();
- ast_test_validate(test, bridge2 != NULL);
-
- CREATE_FRED_CHANNEL(chan_fred, &fred_caller);
- CREATE_CHARLIE_CHANNEL(chan_charlie, &charlie_caller);
- CREATE_EVE_CHANNEL(chan_eve, &eve_caller);
- ANSWER_NO_APP(chan_fred);
ANSWER_NO_APP(chan_charlie);
- ANSWER_NO_APP(chan_eve);
ast_test_validate(test, 0 == ast_bridge_impart(bridge2, chan_charlie, NULL, NULL, 0));
do_sleep();
- ast_test_validate(test, 0 == ast_bridge_impart(bridge2, chan_fred, NULL, NULL, 0));
- do_sleep();
- APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_START, NULL, NULL, ast_channel_name(chan_fred));
-
- ast_test_validate(test, 0 == ast_bridge_impart(bridge2, chan_eve, NULL, NULL, 0));
- do_sleep();
- BRIDGE_TO_CONF(chan_charlie, chan_fred, chan_eve, bridge2);
- do_sleep();
+ ast_test_validate(test, 0 == ast_bridge_impart(bridge2, chan_david, NULL, NULL, 0));
+ do_sleep();
+ APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_START, NULL, NULL, ast_channel_name(chan_david));
/* Perform attended transfer */
- CONF_EXIT(chan_eve, bridge2);
- do_sleep();
- CONF_EXIT_EVENT(chan_charlie, bridge2);
- do_sleep();
- ast_test_validate(test, 0 == ast_bridge_depart(chan_charlie)); \
- do_sleep();
- ast_test_validate(test, 0 == ast_bridge_impart(bridge1, chan_charlie, NULL, NULL, 0)); \
- do_sleep();
- CONF_ENTER_EVENT(chan_charlie, bridge1); \
- do_sleep();
- CONF_EXIT_EVENT(chan_charlie, bridge1);
-
- /* Fred goes away */
- CONF_EXIT(chan_fred, bridge2);
- do_sleep();
- /*CONF_EXIT_EVENT(chan_eve, bridge1);
- do_sleep();
- ast_test_validate(test, 0 == ast_bridge_depart(chan_eve)); \
- do_sleep();*/
-
- /* Alice goes away */
- CONF_EXIT(chan_alice, bridge1);
- do_sleep();
-
- transferee.bridge = bridge1;
- transferee.channel = chan_alice;
- target.bridge = bridge2;
- target.channel = chan_fred;
- ast_bridge_publish_attended_transfer_bridge_merge(1, AST_BRIDGE_TRANSFER_SUCCESS,
- &transferee, &target, bridge1);
- ATTENDEDTRANSFER_BRIDGE(chan_alice, bridge1, chan_fred, bridge2);
-
+ APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_END, NULL, NULL, ast_channel_name(chan_david));
+
+ ast_bridge_transfer_attended(chan_alice, chan_david);
+ do_sleep();
+ BRIDGE_TO_CONF(chan_bob, chan_alice, chan_charlie, bridge1);
+ CONF_EXIT_EVENT(chan_alice, bridge1);
+
+ ATTENDEDTRANSFER_BRIDGE(chan_alice, bridge1, chan_david, bridge2);
+
+ do_sleep();
CONF_EXIT(chan_bob, bridge1);
- do_sleep();
- CONF_EXIT(chan_david, bridge1);
- do_sleep();
-
- HANGUP_CHANNEL(chan_fred, AST_CAUSE_NORMAL, "");
- do_sleep();
+ CONF_EXIT(chan_charlie, bridge1);
+
HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "");
do_sleep();
HANGUP_CHANNEL(chan_bob, AST_CAUSE_NORMAL, "");
do_sleep();
+ HANGUP_CHANNEL(chan_david, AST_CAUSE_NORMAL, "");
+ do_sleep();
HANGUP_CHANNEL(chan_charlie, AST_CAUSE_NORMAL, "");
- do_sleep();
- HANGUP_CHANNEL(chan_david, AST_CAUSE_NORMAL, "");
- do_sleep();
- HANGUP_CHANNEL(chan_eve, AST_CAUSE_NORMAL, "");
return AST_TEST_PASS;
}
@@ -1365,17 +1326,12 @@
RAII_VAR(struct ast_channel *, chan_bob, NULL, safe_channel_release);
RAII_VAR(struct ast_channel *, chan_charlie, NULL, safe_channel_release);
RAII_VAR(struct ast_channel *, chan_david, NULL, safe_channel_release);
- RAII_VAR(struct ast_channel *, chan_eve, NULL, safe_channel_release);
- RAII_VAR(struct ast_channel *, chan_fred, NULL, safe_channel_release);
RAII_VAR(struct ast_bridge *, bridge1, NULL, ao2_cleanup);
RAII_VAR(struct ast_bridge *, bridge2, NULL, ao2_cleanup);
- RAII_VAR(struct ast_channel_snapshot *, eve_tmp_snapshot, NULL, ao2_cleanup);
struct ast_party_caller alice_caller = ALICE_CALLERID;
struct ast_party_caller bob_caller = BOB_CALLERID;
struct ast_party_caller charlie_caller = CHARLIE_CALLERID;
- struct ast_party_caller david_caller = DAVID_CALLERID;
- struct ast_party_caller eve_caller = EVE_CALLERID;
- struct ast_party_caller fred_caller = EVE_CALLERID;
+ struct ast_party_caller david_caller = ALICE_CALLERID;
switch (cmd) {
case TEST_INIT:
@@ -1384,9 +1340,9 @@
info->summary = "Test attended transfers between two pairs of"
" bridged parties that results in a bridge merge";
info->description =
- "This test creates six channels, places each triplet"
+ "This test creates four channels, places each pair"
" in a bridge, and then attended transfers the bridges"
- " together causing a bridge merge.\n";
+ " together causing a bridge link.\n";
return AST_TEST_NOT_RUN;
case TEST_EXECUTE:
break;
@@ -1394,97 +1350,81 @@
/* Create first set of bridged parties */
bridge1 = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE | AST_BRIDGE_CAPABILITY_MULTIMIX,
AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM
- | AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM | AST_BRIDGE_FLAG_TRANSFER_PROHIBITED | AST_BRIDGE_FLAG_SMART);
+ | AST_BRIDGE_FLAG_SWAP_INHIBIT_TO | AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM
+ | AST_BRIDGE_FLAG_TRANSFER_PROHIBITED | AST_BRIDGE_FLAG_SMART);
ast_test_validate(test, bridge1 != NULL);
CREATE_ALICE_CHANNEL(chan_alice, &alice_caller);
CREATE_BOB_CHANNEL(chan_bob, &bob_caller);
- CREATE_DAVID_CHANNEL(chan_david, &david_caller);
ANSWER_NO_APP(chan_alice);
ANSWER_NO_APP(chan_bob);
+
+ ast_test_validate(test, 0 == ast_bridge_impart(bridge1, chan_bob, NULL, NULL, 0));
+ do_sleep();
+
+ ast_test_validate(test, 0 == ast_bridge_impart(bridge1, chan_alice, NULL, NULL, 0));
+ do_sleep();
+ APPEND_EVENT(chan_bob, AST_CEL_BRIDGE_START, NULL, NULL, ast_channel_name(chan_alice));
+
+ /* Create second set of bridged parties */
+ bridge2 = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE | AST_BRIDGE_CAPABILITY_MULTIMIX,
+ AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM
+ | AST_BRIDGE_FLAG_SWAP_INHIBIT_TO | AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM
+ | AST_BRIDGE_FLAG_TRANSFER_PROHIBITED | AST_BRIDGE_FLAG_SMART);
+ ast_test_validate(test, bridge2 != NULL);
+
+ CREATE_DAVID_CHANNEL(chan_david, &david_caller);
+ CREATE_CHARLIE_CHANNEL(chan_charlie, &charlie_caller);
ANSWER_NO_APP(chan_david);
-
- ast_test_validate(test, 0 == ast_bridge_impart(bridge1, chan_bob, NULL, NULL, 0));
- do_sleep();
-
- ast_test_validate(test, 0 == ast_bridge_impart(bridge1, chan_alice, NULL, NULL, 0));
- do_sleep();
- APPEND_EVENT(chan_bob, AST_CEL_BRIDGE_START, NULL, NULL, ast_channel_name(chan_alice));
-
- ast_test_validate(test, 0 == ast_bridge_impart(bridge1, chan_david, NULL, NULL, 0));
- do_sleep();
- BRIDGE_TO_CONF(chan_bob, chan_alice, chan_david, bridge1);
-
- /* Create second set of bridged parties */
- bridge2 = ast_bridge_basic_new();
- ast_test_validate(test, bridge2 != NULL);
-
- CREATE_FRED_CHANNEL(chan_fred, &fred_caller);
- CREATE_CHARLIE_CHANNEL(chan_charlie, &charlie_caller);
- CREATE_EVE_CHANNEL(chan_eve, &eve_caller);
- ANSWER_NO_APP(chan_fred);
ANSWER_NO_APP(chan_charlie);
- ANSWER_NO_APP(chan_eve);
ast_test_validate(test, 0 == ast_bridge_impart(bridge2, chan_charlie, NULL, NULL, 0));
do_sleep();
- ast_test_validate(test, 0 == ast_bridge_impart(bridge2, chan_fred, NULL, NULL, 0));
- do_sleep();
- APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_START, NULL, NULL, ast_channel_name(chan_fred));
-
- ast_test_validate(test, 0 == ast_bridge_impart(bridge2, chan_eve, NULL, NULL, 0));
- do_sleep();
- BRIDGE_TO_CONF(chan_charlie, chan_fred, chan_eve, bridge2);
+ ast_test_validate(test, 0 == ast_bridge_impart(bridge2, chan_david, NULL, NULL, 0));
+ do_sleep();
+ APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_START, NULL, NULL, ast_channel_name(chan_david));
/* Perform attended transfer */
- ast_bridge_transfer_attended(chan_alice, chan_fred);
- do_sleep();
-
- /* Append dummy event for the link channel ;1 start */
- APPEND_DUMMY_EVENT();
-
- /* Append dummy event for the link channel ;2 start */
- APPEND_DUMMY_EVENT();
-
- /* Append dummy event for the link channel ;2 answer */
- APPEND_DUMMY_EVENT();
-
- ATTENDEDTRANSFER_BRIDGE(chan_alice, bridge1, chan_fred, bridge2);
-
- /* Append dummy event for the link channel ;1 enter */
- APPEND_DUMMY_EVENT();
-
- /* Append dummy events for the link channel ;2 enter and Alice's exit,
- * must both be dummies since they're racing */
+
+ /* The following events can not be matched directly since nothing is known
+ * about the linking local channel.
+ * local channel ;1 and ;2 creation and ;2 answer */
APPEND_DUMMY_EVENT();
APPEND_DUMMY_EVENT();
-
- /* Append dummy events for the link channel ;1 answer and Fred's exit,
- * must both be dummies since they're racing */
+ APPEND_DUMMY_EVENT();
+
+ ATTENDEDTRANSFER_BRIDGE(chan_alice, bridge1, chan_david, bridge2);
+
+ /* The two BRIDGE_TO_CONFs and CONF_EXITs are all racing to be first */
+
+ /* BRIDGE_TO_CONF with primary charlie, peer david, and trigger channel ;2 */
+ APPEND_DUMMY_EVENT();
+
+ ast_bridge_transfer_attended(chan_alice, chan_david);
+ do_sleep();
+
+ /* BRIDGE_TO_CONF with primary bob, peer alice, and trigger channel ;1 */
+ APPEND_DUMMY_EVENT();
+
+ /* CONF_EXIT alice and david */
APPEND_DUMMY_EVENT();
APPEND_DUMMY_EVENT();
+ /* ANSWER ;1 */
+ APPEND_DUMMY_EVENT();
+
+ do_sleep();
CONF_EXIT(chan_bob, bridge1);
- do_sleep();
CONF_EXIT(chan_charlie, bridge2);
- do_sleep();
- CONF_EXIT(chan_david, bridge1);
- do_sleep();
- CONF_EXIT(chan_eve, bridge2);
-
- do_sleep();
+
HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "");
do_sleep();
HANGUP_CHANNEL(chan_bob, AST_CAUSE_NORMAL, "");
do_sleep();
- HANGUP_CHANNEL(chan_fred, AST_CAUSE_NORMAL, "");
+ HANGUP_CHANNEL(chan_david, AST_CAUSE_NORMAL, "");
do_sleep();
HANGUP_CHANNEL(chan_charlie, AST_CAUSE_NORMAL, "");
- do_sleep();
- HANGUP_CHANNEL(chan_david, AST_CAUSE_NORMAL, "");
- do_sleep();
- HANGUP_CHANNEL(chan_eve, AST_CAUSE_NORMAL, "");
return AST_TEST_PASS;
}
@@ -1621,6 +1561,29 @@
return event_dup;
}
+static void mid_test_sync(void)
+{
+ ast_mutex_lock(&mid_test_sync_lock);
+ if (ao2_container_count(cel_expected_events) <= ao2_container_count(cel_received_events)) {
+ ast_mutex_unlock(&mid_test_sync_lock);
+ return;
+ }
+
+ do_mid_test_sync = 1;
+ ast_mutex_unlock(&mid_test_sync_lock);
+
+ {
+ struct timeval start = ast_tvnow();
+ struct timespec end = {
+ .tv_sec = start.tv_sec + 15,
+ .tv_nsec = start.tv_usec * 1000
+ };
+
+ SCOPED_MUTEX(lock, &sync_lock);
+ ast_cond_timedwait(&sync_out, &sync_lock, &end);
+ }
+}
+
static int append_event(struct ast_event *ev)
{
RAII_VAR(struct ast_event *, ao2_ev, NULL, ao2_cleanup);
@@ -1676,13 +1639,12 @@
return append_expected_event_snapshot(snapshot, type, userdefevname, extra, peer);
}
-ast_mutex_t sync_lock;
-ast_cond_t sync_out;
-
static void test_sub(const struct ast_event *event, void *data)
{
struct ast_event *event_dup = ao2_dup_event(event);
const char *sync_tag;
+ SCOPED_MUTEX(mid_test_lock, &mid_test_sync_lock);
+
if (!event_dup) {
return;
}
@@ -1696,8 +1658,21 @@
return;
}
}
+
/* save the event for later processing */
ao2_link(cel_received_events, event_dup);
+
+ if (do_mid_test_sync) {
+ int expected = ao2_container_count(cel_expected_events);
+ int received = ao2_container_count(cel_received_events);
+ if (expected <= received) {
+ {
+ SCOPED_MUTEX(lock, &sync_lock);
+ ast_cond_signal(&sync_out);
+ do_mid_test_sync = 0;
+ }
+ }
+ }
}
/*!
@@ -1709,6 +1684,7 @@
ast_assert(cel_received_events == NULL);
ast_assert(cel_expected_events == NULL);
+ ast_mutex_init(&mid_test_sync_lock);
ast_mutex_init(&sync_lock);
ast_cond_init(&sync_out, NULL);
@@ -1764,7 +1740,7 @@
return 0;
}
-static int events_are_equal(struct ast_event *received, struct ast_event *expected)
+static int events_are_equal(struct ast_test *test, struct ast_event *received, struct ast_event *expected)
{
struct ast_event_iterator iterator;
int res;
@@ -1780,7 +1756,7 @@
if (ie_type != AST_EVENT_IE_CEL_EVENT_TIME_USEC
&& ie_type != AST_EVENT_IE_CEL_EVENT_TIME
&& !match_ie_val(received, expected, ie_type)) {
- ast_log(LOG_ERROR, "Failed matching on field %s\n", ast_event_get_ie_type_name(ie_type));
+ ast_test_status_update(test, "Failed matching on field %s\n", ast_event_get_ie_type_name(ie_type));
return 0;
}
}
@@ -1788,16 +1764,16 @@
return 1;
}
-static int dump_event(struct ast_event *event)
+static int dump_event(struct ast_test *test, struct ast_event *event)
{
struct ast_event_iterator i;
if (ast_event_iterator_init(&i, event)) {
- ast_log(LOG_ERROR, "Failed to initialize event iterator. :-(\n");
+ ast_test_status_update(test, "Failed to initialize event iterator. :-(\n");
return 0;
}
- ast_log(LOG_ERROR, "Event: %s\n",
[... 111 lines stripped ...]
More information about the asterisk-commits
mailing list