47#include <dahdi/user.h> 
  709#define CONFIG_FILE_NAME    "meetme.conf" 
  710#define STR_CONCISE         "concise" 
  713#define DEFAULT_AUDIO_BUFFERS  32 
  716#define DATE_FORMAT "%Y-%m-%d %H:%M:%S" 
  727#define MEETME_DELAYDETECTTALK     300 
  728#define MEETME_DELAYDETECTENDTALK  1000 
  730#define AST_FRAME_BITS  32 
  811#define CONFFLAG_NO_AUDIO_UNTIL_UP  (1ULL << 31) 
  812#define CONFFLAG_INTROMSG           (1ULL << 32)  
  813#define CONFFLAG_INTROUSER_VMREC    (1ULL << 33) 
  815#define CONFFLAG_KILL_LAST_MAN_STANDING (1ULL << 34) 
  817#define CONFFLAG_DONT_DENOISE       (1ULL << 35) 
  866static const char * 
const app = 
"MeetMe";
 
  867static const char * 
const app2 = 
"MeetMeCount";
 
  868static const char * 
const app3 = 
"MeetMeAdmin";
 
  869static const char * 
const app4 = 
"MeetMeChannelAdmin";
 
  881#define MAX_CONFNUM 80 
  883#define OPTIONS_LEN 100 
  886#define MAX_SETTINGS (MAX_CONFNUM + MAX_PIN + MAX_PIN + 3) 
 1060            meetme_leave_type(),
 
 1084            meetme_talking_type(),
 
 1092            meetme_talk_request_type(),
 
 
 1108    const char *conference_num;
 
 1114    if (!channel_blob) {
 
 1121    if (!message_type) {
 
 1126    if (message_type == meetme_join_type()) {
 
 1127        event = 
"MeetmeJoin";
 
 1128    } 
else if (message_type == meetme_leave_type()) {
 
 1129        event = 
"MeetmeLeave";
 
 1130    } 
else if (message_type == meetme_end_type()) {
 
 1131        event = 
"MeetmeEnd";
 
 1132    } 
else if (message_type == meetme_mute_type()) {
 
 1133        event = 
"MeetmeMute";
 
 1134    } 
else if (message_type == meetme_talking_type()) {
 
 1135        event = 
"MeetmeTalking";
 
 1136    } 
else if (message_type == meetme_talk_request_type()) {
 
 1137        event = 
"MeetmeTalkRequest";
 
 1149    if (!conference_num) {
 
 1166        if (!user_prop_str) {
 
 1170        ast_str_set(&user_prop_str, 0, 
"%d", user_number);
 
 
 1203        "status", on ? 
"on" : 
"off");
 
 
 1226        "Meetme", meetme_conference->
confno);
 
 1238        long duration = (long)(now.tv_sec - 
user->jointime);
 
 1240        struct ast_json *json_user_duration;
 
 1249            if (!json_user_duration
 
 
 1279        return "(unmonitored)";
 
 1281        return "(not talking)";
 
 
 1291            x = DAHDI_IOMUX_WRITE | DAHDI_IOMUX_SIGEVENT;
 
 1292            res = ioctl(fd, DAHDI_IOMUX, &x);
 
 1296            res = write(fd, data, 
len);
 
 1298            if (
errno != EAGAIN) {
 
 
 1377        user->talk.actual = 0;
 
 1379        user->talk.actual = 
user->talk.desired;
 
 
 1389        user->listen.actual = 0;
 
 1391        user->listen.actual = 
user->listen.desired;
 
 
 1396    signed char zero_volume = 0;
 
 
 1404    unsigned char *data;
 
 1409        "Conference: %s\r\n" 
 
 1460    if (
user->user_no > *max_no) {
 
 1461        *max_no = 
user->user_no;
 
 
 1487    struct dahdi_confinfo dahdic = { 0, };
 
 1494        if (!strcmp(confno, cnf->
confno))
 
 1498    if (cnf || (!make && !dynamic) || !cap_slin)
 
 1527    dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
 
 1528    cnf->
fd = open(
"/dev/dahdi/pseudo", O_RDWR);
 
 1529    if (cnf->
fd < 0 || ioctl(cnf->
fd, DAHDI_SETCONF, &dahdic)) {
 
 1559        dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
 
 1588    if ((sscanf(cnf->
confno, 
"%30d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024))
 
 
 1631        snprintf(usrno, 
sizeof(usrno), 
"%d", usr->
user_no);
 
 
 1655        if (!strncasecmp(
word, 
"all", 
len)) {
 
 1664        strtok_r(myline, 
" ", &saved);
 
 1665        strtok_r(
NULL, 
" ", &saved);
 
 
 1705    if (pos == 3 && 
state == 0) {
 
 1712        strtok_r(myline, 
" ", &saved);
 
 1713        strtok_r(
NULL, 
" ", &saved);
 
 
 1737#define MC_HEADER_FORMAT "%-14s %-14s %-10s %-8s  %-8s  %-6s\n" 
 1738#define MC_DATA_FORMAT "%-12.12s   %4.4d          %4.4s       %02d:%02d:%02d  %-8s  %-6s\n" 
 1744            "Usage: meetme list [<confno>] [" STR_CONCISE "]\n" 
 1745            "       List all conferences or a specific conference.\n";
 
 1751    if (
a->argc == 2 || (
a->argc == 3 && !strcasecmp(
a->argv[2], 
STR_CONCISE))) {
 
 1753        int concise = (
a->argc == 3);
 
 1764                ast_cli(
a->fd, 
"No active MeetMe conferences.\n");
 
 1774            hr = (now - cnf->
start) / 3600;
 
 1775            min = ((now - cnf->
start) % 3600) / 60;
 
 1776            sec = (now - cnf->
start) % 60;
 
 1787                ast_cli(
a->fd, 
"%s!%d!%d!%02d:%02d:%02d!%d!%d\n",
 
 1800            ast_cli(
a->fd, 
"* Total number of MeetMe users: %d\n", 
total);
 
 1805    if (
a->argc == 3 || (
a->argc == 4 && !strcasecmp(
a->argv[3], 
STR_CONCISE))) {
 
 1807        int concise = (
a->argc == 4);
 
 1812                ast_cli(
a->fd, 
"No active MeetMe conferences.\n");
 
 1819            if (strcmp(cnf->
confno, 
a->argv[2]) == 0) {
 
 1825                ast_cli(
a->fd, 
"No such conference: %s.\n", 
a->argv[2]);
 
 1833            hr = (now - 
user->jointime) / 3600;
 
 1834            min = ((now - 
user->jointime) % 3600) / 60;
 
 1835            sec = (now - 
user->jointime) % 60;
 
 1837                ast_cli(
a->fd, 
"User #: %-2.2d %12.12s %-20.20s Channel: %s %s %s %s %s %s %02d:%02d:%02d\n",
 
 1848                ast_cli(
a->fd, 
"%d!%s!%s!%s!%s!%s!%s!%s!%d!%02d:%02d:%02d\n",
 
 1863            ast_cli(
a->fd, 
"%d users in that conference.\n", cnf->
users);
 
 
 1883        if (strcasecmp(
a->argv[1], 
"lock") == 0) {
 
 1891        if (strcasecmp(
a->argv[1], 
"mute") == 0) {
 
 1893            if (strcasecmp(
a->argv[3], 
"all") == 0) {
 
 1900            if (strcasecmp(
a->argv[3], 
"all") == 0) {
 
 1906    } 
else if (strcasecmp(
a->argv[1], 
"kick") == 0) {
 
 1907        if (strcasecmp(
a->argv[3], 
"all") == 0) {
 
 
 1935        e->
command = 
"meetme {lock|unlock}";
 
 1937            "Usage: meetme lock|unlock <confno>\n" 
 1938            "       Lock or unlock a conference to new users.\n";
 
 
 1957            "Usage: meetme kick <confno> all|<userno>\n" 
 1958            "       Kick a conference or a user in a conference.\n";
 
 
 1975        e->
command = 
"meetme {mute|unmute}";
 
 1977            "Usage: meetme mute|unmute <confno> all|<userno>\n" 
 1978            "       Mute or unmute a conference or a user in a conference.\n";
 
 
 2021    x = DAHDI_FLUSH_ALL;
 
 2022    if (ioctl(fd, DAHDI_FLUSH, &x))
 
 
 2052        if (
conf->transframe[x])
 
 2054        if (
conf->transpath[x])
 
 2059        conf->announcethread_stop = 1;
 
 2063        pthread_join(
conf->announcethread, 
NULL);
 
 2075    if (
conf->origframe)
 
 2081    if (
conf->recordingfilename) {
 
 2084    if (
conf->usercontainer) {
 
 2087    if (
conf->recordingformat) {
 
 
 2107        if (
user == sender) {
 
 
 2127        if ((sscanf(
conf->confno, 
"%4d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024)) {
 
 
 2140    char currenttime[32];
 
 2157        confno, 
"startTime<= ", currenttime,
 
 2158        "endtime>= ", currenttime, 
NULL);
 
 2164        if (!strcasecmp(
var->name, 
"bookid")) {
 
 2167        if (!strcasecmp(
var->name, 
"endtime")) {
 
 2182    strcat(currenttime, 
"0"); 
 
 2185        confno, 
"startTime<= ", currenttime,
 
 2186        "endtime>= ", currenttime, 
NULL);
 
 2190        ast_debug(3, 
"Trying to update the endtime of Conference %s to %s\n", confno, currenttime);
 
 
 2206    ast_channel_musicclass_set(chan, musicclass);
 
 2212    ast_channel_musicclass_set(chan, original_moh);
 
 
 2220        return "conf-hasleft";
 
 2223        return "conf-hasjoin";
 
 
 2239    while (!
conf->announcethread_stop) {
 
 2241        if (
conf->announcethread_stop) {
 
 2252        if (
conf->announcethread_stop) {
 
 
 2304    int last_talking = 
user->talking;
 
 2305    if (last_talking == talking)
 
 2308    user->talking = talking;
 
 2312        int was_talking = (last_talking > 0);
 
 2313        int now_talking = (talking > 0);
 
 2314        if (was_talking != now_talking) {
 
 
 2597        if (
conf->users == 1) {
 
 2605        } 
else if (
conf->users == 2) {
 
 2663        if (
conf->users == 1) {
 
 2695            if (!
conf->recordingfilename) {
 
 2705                if (!
conf->recordingfilename) {
 
 2709                if (!
conf->recordingformat) {
 
 2712                ast_verb(4, 
"Starting recording of MeetMe Conference %s into file %s.%s.\n",
 
 2713                conf->confno, 
conf->recordingfilename, 
conf->recordingformat);
 
 2718                struct dahdi_confinfo dahdic;
 
 2723                dahdic.confno = 
conf->dahdiconf;
 
 2724                dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
 
 
 2775    switch (*menu_mode) {
 
 2789            recordingtmp, recordingtmp_size, cap_slin);
 
 
 2798    struct dahdi_confinfo dahdic, dahdic_empty;
 
 2808    int musiconhold = 0, mohtempstopped = 0;
 
 2811    int currentmarked = 0;
 
 2815    int talkreq_manager = 0;
 
 2816    int using_pseudo = 0;
 
 2820    int announcement_played = 0;
 
 2825    const char *agifiledefault = 
"conf-background.agi", *tmpvar;
 
 2826    char meetmesecs[30] = 
"";
 
 2829    char members[10] = 
"";
 
 2830    int dtmf = 0, opt_waitmarked_timeout = 0;
 
 2832    struct dahdi_bufferinfo bi;
 
 2835    char *exitkeys = 
NULL;
 
 2836    unsigned int calldurationlimit = 0;
 
 2838    long play_warning = 0;
 
 2839    long warning_freq = 0;
 
 2840    const char *warning_sound = 
NULL;
 
 2841    const char *end_sound = 
NULL;
 
 2843    long time_left_ms = 0;
 
 2844    struct timeval nexteventts = { 0, };
 
 2846    int setusercount = 0;
 
 2847    int confsilence = 0, totalsilence = 0;
 
 2848    char *mailbox, *context;
 
 2852        goto conf_run_cleanup;
 
 2857        goto conf_run_cleanup;
 
 2864        (opt_waitmarked_timeout > 0)) {
 
 2865        timeout = time(
NULL) + opt_waitmarked_timeout;
 
 2870        ast_verb(3, 
"Setting call duration limit to %u seconds.\n", calldurationlimit);
 
 2874        char *limit_str, *warning_str, *warnfreq_str;
 
 2878        limit_str = 
strsep(&parse, 
":");
 
 2879        warning_str = 
strsep(&parse, 
":");
 
 2880        warnfreq_str = parse;
 
 2882        timelimit = atol(limit_str);
 
 2884            play_warning = atol(warning_str);
 
 2886            warning_freq = atol(warnfreq_str);
 
 2889            timelimit = play_warning = warning_freq = 0;
 
 2890            warning_sound = 
NULL;
 
 2891        } 
else if (play_warning > timelimit) {
 
 2892            if (!warning_freq) {
 
 2895                while (play_warning > timelimit)
 
 2896                    play_warning -= warning_freq;
 
 2897                if (play_warning < 1)
 
 2898                    play_warning = warning_freq = 0;
 
 2902        ast_verb(3, 
"Setting conference duration limit to: %ldms.\n", timelimit);
 
 2904            ast_verb(3, 
"Setting warning time to %ldms from the conference duration limit.\n", play_warning);
 
 2907            ast_verb(3, 
"Setting warning frequency to %ldms.\n", warning_freq);
 
 2916        warning_sound = 
var ? 
var : 
"timeleft";
 
 2927        calldurationlimit = 0;
 
 2929        if (!play_warning && !end_sound && timelimit) {
 
 2930            calldurationlimit = timelimit / 1000;
 
 2931            timelimit = play_warning = warning_freq = 0;
 
 2933            ast_debug(2, 
"Limit Data for this call:\n");
 
 2934            ast_debug(2, 
"- timelimit     = %ld\n", timelimit);
 
 2935            ast_debug(2, 
"- play_warning  = %ld\n", play_warning);
 
 2936            ast_debug(2, 
"- warning_freq  = %ld\n", warning_freq);
 
 2937            ast_debug(2, 
"- warning_sound = %s\n", warning_sound ? warning_sound : 
"UNDEF");
 
 2938            ast_debug(2, 
"- end_sound     = %s\n", end_sound ? end_sound : 
"UNDEF");
 
 2951        if (!
conf->recordingfilename) {
 
 2961            if (!
conf->recordingfilename) {
 
 2965            if (!
conf->recordingformat) {
 
 2968            ast_verb(4, 
"Starting recording of MeetMe Conference %s into file %s.%s.\n",
 
 2969                    conf->confno, 
conf->recordingfilename, 
conf->recordingformat);
 
 2979        dahdic.confno = 
conf->dahdiconf;
 
 2980        dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
 
 3000    time(&
user->jointime);
 
 3002    user->timelimit = timelimit;
 
 3003    user->play_warning = play_warning;
 
 3004    user->warning_freq = warning_freq;
 
 3005    user->warning_sound = warning_sound;
 
 3006    user->end_sound = end_sound;
 
 3008    if (calldurationlimit > 0) {
 
 3009        time(&
user->kicktime);
 
 3010        user->kicktime = 
user->kicktime + calldurationlimit;
 
 3015    time_left_ms = 
user->timelimit;
 
 3017    if (
user->timelimit) {
 
 3032        if (
conf->users >= 
conf->maxusers) {
 
 3048    user->userflags = *confflags;
 
 3069            mailbox = 
strsep(&context, 
"@");
 
 3077                    context = 
"default";
 
 3080                snprintf(
user->namerecloc, 
sizeof(
user->namerecloc),
 
 3085                    snprintf(
user->namerecloc, 
sizeof(
user->namerecloc),
 
 3086                         "%s/meetme-username-%s-%d", destdir,
 
 3092            snprintf(
user->namerecloc, 
sizeof(
user->namerecloc),
 
 3093                 "%s/meetme-username-%s-%d", destdir,
 
 3110        conf->markedusers++;
 
 3114        snprintf(members, 
sizeof(members), 
"%d", 
conf->users);
 
 3124    if (
conf->users == 1)
 
 3160        int keepplaying = 1;
 
 3162        if (
conf->users == 2) {
 
 3219    user->dahdichannel = !retrydahdi;
 
 3225        fd = open(
"/dev/dahdi/pseudo", O_RDWR | O_NONBLOCK);
 
 3232        memset(&bi, 0, 
sizeof(bi));
 
 3234        bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
 
 3235        bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
 
 3237        if (ioctl(fd, DAHDI_SET_BUFINFO, &bi)) {
 
 3243        if (ioctl(fd, DAHDI_SETLINEAR, &x)) {
 
 3254    memset(&dahdic, 0, 
sizeof(dahdic));
 
 3255    memset(&dahdic_empty, 0, 
sizeof(dahdic_empty));
 
 3258    if (ioctl(fd, DAHDI_GETCONF, &dahdic)) {
 
 3263    if (dahdic.confmode) {
 
 3266            ast_debug(1, 
"DAHDI channel is in a conference already, retrying with pseudo\n");
 
 3271    memset(&dahdic, 0, 
sizeof(dahdic));
 
 3274    dahdic.confno = 
conf->dahdiconf;
 
 3302        dahdic.confmode = DAHDI_CONF_CONF;
 
 3304        dahdic.confmode = DAHDI_CONF_CONFMON | DAHDI_CONF_LISTENER;
 
 3306        dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER;
 
 3308        dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
 
 3310    if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
 
 3327                (
conf->markedusers >= 1))) {
 
 3354        if (
user->dahdichannel) {
 
 3362            ret = 
pbx_exec(chan, agi_app, agifile);
 
 3367        if (
user->dahdichannel) {
 
 3373        int lastusers = 
conf->users;
 
 3381            int menu_was_active = 0;
 
 3388                char currenttime[32];
 
 3389                long localendtime = 0;
 
 3395                if (now.tv_sec % 60 == 0) {
 
 3400                            conf->confno, 
"starttime <=", currenttime,
 
 3401                             "endtime >=", currenttime, 
NULL);
 
 3404                            if (!strcasecmp(
var->name, 
"endtime")) {
 
 3405                                struct ast_tm endtime_tm;
 
 3408                                localendtime = tmp.tv_sec;
 
 3415                        if (localendtime > 
conf->endtime){
 
 3416                            conf->endtime = localendtime;
 
 3420                        if (
conf->endtime && (now.tv_sec >= 
conf->endtime)) {
 
 3425                        if (!announcement_played && 
conf->endalert) {
 
 3426                            if (now.tv_sec + 
conf->endalert >= 
conf->endtime) {
 
 3435                                announcement_played = 1;
 
 3440                            announcement_played = 0;
 
 3450            if (
user->kicktime && (
user->kicktime <= now.tv_sec)) {
 
 3460            if (
user->timelimit) {
 
 3461                int minutes = 0, seconds = 0, remain = 0;
 
 3468                if (time_left_ms < to) {
 
 3472                if (time_left_ms <= 0) {
 
 3473                    if (
user->end_sound) {
 
 3486                    if (time_left_ms >= 5000) {
 
 3488                        remain = (time_left_ms + 500) / 1000;
 
 3489                        if (remain / 60 >= 1) {
 
 3490                            minutes = remain / 60;
 
 3491                            seconds = remain % 60;
 
 3497                        if (
user->warning_sound && 
user->play_warning) {
 
 3498                            if (!strcmp(
user->warning_sound, 
"timeleft")) {
 
 3521                    if (
user->warning_freq) {
 
 3530            if (timeout && now.tv_sec >= timeout) {
 
 3542            if (!menu_mode && menu_was_active && 
user->listen.desired && !
user->listen.actual) {
 
 3546            menu_was_active = menu_mode;
 
 3548            currentmarked = 
conf->markedusers;
 
 3553                if (currentmarked == 1 && 
conf->users > 1) {
 
 3555                    if (
conf->users - 1 == 1) {
 
 3573            user->userflags = *confflags;
 
 3576                if (currentmarked == 0) {
 
 3577                    if (lastmarked != 0) {
 
 3589                            dahdic.confmode = DAHDI_CONF_CONF;
 
 3590                            if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
 
 3601                } 
else if (currentmarked >= 1 && lastmarked == 0) {
 
 3605                        dahdic.confmode = DAHDI_CONF_CONFMON | DAHDI_CONF_LISTENER;
 
 3607                        dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER;
 
 3609                        dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
 
 3611                    if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
 
 3632                if (
conf->users == 1) {
 
 3656            if (
conf->users != lastusers) {
 
 3657                if (
conf->users < lastusers) {
 
 3660                lastusers = 
conf->users;
 
 3668                dahdic.confmode ^= DAHDI_CONF_TALKER;
 
 3669                if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
 
 3685                dahdic.confmode |= DAHDI_CONF_TALKER;
 
 3686                if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
 
 3698                talkreq_manager = 1;
 
 3705                talkreq_manager = 0;
 
 3734                char dtmfstr[2] = 
"";
 
 3742                    ast_debug(1, 
"Ooh, something swapped out under us, starting over\n");
 
 3744                    user->dahdichannel = !retrydahdi;
 
 3761                    if (
user->talk.actual) {
 
 3766                        if (
user->talking == -1) {
 
 3801                    if (ioctl(fd, DAHDI_SETCONF, &dahdic_empty)) {
 
 3811                    if (!menu_mode && 
user->talk.desired && !
user->talk.actual) {
 
 3817                    } 
else if (!menu_mode) {
 
 3821                            menu_to_play = 
"conf-adminmenu-18";
 
 3824                            menu_to_play = 
"conf-usermenu-162";
 
 3839                            chan, 
user, recordingtmp, 
sizeof(recordingtmp), cap_slin);
 
 3842                    if (musiconhold && !menu_mode) {
 
 3847                    if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
 
 3870                        ast_debug(2, 
"Exit by single digit did not work in meetme. Extension %s does not exist in context %s\n", dtmfstr, 
exitcontext);
 
 3896                            "Got ignored control frame on channel %s, f->frametype=%u,f->subclass=%d\n",
 
 3901                        "Got unrecognized frame on channel %s, f->frametype=%u,f->subclass=%d\n",
 
 3905            } 
else if (outfd > -1) {
 
 3908                    memset(&fr, 0, 
sizeof(fr));
 
 3915                    if (!
user->listen.actual &&
 
 3927                            goto bailoutandtrynormal;
 
 3930                        if (!
conf->transframe[idx]) {
 
 3931                            if (
conf->origframe) {
 
 3939                                if (!
conf->transpath[idx]) {
 
 3942                                if (
conf->transpath[idx]) {
 
 3944                                    if (!
conf->transframe[idx]) {
 
 3950                        if (
conf->transframe[idx]) {
 
 3970                            goto bailoutandtrynormal;
 
 3982                        if (
user->listen.actual) {
 
 3997            lastmarked = currentmarked;
 
 4011        dahdic.confmode = 0;
 
 4012        if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
 
 4052    if (
user->user_no) {
 
 4064                snprintf(members, 
sizeof(members), 
"%d", 
conf->users);
 
 4072                conf->markedusers--;
 
 4089        snprintf(meetmesecs, 
sizeof(meetmesecs), 
"%d", (
int) (time(
NULL) - 
user->jointime));
 
 
 4108                char *dynamic_pin, 
size_t pin_buf_len, 
int refcount, 
struct ast_flags64 *confflags, 
int *too_early, 
char **optargs)
 
 4131        char recordingfilename[256] = 
"";
 
 4132        char recordingformat[11] = 
"";
 
 4133        char currenttime[32] = 
"";
 
 4134        char eatime[32] = 
"";
 
 4135        char bookid[51] = 
"";
 
 4140        struct timeval endtime = { .tv_sec = 0 };
 
 4149            ast_debug(1, 
"Looking for conference %s that starts after %s\n", confno, currenttime);
 
 4152                confno, 
"starttime <= ", currenttime, 
"endtime >= ",
 
 4162                    confno, 
"starttime <= ", currenttime, 
"endtime >= ",
 
 4172                    confno, 
"starttime <= ", eatime, 
"endtime >= ",
 
 4197            if (!strcasecmp(
var->name, 
"pin")) {
 
 4199            } 
else if (!strcasecmp(
var->name, 
"adminpin")) {
 
 4201            } 
else if (!strcasecmp(
var->name, 
"bookId")) {
 
 4203            } 
else if (!strcasecmp(
var->name, 
"opts")) {
 
 4205            } 
else if (!strcasecmp(
var->name, 
"maxusers")) {
 
 4206                maxusers = atoi(
var->value);
 
 4207            } 
else if (!strcasecmp(
var->name, 
"adminopts")) {
 
 4209            } 
else if (!strcasecmp(
var->name, 
"recordingfilename")) {
 
 4211            } 
else if (!strcasecmp(
var->name, 
"recordingformat")) {
 
 4213            } 
else if (!strcasecmp(
var->name, 
"endtime")) {
 
 4214                struct ast_tm endtime_tm;
 
 4222        cnf = 
build_conf(confno, pin ? pin : 
"", pinadmin ? pinadmin : 
"", make, dynamic, refcount, chan, 
NULL);
 
 4229            cnf->
endtime = endtime.tv_sec;
 
 4280            ast_log(
LOG_WARNING, 
"No DAHDI channel available for conference, user introduction disabled (is chan_dahdi loaded?)\n");
 
 4284        if (confflags && !cnf->
chan &&
 
 4286            ast_log(
LOG_WARNING, 
"No DAHDI channel available for conference, conference recording disabled (is chan_dahdi loaded?)\n");
 
 
 4326                if (dynamic_pin[0] == 
'q') {
 
 4349                if (strcasecmp(
var->name, 
"conf"))
 
 4370    } 
else if (dynamic_pin) {
 
 4374        if (dynamic_pin[0] == 
'q') {
 
 4375            dynamic_pin[0] = 
'\0';
 
 4380        if (confflags && !cnf->
chan &&
 
 4383            ast_log(
LOG_WARNING, 
"No DAHDI channel available for conference, user introduction disabled (is chan_dahdi loaded?)\n");
 
 4387        if (confflags && !cnf->
chan &&
 
 4389            ast_log(
LOG_WARNING, 
"No DAHDI channel available for conference, conference recording disabled (is chan_dahdi loaded?)\n");
 
 
 4422        count = 
conf->users;
 
 4430        snprintf(
val, 
sizeof(
val), 
"%d", count);
 
 
 4453    int empty = 0, empty_no_pin = 0;
 
 4454    int always_prompt = 0;
 
 4455    const char *notdata;
 
 4456    char *info, the_pin[
MAX_PIN] = 
"";
 
 4492            strcpy(the_pin, 
"q");
 
 4509            if ((empty_no_pin) || (!dynamic)) {
 
 4514                        char parse[
MAX_SETTINGS], *stringp = parse, *confno_tmp;
 
 4515                        if (!strcasecmp(
var->name, 
"conf")) {
 
 4518                            confno_tmp = 
strsep(&stringp, 
"|,");
 
 4523                                    if (!strcmp(confno_tmp, cnf->
confno)) {
 
 4562                                if (!strcmp(confno_tmp, cnf->
confno)) {
 
 4591                        snprintf(confno, 
sizeof(confno), 
"%d", i);
 
 4606                if (sscanf(confno, 
"%30d", &confno_int) == 1) {
 
 4622            res = 
ast_app_getdata(chan, 
"conf-getconfno", confno, 
sizeof(confno) - 1, 0);
 
 4632            cnf = 
find_conf(chan, confno, 1, dynamic, the_pin,
 
 4633                sizeof(the_pin), 1, &confflags);
 
 4638                    the_pin, 
sizeof(the_pin), 1, &confflags, &too_early, optargs);
 
 4672                if (req_pin && not_exempt) {
 
 4677                    for (j = 0; j < 3; j++) {
 
 4678                        if (*the_pin && (always_prompt == 0)) {
 
 4686                            res = 
ast_app_getdata(chan, 
"conf-getpin", pin + strlen(pin), 
sizeof(pin) - 1 - strlen(pin), 0);
 
 4689                            if ((!strcasecmp(pin, cnf->
pin) &&
 
 4693                                  !strcasecmp(pin, cnf->
pinadmin))) {
 
 4709                                res = 
conf_run(chan, cnf, &confflags, optargs);
 
 4737                        if (*the_pin && (always_prompt == 0)) {
 
 4754                    res = 
conf_run(chan, cnf, &confflags, optargs);
 
 4760    } 
while (allowretry);
 
 
 4773    if (
conf && callerident && sscanf(callerident, 
"%30d", &cid) == 1) {
 
 
 4819    const char *channel = 
args;
 
 
 4853    if (!
args.command) {
 
 4887        switch (*
args.command) {
 
 4904    switch (*
args.command) {
 
 
 5021    if (!
args.channel) {
 
 5026    if (!
args.command) {
 
 5045    switch (*
args.command) {
 
 5050            user->adminflags &= ~ADMINFLAG_MUTED;
 
 
 5083    userno = strtoul(userid, &userid, 10);
 
 5093        if (!strcmp(confid, 
conf->confno))
 
 
 5139    char idText[80] = 
"";
 
 5146        snprintf(idText, 
sizeof(idText), 
"ActionID: %s\r\n", actionid);
 
 5167                "Event: MeetmeList\r\n" 
 5169                "Conference: %s\r\n" 
 5170                "UserNumber: %d\r\n" 
 5171                "CallerIDNum: %s\r\n" 
 5172                "CallerIDName: %s\r\n" 
 5173                "ConnectedLineNum: %s\r\n" 
 5174                "ConnectedLineName: %s\r\n" 
 5178                "MarkedUser: %s\r\n" 
 5194                user->talking > 0 ? 
"Yes" : 
user->talking == 0 ? 
"No" : 
"Not monitored");
 
 
 5210    char idText[80] = 
"";
 
 5218        snprintf(idText, 
sizeof(idText), 
"ActionID: %s\r\n", actionid);
 
 5240        hr = (now - cnf->
start) / 3600;
 
 5241        min = ((now - cnf->
start) % 3600) / 60;
 
 5242        sec = (now - cnf->
start) % 60;
 
 5245        "Event: MeetmeListRooms\r\n" 
 5247        "Conference: %s\r\n" 
 5250        "Activity: %2.2d:%2.2d:%2.2d\r\n" 
 5260        cnf->
locked ? 
"Yes" : 
"No");
 
 
 5281    } 
else if (filename[0] != 
'/') {
 
 5288    if ((slash = strrchr(slash, 
'/'))) {
 
 
 5303    const char *oldrecordingfilename = 
NULL;
 
 5306    if (!cnf || !cnf->
lchan) {
 
 5310    filename_buffer[0] = 
'\0';
 
 5314    flags = O_CREAT | O_TRUNC | O_WRONLY;
 
 5324        if (!s && !(
ast_strlen_zero(filename_buffer)) && (filename_buffer != oldrecordingfilename)) {
 
 5326            oldrecordingfilename = filename_buffer;
 
 
 5371        if (!strcmp(data, 
conf->confno))
 
 
 5429                DAHDI_DEFAULT_NUM_BUFS, DAHDI_MAX_NUM_BUFS);
 
 
 5470    if (!strcasecmp(
"lock", keyword)) {
 
 5471        return conf->locked;
 
 5472    } 
else if (!strcasecmp(
"parties", keyword)) {
 
 5474    } 
else if (!strcasecmp(
"activity", keyword)) {
 
 5477        return (now - 
conf->start);
 
 5478    } 
else if (!strcasecmp(
"dynamic", keyword)) {
 
 5479        return conf->isdynamic;
 
 
 5510        ast_log(
LOG_ERROR, 
"Syntax: MEETME_INFO() requires a conference number\n");
 
 5516        if (!strcmp(
args.confno, 
conf->confno)) {
 
 5525    } 
else if (
result == -1) {
 
 5528    } 
else if (
result == -2) {
 
 
 5537    .
name = 
"MEETME_INFO",
 
 
 5619    .optional_modules = 
"func_speex",
 
void ast_cli_unregister_multiple(void)
static int load_config(void)
static int action_meetmeunmute(struct mansession *s, const struct message *m)
static void meetme_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static int user_no_cmp(void *obj, void *arg, int flags)
@ MEETME_RECORD_TERMINATE
static struct ast_custom_function meetme_info_acf
static const char * get_announce_filename(enum announcetypes type)
static void tweak_listen_volume(struct ast_conf_user *user, enum volume_action action)
static int rt_log_members
static int user_set_kickme_cb(void *obj, void *check_admin_arg, int flags)
static void meetme_menu_normal(enum menu_modes *menu_mode, int *dtmf, struct ast_conference *conf, struct ast_flags64 *confflags, struct ast_channel *chan, struct ast_conf_user *user)
static int dispose_conf(struct ast_conference *conf)
Decrement reference counts, as incremented by find_conf()
static const struct ast_app_option meetme_opts[128]
static char * meetme_show_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int careful_write(int fd, unsigned char *data, int len, int block)
static unsigned int conf_map[1024]
static int user_max_cmp(void *obj, void *arg, int flags)
static int count_exec(struct ast_channel *chan, const char *data)
The MeetmeCount application.
static int conf_free(struct ast_conference *conf)
Remove the conference from the list and free it.
#define CONFFLAG_DONT_DENOISE
static int rt_extend_conf(const char *confno)
static struct ast_cli_entry cli_meetme[]
static void * recordthread(void *args)
#define MEETME_DELAYDETECTENDTALK
static int user_reset_vol_cb(void *obj, void *unused, int flags)
static const char *const app
static struct ast_conference * find_conf_realtime(struct ast_channel *chan, char *confno, int make, int dynamic, char *dynamic_pin, size_t pin_buf_len, int refcount, struct ast_flags64 *confflags, int *too_early, char **optargs)
static void conf_flush(int fd, struct ast_channel *chan)
static int can_write(struct ast_channel *chan, struct ast_flags64 *confflags)
static void tweak_volume(struct volume *vol, enum volume_action action)
@ CONFFLAG_INTROUSERNOREVIEW
@ CONFFLAG_OPTIMIZETALKER
@ CONFFLAG_ANNOUNCEUSERCOUNT
@ CONFFLAG_DURATION_LIMIT
static int set_talk_volume(struct ast_conf_user *user, int volume)
static char * meetme_cmd_helper(struct ast_cli_args *a)
@ OPT_ARG_INTROUSER_VMREC
static int user_chan_cb(void *obj, void *args, int flags)
static void meetme_stasis_generate_msg(struct ast_conference *meetme_conference, struct ast_channel *chan, struct ast_conf_user *user, struct stasis_message_type *message_type, struct ast_json *extras)
static const char *const app4
static const char *const app2
static void reset_volumes(struct ast_conf_user *user)
static void meetme_set_defaults(void)
static void conf_start_moh(struct ast_channel *chan, const char *musicclass)
static void meetme_menu_admin(enum menu_modes *menu_mode, int *dtmf, struct ast_conference *conf, struct ast_flags64 *confflags, struct ast_channel *chan, struct ast_conf_user *user)
static const char * istalking(int x)
static void conf_play(struct ast_channel *chan, struct ast_conference *conf, enum entrance_sound sound)
static const char gain_map[]
Map 'volume' levels from -5 through +5 into decibel (dB) settings for channel drivers.
static int meetmemute(struct mansession *s, const struct message *m, int mute)
static char * meetme_mute_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int acf_meetme_info_eval(const char *keyword, const struct ast_conference *conf)
static void filename_parse(char *filename, char *buffer)
static void meetme_stasis_cleanup(void)
static char * complete_meetmecmd_list(const char *line, const char *word, int pos, int state)
static void send_talking_event(struct ast_channel *chan, struct ast_conference *conf, struct ast_conf_user *user, int talking)
static struct ast_conf_user * find_user(struct ast_conference *conf, const char *callerident)
static void meetme_menu(enum menu_modes *menu_mode, int *dtmf, struct ast_conference *conf, struct ast_flags64 *confflags, struct ast_channel *chan, struct ast_conf_user *user, char *recordingtmp, int recordingtmp_size, struct ast_format_cap *cap_slin)
static int user_set_muted_cb(void *obj, void *check_admin_arg, int flags)
static void * announce_thread(void *data)
static int set_listen_volume(struct ast_conf_user *user, int volume)
static int channel_admin_exec(struct ast_channel *chan, const char *data)
The MeetMeChannelAdmin application MeetMeChannelAdmin(channel, command)
static void tweak_talk_volume(struct ast_conf_user *user, enum volume_action action)
static const char *const app3
static enum ast_device_state meetmestate(const char *data)
Callback for devicestate providers.
static char * complete_meetmecmd_lock(const char *word, int pos, int state)
static int action_meetmelist(struct mansession *s, const struct message *m)
static int admin_exec(struct ast_channel *chan, const char *data)
The MeetMeAdmin application.
static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struct ast_flags64 *confflags, char *optargs[])
#define CONFFLAG_KILL_LAST_MAN_STANDING
static int action_meetmemute(struct mansession *s, const struct message *m)
static int user_set_unmuted_cb(void *obj, void *check_admin_arg, int flags)
static struct stasis_message_router * meetme_event_message_router
static char * complete_confno(const char *word, int state)
static int user_set_hangup_cb(void *obj, void *check_admin_arg, int flags)
static int user_talk_voldown_cb(void *obj, void *unused, int flags)
static char * complete_meetmecmd_mute_kick(const char *line, const char *word, int pos, int state)
static int meetme_stasis_init(void)
#define CONFFLAG_INTROUSER_VMREC
static int load_module(void)
Load the module.
static int user_listen_volup_cb(void *obj, void *unused, int flags)
#define CONFFLAG_INTROMSG
#define MEETME_DELAYDETECTTALK
static struct ast_conference * build_conf(const char *confno, const char *pin, const char *pinadmin, int make, int dynamic, int refcount, const struct ast_channel *chan, struct ast_test *test)
Find or create a conference.
static void load_config_meetme(int reload)
static int conf_exec(struct ast_channel *chan, const char *data)
The meetme() application.
#define CONFFLAG_NO_AUDIO_UNTIL_UP
static char * meetme_lock_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int audio_buffers
The number of audio buffers to be allocated on pseudo channels when in a conference.
static int unload_module(void)
static char * meetme_kick_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct ast_conference * find_conf(struct ast_channel *chan, char *confno, int make, int dynamic, char *dynamic_pin, size_t pin_buf_len, int refcount, struct ast_flags64 *confflags)
static void conf_queue_dtmf(const struct ast_conference *conf, const struct ast_conf_user *sender, struct ast_frame *f)
static void set_user_talking(struct ast_channel *chan, struct ast_conference *conf, struct ast_conf_user *user, int talking, int monitor)
static void meetme_menu_admin_extended(enum menu_modes *menu_mode, int *dtmf, struct ast_conference *conf, struct ast_flags64 *confflags, struct ast_channel *chan, struct ast_conf_user *user, char *recordingtmp, int recordingtmp_size, struct ast_format_cap *cap_slin)
static int user_listen_voldown_cb(void *obj, void *unused, int flags)
static int action_meetmelistrooms(struct mansession *s, const struct message *m)
static int acf_meetme_info(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static char * complete_userno(struct ast_conference *cnf, const char *word, int state)
static int user_talk_volup_cb(void *obj, void *unused, int flags)
#define DEFAULT_AUDIO_BUFFERS
static struct ast_json * status_to_json(int on)
static char exitcontext[AST_MAX_CONTEXT]
char * strsep(char **str, const char *delims)
char * strcasestr(const char *, const char *)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_calloc(num, len)
A wrapper for calloc()
#define ao2_iterator_next(iter)
#define ao2_link(container, obj)
Add an object to a container.
@ AO2_ALLOC_OPT_LOCK_MUTEX
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
#define ao2_unlink(container, obj)
Remove an object from a container.
#define ao2_find(container, arg, flags)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a list container.
#define ao2_alloc(data_size, destructor_fn)
Internal Asterisk hangup causes.
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
struct ast_channel * ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, int nfds, int *exception, int *outfd, int *ms)
Waits for activity on a group of channels.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
const char * ast_channel_musicclass(const struct ast_channel *chan)
struct stasis_topic * ast_channel_topic(struct ast_channel *chan)
A topic which publishes the events for a particular channel.
#define ast_channel_lock(chan)
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
const char * ast_channel_uniqueid(const struct ast_channel *chan)
const char * ast_channel_context(const struct ast_channel *chan)
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
int ast_channel_fd(const struct ast_channel *chan, int which)
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
struct ast_audiohook_list * ast_channel_audiohooks(const struct ast_channel *chan)
struct ast_format * ast_channel_rawwriteformat(struct ast_channel *chan)
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
struct ast_frame * ast_read_noaudio(struct ast_channel *chan)
Reads a frame, returning AST_FRAME_NULL frame if audio.
int ast_softhangup(struct ast_channel *chan, int cause)
Softly hangup up a channel.
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
const char * ast_channel_language(const struct ast_channel *chan)
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
int ast_answer(struct ast_channel *chan)
Answer a channel.
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
int ast_safe_sleep(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups.
struct ast_channel * ast_request(const char *type, struct ast_format_cap *request_cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
Requests a channel.
@ AST_SOFTHANGUP_EXPLICIT
#define ast_channel_unlock(chan)
#define AST_MAX_EXTENSION
ast_channel_state
ast_channel states
Standard Command Line Interface.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
int ast_devstate_prov_del(const char *label)
Remove device state provider.
@ AST_DEVSTATE_NOT_CACHABLE
int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt,...)
Tells Asterisk the State for Device is changed.
int ast_devstate_prov_add(const char *label, ast_devstate_prov_cb_type callback)
Add device state provider.
ast_device_state
Device States.
Convenient Signal Processing routines.
void ast_dsp_free(struct ast_dsp *dsp)
int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence)
Process the audio frame for silence.
int ast_dsp_get_threshold_from_settings(enum threshold which)
Get silence threshold from dsp.conf.
struct ast_dsp * ast_dsp_new(void)
Allocates a new dsp, assumes 8khz for internal sample rate.
static unsigned char enter[]
Generic File Format Support. Should be included by clients of the file handling routines....
int ast_stopstream(struct ast_channel *c)
Stops a stream.
int ast_writestream(struct ast_filestream *fs, struct ast_frame *f)
Writes a frame to a stream.
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
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.
int ast_closestream(struct ast_filestream *f)
Closes a stream.
int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
Checks for the existence of a given file.
int ast_filedelete(const char *filename, const char *fmt)
Deletes a file.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
void astman_append(struct mansession *s, const char *fmt,...)
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
struct stasis_topic * ast_channel_topic_all(void)
A topic which publishes the events for all channels.
struct stasis_message * ast_channel_blob_create(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
Creates a ast_channel_blob message.
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
enum ast_getdata_result ast_app_getdata(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout)
Plays a stream and gets DTMF data from a channel.
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...
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
int ast_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.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
int ast_app_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.
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
int ast_realtime_require_field(const char *family,...) attribute_sentinel
Inform realtime what fields that may be stored.
struct ast_config * ast_load_realtime_multientry(const char *family,...) attribute_sentinel
Retrieve realtime configuration.
int ast_unload_realtime(const char *family)
Release any resources cached for a realtime family.
#define CONFIG_STATUS_FILEINVALID
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
int ast_update_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Update realtime configuration.
struct ast_variable * ast_load_realtime(const char *family,...) attribute_sentinel
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
#define AST_OPTION_TONE_VERIFY
#define AST_OPTION_RXGAIN
#define ast_frdup(fr)
Copies a frame.
int ast_frame_adjust_volume(struct ast_frame *f, int adjustment)
Adjusts the volume of the audio samples contained in a frame.
#define AST_OPTION_TXGAIN
#define AST_FRIENDLY_OFFSET
Offset into a frame's data buffer.
struct ast_frame ast_null_frame
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
Asterisk JSON abstraction layer.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
struct ast_json * ast_json_integer_create(intmax_t value)
Create a JSON integer.
int ast_json_object_set(struct ast_json *object, const char *key, struct ast_json *value)
Set a field in a JSON object.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
intmax_t ast_json_integer_get(const struct ast_json *integer)
Get the value from a JSON integer.
int ast_json_object_update(struct ast_json *object, struct ast_json *other)
Update object with all of the fields of other.
static unsigned char leave[]
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
#define AST_LIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_LOCK(head)
Locks a list.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define AST_LIST_APPEND_LIST(head, list, field)
Appends a whole list to the tail of a list.
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm)
Special version of strftime(3) that handles fractions of a second. Takes the same arguments as strfti...
struct timeval ast_mktime(struct ast_tm *const tmp, const char *zone)
Timezone-independent version of mktime(3).
char * ast_strptime(const char *s, const char *format, struct ast_tm *tm)
Special version of strptime(3) which places the answer in the common structure ast_tm....
Asterisk locking-related definitions:
#define ast_cond_wait(cond, mutex)
#define AST_PTHREADT_NULL
#define ast_mutex_init(pmutex)
#define ast_mutex_unlock(a)
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
pthread_cond_t ast_cond_t
#define ast_mutex_destroy(a)
#define ast_mutex_lock(a)
int ast_atomic_dec_and_test(volatile int *p)
decrement *p by 1 and return true if the variable has reached 0.
#define ast_cond_signal(cond)
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
#define EVENT_FLAG_REPORTING
#define manager_event(category, event, contents,...)
External routines may send asterisk manager events this way.
struct ast_str * ast_manager_build_channel_state_string(const struct ast_channel_snapshot *snapshot)
Generate the AMI message body from a channel snapshot.
int ast_str_append_event_header(struct ast_str **fields_string, const char *header, const char *value)
append an event header to an ast string
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_DEVSTATE_PROVIDER
@ AST_MODULE_SUPPORT_DEPRECATED
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_SPOOL_DIR
Core PBX routines and definitions.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
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.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority)
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
struct ast_app * pbx_findapp(const char *app)
Look up an application.
int ast_func_write(struct ast_channel *chan, const char *function, const char *value)
executes a write operation on a function
static struct stasis_subscription * sub
Statsd channel stats. Exmaple of how to subscribe to Stasis events.
Say numbers and dates (maybe words one day too)
int ast_say_digits(struct ast_channel *chan, int num, const char *ints, const char *lang)
says digits
int ast_say_number(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options)
says a number
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
#define STASIS_MESSAGE_TYPE_CLEANUP(name)
Boiler-plate messaging macro for cleaning up message types.
#define STASIS_MESSAGE_TYPE_DEFN_LOCAL(name,...)
Boiler-plate messaging macro for defining local message types.
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
void stasis_publish(struct stasis_topic *topic, struct stasis_message *message)
Publish a message to a topic's subscribers.
#define stasis_message_router_create(topic)
Create a new message router object.
void stasis_message_router_unsubscribe(struct stasis_message_router *router)
Unsubscribe the router from the upstream topic.
int stasis_message_router_add(struct stasis_message_router *router, struct stasis_message_type *message_type, stasis_subscription_cb callback, void *data)
Add a route to a message router.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
char *attribute_pure ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char namerecloc[PATH_MAX]
enum announcetypes announcetype
struct ast_channel * confchan
char language[MAX_LANGUAGE]
struct announce_listitem::@34 entry
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
ast_app: A registered application
Blob of data associated with a channel.
struct ast_channel_snapshot * snapshot
Structure to describe a channel "technology", ie a channel driver See for examples:
Main Channel structure associated with a channel.
descriptor for a cli entry.
char namerecloc[PATH_MAX]
const char * warning_sound
struct ast_flags64 userflags
struct ast_channel * chan
struct timeval start_time
struct ast_conf_user::@37 list
The MeetMe Conference object.
struct ast_conference::@35 list
struct ast_conference::@36 announcelist
struct ast_frame * transframe[32]
struct ast_trans_pvt * transpath[32]
struct ao2_container * usercontainer
ast_mutex_t announcethreadlock
ast_mutex_t recordthreadlock
ast_mutex_t announcelistlock
struct ast_channel * chan
struct ast_channel * lchan
ast_cond_t announcelist_addition
unsigned int announcethread_stop
struct ast_frame * origframe
enum recording_state recording
Data structure associated with a custom dialplan function.
This structure is allocated by file.c in one chunk, together with buf_size and desc_size bytes of mem...
Structure used to handle a large number of boolean flags == used only in app_dial?
Structure used to handle boolean flags.
struct ast_format * format
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
enum ast_frame_type frametype
union ast_frame::@239 data
Abstract JSON element (object, array, string, int, ...).
Structure for mutex and tracking information.
struct ast_party_id id
Caller party ID.
struct ast_party_id id
Connected party ID.
struct ast_party_name name
Subscriber name.
struct ast_party_number number
Subscriber phone number.
unsigned char valid
TRUE if the name information is valid/present.
char * str
Subscriber name (Malloced)
unsigned char valid
TRUE if the number information is valid/present.
char * str
Subscriber phone number (Malloced)
Support for dynamic strings.
Default structure for translators, with the basic fields and buffers, all allocated as part of the sa...
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
All configuration options for http media cache.
In case you didn't read that giant block of text above the mansession_session struct,...
structure to hold users read from phoneprov_users.conf
#define ast_test_status_update(a, b, c...)
#define ast_test_suite_event_notify(s, f,...)
static struct aco_type item
struct timeval ast_samp2tv(unsigned int _nsamp, unsigned int _rate)
Returns a timeval corresponding to the duration of n samples at rate r. Useful to convert samples to ...
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
struct timeval ast_tvsub(struct timeval a, struct timeval b)
Returns the difference of two timevals a - b.
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Support for translation of data formats. translate.c.
struct ast_frame * ast_translate(struct ast_trans_pvt *tr, struct ast_frame *f, int consume)
translates one or more frames Apply an input frame into the translator and receive zero or one output...
void ast_translator_free_path(struct ast_trans_pvt *tr)
Frees a translator path Frees the given translator path structure.
struct ast_trans_pvt * ast_translator_build_path(struct ast_format *dest, struct ast_format *source)
Builds a translator path Build a path (possibly NULL) from source to dest.
u-Law to Signed linear conversion
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_test_flag64(p, flag)
#define ast_clear_flag64(p, flag)
#define ast_pthread_create_background(a, b, c, d)
int ast_mkdir(const char *path, int mode)
Recursively create directory path.
#define ast_pthread_create_detached_background(a, b, c, d)
#define ast_copy_flags64(dest, src, flagz)
#define ast_set_flag64(p, flag)