64 info->name = __func__;
66 info->summary =
"Test creation of ast_channel_blob objects";
67 info->description =
"Test creation of ast_channel_blob objects";
74 chan =
ast_channel_alloc(0,
AST_STATE_DOWN,
"100",
"Alice",
"100",
"100",
"default",
NULL,
NULL, 0,
"TEST/Alice");
86 ast_test_validate(
test,
NULL != msg);
88 ast_test_validate(
test,
NULL != blob);
98 ast_test_validate(
test,
NULL != msg);
100 ast_test_validate(
test,
NULL != blob);
119 info->name = __func__;
121 info->summary =
"Test creation of ast_channel_blob objects";
122 info->description =
"Test creation of ast_channel_blob objects";
129 chan =
ast_channel_alloc(0,
AST_STATE_DOWN,
"100",
"Alice",
"100",
"100",
"default",
NULL,
NULL, 0,
"TEST/Alice");
138 ast_test_validate(
test,
NULL != msg);
140 ast_test_validate(
test,
NULL != blob);
156 info->name = __func__;
158 info->summary =
"Test creation of ast_multi_channel_blob objects";
159 info->description =
"Test creation of ast_multi_channel_blob objects";
188 info->name = __func__;
190 info->summary =
"Test creation of ast_multi_channel_blob objects";
191 info->description =
"Test creation of ast_multi_channel_blob objects";
199 chan_alice =
ast_channel_alloc(0,
AST_STATE_DOWN,
"100",
"Alice",
"100",
"100",
"default",
NULL,
NULL, 0,
"TEST/Alice");
201 chan_bob =
ast_channel_alloc(0,
AST_STATE_DOWN,
"200",
"Bob",
"200",
"200",
"default",
NULL,
NULL, 0,
"TEST/Bob");
203 chan_charlie =
ast_channel_alloc(0,
AST_STATE_DOWN,
"300",
"Bob",
"300",
"300",
"default",
NULL,
NULL, 0,
"TEST/Charlie");
222 ast_test_validate(
test,
NULL != snapshot);
223 ast_test_validate(
test, 0 == strcmp(
"TEST/Alice", snapshot->
base->
name));
227 ast_test_validate(
test,
NULL != snapshot);
228 ast_test_validate(
test, 0 != strcmp(
"TEST/Alice", snapshot->
base->
name));
232 ast_test_validate(
test,
NULL != matches);
235 ast_test_validate(
test,
NULL != snapshot);
238 ast_test_validate(
test,
NULL != snapshot);
256 info->name = __func__;
258 info->summary =
"Test creation of ast_channel_blob objects";
259 info->description =
"Test creation of ast_channel_blob objects";
267 chan =
ast_channel_alloc(0,
AST_STATE_DOWN,
"cid_num",
"cid_name",
"acctcode",
"exten",
"context",
NULL,
NULL, 0,
"TEST/name");
269 ast_test_validate(
test,
NULL != chan);
273 ast_test_validate(
test,
NULL != snapshot);
277 " s: { s: s, s: s, s: i, s: s, s: s }," 278 " s: { s: s, s: s }," 279 " s: { s: s, s: s }," 285 "accountcode",
"acctcode",
288 "context",
"context",
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
struct ast_channel_snapshot_base * base
Asterisk main include file. File version handling, generic pbx functions.
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
struct ast_channel_snapshot * snapshot
struct ast_channel * ast_channel_release(struct ast_channel *chan)
Unlink and release reference to a channel.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
Structure representing a snapshot of channel state.
static void safe_channel_release(struct ast_channel *chan)
#define AST_TEST_REGISTER(cb)
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
enum stasis_message_type_result stasis_message_type_create(const char *name, struct stasis_message_vtable *vtable, struct stasis_message_type **result)
Create a new message type.
struct ast_channel_snapshot * ast_channel_snapshot_create(struct ast_channel *chan)
Generate a snapshot of the channel state. This is an ao2 object, so ao2_cleanup() to deallocate...
struct ast_json * ast_multi_channel_blob_get_json(struct ast_multi_channel_blob *obj)
Retrieve the JSON blob from a ast_multi_channel_blob. Returned ast_json is still owned by obj...
Blob of data associated with a channel.
struct ast_json * ast_json_null(void)
Get the JSON null value.
static const char * test_category
General Asterisk PBX channel definitions.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
void ast_multi_channel_blob_add_channel(struct ast_multi_channel_blob *obj, const char *role, struct ast_channel_snapshot *snapshot)
Add a ast_channel_snapshot to a ast_multi_channel_blob object.
AST_TEST_DEFINE(channel_blob_create)
#define ao2_ref(o, delta)
struct ast_json * ast_json_timeval(const struct timeval tv, const char *zone)
Construct a timeval as JSON.
struct ao2_container * ast_multi_channel_blob_get_channels(struct ast_multi_channel_blob *obj, const char *role)
Retrieve all channel snapshots associated with a specific role from a ast_multi_channel_blob.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
#define AST_TEST_UNREGISTER(cb)
struct timeval ast_channel_creationtime(struct ast_channel *chan)
struct stasis_message * ast_channel_blob_create(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
Creates a ast_channel_blob message.
#define ast_channel_unlock(chan)
struct ast_json * ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot, const struct stasis_message_sanitizer *sanitize)
Build a JSON object from a ast_channel_snapshot.
#define ao2_find(container, arg, flags)
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
int ast_json_equal(const struct ast_json *lhs, const struct ast_json *rhs)
Compare two JSON objects.
struct ast_channel_snapshot * ast_multi_channel_blob_get_channel(struct ast_multi_channel_blob *obj, const char *role)
Retrieve a channel snapshot associated with a specific role from a ast_multi_channel_blob.
A multi channel blob data structure for multi_channel_blob stasis messages.
Abstract JSON element (object, array, string, int, ...).
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
Asterisk module definitions.
static int unload_module(void)
struct ast_multi_channel_blob * ast_multi_channel_blob_create(struct ast_json *blob)
Create a ast_multi_channel_blob suitable for a stasis_message.
static int load_module(void)
const ast_string_field name