38#include <netinet/in.h>
663static const char app[] =
"Dial";
664static const char rapp[] =
"RetryDial";
700#define DIAL_STILLGOING (1LLU << 31)
701#define DIAL_NOFORWARDHTML (1LLU << 32)
702#define DIAL_CALLERID_ABSENT (1LLU << 33)
703#define OPT_CANCEL_ELSEWHERE (1LLU << 34)
704#define OPT_PEER_H (1LLU << 35)
705#define OPT_CALLEE_GO_ON (1LLU << 36)
706#define OPT_CANCEL_TIMEOUT (1LLU << 37)
707#define OPT_FORCE_CID_TAG (1LLU << 38)
708#define OPT_FORCE_CID_PRES (1LLU << 39)
709#define OPT_CALLER_ANSWER (1LLU << 40)
710#define OPT_PREDIAL_CALLEE (1LLU << 41)
711#define OPT_PREDIAL_CALLER (1LLU << 42)
712#define OPT_RING_WITH_EARLY_MEDIA (1LLU << 43)
713#define OPT_HANGUPCAUSE (1LLU << 44)
714#define OPT_HEARPULSING (1LLU << 45)
715#define OPT_TOPOLOGY_PRESERVE (1LLU << 46)
787#define CAN_EARLY_BRIDGE(flags,chan,peer) (!ast_test_flag64(flags, OPT_CALLEE_HANGUP | \
788 OPT_CALLER_HANGUP | OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER | \
789 OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR | OPT_CALLEE_PARK | \
790 OPT_CALLER_PARK | OPT_ANNOUNCE | OPT_CALLEE_GOSUB) && \
791 !ast_channel_audiohooks(chan) && !ast_channel_audiohooks(peer) && \
792 ast_framehook_list_is_empty(ast_channel_framehooks(chan)) && ast_framehook_list_is_empty(ast_channel_framehooks(peer)))
826 .
type =
"app_dial_topology_preserve",
848 if (hangupcause >= 0) {
858#define AST_MAX_WATCHERS 256
894 char rexten[2] = {
exten,
'\0' };
938 struct ast_flags64 *peerflags,
int single,
int caller_entertained,
int *to,
953 if ((stuff = strchr(tmpchan,
'/'))) {
957 const char *forward_context;
961 forward_context =
NULL;
968 if (!strcasecmp(tech,
"Local")) {
999 if (single && !caller_entertained) {
1014 ast_verb(3,
"Not accepting call completion offers from call-forward recipient %s\n",
1018 "Forwarding failed to create channel to dial '%s/%s' (cause = %d)\n",
1019 tech, stuff, cause);
1057 caller.
id = *stored_clid;
1066 caller.
id = *stored_clid;
1133 if (single && !caller_entertained) {
1192 char full_var_name[128];
1194 snprintf(
buf,
sizeof(
buf),
"%" PRId64, duration / 1000);
1197 snprintf(full_var_name,
sizeof(full_var_name),
"%s_MS", var_base);
1198 snprintf(
buf,
sizeof(
buf),
"%" PRId64, duration);
1207 char *mf_progress,
char *mf_wink,
1208 char *sf_progress,
char *sf_wink,
1209 const int hearpulsing,
1210 const int ignore_cc,
1216 int orig_answer_to = *to_answer;
1217 int orig_progress_to = *to_progress;
1225 int cc_recall_core_id;
1227 int cc_frame_received = 0;
1228 int num_ringing = 0;
1230 int sent_progress = 0, sent_wink = 0;
1236 if (!caller_entertained) {
1246 strcpy(pa->
status,
"CONGESTION");
1264 int numlines = prestart;
1268 watchers[pos++] =
in;
1272 watchers[pos++] = o->
chan;
1279 strcpy(pa->
status,
"BUSY");
1281 strcpy(pa->
status,
"CONGESTION");
1283 strcpy(pa->
status,
"CHANUNAVAIL");
1289 ast_cc_failed(cc_recall_core_id,
"Everyone is busy/congested for the recall. How sad");
1295 winner =
ast_waitfor_n(watchers, pos, *to_progress > 0 && (*to_answer < 0 || *to_progress < *to_answer) ? to_progress : to_answer);
1324 size_t encoded_size;
1340 ast_channel_dialcontext_set(
c,
"");
1373 do_forward(o, &num, peerflags, single, caller_entertained, &orig_answer_to,
1374 forced_clid, stored_clid);
1422 size_t encoded_size;
1437 ast_trace(-1,
"%s Found topology in frame: %p %p %s\n",
1454 ast_channel_dialcontext_set(
c,
"");
1511 orig_progress_to = -1;
1512 if (ignore_cc || cc_frame_received || num_ringing == numlines) {
1515 if (single && !caller_entertained
1524 struct timeval now, then;
1546 if (single && !caller_entertained
1556 orig_progress_to = -1;
1557 if (!sent_progress) {
1558 struct timeval now, then;
1576 "Sending MF '%s' to %s as result of "
1577 "receiving a PROGRESS message.\n",
1578 mf_progress, hearpulsing ?
"parties" :
"called party");
1580 (hearpulsing ?
in :
NULL), mf_progress, 50, 55, 120, 65, 0);
1584 "Sending SF '%s' to %s as result of "
1585 "receiving a PROGRESS message.\n",
1586 sf_progress, (hearpulsing ?
"parties" :
"called party"));
1588 (hearpulsing ?
in :
NULL), sf_progress, 0, 0);
1592 "Sending DTMF '%s' to the called party as result of "
1593 "receiving a PROGRESS message.\n",
1610 "Sending MF '%s' to %s as result of "
1611 "receiving a WINK message.\n",
1612 mf_wink, (hearpulsing ?
"parties" :
"called party"));
1614 (hearpulsing ?
in :
NULL), mf_wink, 50, 55, 120, 65, 0);
1618 "Sending SF '%s' to %s as result of "
1619 "receiving a WINK message.\n",
1620 sf_wink, (hearpulsing ?
"parties" :
"called party"));
1622 (hearpulsing ?
in :
NULL), sf_wink, 0, 0);
1634 if (!single || caller_entertained) {
1637 ast_verb(3,
"%s requested media update control %d, passing it to %s\n",
1649 ast_verb(3,
"%s connected line has changed. Saving it until answer for %s\n",
1685 ast_verb(3,
"%s redirecting info has changed, passing it to %s\n",
1694 if (single && !caller_entertained
1719 cc_frame_received = 1;
1726 if (single && !caller_entertained) {
1742 if (caller_entertained) {
1746 orig_progress_to = -1;
1771 printf(
"Hangup received on %s\n",
in->name);
1776 strcpy(pa->
status,
"CANCEL");
1801 strcpy(pa->
status,
"CANCEL");
1817 ast_verb(3,
"User requested call disconnect.\n");
1819 strcpy(pa->
status,
"CANCEL");
1848 if (!single || caller_entertained) {
1882 if (!single || caller_entertained) {
1890 ast_verb(3,
"%s requested media update control %d, passing it to %s\n",
1929 ast_verb(3,
"Nobody picked up in %d ms\n", orig_answer_to);
1931 }
else if (!*to_progress) {
1932 ast_verb(3,
"No early media received in %d ms\n", orig_progress_to);
1934 strcpy(pa->
status,
"CHANUNAVAIL");
2006 ast_channel_musicclass_set(chan, original_moh);
2015 for (loopcount = 0; loopcount < 3; loopcount++) {
2016 if (res2 && loopcount == 0)
2069 static const char *
const _val[] = {
"ALLOW",
"DENY",
"TORTURE",
"KILL",
"ALLOW" };
2072 ast_verb(3,
"--Set privacy database entry %s/%s to %s\n",
2099 ast_verb(3,
"privacy: no valid response from the callee. Sending the caller to voicemail, the callee isn't responding\n");
2137 ast_verb(3,
"Privacy Screening, clid is '%s'\n", l);
2145 for (tn2 = tnam; *tn2; tn2++) {
2149 ast_verb(3,
"Privacy-- callerid is empty\n");
2151 snprintf(callerid,
sizeof(callerid),
"NOCALLERID_%s%s",
ast_channel_exten(chan), tnam);
2160 ast_verb(3,
"CallerID set (%s); N option set; Screening should be off\n", pa->
privcid);
2163 ast_verb(3,
"CallerID blank; N option set; Screening should happen; dbval is %d\n", pa->
privdb_val);
2167 ast_verb(3,
"Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
2184 ast_log(
LOG_WARNING,
"privacy: can't create directory priv-callerintros: %s\n", strerror(res));
2250 if (ts && ts->
data[0]) {
2307 int to_answer, to_progress;
2309 int cause, hanguptreecause = -1;
2312 struct timeval calldurationlimit = { 0, };
2313 char *dtmfcalled =
NULL, *dtmfcalling =
NULL, *dtmf_progress =
NULL;
2314 char *mf_progress =
NULL, *mf_wink =
NULL;
2315 char *sf_progress =
NULL, *sf_wink =
NULL;
2319 .status =
"INVALIDARGS",
2323 const char *outbound_group =
NULL;
2327 int delprivintro = 0;
2336 int fulldial = 0, num_dialed = 0;
2341 int force_forwards_only;
2385 ast_log(
LOG_WARNING,
"Cannot place outbound call from channel '%s'. Max forwards exceeded\n",
2404 ast_verb(3,
"Caller hung up before dial.\n");
2426 if (delprivintro < 0 || delprivintro > 1) {
2427 ast_log(
LOG_WARNING,
"Unknown argument %d specified to n option, ignoring\n", delprivintro);
2438 ast_verb(3,
"Setting operator services mode to %d.\n", opermode);
2443 if (!calldurationlimit.tv_sec) {
2448 ast_verb(3,
"Setting call duration limit to %.3lf seconds.\n", calldurationlimit.tv_sec + calldurationlimit.tv_usec / 1000000.0);
2453 dtmfcalled =
strsep(&sf_wink,
":");
2454 dtmfcalling =
strsep(&sf_wink,
":");
2455 dtmf_progress =
strsep(&sf_wink,
":");
2456 mf_progress =
strsep(&sf_wink,
":");
2457 mf_wink =
strsep(&sf_wink,
":");
2458 sf_progress =
strsep(&sf_wink,
":");
2468 force_forwards_only = 0;
2474 forced_clid_name[0] =
'\0';
2476 sizeof(forced_clid_name), chan);
2477 force_forwards_only = 1;
2540 stored_clid_name[0] =
'\0';
2542 sizeof(stored_clid_name), chan);
2595 while ((cur =
strsep(&rest,
"&"))) {
2621 tech_len = strlen(tech) + 1;
2622 number_len = strlen(
number) + 1;
2634 cur[tech_len - 1] =
'/';
2635 tmp->interface = cur;
2676 topology = topology_ds->
data;
2750 caller.
id = stored_clid;
2759 caller.
id = stored_clid;
2843 ast_verb(3,
"No devices or endpoints to dial (technology/resource)\n");
2844 if (continue_exec) {
2848 strcpy(pa.
status,
"CHANUNAVAIL");
2868 const char *predial_callee;
2872 if (predial_callee) {
2890 ast_debug(1,
"ast call on peer returned %d\n", res);
2891 ast_verb(3,
"Couldn't call %s\n",
tmp->interface);
2921 char *anstimeout =
strsep(&
args.timeout,
"^");
2923 to_answer = atoi(anstimeout);
2924 if (to_answer > 0) {
2927 ast_log(
LOG_WARNING,
"Invalid answer timeout specified: '%s'. Setting timeout to infinite\n",
args.timeout);
2934 to_progress = atoi(
args.timeout);
2935 if (to_progress > 0) {
2936 to_progress *= 1000;
2938 ast_log(
LOG_WARNING,
"Invalid progress timeout specified: '%s'. Setting timeout to infinite\n",
args.timeout);
2948 strcpy(pa.
status,
"CHANUNAVAIL");
2949 if (fulldial == num_dialed) {
2955 strcpy(pa.
status,
"NOANSWER");
2962 ast_channel_musicclass_set(chan, original_moh);
2982 peer =
wait_for_answer(chan, &out_chans, &to_answer, &to_progress, peerflags, opt_args, &pa, &num, &
result,
2983 dtmf_progress, mf_progress, mf_wink, sf_progress, sf_wink,
2985 ignore_cc, &forced_clid, &stored_clid, &
config);
2990 }
else if (to_answer) {
2998 int dial_end_raised = 0;
3041 strcpy(pa.
status,
"ANSWER");
3055 if (do_privacy(chan, peer, &opts, opt_args, &pa)) {
3069 char *calledfile =
NULL, *callerfile =
NULL;
3070 int calledstream = 0, callerstream = 0;
3077 calledfile =
strsep(&callerfile,
":");
3122 if (!calledstream && !callerstream) {
3160 if (active_chan == chan) {
3213 const char *gosub_result_peer;
3214 char *gosub_argstart;
3215 char *gosub_args =
NULL;
3220 if (gosub_argstart) {
3221 const char *what_is_s =
"s";
3222 *gosub_argstart = 0;
3225 what_is_s =
"~~s~~";
3230 *gosub_argstart =
',';
3232 const char *what_is_s =
"s";
3235 what_is_s =
"~~s~~";
3245 ast_log(
LOG_ERROR,
"Could not Allocate string for Gosub arguments -- Gosub Call Aborted!\n");
3251 char *gosub_transfer_dest;
3252 char *gosub_result =
ast_strdupa(gosub_result_peer);
3263 if (!strcasecmp(gosub_result,
"BUSY")) {
3267 }
else if (!strcasecmp(gosub_result,
"CONGESTION") || !strcasecmp(gosub_result,
"CHANUNAVAIL")) {
3271 }
else if (!strcasecmp(gosub_result,
"CONTINUE")) {
3275 }
else if (!strcasecmp(gosub_result,
"ABORT")) {
3278 }
else if (!strncasecmp(gosub_result,
"GOTO:", 5)) {
3279 gosub_transfer_dest = gosub_result + 5;
3282 if (strchr(gosub_transfer_dest,
'^')) {
3291 if (!dial_end_raised) {
3293 dial_end_raised = 1;
3307 if (!dial_end_raised) {
3309 dial_end_raised = 1;
3319 ast_verb(3,
"Sending DTMF '%s' to the called party.\n", dtmfcalled);
3323 ast_verb(3,
"Sending DTMF '%s' to the calling party.\n", dtmfcalling);
3361 config.end_bridge_callback_data = chan;
3367 }
else if (sentringing) {
3399 }
else if (sentringing) {
3434 if (
config.answer_topology) {
3435 ast_trace(2,
"%s Cleaning up topology: %p %s\n",
3446 if (
config.warning_sound) {
3452 if (
config.start_sound) {
3463 memset(&peerflags, 0,
sizeof(peerflags));
3472 int sleepms = 0, loops = 0, res = -1;
3493 loops = atoi(
args.retries);
3496 if (!
args.dialdata) {
3533 if (!res && sleepms) {
3557 }
else if (res > 0) {
Generic Advice of Charge encode and decode routines.
void * ast_aoc_destroy_encoded(struct ast_aoc_encoded *encoded)
free an ast_aoc_encoded object
enum ast_aoc_type ast_aoc_get_msg_type(struct ast_aoc_decoded *decoded)
get the message type, AOC-D, AOC-E, or AOC Request
struct ast_aoc_decoded * ast_aoc_decode(struct ast_aoc_encoded *encoded, size_t size, struct ast_channel *chan)
decodes an encoded aoc payload.
void * ast_aoc_destroy_decoded(struct ast_aoc_decoded *decoded)
free an ast_aoc_decoded object
struct ast_aoc_encoded * ast_aoc_encode(struct ast_aoc_decoded *decoded, size_t *out_size, struct ast_channel *chan)
encodes a decoded aoc structure so it can be passed on the wire
static void topology_ds_destroy(void *data)
static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast_flags64 *peerflags, int *continue_exec)
#define OPT_PREDIAL_CALLER
@ OPT_IGNORE_CONNECTEDLINE
#define OPT_CANCEL_ELSEWHERE
static const char * get_cid_name(char *name, int namelen, struct ast_channel *chan)
static const struct ast_app_option dial_exec_options[128]
static void do_forward(struct chanlist *o, struct cause_args *num, struct ast_flags64 *peerflags, int single, int caller_entertained, int *to, struct ast_party_id *forced_clid, struct ast_party_id *stored_clid)
#define OPT_PREDIAL_CALLEE
#define DIAL_CALLERID_ABSENT
#define OPT_FORCE_CID_PRES
static void setup_peer_after_bridge_goto(struct ast_channel *chan, struct ast_channel *peer, struct ast_flags64 *opts, char *opt_args[])
#define CAN_EARLY_BRIDGE(flags, chan, peer)
#define OPT_TOPOLOGY_PRESERVE
#define OPT_RING_WITH_EARLY_MEDIA
#define OPT_FORCE_CID_TAG
static int dial_exec(struct ast_channel *chan, const char *data)
#define DIAL_NOFORWARDHTML
#define OPT_CANCEL_TIMEOUT
static void chanlist_free(struct chanlist *outgoing)
static void publish_dial_end_event(struct ast_channel *in, struct dial_head *out_chans, struct ast_channel *exception, const char *status)
static int onedigit_goto(struct ast_channel *chan, const char *context, char exten, int pri)
static void handle_cause(int cause, struct cause_args *num)
static int setup_privacy_args(struct privacy_args *pa, struct ast_flags64 *opts, char *opt_args[], struct ast_channel *chan)
returns 1 if successful, 0 or <0 if the caller should 'goto out'
static void set_duration_var(struct ast_channel *chan, const char *var_base, int64_t duration)
static void update_connected_line_from_peer(struct ast_channel *chan, struct ast_channel *peer, int is_caller)
static int detect_disconnect(struct ast_channel *chan, char code, struct ast_str **featurecode)
static void hanguptree(struct dial_head *out_chans, struct ast_channel *exception, int hangupcause)
static const struct ast_datastore_info topology_ds_info
static int load_module(void)
static int retrydial_exec(struct ast_channel *chan, const char *data)
static int dial_handle_playtones(struct ast_channel *chan, const char *data)
static void end_bridge_callback(void *data)
static int unload_module(void)
#define OPT_CALLER_ANSWER
static struct ast_channel * wait_for_answer(struct ast_channel *in, struct dial_head *out_chans, int *to_answer, int *to_progress, struct ast_flags64 *peerflags, char *opt_args[], struct privacy_args *pa, const struct cause_args *num_in, int *result, char *dtmf_progress, char *mf_progress, char *mf_wink, char *sf_progress, char *sf_wink, const int hearpulsing, const int ignore_cc, struct ast_party_id *forced_clid, struct ast_party_id *stored_clid, struct ast_bridge_config *config)
static void end_bridge_callback_data_fixup(struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator)
static int valid_priv_reply(struct ast_flags64 *opts, int res)
static int silencethreshold
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
#define ast_calloc(num, len)
A wrapper for calloc()
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
After Bridge Execution API.
int ast_bridge_setup_after_goto(struct ast_channel *chan)
Setup any after bridge goto location to begin execution.
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.
void ast_bridge_set_after_h(struct ast_channel *chan, const char *context)
Set channel to run the h exten after the bridge.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
#define AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN
int ast_parse_caller_presentation(const char *data)
Convert caller ID text code to value (used in config file parsing)
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)
@ AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s,...
Internal Asterisk hangup causes.
#define AST_CAUSE_CONGESTION
#define AST_CAUSE_ANSWERED_ELSEWHERE
#define AST_CAUSE_NO_ROUTE_DESTINATION
#define AST_CAUSE_UNREGISTERED
#define AST_CAUSE_NO_ANSWER
#define AST_CAUSE_NORMAL_CLEARING
Call Completion Supplementary Services API.
void ast_cc_call_failed(struct ast_channel *incoming, struct ast_channel *outgoing, const char *const dialstring)
Make CCBS available in the case that ast_call fails.
void ast_ignore_cc(struct ast_channel *chan)
Mark the channel to ignore further CC activity.
int ast_cc_is_recall(struct ast_channel *chan, int *core_id, const char *const monitor_type)
Decide if a call to a particular channel is a CC recall.
void ast_handle_cc_control_frame(struct ast_channel *inbound, struct ast_channel *outbound, void *frame_data)
Properly react to a CC control frame.
int ast_cc_completed(struct ast_channel *chan, const char *const debug,...)
Indicate recall has been acknowledged.
void ast_cc_busy_interface(struct ast_channel *inbound, struct ast_cc_config_params *cc_params, const char *monitor_type, const char *const device_name, const char *const dialstring, void *private_data)
Callback made from ast_cc_callback for certain channel types.
void ast_cc_extension_monitor_add_dialstring(struct ast_channel *incoming, const char *const dialstring, const char *const device_name)
Add a child dialstring to an extension monitor.
int ast_cc_call_init(struct ast_channel *chan, int *ignore_cc)
Start the CC process on a call.
int ast_cc_failed(int core_id, const char *const debug,...)
Indicate failure has occurred.
int ast_cc_callback(struct ast_channel *inbound, const char *const tech, const char *const dest, ast_cc_callback_fn callback)
Run a callback for potential matching destinations.
int ast_cdr_reset(const char *channel_name, int keep_variables)
Reset the detail record.
static const char config[]
General Asterisk PBX channel definitions.
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
int ast_str2cause(const char *name) attribute_pure
Convert the string form of a cause code to a number.
const char * ast_channel_name(const struct ast_channel *chan)
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
void ast_channel_appl_set(struct ast_channel *chan, const char *value)
void ast_channel_visible_indication_set(struct ast_channel *chan, int value)
int ast_channel_get_device_name(struct ast_channel *chan, char *device_name, size_t name_buffer_length)
Get a device name given its channel structure.
void ast_party_redirecting_init(struct ast_party_redirecting *init)
Initialize the given redirecting structure.
int ast_call(struct ast_channel *chan, const char *addr, int timeout)
Make a call.
void ast_channel_clear_flag(struct ast_channel *chan, unsigned int flag)
Clear a flag on a channel.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
void ast_party_id_init(struct ast_party_id *init)
Initialize the given party id structure.
int ast_channel_connected_line_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *connected_info, int frame)
Run a connected line interception subroutine and update a channel's connected line information.
void ast_party_number_init(struct ast_party_number *init)
Initialize the given number structure.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
@ AST_CHANNEL_REQUESTOR_BRIDGE_PEER
void ast_channel_set_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Set the connected line information in the Asterisk channel.
const char * ast_channel_musicclass(const struct ast_channel *chan)
int ast_channel_sendhtml(struct ast_channel *channel, int subclass, const char *data, int datalen)
Sends HTML on given channel Send HTML or URL on link.
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
int64_t ast_channel_get_up_time_ms(struct ast_channel *chan)
Obtain how long it has been since the channel was answered in ms.
void ast_channel_set_caller_event(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update)
Set the caller id information in the Asterisk channel and generate an AMI event if the caller id name...
struct ast_channel * ast_waitfor_n(struct ast_channel **chan, int n, int *ms)
Waits for input on a group of channels Wait for input on an array of channels for a given # of millis...
int ast_senddigit(struct ast_channel *chan, char digit, unsigned int duration)
Send a DTMF digit to a channel.
#define ast_channel_lock(chan)
int ast_channel_make_compatible(struct ast_channel *chan, struct ast_channel *peer)
Make the frame formats of two channels compatible.
void ast_channel_data_set(struct ast_channel *chan, const char *value)
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
unsigned short ast_channel_transfercapability(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.
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
void ast_party_connected_line_set(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src, const struct ast_set_party_connected_line *update)
Set the connected line information based on another connected line source.
int ast_channel_priority(const struct ast_channel *chan)
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
struct ast_party_connected_line * ast_channel_connected(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_deactivate_generator(struct ast_channel *chan)
int ast_check_hangup_locked(struct ast_channel *chan)
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
void ast_channel_update_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Indicate that the connected line information has changed.
void ast_party_caller_set_init(struct ast_party_caller *init, const struct ast_party_caller *guide)
Initialize the given caller structure using the given guide for a set update operation.
void ast_party_id_set_init(struct ast_party_id *init, const struct ast_party_id *guide)
Initialize the given party id structure using the given guide for a set update operation.
struct timeval ast_channel_creationtime(struct ast_channel *chan)
int ast_channel_redirecting_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *redirecting_info, int is_frame)
Run a redirecting interception subroutine and update a channel's redirecting information.
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
Inherits channel variable from parent to child channel.
int ast_connected_line_parse_data(const unsigned char *data, size_t datalen, struct ast_party_connected_line *connected)
Parse connected line indication frame data.
struct ast_channel * ast_request_with_stream_topology(const char *type, struct ast_stream_topology *topology, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
Requests a channel (specifying stream topology)
int ast_channel_supports_html(struct ast_channel *channel)
Checks for HTML support on a channel.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
struct ast_stream_topology * ast_channel_get_stream_topology(const struct ast_channel *chan)
Retrieve the topology of streams on a channel.
int ast_channel_hangupcause(const struct ast_channel *chan)
int64_t ast_channel_get_duration_ms(struct ast_channel *chan)
Obtain how long it's been, in milliseconds, since the channel was created.
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen)
Indicates condition of channel, with payload.
struct ast_tone_zone * ast_channel_zone(const struct ast_channel *chan)
void ast_channel_set_flag(struct ast_channel *chan, unsigned int flag)
Set a flag on a channel.
void ast_channel_update_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Indicate that the redirecting id has changed.
ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan)
struct timeval * ast_channel_whentohangup(struct ast_channel *chan)
void ast_party_number_free(struct ast_party_number *doomed)
Destroy the party number contents.
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
int ast_channel_sendurl(struct ast_channel *channel, const char *url)
Sends a URL on a given link Send URL on link.
const char * ast_channel_language(const struct ast_channel *chan)
const char * ast_cause2str(int cause) attribute_pure
Gives the string form of a given cause code.
void ast_party_redirecting_free(struct ast_party_redirecting *doomed)
Destroy the redirecting information contents.
void ast_channel_context_set(struct ast_channel *chan, const char *value)
struct ast_sched_context * ast_channel_sched(const struct ast_channel *chan)
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.
const char * ast_channel_call_forward(const struct ast_channel *chan)
struct ast_filestream * ast_channel_stream(const struct ast_channel *chan)
int ast_pre_call(struct ast_channel *chan, const char *sub_args)
Execute a Gosub call on the channel before a call is placed.
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_party_connected_line_set_init(struct ast_party_connected_line *init, const struct ast_party_connected_line *guide)
Initialize the given connected line structure using the given guide for a set update operation.
void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
void ast_channel_priority_set(struct ast_channel *chan, int value)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
void ast_autoservice_chan_hangup_peer(struct ast_channel *chan, struct ast_channel *peer)
Put chan into autoservice while hanging up peer.
void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
int ast_answer(struct ast_channel *chan)
Answer a channel.
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
int ast_channel_early_bridge(struct ast_channel *c0, struct ast_channel *c1)
Bridge two channels together (early)
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
const char * ast_channel_exten(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
#define AST_MAX_EXTENSION
void ast_party_redirecting_copy(struct ast_party_redirecting *dest, const struct ast_party_redirecting *src)
Copy the source redirecting information to the destination redirecting.
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.
ast_channel_state
ast_channel states
#define ast_datastore_alloc(info, uid)
const char * ast_hangup_cause_to_dial_status(int hangup_cause)
Convert a hangup cause to a publishable dial status.
Convenient Signal Processing routines.
int ast_dsp_get_threshold_from_settings(enum threshold which)
Get silence threshold from dsp.conf.
Call Parking and Pickup API Includes code and algorithms from the Zapata library.
int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config)
Bridge a call, optionally allowing redirection.
int ast_bridge_timelimit(struct ast_channel *chan, struct ast_bridge_config *config, char *parse, struct timeval *calldurationlimit)
parse L option and read associated channel variables to set warning, warning frequency,...
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_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
Checks for the existence of a given file.
int ast_filedelete(const char *filename, const char *fmt)
Deletes a file.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
#define SCOPE_EXIT_RTN_VALUE(__return_value,...)
#define SCOPE_ENTER(level,...)
#define ast_trace(level,...)
void ast_channel_publish_dial(struct ast_channel *caller, struct ast_channel *peer, const char *dialstring, const char *dialstatus)
Publish in the ast_channel_topic or ast_channel_topic_all topics a stasis message for the channels in...
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_publish_snapshot(struct ast_channel *chan)
Publish a ast_channel_snapshot for a channel.
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
void ast_channel_publish_dial_forward(struct ast_channel *caller, struct ast_channel *peer, struct ast_channel *forwarded, const char *dialstring, const char *dialstatus, const char *forward)
Publish in the ast_channel_topic or ast_channel_topic_all topics a stasis message for the channels in...
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
const char * ast_app_expand_sub_args(struct ast_channel *chan, const char *args)
Add missing context/exten to subroutine argument string.
#define AST_APP_ARG(name)
Define an application argument.
int ast_sf_stream(struct ast_channel *chan, struct ast_channel *peer, struct ast_channel *chan2, const char *digits, int frequency, int is_external)
Send a string of SF digits to a channel.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
int ast_play_and_record(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime_sec, const char *fmt, int *duration, int *sound_duration, int silencethreshold, int maxsilence_ms, const char *path)
Record a file based on input from a channel. Use default accept and cancel DTMF. This function will p...
int ast_app_group_set_channel(struct ast_channel *chan, const char *data)
Set the group for a channel, splitting the provided data into group and category, if specified.
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
int ast_play_and_wait(struct ast_channel *chan, const char *fn)
Play a stream and wait for a digit, returning the digit that was pressed.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
int ast_app_exec_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const char *sub_args, int ignore_hangup)
Run a subroutine on a channel, placing an optional second channel into autoservice.
int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between, unsigned int duration)
Send a string of DTMF digits to a channel.
int ast_mf_stream(struct ast_channel *chan, struct ast_channel *peer, struct ast_channel *chan2, const char *digits, int between, unsigned int duration, unsigned int durationkp, unsigned int durationst, int is_external)
Send a string of MF digits to a channel.
int ast_app_parse_options64(const struct ast_app_option *options, struct ast_flags64 *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
char * strsep(char **str, const char *delims)
Configuration File Parser.
#define AST_FEATURE_MAX_LEN
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.
#define AST_OPTION_OPRMODE
@ AST_CONTROL_REDIRECTING
@ AST_CONTROL_CONNECTED_LINE
@ AST_CONTROL_PVT_CAUSE_CODE
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
static struct ast_tone_zone_sound * ast_tone_zone_sound_unref(struct ast_tone_zone_sound *ts)
Release a reference to an ast_tone_zone_sound.
int ast_playtones_start(struct ast_channel *chan, int vol, const char *tonelist, int interruptible)
Start playing a list of tones on a channel.
struct ast_tone_zone_sound * ast_get_indication_tone(const struct ast_tone_zone *zone, const char *indication)
Locate a tone zone sound.
#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_EMPTY(head)
Checks whether the specified list contains any entries.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_HEAD_NOLOCK_INIT_VALUE
Defines initial values for a declaration of AST_LIST_HEAD_NOLOCK.
#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_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Asterisk locking-related definitions:
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
int ast_max_forwards_decrement(struct ast_channel *chan)
Decrement the max forwards count for a particular channel.
int ast_max_forwards_get(struct ast_channel *chan)
Get the current max forwards for a particular channel.
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.
int ast_unregister_application(const char *app)
Unregister an application.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_DATA_DIR
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.
#define AST_PBX_INCOMPLETE
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.
int ast_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority)
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
int ast_get_hint(char *hint, int hintsize, char *name, int namesize, struct ast_channel *c, const char *context, const char *exten)
If an extension hint exists, return non-zero.
int ast_parseable_goto(struct ast_channel *chan, const char *goto_string)
Persistent data storage (akin to *doze registry)
#define AST_PRIVACY_ALLOW
int ast_privacy_set(char *dest, char *cid, int status)
int ast_privacy_check(char *dest, char *cid)
#define AST_PRIVACY_UNKNOWN
#define AST_PRIVACY_TORTURE
Pluggable RTP Architecture.
void ast_rtp_instance_early_bridge_make_compatible(struct ast_channel *c_dst, struct ast_channel *c_src)
Make two channels compatible for early bridging.
Say numbers and dates (maybe words one day too)
int ast_sched_runq(struct ast_sched_context *con)
Runs the queue.
int ast_sched_wait(struct ast_sched_context *con) attribute_warn_unused_result
Determines number of seconds until the next outstanding event to take place.
@ AST_STREAM_STATE_RECVONLY
Set when the stream is receiving media only.
@ AST_STREAM_STATE_SENDONLY
Set when the stream is sending media only.
void ast_stream_set_state(struct ast_stream *stream, enum ast_stream_state state)
Set the state of a stream.
const char * ast_stream_topology_to_str(const struct ast_stream_topology *topology, struct ast_str **buf)
Get a string representing the topology for debugging/display purposes.
struct ast_stream * ast_stream_topology_get_stream(const struct ast_stream_topology *topology, unsigned int position)
Get a specific stream from the topology.
int ast_stream_topology_get_count(const struct ast_stream_topology *topology)
Get the number of streams in a topology.
enum ast_stream_state ast_stream_get_state(const struct ast_stream *stream)
Get the current state of a stream.
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
struct ast_stream_topology * ast_stream_topology_clone(const struct ast_stream_topology *topology)
Create a deep clone of an existing stream topology.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#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)
#define ast_str_tmp(init_len, __expr)
Provides a temporary ast_str and returns a copy of its buffer.
#define ast_str_alloca(init_len)
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
void * end_bridge_callback_data
Main Channel structure associated with a channel.
char exten[AST_MAX_EXTENSION]
const struct ast_channel_tech * tech
Structure for a data store type.
Structure for a data store object.
Structure used to handle a large number of boolean flags == used only in app_dial?
struct ast_stream_topology * topology
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
union ast_frame::@226 data
enum ast_frame_type frametype
Caller Party information.
struct ast_party_id id
Caller party ID.
Connected Line/Party information.
int source
Information about the source of an update.
struct ast_party_id id
Connected party ID.
int transit_network_select
Transit Network Select.
Information needed to identify an endpoint in a call.
struct ast_party_subaddress subaddress
Subscriber subaddress.
char * tag
User-set "tag".
struct ast_party_name name
Subscriber name.
struct ast_party_number number
Subscriber phone number.
unsigned char valid
TRUE if the name information is valid/present.
char * str
Subscriber name (Malloced)
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
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)
struct ast_party_id to
Call is redirecting to a new party (Sent to the caller)
char * str
Malloced subaddress string.
Support for dynamic strings.
const char * data
Description of a tone.
struct ast_channel * chan
struct ast_aoc_decoded * aoc_s_rate_list
struct ast_party_connected_line connected
struct ast_channel * chan
struct chanlist::@16 node
unsigned int pending_connected_update
structure to hold extensions
Channel datastore data for max forwards.
struct ast_channel * peer
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Support for translation of data formats. translate.c.
#define ast_test_flag(p, flag)
#define ast_set2_flag64(p, value, flag)
#define ast_test_flag64(p, flag)
#define ast_clear_flag64(p, flag)
#define ast_clear_flag(p, flag)
int ast_mkdir(const char *path, int mode)
Recursively create directory path.
#define ast_copy_flags64(dest, src, flagz)
#define ast_set_flag64(p, flag)
#define ast_set_flag(p, flag)
void ast_replace_subargument_delimiter(char *s)
Replace '^' in a string with ','.