Asterisk - The Open Source Telephony Project GIT-master-b023714
|
CEL unit tests. More...
#include "asterisk.h"
#include <math.h>
#include "asterisk/module.h"
#include "asterisk/test.h"
#include "asterisk/cel.h"
#include "asterisk/channel.h"
#include "asterisk/format_cache.h"
#include "asterisk/linkedlists.h"
#include "asterisk/chanvars.h"
#include "asterisk/utils.h"
#include "asterisk/causes.h"
#include "asterisk/time.h"
#include "asterisk/bridge.h"
#include "asterisk/bridge_basic.h"
#include "asterisk/pickup.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_bridges.h"
#include "asterisk/json.h"
#include "asterisk/features.h"
#include "asterisk/core_local.h"
Go to the source code of this file.
Macros | |
#define | ALICE_CALLERID { .id.name.str = "Alice", .id.name.valid = 1, .id.number.str = "100", .id.number.valid = 1, } |
Alice's Caller ID. | |
#define | ANSWER_CHANNEL(chan) |
#define | ANSWER_NO_APP(chan) |
#define | APPEND_DUMMY_EVENT() |
#define | APPEND_EVENT(chan, ev_type, userevent, extra) |
#define | APPEND_EVENT_PEER(chan, ev_type, userevent, extra, peer) |
#define | APPEND_EVENT_SNAPSHOT(snapshot, ev_type, userevent, extra, peer) |
#define | ATTENDEDTRANSFER_BRIDGE(channel1, bridge1, channel2, bridge2, channel3, channel4) |
#define | BLINDTRANSFER_EVENT(channel, bridge, extension, context) |
#define | BOB_CALLERID { .id.name.str = "Bob", .id.name.valid = 1, .id.number.str = "200", .id.number.valid = 1, } |
Bob's Caller ID. | |
#define | BRIDGE_ENTER(channel, bridge) |
#define | BRIDGE_ENTER_EVENT(channel, bridge) |
#define | BRIDGE_ENTER_EVENT_PEER(channel, bridge, peer) |
#define | BRIDGE_EXIT(channel, bridge) |
#define | BRIDGE_EXIT_EVENT(channel, bridge) |
#define | BRIDGE_EXIT_EVENT_PEER(channel, bridge, peer) |
#define | BRIDGE_EXIT_SNAPSHOT(channel, bridge) |
#define | CHANNEL_TECH_NAME "CELTestChannel" |
#define | CHARLIE_CALLERID { .id.name.str = "Charlie", .id.name.valid = 1, .id.number.str = "300", .id.number.valid = 1, } |
Charlie's Caller ID. | |
#define | CREATE_ALICE_CHANNEL(channel_var, caller_id) |
Create a test_cel_chan_tech for Alice. | |
#define | CREATE_BOB_CHANNEL(channel_var, caller_id) |
Create a test_cel_chan_tech for Bob. | |
#define | CREATE_CHARLIE_CHANNEL(channel_var, caller_id) |
Create a test_cel_chan_tech for Charlie. | |
#define | CREATE_DAVID_CHANNEL(channel_var, caller_id) |
Create a test_cel_chan_tech for David. | |
#define | DAVID_CALLERID { .id.name.str = "David", .id.name.valid = 1, .id.number.str = "400", .id.number.valid = 1, } |
David's Caller ID. | |
#define | EMULATE_APP_DATA(channel, priority, application, data) |
Emulate a channel entering into an application. | |
#define | EMULATE_DIAL(channel, dialstring) |
#define | HANGUP_CHANNEL(channel, cause, dialstatus) |
Hang up a test channel safely. | |
#define | HANGUP_EVENT(channel, cause, dialstatus) |
#define | SET_FORMATS(chan) |
Set ulaw format on channel. | |
#define | START_DIALED(caller, callee) START_DIALED_FULL(caller, callee, "200", "Bob") |
#define | START_DIALED_FULL(caller, callee, number, name) |
#define | TEST_BACKEND_NAME "CEL Test Logging" |
#define | TEST_CATEGORY "/main/cel/" |
Functions | |
static void | __reg_module (void) |
static struct ast_str * | __test_cel_generate_peer_str (struct ast_channel_snapshot *chan, struct ast_bridge_snapshot *bridge) |
static void | __unreg_module (void) |
static struct ast_event * | ao2_dup_event (const struct ast_event *event) |
static int | append_event (struct ast_event *ev) |
static int | append_expected_event (struct ast_channel *chan, enum ast_cel_event_type type, const char *userdefevname, struct ast_json *extra, const char *peer) |
static int | append_expected_event_snapshot (struct ast_channel_snapshot *snapshot, enum ast_cel_event_type type, const char *userdefevname, struct ast_json *extra, const char *peer) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_TEST_DEFINE (test_cel_attended_transfer_bridges_merge) | |
AST_TEST_DEFINE (test_cel_blind_transfer) | |
AST_TEST_DEFINE (test_cel_channel_creation) | |
AST_TEST_DEFINE (test_cel_dial_answer_no_bridge) | |
AST_TEST_DEFINE (test_cel_dial_answer_twoparty_bridge_a) | |
AST_TEST_DEFINE (test_cel_dial_answer_twoparty_bridge_b) | |
AST_TEST_DEFINE (test_cel_dial_busy) | |
AST_TEST_DEFINE (test_cel_dial_caller_cancel) | |
AST_TEST_DEFINE (test_cel_dial_congestion) | |
AST_TEST_DEFINE (test_cel_dial_parallel_failed) | |
AST_TEST_DEFINE (test_cel_dial_pickup) | |
AST_TEST_DEFINE (test_cel_dial_unanswered) | |
AST_TEST_DEFINE (test_cel_dial_unanswered_filter) | |
AST_TEST_DEFINE (test_cel_dial_unavailable) | |
AST_TEST_DEFINE (test_cel_local_optimize) | |
AST_TEST_DEFINE (test_cel_single_bridge) | |
AST_TEST_DEFINE (test_cel_single_bridge_continue) | |
AST_TEST_DEFINE (test_cel_single_party) | |
AST_TEST_DEFINE (test_cel_single_twoparty_bridge_a) | |
AST_TEST_DEFINE (test_cel_single_twoparty_bridge_b) | |
AST_TEST_DEFINE (test_cel_unanswered_inbound_call) | |
AST_TEST_DEFINE (test_cel_unanswered_outbound_call) | |
static int | cel_verify_and_cleanup_cb (struct ast_test_info *info, struct ast_test *test) |
static int | check_events (struct ast_test *test, struct ao2_container *local_expected, struct ao2_container *local_received) |
static void | do_sleep (void) |
static int | dump_event (struct ast_test *test, struct ast_event *event) |
static int | events_are_equal (struct ast_test *test, struct ast_event *received, struct ast_event *expected) |
static int | load_module (void) |
static int | match_ie_val (const struct ast_event *event1, const struct ast_event *event2, enum ast_event_ie_type type) |
Check an IE value from two events. | |
static void | mid_test_sync (void) |
static void | safe_bridge_destroy (struct ast_bridge *bridge) |
static void | safe_channel_release (struct ast_channel *chan) |
static struct ast_str * | test_cel_generate_peer_str (struct ast_channel *chan, struct ast_bridge *bridge) |
static struct ast_str * | test_cel_generate_peer_str_snapshot (struct ast_channel_snapshot *chan, struct ast_bridge *bridge) |
static int | test_cel_init_cb (struct ast_test_info *info, struct ast_test *test) |
static int | test_cel_peer_strings_match (const char *str1, const char *str2) |
Check two peer strings for equality. | |
static void | test_sub (struct ast_event *event) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "CEL unit tests" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ao2_container * | cel_expected_events = NULL |
static struct ao2_container * | cel_received_events = NULL |
static struct ast_cel_general_config * | cel_test_config |
The CEL config used for CEL unit tests. | |
int | do_mid_test_sync = 0 |
Flag used to trigger a mid-test synchronization, access controlled by mid_test_sync_lock. | |
ast_mutex_t | mid_test_sync_lock |
Lock used for synchronizing test execution stages with received events. | |
static struct ast_cel_general_config * | saved_config |
A placeholder for Asterisk's 'real' CEL configuration. | |
ast_mutex_t | sync_lock |
Lock used with sync_out for checking the end of test execution. | |
ast_cond_t | sync_out |
Condition used for checking the end of test execution. | |
static struct ast_channel_tech | test_cel_chan_tech |
A channel technology used for the unit tests. | |
static struct timespec | to_sleep = {1, 0} |
A 1 second sleep. | |
CEL unit tests.
Definition in file test_cel.c.
#define ALICE_CALLERID { .id.name.str = "Alice", .id.name.valid = 1, .id.number.str = "100", .id.number.valid = 1, } |
Alice's Caller ID.
Definition at line 196 of file test_cel.c.
#define ANSWER_CHANNEL | ( | chan | ) |
Definition at line 262 of file test_cel.c.
#define ANSWER_NO_APP | ( | chan | ) |
Definition at line 267 of file test_cel.c.
#define APPEND_DUMMY_EVENT | ( | ) |
Definition at line 111 of file test_cel.c.
#define APPEND_EVENT | ( | chan, | |
ev_type, | |||
userevent, | |||
extra | |||
) |
Definition at line 93 of file test_cel.c.
#define APPEND_EVENT_PEER | ( | chan, | |
ev_type, | |||
userevent, | |||
extra, | |||
peer | |||
) |
Definition at line 99 of file test_cel.c.
#define APPEND_EVENT_SNAPSHOT | ( | snapshot, | |
ev_type, | |||
userevent, | |||
extra, | |||
peer | |||
) |
Definition at line 105 of file test_cel.c.
#define ATTENDEDTRANSFER_BRIDGE | ( | channel1, | |
bridge1, | |||
channel2, | |||
bridge2, | |||
channel3, | |||
channel4 | |||
) |
Definition at line 180 of file test_cel.c.
#define BLINDTRANSFER_EVENT | ( | channel, | |
bridge, | |||
extension, | |||
context | |||
) |
Definition at line 168 of file test_cel.c.
#define BOB_CALLERID { .id.name.str = "Bob", .id.name.valid = 1, .id.number.str = "200", .id.number.valid = 1, } |
Bob's Caller ID.
Definition at line 199 of file test_cel.c.
#define BRIDGE_ENTER | ( | channel, | |
bridge | |||
) |
Definition at line 147 of file test_cel.c.
#define BRIDGE_ENTER_EVENT | ( | channel, | |
bridge | |||
) |
Definition at line 154 of file test_cel.c.
#define BRIDGE_ENTER_EVENT_PEER | ( | channel, | |
bridge, | |||
peer | |||
) |
Definition at line 161 of file test_cel.c.
#define BRIDGE_EXIT | ( | channel, | |
bridge | |||
) |
Definition at line 117 of file test_cel.c.
#define BRIDGE_EXIT_EVENT | ( | channel, | |
bridge | |||
) |
Definition at line 123 of file test_cel.c.
#define BRIDGE_EXIT_EVENT_PEER | ( | channel, | |
bridge, | |||
peer | |||
) |
Definition at line 130 of file test_cel.c.
#define BRIDGE_EXIT_SNAPSHOT | ( | channel, | |
bridge | |||
) |
Definition at line 137 of file test_cel.c.
#define CHANNEL_TECH_NAME "CELTestChannel" |
Definition at line 56 of file test_cel.c.
#define CHARLIE_CALLERID { .id.name.str = "Charlie", .id.name.valid = 1, .id.number.str = "300", .id.number.valid = 1, } |
Charlie's Caller ID.
Definition at line 202 of file test_cel.c.
#define CREATE_ALICE_CHANNEL | ( | channel_var, | |
caller_id | |||
) |
Create a test_cel_chan_tech for Alice.
Definition at line 221 of file test_cel.c.
#define CREATE_BOB_CHANNEL | ( | channel_var, | |
caller_id | |||
) |
Create a test_cel_chan_tech for Bob.
Definition at line 229 of file test_cel.c.
#define CREATE_CHARLIE_CHANNEL | ( | channel_var, | |
caller_id | |||
) |
Create a test_cel_chan_tech for Charlie.
Definition at line 237 of file test_cel.c.
#define CREATE_DAVID_CHANNEL | ( | channel_var, | |
caller_id | |||
) |
Create a test_cel_chan_tech for David.
Definition at line 245 of file test_cel.c.
#define DAVID_CALLERID { .id.name.str = "David", .id.name.valid = 1, .id.number.str = "400", .id.number.valid = 1, } |
David's Caller ID.
Definition at line 205 of file test_cel.c.
#define EMULATE_APP_DATA | ( | channel, | |
priority, | |||
application, | |||
data | |||
) |
Emulate a channel entering into an application.
Definition at line 253 of file test_cel.c.
#define EMULATE_DIAL | ( | channel, | |
dialstring | |||
) |
Definition at line 745 of file test_cel.c.
#define HANGUP_CHANNEL | ( | channel, | |
cause, | |||
dialstatus | |||
) |
Hang up a test channel safely.
Definition at line 273 of file test_cel.c.
#define HANGUP_EVENT | ( | channel, | |
cause, | |||
dialstatus | |||
) |
Definition at line 284 of file test_cel.c.
#define SET_FORMATS | ( | chan | ) |
Set ulaw format on channel.
Definition at line 208 of file test_cel.c.
#define START_DIALED | ( | caller, | |
callee | |||
) | START_DIALED_FULL(caller, callee, "200", "Bob") |
Definition at line 752 of file test_cel.c.
Definition at line 755 of file test_cel.c.
#define TEST_BACKEND_NAME "CEL Test Logging" |
Definition at line 58 of file test_cel.c.
#define TEST_CATEGORY "/main/cel/" |
Definition at line 54 of file test_cel.c.
|
static |
Definition at line 2231 of file test_cel.c.
|
static |
Definition at line 314 of file test_cel.c.
References ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ast_channel_snapshot_get_latest(), ast_str_append(), ast_str_create, ast_str_truncate(), ast_channel_snapshot::base, ast_bridge_snapshot::channels, NULL, RAII_VAR, and ast_channel_snapshot_base::uniqueid.
Referenced by test_cel_generate_peer_str_snapshot().
|
static |
Definition at line 2231 of file test_cel.c.
Definition at line 1689 of file test_cel.c.
References ao2_alloc, ast_event_get_size(), ast_event::event_len, and NULL.
Referenced by append_event(), and test_sub().
|
static |
Definition at line 1729 of file test_cel.c.
References ao2_cleanup, ao2_dup_event(), ao2_link, cel_expected_events, NULL, and RAII_VAR.
Referenced by append_expected_event_snapshot().
|
static |
Definition at line 1772 of file test_cel.c.
References ao2_cleanup, append_expected_event_snapshot(), ast_channel_lock, ast_channel_snapshot_create(), ast_channel_unlock, NULL, RAII_VAR, and type.
|
static |
Definition at line 1756 of file test_cel.c.
References append_event(), ast_cel_create_event(), ast_free, NULL, RAII_VAR, and type.
Referenced by append_expected_event().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 2231 of file test_cel.c.
AST_TEST_DEFINE | ( | test_cel_attended_transfer_bridges_merge | ) |
Definition at line 1387 of file test_cel.c.
References ALICE_CALLERID, ANSWER_NO_APP, ast_bridge_base_new(), AST_BRIDGE_CAPABILITY_1TO1MIX, AST_BRIDGE_CAPABILITY_MULTIMIX, AST_BRIDGE_CAPABILITY_NATIVE, AST_BRIDGE_FLAG_SMART, AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM, AST_BRIDGE_FLAG_TRANSFER_PROHIBITED, ast_bridge_transfer_attended(), AST_CAUSE_NORMAL, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ATTENDEDTRANSFER_BRIDGE, BOB_CALLERID, BRIDGE_ENTER, BRIDGE_ENTER_EVENT_PEER, BRIDGE_EXIT, BRIDGE_EXIT_EVENT, BRIDGE_EXIT_EVENT_PEER, CHARLIE_CALLERID, CREATE_ALICE_CHANNEL, CREATE_BOB_CHANNEL, CREATE_CHARLIE_CHANNEL, CREATE_DAVID_CHANNEL, do_sleep(), HANGUP_CHANNEL, NULL, RAII_VAR, safe_bridge_destroy(), safe_channel_release(), TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_blind_transfer | ) |
Definition at line 1240 of file test_cel.c.
References ALICE_CALLERID, ANSWER_NO_APP, ao2_cleanup, ast_blind_transfer_message_create(), ast_bridge_basic_new(), ast_bridge_lock, ast_bridge_publish_blind_transfer(), ast_bridge_snapshot_create(), AST_BRIDGE_TRANSFER_SUCCESS, ast_bridge_unlock, AST_CAUSE_NORMAL, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, BLINDTRANSFER_EVENT, BOB_CALLERID, BRIDGE_ENTER, BRIDGE_EXIT, CREATE_ALICE_CHANNEL, CREATE_BOB_CHANNEL, do_sleep(), HANGUP_CHANNEL, NULL, RAII_VAR, safe_bridge_destroy(), safe_channel_release(), TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_channel_creation | ) |
Definition at line 393 of file test_cel.c.
References ALICE_CALLERID, AST_CAUSE_NORMAL, AST_TEST_NOT_RUN, AST_TEST_PASS, CREATE_ALICE_CHANNEL, HANGUP_CHANNEL, NULL, RAII_VAR, safe_channel_release(), TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_dial_answer_no_bridge | ) |
Definition at line 1026 of file test_cel.c.
References ALICE_CALLERID, ANSWER_NO_APP, AST_CAUSE_NORMAL, ast_channel_flags(), ast_channel_publish_dial(), ast_channel_state_set(), ast_clear_flag, AST_FLAG_OUTGOING, AST_STATE_RINGING, AST_TEST_NOT_RUN, AST_TEST_PASS, CHANNEL_TECH_NAME, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, EMULATE_DIAL, HANGUP_CHANNEL, NULL, RAII_VAR, safe_channel_release(), START_DIALED, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_dial_answer_twoparty_bridge_a | ) |
Definition at line 1070 of file test_cel.c.
References ALICE_CALLERID, ANSWER_NO_APP, ast_bridge_basic_new(), AST_CAUSE_NORMAL, ast_channel_publish_dial(), ast_channel_state_set(), AST_STATE_RINGING, AST_TEST_NOT_RUN, AST_TEST_PASS, BRIDGE_ENTER, BRIDGE_EXIT, CHANNEL_TECH_NAME, CREATE_ALICE_CHANNEL, do_sleep(), EMULATE_DIAL, HANGUP_CHANNEL, NULL, RAII_VAR, safe_bridge_destroy(), safe_channel_release(), START_DIALED, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_dial_answer_twoparty_bridge_b | ) |
Definition at line 1117 of file test_cel.c.
References ALICE_CALLERID, ANSWER_NO_APP, ast_bridge_basic_new(), AST_CAUSE_NORMAL, ast_channel_publish_dial(), ast_channel_state_set(), AST_STATE_RINGING, AST_TEST_NOT_RUN, AST_TEST_PASS, BRIDGE_ENTER, BRIDGE_EXIT, CHANNEL_TECH_NAME, CREATE_ALICE_CHANNEL, do_sleep(), EMULATE_DIAL, HANGUP_CHANNEL, NULL, RAII_VAR, safe_bridge_destroy(), safe_channel_release(), START_DIALED, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_dial_busy | ) |
Definition at line 836 of file test_cel.c.
References ALICE_CALLERID, AST_CAUSE_BUSY, ast_channel_publish_dial(), ast_channel_state_set(), AST_STATE_RINGING, AST_TEST_NOT_RUN, AST_TEST_PASS, CHANNEL_TECH_NAME, CREATE_ALICE_CHANNEL, EMULATE_DIAL, HANGUP_CHANNEL, NULL, RAII_VAR, safe_channel_release(), START_DIALED, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_dial_caller_cancel | ) |
Definition at line 938 of file test_cel.c.
References ALICE_CALLERID, AST_CAUSE_NORMAL, ast_channel_publish_dial(), ast_channel_state_set(), AST_STATE_RINGING, AST_TEST_NOT_RUN, AST_TEST_PASS, CHANNEL_TECH_NAME, CREATE_ALICE_CHANNEL, EMULATE_DIAL, HANGUP_CHANNEL, NULL, RAII_VAR, safe_channel_release(), START_DIALED, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_dial_congestion | ) |
Definition at line 870 of file test_cel.c.
References ALICE_CALLERID, AST_CAUSE_CONGESTION, ast_channel_publish_dial(), ast_channel_state_set(), AST_STATE_RINGING, AST_TEST_NOT_RUN, AST_TEST_PASS, CHANNEL_TECH_NAME, CREATE_ALICE_CHANNEL, EMULATE_DIAL, HANGUP_CHANNEL, NULL, RAII_VAR, safe_channel_release(), START_DIALED, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_dial_parallel_failed | ) |
Definition at line 973 of file test_cel.c.
References ALICE_CALLERID, AST_CAUSE_BUSY, AST_CAUSE_CONGESTION, AST_CAUSE_NORMAL, ast_channel_publish_dial(), ast_channel_state_set(), AST_STATE_RINGING, AST_TEST_NOT_RUN, AST_TEST_PASS, CHANNEL_TECH_NAME, CREATE_ALICE_CHANNEL, EMULATE_DIAL, HANGUP_CHANNEL, NULL, RAII_VAR, safe_channel_release(), START_DIALED_FULL, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_dial_pickup | ) |
Definition at line 1561 of file test_cel.c.
References ALICE_CALLERID, APPEND_EVENT, AST_CAUSE_NORMAL, AST_CEL_PICKUP, ast_channel_name(), ast_channel_publish_dial(), ast_channel_state_set(), ast_channel_uniqueid(), ast_do_pickup(), ast_json_pack(), ast_json_unref(), AST_STATE_RINGING, AST_TEST_NOT_RUN, AST_TEST_PASS, CHANNEL_TECH_NAME, CHARLIE_CALLERID, CREATE_ALICE_CHANNEL, CREATE_CHARLIE_CHANNEL, EMULATE_DIAL, HANGUP_CHANNEL, lock, NULL, RAII_VAR, safe_channel_release(), SCOPED_CHANNELLOCK, START_DIALED, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_dial_unanswered | ) |
Definition at line 767 of file test_cel.c.
References ALICE_CALLERID, AST_CAUSE_NO_ANSWER, ast_channel_publish_dial(), ast_channel_state_set(), AST_STATE_RINGING, AST_TEST_NOT_RUN, AST_TEST_PASS, CHANNEL_TECH_NAME, CREATE_ALICE_CHANNEL, EMULATE_DIAL, HANGUP_CHANNEL, NULL, RAII_VAR, safe_channel_release(), START_DIALED, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_dial_unanswered_filter | ) |
Definition at line 801 of file test_cel.c.
References ALICE_CALLERID, AST_CAUSE_NO_ANSWER, ast_channel_publish_dial(), ast_channel_state_set(), AST_STATE_RINGING, AST_TEST_NOT_RUN, AST_TEST_PASS, CHANNEL_TECH_NAME, CREATE_ALICE_CHANNEL, EMULATE_DIAL, HANGUP_CHANNEL, NULL, RAII_VAR, safe_channel_release(), START_DIALED, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_dial_unavailable | ) |
Definition at line 904 of file test_cel.c.
References ALICE_CALLERID, AST_CAUSE_NO_ROUTE_DESTINATION, ast_channel_publish_dial(), ast_channel_state_set(), AST_STATE_RINGING, AST_TEST_NOT_RUN, AST_TEST_PASS, CHANNEL_TECH_NAME, CREATE_ALICE_CHANNEL, EMULATE_DIAL, HANGUP_CHANNEL, NULL, RAII_VAR, safe_channel_release(), START_DIALED, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_local_optimize | ) |
Definition at line 1616 of file test_cel.c.
References ALICE_CALLERID, ao2_cleanup, APPEND_EVENT_SNAPSHOT, AST_CAUSE_NORMAL, AST_CEL_LOCAL_OPTIMIZE, ast_channel_lock, ast_channel_snapshot_create(), ast_channel_topic(), ast_channel_unlock, ast_json_null(), ast_json_pack(), ast_json_unref(), ast_local_optimization_begin_type(), ast_local_optimization_end_type(), ast_multi_channel_blob_add_channel(), ast_multi_channel_blob_create(), AST_TEST_NOT_RUN, AST_TEST_PASS, BOB_CALLERID, CREATE_ALICE_CHANNEL, CREATE_BOB_CHANNEL, HANGUP_CHANNEL, NULL, RAII_VAR, safe_channel_release(), stasis_message_create(), stasis_publish(), TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_single_bridge | ) |
Definition at line 505 of file test_cel.c.
References ALICE_CALLERID, ANSWER_CHANNEL, ast_bridge_basic_new(), AST_CAUSE_NORMAL, AST_TEST_NOT_RUN, AST_TEST_PASS, BRIDGE_ENTER, BRIDGE_EXIT, CREATE_ALICE_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, NULL, RAII_VAR, safe_bridge_destroy(), safe_channel_release(), TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_single_bridge_continue | ) |
Definition at line 544 of file test_cel.c.
References ALICE_CALLERID, ANSWER_CHANNEL, ast_bridge_basic_new(), AST_CAUSE_NORMAL, AST_TEST_NOT_RUN, AST_TEST_PASS, BRIDGE_ENTER, BRIDGE_EXIT, CREATE_ALICE_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, NULL, RAII_VAR, safe_bridge_destroy(), safe_channel_release(), TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_single_party | ) |
Definition at line 478 of file test_cel.c.
References ALICE_CALLERID, ANSWER_CHANNEL, AST_CAUSE_NORMAL, AST_TEST_NOT_RUN, AST_TEST_PASS, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, HANGUP_CHANNEL, NULL, RAII_VAR, safe_channel_release(), TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_single_twoparty_bridge_a | ) |
Definition at line 585 of file test_cel.c.
References ALICE_CALLERID, ANSWER_CHANNEL, ast_bridge_basic_new(), AST_CAUSE_NORMAL, AST_TEST_NOT_RUN, AST_TEST_PASS, BOB_CALLERID, BRIDGE_ENTER, BRIDGE_EXIT, CREATE_ALICE_CHANNEL, CREATE_BOB_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, NULL, RAII_VAR, safe_bridge_destroy(), safe_channel_release(), TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_single_twoparty_bridge_b | ) |
Definition at line 633 of file test_cel.c.
References ALICE_CALLERID, ANSWER_CHANNEL, ast_bridge_basic_new(), AST_CAUSE_NORMAL, AST_TEST_NOT_RUN, AST_TEST_PASS, BOB_CALLERID, BRIDGE_ENTER, BRIDGE_EXIT, CREATE_ALICE_CHANNEL, CREATE_BOB_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, NULL, RAII_VAR, safe_bridge_destroy(), safe_channel_release(), TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_unanswered_inbound_call | ) |
Definition at line 417 of file test_cel.c.
References ALICE_CALLERID, AST_CAUSE_NORMAL, AST_TEST_NOT_RUN, AST_TEST_PASS, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, HANGUP_CHANNEL, NULL, RAII_VAR, safe_channel_release(), TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | test_cel_unanswered_outbound_call | ) |
Definition at line 445 of file test_cel.c.
References AST_CAUSE_NORMAL, ast_channel_context_set(), ast_channel_exten_set(), ast_channel_flags(), AST_FLAG_ORIGINATED, ast_set_flag, AST_TEST_NOT_RUN, AST_TEST_PASS, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, HANGUP_CHANNEL, ast_party_caller::id, ast_party_id::name, NULL, RAII_VAR, safe_channel_release(), ast_party_name::str, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
|
static |
Definition at line 2076 of file test_cel.c.
References ao2_cleanup, ast_assert, ast_cel_backend_unregister(), ast_cel_set_config(), ast_cond_destroy, ast_mutex_destroy, cel_expected_events, cel_received_events, check_events(), do_sleep(), mid_test_sync_lock, NULL, RAII_VAR, saved_config, sync_lock, sync_out, and TEST_BACKEND_NAME.
Referenced by load_module().
|
static |
Definition at line 2010 of file test_cel.c.
References ao2_cleanup, ao2_container_count(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, AST_EVENT_CUSTOM, ast_event_get_type(), ast_test_status_update, debug, dump_event(), events_are_equal(), NULL, and RAII_VAR.
Referenced by cel_verify_and_cleanup_cb().
|
static |
Definition at line 87 of file test_cel.c.
References errno, and to_sleep.
Referenced by AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), and cel_verify_and_cleanup_cb().
|
static |
Definition at line 1969 of file test_cel.c.
References ast_cel_get_type_name(), ast_event_get_ie_pltype(), ast_event_get_ie_type_name(), ast_event_get_ie_uint(), AST_EVENT_IE_CEL_EVENT_TYPE, AST_EVENT_IE_PLTYPE_STR, AST_EVENT_IE_PLTYPE_UINT, AST_EVENT_IE_PLTYPE_UNKNOWN, ast_event_iterator_get_ie_str(), ast_event_iterator_get_ie_type(), ast_event_iterator_get_ie_uint(), ast_event_iterator_init(), ast_event_iterator_next(), and ast_test_status_update.
Referenced by check_events().
|
static |
Definition at line 1948 of file test_cel.c.
References AST_EVENT_CUSTOM, ast_event_get_ie_type_name(), ast_event_get_type(), ast_event_iterator_get_ie_type(), ast_event_iterator_init(), ast_event_iterator_next(), ast_test_status_update, and match_ie_val().
Referenced by check_events().
|
static |
Definition at line 2156 of file test_cel.c.
References ast_cel_general_config::apps, AST_CEL_ANSWER, AST_CEL_APP_START, AST_CEL_ATTENDEDTRANSFER, AST_CEL_BLINDTRANSFER, AST_CEL_BRIDGE_ENTER, AST_CEL_BRIDGE_EXIT, AST_CEL_CHANNEL_END, AST_CEL_CHANNEL_START, ast_cel_general_config_alloc(), AST_CEL_HANGUP, AST_CEL_LOCAL_OPTIMIZE, AST_CEL_PICKUP, ast_channel_register(), AST_MODULE_LOAD_SUCCESS, ast_str_container_add(), AST_TEST_REGISTER, cel_test_config, cel_verify_and_cleanup_cb(), ast_cel_general_config::enable, ast_cel_general_config::events, TEST_CATEGORY, test_cel_chan_tech, and test_cel_init_cb().
|
static |
Check an IE value from two events.
zero | if the IEs in the events of the specified type do not match |
non-zero | if the IEs in the events of the specified type match |
Definition at line 1895 of file test_cel.c.
References ast_event_get_ie_pltype(), ast_event_get_ie_str(), ast_event_get_ie_uint(), AST_EVENT_IE_CEL_EVENT_TIME, AST_EVENT_IE_CEL_EVENT_TIME_USEC, AST_EVENT_IE_CEL_PEER, AST_EVENT_IE_PLTYPE_BITFLAGS, AST_EVENT_IE_PLTYPE_RAW, AST_EVENT_IE_PLTYPE_STR, AST_EVENT_IE_PLTYPE_UINT, test_cel_peer_strings_match(), and type.
Referenced by events_are_equal().
|
static |
Definition at line 1706 of file test_cel.c.
References ao2_container_count(), ast_cond_timedwait, ast_mutex_lock, ast_mutex_unlock, ast_tvnow(), cel_expected_events, cel_received_events, do_mid_test_sync, end, lock, mid_test_sync_lock, SCOPED_MUTEX, sync_lock, and sync_out.
|
static |
Definition at line 385 of file test_cel.c.
References ast_bridge_destroy().
Referenced by AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), and AST_TEST_DEFINE().
|
static |
Definition at line 377 of file test_cel.c.
References ast_channel_release().
Referenced by AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), and AST_TEST_DEFINE().
|
static |
Definition at line 364 of file test_cel.c.
References ao2_cleanup, ast_channel_snapshot_get_latest(), ast_channel_uniqueid(), NULL, RAII_VAR, and test_cel_generate_peer_str_snapshot().
|
static |
Definition at line 351 of file test_cel.c.
References __test_cel_generate_peer_str(), ao2_cleanup, ast_bridge_get_snapshot(), NULL, and RAII_VAR.
Referenced by test_cel_generate_peer_str().
|
static |
Definition at line 1825 of file test_cel.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_list, ast_assert, ast_cel_backend_register(), ast_cel_get_config(), ast_cel_set_config(), ast_cond_init, ast_mutex_init, cel_expected_events, cel_received_events, cel_test_config, mid_test_sync_lock, NULL, saved_config, sync_lock, sync_out, TEST_BACKEND_NAME, and test_sub().
Referenced by load_module().
|
static |
Check two peer strings for equality.
zero | if the peer strings do not match |
non-zero | if the peer strings match |
Definition at line 1855 of file test_cel.c.
References ao2_cleanup, ao2_container_count(), ao2_find, ast_free, ast_str_container_add(), ast_str_container_alloc, ast_str_container_remove(), ast_strdup, OBJ_SEARCH_KEY, RAII_VAR, and strsep().
Referenced by match_ie_val().
|
static |
Definition at line 1790 of file test_cel.c.
References ao2_cleanup, ao2_container_count(), ao2_dup_event(), ao2_link, ast_cond_signal, ast_event_get_ie_str(), AST_EVENT_IE_CEL_CHANNAME, cel_expected_events, cel_received_events, CHANNEL_TECH_NAME, do_mid_test_sync, lock, mid_test_sync_lock, RAII_VAR, SCOPED_MUTEX, sync_lock, and sync_out.
Referenced by test_cel_init_cb().
|
static |
Definition at line 2107 of file test_cel.c.
References ao2_cleanup, ast_channel_unregister(), AST_TEST_UNREGISTER, cel_expected_events, cel_received_events, cel_test_config, NULL, and test_cel_chan_tech.
|
static |
Definition at line 2231 of file test_cel.c.
|
static |
Definition at line 2231 of file test_cel.c.
|
static |
Container for expected CEL events
Definition at line 1687 of file test_cel.c.
Referenced by append_event(), cel_verify_and_cleanup_cb(), mid_test_sync(), test_cel_init_cb(), test_sub(), and unload_module().
|
static |
Container for astobj2 duplicated ast_events
Definition at line 1684 of file test_cel.c.
Referenced by cel_verify_and_cleanup_cb(), mid_test_sync(), test_cel_init_cb(), test_sub(), and unload_module().
|
static |
The CEL config used for CEL unit tests.
Definition at line 64 of file test_cel.c.
Referenced by load_module(), test_cel_init_cb(), and unload_module().
int do_mid_test_sync = 0 |
Flag used to trigger a mid-test synchronization, access controlled by mid_test_sync_lock.
Definition at line 76 of file test_cel.c.
Referenced by mid_test_sync(), and test_sub().
ast_mutex_t mid_test_sync_lock |
Lock used for synchronizing test execution stages with received events.
Definition at line 67 of file test_cel.c.
Referenced by cel_verify_and_cleanup_cb(), mid_test_sync(), test_cel_init_cb(), and test_sub().
|
static |
A placeholder for Asterisk's 'real' CEL configuration.
Definition at line 61 of file test_cel.c.
Referenced by cel_verify_and_cleanup_cb(), and test_cel_init_cb().
ast_mutex_t sync_lock |
Lock used with sync_out for checking the end of test execution.
Definition at line 70 of file test_cel.c.
Referenced by cel_verify_and_cleanup_cb(), mid_test_sync(), test_cel_init_cb(), and test_sub().
ast_cond_t sync_out |
Condition used for checking the end of test execution.
Definition at line 73 of file test_cel.c.
Referenced by cel_verify_and_cleanup_cb(), mid_test_sync(), test_cel_init_cb(), and test_sub().
|
static |
A channel technology used for the unit tests.
Definition at line 79 of file test_cel.c.
Referenced by load_module(), and unload_module().
|
static |
A 1 second sleep.
Definition at line 85 of file test_cel.c.
Referenced by AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), do_sleep(), and do_sleep().