38 #include <netinet/in.h> 663 static const char app[] =
"Dial";
664 static const char rapp[] =
"RetryDial";
701 #define DIAL_STILLGOING (1LLU << 31) 702 #define DIAL_NOFORWARDHTML (1LLU << 32) 703 #define DIAL_CALLERID_ABSENT (1LLU << 33) 704 #define OPT_CANCEL_ELSEWHERE (1LLU << 34) 705 #define OPT_PEER_H (1LLU << 35) 706 #define OPT_CALLEE_GO_ON (1LLU << 36) 707 #define OPT_CANCEL_TIMEOUT (1LLU << 37) 708 #define OPT_FORCE_CID_TAG (1LLU << 38) 709 #define OPT_FORCE_CID_PRES (1LLU << 39) 710 #define OPT_CALLER_ANSWER (1LLU << 40) 711 #define OPT_PREDIAL_CALLEE (1LLU << 41) 712 #define OPT_PREDIAL_CALLER (1LLU << 42) 713 #define OPT_RING_WITH_EARLY_MEDIA (1LLU << 43) 714 #define OPT_HANGUPCAUSE (1LLU << 44) 786 #define CAN_EARLY_BRIDGE(flags,chan,peer) (!ast_test_flag64(flags, OPT_CALLEE_HANGUP | \ 787 OPT_CALLER_HANGUP | OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER | \ 788 OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR | OPT_CALLEE_PARK | \ 789 OPT_CALLER_PARK | OPT_ANNOUNCE | OPT_CALLEE_MACRO | OPT_CALLEE_GOSUB) && \ 790 !ast_channel_audiohooks(chan) && !ast_channel_audiohooks(peer) && \ 791 ast_framehook_list_is_empty(ast_channel_framehooks(chan)) && ast_framehook_list_is_empty(ast_channel_framehooks(peer))) 836 if (outgoing->
chan && (outgoing->
chan != exception)) {
837 if (hangupcause >= 0) {
847 #define AST_MAX_WATCHERS 256 883 char rexten[2] = {
exten,
'\0' };
931 struct ast_flags64 *peerflags,
int single,
int caller_entertained,
int *to,
946 if ((stuff = strchr(tmpchan,
'/'))) {
950 const char *forward_context;
954 forward_context =
NULL;
961 if (!strcasecmp(tech,
"Local")) {
992 if (single && !caller_entertained) {
1007 ast_verb(3,
"Not accepting call completion offers from call-forward recipient %s\n",
1011 "Forwarding failed to create channel to dial '%s/%s' (cause = %d)\n",
1012 tech, stuff, cause);
1050 caller.
id = *stored_clid;
1059 caller.
id = *stored_clid;
1071 connected.
id = *forced_clid;
1131 if (single && !caller_entertained) {
1142 char privintro[1024];
1150 if (!outgoing->
chan || outgoing->
chan == exception) {
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,
const int ignore_cc,
1218 int caller_entertained = outgoing
1221 int cc_recall_core_id;
1223 int cc_frame_received = 0;
1224 int num_ringing = 0;
1226 int sent_progress = 0;
1232 if (!caller_entertained) {
1242 strcpy(pa->
status,
"CONGESTION");
1260 int numlines = prestart;
1264 watchers[pos++] =
in;
1268 watchers[pos++] = o->
chan;
1271 if (o && !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");
1322 size_t encoded_size;
1338 ast_channel_dialcontext_set(c,
"");
1350 if (!ignore_cc && (f =
ast_read(c))) {
1373 do_forward(o, &num, peerflags, single, caller_entertained, &orig,
1374 forced_clid, stored_clid);
1427 size_t encoded_size;
1442 ast_trace(-1,
"%s Found topology in frame: %p %p %s\n",
1459 ast_channel_dialcontext_set(c,
"");
1515 if (ignore_cc || cc_frame_received || num_ringing == numlines) {
1518 if (single && !caller_entertained
1527 struct timeval now, then;
1549 if (single && !caller_entertained
1558 if (!sent_progress) {
1559 struct timeval now, then;
1577 "Sending MF '%s' to the called party as result of " 1578 "receiving a PROGRESS message.\n",
1584 "Sending DTMF '%s' to the called party as result of " 1585 "receiving a PROGRESS message.\n",
1595 if (!single || caller_entertained) {
1598 ast_verb(3,
"%s requested media update control %d, passing it to %s\n",
1610 ast_verb(3,
"%s connected line has changed. Saving it until answer for %s\n",
1647 ast_verb(3,
"%s redirecting info has changed, passing it to %s\n",
1657 if (single && !caller_entertained
1682 cc_frame_received = 1;
1689 if (single && !caller_entertained) {
1703 if (caller_entertained) {
1730 printf(
"Hangup received on %s\n", in->
name);
1735 strcpy(pa->
status,
"CANCEL");
1744 ast_cc_completed(in,
"CC completed, although the caller hung up (cancelled)");
1760 strcpy(pa->
status,
"CANCEL");
1775 ast_verb(3,
"User requested call disconnect.\n");
1777 strcpy(pa->
status,
"CANCEL");
1809 if (!single || caller_entertained) {
1839 if (!single || caller_entertained) {
1847 ast_verb(3,
"%s requested media update control %d, passing it to %s\n",
1887 ast_verb(3,
"Nobody picked up in %d ms\n", orig);
1957 ast_channel_musicclass_set(chan, opt_args[OPT_ARG_MUSICBACK]);
1959 ast_channel_musicclass_set(chan, original_moh);
1968 for (loopcount = 0; loopcount < 3; loopcount++) {
1969 if (res2 && loopcount == 0)
2022 static const char *
const _val[] = {
"ALLOW",
"DENY",
"TORTURE",
"KILL",
"ALLOW" };
2025 ast_verb(3,
"--Set privacy database entry %s/%s to %s\n",
2052 ast_verb(3,
"privacy: no valid response from the callee. Sending the caller to voicemail, the callee isn't responding\n");
2090 ast_verb(3,
"Privacy Screening, clid is '%s'\n", l);
2098 for (tn2 = tnam; *tn2; tn2++) {
2102 ast_verb(3,
"Privacy-- callerid is empty\n");
2104 snprintf(callerid,
sizeof(callerid),
"NOCALLERID_%s%s",
ast_channel_exten(chan), tnam);
2113 ast_verb(3,
"CallerID set (%s); N option set; Screening should be off\n", pa->
privcid);
2116 ast_verb(3,
"CallerID blank; N option set; Screening should happen; dbval is %d\n", pa->
privdb_val);
2120 ast_verb(3,
"Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
2137 ast_log(
LOG_WARNING,
"privacy: can't create directory priv-callerintros: %s\n", strerror(res));
2203 if (ts && ts->
data[0]) {
2267 struct timeval calldurationlimit = { 0, };
2268 char *dtmfcalled =
NULL, *dtmfcalling =
NULL, *dtmf_progress=
NULL;
2269 char *mfcalled =
NULL, *mfcalling =
NULL, *mf_progress=
NULL;
2273 .status =
"INVALIDARGS",
2276 const char *outbound_group =
NULL;
2280 int delprivintro = 0;
2289 int fulldial = 0, num_dialed = 0;
2294 int force_forwards_only;
2336 if (max_forwards <= 0) {
2337 ast_log(
LOG_WARNING,
"Cannot place outbound call from channel '%s'. Max forwards exceeded\n",
2356 ast_verb(3,
"Caller hung up before dial.\n");
2376 delprivintro = atoi(opt_args[OPT_ARG_SCREEN_NOINTRO]);
2378 if (delprivintro < 0 || delprivintro > 1) {
2379 ast_log(
LOG_WARNING,
"Unknown argument %d specified to n option, ignoring\n", delprivintro);
2390 ast_verb(3,
"Setting operator services mode to %d.\n", opermode);
2394 calldurationlimit.tv_sec = atoi(opt_args[OPT_ARG_DURATION_STOP]);
2395 if (!calldurationlimit.tv_sec) {
2396 ast_log(
LOG_WARNING,
"Dial does not accept S(%s)\n", opt_args[OPT_ARG_DURATION_STOP]);
2400 ast_verb(3,
"Setting call duration limit to %.3lf seconds.\n", calldurationlimit.tv_sec + calldurationlimit.tv_usec / 1000000.0);
2405 dtmfcalling =
strsep(&mf_progress,
":");
2406 dtmfcalled =
strsep(&mf_progress,
":");
2407 dtmf_progress =
strsep(&mf_progress,
":");
2408 mfcalling =
strsep(&mf_progress,
":");
2409 mfcalled =
strsep(&mf_progress,
":");
2419 force_forwards_only = 0;
2425 forced_clid_name[0] =
'\0';
2427 sizeof(forced_clid_name),
chan);
2428 force_forwards_only = 1;
2491 stored_clid_name[0] =
'\0';
2493 sizeof(stored_clid_name),
chan);
2546 while ((cur =
strsep(&rest,
"&"))) {
2562 tech =
strsep(&number,
"/");
2570 tech_len = strlen(tech) + 1;
2571 number_len = strlen(number) + 1;
2572 tmp =
ast_calloc(1,
sizeof(*tmp) + (2 * tech_len) + number_len);
2583 cur[tech_len - 1] =
'/';
2586 strcpy(cur, number);
2669 caller.
id = stored_clid;
2678 caller.
id = stored_clid;
2711 connected.
id = forced_clid;
2763 ast_verb(3,
"No devices or endpoints to dial (technology/resource)\n");
2764 if (continue_exec) {
2768 strcpy(pa.
status,
"CHANUNAVAIL");
2788 const char *predial_callee;
2792 if (predial_callee) {
2810 ast_debug(1,
"ast call on peer returned %d\n", res);
2840 to = atoi(
args.timeout);
2851 strcpy(pa.
status,
"CHANUNAVAIL");
2852 if (fulldial == num_dialed) {
2858 strcpy(pa.
status,
"NOANSWER");
2863 ast_channel_musicclass_set(chan, opt_args[OPT_ARG_MUSICBACK]);
2865 ast_channel_musicclass_set(chan, original_moh);
2885 peer =
wait_for_answer(chan, &out_chans, &to, peerflags, opt_args, &pa, &num, &result,
2886 dtmf_progress, mf_progress, ignore_cc, &forced_clid, &stored_clid, &config);
2899 int dial_end_raised = 0;
2914 if (!strcasecmp(opt_args[OPT_ARG_HANGUPCAUSE],
"NONE")) {
2916 }
else if (sscanf(opt_args[OPT_ARG_HANGUPCAUSE],
"%30d", &cause) != 1
2919 opt_args[OPT_ARG_HANGUPCAUSE]);
2942 strcpy(pa.
status,
"ANSWER");
2956 if (do_privacy(chan, peer, &opts, opt_args, &pa)) {
2970 char *calledfile =
NULL, *callerfile =
NULL;
2971 int calledstream = 0, callerstream = 0;
2978 calledfile =
strsep(&callerfile,
":");
3023 if (!calledstream && !callerstream) {
3034 active_chan =
ast_waitfor_n(chans, 2, (mspeer > mschan ? &mschan : &mspeer));
3061 if (active_chan == chan) {
3068 other_chan, fr, other_chan == chan, 1)) {
3116 const char *macro_result_peer;
3131 char *macro_result =
ast_strdupa(macro_result_peer);
3132 char *macro_transfer_dest;
3136 if (!strcasecmp(macro_result,
"BUSY")) {
3140 }
else if (!strcasecmp(macro_result,
"CONGESTION") || !strcasecmp(macro_result,
"CHANUNAVAIL")) {
3144 }
else if (!strcasecmp(macro_result,
"CONTINUE")) {
3151 }
else if (!strcasecmp(macro_result,
"ABORT")) {
3154 }
else if (!strncasecmp(macro_result,
"GOTO:", 5)) {
3155 macro_transfer_dest = macro_result + 5;
3158 if (strchr(macro_transfer_dest,
'^')) {
3165 if (macro_res && !dial_end_raised) {
3167 dial_end_raised = 1;
3176 const char *gosub_result_peer;
3177 char *gosub_argstart;
3178 char *gosub_args =
NULL;
3182 gosub_argstart = strchr(opt_args[OPT_ARG_CALLEE_GOSUB],
',');
3183 if (gosub_argstart) {
3184 const char *what_is_s =
"s";
3185 *gosub_argstart = 0;
3188 what_is_s =
"~~s~~";
3190 if (
ast_asprintf(&gosub_args,
"%s,%s,1(%s)", opt_args[OPT_ARG_CALLEE_GOSUB], what_is_s, gosub_argstart + 1) < 0) {
3193 *gosub_argstart =
',';
3195 const char *what_is_s =
"s";
3198 what_is_s =
"~~s~~";
3200 if (
ast_asprintf(&gosub_args,
"%s,%s,1", opt_args[OPT_ARG_CALLEE_GOSUB], what_is_s) < 0) {
3208 ast_log(
LOG_ERROR,
"Could not Allocate string for Gosub arguments -- Gosub Call Aborted!\n");
3214 char *gosub_transfer_dest;
3215 char *gosub_result =
ast_strdupa(gosub_result_peer);
3226 if (!strcasecmp(gosub_result,
"BUSY")) {
3230 }
else if (!strcasecmp(gosub_result,
"CONGESTION") || !strcasecmp(gosub_result,
"CHANUNAVAIL")) {
3234 }
else if (!strcasecmp(gosub_result,
"CONTINUE")) {
3238 }
else if (!strcasecmp(gosub_result,
"ABORT")) {
3241 }
else if (!strncasecmp(gosub_result,
"GOTO:", 5)) {
3242 gosub_transfer_dest = gosub_result + 5;
3245 if (strchr(gosub_transfer_dest,
'^')) {
3254 if (!dial_end_raised) {
3256 dial_end_raised = 1;
3270 if (!dial_end_raised) {
3272 dial_end_raised = 1;
3282 ast_verb(3,
"Sending MF '%s' to the called party.\n", mfcalled);
3283 res =
ast_mf_stream(peer, chan, mfcalled, 50, 55, 120, 65, 0);
3286 ast_verb(3,
"Sending MF '%s' to the calling party.\n", mfcalling);
3287 res =
ast_mf_stream(chan, peer, mfcalling, 50, 55, 120, 65, 0);
3290 ast_verb(3,
"Sending DTMF '%s' to the called party.\n", dtmfcalled);
3294 ast_verb(3,
"Sending DTMF '%s' to the calling party.\n", dtmfcalling);
3338 }
else if (sentringing) {
3357 oprmode.
mode = opermode;
3370 }
else if (sentringing) {
3401 ast_trace(2,
"%s Cleaning up topology: %p %s\n",
3429 memset(&peerflags, 0,
sizeof(peerflags));
3438 int sleepms = 0, loops = 0, res = -1;
3459 loops = atoi(
args.retries);
3462 if (!
args.dialdata) {
3499 if (!res && sleepms) {
3523 }
else if (res > 0) {
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
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.
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...
#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.
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
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.
int ast_max_forwards_get(struct ast_channel *chan)
Get the current max forwards for a particular channel.
char * str
Subscriber phone number (Malloced)
int64_t ast_channel_get_duration_ms(struct ast_channel *chan)
Obtain how long it's been, in milliseconds, since the channel was created.
#define OPT_RING_WITH_EARLY_MEDIA
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
#define AST_PRIVACY_ALLOW
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int is_caller, int frame)
Run a connected line interception macro and update a channel's connected line information.
void ast_channel_visible_indication_set(struct ast_channel *chan, int value)
#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...
void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
static int onedigit_goto(struct ast_channel *chan, const char *context, char exten, int pri)
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
int ast_cc_failed(int core_id, const char *const debug,...)
Indicate failure has occurred.
unsigned int pending_connected_update
#define OPT_CANCEL_ELSEWHERE
struct ast_stream_topology * ast_channel_get_stream_topology(const struct ast_channel *chan)
Retrieve the topology of streams on a channel.
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_sched_runq(struct ast_sched_context *con)
Runs the queue.
struct ast_stream_topology * answer_topology
struct ast_party_id id
Connected party ID.
const char * ast_app_expand_sub_args(struct ast_channel *chan, const char *args)
Add missing context/exten to subroutine argument string.
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)
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)
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...
static int unload_module(void)
void ast_channel_appl_set(struct ast_channel *chan, const char *value)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
#define OPT_PREDIAL_CALLEE
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.
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.
Convenient Signal Processing routines.
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)
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
int ast_check_hangup_locked(struct ast_channel *chan)
#define AST_OPTION_OPRMODE
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
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)
int ast_call(struct ast_channel *chan, const char *addr, int timeout)
Make a call.
struct ast_tone_zone * ast_channel_zone(const struct ast_channel *chan)
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
void ast_channel_clear_flag(struct ast_channel *chan, unsigned int flag)
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
void * ast_aoc_destroy_decoded(struct ast_aoc_decoded *decoded)
free an ast_aoc_decoded object
#define ast_trace(level,...)
Print a basic trace message.
ast_channel_state
ast_channel states
struct chanlist::@18 node
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.
const char * ast_hangup_cause_to_dial_status(int hangup_cause)
Convert a hangup cause to a publishable dial status.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define ast_set_flag64(p, flag)
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
#define ast_str_alloca(init_len)
static int retrydial_exec(struct ast_channel *chan, const char *data)
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
#define ast_strdup(str)
A wrapper for strdup()
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
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?
int ast_unregister_application(const char *app)
Unregister an application.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
const char * ast_channel_call_forward(const struct ast_channel *chan)
int ast_channel_priority(const struct ast_channel *chan)
#define ast_verb(level,...)
void ast_bridge_set_after_h(struct ast_channel *chan, const char *context)
Set channel to run the h exten after the bridge.
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)
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
struct ast_frame_subclass subclass
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.
#define CAN_EARLY_BRIDGE(flags, chan, peer)
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
#define ast_strlen_zero(foo)
struct timeval * ast_channel_whentohangup(struct ast_channel *chan)
int ast_cc_completed(struct ast_channel *chan, const char *const debug,...)
Indicate recall has been acknowledged.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
#define DIAL_CALLERID_ABSENT
struct ast_party_id id
Caller party ID.
Configuration File Parser.
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_str_tmp(init_len, __expr)
#define ast_debug(level,...)
Log a DEBUG message.
void ast_replace_subargument_delimiter(char *s)
Replace '^' in a string with ','.
static int dial_exec(struct ast_channel *chan, const char *data)
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.
int ast_channel_make_compatible(struct ast_channel *chan, struct ast_channel *peer)
Make the frame formats of two channels compatible.
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_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 int valid_priv_reply(struct ast_flags64 *opts, int res)
Asterisk file paths, configured in asterisk.conf.
struct ast_channel * chan
#define OPT_PREDIAL_CALLER
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
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
static struct ast_channel * wait_for_answer(struct ast_channel *in, struct dial_head *out_chans, int *to, 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, const int ignore_cc, struct ast_party_id *forced_clid, struct ast_party_id *stored_clid, struct ast_bridge_config *config)
static int silencethreshold
int ast_parseable_goto(struct ast_channel *chan, const char *goto_string)
#define AST_MAX_EXTENSION
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
#define AST_CAUSE_NORMAL_CLEARING
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_party_number_init(struct ast_party_number *init)
Initialize the given number structure.
void * end_bridge_callback_data
Caller Party information.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
structure to hold extensions
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.
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(* end_bridge_callback_data_fixup)(struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator)
int ast_cdr_reset(const char *channel_name, int keep_variables)
Reset the detail record.
#define ast_strdupa(s)
duplicate a string in memory from the stack
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.
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)
#define DIAL_NOFORWARDHTML
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_CAUSE_NO_ANSWER
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
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 ast_app_exec_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const char *macro_args)
Run a macro on a channel, placing an optional second channel into autoservice.
int ast_pre_call(struct ast_channel *chan, const char *sub_args)
Execute a Gosub call on the channel before a call is placed.
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().
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
const char * ast_channel_exten(const struct ast_channel *chan)
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_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.
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.
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
struct ast_party_subaddress subaddress
Subscriber subaddress.
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
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.
#define OPT_CALLER_ANSWER
struct ast_sched_context * ast_channel_sched(const struct ast_channel *chan)
#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 ...
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
void ast_channel_set_flag(struct ast_channel *chan, unsigned int flag)
Set a flag on a channel.
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
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...
Channel datastore data for max forwards.
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_mf_stream(struct ast_channel *chan, struct ast_channel *peer, 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.
struct ast_tone_zone_sound * ast_get_indication_tone(const struct ast_tone_zone *zone, const char *indication)
Locate a tone zone sound.
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 timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
Connected Line/Party information.
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...
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_party_dialed * ast_channel_dialed(struct ast_channel *chan)
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.
static void setup_peer_after_bridge_goto(struct ast_channel *chan, struct ast_channel *peer, struct ast_flags64 *opts, char *opt_args[])
struct timeval ast_channel_creationtime(struct ast_channel *chan)
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)
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...
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_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
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
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.
#define ast_calloc(num, len)
A wrapper for calloc()
Call Completion Supplementary Services API.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
struct ast_filestream * ast_channel_stream(const struct ast_channel *chan)
#define SCOPE_ENTER(level,...)
Non RAII_VAR Scope Trace macros The advantage of these macros is that the EXITs will have the actual ...
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
static const struct ast_app_option dial_exec_options[128]
static void set_duration_var(struct ast_channel *chan, const char *var_base, int64_t duration)
void ast_autoservice_chan_hangup_peer(struct ast_channel *chan, struct ast_channel *peer)
Put chan into autoservice while hanging up peer.
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
#define AST_LIST_HEAD_NOLOCK_INIT_VALUE
Defines initial values for a declaration of AST_LIST_HEAD_NOLOCK.
#define ast_clear_flag64(p, flag)
#define ast_clear_flag(p, flag)
struct ast_channel * peer
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
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...
struct ast_stream_topology * ast_stream_topology_clone(const struct ast_stream_topology *topology)
Create a deep clone of an existing stream topology.
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.
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
void(* end_bridge_callback)(void *)
#define AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
#define SCOPE_EXIT_RTN_VALUE(__return_value,...)
Scope Exit with return value.
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)
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
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.
char * strsep(char **str, const char *delims)
#define AST_CAUSE_NO_ROUTE_DESTINATION
int ast_max_forwards_decrement(struct ast_channel *chan)
Decrement the max forwards count for a particular channel.
After Bridge Execution API.
int ast_channel_hangupcause(const struct ast_channel *chan)
void ast_channel_context_set(struct ast_channel *chan, const char *value)
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...
const char * ast_channel_name(const struct ast_channel *chan)
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.
int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
Checks for the existence of a given file.
void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
static int load_module(void)
int ast_answer(struct ast_channel *chan)
Answer a channel.
static void publish_dial_end_event(struct ast_channel *in, struct dial_head *out_chans, struct ast_channel *exception, const char *status)
#define AST_FEATURE_MAX_LEN
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.
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.
static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast_flags64 *peerflags, int *continue_exec)
Data structure associated with a single frame of data.
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.
Internal Asterisk hangup causes.
const char * ast_channel_language(const struct ast_channel *chan)
int ast_playtones_start(struct ast_channel *chan, int vol, const char *tonelist, int interruptible)
Start playing a list of tones on a channel.
const char * ast_channel_context(const struct ast_channel *chan)
void ast_bridge_set_after_go_on(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *parseable_goto)
Set channel to go on in the dialplan after the bridge.
const char * data
Description of a tone.
void ast_channel_publish_snapshot(struct ast_channel *chan)
Publish a ast_channel_snapshot for a channel.
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)
union ast_frame::@263 data
static void update_connected_line_from_peer(struct ast_channel *chan, struct ast_channel *peer, int is_caller)
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
enum ast_frame_type frametype
int ast_str2cause(const char *name) attribute_pure
Convert the string form of a cause code to a number.
const char * warning_sound
static void end_bridge_callback_data_fixup(struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator)
unsigned char valid
TRUE if the name information is valid/present.
static char context[AST_MAX_CONTEXT]
Call Parking and Pickup API Includes code and algorithms from the Zapata library. ...
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
const char * ast_channel_macrocontext(const struct ast_channel *chan)
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_channel_priority_set(struct ast_channel *chan, int value)
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.
static void hanguptree(struct dial_head *out_chans, struct ast_channel *exception, int hangupcause)
int ast_dsp_get_threshold_from_settings(enum threshold which)
Get silence threshold from dsp.conf.
struct ast_stream_topology * topology
Asterisk module definitions.
ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
unsigned char valid
TRUE if the number information is valid/present.
int ast_bridge_setup_after_goto(struct ast_channel *chan)
Setup any after bridge goto location to begin execution.
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
const char * ast_channel_macroexten(const struct ast_channel *chan)
void ast_channel_data_set(struct ast_channel *chan, const char *value)
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...
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.
const char * ast_channel_musicclass(const struct ast_channel *chan)
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_ARG(name)
Define an application 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
struct ast_party_number number
Subscriber phone number.
#define ast_test_flag64(p, flag)