148 if (node && !node->
reason) {
155 .
type =
"after-bridge-cb",
179 return datastore->
data;
200 return datastore->
data;
208 after_bridge =
ast_calloc(1,
sizeof(*after_bridge));
214 datastore->
data = after_bridge;
217 return datastore->
data;
267 if (!chan || !callback) {
288 if (last_node && !last_node->
reason) {
300 return "Channel destroyed (hungup)";
302 return "Callback was replaced";
304 return "Channel masqueraded";
306 return "Channel was departed from bridge";
308 return "Callback was removed";
310 return "Channel failed joining the bridge";
367 .
type =
"after-bridge-goto",
410 char *current_pos = buffer;
411 size_t remaining_size = buf_size;
421 after_bridge = datastore->
data;
429 snprintf(current_pos, remaining_size,
"%s,", after_bridge->
context);
430 remaining_size = remaining_size - strlen(current_pos);
431 current_pos += strlen(current_pos);
435 snprintf(current_pos, remaining_size,
"h,");
436 remaining_size = remaining_size - strlen(current_pos);
437 current_pos += strlen(current_pos);
439 snprintf(current_pos, remaining_size,
"%s,", after_bridge->
exten);
440 remaining_size = remaining_size - strlen(current_pos);
441 current_pos += strlen(current_pos);
444 snprintf(current_pos, remaining_size,
"%d", after_bridge->
priority);
451 int goto_failed = -1;
474 after_bridge = datastore->
data;
479 ast_debug(1,
"Running after bridge goto h exten %s,h,1\n",
524 ast_debug(1,
"Setup after bridge goto location to %s,%s,%d.\n",
588 if (!context || !exten || priority < 1) {
598 after_bridge =
ast_calloc(1,
sizeof(*after_bridge));
610 after_bridge->
specific = specific ? 1 : 0;
611 datastore->
data = after_bridge;
613 || (context && !after_bridge->
context)
614 || (exten && !after_bridge->
exten)) {
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_pbx_h_exten_run(struct ast_channel *chan, const char *context)
Run the h exten from the given context.
#define ast_channel_lock(chan)
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
void ast_bridge_run_after_callback(struct ast_channel *chan)
Run any after bridge callback.
#define AST_LIST_LOCK(head)
Locks a list.
Asterisk main include file. File version handling, generic pbx functions.
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
#define ast_test_flag(p, flag)
const char * parseable_goto
static void after_bridge_cb_run_discard(struct after_bridge_cb_ds *after_bridge, enum ast_bridge_after_cb_reason reason)
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
ast_bridge_after_cb callback
int ast_bridge_setup_after_goto(struct ast_channel *chan)
Setup any after bridge goto location to begin execution.
void ast_channel_clear_flag(struct ast_channel *chan, unsigned int flag)
static const struct ast_datastore_info after_bridge_goto_info
void ast_bridge_read_after_goto(struct ast_channel *chan, char *buffer, size_t buf_size)
Read after bridge goto if it exists.
Structure for a data store type.
int ast_explicit_goto(struct ast_channel *chan, const char *context, const char *exten, int priority)
#define ast_strdup(str)
A wrapper for strdup()
Structure for a data store object.
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
enum ast_bridge_after_cb_reason reason
static void after_bridge_cb_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
void ast_bridge_run_after_goto(struct ast_channel *chan)
Run a PBX on any after bridge goto location.
int ast_channel_priority(const struct ast_channel *chan)
int ast_bridge_set_after_callback(struct ast_channel *chan, ast_bridge_after_cb callback, ast_bridge_after_cb_failed failed, void *data)
Setup an after bridge callback for when the channel leaves the bridging system.
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
static void __after_bridge_set_goto(struct ast_channel *chan, int run_h_exten, int specific, const char *context, const char *exten, int priority, const char *parseable_goto)
#define ast_strlen_zero(foo)
#define AST_LIST_HEAD_DESTROY(head)
Destroys a list head structure.
ast_bridge_after_cb_reason
#define ast_debug(level,...)
Log a DEBUG message.
void ast_replace_subargument_delimiter(char *s)
Replace '^' in a string with ','.
#define SCOPED_CHANNELLOCK(varname, chan)
scoped lock specialization for channels.
General Asterisk PBX channel definitions.
const char * ast_bridge_after_cb_reason_string(enum ast_bridge_after_cb_reason reason)
Get a string representation of an after bridge callback reason.
void ast_channel_clear_softhangup(struct ast_channel *chan, int flag)
Clear a set of softhangup flags from a channel.
int ast_parseable_goto(struct ast_channel *chan, const char *goto_string)
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
#define ast_strdupa(s)
duplicate a string in memory from the stack
static struct ast_datastore * after_bridge_goto_remove(struct ast_channel *chan)
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
void ast_bridge_discard_after_goto(struct ast_channel *chan)
Discard channel after bridge goto location.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
const char * ast_channel_exten(const struct ast_channel *chan)
Core PBX routines and definitions.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
ast_bridge_after_cb_failed failed
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
static struct after_bridge_cb_ds * after_bridge_cb_setup(struct ast_channel *chan)
void ast_bridge_set_after_go_on(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *parseable_goto)
Set channel to go on in the dialplan after the bridge.
static struct after_bridge_cb_ds * after_bridge_cb_find(struct ast_channel *chan)
static const struct ast_datastore_info after_bridge_cb_info
void ast_bridge_set_after_goto(struct ast_channel *chan, const char *context, const char *exten, int priority)
Set channel to goto specific location after the bridge.
static void after_bridge_goto_destroy(void *data)
#define AST_LIST_LAST(head)
Returns the last entry contained in a list.
int ast_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority)
struct after_bridge_cb_node::@350 list
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define ast_channel_unlock(chan)
#define AST_LIST_HEAD_INIT(head)
Initializes a list head structure.
#define ast_calloc(num, len)
A wrapper for calloc()
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
static void after_bridge_goto_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
Support for logging to various files, console and syslog Configuration in file logger.conf.
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
int ast_channel_softhangup_internal_flag(struct ast_channel *chan)
After Bridge Execution API.
void ast_channel_context_set(struct ast_channel *chan, const char *value)
struct after_bridge_cb_ds::@351 callbacks
enum ast_pbx_result ast_pbx_run(struct ast_channel *c)
Execute the PBX in the current thread.
static void after_bridge_cb_destroy(void *data)
void ast_bridge_discard_after_callback(struct ast_channel *chan, enum ast_bridge_after_cb_reason reason)
Run discarding any after bridge callbacks.
const char * ast_channel_context(const struct ast_channel *chan)
#define ast_datastore_alloc(info, uid)
void(* ast_bridge_after_cb)(struct ast_channel *chan, void *data)
After bridge callback function.
static char context[AST_MAX_CONTEXT]
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
static void after_bridge_cb_failed(struct after_bridge_cb_node *node)
void ast_channel_priority_set(struct ast_channel *chan, int value)
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
void(* ast_bridge_after_cb_failed)(enum ast_bridge_after_cb_reason reason, void *data)
After bridge callback failed.
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
void ast_channel_set_unbridged(struct ast_channel *chan, int value)
Sets the unbridged flag and queues a NULL frame on the channel to trigger a check by bridge_channel_w...
void ast_bridge_set_after_h(struct ast_channel *chan, const char *context)
Set channel to run the h exten after the bridge.