38 #ifdef HAVE_SYS_STAT_H 45 #include <sys/types.h> 47 #ifndef HAVE_CLOSEFROM 51 #include <sys/capability.h> 101 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,
NULL);
104 if (waitpid(cur->
pid, &status, WNOHANG) != 0) {
111 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,
NULL);
113 pthread_testcancel();
121 #define AST_MAX_FORMATS 10 163 for (x = strlen(collect); x < maxlen; ) {
199 int res = 0, to, fto;
200 char *front, *filename;
211 while ((front =
strsep(&filename,
"&"))) {
226 fto = to = 1000000000;
252 int res, to = 2000, fto = 6000;
265 fto = to = 1000000000;
281 "Cannot run 'Macro(%s)'. The application is not available.\n", macro_args);
284 if (autoservice_chan) {
292 res =
pbx_exec(macro_chan, macro_app, macro_args);
293 ast_debug(4,
"Macro exited with status %d\n", res);
309 if (autoservice_chan) {
331 args_len = strlen(macro_name) + strlen(macro_args) + 2;
336 snprintf(args_str, args_len,
"%s,%s", macro_name, macro_args);
348 app_stack_callbacks = funcs;
354 const char *new_args;
359 "Cannot expand 'Gosub(%s)' arguments. The app_stack module is not available.\n",
378 "Cannot run 'Gosub(%s)'. The app_stack module is not available.\n",
383 if (autoservice_chan) {
387 res = funcs->
run_sub(sub_chan, sub_args, ignore_hangup);
390 if (autoservice_chan) {
408 return ast_app_exec_sub(autoservice_chan, sub_chan, sub_location, ignore_hangup);
412 args_len = strlen(sub_location) + strlen(sub_args) + 3;
417 snprintf(args_str, args_len,
"%s(%s)", sub_location, sub_args);
419 res =
ast_app_exec_sub(autoservice_chan, sub_chan, args_str, ignore_hangup);
436 is_registered = table ? 1 : 0;
438 return is_registered;
478 if (table && !strcmp(table->
module_name, module_name)) {
484 #ifdef TEST_FRAMEWORK 495 ast_log(
LOG_ERROR,
"Attempted to swap in test function table without swapping out old test table.\n");
520 ast_log(
LOG_ERROR,
"Attempted to swap out test function table, but none is currently installed.\n");
547 is_registered = table ? 1 : 0;
549 return is_registered;
557 ast_log(
LOG_ERROR,
"Voicemail greeter provider missing required information.\n");
561 ast_log(
LOG_ERROR,
"Voicemail greeter provider '%s' has incorrect version\n",
589 if (table && !strcmp(table->
module_name, module_name)) {
595 #ifdef TEST_FRAMEWORK 616 ast_verb(3,
"No voicemail provider registered.\n");
620 #define VM_API_CALL(res, api_call, api_parms) \ 622 struct ast_vm_functions *table; \ 623 table = ao2_global_obj_ref(vm_provider); \ 625 vm_warn_no_provider(); \ 626 } else if (table->api_call) { \ 627 ast_module_ref(table->module); \ 628 (res) = table->api_call api_parms; \ 629 ast_module_unref(table->module); \ 631 ao2_cleanup(table); \ 637 ast_verb(3,
"No voicemail greeter provider registered.\n");
641 #define VM_GREETER_API_CALL(res, api_call, api_parms) \ 643 struct ast_vm_greeter_functions *table; \ 644 table = ao2_global_obj_ref(vm_greeter_provider); \ 646 vm_greeter_warn_no_provider(); \ 647 } else if (table->api_call) { \ 648 ast_module_ref(table->module); \ 649 (res) = table->api_call api_parms; \ 650 ast_module_unref(table->module); \ 652 ao2_cleanup(table); \ 673 VM_API_CALL(res, copy_recording_to_vm, (vm_rec_data));
728 const char *res =
NULL;
739 int combine_INBOX_and_OLD)
743 VM_API_CALL(res, mailbox_snapshot_create, (mailbox, context, folder, descending,
744 sort_val, combine_INBOX_and_OLD));
752 VM_API_CALL(res, mailbox_snapshot_destroy, (mailbox_snapshot));
759 const char *oldfolder,
760 const char *old_msg_ids[],
761 const char *newfolder)
765 VM_API_CALL(res, msg_move, (mailbox, context, num_msgs, oldfolder, old_msg_ids,
778 VM_API_CALL(res, msg_remove, (mailbox, context, num_msgs, folder, msgs));
783 const char *from_context,
784 const char *from_folder,
785 const char *to_mailbox,
786 const char *to_context,
787 const char *to_folder,
789 const char *msg_ids[],
794 VM_API_CALL(res, msg_forward, (from_mailbox, from_context, from_folder, to_mailbox,
795 to_context, to_folder, num_msgs, msg_ids, delete_old));
808 VM_API_CALL(res, msg_play, (chan, mailbox, context, folder, msg_num, cb));
812 #ifdef TEST_FRAMEWORK 837 unsigned int durationkp,
unsigned int durationst,
int is_external)
858 res = my_sleep(chan, 100);
860 goto mf_stream_cleanup;
863 for (ptr = digits; *ptr; ptr++) {
864 if (strchr(
"0123456789*#ABCwWfF", *ptr)) {
865 if (*ptr ==
'f' || *ptr ==
'F') {
868 }
else if (*ptr ==
'w' || *ptr ==
'W') {
873 ast_senddigit_mf(chan, *ptr, duration, durationkp, durationst, is_external);
881 res = my_sleep(chan, between);
887 ast_log(
LOG_WARNING,
"Illegal MF character '%c' in string. (0-9*#ABCwWfF allowed)\n", *ptr);
899 static int dtmf_stream(
struct ast_channel *chan,
const char *digits,
int between,
unsigned int duration,
int is_external)
905 int (*my_senddigit)(
struct ast_channel *chan,
char digit,
unsigned int duration);
923 res = my_sleep(chan, 100);
925 goto dtmf_stream_cleanup;
928 for (ptr = digits; *ptr; ptr++) {
931 res = my_sleep(chan, 500);
935 }
else if (*ptr ==
'W') {
937 res = my_sleep(chan, 1000);
941 }
else if (strchr(
"0123456789*#abcdfABCDF", *ptr)) {
942 if (*ptr ==
'f' || *ptr ==
'F') {
947 my_senddigit(chan, *ptr, duration);
950 res = my_sleep(chan, between);
955 ast_log(
LOG_WARNING,
"Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n", *ptr);
968 unsigned int durationkp,
unsigned int durationst,
int is_external)
974 res =
mf_stream(chan, digits, between, duration, durationkp, durationst, is_external);
988 res =
dtmf_stream(chan, digits, between, duration, 0);
1102 if (filename[0] ==
'/') {
1108 fd = open(tmpf, O_RDONLY);
1137 const char *restart,
1143 char *breaks =
NULL;
1147 long pause_restart_point = 0;
1155 offset = *offsetms * 8;
1162 blen += strlen(stop);
1165 blen += strlen(suspend);
1168 blen += strlen(restart);
1175 strcat(breaks, stop);
1178 strcat(breaks, suspend);
1181 strcat(breaks, restart);
1185 if ((end = strchr(file,
':'))) {
1186 if (!strcasecmp(end,
":end")) {
1198 if (pause_restart_point) {
1200 pause_restart_point = 0;
1202 else if (end || offset < 0) {
1206 ast_verb(3,
"ControlPlayback seek to offset %ld from end\n", offset);
1211 }
else if (offset) {
1212 ast_verb(3,
"ControlPlayback seek to offset %ld\n", offset);
1229 ast_debug(1,
"we'll restart the stream here at next loop\n");
1230 pause_restart_point = 0;
1252 }
else if (res == -1 || (suspend && strchr(suspend, res)) || (stop && strchr(stop, res))
1286 if (pause_restart_point) {
1287 offset = pause_restart_point;
1297 *offsetms = offset / 8;
1311 const char *restart,
1316 return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms,
NULL, cb);
1320 const char *fwd,
const char *rev,
1322 const char *restart,
int skipms,
long *offsetms)
1324 return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms,
NULL,
NULL);
1328 const char *fwd,
const char *rev,
const char *
stop,
const char *
suspend,
1329 const char *restart,
int skipms,
const char *lang,
long *offsetms)
1331 return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms, lang,
NULL);
1364 ast_log(
LOG_NOTICE,
"Media control operation 'reverse' not supported for media type 'tone'\n");
1367 ast_log(
LOG_NOTICE,
"Media control operation 'forward' not supported for media type 'tone'\n");
1379 const char **tone_indication,
1380 const char **tone_zone)
1382 *tone_indication =
strsep(&tone_parser,
";");
1389 if (!(strncmp(tone_parser,
"tonezone=", 9))) {
1390 *tone_zone = tone_parser + 9;
1406 const char *tone_indication =
NULL;
1407 const char *tone_zone =
NULL;
1408 char *tone_uri_parser;
1416 if (
parse_tone_uri(tone_uri_parser, &tone_indication, &tone_zone)) {
1515 ast_verb(4,
"Silencing %zu samples\n", samples);
1518 datalen =
sizeof(short) * samples;
1519 size =
sizeof(*silence) +
datalen;
1527 silence->
data.
ptr = (
void *)(silence + 1);
1548 if (!chan || !orig_format) {
1580 static int __ast_play_and_record(
struct ast_channel *chan,
const char *playfile,
const char *recordfile,
int maxtime,
const char *fmt,
int *duration,
int *sound_duration,
int beep,
int silencethreshold,
int maxsilence,
const char *path,
int prepend,
const char *acceptdtmf,
const char *canceldtmf,
int skip_confirmation_sound,
enum ast_record_if_exists if_exists)
1585 int x, fmtcnt = 1, res = -1, outmsg = 0;
1588 char *stringp =
NULL;
1593 int olddspsilence = 0;
1599 ioflags = O_CREAT|O_WRONLY;
1601 switch (if_exists) {
1609 ioflags |= O_APPEND;
1616 if (silencethreshold < 0) {
1620 if (maxsilence < 0) {
1630 ast_debug(1,
"play_and_record: %s, %s, '%s'\n", playfile ? playfile :
"<None>", recordfile, fmt);
1631 snprintf(comment,
sizeof(comment),
"Playing %s, Recording to: %s on %s\n", playfile ? playfile :
"<None>", recordfile,
ast_channel_name(chan));
1633 if (playfile || beep) {
1647 strncat(prependfile,
"-prepend",
sizeof(prependfile) - strlen(prependfile) - 1);
1654 ast_debug(1,
"Recording Formats: sfmts=%s\n", fmts);
1657 while ((fmt =
strsep(&stringp,
"|"))) {
1667 sfmt[fmtcnt++] = fmt;
1670 end = start = time(
NULL);
1671 for (x = 0; x < fmtcnt; x++) {
1673 ast_verb(3,
"x=%d, open writing: %s format: %s, %p\n", x, prepend ? prependfile : recordfile, sfmt[x], others[x]);
1684 if (maxsilence > 0) {
1715 time_t pause_start = 0;
1716 int paused_secs = 0;
1717 int pausedsilence = 0;
1721 ast_debug(1,
"One waitfor failed, trying another\n");
1753 for (x = 0; x < fmtcnt; x++) {
1754 if (prepend && !others[x]) {
1764 if (maxsilence > 0) {
1767 if (olddspsilence > dspsilence) {
1768 totalsilence += olddspsilence;
1770 olddspsilence = dspsilence;
1774 pausedsilence = dspsilence;
1775 }
else if (dspsilence > pausedsilence) {
1777 dspsilence -= pausedsilence;
1783 if (dspsilence > maxsilence) {
1785 ast_verb(3,
"Recording automatically stopped after a silence of %d seconds\n", dspsilence/1000);
1821 ast_verb(3,
"Message canceled by control\n");
1826 ast_verb(3,
"Message ended by control\n");
1831 ast_verb(3,
"Message %spaused by control\n",
1832 paused ?
"" :
"un");
1834 pause_start = time(
NULL);
1836 paused_secs += time(
NULL) - pause_start;
1840 ast_verb(3,
"Message %smuted by control\n",
1846 if (muted && !rfmt) {
1847 ast_verb(3,
"Setting read format to linear mode\n");
1856 if (maxtime && !paused) {
1858 if (maxtime < (end - start - paused_secs)) {
1859 ast_verb(3,
"Took too long, cutting it short...\n");
1875 ast_log(
LOG_WARNING,
"Error creating writestream '%s', format '%s'\n", recordfile, sfmt[x]);
1894 if (sound_duration) {
1895 *sound_duration = *duration;
1900 if (olddspsilence <= dspsilence) {
1901 totalsilence += dspsilence;
1904 if (sound_duration) {
1905 if (totalsilence > 0) {
1906 *sound_duration -= (totalsilence - 200) / 1000;
1908 if (*sound_duration < 0) {
1909 *sound_duration = 0;
1913 if (dspsilence > 0) {
1914 *duration -= (dspsilence - 200) / 1000;
1917 if (*duration < 0) {
1921 for (x = 0; x < fmtcnt; x++) {
1930 if (res > 0 && dspsilence) {
1937 }
else if (prepend && outmsg) {
1941 for (x = 0; x < fmtcnt; x++) {
1942 snprintf(comment,
sizeof(comment),
"Opening the real file %s.%s\n", recordfile, sfmt[x]);
1943 realfiles[x] =
ast_readfile(recordfile, sfmt[x], comment, O_RDONLY, 0, 0);
1947 if (!realfiles[x]) {
1964 ast_verb(4,
"Recording Format: sfmts=%s, prependfile %s, recordfile %s\n", sfmt[x], prependfile, recordfile);
1968 for (x = 0; x < fmtcnt; x++) {
1980 if ((outmsg == 2) && (!skip_confirmation_sound)) {
1992 int ast_play_and_record_full(
struct ast_channel *chan,
const char *playfile,
const char *recordfile,
int maxtime,
const char *fmt,
int *duration,
int *sound_duration,
int beep,
int silencethreshold,
int maxsilence,
const char *path,
const char *acceptdtmf,
const char *canceldtmf,
int skip_confirmation_sound,
enum ast_record_if_exists if_exists)
1994 return __ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration, sound_duration, beep, silencethreshold, maxsilence, path, 0,
S_OR(acceptdtmf,
""),
S_OR(canceldtmf,
default_canceldtmf), skip_confirmation_sound, if_exists);
1999 return __ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration, sound_duration, 0, silencethreshold, maxsilence, path, 0,
default_acceptdtmf,
default_canceldtmf, 0,
AST_RECORD_IF_EXISTS_OVERWRITE);
2004 return __ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration, sound_duration, beep, silencethreshold, maxsilence,
NULL, 1,
default_acceptdtmf,
default_canceldtmf, 1,
AST_RECORD_IF_EXISTS_OVERWRITE);
2018 if ((cat = strchr(tmp,
'@'))) {
2039 char group[80] =
"", category[80] =
"";
2048 len =
sizeof(*gi) + strlen(group) + 1;
2067 gi->
group = (
char *) gi +
sizeof(*gi);
2068 strcpy(gi->
group, group);
2070 gi->
category = (
char *) gi +
sizeof(*gi) + strlen(group) + 1;
2106 regex_t regexbuf_group;
2107 regex_t regexbuf_category;
2116 if (regcomp(®exbuf_group, groupmatch, REG_EXTENDED | REG_NOSUB)) {
2121 if (!
ast_strlen_zero(category) && regcomp(®exbuf_category, category, REG_EXTENDED | REG_NOSUB)) {
2123 regfree(®exbuf_group);
2135 regfree(®exbuf_group);
2137 regfree(®exbuf_category);
2149 if (gi->
chan == old) {
2151 }
else if (gi->
chan ==
new) {
2168 if (gi->
chan == chan) {
2202 char *scan, *wasdelim =
NULL;
2205 if (!array || !arraylen) {
2209 memset(array, 0, arraylen *
sizeof(*array));
2217 for (argc = 0; *scan && (argc < arraylen - 1); argc++) {
2219 for (; *scan; scan++) {
2222 }
else if (*scan ==
')') {
2226 }
else if (*scan ==
'[') {
2228 }
else if (*scan ==
']') {
2232 }
else if (*scan ==
'"' && delim !=
'"') {
2236 memmove(scan, scan + 1, strlen(scan));
2239 }
else if (*scan ==
'\\') {
2242 memmove(scan, scan + 1, strlen(scan));
2246 }
else if ((*scan == delim) && !paren && !
quote && !bracket) {
2256 if (*scan || (scan > buf && (scan - 1) == wasdelim)) {
2257 array[argc++] = scan;
2269 int lp = strlen(path);
2275 snprintf(fs, strlen(path) + 19,
"%s/.lock-%08lx", path, (
unsigned long)
ast_random());
2283 snprintf(s, strlen(path) + 9,
"%s/.lock", path);
2285 while (((res = link(fs, s)) < 0) && (
errno == EEXIST) && (time(
NULL) - start < 5)) {
2295 ast_debug(1,
"Locked path '%s'\n", path);
2307 snprintf(s, strlen(path) + 9,
"%s/%s", path,
".lock");
2309 if ((res = unlink(s))) {
2312 ast_debug(1,
"Unlocked path '%s'\n", path);
2344 struct stat st, ost;
2348 snprintf(fs, strlen(path) + 19,
"%s/lock", path);
2349 if (lstat(fs, &st) == 0) {
2350 if ((st.st_mode & S_IFMT) == S_IFLNK) {
2352 "'%s': it's already a symbolic link\n",
2356 if (st.st_nlink > 1) {
2358 "'%s': %u hard links exist\n",
2359 fs, (
unsigned int) st.st_nlink);
2363 if ((fd = open(fs, O_WRONLY | O_CREAT, 0600)) < 0) {
2365 fs, strerror(
errno));
2383 ((res = fcntl(pl->
fd, F_SETLK, fcntl(pl->
fd, F_GETFL) | O_NONBLOCK)) < 0) &&
2385 ((res = flock(pl->
fd, LOCK_EX | LOCK_NB)) < 0) &&
2387 (
errno == EWOULDBLOCK) &&
2388 (time(
NULL) - start < 5))
2392 path, strerror(
errno));
2403 if (lstat(fs, &st) != 0 && fstat(pl->
fd, &ost) != 0 &&
2404 st.st_dev != ost.st_dev &&
2405 st.st_ino != ost.st_ino) {
2407 "file changed underneath us\n", fs);
2417 ast_debug(1,
"Locked path '%s'\n", path);
2431 if (!strcmp(p->
path, path)) {
2440 snprintf(s, strlen(path) + 19,
"%s/lock", path);
2443 ast_debug(1,
"Unlocked path '%s'\n", path);
2445 ast_debug(1,
"Failed to unlock path '%s': " 2446 "lock not found\n", path);
2495 int max_attempts = 3;
2498 int message_exists = 0;
2511 while ((cmd >= 0) && (cmd !=
't')) {
2514 if (!message_exists) {
2525 ast_verb(3,
"Reviewing the recording\n");
2531 ast_verb(3,
"R%secording\n", recorded == 1 ?
"e-r" :
"");
2533 if ((cmd =
ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration,
NULL, silencethreshold, maxsilence, path)) == -1) {
2539 }
else if (cmd ==
'*') {
2558 if (message_exists) {
2572 if (attempts > max_attempts) {
2583 #define RES_UPONE (1 << 16) 2584 #define RES_EXIT (1 << 17) 2585 #define RES_REPEAT (1 << 18) 2586 #define RES_RESTART ((1 << 19) | RES_REPEAT) 2597 switch (option->
action) {
2601 return RES_EXIT | (((
unsigned long)(option->
adata)) & 0xffff);
2634 ivr_func = option->
adata;
2635 res = ivr_func(chan, cbdata);
2644 while ((n =
strsep(&c,
";"))) {
2674 if ((!strncasecmp(menu->
options[x].
option, option, strlen(option))) &&
2688 if (strlen(exten) >= maxexten - 1) {
2694 exten[strlen(exten) + 1] =
'\0';
2695 exten[strlen(exten)] = res;
2697 return res > 0 ? 0 : res;
2718 ast_debug(1,
"IVR Dispatch of '%s' (pos %d) yields %d\n", exten, pos, res);
2735 if ((maxretries > 0) && (retries >= maxretries)) {
2736 ast_debug(1,
"Max retries %d exceeded\n", maxretries);
2748 ast_debug(1,
"Got start of extension, %c\n", res);
2756 ast_debug(1,
"Invalid extension entered, going to 'i'!\n");
2761 ast_debug(1,
"Aborting on invalid entry, with no 'i' option!\n");
2766 ast_debug(1,
"New existing extension: %s\n", exten);
2774 ast_debug(1,
"Stopping option '%s', res is %d\n", exten, res);
2776 if (!strcasecmp(exten,
"s")) {
2789 return res > 0 ? 0 : res;
2794 int fd, count = 0, res;
2795 char *output =
NULL;
2796 struct stat filesize;
2798 if (stat(filename, &filesize) == -1) {
2803 count = filesize.st_size + 1;
2805 if ((fd = open(filename, O_RDONLY)) < 0) {
2811 res = read(fd, output, count - 1);
2812 if (res == count - 1) {
2829 int curarg, res = 0;
2830 unsigned int argloc;
2834 if (flaglen == 32) {
2846 curarg = *s++ & 0x7f;
2850 int parsequotes = (s[1] ==
'"') ? 1 : 0;
2855 if (*s ==
'(' && !
quote) {
2857 }
else if (*s ==
')' && !
quote) {
2860 }
else if (*s ==
'"' && parsequotes) {
2865 }
else if (*s ==
'\\') {
2869 }
else if (
quote && s[1] ==
'"') {
2883 if ((s = strchr(s,
')'))) {
2885 args[argloc - 1] = arg;
2889 ast_log(
LOG_WARNING,
"Missing closing parenthesis for argument '%c' in string '%s'\n", curarg, arg);
2893 }
else if (argloc) {
2894 args[argloc - 1] =
"";
2896 if (flaglen == 32) {
2918 unsigned int i, found = 0;
2919 for (i = 32; i < 128 && found <
len; i++) {
2937 if (*stream ==
'\\') {
2939 switch (*(stream + 1)) {
2951 if (strchr(
"0123456789ABCDEFabcdef", *(stream + 2)) && *(stream + 2) !=
'\0') {
2953 if (*(stream + 2) <=
'9') {
2954 *result = *(stream + 2) -
'0';
2955 }
else if (*(stream + 2) <=
'F') {
2956 *result = *(stream + 2) -
'A' + 10;
2958 *result = *(stream + 2) -
'a' + 10;
2961 ast_log(
LOG_ERROR,
"Illegal character '%c' in hexadecimal string\n", *(stream + 2));
2965 if (strchr(
"0123456789ABCDEFabcdef", *(stream + 3)) && *(stream + 3) !=
'\0') {
2968 if (*(stream + 3) <=
'9') {
2969 *result += *(stream + 3) -
'0';
2970 }
else if (*(stream + 3) <=
'F') {
2971 *result += *(stream + 3) -
'A' + 10;
2973 *result += *(stream + 3) -
'a' + 10;
2980 for (i = 2; ; i++) {
2981 if (strchr(
"01234567", *(stream + i)) && *(stream + i) !=
'\0') {
2983 ast_debug(5,
"result was %d, ", *result);
2985 *result += *(stream + i) -
'0';
2993 *result = *(stream + 1);
3021 if (strchr(stream,
'\\')) {
3030 buf[offset++] =
next;
3034 buf[offset++] =
'\0';
3049 sigset_t signal_set, old_set;
3059 (void) sigfillset(&signal_set);
3060 pthread_sigmask(SIG_BLOCK, &signal_set, &old_set);
3066 pthread_sigmask(SIG_SETMASK, &old_set,
NULL);
3067 if (!stop_reaper && pid > 0) {
3076 ast_log(
LOG_ERROR,
"Shaun of the Dead wants to kill zombies, but can't?!!\n");
3090 signal(SIGHUP, SIG_DFL);
3091 signal(SIGCHLD, SIG_DFL);
3092 signal(SIGINT, SIG_DFL);
3093 signal(SIGURG, SIG_DFL);
3094 signal(SIGTERM, SIG_DFL);
3095 signal(SIGPIPE, SIG_DFL);
3096 signal(SIGXFSZ, SIG_DFL);
3099 if (pthread_sigmask(SIG_UNBLOCK, &signal_set,
NULL)) {
3117 #ifdef HAVE_LONG_DOUBLE_WIDER 3119 #define FMT "%30Lf%9s" 3122 #define FMT "%30lf%9s" 3128 res = sscanf(timestr,
FMT, &amount, u);
3130 if (res == 0 || res == EOF) {
3133 }
else if (res == 2) {
3151 if (toupper(u[1]) ==
'S') {
3156 }
else if (u[1] ==
'\0') {
3180 *result = amount > INT_MAX ? INT_MAX : (int) amount;
3200 queue_topic_pool =
NULL;
3202 queue_topic_all =
NULL;
3209 child_cap = cap_from_text(
"cap_net_admin-eip");
3212 if (!queue_topic_all) {
3216 if (!queue_topic_pool) {
unsigned int module_version
The version of this function table.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
static int ast_unlock_path_flock(const char *path)
int ast_safe_sleep(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups.
int ast_queue_hangup(struct ast_channel *chan)
Queue a hangup frame.
int app_init(void)
Initialize the application core.
int ast_matchmore_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks to see if adding anything to this extension might match something. (exists ^ canmatch) ...
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
struct ast_module * module
The module for the voicemail provider.
struct stasis_topic * ast_queue_topic(const char *queuename)
Get the Stasis Message Bus API topic for queue messages for a particular queue name.
static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int *sound_duration, int beep, int silencethreshold, int maxsilence, const char *path, int prepend, const char *acceptdtmf, const char *canceldtmf, int skip_confirmation_sound, enum ast_record_if_exists if_exists)
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
#define AST_LIST_LOCK(head)
Locks a list.
unsigned int __ast_app_separate_args(char *buf, char delim, int remove_chars, char **array, int arraylen)
Separate a string into arguments in an array.
int ast_vm_msg_remove(const char *mailbox, const char *context, size_t num_msgs, const char *folder, const char *msgs[])
Remove/delete messages from a mailbox folder.
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.
static const struct ast_vm_functions vm_table
static const char default_acceptdtmf[]
static AO2_GLOBAL_OBJ_STATIC(vm_provider)
The container for the voicemail provider.
static ast_vm_test_create_user_fn * ast_vm_test_create_user_func
int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime, char *fmt, int *duration, int *sound_duration, int beep, int silencethreshold, int maxsilence)
Record a file based on input frm a channel. Recording is performed in 'prepend' mode which works a li...
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
int ast_app_inboxcount2(const char *mailboxes, int *urgentmsgs, int *newmsgs, int *oldmsgs)
Determine number of urgent/new/old messages in a mailbox.
static struct stasis_topic * queue_topic_all
static struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized...
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
void ast_unreplace_sigchld(void)
Restore the SIGCHLD handler.
int ast_app_getdata_full(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout, int audiofd, int ctrlfd)
Full version with audiofd and controlfd. NOTE: returns '2' on ctrlfd available, not '1' like other fu...
int ast_vm_msg_move(const char *mailbox, const char *context, size_t num_msgs, const char *oldfolder, const char *old_msg_ids[], const char *newfolder)
Move messages from one folder to another.
int ast_app_has_voicemail(const char *mailboxes, const char *folder)
Determine if a given mailbox has any voicemail If folder is NULL, defaults to "INBOX". If folder is "INBOX", includes the number of messages in the "Urgent" folder.
static int vm_greeter_warnings
void *(* alloc)(struct ast_channel *chan, void *params)
int ast_app_inboxcount(const char *mailboxes, int *newmsgs, int *oldmsgs)
Determine number of new/old messages in a mailbox.
int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen, void *params)
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
size_t ast_str_size(const struct ast_str *buf)
Returns the current maximum length (without reallocation) of the current buffer.
AST_THREADSTORAGE_PUBLIC(ast_str_thread_global_buf)
int ast_app_parse_timelen(const char *timestr, int *result, enum ast_timelen unit)
Common routine to parse time lengths, with optional time unit specifier.
void ast_dsp_free(struct ast_dsp *dsp)
Convenient Signal Processing routines.
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
static const char default_canceldtmf[]
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_set_flag(p, flag)
int ast_check_hangup_locked(struct ast_channel *chan)
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
int ast_vm_greeter_is_registered(void)
Determine if a voicemail greeter provider is registered.
static int parse_tone_uri(char *tone_parser, const char **tone_indication, const char **tone_zone)
static int sayname(struct ast_channel *chan, const char *mailbox, const char *context)
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define ast_str_make_space(buf, new_len)
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Voicemail greeter function table definition.
int ast_unlock_path(const char *path)
Unlock a path.
static struct stasis_rest_handlers mailboxes
REST handler for /api-docs/mailboxes.json.
struct ast_dsp * ast_dsp_new(void)
Allocates a new dsp, assumes 8khz for internal sample rate.
static int mf_stream(struct ast_channel *chan, const char *digits, int between, unsigned int duration, unsigned int durationkp, unsigned int durationst, int is_external)
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
struct ast_tone_zone * ast_channel_zone(const struct ast_channel *chan)
void ast_close_fds_above_n(int n)
Common routine for child processes, to close all fds prior to exec(2)
static pthread_t shaun_of_the_dead_thread
void ast_vm_test_swap_table_in(const struct ast_vm_functions *vm_table)
Swap out existing voicemail functions with a temporary set of functions for use with unit tests...
#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.
static int option_matchmore(struct ast_ivr_menu *menu, char *option)
static int messagecount(const char *mailbox_id, const char *folder)
int ast_ignore_pattern(const char *context, const char *pattern)
Checks to see if a number should be ignored.
static enum AST_LOCK_RESULT ast_lock_path_lockfile(const char *path)
int ast_senddigit_external(struct ast_channel *chan, char digit, unsigned int duration)
Send a DTMF digit to a channel from an external thread.
#define ao2_global_obj_ref(holder)
#define VM_GREETER_MODULE_VERSION
#define ast_set_flag64(p, flag)
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
#define ao2_alloc_options(data_size, destructor_fn, options)
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
#define ast_opt_transmit_silence
static void app_cleanup(void)
int ast_app_run_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const char *sub_location, const char *sub_args, int ignore_hangup)
Run a subroutine on a channel, placing an optional second channel into autoservice.
#define ast_strdup(str)
A wrapper for strdup()
struct ast_vm_mailbox_snapshot * ast_vm_mailbox_snapshot_destroy(struct ast_vm_mailbox_snapshot *mailbox_snapshot)
destroy a snapshot
struct stasis_topic * stasis_topic_pool_get_topic(struct stasis_topic_pool *pool, const char *topic_name)
Find or create a topic in the pool.
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_menu *menu, void *cbdata)
void ast_playtones_stop(struct ast_channel *chan)
Stop playing tones on a channel.
void ast_app_options2str64(const struct ast_app_option *options, struct ast_flags64 *flags, char *buf, size_t len)
Given a list of options array, return an option string based on passed flags.
Definitions to aid in the use of thread local storage.
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.
int ast_app_dtget(struct ast_channel *chan, const char *context, char *collect, size_t size, int maxlen, int timeout)
This function presents a dialtone and reads an extension into 'collect' which must be a pointer to a ...
static int inboxcount2(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs)
Check the given mailbox's message count.
int ast_vm_msg_forward(const char *from_mailbox, const char *from_context, const char *from_folder, const char *to_mailbox, const char *to_context, const char *to_folder, size_t num_msgs, const char *msg_ids[], int delete_old)
forward a message from one mailbox to another.
Structure used to handle a large number of boolean flags == used only in app_dial?
int ast_play_and_record_full(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int *sound_duration, int beep, int silencethreshold, int maxsilence, const char *path, const char *acceptdtmf, const char *canceldtmf, int skip_confirmation_sound, enum ast_record_if_exists if_exists)
Record a file based on input from a channel This function will play "auth-thankyou" upon successful r...
struct stasis_topic * ast_queue_topic_all(void)
Get the Stasis Message Bus API topic for queue messages.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
int ast_channel_priority(const struct ast_channel *chan)
#define ast_verb(level,...)
void() ast_vm_msg_play_cb(struct ast_channel *chan, const char *playfile, int duration)
Voicemail playback callback function definition.
int ast_linear_stream(struct ast_channel *chan, const char *filename, int fd, int allowoverride)
Stream a filename (or file descriptor) as a generator.
static void linear_release(struct ast_channel *chan, void *params)
const char * ast_vm_index_to_foldername(int id)
Return name of folder, given an id.
def from_mailbox(key, val, section, pjsip, nmapped)
struct ast_frame_subclass subclass
#define ast_module_unref(mod)
Release a reference to the module.
#define ast_strlen_zero(foo)
#define VM_GREETER_API_CALL(res, api_call, api_parms)
struct stasis_topic_pool * stasis_topic_pool_create(struct stasis_topic *pooled_topic)
Create a topic pool that routes messages from dynamically generated topics to the given topic...
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
off_t ast_tellstream(struct ast_filestream *fs)
Tell where we are in a stream.
void ast_frame_dtor(struct ast_frame *frame)
NULL-safe wrapper for ast_frfree, good for RAII_VAR.
static int set_read_to_slin(struct ast_channel *chan, struct ast_format **orig_format)
Sets a channel's read format to AST_FORMAT_SLINEAR, recording its original format.
#define ast_pthread_create_background(a, b, c, d)
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
static char mailbox[AST_MAX_MAILBOX_UNIQUEID]
int ast_app_group_get_count(const char *group, const char *category)
Get the current channel count of the specified group and category.
static int dtmf_stream(struct ast_channel *chan, const char *digits, int between, unsigned int duration, int is_external)
#define ast_debug(level,...)
Log a DEBUG message.
#define VM_API_CALL(res, api_call, api_parms)
static struct stasis_topic_pool * queue_topic_pool
int ast_app_group_list_rdlock(void)
Read Lock the group count list.
static int option_exists(struct ast_ivr_menu *menu, char *option)
A structure to hold the description of an application 'option'.
static struct ast_frame * make_silence(const struct ast_frame *orig)
Construct a silence frame of the same duration as orig.
General Asterisk PBX channel definitions.
Asterisk JSON abstraction layer.
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
Asterisk file paths, configured in asterisk.conf.
#define AST_FRIENDLY_OFFSET
Offset into a frame's data buffer.
static int quote(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
A set of tones for a given locale.
static int ast_unlock_path_lockfile(const char *path)
#define AST_PTHREADT_NULL
int ast_control_streamfile_w_cb(struct ast_channel *chan, const char *file, const char *fwd, const char *rev, const char *stop, const char *suspend, const char *restart, int skipms, long *offsetms, ast_waitstream_fr_cb cb)
Stream a file with fast forward, pause, reverse, restart.
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.
#define ast_poll(a, b, c)
struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan)
int ast_app_group_update(struct ast_channel *old, struct ast_channel *new)
Update all group counting for a channel to a new one.
static int silencethreshold
int ast_parseable_goto(struct ast_channel *chan, const char *goto_string)
#define AST_MAX_EXTENSION
#define AST_RWLIST_TRAVERSE
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
int ast_play_and_record(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int *sound_duration, int silencethreshold, int maxsilence, const char *path)
Record a file based on input from a channel. Use default accept and cancel DTMF. This function will p...
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
int ast_str_get_encoded_str(struct ast_str **str, int maxlen, const char *stream)
Decode a stream of encoded control or extended ASCII characters.
#define VM_MODULE_VERSION
long int ast_random(void)
#define AST_RWLIST_REMOVE_CURRENT
#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.
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.
static int provider_is_swapped
A set of macros to manage forward-linked lists.
int ast_vm_test_destroy_user(const char *context, const char *mailbox)
#define ast_malloc(len)
A wrapper for malloc()
int ast_waitstream_fr(struct ast_channel *c, const char *breakon, const char *forward, const char *rewind, int ms)
Same as waitstream but allows stream to be forwarded or rewound.
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
struct stasis_topic * stasis_topic_create(const char *name)
Create a new topic.
void ast_vm_greeter_unregister(const char *module_name)
Unregister the specified voicemail greeter provider.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
static void * shaun_of_the_dead(void *data)
void ast_replace_sigchld(void)
Replace the SIGCHLD handler.
const char * ast_channel_exten(const struct ast_channel *chan)
Core PBX routines and definitions.
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
void ast_install_vm_test_functions(ast_vm_test_create_user_fn *vm_test_create_user_func, ast_vm_test_destroy_user_fn *vm_test_destroy_user_func)
struct ast_module * module
The module for the voicemail greeter provider.
void ast_uninstall_vm_test_functions(void)
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
const char * ast_app_expand_sub_args(struct ast_channel *chan, const char *args)
Add missing context/exten to subroutine argument string.
int ast_app_group_match_get_count(const char *groupmatch, const char *category)
Get the current channel count of all groups that match the specified pattern and category.
static int read_newoption(struct ast_channel *chan, struct ast_ivr_menu *menu, char *exten, int maxexten)
struct ast_channel * chan
#define AST_LIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold)
Set the minimum average magnitude threshold to determine talking by the DSP.
#define ast_test_suite_event_notify(s, f,...)
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
struct ast_silence_generator * ast_channel_start_silence_generator(struct ast_channel *chan)
Starts a silence generator on the given channel.
int ast_vm_test_create_user(const char *context, const char *mailbox)
struct ast_format * origwfmt
int ast_app_messagecount(const char *mailbox_id, const char *folder)
Get the number of messages in a given mailbox folder.
control_tone_frame_response_result
const char * ast_config_AST_DATA_DIR
static enum AST_LOCK_RESULT ast_lock_path_flock(const char *path)
int __ast_vm_greeter_register(const struct ast_vm_greeter_functions *vm_table, struct ast_module *module)
Set voicemail greeter function callbacks.
struct ast_vm_mailbox_snapshot * ast_vm_mailbox_snapshot_create(const char *mailbox, const char *context, const char *folder, int descending, enum ast_vm_snapshot_sort_val sort_val, int combine_INBOX_and_OLD)
Create a snapshot of a mailbox which contains information about every msg.
int ast_app_sayname(struct ast_channel *chan, const char *mailbox_id)
Play a recorded user name for the mailbox to the specified channel.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
void() ast_waitstream_fr_cb(struct ast_channel *chan, long ms, enum ast_waitstream_fr_cb_values val)
callback used during dtmf controlled file playback to indicate location of playback in a file after r...
int ast_control_streamfile(struct ast_channel *chan, const char *file, const char *fwd, const char *rev, const char *stop, const char *suspend, const char *restart, int skipms, long *offsetms)
Stream a file with fast forward, pause, reverse, restart.
void ast_dtmf_stream_external(struct ast_channel *chan, const char *digits, int between, unsigned int duration)
Send a string of DTMF digits to a channel from an external thread.
static int array(struct ast_channel *chan, const char *cmd, char *var, const char *value)
const char * module_name
The name of the module that provides the voicemail greeter functionality.
int() ast_vm_test_destroy_user_fn(const char *context, const char *user)
int ast_app_group_split_group(const char *data, char *group, int group_max, char *category, int category_max)
Split a group string into group and category, returning a default category if none is provided...
struct ast_frame * ast_readframe(struct ast_filestream *s)
Read a frame from a filestream.
#define ao2_global_obj_release(holder)
Stack applications callback functions.
int ast_senddigit_mf_end(struct ast_channel *chan)
End sending an MF digit to a channel.
int ast_stream_rewind(struct ast_filestream *fs, off_t ms)
Rewind stream ms.
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
static const struct ast_app_stack_funcs * app_stack_callbacks
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int ast_control_tone(struct ast_channel *chan, const char *tone)
Controls playback of a tone.
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_app_group_discard(struct ast_channel *chan)
Discard all group counting for a channel.
int() ast_vm_test_create_user_fn(const char *context, const char *user)
struct ast_filestream * ast_writefile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)
Starts writing a file.
static void * linear_alloc(struct ast_channel *chan, void *params)
static void vm_warn_no_provider(void)
static struct ast_generator linearstream
int ast_seekstream(struct ast_filestream *fs, off_t sample_offset, int whence)
Seeks into stream.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
int ast_app_run_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const char *macro_name, const char *macro_args)
Run a macro on a channel, placing an optional second channel into autoservice.
void ast_set_lock_type(enum AST_LOCK_TYPE type)
Set the type of locks used by ast_lock_path()
void ast_channel_stop_silence_generator(struct ast_channel *chan, struct ast_silence_generator *state)
Stops a previously-started silence generator on the given channel.
#define ast_calloc(num, len)
A wrapper for calloc()
void ast_install_stack_functions(const struct ast_app_stack_funcs *funcs)
Set stack application function callbacks.
void ast_vm_test_swap_table_out(void)
Used after ast_vm_test_swap_table_in to restore the original set of voicemail functions.
static enum control_tone_frame_response_result control_tone_frame_response(struct ast_channel *chan, struct ast_frame *fr, struct ast_tone_zone_sound *ts, const char *tone, int *paused)
int ast_app_group_list_wrlock(void)
Write Lock the group count list.
int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *digits)
stream file until digit If the file name is non-empty, try to play it.
int ast_closestream(struct ast_filestream *f)
Closes a stream.
struct ast_filestream * ast_channel_stream(const struct ast_channel *chan)
int ast_vm_msg_play(struct ast_channel *chan, const char *mailbox, const char *context, const char *folder, const char *msg_num, ast_vm_msg_play_cb *cb)
Play a voicemail msg back on a channel.
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.
static void suspend(struct cc_core_instance *core_instance)
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_safe_fork_cleanup(void)
Common routine to cleanup after fork'ed process is complete (if reaping was stopped) ...
Module has failed to load, may be in an inconsistent state.
void closefrom(int lowfd)
static int linear_generator(struct ast_channel *chan, void *data, int len, int samples)
unsigned int arg_index
The index of the entry in the arguments array that should be used for this option's argument...
Structure used to handle boolean flags.
#define ast_clear_flag(p, flag)
int(* run_sub)(struct ast_channel *chan, const char *args, int ignore_hangup)
Callback for the routine to run a subroutine on a channel.
int ast_truncstream(struct ast_filestream *fs)
Trunc stream at current location.
static int ivr_dispatch(struct ast_channel *chan, struct ast_ivr_option *option, char *exten, void *cbdata)
#define ast_module_running_ref(mod)
Hold a reference to the module if it is running.
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
const char * module_name
The name of the module that provides the voicemail functionality.
static ast_vm_test_destroy_user_fn * ast_vm_test_destroy_user_func
void ast_vm_unregister(const char *module_name)
Unregister the specified voicemail provider.
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.
#define ao2_global_obj_replace_unref(holder, obj)
int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence)
Process the audio frame for silence.
#define AST_RWLIST_INSERT_TAIL
struct ast_group_info * ast_app_group_list_head(void)
Get the head of the group count list.
static int global_silence_threshold
char * strsep(char **str, const char *delims)
Structure used for ast_copy_recording_to_vm in order to cleanly supply data needed for making the rec...
static int parse_options(const struct ast_app_option *options, void *_flags, char **args, char *optstr, int flaglen)
This structure is allocated by file.c in one chunk, together with buf_size and desc_size bytes of mem...
char * ast_get_encoded_str(const char *stream, char *result, size_t result_size)
Decode a stream of encoded control or extended ASCII characters.
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
int __ast_vm_register(const struct ast_vm_functions *vm_table, struct ast_module *module)
Set voicemail function callbacks.
int ast_safe_fork(int stop_reaper)
Common routine to safely fork without a chance of a signal handler firing badly in the child...
static int has_voicemail(const char *mailbox, const char *folder)
Determines if the given folder has messages.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
void ast_str_update(struct ast_str *buf)
Update the length of the buffer, after using ast_str merely as a buffer.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
int ast_vm_is_registered(void)
Determine if a voicemail provider is registered.
ast_app: A registered application
const char * ast_channel_name(const struct ast_channel *chan)
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_writestream(struct ast_filestream *fs, struct ast_frame *f)
Writes a frame to a stream.
char * ast_read_textfile(const char *filename)
Read a file into asterisk.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders, int audiofd, int ctrlfd)
int ast_control_streamfile_lang(struct ast_channel *chan, const char *file, const char *fwd, const char *rev, const char *stop, const char *suspend, const char *restart, int skipms, const char *lang, long *offsetms)
Version of ast_control_streamfile() which allows the language of the media file to be specified...
static int global_maxsilence
static int inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs)
Data structure associated with a single frame of data.
static int control_streamfile(struct ast_channel *chan, const char *file, const char *fwd, const char *rev, const char *stop, const char *suspend, const char *restart, int skipms, long *offsetms, const char *lang, ast_waitstream_fr_cb cb)
int ast_app_group_list_unlock(void)
Unlock the group count list.
struct ast_filestream * ast_readfile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)
Starts reading from a file.
const char * ast_channel_language(const struct ast_channel *chan)
unsigned int module_version
The version of this function table.
int ast_playtones_start(struct ast_channel *chan, int vol, const char *tonelist, int interruptible)
Start playing a list of tones on a channel.
int ast_filerename(const char *oldname, const char *newname, const char *fmt)
Renames a file.
int ast_app_copy_recording_to_vm(struct ast_vm_recording_data *vm_rec_data)
param[in] vm_rec_data Contains data needed to make the recording. retval 0 voicemail successfully cre...
const char * ast_channel_context(const struct ast_channel *chan)
struct path_lock::@334 le
const char * data
Description of a tone.
static void vm_greeter_warn_no_provider(void)
union ast_frame::@263 data
static int external_sleep(struct ast_channel *chan, int ms)
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
enum ast_frame_type frametype
enum ast_getdata_result ast_app_getdata(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout)
ast_app_getdata
static struct ast_str * prompt
static char context[AST_MAX_CONTEXT]
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
int ast_readstring(struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders)
Reads multiple digits.
struct ast_format * format
struct ast_app * pbx_findapp(const char *app)
Look up an application.
struct ast_group_info::@248 group_list
int ast_record_review(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, const char *path)
Allow to record message and have a review option.
int ast_dsp_get_threshold_from_settings(enum threshold which)
Get silence threshold from dsp.conf.
Asterisk module definitions.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
int ast_ivr_menu_run(struct ast_channel *chan, struct ast_ivr_menu *menu, void *cbdata)
Runs an IVR menu.
Voicemail function table definition.
AST_LOCK_TYPE
Type of locking to use in ast_lock_path / ast_unlock_path.
struct ast_frame * ast_read_noaudio(struct ast_channel *chan)
Reads a frame, returning AST_FRAME_NULL frame if audio.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
const char *(* expand_sub_args)(struct ast_channel *chan, const char *args)
Add missing context/exten to Gosub application argument string.
int ast_senddigit_mf(struct ast_channel *chan, char digit, unsigned int duration, unsigned int durationkp, unsigned int durationst, int is_external)
Send an MF digit to a channel.
int ast_get_encoded_char(const char *stream, char *result, size_t *consumed)
Decode an encoded control or extended ASCII character.
#define AST_RWLIST_TRAVERSE_SAFE_END
int ast_stopstream(struct ast_channel *c)
Stops a stream.
int ast_waitstream_fr_w_cb(struct ast_channel *c, const char *breakon, const char *forward, const char *rewind, int ms, ast_waitstream_fr_cb cb)
Same as waitstream_fr but allows a callback to be alerted when a user fastforwards or rewinds the fil...
static void path_lock_destroy(struct path_lock *obj)
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.
enum AST_LOCK_RESULT ast_lock_path(const char *path)
Lock a filesystem path.
#define ast_test_flag64(p, flag)