39 #include <sys/signal.h>
41 #include <netinet/in.h>
542 static const char app[] =
"Dial";
543 static const char rapp[] =
"RetryDial";
580 #define DIAL_STILLGOING (1LLU << 31)
581 #define DIAL_NOFORWARDHTML (1LLU << 32)
582 #define DIAL_CALLERID_ABSENT (1LLU << 33)
583 #define OPT_CANCEL_ELSEWHERE (1LLU << 34)
584 #define OPT_PEER_H (1LLU << 35)
585 #define OPT_CALLEE_GO_ON (1LLU << 36)
586 #define OPT_CANCEL_TIMEOUT (1LLU << 37)
587 #define OPT_FORCE_CID_TAG (1LLU << 38)
588 #define OPT_FORCE_CID_PRES (1LLU << 39)
589 #define OPT_CALLER_ANSWER (1LLU << 40)
654 #define CAN_EARLY_BRIDGE(flags,chan,peer) (!ast_test_flag64(flags, OPT_CALLEE_HANGUP | \
655 OPT_CALLER_HANGUP | OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER | \
656 OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR | OPT_CALLEE_PARK | \
657 OPT_CALLER_PARK | OPT_ANNOUNCE | OPT_CALLEE_MACRO | OPT_CALLEE_GOSUB) && \
658 !chan->audiohooks && !peer->audiohooks && \
659 ast_framehook_list_is_empty(chan->framehooks) && ast_framehook_list_is_empty(peer->framehooks))
690 if (outgoing->
chan && (outgoing->
chan != exception)) {
691 if (answered_elsewhere) {
700 outgoing = outgoing->
next;
705 #define AST_MAX_WATCHERS 256
757 char rexten[2] = {
exten,
'\0' };
784 return ast_get_hint(NULL, 0, name, namelen, chan, context, exten) ? name :
"";
791 "SubEvent: Begin\r\n"
793 "Destination: %s\r\n"
794 "CallerIDNum: %s\r\n"
795 "CallerIDName: %s\r\n"
796 "ConnectedLineNum: %s\r\n"
797 "ConnectedLineName: %s\r\n"
799 "DestUniqueID: %s\r\n"
800 "Dialstring: %s\r\n",
807 dialstring ? dialstring :
"");
816 "DialStatus: %s\r\n",
838 struct ast_flags64 *peerflags,
int single,
int caller_entertained,
int *to,
851 if ((stuff = strchr(tmpchan,
'/'))) {
855 const char *forward_context;
859 forward_context = NULL;
861 snprintf(tmpchan,
sizeof(tmpchan),
"%s@%s", c->
call_forward, forward_context ? forward_context : c->
context);
866 if (!strcasecmp(tech,
"Local")) {
878 ast_verb(3,
"Now forwarding %s to '%s/%s' (thanks to %s)\n", in->
name, tech, stuff, c->
name);
881 ast_verb(3,
"Forwarding %s to '%s/%s' prevented.\n", in->
name, tech, stuff);
888 if (single && !caller_entertained) {
904 "Forwarding failed to create channel to dial '%s/%s' (cause = %d)\n",
941 caller.
id = *stored_clid;
950 caller.
id = *stored_clid;
962 connected.
id = *forced_clid;
971 c->
data =
"(Outgoing Line)";
1018 if (single && !caller_entertained) {
1037 const struct cause_args *num_in,
int *result,
char *dtmf_progress,
1038 const int ignore_cc,
1046 int single = outgoing && !outgoing->
next;
1047 int caller_entertained = outgoing
1054 int cc_recall_core_id;
1056 int cc_frame_received = 0;
1057 int num_ringing = 0;
1063 if (!caller_entertained) {
1073 strcpy(pa->
status,
"CONGESTION");
1095 for (epollo = outgoing; epollo; epollo = epollo->
next)
1102 int numlines = prestart;
1106 watchers[pos++] = in;
1107 for (o = outgoing; o; o = o->
next) {
1110 watchers[pos++] = o->
chan;
1117 strcpy(pa->
status,
"BUSY");
1119 strcpy(pa->
status,
"CONGESTION");
1121 strcpy(pa->
status,
"CHANUNAVAIL");
1127 ast_cc_failed(cc_recall_core_id,
"Everyone is busy/congested for the recall. How sad");
1132 for (o = outgoing; o; o = o->
next) {
1158 size_t encoded_size;
1183 if (!ignore_cc && (f =
ast_read(c))) {
1206 do_forward(o, &num, peerflags, single, caller_entertained, &orig,
1207 forced_clid, stored_clid);
1209 if (single && o->
chan
1259 size_t encoded_size;
1331 if (ignore_cc || cc_frame_received || num_ringing == numlines) {
1334 if (single && !caller_entertained
1345 ast_verb(3,
"%s is making progress passing it to %s\n", c->
name, in->
name);
1347 if (single && !caller_entertained
1358 "Sending DTMF '%s' to the called party as result of receiving a PROGRESS message.\n",
1366 if (!single || caller_entertained) {
1369 ast_verb(3,
"%s requested media update control %d, passing it to %s\n",
1375 ast_verb(3,
"Connected line update to %s prevented.\n", in->
name);
1381 ast_verb(3,
"%s connected line has changed. Saving it until answer for %s\n",
1414 ast_verb(3,
"Redirecting update to %s prevented.\n", in->
name);
1417 ast_verb(3,
"%s redirecting info has changed, passing it to %s\n",
1426 if (single && !caller_entertained
1450 cc_frame_received = 1;
1454 if (single && !caller_entertained) {
1467 if (caller_entertained) {
1494 printf(
"Hangup received on %s\n", in->
name);
1499 strcpy(pa->
status,
"CANCEL");
1508 ast_cc_completed(in,
"CC completed, although the caller hung up (cancelled)");
1524 strcpy(pa->
status,
"CANCEL");
1537 ast_verb(3,
"User requested call disconnect.\n");
1539 strcpy(pa->
status,
"CANCEL");
1550 for (o = outgoing; o; o = o->
next) {
1565 if (!single || caller_entertained) {
1595 if (!single || caller_entertained) {
1603 ast_verb(3,
"%s requested media update control %d, passing it to %s\n",
1633 ast_verb(3,
"Nobody picked up in %d ms\n", orig);
1640 for (epollo = outgoing; epollo; epollo = epollo->
next) {
1720 for (loopcount = 0; loopcount < 3; loopcount++) {
1721 if (res2 && loopcount == 0)
1773 static const char *
const _val[] = {
"ALLOW",
"DENY",
"TORTURE",
"KILL",
"ALLOW" };
1776 ast_verb(3,
"--Set privacy database entry %s/%s to %s\n",
1802 ast_log(
LOG_NOTICE,
"privacy: no valid response from the callee. Sending the caller to voicemail, the callee isn't responding\n");
1842 ast_verb(3,
"Privacy Screening, clid is '%s'\n", l);
1850 for (tn2 = tnam; *tn2; tn2++) {
1854 ast_verb(3,
"Privacy-- callerid is empty\n");
1856 snprintf(callerid,
sizeof(callerid),
"NOCALLERID_%s%s", chan->
exten, tnam);
1865 ast_verb(3,
"CallerID set (%s); N option set; Screening should be off\n", pa->
privcid);
1868 ast_verb(3,
"CallerID blank; N option set; Screening should happen; dbval is %d\n", pa->
privdb_val);
1872 ast_verb(3,
"Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
1889 ast_log(
LOG_WARNING,
"privacy: can't create directory priv-callerintros: %s\n", strerror(res));
1942 snprintf(buf,
sizeof(buf),
"%ld", (
long) end - chan->
cdr->
answer.tv_sec);
1947 snprintf(buf,
sizeof(buf),
"%ld", (
long) end - chan->
cdr->
start.tv_sec);
1970 if (ts && ts->
data[0]) {
1999 struct timeval calldurationlimit = { 0, };
2000 char *dtmfcalled = NULL, *dtmfcalling = NULL, *dtmf_progress=NULL;
2004 .status =
"INVALIDARGS",
2007 const char *outbound_group = NULL;
2011 int delprivintro = 0;
2021 int fulldial = 0, num_dialed = 0;
2026 int force_forwards_only;
2082 delprivintro = atoi(opt_args[OPT_ARG_SCREEN_NOINTRO]);
2084 if (delprivintro < 0 || delprivintro > 1) {
2085 ast_log(
LOG_WARNING,
"Unknown argument %d specified to n option, ignoring\n", delprivintro);
2096 ast_verb(3,
"Setting operator services mode to %d.\n", opermode);
2100 calldurationlimit.tv_sec = atoi(opt_args[OPT_ARG_DURATION_STOP]);
2101 if (!calldurationlimit.tv_sec) {
2102 ast_log(
LOG_WARNING,
"Dial does not accept S(%s), hanging up.\n", opt_args[OPT_ARG_DURATION_STOP]);
2106 ast_verb(3,
"Setting call duration limit to %.3lf seconds.\n", calldurationlimit.tv_sec + calldurationlimit.tv_usec / 1000000.0);
2111 dtmfcalled =
strsep(&dtmf_progress,
":");
2112 dtmfcalling =
strsep(&dtmf_progress,
":");
2122 force_forwards_only = 0;
2128 forced_clid_name[0] =
'\0';
2130 sizeof(forced_clid_name), chan);
2131 force_forwards_only = 1;
2194 stored_clid_name[0] =
'\0';
2196 sizeof(stored_clid_name), chan);
2241 while ((cur =
strsep(&rest,
"&")) ) {
2246 char *
interface = ast_strdupa(number);
2247 char *tech =
strsep(&number,
"/");
2285 dialed_interfaces = datastore->
data;
2288 ast_log(
LOG_WARNING,
"Unable to create channel datastore for dialed interfaces. Aborting!\n");
2295 if (!(dialed_interfaces =
ast_calloc(1,
sizeof(*dialed_interfaces)))) {
2301 datastore->
data = dialed_interfaces;
2312 ast_log(
LOG_WARNING,
"Skipping dialing interface '%s' again since it has already been dialed\n",
2329 if (strcasecmp(tech,
"Local")) {
2377 tc->
appl =
"AppDial";
2378 tc->
data =
"(Outgoing Line)";
2384 caller.
id = stored_clid;
2393 caller.
id = stored_clid;
2426 connected.
id = forced_clid;
2477 ast_debug(1,
"ast call on peer returned %d\n", res);
2478 ast_verb(3,
"Couldn't call %s/%s\n", tech, numsubst);
2490 ast_verb(3,
"Called %s/%s\n", tech, numsubst);
2498 tmp->
next = outgoing;
2508 to = atoi(
args.timeout);
2518 strcpy(pa.
status,
"CHANUNAVAIL");
2519 if (fulldial == num_dialed) {
2525 strcpy(pa.
status,
"NOANSWER");
2552 peer =
wait_for_answer(chan, outgoing, &to, peerflags, opt_args, &pa, &num, &result,
2553 dtmf_progress, ignore_cc, &forced_clid, &stored_clid);
2581 strcpy(pa.
status,
"ANSWER");
2608 if (do_privacy(chan, peer, &opts, opt_args, &pa)) {
2629 ast_log(
LOG_ERROR,
"error streaming file '%s' to callee\n", opt_args[OPT_ARG_ANNOUNCE]);
2707 const char *macro_result;
2717 if (theapp && !res) {
2723 res =
pbx_exec(peer, theapp, opt_args[OPT_ARG_CALLEE_MACRO]);
2724 ast_debug(1,
"Macro exited with status %d\n", res);
2738 char *macro_transfer_dest;
2740 if (!strcasecmp(macro_result,
"BUSY")) {
2744 }
else if (!strcasecmp(macro_result,
"CONGESTION") || !strcasecmp(macro_result,
"CHANUNAVAIL")) {
2748 }
else if (!strcasecmp(macro_result,
"CONTINUE")) {
2755 }
else if (!strcasecmp(macro_result,
"ABORT")) {
2758 }
else if (!strncasecmp(macro_result,
"GOTO:", 5) && (macro_transfer_dest =
ast_strdupa(macro_result + 5))) {
2761 if (strchr(macro_transfer_dest,
'^')) {
2775 const char *gosub_result;
2776 char *gosub_args, *gosub_argstart;
2787 if (theapp && !res9) {
2795 gosub_argstart = strchr(opt_args[OPT_ARG_CALLEE_GOSUB],
',');
2796 if (gosub_argstart) {
2797 const char *what_is_s =
"s";
2798 *gosub_argstart = 0;
2801 what_is_s =
"~~s~~";
2803 if (
ast_asprintf(&gosub_args,
"%s,%s,1(%s)", opt_args[OPT_ARG_CALLEE_GOSUB], what_is_s, gosub_argstart + 1) < 0) {
2806 *gosub_argstart =
',';
2808 const char *what_is_s =
"s";
2811 what_is_s =
"~~s~~";
2813 if (
ast_asprintf(&gosub_args,
"%s,%s,1", opt_args[OPT_ARG_CALLEE_GOSUB], what_is_s) < 0) {
2819 res9 =
pbx_exec(peer, theapp, gosub_args);
2823 memset(&args, 0,
sizeof(args));
2828 ast_debug(1,
"Gosub exited with status %d\n", res9);
2830 ast_log(
LOG_ERROR,
"Could not Allocate string for Gosub arguments -- Gosub Call Aborted!\n");
2845 char *gosub_transfer_dest;
2853 if (!strcasecmp(gosub_result,
"BUSY")) {
2857 }
else if (!strcasecmp(gosub_result,
"CONGESTION") || !strcasecmp(gosub_result,
"CHANUNAVAIL")) {
2861 }
else if (!strcasecmp(gosub_result,
"CONTINUE")) {
2868 }
else if (!strcasecmp(gosub_result,
"ABORT")) {
2871 }
else if (!strncasecmp(gosub_result,
"GOTO:", 5) && (gosub_transfer_dest =
ast_strdupa(gosub_result + 5))) {
2874 if (strchr(gosub_transfer_dest,
'^')) {
2888 struct timeval whentohangup = calldurationlimit;
2892 ast_verb(3,
"Sending DTMF '%s' to the called party.\n", dtmfcalled);
2896 ast_verb(3,
"Sending DTMF '%s' to the calling party.\n", dtmfcalling);
2934 }
else if (sentringing) {
2953 oprmode.
mode = opermode;
2969 strcpy(peer->
exten,
"h");
2981 if (found && res9) {
3013 }
else if (sentringing) {
3059 memset(&peerflags, 0,
sizeof(peerflags));
3068 int sleepms = 0, loops = 0, res = -1;
3089 loops = atoi(
args.retries);
3092 if (!
args.dialdata) {
3112 chan->
data =
"Retrying";
3129 if (!res && sleepms) {
3153 }
else if (res > 0) {
3195 ast_log(
LOG_ERROR,
"Dial virtual context 'app_dial_gosub_virtual_context' does not exist and unable to create\n");
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...
static char musicclass[MAX_MUSICCLASS]
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...
union ast_frame_subclass subclass
int ast_hangup(struct ast_channel *chan)
Hang up a channel.
#define OPT_FORCE_CID_PRES
static int detect_disconnect(struct ast_channel *chan, char code, struct ast_str **featurecode)
int ast_channel_early_bridge(struct ast_channel *c0, struct ast_channel *c1)
Bridge two channels together (early)
Information needed to identify an endpoint in a call.
Options for ast_pbx_run()
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
static char accountcode[AST_MAX_ACCOUNT_CODE]
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.
#define ast_channel_lock(chan)
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
void ast_cdr_failed(struct ast_cdr *cdr)
Fail a call.
char * str
Subscriber phone number (Malloced)
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
struct ast_party_connected_line connected
Channel Connected Line ID information.
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
#define AST_LIST_LOCK(head)
Locks a list.
#define AST_PRIVACY_ALLOW
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
void ast_poll_channel_add(struct ast_channel *chan0, struct ast_channel *chan1)
void(* end_bridge_callback_data_fixup)(struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator)
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
#define ast_copy_flags64(dest, src, flagz)
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_party_caller caller
Channel Caller ID information.
struct ast_tone_zone * zone
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
char * strsep(char **str, const char *delims)
static int onedigit_goto(struct ast_channel *chan, const char *context, char exten, int pri)
struct ast_app * pbx_findapp(const char *app)
Look up an application.
int ast_cc_failed(int core_id, const char *const debug,...)
Indicate failure has occurred.
unsigned int pending_connected_update
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
#define OPT_CANCEL_ELSEWHERE
const ast_string_field uniqueid
struct ast_flags features_callee
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
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...
void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *flags)
Reset the detail record, optionally posting it first.
struct ast_party_id id
Connected party ID.
#define ast_set2_flag(p, value, flag)
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...
#define ast_test_flag(p, flag)
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.
Support for translation of data formats. translate.c.
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
struct ast_party_name name
Subscriber name.
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
static int unload_module(void)
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.
static struct ast_channel * wait_for_answer(struct ast_channel *in, struct chanlist *outgoing, int *to, struct ast_flags64 *peerflags, char *opt_args[], struct privacy_args *pa, const struct cause_args *num_in, int *result, char *dtmf_progress, const int ignore_cc, struct ast_party_id *forced_clid, struct ast_party_id *stored_clid)
Convenient Signal Processing routines.
char context[AST_MAX_CONTEXT]
int ast_privacy_check(char *dest, char *cid)
int ast_channel_supports_html(struct ast_channel *channel)
Checks for HTML support on a channel.
#define ast_set_flag(p, flag)
int ast_cel_report_event(struct ast_channel *chan, enum ast_cel_event_type event_type, const char *userdefevname, const char *extra, struct ast_channel *peer2)
Report a channel event.
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
int ast_add_extension2(struct ast_context *con, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar)
Add an extension to an extension context, this time with an ast_context *.
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.
#define AST_PRIVACY_TORTURE
static void end_bridge_callback(void *data)
Persistant data storage (akin to *doze registry)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
globally accessible channel datastores
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
struct ast_party_redirecting redirecting
Redirecting/Diversion information.
#define AST_OPTION_OPRMODE
void * ast_aoc_destroy_decoded(struct ast_aoc_decoded *decoded)
free an ast_aoc_decoded object
Configuration File Parser.
static void hanguptree(struct chanlist *outgoing, struct ast_channel *exception, int answered_elsewhere)
char * str
Subscriber name (Malloced)
int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen)
Indicates condition of channel, with payload.
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_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define ast_set_flag64(p, flag)
static void senddialendevent(struct ast_channel *src, const char *dialstatus)
static void replace_macro_delimiter(char *s)
unsigned short transfercapability
#define ast_str_alloca(init_len)
static int retrydial_exec(struct ast_channel *chan, const char *data)
Structure for a data store object.
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
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.
int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int caller, int frame)
Run a connected line interception macro and update a channel's connected line information.
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
char * str
Malloced subaddress string.
int ast_senddigit(struct ast_channel *chan, char digit, unsigned int duration)
Send a DTMF digit to a channel.
int ast_filedelete(const char *filename, const char *fmt)
Deletes a file.
#define OPT_CANCEL_TIMEOUT
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
Structure used to handle a large number of boolean flags == used only in app_dial?
enum ast_channel_adsicpe adsicpe
int ast_unregister_application(const char *app)
Unregister an application.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
void ast_free_ptr(void *ptr)
#define ast_verb(level,...)
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.
static void handle_cause(int cause, struct cause_args *num)
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
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.
String fields in structures.
#define CAN_EARLY_BRIDGE(flags, chan, peer)
#define ast_manager_event(chan, category, event, contents,...)
int ast_cc_completed(struct ast_channel *chan, const char *const debug,...)
Indicate recall has been acknowledged.
#define DIAL_CALLERID_ABSENT
struct ast_party_id id
Caller party ID.
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
Inherit datastores from a parent to a child.
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'
#define ast_asprintf(a, b, c...)
#define ast_debug(level,...)
Log a DEBUG message.
static int dial_exec(struct ast_channel *chan, const char *data)
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.
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.
static const char * get_cid_name(char *name, int namelen, struct ast_channel *chan)
Generic Advice of Charge encode and decode routines.
struct ast_aoc_decoded * ast_aoc_decode(struct ast_aoc_encoded *encoded, size_t size, struct ast_channel *chan)
decodes an encoded aoc payload.
General Asterisk PBX channel definitions.
static char dialcontext[AST_MAX_CONTEXT]
static int valid_priv_reply(struct ast_flags64 *opts, int res)
Asterisk file paths, configured in asterisk.conf.
struct ast_channel * chan
static force_inline int attribute_pure ast_strlen_zero(const char *s)
struct ast_datastore_info dialed_interface_info
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
#define OPT_FORCE_CID_TAG
#define AST_CAUSE_ANSWERED_ELSEWHERE
enum ast_pbx_result ast_pbx_run_args(struct ast_channel *c, struct ast_pbx_args *args)
Execute the PBX in the current thread.
static int silencethreshold
int ast_parseable_goto(struct ast_channel *chan, const char *goto_string)
#define AST_MAX_EXTENSION
#define AST_CAUSE_NORMAL_CLEARING
void ast_party_number_init(struct ast_party_number *init)
Initialize the given number structure.
void * end_bridge_callback_data
Caller Party information.
static int dial_handle_playtones(struct ast_channel *chan, const char *data)
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
void ast_cdr_setanswer(struct ast_cdr *cdr, struct timeval t)
Set the answer time for a call.
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.
char dst[AST_MAX_EXTENSION]
struct sched_context * sched
#define DIAL_NOFORWARDHTML
int(* timingfunc)(const void *data)
#define AST_CAUSE_NO_ANSWER
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
Core PBX routines and definitions.
int ast_parse_caller_presentation(const char *data)
Convert caller ID text code to value (used in config file parsing)
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
void ast_party_number_free(struct ast_party_number *doomed)
Destroy the party number contents.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
struct ast_party_connected_line connected
struct ast_flags features_caller
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.
struct ast_party_dialed dialed
Dialed/Called information.
int ast_cc_call_init(struct ast_channel *chan, int *ignore_cc)
Start the CC process on a call.
const char * ast_config_AST_DATA_DIR
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
#define AST_PBX_INCOMPLETE
#define ast_strdupa(s)
duplicate a string in memory from the stack
struct ast_party_subaddress subaddress
Subscriber subaddress.
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.
Responsible for call detail data.
#define OPT_CALLER_ANSWER
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
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.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
const ast_string_field call_forward
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.
enum ast_channel_state _state
struct ast_tone_zone_sound * ast_get_indication_tone(const struct ast_tone_zone *zone, const char *indication)
Locate a tone zone sound.
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
Connected Line/Party information.
const ast_string_field name
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 ast_channel * chan
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_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
struct ast_datastore * ast_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
Redirecting Line information. RDNIS (Redirecting Directory Number Information Service) Where a call d...
int ast_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority)
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.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_FEATURE_RETURN_STOREDIGITS
struct ast_dialed_interface::@174 list
int ast_channel_sendurl(struct ast_channel *channel, const char *url)
Sends a URL on a given link Send URL on link.
#define ast_channel_unlock(chan)
int ast_privacy_set(char *dest, char *cid, int status)
const char * ast_cause2str(int state) attribute_pure
Gives the string form of a given cause code.
static void parse(struct mgcp_request *req)
#define AST_CAUSE_UNREGISTERED
#define AST_LIST_HEAD_INIT(head)
Initializes a list head structure.
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
Inherits channel variable from parent to child channel.
int source
Information about the source of an update.
char macrocontext[AST_MAX_CONTEXT]
Call Completion Supplementary Services API.
#define CHANNEL_DEADLOCK_AVOIDANCE(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.
void * ast_aoc_destroy_encoded(struct ast_aoc_encoded *encoded)
free an ast_aoc_encoded object
int ast_call(struct ast_channel *chan, char *addr, int timeout)
Make a call.
#define DATASTORE_INHERIT_FOREVER
void ast_party_id_init(struct ast_party_id *init)
Initialize the given party id structure.
#define ast_set2_flag64(p, value, flag)
#define AST_PRIVACY_UNKNOWN
Structure used to handle boolean flags.
#define ast_clear_flag64(p, flag)
#define ast_clear_flag(p, flag)
struct ast_channel * peer
int ast_spawn_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid, int *found, int combined_find_spawn)
Launch a new extension (i.e. new stack)
int ast_sched_runq(struct sched_context *con)
Runs the queue.
char src[AST_MAX_EXTENSION]
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...
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.
char macroexten[AST_MAX_EXTENSION]
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
#define AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
void ast_ignore_cc(struct ast_channel *chan)
Mark the channel to ignore further CC activity.
char * tag
User-set "tag".
void ast_deactivate_generator(struct ast_channel *chan)
void ast_poll_channel_del(struct ast_channel *chan0, struct ast_channel *chan1)
int transit_network_select
Transit Network Select.
void ast_party_redirecting_free(struct ast_party_redirecting *doomed)
Destroy the redirecting information contents.
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.
#define AST_CAUSE_NO_ROUTE_DESTINATION
int ast_channel_make_compatible(struct ast_channel *c0, struct ast_channel *c1)
Makes two channel formats compatible.
static void chanlist_free(struct chanlist *outgoing)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
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.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
ast_app: A registered application
void ast_cdr_noanswer(struct ast_cdr *cdr)
A call wasn't answered.
void ast_party_redirecting_init(struct ast_party_redirecting *init)
Initialize the given redirecting structure.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
static void senddialevent(struct ast_channel *src, struct ast_channel *dst, const char *dialstring)
int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
Checks for the existence of a given file.
int ast_sched_wait(struct sched_context *con) attribute_warn_unused_result
Determines number of seconds until the next outstanding event to take place Determine the number of s...
static int load_module(void)
int ast_answer(struct ast_channel *chan)
Answer a channel.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
const ast_string_field musicclass
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.
const ast_string_field accountcode
static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast_flags64 *peerflags, int *continue_exec)
int ast_context_remove_extension2(struct ast_context *con, const char *extension, int priority, const char *registrar, int already_locked)
This functionc locks given context, search for the right extension and fires out all peer in this ext...
Data structure associated with a single frame of data.
Internal Asterisk hangup causes.
#define ast_manager_event_multichan(category, event, nchans, chans, contents,...)
void ast_context_destroy(struct ast_context *con, const char *registrar)
Destroy a context (matches the specified context (or ANY context if NULL)
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 timeval whentohangup
const char * data
Description of a tone.
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
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 AST_APP_ARG(name)
Define an application argument.
enum ast_frame_type frametype
const char * warning_sound
static void end_bridge_callback_data_fixup(struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator)
#define ast_channel_trylock(chan)
unsigned char valid
TRUE if the name information is valid/present.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
static char context[AST_MAX_CONTEXT]
Call Parking and Pickup API Includes code and algorithms from the Zapata library. ...
int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between, unsigned int duration)
Send DTMF to a channel.
struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
Register a new context or find an existing one.
void(* end_bridge_callback)(void *)
struct ast_filestream * stream
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s, .'s, and -'s...
struct ast_aoc_decoded * aoc_s_rate_list
Say numbers and dates (maybe words one day too)
#define ASTERISK_GPL_KEY
The text the key() function should return.
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.
Pluggable RTP Architecture.
int ast_dsp_get_threshold_from_settings(enum threshold which)
Get silence threshold from dsp.conf.
Asterisk module definitions.
unsigned int no_hangup_chan
struct ast_channel * ast_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *status)
Requests a channel.
union ast_frame::@172 data
struct ast_channel_tech * tech
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
ast_context: An extension context
void ast_cdr_setdestchan(struct ast_cdr *cdr, const char *chan)
Set the destination channel, if there was one.
unsigned char valid
TRUE if the number information is valid/present.
this call was forwarded somewhere else
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
static struct ast_app_option dial_exec_options[128]
const ast_string_field language
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.
#define AST_CAUSE_CONGESTION
struct ast_context * ast_context_find(const char *name)
Find a context.
char exten[AST_MAX_EXTENSION]
int ast_stopstream(struct ast_channel *c)
Stops a stream.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
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.
int ast_feature_detect(struct ast_channel *chan, struct ast_flags *features, const char *code, struct ast_call_feature *feature)
detect a feature before bridging
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
int ast_channel_redirecting_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *redirecting_info, int is_caller, int is_frame)
Run a redirecting interception macro and update a channel's redirecting information.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
int ast_mkdir(const char *path, int mode)
Recursively create directory path.
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)
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, and timelimit
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
void ast_cdr_busy(struct ast_cdr *cdr)
Busy a call.
struct ast_party_number number
Subscriber phone number.
#define ast_test_flag64(p, flag)