Asterisk - The Open Source Telephony Project
18.5.0
|
CDR unit tests. More...
#include "asterisk.h"
#include <math.h>
#include "asterisk/module.h"
#include "asterisk/test.h"
#include "asterisk/cdr.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/stasis_channels.h"
#include "asterisk/stasis_bridges.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Data Structures | |
struct | test_cdr_entry |
Macros | |
#define | ALICE_CALLERID { .id.name.str = "Alice", .id.name.valid = 1, .id.number.str = "100", .id.number.valid = 1, } |
Alice's Caller ID. More... | |
#define | BOB_CALLERID { .id.name.str = "Bob", .id.name.valid = 1, .id.number.str = "200", .id.number.valid = 1, } |
Bob's Caller ID. More... | |
#define | CHANNEL_TECH_NAME "CDRTestChannel" |
#define | CHARLIE_CALLERID { .id.name.str = "Charlie", .id.name.valid = 1, .id.number.str = "300", .id.number.valid = 1, } |
Charlie's Caller ID. More... | |
#define | COPY_IDS(channel_var, expected_record) |
Copy the linkedid and uniqueid from a channel to an expected CDR. More... | |
#define | CREATE_ALICE_CHANNEL(channel_var, caller_id, expected_record) |
Create a test_cdr_chan_tech for Alice, and set the expected CDR records' linkedid and uniqueid. More... | |
#define | CREATE_BOB_CHANNEL(channel_var, caller_id, expected_record) |
Create a test_cdr_chan_tech for Bob, and set the expected CDR records' linkedid and uniqueid. More... | |
#define | CREATE_CHARLIE_CHANNEL(channel_var, caller_id, expected_record) |
Create a test_cdr_chan_tech for Charlie, and set the expected CDR records' linkedid and uniqueid. More... | |
#define | CREATE_DAVID_CHANNEL(channel_var, caller_id, expected_record) |
Create a test_cdr_chan_tech for Charlie, and set the expected CDR records' linkedid and uniqueid. More... | |
#define | DAVID_CALLERID { .id.name.str = "David", .id.name.valid = 1, .id.number.str = "400", .id.number.valid = 1, } |
David's Caller ID. More... | |
#define | EMULATE_APP_DATA(channel, priority, application, data) |
Emulate a channel entering into an application. More... | |
#define | EPSILON 0.001 |
#define | HANGUP_CHANNEL(channel, cause) |
Hang up a test channel safely. More... | |
#define | MOCK_CDR_BACKEND "mock_cdr_backend" |
#define | SET_FORMATS(chan) |
Set ulaw format on channel. More... | |
#define | SWAP_CONFIG(ao2_config, template) |
Macro to swap a configuration out from the CDR engine. This should be used at the beginning of each test to set the needed configuration for that test. More... | |
#define | TEST_CATEGORY "/main/cdr/" |
#define | VERIFY_NUMERIC_FIELD(field, actual, expected) |
Verify a numeric field. This will set the test status result to fail; as such, it assumes that (a) test is the test object variable, and (b) that a return variable res exists. More... | |
#define | VERIFY_STRING_FIELD(field, actual, expected) |
Verify a string field. This will set the test status result to fail; as such, it assumes that (a) test is the test object variable, and (b) that a return variable res exists. More... | |
#define | VERIFY_TIME_VALUE(field, actual) |
Verify a time field. This will set the test status result to fail; as such, it assumes that (a) test is the test object variable, and (b) that a return variable res exists. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_TEST_DEFINE (test_cdr_channel_creation) | |
AST_TEST_DEFINE (test_cdr_unanswered_inbound_call) | |
AST_TEST_DEFINE (test_cdr_unanswered_outbound_call) | |
AST_TEST_DEFINE (test_cdr_outbound_bridged_call) | |
AST_TEST_DEFINE (test_cdr_single_party) | |
AST_TEST_DEFINE (test_cdr_single_bridge) | |
AST_TEST_DEFINE (test_cdr_single_bridge_continue) | |
AST_TEST_DEFINE (test_cdr_single_twoparty_bridge_a) | |
AST_TEST_DEFINE (test_cdr_single_twoparty_bridge_b) | |
AST_TEST_DEFINE (test_cdr_single_multiparty_bridge) | |
AST_TEST_DEFINE (test_cdr_dial_unanswered) | |
AST_TEST_DEFINE (test_cdr_dial_busy) | |
AST_TEST_DEFINE (test_cdr_dial_congestion) | |
AST_TEST_DEFINE (test_cdr_dial_unavailable) | |
AST_TEST_DEFINE (test_cdr_dial_caller_cancel) | |
AST_TEST_DEFINE (test_cdr_dial_parallel_failed) | |
AST_TEST_DEFINE (test_cdr_dial_answer_no_bridge) | |
AST_TEST_DEFINE (test_cdr_dial_answer_twoparty_bridge_a) | |
AST_TEST_DEFINE (test_cdr_dial_answer_twoparty_bridge_b) | |
AST_TEST_DEFINE (test_cdr_dial_answer_multiparty) | |
AST_TEST_DEFINE (test_cdr_park) | |
AST_TEST_DEFINE (test_cdr_fields) | |
AST_TEST_DEFINE (test_cdr_no_reset_cdr) | |
AST_TEST_DEFINE (test_cdr_fork_cdr) | |
static void | clear_mock_cdr_backend (void) |
static void | do_sleep (struct timespec *to_sleep) |
static int | load_module (void) |
static int | mock_cdr_backend_cb (struct ast_cdr *cdr) |
static void | safe_bridge_destroy (struct ast_bridge *bridge) |
static void | safe_channel_release (struct ast_channel *chan) |
static int | test_cdr_cleanup_cb (struct ast_test_info *info, struct ast_test *test) |
static int | test_cdr_init_cb (struct ast_test_info *info, struct ast_test *test) |
static int | unload_module (void) |
static enum ast_test_result_state | verify_mock_cdr_record (struct ast_test *test, struct ast_cdr *expected, int record) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "CDR unit tests" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
struct { | |
struct test_cdr_entry * first | |
struct test_cdr_entry * last | |
ast_mutex_t lock | |
} | actual_cdr_entries = AST_LIST_HEAD_INIT_VALUE |
A linked list of received CDR entries from the engine. More... | |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_cdr_config | congestion_cdr_config |
A configuration suitable for CDRs with congestion enabled. More... | |
static struct ast_cdr_config | debug_cdr_config |
A configuration suitable for 'normal' CDRs. More... | |
static int | global_mock_cdr_count |
The number of CDRs the mock backend has received. More... | |
static ast_cond_t | mock_cdr_cond |
The Mock CDR backend condition wait. More... | |
static struct ast_cdr_config * | saved_config |
A placeholder for Asterisk's 'real' CDR configuration. More... | |
static struct ast_channel_tech | test_cdr_chan_tech |
A channel technology used for the unit tests. More... | |
static struct ast_cdr_config | unanswered_cdr_config |
A configuration suitable for CDRs with unanswered records. More... | |
CDR unit tests.
Definition in file test_cdr.c.
#define ALICE_CALLERID { .id.name.str = "Alice", .id.name.valid = 1, .id.number.str = "100", .id.number.valid = 1, } |
#define BOB_CALLERID { .id.name.str = "Bob", .id.name.valid = 1, .id.number.str = "200", .id.number.valid = 1, } |
#define CHANNEL_TECH_NAME "CDRTestChannel" |
Definition at line 55 of file test_cdr.c.
Referenced by AST_TEST_DEFINE().
#define CHARLIE_CALLERID { .id.name.str = "Charlie", .id.name.valid = 1, .id.number.str = "300", .id.number.valid = 1, } |
#define COPY_IDS | ( | channel_var, | |
expected_record | |||
) |
Copy the linkedid and uniqueid from a channel to an expected CDR.
Definition at line 228 of file test_cdr.c.
Referenced by AST_TEST_DEFINE().
#define CREATE_ALICE_CHANNEL | ( | channel_var, | |
caller_id, | |||
expected_record | |||
) |
Create a test_cdr_chan_tech for Alice, and set the expected CDR records' linkedid and uniqueid.
Definition at line 248 of file test_cdr.c.
Referenced by AST_TEST_DEFINE().
#define CREATE_BOB_CHANNEL | ( | channel_var, | |
caller_id, | |||
expected_record | |||
) |
Create a test_cdr_chan_tech for Bob, and set the expected CDR records' linkedid and uniqueid.
Definition at line 259 of file test_cdr.c.
Referenced by AST_TEST_DEFINE().
#define CREATE_CHARLIE_CHANNEL | ( | channel_var, | |
caller_id, | |||
expected_record | |||
) |
Create a test_cdr_chan_tech for Charlie, and set the expected CDR records' linkedid and uniqueid.
Definition at line 270 of file test_cdr.c.
Referenced by AST_TEST_DEFINE().
#define CREATE_DAVID_CHANNEL | ( | channel_var, | |
caller_id, | |||
expected_record | |||
) |
Create a test_cdr_chan_tech for Charlie, and set the expected CDR records' linkedid and uniqueid.
Definition at line 281 of file test_cdr.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 225 of file test_cdr.c.
Emulate a channel entering into an application.
Definition at line 291 of file test_cdr.c.
Referenced by AST_TEST_DEFINE().
#define EPSILON 0.001 |
Definition at line 49 of file test_cdr.c.
Referenced by AST_TEST_DEFINE().
#define HANGUP_CHANNEL | ( | channel, | |
cause | |||
) |
Hang up a test channel safely.
Definition at line 303 of file test_cdr.c.
Referenced by AST_TEST_DEFINE().
#define MOCK_CDR_BACKEND "mock_cdr_backend" |
Definition at line 53 of file test_cdr.c.
Referenced by load_module(), and unload_module().
#define SET_FORMATS | ( | chan | ) |
Set ulaw format on channel.
Definition at line 234 of file test_cdr.c.
Referenced by AST_TEST_DEFINE().
#define SWAP_CONFIG | ( | ao2_config, | |
template | |||
) |
Macro to swap a configuration out from the CDR engine. This should be used at the beginning of each test to set the needed configuration for that test.
Definition at line 79 of file test_cdr.c.
Referenced by AST_TEST_DEFINE().
#define TEST_CATEGORY "/main/cdr/" |
Definition at line 51 of file test_cdr.c.
Referenced by AST_TEST_DEFINE(), and load_module().
#define VERIFY_NUMERIC_FIELD | ( | field, | |
actual, | |||
expected | |||
) |
Verify a numeric field. This will set the test status result to fail; as such, it assumes that (a) test is the test object variable, and (b) that a return variable res exists.
Definition at line 197 of file test_cdr.c.
Referenced by verify_mock_cdr_record().
#define VERIFY_STRING_FIELD | ( | field, | |
actual, | |||
expected | |||
) |
Verify a string field. This will set the test status result to fail; as such, it assumes that (a) test is the test object variable, and (b) that a return variable res exists.
Definition at line 186 of file test_cdr.c.
Referenced by verify_mock_cdr_record().
#define VERIFY_TIME_VALUE | ( | field, | |
actual | |||
) |
Verify a time field. This will set the test status result to fail; as such, it assumes that (a) test is the test object variable, and (b) that a return variable res exists.
Definition at line 208 of file test_cdr.c.
Referenced by verify_mock_cdr_record().
|
static |
Definition at line 2628 of file test_cdr.c.
|
static |
Definition at line 2628 of file test_cdr.c.
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 2628 of file test_cdr.c.
AST_TEST_DEFINE | ( | test_cdr_channel_creation | ) |
Definition at line 393 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, AST_CAUSE_NORMAL, AST_CDR_NOANSWER, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_channel_release(), SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_unanswered_inbound_call | ) |
Definition at line 435 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, AST_CAUSE_NORMAL, AST_CDR_NOANSWER, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_channel_release(), SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_unanswered_outbound_call | ) |
Definition at line 483 of file test_cdr.c.
References ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, AST_CAUSE_NORMAL, AST_CDR_NOANSWER, ast_channel_context_set(), ast_channel_exten_set(), ast_channel_flags(), AST_FLAG_ORIGINATED, ast_set_flag, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, HANGUP_CHANNEL, ast_party_caller::id, sip_to_pjsip::info(), ast_party_id::name, NULL, RAII_VAR, result, safe_channel_release(), ast_party_name::str, SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_outbound_bridged_call | ) |
Definition at line 535 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, ast_bridge_basic_new(), ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, ast_channel_alloc, ast_channel_flags(), ast_channel_linkedid(), ast_channel_publish_dial(), ast_channel_state_set(), ast_channel_uniqueid(), ast_channel_unlock, ast_copy_string(), AST_FLAG_ORIGINATED, AST_FLAG_OUTGOING, ast_set_flag, AST_STATE_DOWN, AST_STATE_RINGING, AST_STATE_UP, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), ast_cdr::linkedid, NULL, RAII_VAR, result, safe_bridge_destroy(), safe_channel_release(), SET_FORMATS, SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, ast_cdr::uniqueid, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_single_party | ) |
Definition at line 633 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, ast_channel_lock, ast_channel_unlock, ast_setstate(), AST_STATE_UP, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_channel_release(), SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_single_bridge | ) |
Definition at line 684 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, ast_bridge_basic_new(), ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, ast_channel_lock, ast_channel_unlock, ast_setstate(), AST_STATE_UP, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_bridge_destroy(), safe_channel_release(), SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_single_bridge_continue | ) |
Definition at line 745 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, ast_bridge_basic_new(), ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, ast_channel_lock, ast_channel_unlock, ast_setstate(), AST_STATE_UP, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, COPY_IDS, CREATE_ALICE_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_bridge_destroy(), safe_channel_release(), SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_single_twoparty_bridge_a | ) |
Definition at line 824 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, ast_bridge_basic_new(), ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, ast_channel_linkedid(), ast_channel_lock, ast_channel_unlock, ast_copy_string(), ast_setstate(), AST_STATE_UP, AST_TEST_NOT_RUN, BOB_CALLERID, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, CREATE_BOB_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), ast_cdr::linkedid, NULL, RAII_VAR, result, safe_bridge_destroy(), safe_channel_release(), SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_single_twoparty_bridge_b | ) |
Definition at line 916 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, ast_bridge_basic_new(), ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, ast_channel_linkedid(), ast_channel_lock, ast_channel_unlock, ast_copy_string(), ast_setstate(), AST_STATE_UP, AST_TEST_NOT_RUN, BOB_CALLERID, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, CREATE_BOB_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), ast_cdr::linkedid, NULL, RAII_VAR, result, safe_bridge_destroy(), safe_channel_release(), SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_single_multiparty_bridge | ) |
Definition at line 1009 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, ast_bridge_basic_new(), ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, ast_channel_linkedid(), ast_channel_lock, ast_channel_unlock, ast_copy_string(), ast_setstate(), AST_STATE_UP, AST_TEST_NOT_RUN, BOB_CALLERID, CHANNEL_TECH_NAME, CHARLIE_CALLERID, ast_cdr::clid, config, COPY_IDS, CREATE_ALICE_CHANNEL, CREATE_BOB_CHANNEL, CREATE_CHARLIE_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), ast_cdr::linkedid, NULL, RAII_VAR, result, safe_bridge_destroy(), safe_channel_release(), SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_dial_unanswered | ) |
Definition at line 1148 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, AST_CAUSE_NO_ANSWER, AST_CDR_NOANSWER, ast_channel_alloc, ast_channel_flags(), ast_channel_publish_dial(), ast_channel_state_set(), ast_channel_unlock, AST_FLAG_OUTGOING, ast_set_flag, AST_STATE_DOWN, AST_STATE_RINGING, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_channel_release(), SET_FORMATS, SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_dial_busy | ) |
Definition at line 1211 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, AST_CAUSE_BUSY, AST_CDR_BUSY, ast_channel_alloc, ast_channel_flags(), ast_channel_publish_dial(), ast_channel_state_set(), ast_channel_unlock, AST_FLAG_OUTGOING, ast_set_flag, AST_STATE_DOWN, AST_STATE_RINGING, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_channel_release(), SET_FORMATS, SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_dial_congestion | ) |
Definition at line 1273 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, AST_CAUSE_CONGESTION, AST_CDR_CONGESTION, ast_channel_alloc, ast_channel_flags(), ast_channel_publish_dial(), ast_channel_state_set(), ast_channel_unlock, AST_FLAG_OUTGOING, ast_set_flag, AST_STATE_DOWN, AST_STATE_RINGING, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_channel_release(), SET_FORMATS, SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_dial_unavailable | ) |
Definition at line 1335 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, AST_CAUSE_NO_ROUTE_DESTINATION, AST_CDR_FAILED, ast_channel_alloc, ast_channel_flags(), ast_channel_publish_dial(), ast_channel_state_set(), ast_channel_unlock, AST_FLAG_OUTGOING, ast_set_flag, AST_STATE_DOWN, AST_STATE_RINGING, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_channel_release(), SET_FORMATS, SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_dial_caller_cancel | ) |
Definition at line 1397 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, AST_CAUSE_NORMAL, AST_CDR_NOANSWER, ast_channel_alloc, ast_channel_flags(), ast_channel_publish_dial(), ast_channel_state_set(), ast_channel_unlock, AST_FLAG_OUTGOING, ast_set_flag, AST_STATE_DOWN, AST_STATE_RINGING, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_channel_release(), SET_FORMATS, SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_dial_parallel_failed | ) |
Definition at line 1460 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, AST_CAUSE_BUSY, AST_CAUSE_CONGESTION, AST_CAUSE_NORMAL, AST_CDR_BUSY, AST_CDR_CONGESTION, AST_CDR_NOANSWER, ast_channel_alloc, ast_channel_flags(), ast_channel_publish_dial(), ast_channel_state_set(), ast_channel_unlock, AST_FLAG_OUTGOING, ast_set_flag, AST_STATE_DOWN, AST_STATE_RINGING, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, COPY_IDS, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), ast_cdr::next, NULL, RAII_VAR, result, safe_channel_release(), SET_FORMATS, SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_dial_answer_no_bridge | ) |
Definition at line 1589 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, ast_channel_alloc, ast_channel_flags(), ast_channel_publish_dial(), ast_channel_state_set(), ast_channel_unlock, ast_clear_flag, AST_FLAG_OUTGOING, ast_set_flag, AST_STATE_DOWN, AST_STATE_RINGING, AST_STATE_UP, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, COPY_IDS, CREATE_ALICE_CHANNEL, EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_channel_release(), SET_FORMATS, SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_dial_answer_twoparty_bridge_a | ) |
Definition at line 1688 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, ast_bridge_basic_new(), ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, ast_channel_alloc, ast_channel_flags(), ast_channel_publish_dial(), ast_channel_state_set(), ast_channel_unlock, AST_FLAG_OUTGOING, ast_set_flag, AST_STATE_DOWN, AST_STATE_RINGING, AST_STATE_UP, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_bridge_destroy(), safe_channel_release(), SET_FORMATS, SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_dial_answer_twoparty_bridge_b | ) |
Definition at line 1765 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, ast_bridge_basic_new(), ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, ast_channel_alloc, ast_channel_flags(), ast_channel_publish_dial(), ast_channel_state_set(), ast_channel_unlock, AST_FLAG_OUTGOING, ast_set_flag, AST_STATE_DOWN, AST_STATE_RINGING, AST_STATE_UP, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_bridge_destroy(), safe_channel_release(), SET_FORMATS, SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_dial_answer_multiparty | ) |
Definition at line 1840 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, ast_bridge_basic_new(), ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, ast_channel_alloc, ast_channel_flags(), ast_channel_linkedid(), ast_channel_publish_dial(), ast_channel_state_set(), ast_channel_uniqueid(), ast_channel_unlock, ast_copy_string(), AST_FLAG_OUTGOING, ast_set_flag, AST_STATE_DOWN, AST_STATE_RINGING, AST_STATE_UP, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, CHARLIE_CALLERID, ast_cdr::clid, config, COPY_IDS, CREATE_ALICE_CHANNEL, CREATE_CHARLIE_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), ast_cdr::linkedid, NULL, RAII_VAR, result, safe_bridge_destroy(), safe_channel_release(), SET_FORMATS, SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, ast_cdr::uniqueid, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_park | ) |
Definition at line 2030 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, ast_bridge_base_new(), AST_BRIDGE_CAPABILITY_HOLDING, ast_bridge_depart(), AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM, AST_BRIDGE_FLAG_MERGE_INHIBIT_TO, AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM, AST_BRIDGE_FLAG_TRANSFER_PROHIBITED, ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, ast_channel_lock, ast_channel_unlock, ast_setstate(), AST_STATE_UP, AST_TEST_NOT_RUN, BOB_CALLERID, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, CREATE_BOB_CHANNEL, do_sleep(), EMULATE_APP_DATA, HANGUP_CHANNEL, sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_bridge_destroy(), safe_channel_release(), SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_fields | ) |
Definition at line 2120 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_OMIT, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, AST_CDR_FAILED, AST_CDR_FLAG_FINALIZE, AST_CDR_FLAG_KEEP_VARS, ast_cdr_fork(), ast_cdr_getvar(), AST_CDR_NULL, ast_cdr_setuserfield(), ast_cdr_setvar(), ast_channel_amaflags_set(), ast_channel_appl_set(), ast_channel_data_set(), ast_channel_hangupcause_set(), ast_channel_linkedid(), ast_channel_lock, ast_channel_name(), ast_channel_priority_set(), ast_channel_publish_snapshot(), ast_channel_uniqueid(), ast_channel_unlock, ast_copy_string(), ast_hangup(), ast_set_flag, ast_setstate(), AST_STATE_UP, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, do_sleep(), EPSILON, sip_to_pjsip::info(), ast_cdr::linkedid, ast_cdr::next, NULL, RAII_VAR, result, safe_channel_release(), SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, ast_cdr::uniqueid, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_no_reset_cdr | ) |
Definition at line 2324 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, AST_CAUSE_NORMAL, ast_cdr_clear_property(), AST_CDR_FAILED, AST_CDR_FLAG_DISABLE, AST_CDR_FLAG_DISABLE_ALL, AST_CDR_FLAG_FINALIZE, ast_cdr_fork(), ast_cdr_set_property(), ast_channel_hangupcause_set(), ast_channel_name(), ast_hangup(), ast_set_flag, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, do_sleep(), sip_to_pjsip::info(), NULL, RAII_VAR, result, safe_channel_release(), SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, and verify_mock_cdr_record().
AST_TEST_DEFINE | ( | test_cdr_fork_cdr | ) |
Definition at line 2394 of file test_cdr.c.
References ALICE_CALLERID, ao2_alloc, ao2_cleanup, AST_AMA_DOCUMENTATION, AST_CAUSE_NORMAL, AST_CDR_ANSWERED, AST_CDR_FLAG_FINALIZE, AST_CDR_FLAG_KEEP_VARS, AST_CDR_FLAG_RESET, AST_CDR_FLAG_SET_ANSWER, ast_cdr_fork(), ast_cdr_getvar(), ast_cdr_setvar(), ast_channel_hangupcause_set(), ast_channel_linkedid(), ast_channel_lock, ast_channel_name(), ast_channel_uniqueid(), ast_channel_unlock, ast_clear_flag, ast_copy_string(), ast_hangup(), ast_set_flag, ast_setstate(), AST_STATE_UP, AST_TEST_NOT_RUN, CHANNEL_TECH_NAME, ast_cdr::clid, config, CREATE_ALICE_CHANNEL, do_sleep(), sip_to_pjsip::info(), ast_cdr::linkedid, ast_cdr::next, NULL, RAII_VAR, result, safe_channel_release(), SWAP_CONFIG, TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, ast_cdr::uniqueid, and verify_mock_cdr_record().
|
static |
Definition at line 169 of file test_cdr.c.
References actual_cdr_entries, ast_cdr_free(), ast_free, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, test_cdr_entry::cdr, global_mock_cdr_count, and test_cdr_entry::list.
Referenced by test_cdr_cleanup_cb(), test_cdr_init_cb(), and unload_module().
|
static |
|
static |
Definition at line 2585 of file test_cdr.c.
References ast_cdr_register(), ast_channel_register(), ast_cond_init, AST_MODULE_LOAD_SUCCESS, AST_TEST_REGISTER, ast_test_register_cleanup(), ast_test_register_init(), MOCK_CDR_BACKEND, mock_cdr_backend_cb(), mock_cdr_cond, NULL, TEST_CATEGORY, test_cdr_cleanup_cb(), and test_cdr_init_cb().
|
static |
Definition at line 116 of file test_cdr.c.
References actual_cdr_entries, ast_calloc, ast_cond_signal, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_var_assign, test_cdr_entry::cdr, ast_var_t::entries, varshead::first, global_mock_cdr_count, varshead::last, test_cdr_entry::list, mock_cdr_cond, ast_var_t::name, ast_cdr::next, NULL, ast_var_t::value, and ast_cdr::varshead.
Referenced by load_module().
|
static |
Definition at line 379 of file test_cdr.c.
References ast_bridge_destroy().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 371 of file test_cdr.c.
References ast_channel_release().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 2534 of file test_cdr.c.
References ao2_cleanup, ast_cdr_set_config(), clear_mock_cdr_backend(), and NULL.
Referenced by load_module().
|
static |
Definition at line 2522 of file test_cdr.c.
References ast_cdr_get_config(), and clear_mock_cdr_backend().
Referenced by load_module().
|
static |
Definition at line 2546 of file test_cdr.c.
References ast_cdr_unregister(), ast_channel_unregister(), AST_TEST_UNREGISTER, clear_mock_cdr_backend(), and MOCK_CDR_BACKEND.
|
static |
Definition at line 310 of file test_cdr.c.
References accountcode, actual_cdr_entries, amaflags, answer(), ast_cond_timedwait, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_test_debug(), AST_TEST_FAIL, AST_TEST_PASS, ast_test_status_update, ast_tvnow(), ast_cdr::billsec, test_cdr_entry::cdr, ast_cdr::channel, ast_cdr::dstchannel, end, global_mock_cdr_count, test_cdr_entry::list, mock_cdr_cond, ast_cdr::next, NULL, S_OR, VERIFY_NUMERIC_FIELD, VERIFY_STRING_FIELD, and VERIFY_TIME_VALUE.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 2628 of file test_cdr.c.
struct { ... } actual_cdr_entries |
A linked list of received CDR entries from the engine.
Referenced by clear_mock_cdr_backend(), mock_cdr_backend_cb(), and verify_mock_cdr_record().
|
static |
Definition at line 2628 of file test_cdr.c.
|
static |
A configuration suitable for CDRs with congestion enabled.
Definition at line 71 of file test_cdr.c.
|
static |
A configuration suitable for 'normal' CDRs.
Definition at line 61 of file test_cdr.c.
struct test_cdr_entry* first |
Definition at line 85 of file test_cdr.c.
|
static |
The number of CDRs the mock backend has received.
Definition at line 102 of file test_cdr.c.
Referenced by clear_mock_cdr_backend(), mock_cdr_backend_cb(), and verify_mock_cdr_record().
struct test_cdr_entry* last |
Definition at line 85 of file test_cdr.c.
ast_mutex_t lock |
Definition at line 85 of file test_cdr.c.
|
static |
The Mock CDR backend condition wait.
Definition at line 88 of file test_cdr.c.
Referenced by load_module(), mock_cdr_backend_cb(), and verify_mock_cdr_record().
|
static |
A placeholder for Asterisk's 'real' CDR configuration.
Definition at line 58 of file test_cdr.c.
|
static |
A channel technology used for the unit tests.
Definition at line 91 of file test_cdr.c.
|
static |
A configuration suitable for CDRs with unanswered records.
Definition at line 66 of file test_cdr.c.