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);
98 ast_test_validate(
test,
NULL != msg);
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);
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",
289 "context",
"context",
322 info->name = __func__;
324 info->summary =
"Test creation of ast_channel_blob objects with rdnis";
325 info->description =
"Test creation of ast_channel_blob objects with rdnis";
332 chan =
ast_channel_alloc(0,
AST_STATE_DOWN,
"cid_num",
"cid_name",
"acctcode",
"exten",
"context",
NULL,
NULL, 0,
"TEST/name");
334 ast_test_validate(
test,
NULL != chan);
347 ast_test_validate(
test,
NULL != snapshot);
351 " s: { s: s, s: s, s: i, s: s, s: s },"
352 " s: { s: s, s: s },"
353 " s: { s: s, s: s },"
360 "accountcode",
"acctcode",
364 "context",
"context",
376 "caller_rdnis",
"123456",
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define ao2_find(container, arg, flags)
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
General Asterisk PBX channel definitions.
void ast_party_redirecting_init(struct ast_party_redirecting *init)
Initialize the given redirecting structure.
void ast_channel_set_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Set the redirecting id information in the Asterisk channel.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
#define ast_channel_lock(chan)
const char * ast_channel_uniqueid(const struct ast_channel *chan)
struct timeval ast_channel_creationtime(struct ast_channel *chan)
struct ast_channel * ast_channel_release(struct ast_channel *chan)
Unlink and release reference to a channel.
void ast_party_redirecting_free(struct ast_party_redirecting *doomed)
Destroy the redirecting information contents.
#define ast_channel_unlock(chan)
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.
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.
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 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.
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.
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.
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.
struct ast_json * ast_json_null(void)
Get the JSON null value.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
int ast_json_equal(const struct ast_json *lhs, const struct ast_json *rhs)
Compare two JSON objects.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
struct ast_json * ast_json_timeval(const struct timeval tv, const char *zone)
Construct a timeval as JSON.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a 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.
@ STASIS_MESSAGE_TYPE_SUCCESS
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.
Blob of data associated with a channel.
const ast_string_field name
Structure representing a snapshot of channel state.
struct ast_channel_snapshot_base * base
Main Channel structure associated with a channel.
Abstract JSON element (object, array, string, int, ...).
A multi channel blob data structure for multi_channel_blob stasis messages.
struct ast_party_number number
Subscriber phone number.
unsigned char valid
TRUE if the number information is valid/present.
char * str
Subscriber phone number (Malloced)
Redirecting Line information. RDNIS (Redirecting Directory Number Information Service) Where a call d...
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
#define AST_TEST_REGISTER(cb)
#define AST_TEST_UNREGISTER(cb)
AST_TEST_DEFINE(channel_blob_create)
static void safe_channel_release(struct ast_channel *chan)
static int load_module(void)
static int unload_module(void)
static const char * test_category
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.