51#define NORMAL_FLAGS (AST_BRIDGE_FLAG_DISSOLVE_HANGUP | AST_BRIDGE_FLAG_DISSOLVE_EMPTY \
52 | AST_BRIDGE_FLAG_SMART)
54#define TRANSFER_FLAGS AST_BRIDGE_FLAG_SMART
83 .
type =
"bridge-dtmf-features",
135 size_t buffer_expended = 0;
136 unsigned int cur_feature;
137 static const struct {
148 for (cur_feature = 0; cur_feature <
ARRAY_LEN(associations); cur_feature++) {
150 if (buffer_expended == buffer_size - 1) {
151 buffer[buffer_expended] =
'\0';
154 buffer[buffer_expended++] = associations[cur_feature].letter;
158 buffer[buffer_expended] =
'\0';
166 char missing_features[strlen(features) + 1];
167 size_t number_of_missing_features = 0;
169 for (feature = features; *feature; feature++) {
170 if (!isupper(*feature)) {
171 ast_log(
LOG_ERROR,
"Features string '%s' rejected because it contains non-uppercase feature.\n", features);
176 missing_features[number_of_missing_features++] = *feature;
180 missing_features[number_of_missing_features] =
'\0';
182 if (number_of_missing_features) {
183 ast_log(
LOG_WARNING,
"Features '%s' from features string '%s' can not be applied.\n", missing_features, features);
218 held_copy = *channel_flags;
231 ds_flags = datastore->
data;
253 datastore->
data = ds_flags;
276 return datastore->
data;
292 int bridge_count = 0;
301 if (2 <= bridge_count) {
381 ast_log(
LOG_ERROR,
"Channel %s: Requested DTMF feature %s not available.\n",
436 const void *payload,
size_t payload_size)
479 const char *activated_name;
484 size_t len_activated;
488 len_name = strlen(pvt->
app_name) + 1;
495 len_activated = strlen(activated_name) + 1;
496 len_data =
sizeof(*run_data) + len_name + len_args + len_moh + len_feature + len_activated;
501 run_data->
moh_offset = len_moh ? len_name + len_args : 0;
546 size_t len_name = strlen(
app_name) + 1;
547 size_t len_args =
ast_strlen_zero(app_args) ? 0 : strlen(app_args) + 1;
548 size_t len_moh =
ast_strlen_zero(moh_class) ? 0 : strlen(moh_class) + 1;
549 size_t len_feature = strlen(feature_name) + 1;
550 size_t len_data =
sizeof(*hook_data) + len_name + len_args + len_moh + len_feature;
560 hook_data->
moh_offset = len_moh ? len_name + len_args : 0;
612 if (applicationmap) {
1356 ast_debug(1,
"Destroy attended transfer properties %p\n", props);
1445 ast_log(
LOG_ERROR,
"Unable to initialize prop fields - channel %s, context %s\n",
1463 if (transferer_features) {
1483 addr = strchr(tech,
'/');
1485 ast_log(
LOG_ERROR,
"Transferer channel name does not follow typical channel naming format (tech/address)\n");
1491 serial = strrchr(addr,
'-');
1500 ast_debug(1,
"Allocated attended transfer properties %p for transfer from %s\n",
1526 ast_debug(1,
"Shutting down attended transfer %p\n", props);
1555 ast_log(
LOG_ERROR,
"Unable to push event to attended transfer queue. Expect transfer to fail\n");
1644 if (transferer_bridge == transferee_bridge) {
1646 transferer, transferee, transfer_target);
1647 }
else if (transferer_bridge == target_bridge) {
1649 transferer, transfer_target, transferee);
1668 transferee_channel, target_channel);
1670 if (!transfer_msg) {
1671 ast_log(
LOG_ERROR,
"Unable to publish successful attended transfer from %s\n",
1691 transferee_channel, target_channel);
1693 if (!transfer_msg) {
1694 ast_log(
LOG_ERROR,
"Unable to publish successful three-way transfer from %s\n",
1716 if (!transfer_msg) {
1741 if (bridge_channel) {
1800 if (bridge_channel) {
1821 if (bridge_channel) {
1838 if (bridge_channel) {
1902 if (bridge_channel) {
1924 int num_bridge_channels = 0;
1928 for (i = 0; i < num_channels; ++i) {
1932 if (!kick_bridge_channel) {
1940 if (!kick_bridge_channel) {
1944 kick_bridge_channels[num_bridge_channels++] = kick_bridge_channel;
1947 bridge_do_merge(dest, src, kick_bridge_channels, num_bridge_channels, 0);
2045 .state_name =
"Hesitant",
2051 .state_name =
"Rebridge",
2056 .state_name =
"Resume",
2061 .state_name =
"Threeway",
2066 .state_name =
"Consulting",
2071 .state_name =
"Double Checking",
2076 .state_name =
"Complete",
2081 .state_name =
"Blond",
2086 .state_name =
"Blond Non-Final",
2092 .state_name =
"Recalling",
2098 .state_name =
"Wait to Retransfer",
2104 .state_name =
"Retransfer",
2110 .state_name =
"Wait to Recall",
2116 .state_name =
"Fail",
2156 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2158 return props->
state;
2196 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2198 return props->
state;
2220 &transferee_channel, &target_channel);
2280 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2282 return props->
state;
2322 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2324 return props->
state;
2334 &transferee_channel, &target_channel);
2350 &transferee_channel, &target_channel);
2397 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2399 return props->
state;
2583 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2585 return props->
state;
2615 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2617 return props->
state;
2633 snprintf(destination,
sizeof(destination),
"%s@%s", props->
exten, props->
context);
2640 ast_log(
LOG_ERROR,
"Unable to request outbound channel for recall target\n");
2709 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2711 return props->
state;
2741 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2743 return props->
state;
2765 ast_debug(1,
"Transferer on attended transfer %p pressed abort sequence\n", props);
2779 ast_debug(1,
"Transferer on attended transfer %p pressed complete sequence\n", props);
2793 ast_debug(1,
"Transferer on attended transfer %p pressed threeway sequence\n", props);
2807 ast_debug(1,
"Transferer on attended transfer %p pressed swap sequence\n", props);
2821 ast_debug(1,
"Transferer on attended transfer %p hung up\n", props);
2850 ast_debug(1,
"Detected an answer for recall attempt on attended transfer %p\n", props);
2877 const char *abort_dtmf;
2878 const char *complete_dtmf;
2879 const char *threeway_dtmf;
2880 const char *swap_dtmf;
2935 if (!transferer_bridge_channel) {
2940 ao2_ref(transferer_bridge_channel, -1);
2941 if (not_transferer) {
2991 if (target_bridge_channel) {
2995 ao2_ref(target_bridge_channel, -1);
3025 struct timeval relative_timeout = { 0, };
3026 struct timeval absolute_timeout;
3027 struct timespec timeout_arg;
3041 timeout_arg.tv_sec = absolute_timeout.tv_sec;
3042 timeout_arg.tv_nsec = absolute_timeout.tv_usec * 1000;
3087 ast_log(
LOG_ERROR,
"State %s enter function returned an error for attended transfer %p\n",
3093 ast_debug(1,
"State %s is a terminal state. Ending attended transfer %p\n",
3125 .disable_inheritance = 1,
3129 target_interface.
data = props;
3154 if (attended_transfer) {
3187 char *announce_sound, *retry_sound, *invalid_sound;
3188 const char *extenoverride;
3258 ast_verb(3,
"Channel %s: Dialed '%s@%s' does not exist.\n",
3261 if (attempts < max_attempts) {
3266 memset(exten, 0, exten_len);
3272 }
while (res > 0 && attempts < max_attempts);
3279 return res ? -1 : 0;
3352 ast_verb(3,
"Channel %s: Started DTMF attended transfer.\n",
3356 ast_log(
LOG_ERROR,
"Channel %s: Attended transfer attempted on unsupported bridge type '%s'.\n",
3369 ast_verb(3,
"Channel %s: Bridge '%s' does not permit merging at this time.\n",
3377 attended_transfer ? attended_transfer->
context :
NULL);
3379 ast_log(
LOG_ERROR,
"Channel %s: Unable to allocate control structure for performing attended transfer.\n",
3405 ast_verb(3,
"Channel %s: Unable to acquire target extension for attended transfer.\n",
3415 snprintf(destination,
sizeof(destination),
"%s@%s", props->
exten, props->
context);
3417 ast_debug(1,
"Channel %s: Attended transfer target '%s'\n",
3423 ast_log(
LOG_ERROR,
"Channel %s: Unable to request outbound channel for attended transfer target.\n",
3435 ast_log(
LOG_ERROR,
"Channel %s: Unable to create bridge for attended transfer target.\n",
3447 ast_log(
LOG_ERROR,
"Channel %s: Unable to attach framehook to transfer target.\n",
3463 ast_log(
LOG_ERROR,
"Channel %s: Unable to place outbound call to transfer target.\n",
3480 ast_log(
LOG_ERROR,
"Channel %s: Unable to place transfer target into bridge.\n",
3491 ast_log(
LOG_ERROR,
"Channel %s: Unable to create monitoring thread for attended transfer.\n",
3520 const char *xfer_context;
3521 char *goto_on_blindxfer;
3523 ast_verb(3,
"Channel %s: Started DTMF blind transfer.\n",
3530 blind_transfer ? blind_transfer->
context :
NULL));
3532 "GOTO_ON_BLINDXFR"),
""));
3536 if (
grab_transfer(bridge_channel->
chan, xfer_exten,
sizeof(xfer_exten), xfer_context)) {
3541 ast_debug(1,
"Channel %s: Blind transfer target '%s@%s'\n",
3545 const char *chan_context;
3546 const char *chan_exten;
3549 ast_debug(1,
"Channel %s: After transfer, transferrer goes to %s\n",
3558 chan_context, chan_exten, chan_priority, goto_on_blindxfer);
3613 ast_log(
LOG_WARNING,
"Unable to set up bridge hooks for channel %s. Features may not work properly\n",
3633 ast_log(
LOG_WARNING,
"Asked to initialize unexpected basic bridge personality type.\n");
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_strdupa(s)
duplicate a string in memory from the stack
void ast_free_ptr(void *ptr)
free() wrapper
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
#define ao2_callback_data(container, flags, cb_fn, arg, data)
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
void * ao2_object_get_lockaddr(void *obj)
Return the mutex lock address of an object.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
#define ao2_alloc(data_size, destructor_fn)
#define ast_bridge_lock_both(bridge1, bridge2)
Lock two bridges.
void ast_bridge_features_remove(struct ast_bridge_features *features, enum ast_bridge_hook_remove_flags flags)
Remove marked bridge channel feature hooks.
#define ast_bridge_unlock(bridge)
Unlock the bridge.
int ast_bridge_destroy(struct ast_bridge *bridge, int cause)
Destroy a bridge.
int ast_bridge_impart(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, enum ast_bridge_impart_flags flags) attribute_warn_unused_result
Impart a channel to a bridge (non-blocking)
struct ast_bridge_methods ast_bridge_base_v_table
Bridge base class virtual method table.
void ast_bridge_merge_inhibit(struct ast_bridge *bridge, int request)
Adjust the bridge merge inhibit request count.
@ AST_BRIDGE_CAPABILITY_MULTIMIX
@ AST_BRIDGE_CAPABILITY_NATIVE
@ AST_BRIDGE_CAPABILITY_1TO1MIX
struct ast_channel * ast_bridge_peer(struct ast_bridge *bridge, struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
@ AST_BRIDGE_TRANSFER_MULTI_PARTY
void ast_bridge_set_transfer_variables(struct ast_channel *chan, const char *value, int is_attended)
Set the relevant transfer variables for a single channel.
enum ast_transfer_result ast_bridge_transfer_blind(int is_external, struct ast_channel *transferer, const char *exten, const char *context, transfer_channel_cb new_channel_cb, void *user_data)
Blind transfer target to the extension and context provided.
@ AST_BRIDGE_TRANSFER_SUCCESS
@ AST_BRIDGE_TRANSFER_FAIL
#define ast_bridge_lock(bridge)
Lock the bridge.
@ AST_BRIDGE_IMPART_CHAN_INDEPENDENT
int ast_bridge_queue_everyone_else(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
Queue the given frame to everyone else.
After Bridge Execution API.
void ast_bridge_discard_after_goto(struct ast_channel *chan)
Discard channel after bridge goto location.
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 void dynamic_dtmf_hook_callback(struct ast_bridge_channel *bridge_channel, const void *payload, size_t payload_size)
static void blind_transfer_cb(struct ast_channel *new_channel, struct transfer_channel_data *user_data_wrapper, enum ast_transfer_type transfer_type)
static struct attended_transfer_properties * attended_transfer_properties_alloc(struct ast_channel *transferer, const char *context)
Allocate and initialize attended transfer properties.
struct ast_bridge_methods ast_bridge_basic_v_table
Bridge basic class virtual method table.
int ast_bridge_features_ds_get_string(struct ast_channel *chan, char *buffer, size_t buf_size)
writes a channel's DTMF features to a buffer string
static void attended_transfer_properties_shutdown(struct attended_transfer_properties *props)
Initiate shutdown of attended transfer properties.
static int builtin_feature_get_exten(struct ast_channel *chan, const char *feature_name, char *buf, size_t len)
static int retransfer_enter(struct attended_transfer_properties *props)
static enum attended_transfer_state double_checking_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
static int atxfer_complete(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
DTMF hook when transferer presses complete sequence.
static void attended_transfer_properties_destructor(void *obj)
static int feature_blind_transfer(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
Internal built in feature for blind transfers.
static int atxfer_abort(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
DTMF hook when transferer presses abort sequence.
static void bridge_basic_pull(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel)
static void get_transfer_parties_transferer_bridge(struct ast_bridge *transferer_bridge, struct ast_bridge *other_bridge, struct ast_channel *transferer, struct ast_channel **transferer_peer, struct ast_channel **other_party)
Get the transferee and transfer target when the transferer is in a bridge with one of the desired par...
static void bridge_personality_atxfer_pull(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel)
static int resume_enter(struct attended_transfer_properties *props)
static void bridge_basic_destroy(struct ast_bridge *self)
static void stream_failsound(struct ast_channel *chan)
Helper method to stream a fail sound on a channel.
static int recalling_enter(struct attended_transfer_properties *props)
static void bridge_basic_change_personality(struct ast_bridge *bridge, enum bridge_basic_personality_type type, void *user_data)
Change basic bridge personality.
static int basic_hangup_hook(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
void ast_bridge_basic_set_flags(struct ast_bridge *bridge, unsigned int flags)
Set feature flags on a basic bridge.
static int atxfer_swap(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
DTMF hook when transferer presses swap sequence.
static enum attended_transfer_state recalling_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
static int atxfer_transferer_hangup(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
Hangup hook for transferer channel.
static void play_failsound(struct ast_channel *chan)
Helper method to play a fail sound on a channel in a bridge.
static int setup_dynamic_feature(void *obj, void *arg, void *data, int flags)
static void transfer_target_framehook_destroy_cb(void *data)
struct ast_bridge_methods personality_normal_v_table
static void bridge_ringing(struct ast_bridge *bridge)
Helper method to send a ringing indication to all channels in a bridge.
void ast_bridging_init_basic(void)
static int rebridge_enter(struct attended_transfer_properties *props)
static void bridge_move(struct ast_bridge *dest, struct ast_bridge *src, struct ast_channel *channel, struct ast_channel *swap)
Wrapper for bridge_do_move.
static int setup_bridge_features_dynamic(struct ast_bridge_features *features, struct ast_channel *chan)
static void bridge_hold(struct ast_bridge *bridge)
Helper method to send a hold frame to all channels in a bridge.
static int bridge_personality_normal_push(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
struct ast_bridge * ast_bridge_basic_new(void)
Create a new basic class bridge.
attended_transfer_stimulus
Stimuli that can cause transfer state changes.
@ STIMULUS_RECALL_TARGET_HANGUP
@ STIMULUS_RECALL_TARGET_ANSWER
@ STIMULUS_TRANSFER_TARGET_HANGUP
@ STIMULUS_TRANSFEREE_HANGUP
@ STIMULUS_DTMF_ATXFER_THREEWAY
@ STIMULUS_DTMF_ATXFER_ABORT
@ STIMULUS_TRANSFER_TARGET_ANSWER
@ STIMULUS_TRANSFERER_HANGUP
@ STIMULUS_DTMF_ATXFER_COMPLETE
@ STIMULUS_DTMF_ATXFER_SWAP
static int fail_enter(struct attended_transfer_properties *props)
static int build_dtmf_features(struct ast_flags *flags, const char *features)
static const struct attended_transfer_state_properties state_properties[]
static int bridge_basic_push(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
static int setup_bridge_features_builtin(struct ast_bridge_features *features, struct ast_channel *chan)
attended_transfer_state_flags
Flags that indicate properties of attended transfer states.
@ TRANSFER_STATE_FLAG_TIMER_RESET
@ TRANSFER_STATE_FLAG_TIMED
@ TRANSFER_STATE_FLAG_TERMINAL
@ TRANSFER_STATE_FLAG_ATXFER_NO_ANSWER
@ TRANSFER_STATE_FLAG_TIMER_LOOP_DELAY
static enum attended_transfer_state wait_to_recall_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
static int add_normal_hooks(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
static int hesitant_enter(struct attended_transfer_properties *props)
static int wait_to_recall_enter(struct attended_transfer_properties *props)
static void recall_pull(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct attended_transfer_properties *props)
static void ringing(struct ast_channel *chan)
Helper method to send a ringing indication to a channel in a bridge.
static void copy_caller_data(struct ast_channel *dest, struct ast_channel *caller)
const char * stimulus_strs[]
String representations of the various stimuli.
static const char * get_transfer_context(struct ast_channel *transferer, const char *context)
static void recall_callback(struct ast_dial *dial)
Dial callback when attempting to recall the original transferer channel.
bridge_basic_personality_type
@ BRIDGE_BASIC_PERSONALITY_NORMAL
@ BRIDGE_BASIC_PERSONALITY_ATXFER
@ BRIDGE_BASIC_PERSONALITY_END
static enum attended_transfer_stimulus wait_for_stimulus(struct attended_transfer_properties *props)
static void get_transfer_party_non_transferer_bridge(struct ast_bridge *bridge, struct ast_channel **party)
Get a desired transfer party for a bridge the transferer is not in.
static void init_details(struct personality_details *details, enum bridge_basic_personality_type type)
struct ast_bridge_methods personality_atxfer_v_table
static const struct ast_datastore_info dtmf_features_info
static int set_feature_flag_from_char(struct ast_flags *feature_flags, char feature)
static void remove_hooks_on_personality_change(struct ast_bridge *bridge)
Remove appropriate hooks when basic bridge personality changes.
static void publish_transfer_fail(struct attended_transfer_properties *props)
Send a stasis publication for a failed attended transfer.
static void bridge_unhold(struct ast_bridge *bridge)
Helper method to send an unhold frame to all channels in a bridge.
static int bridge_basic_setup_features(struct ast_bridge_channel *bridge_channel)
static int threeway_enter(struct attended_transfer_properties *props)
static void hold(struct ast_channel *chan)
Helper method to place a channel in a bridge on hold.
static enum attended_transfer_state hesitant_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
static int calling_target_enter(struct attended_transfer_properties *props)
static void publish_transfer_threeway(struct attended_transfer_properties *props, struct ast_channel *transferee_channel, struct ast_channel *target_channel)
Send a stasis publication for an attended transfer that ends in a threeway call.
static int complete_enter(struct attended_transfer_properties *props)
static enum attended_transfer_state blond_nonfinal_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
static int wait_to_retransfer_enter(struct attended_transfer_properties *props)
static int dtmf_features_flags_to_string(struct ast_flags *feature_flags, char *buffer, size_t buffer_size)
static int blond_enter(struct attended_transfer_properties *props)
static struct ast_channel * dial_transfer(struct ast_channel *caller, const char *destination)
Helper function that creates an outgoing channel and returns it immediately.
int ast_bridge_features_ds_set_string(struct ast_channel *chan, const char *features)
Sets the features a channel will use upon being bridged.
@ TRANSFER_WAIT_TO_RETRANSFER
Wait to Retransfer state.
@ TRANSFER_DOUBLECHECKING
Double-checking state.
@ TRANSFER_COMPLETE
Complete state.
@ TRANSFER_REBRIDGE
Rebridge state.
@ TRANSFER_RETRANSFER
Retransfer state.
@ TRANSFER_FAIL
Fail state.
@ TRANSFER_WAIT_TO_RECALL
Wait to recall state.
@ TRANSFER_HESITANT
Hesitant state.
@ TRANSFER_BLOND
Blond state.
@ TRANSFER_RESUME
Resume state.
@ TRANSFER_THREEWAY
Threeway state.
@ TRANSFER_CALLING_TARGET
Calling Target state.
@ TRANSFER_CONSULTING
Consulting state.
@ TRANSFER_RECALLING
Recalling state.
@ TRANSFER_BLOND_NONFINAL
Blond non-final state.
struct ast_flags * ast_bridge_features_ds_get(struct ast_channel *chan)
Get DTMF feature flags from the channel.
int ast_bridge_features_ds_set(struct ast_channel *chan, struct ast_flags *flags)
Set basic bridge DTMF feature flags datastore on the channel.
static const char * get_transfer_exten(struct ast_channel *transferer, const char *exten)
static enum attended_transfer_state wait_to_retransfer_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
static int add_transferer_role(struct ast_channel *chan, struct ast_bridge_features_attended_transfer *attended_transfer)
static struct ast_frame * transfer_target_framehook_cb(struct ast_channel *chan, struct ast_frame *frame, enum ast_framehook_event event, void *data)
Frame hook for transfer target channel.
int ast_bridge_features_ds_append(struct ast_channel *chan, struct ast_flags *flags)
Append basic bridge DTMF feature flags on the channel.
static enum attended_transfer_state calling_target_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
static enum attended_transfer_state retransfer_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
static void remove_attended_transfer_stimulus(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
static void unhold(struct ast_channel *chan)
Helper method to take a channel in a bridge off hold.
static void on_personality_change_normal(struct ast_bridge *bridge)
static void * attended_transfer_monitor_thread(void *data)
The main loop for the attended transfer monitor thread.
static int builtin_features_helper(struct ast_bridge_features *features, struct ast_channel *chan, struct ast_flags *flags, unsigned int feature_flag, const char *feature_name, enum ast_bridge_builtin_feature feature_bridge)
static int blond_nonfinal_enter(struct attended_transfer_properties *props)
static int transfer_target_framehook_consume(void *data, enum ast_frame_type type)
Callback function which informs upstream if we are consuming a frame of a specific type.
static int consulting_enter(struct attended_transfer_properties *props)
static void common_recall_channel_setup(struct ast_channel *recall, struct ast_channel *transferer)
static int bridge_features_ds_set_full(struct ast_channel *chan, struct ast_flags *flags, int replace)
static int bridge_personality_atxfer_push(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
static enum attended_transfer_state consulting_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
static int dynamic_dtmf_hook_trip(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
static void play_sound(struct ast_channel *chan, const char *sound)
Helper method to play a sound on a channel in a bridge.
static int double_checking_enter(struct attended_transfer_properties *props)
static void get_transfer_parties(struct ast_channel *transferer, struct ast_bridge *transferee_bridge, struct ast_bridge *target_bridge, struct ast_channel **transferee, struct ast_channel **transfer_target)
determine transferee and transfer target for an attended transfer
static struct ast_bridge * bridge_basic_personality_alloc(struct ast_bridge *bridge)
static int grab_transfer(struct ast_channel *chan, char *exten, size_t exten_len, const char *context)
Helper function that presents dialtone and grabs extension.
attended_transfer_superstate
Attended transfer superstates.
@ SUPERSTATE_TRANSFER
Transfer superstate.
@ SUPERSTATE_RECALL
Recall superstate.
static void personality_destructor(void *obj)
static int dynamic_dtmf_hook_add(struct ast_bridge_features *features, unsigned int flags, const char *dtmf, const char *feature_name, const char *app_name, const char *app_args, const char *moh_class)
static int attach_framehook(struct attended_transfer_properties *props, struct ast_channel *channel)
static void publish_transfer_success(struct attended_transfer_properties *props, struct ast_channel *transferee_channel, struct ast_channel *target_channel)
Send a stasis publication for a successful attended transfer.
static void stimulate_attended_transfer(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
static int atxfer_threeway(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
DTMF hook when transferer presses threeway sequence.
static void bridge_merge(struct ast_bridge *dest, struct ast_bridge *src, struct ast_channel **kick_channels, unsigned int num_channels)
Wrapper for bridge_do_merge.
static int feature_attended_transfer(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
Internal built in feature for attended transfers.
static void clear_stimulus_queue(struct attended_transfer_properties *props)
Free backlog of stimuli in the queue.
static void transfer_pull(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct attended_transfer_properties *props)
Basic bridge subclass API.
#define AST_TRANSFERER_ROLE_NAME
void ast_bridge_channel_run_app(struct ast_bridge_channel *bridge_channel, const char *app_name, const char *app_args, const char *moh_class)
Run an application on the bridge channel.
void ast_bridge_channel_update_linkedids(struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
@ AST_BRIDGE_CHANNEL_CB_OPTION_MEDIA
#define ast_bridge_channel_unlock(bridge_channel)
Unlock the bridge_channel.
int ast_bridge_channel_write_unhold(struct ast_bridge_channel *bridge_channel)
Write an unhold frame into the bridge.
void ast_bridge_channel_update_accountcodes(struct ast_bridge_channel *joining, struct ast_bridge_channel *leaving)
void ast_bridge_channel_lock_bridge(struct ast_bridge_channel *bridge_channel)
Lock the bridge associated with the bridge channel.
int ast_bridge_channel_write_control_data(struct ast_bridge_channel *bridge_channel, enum ast_control_frame_type control, const void *data, size_t datalen)
Write a control frame into the bridge with data.
#define ast_bridge_channel_lock(bridge_channel)
Lock the bridge_channel.
struct ast_bridge * ast_bridge_channel_merge_inhibit(struct ast_bridge_channel *bridge_channel, int request)
Adjust the bridge_channel's bridge merge inhibit request count.
@ BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE
@ BRIDGE_CHANNEL_STATE_WAIT
int ast_bridge_channel_queue_playfile(struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class)
Queue a bridge action play file frame onto the bridge channel.
void ast_bridge_channel_leave_bridge(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state, int cause)
Set bridge channel state to leave bridge (if not leaving already).
int ast_bridge_channel_write_hold(struct ast_bridge_channel *bridge_channel, const char *moh_class)
Write a hold frame into the bridge.
int ast_bridge_channel_write_callback(struct ast_bridge_channel *bridge_channel, enum ast_bridge_channel_custom_callback_option flags, ast_bridge_custom_callback_fn callback, const void *payload, size_t payload_size)
Write a bridge action custom callback frame into the bridge.
int ast_bridge_hangup_hook(struct ast_bridge_features *features, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
Attach a hangup hook to a bridge features structure.
@ AST_BRIDGE_HOOK_REMOVE_ON_PULL
@ AST_BRIDGE_HOOK_REMOVE_ON_PERSONALITY_CHANGE
int ast_bridge_dtmf_hook(struct ast_bridge_features *features, const char *dtmf, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
Attach a DTMF hook to a bridge features structure.
ast_bridge_builtin_feature
Built in DTMF features.
@ AST_BRIDGE_BUILTIN_BLINDTRANSFER
@ AST_BRIDGE_BUILTIN_AUTOMIXMON
@ AST_BRIDGE_BUILTIN_ATTENDEDTRANSFER
@ AST_BRIDGE_BUILTIN_HANGUP
@ AST_BRIDGE_BUILTIN_PARKCALL
int ast_bridge_features_enable(struct ast_bridge_features *features, enum ast_bridge_builtin_feature feature, const char *dtmf, void *config, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
Enable a built in feature on a bridge features structure.
int ast_bridge_features_register(enum ast_bridge_builtin_feature feature, ast_bridge_hook_callback callback, const char *dtmf)
Register a handler for a built in feature.
void bridge_do_merge(struct ast_bridge *dst_bridge, struct ast_bridge *src_bridge, struct ast_bridge_channel **kick_me, unsigned int num_kick, unsigned int optimized)
struct ast_bridge * bridge_register(struct ast_bridge *bridge)
Register the new bridge with the system.
struct ast_bridge * bridge_base_init(struct ast_bridge *self, uint32_t capabilities, unsigned int flags, const char *creator, const char *name, const char *id)
Initialize the base class of the bridge.
struct ast_bridge_channel * bridge_find_channel(struct ast_bridge *bridge, struct ast_channel *chan)
struct ast_bridge * bridge_alloc(size_t size, const struct ast_bridge_methods *v_table)
int bridge_do_move(struct ast_bridge *dst_bridge, struct ast_bridge_channel *bridge_channel, int attempt_recovery, unsigned int optimized)
int ast_channel_set_bridge_role_option(struct ast_channel *channel, const char *role_name, const char *option, const char *value)
Set a role option on a channel.
const char * ast_channel_get_role_option(struct ast_channel *channel, const char *role_name, const char *option)
Retrieve the value of a requested role option from a channel.
int ast_channel_has_role(struct ast_channel *channel, const char *role_name)
Check if a role exists on a channel.
void ast_channel_remove_bridge_role(struct ast_channel *chan, const char *role_name)
Removes a bridge role from a channel.
int ast_channel_add_bridge_role(struct ast_channel *chan, const char *role_name)
Adds a bridge role to a channel.
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
int ast_call(struct ast_channel *chan, const char *addr, int timeout)
Make a call.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
@ AST_CHANNEL_REQUESTOR_BRIDGE_PEER
@ AST_CHANNEL_REQUESTOR_REPLACEMENT
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
#define ast_channel_lock(chan)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
void ast_party_connected_line_copy(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src)
Copy the source connected line information to the destination connected line.
int ast_channel_priority(const struct ast_channel *chan)
#define ast_channel_ref(c)
Increase channel reference count.
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
void ast_party_caller_copy(struct ast_party_caller *dest, const struct ast_party_caller *src)
Copy the source caller information to the destination caller.
ast_callid ast_channel_callid(const struct ast_channel *chan)
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
Inherit datastores from a parent to a child.
void ast_channel_req_accountcodes(struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship)
Setup new channel accountcodes from the requestor channel after ast_request().
const char * ast_channel_context(const struct ast_channel *chan)
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
Inherits channel variable from parent to child channel.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
struct ast_bridge * ast_channel_get_bridge(const struct ast_channel *chan)
Get the bridge associated with a channel.
int ast_softhangup(struct ast_channel *chan, int cause)
Softly hangup up a channel.
void ast_party_id_reset(struct ast_party_id *id)
Destroy and initialize the given party id structure.
#define ast_channel_unref(c)
Decrease channel reference count.
@ AST_SOFTHANGUP_EXPLICIT
struct ast_bridge_channel * ast_channel_get_bridge_channel(struct ast_channel *chan)
Get a reference to the channel's bridge pointer.
void ast_connected_line_copy_from_caller(struct ast_party_connected_line *dest, const struct ast_party_caller *src)
Copy the caller information to the connected line information.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_channel_callid_set(struct ast_channel *chan, ast_callid value)
#define ast_channel_cleanup(c)
Cleanup a channel reference.
struct ast_channel * ast_request(const char *type, struct ast_format_cap *request_cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
Requests a channel.
const char * ast_channel_exten(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
#define AST_MAX_EXTENSION
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.
#define ast_datastore_alloc(info, uid)
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
enum ast_dial_result ast_dial_state(struct ast_dial *dial)
Return state of dial.
@ AST_DIAL_RESULT_INVALID
@ AST_DIAL_RESULT_ANSWERED
@ AST_DIAL_RESULT_TIMEOUT
@ AST_DIAL_RESULT_PROGRESS
@ AST_DIAL_RESULT_RINGING
@ AST_DIAL_RESULT_PROCEEDING
@ AST_DIAL_RESULT_UNANSWERED
void ast_dial_set_state_callback(struct ast_dial *dial, ast_dial_state_callback callback)
Set a callback for state changes.
int ast_dial_append(struct ast_dial *dial, const char *tech, const char *device, const struct ast_assigned_ids *assignedids)
Append a channel.
struct ast_dial * ast_dial_create(void)
New dialing structure.
void ast_dial_set_user_data(struct ast_dial *dial, void *user_data)
Set user data on a dial structure.
int ast_dial_prerun(struct ast_dial *dial, struct ast_channel *chan, struct ast_format_cap *cap)
Request all appended channels, but do not dial.
enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int async)
Execute dialing synchronously or asynchronously.
enum ast_dial_result ast_dial_join(struct ast_dial *dial)
Cancel async thread.
struct ast_channel * ast_dial_answered_steal(struct ast_dial *dial)
Steal the channel that answered.
void * ast_dial_get_user_data(struct ast_dial *dial)
Return the user data on a dial structure.
struct ast_channel * ast_dial_get_channel(struct ast_dial *dial, int num)
Get the dialing channel, if prerun has been executed.
int ast_dial_destroy(struct ast_dial *dial)
Destroys a dialing structure.
Call Parking and Pickup API Includes code and algorithms from the Zapata library.
@ AST_FEATURE_FLAG_ONPEER
@ AST_FEATURE_FLAG_ONSELF
Generic File Format Support. Should be included by clients of the file handling routines....
int ast_stopstream(struct ast_channel *c)
Stops a stream.
int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *digits)
stream file until digit If the file name is non-empty, try to play it.
int ast_framehook_attach(struct ast_channel *chan, struct ast_framehook_interface *i)
Attach an framehook onto a channel for frame interception.
ast_framehook_event
These are the types of events that the framehook's event callback can receive.
@ AST_FRAMEHOOK_EVENT_READ
int ast_framehook_detach(struct ast_channel *chan, int framehook_id)
Detach an framehook from a channel.
#define AST_FRAMEHOOK_INTERFACE_VERSION
static int replace(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
int ast_app_dtget(struct ast_channel *chan, const char *context, char *collect, size_t size, int maxlen, int timeout)
Present a dialtone and collect a certain length extension.
char * ast_get_chan_features_xferfailsound(struct ast_channel *chan)
Get the transfer configuration option xferfailsound.
#define AST_FEATURE_MAX_LEN
struct ast_features_xfer_config * ast_get_chan_features_xfer_config(struct ast_channel *chan)
Get the transfer configuration options for a channel.
int ast_get_builtin_feature(struct ast_channel *chan, const char *feature, char *buf, size_t len)
Get the DTMF code for a builtin feature.
struct ao2_container * ast_get_chan_applicationmap(struct ast_channel *chan)
Get the applicationmap for a given channel.
ast_frame_type
Frame types.
#define ast_debug(level,...)
Log a DEBUG message.
ast_callid ast_read_threadstorage_callid(void)
extracts the callerid from the thread
int ast_callid_threadassoc_add(ast_callid callid)
Adds a known callid to thread storage of the calling thread.
int ast_callid_threadassoc_remove(void)
Removes callid from thread storage of the calling thread.
#define ast_verb(level,...)
A set of macros to manage forward-linked lists.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
#define ast_cond_destroy(cond)
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
#define ast_cond_wait(cond, mutex)
#define ast_cond_init(cond, attr)
#define ast_cond_timedwait(cond, mutex, time)
#define SCOPED_LOCK(varname, lock, lockfunc, unlockfunc)
Scoped Locks.
#define SCOPED_CHANNELLOCK(varname, chan)
scoped lock specialization for channels.
pthread_cond_t ast_cond_t
#define SCOPED_MUTEX(varname, lock)
scoped lock specialization for mutexes
#define ast_cond_signal(cond)
Core PBX routines and definitions.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
const char * app_name(struct ast_app *app)
void ast_bridge_publish_attended_transfer(struct ast_attended_transfer_message *transfer_msg)
Publish an attended transfer.
int ast_attended_transfer_message_add_threeway(struct ast_attended_transfer_message *transfer_msg, struct ast_channel *survivor_channel, struct ast_bridge *survivor_bridge)
Add details for an attended transfer that was resolved as a three-way call.
struct ast_attended_transfer_message * ast_attended_transfer_message_create(int is_external, struct ast_channel *to_transferee, struct ast_bridge *transferee_bridge, struct ast_channel *to_transfer_target, struct ast_bridge *target_bridge, struct ast_channel *transferee, struct ast_channel *transfer_target)
Create an Attended transfer message to be published.
int ast_attended_transfer_message_add_merge(struct ast_attended_transfer_message *transfer_msg, struct ast_bridge *final_bridge)
Add details for a bridge merge to an attended transfer message.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define AST_STRING_FIELD(name)
Declare a string field.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
An applicationmap configuration item.
Message representing attended transfer.
enum ast_transfer_result result
Structure that contains information regarding a channel in a bridge.
struct ast_channel * swap
struct ast_bridge * bridge
Bridge this channel is participating in.
struct ast_bridge_features * features
struct ast_channel * chan
enum bridge_channel_state state
Structure that contains configuration information for the attended transfer built in feature.
char swap[MAXIMUM_DTMF_FEATURE_STRING]
char threeway[MAXIMUM_DTMF_FEATURE_STRING]
char complete[MAXIMUM_DTMF_FEATURE_STRING]
char abort[MAXIMUM_DTMF_FEATURE_STRING]
char context[AST_MAX_CONTEXT]
Structure that contains configuration information for the blind transfer built in feature.
char context[AST_MAX_CONTEXT]
Structure that contains features information.
Bridge virtual methods table definition.
ast_bridge_push_channel_fn push
ast_bridge_destructor_fn destroy
ast_bridge_pull_channel_fn pull
Structure that contains information about a bridge.
const struct ast_bridge_methods * v_table
const ast_string_field uniqueid
struct ast_bridge_channels_list channels
unsigned int num_channels
unsigned int inhibit_merge
Count of the active temporary requests to inhibit bridge merges. Zero if merges are allowed.
struct ast_flags feature_flags
Main Channel structure associated with a channel.
struct ast_bridge_channel * bridge_channel
struct ast_party_caller caller
Channel Caller ID information.
Structure for a data store type.
Structure for a data store object.
Main dialing structure. Contains global options, channels being dialed, and more!
Feature configuration relating to transfers.
const ast_string_field atxferthreeway
unsigned int atxferdropcall
unsigned int transferdialattempts
unsigned int atxfercallbackretries
unsigned int transferdigittimeout
const ast_string_field atxfercomplete
const ast_string_field transferretrysound
const ast_string_field xfersound
const ast_string_field transferannouncesound
const ast_string_field transferinvalidsound
const ast_string_field atxferabort
const ast_string_field atxferswap
unsigned int atxferloopdelay
unsigned int atxfernoanswertimeout
Structure used to handle boolean flags.
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
union ast_frame::@226 data
enum ast_frame_type frametype
Connected Line/Party information.
struct ast_party_id priv
Private connected party ID.
Collection of data related to an attended transfer attempt.
enum attended_transfer_state state
enum attended_transfer_superstate superstate
struct ast_channel * transferer
int atxfercallbackretries
const ast_string_field transferer_type
struct ast_party_connected_line original_transferer_colp
const ast_string_field transferer_addr
struct attended_transfer_properties::@313 stimulus_queue
int atxfernoanswertimeout
struct ast_bridge * transferee_bridge
const ast_string_field context
struct ast_channel * recall_target
const ast_string_field xfersound
const ast_string_field exten
struct ast_bridge * target_bridge
struct ast_flags transferer_features
struct ast_channel * transfer_target
Properties of an attended transfer state.
enum attended_transfer_state(* exit)(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
enum attended_transfer_state_flags flags
int(* enter)(struct attended_transfer_properties *props)
structure that organizes different personalities for basic bridges.
enum bridge_basic_personality_type current
struct personality_details details[BRIDGE_BASIC_PERSONALITY_END]
Details for specific basic bridge personalities.
struct ast_bridge_methods * v_table
unsigned int bridge_flags
void(* on_personality_change)(struct ast_bridge *bridge)
enum attended_transfer_stimulus stimulus
struct stimulus_list * next
AO2 object that wraps data for transfer_channel_cb.
#define ast_test_suite_event_notify(s, f,...)
static struct aco_type item
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define ast_test_flag(p, flag)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_clear_flag(p, flag)
#define ast_pthread_create_detached(a, b, c, d)
#define ast_set_flag(p, flag)