Asterisk - The Open Source Telephony Project GIT-master-b023714
|
Bridging unit tests. More...
#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/test.h"
#include "asterisk/channel.h"
#include "asterisk/time.h"
#include "asterisk/bridge.h"
#include "asterisk/bridge_basic.h"
#include "asterisk/features.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Data Structures | |
struct | test_bridging_chan_pvt |
A private structure for the test channel. More... | |
Macros | |
#define | CHANNEL_TECH_NAME "BridgingTestChannel" |
#define | HANGUP_CHANNEL(channel) |
Hang up a test channel safely. | |
#define | START_ALICE(channel, pvt) START_CHANNEL(channel, pvt, "Alice", "100") |
Create a test_bridging_chan_tech for Alice. | |
#define | START_BOB(channel, pvt) START_CHANNEL(channel, pvt, "Bob", "200") |
Create a test_bridging_chan_tech for Bob. | |
#define | START_CHANNEL(channel, pvt, name, number) |
#define | TEST_CATEGORY "/main/bridging/" |
#define | TEST_CHANNEL_FORMAT ast_format_slin |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_TEST_DEFINE (test_bridging_deferred_queue) | |
static int | load_module (void) |
static void | safe_bridge_destroy (struct ast_bridge *bridge) |
static void | safe_channel_release (struct ast_channel *chan) |
static void | stream_periodic_frames (struct ast_channel *chan, int ms, int interval_ms) |
static int | test_bridging_chan_hangup (struct ast_channel *chan) |
Callback function for when a channel is hung up. | |
static int | test_bridging_chan_indicate (struct ast_channel *chan, int condition, const void *data, size_t datalen) |
Callback function for when a frame is written to a channel. | |
static void | test_nanosleep (int secs, long nanosecs) |
static int | unload_module (void) |
static void | wait_for_bridged (struct ast_channel *channel) |
Wait until a channel is bridged. | |
static void | wait_for_empty_queue (struct ast_channel *channel) |
Wait until a channel has no frames on its read queue. | |
static void | wait_for_unbridged (struct ast_channel *channel) |
Wait until a channel is not bridged. | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Bridging 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 ast_channel_tech | test_bridging_chan_tech |
A channel technology used for the unit tests. | |
Bridging unit tests.
Definition in file test_bridging.c.
#define CHANNEL_TECH_NAME "BridgingTestChannel" |
Definition at line 45 of file test_bridging.c.
#define HANGUP_CHANNEL | ( | channel | ) |
Hang up a test channel safely.
Definition at line 153 of file test_bridging.c.
#define START_ALICE | ( | channel, | |
pvt | |||
) | START_CHANNEL(channel, pvt, "Alice", "100") |
Create a test_bridging_chan_tech for Alice.
Definition at line 134 of file test_bridging.c.
#define START_BOB | ( | channel, | |
pvt | |||
) | START_CHANNEL(channel, pvt, "Bob", "200") |
Create a test_bridging_chan_tech for Bob.
Definition at line 137 of file test_bridging.c.
Definition at line 139 of file test_bridging.c.
#define TEST_CATEGORY "/main/bridging/" |
Definition at line 43 of file test_bridging.c.
#define TEST_CHANNEL_FORMAT ast_format_slin |
Definition at line 47 of file test_bridging.c.
|
static |
Definition at line 290 of file test_bridging.c.
|
static |
Definition at line 290 of file test_bridging.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 290 of file test_bridging.c.
AST_TEST_DEFINE | ( | test_bridging_deferred_queue | ) |
Definition at line 198 of file test_bridging.c.
References ast_bridge_basic_new(), ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_CONTROL_T38_PARAMETERS, AST_FRAME_CONTROL, ast_queue_frame(), AST_T38_REQUEST_NEGOTIATE, AST_TEST_NOT_RUN, AST_TEST_PASS, test_bridging_chan_pvt::condition, ast_frame::frametype, HANGUP_CHANNEL, test_bridging_chan_pvt::indicated, NULL, RAII_VAR, ast_control_t38_parameters::request_response, safe_bridge_destroy(), safe_channel_release(), START_ALICE, START_BOB, stream_periodic_frames(), TEST_CATEGORY, TEST_EXECUTE, TEST_INIT, wait_for_bridged(), wait_for_empty_queue(), and wait_for_unbridged().
|
static |
Definition at line 276 of file test_bridging.c.
References ast_channel_register(), ast_format_cap_alloc, ast_format_cap_append, AST_FORMAT_CAP_FLAG_DEFAULT, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, AST_TEST_REGISTER, ast_channel_tech::capabilities, test_bridging_chan_tech, and TEST_CHANNEL_FORMAT.
|
static |
Definition at line 168 of file test_bridging.c.
References ast_bridge_destroy().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 160 of file test_bridging.c.
References ast_channel_release().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 176 of file test_bridging.c.
References ast_assert, ast_null_frame, ast_queue_frame(), NULL, and test_nanosleep().
Referenced by AST_TEST_DEFINE().
|
static |
Callback function for when a channel is hung up.
Definition at line 70 of file test_bridging.c.
References ast_channel_tech_pvt(), ast_channel_tech_pvt_set(), ast_free, and NULL.
|
static |
Callback function for when a frame is written to a channel.
Definition at line 58 of file test_bridging.c.
References ast_channel_tech_pvt(), test_bridging_chan_pvt::condition, and test_bridging_chan_pvt::indicated.
|
static |
Definition at line 89 of file test_bridging.c.
References errno.
Referenced by stream_periodic_frames(), wait_for_bridged(), wait_for_empty_queue(), and wait_for_unbridged().
|
static |
Definition at line 265 of file test_bridging.c.
References ao2_cleanup, ast_channel_unregister(), AST_TEST_UNREGISTER, ast_channel_tech::capabilities, NULL, and test_bridging_chan_tech.
|
static |
Wait until a channel is bridged.
Definition at line 98 of file test_bridging.c.
References ast_channel_is_bridged(), ast_channel_lock, ast_channel_unlock, and test_nanosleep().
Referenced by AST_TEST_DEFINE().
|
static |
Wait until a channel has no frames on its read queue.
Definition at line 122 of file test_bridging.c.
References ast_channel_lock, ast_channel_readq(), ast_channel_unlock, AST_LIST_EMPTY, and test_nanosleep().
Referenced by AST_TEST_DEFINE().
|
static |
Wait until a channel is not bridged.
Definition at line 110 of file test_bridging.c.
References ast_channel_is_bridged(), ast_channel_lock, ast_channel_unlock, and test_nanosleep().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 290 of file test_bridging.c.
|
static |
Definition at line 290 of file test_bridging.c.
|
static |
A channel technology used for the unit tests.
Definition at line 81 of file test_bridging.c.
Referenced by load_module(), and unload_module().