app_queue: Cleanup queue_ref / queue_unref routines.
[asterisk/asterisk.git] / apps / app_meetme.c
index 5567fe0..40c0bd2 100644 (file)
@@ -25,7 +25,7 @@
  *
  * \author Mark Spencer <markster@digium.com>
  * \author (SLA) Russell Bryant <russell@digium.com>
- * 
+ *
  * \ingroup applications
  */
 
@@ -33,7 +33,7 @@
  * \addtogroup configuration_file Configuration Files
  */
 
-/*! 
+/*!
  * \page meetme.conf meetme.conf
  * \verbinclude meetme.conf.sample
  */
                                <parameter name="Meetme">
                                        <para>The identifier for the MeetMe conference.</para>
                                </parameter>
-                               <parameter name="Usernum">
+                               <parameter name="User">
                                        <para>The identifier of the MeetMe user who joined.</para>
                                </parameter>
                                <channel_snapshot/>
@@ -695,7 +695,7 @@ enum {
        CONFFLAG_TALKER = (1 << 4),
        /*! If set there will be no enter or leave sounds */
        CONFFLAG_QUIET = (1 << 5),
-       /*! If set, when user joins the conference, they will be told the number 
+       /*! If set, when user joins the conference, they will be told the number
         *  of users that are already in */
        CONFFLAG_ANNOUNCEUSERCOUNT = (1 << 6),
        /*! Set to run AGI Script in Background */
@@ -723,10 +723,10 @@ enum {
        CONFFLAG_ALWAYSPROMPT = (1 << 20),
        /*! If set, treat talking users as muted users */
        CONFFLAG_OPTIMIZETALKER = (1 << 21),
-       /*! If set, won't speak the extra prompt when the first person 
+       /*! If set, won't speak the extra prompt when the first person
         *  enters the conference */
        CONFFLAG_NOONLYPERSON = (1 << 22),
-       /*! If set, user will be asked to record name on entry of conference 
+       /*! If set, user will be asked to record name on entry of conference
         *  without review */
        CONFFLAG_INTROUSERNOREVIEW = (1 << 23),
        /*! If set, the user will be initially self-muted */
@@ -741,7 +741,7 @@ enum {
        CONFFLAG_DURATION_LIMIT = (1 << 30),
 };
 
-/* These flags are defined separately because we ran out of bits that an enum can be used to represent. 
+/* These flags are defined separately because we ran out of bits that an enum can be used to represent.
    If you add new flags, be sure to do it in the same way that these are. */
 /*! Do not write any audio to this channel until the state is up. */
 #define CONFFLAG_NO_AUDIO_UNTIL_UP  (1ULL << 31)
@@ -942,9 +942,9 @@ struct sla_trunk_ref;
 struct sla_station {
        AST_RWLIST_ENTRY(sla_station) entry;
        AST_DECLARE_STRING_FIELDS(
-               AST_STRING_FIELD(name); 
-               AST_STRING_FIELD(device);       
-               AST_STRING_FIELD(autocontext);  
+               AST_STRING_FIELD(name);
+               AST_STRING_FIELD(device);
+               AST_STRING_FIELD(autocontext);
        );
        AST_LIST_HEAD_NOLOCK(, sla_trunk_ref) trunks;
        struct ast_dial *dial;
@@ -982,7 +982,7 @@ struct sla_trunk {
        AST_DECLARE_STRING_FIELDS(
                AST_STRING_FIELD(name);
                AST_STRING_FIELD(device);
-               AST_STRING_FIELD(autocontext);  
+               AST_STRING_FIELD(autocontext);
        );
        AST_LIST_HEAD_NOLOCK(, sla_station_ref) stations;
        /*! Number of stations that use this trunk */
@@ -1051,7 +1051,7 @@ struct sla_event {
        AST_LIST_ENTRY(sla_event) entry;
 };
 
-/*! \brief A station that failed to be dialed 
+/*! \brief A station that failed to be dialed
  * \note Only used by the SLA thread. */
 struct sla_failed_station {
        struct sla_station *station;
@@ -1105,7 +1105,7 @@ static struct {
  *  when in a conference */
 static int audio_buffers;
 
-/*! \brief Map 'volume' levels from -5 through +5 into decibel (dB) 
+/*! \brief Map 'volume' levels from -5 through +5 into decibel (dB)
  *    settings for channel drivers.
  *
  *  \note these are not a straight linear-to-dB
@@ -1401,7 +1401,7 @@ static const char *istalking(int x)
                return "(talking)";
        else if (x < 0)
                return "(unmonitored)";
-       else 
+       else
                return "(not talking)";
 }
 
@@ -1460,7 +1460,7 @@ static void tweak_volume(struct volume *vol, enum volume_action action)
 {
        switch (action) {
        case VOL_UP:
-               switch (vol->desired) { 
+               switch (vol->desired) {
                case 5:
                        break;
                case 0:
@@ -1560,7 +1560,7 @@ static void conf_play(struct ast_channel *chan, struct ast_conference *conf, enu
 
        AST_LIST_UNLOCK(&confs);
 
-       if (!res) 
+       if (!res)
                ast_autoservice_stop(chan);
 }
 
@@ -1615,7 +1615,7 @@ static struct ast_conference *build_conf(const char *confno, const char *pin,
        AST_LIST_LOCK(&confs);
 
        AST_LIST_TRAVERSE(&confs, cnf, list) {
-               if (!strcmp(confno, cnf->confno)) 
+               if (!strcmp(confno, cnf->confno))
                        break;
        }
 
@@ -1705,7 +1705,7 @@ static struct ast_conference *build_conf(const char *confno, const char *pin,
        /* Reserve conference number in map */
        if ((sscanf(cnf->confno, "%30d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024))
                conf_map[confno_int] = 1;
-       
+
 cnfout:
        ao2_cleanup(cap_slin);
        if (cnf)
@@ -1961,7 +1961,7 @@ static char *meetme_show_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
                                        ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "(Listen only)" : "",
                                        user->adminflags & ADMINFLAG_MUTED ? "(Admin Muted)" : user->adminflags & ADMINFLAG_SELFMUTED ? "(Muted)" : "",
                                        user->adminflags & ADMINFLAG_T_REQUEST ? "(Request to Talk)" : "",
-                                       istalking(user->talking), hr, min, sec); 
+                                       istalking(user->talking), hr, min, sec);
                        } else {
                                ast_cli(a->fd, "%d!%s!%s!%s!%s!%s!%s!%s!%d!%02d:%02d:%02d\n",
                                        user->user_no,
@@ -2006,13 +2006,13 @@ static char *meetme_cmd_helper(struct ast_cli_args *a)
                        /* Unlock */
                        ast_str_append(&cmdline, 0, ",l");
                }
-       } else if (strcasestr(a->argv[1], "mute")) { 
+       } else if (strcasestr(a->argv[1], "mute")) {
                if (strcasecmp(a->argv[1], "mute") == 0) {
                        /* Mute */
                        if (strcasecmp(a->argv[3], "all") == 0) {
                                ast_str_append(&cmdline, 0, ",N");
                        } else {
-                               ast_str_append(&cmdline, 0, ",M,%s", a->argv[3]);       
+                               ast_str_append(&cmdline, 0, ",M,%s", a->argv[3]);
                        }
                } else {
                        /* Unmute */
@@ -2164,8 +2164,8 @@ static char *sla_show_trunks(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
                            "=== ==> BargeAllowed: %s\n"
                            "=== ==> HoldAccess:   %s\n"
                            "=== ==> Stations ...\n",
-                           trunk->name, trunk->device, 
-                           S_OR(trunk->autocontext, "(none)"), 
+                           trunk->name, trunk->device,
+                           S_OR(trunk->autocontext, "(none)"),
                            ring_timeout,
                            trunk->barge_disabled ? "No" : "Yes",
                            sla_hold_str(trunk->hold_access));
@@ -2214,7 +2214,7 @@ static char *sla_show_stations(struct ast_cli_entry *e, int cmd, struct ast_cli_
                return NULL;
        }
 
-       ast_cli(a->fd, "\n" 
+       ast_cli(a->fd, "\n"
                    "=============================================================\n"
                    "=== Configured SLA Stations =================================\n"
                    "=============================================================\n"
@@ -2228,11 +2228,11 @@ static char *sla_show_stations(struct ast_cli_entry *e, int cmd, struct ast_cli_
                ao2_lock(station);
 
                if (station->ring_timeout) {
-                       snprintf(ring_timeout, sizeof(ring_timeout), 
+                       snprintf(ring_timeout, sizeof(ring_timeout),
                                "%u", station->ring_timeout);
                }
                if (station->ring_delay) {
-                       snprintf(ring_delay, sizeof(ring_delay), 
+                       snprintf(ring_delay, sizeof(ring_delay),
                                "%u", station->ring_delay);
                }
                ast_cli(a->fd, "=== ---------------------------------------------------------\n"
@@ -2244,7 +2244,7 @@ static char *sla_show_stations(struct ast_cli_entry *e, int cmd, struct ast_cli_
                            "=== ==> HoldAccess:  %s\n"
                            "=== ==> Trunks ...\n",
                            station->name, station->device,
-                           S_OR(station->autocontext, "(none)"), 
+                           S_OR(station->autocontext, "(none)"),
                            ring_timeout, ring_delay,
                            sla_hold_str(station->hold_access));
                AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) {
@@ -2356,7 +2356,7 @@ static int conf_free(struct ast_conference *conf)
                ast_cond_signal(&conf->announcelist_addition);
                ast_mutex_unlock(&conf->announcelistlock);
                pthread_join(conf->announcethread, NULL);
-       
+
                while ((item = AST_LIST_REMOVE_HEAD(&conf->announcelist, entry))) {
                        /* If it's a voicemail greeting file we don't want to remove it */
                        if (!item->vmrec){
@@ -2410,7 +2410,7 @@ static void conf_queue_dtmf(const struct ast_conference *conf,
        ao2_iterator_destroy(&user_iter);
 }
 
-static void sla_queue_event_full(enum sla_event_type type, 
+static void sla_queue_event_full(enum sla_event_type type,
        struct sla_trunk_ref *trunk_ref, struct sla_station *station, int lock)
 {
        struct sla_event *event;
@@ -3323,7 +3323,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                else
                        exitkeys = ast_strdupa("#"); /* Default */
        }
-       
+
        if (ast_test_flag64(confflags, CONFFLAG_RECORDCONF)) {
                if (!conf->recordingfilename) {
                        const char *var;
@@ -3375,29 +3375,29 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
        ast_mutex_unlock(&conf->announcethreadlock);
 
        time(&user->jointime);
-       
+
        user->timelimit = timelimit;
        user->play_warning = play_warning;
        user->warning_freq = warning_freq;
        user->warning_sound = warning_sound;
-       user->end_sound = end_sound;    
-       
+       user->end_sound = end_sound;
+
        if (calldurationlimit > 0) {
                time(&user->kicktime);
                user->kicktime = user->kicktime + calldurationlimit;
        }
-       
+
        if (ast_tvzero(user->start_time))
                user->start_time = ast_tvnow();
        time_left_ms = user->timelimit;
-       
+
        if (user->timelimit) {
                nexteventts = ast_tvadd(user->start_time, ast_samp2tv(user->timelimit, 1000));
                nexteventts = ast_tvsub(nexteventts, ast_samp2tv(user->play_warning, 1000));
        }
 
        if (conf->locked && (!ast_test_flag64(confflags, CONFFLAG_ADMIN))) {
-               /* Sorry, but this conference is locked! */     
+               /* Sorry, but this conference is locked! */
                if (!ast_streamfile(chan, "conf-locked", ast_channel_language(chan)))
                        ast_waitstream(chan, "");
                goto outrun;
@@ -3407,7 +3407,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
 
        if (rt_schedule && conf->maxusers) {
                if (conf->users >= conf->maxusers) {
-                       /* Sorry, but this confernce has reached the participant limit! */      
+                       /* Sorry, but this confernce has reached the participant limit! */
                        ast_mutex_unlock(&conf->playlock);
                        if (!ast_streamfile(chan, "conf-full", ast_channel_language(chan)))
                                ast_waitstream(chan, "");
@@ -3536,7 +3536,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
        if (ast_test_flag64(confflags, CONFFLAG_ANNOUNCEUSERCOUNT) && conf->users > 1) {
                int keepplaying = 1;
 
-               if (conf->users == 2) { 
+               if (conf->users == 2) {
                        if (!ast_streamfile(chan, "conf-onlyone", ast_channel_language(chan))) {
                                res = ast_waitstream(chan, AST_DIGIT_ANY);
                                ast_stopstream(chan);
@@ -3545,7 +3545,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                else if (res == -1)
                                        goto outrun;
                        }
-               } else { 
+               } else {
                        if (!ast_streamfile(chan, "conf-thereare", ast_channel_language(chan))) {
                                res = ast_waitstream(chan, AST_DIGIT_ANY);
                                ast_stopstream(chan);
@@ -3566,7 +3566,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                ast_stopstream(chan);
                                if (res > 0)
                                        keepplaying = 0;
-                               else if (res == -1) 
+                               else if (res == -1)
                                        goto outrun;
                        }
                }
@@ -3588,7 +3588,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
        }
 
        /* Reduce background noise from each participant */
-       if (!ast_test_flag64(confflags, CONFFLAG_DONT_DENOISE) && ast_module_check("func_speex.so")) {
+       if (!ast_test_flag64(confflags, CONFFLAG_DONT_DENOISE)) {
                ast_func_write(chan, "DENOISE(rx)", "on");
        }
 
@@ -3727,7 +3727,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                        agifile = ast_strdupa(agifiledefault);
                }
                ast_channel_unlock(chan);
-               
+
                if (user->dahdichannel) {
                        /*  Set CONFMUTE mode on DAHDI channel to mute DTMF tones */
                        x = 1;
@@ -3832,11 +3832,11 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                }
                                break;
                        }
-  
+
                        to = -1;
                        if (user->timelimit) {
                                int minutes = 0, seconds = 0, remain = 0;
+
                                to = ast_tvdiff_ms(nexteventts, now);
                                if (to < 0) {
                                        to = 0;
@@ -3845,9 +3845,9 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                if (time_left_ms < to) {
                                        to = time_left_ms;
                                }
-       
+
                                if (time_left_ms <= 0) {
-                                       if (user->end_sound) {                                          
+                                       if (user->end_sound) {
                                                res = ast_streamfile(chan, user->end_sound, ast_channel_language(chan));
                                                res = ast_waitstream(chan, "");
                                        }
@@ -3858,10 +3858,10 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                        }
                                        break;
                                }
-                               
+
                                if (!to) {
-                                       if (time_left_ms >= 5000) {                                             
-                                               
+                                       if (time_left_ms >= 5000) {
+
                                                remain = (time_left_ms + 500) / 1000;
                                                if (remain / 60 >= 1) {
                                                        minutes = remain / 60;
@@ -3869,11 +3869,11 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                                } else {
                                                        seconds = remain;
                                                }
-                                               
+
                                                /* force the time left to round up if appropriate */
                                                if (user->warning_sound && user->play_warning) {
                                                        if (!strcmp(user->warning_sound, "timeleft")) {
-                                                               
+
                                                                res = ast_streamfile(chan, "vm-youhave", ast_channel_language(chan));
                                                                res = ast_waitstream(chan, "");
                                                                if (minutes) {
@@ -3994,7 +3994,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                                ast_moh_stop(chan);
                                                musiconhold = 0;
                                        }
-                                       if (!ast_test_flag64(confflags, CONFFLAG_QUIET) && 
+                                       if (!ast_test_flag64(confflags, CONFFLAG_QUIET) &&
                                                !ast_test_flag64(confflags, CONFFLAG_MARKEDUSER)) {
                                                if (!ast_streamfile(chan, "conf-placeintoconf", ast_channel_language(chan))) {
                                                        ast_waitstream(chan, "");
@@ -4010,7 +4010,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                        if (!musiconhold) {
                                                conf_start_moh(chan, optargs[OPT_ARG_MOH_CLASS]);
                                                musiconhold = 1;
-                                       } 
+                                       }
                                } else {
                                        if (musiconhold) {
                                                ast_moh_stop(chan);
@@ -4018,7 +4018,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                        }
                                }
                        }
-                       
+
                        /* Leave if the last marked user left */
                        if (currentmarked == 0 && lastmarked != 0 && ast_test_flag64(confflags, CONFFLAG_MARKEDEXIT)) {
                                if (ast_test_flag64(confflags, CONFFLAG_KICK_CONTINUE)) {
@@ -4068,7 +4068,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                meetme_stasis_generate_msg(conf, chan, user, meetme_mute_type(), status_blob);
                        }
 
-                       if ((user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) && 
+                       if ((user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) &&
                                (user->adminflags & ADMINFLAG_T_REQUEST) && !(talkreq_manager)) {
 
                                RAII_VAR(struct ast_json *, status_blob, status_to_json(1), ast_json_unref);
@@ -4076,7 +4076,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                meetme_stasis_generate_msg(conf, chan, user, meetme_talk_request_type(), status_blob);
                        }
 
-                       if (!(user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) && 
+                       if (!(user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) &&
                                !(user->adminflags & ADMINFLAG_T_REQUEST) && (talkreq_manager)) {
                                RAII_VAR(struct ast_json *, status_blob, status_to_json(0), ast_json_unref);
                                talkreq_manager = 0;
@@ -4092,7 +4092,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                        /* If I have been kicked, exit the conference */
                        if (user->adminflags & ADMINFLAG_KICKME) {
                                /* You have been kicked. */
-                               if (!ast_test_flag64(confflags, CONFFLAG_QUIET) && 
+                               if (!ast_test_flag64(confflags, CONFFLAG_QUIET) &&
                                        !ast_streamfile(chan, "conf-kicked", ast_channel_language(chan))) {
                                        ast_waitstream(chan, "");
                                }
@@ -4386,12 +4386,12 @@ bailoutandtrynormal:
        if (musiconhold) {
                ast_moh_stop(chan);
        }
-       
+
        if (using_pseudo) {
                close(fd);
        } else {
                /* Take out of conference */
-               dahdic.chan = 0;        
+               dahdic.chan = 0;
                dahdic.confno = 0;
                dahdic.confmode = 0;
                if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
@@ -4433,7 +4433,7 @@ bailoutandtrynormal:
        if (dsp) {
                ast_dsp_free(dsp);
        }
-       
+
        if (user->user_no) {
                /* Only cleanup users who really joined! */
                now = ast_tvnow();
@@ -4458,7 +4458,7 @@ bailoutandtrynormal:
                        }
                }
                /* Remove ourselves from the container */
-               ao2_unlink(conf->usercontainer, user); 
+               ao2_unlink(conf->usercontainer, user);
 
                /* Change any states */
                if (!conf->users) {
@@ -4769,7 +4769,7 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno,
                        ast_log(LOG_WARNING, "No DAHDI channel available for conference, user introduction disabled (is chan_dahdi loaded?)\n");
                        ast_clear_flag64(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW | CONFFLAG_INTROUSER_VMREC);
                }
-               
+
                if (confflags && !cnf->chan &&
                    ast_test_flag64(confflags, CONFFLAG_RECORDCONF)) {
                        ast_log(LOG_WARNING, "No DAHDI channel available for conference, conference recording disabled (is chan_dahdi loaded?)\n");
@@ -4787,7 +4787,7 @@ static int count_exec(struct ast_channel *chan, const char *data)
        struct ast_conference *conf;
        int count;
        char *localdata;
-       char val[80] = "0"; 
+       char val[80] = "0";
        AST_DECLARE_APP_ARGS(args,
                AST_APP_ARG(confno);
                AST_APP_ARG(varname);
@@ -4797,11 +4797,11 @@ static int count_exec(struct ast_channel *chan, const char *data)
                ast_log(LOG_WARNING, "MeetMeCount requires an argument (conference number)\n");
                return -1;
        }
-       
+
        localdata = ast_strdupa(data);
 
        AST_STANDARD_APP_ARGS(args, localdata);
-       
+
        conf = find_conf(chan, args.confno, 0, 0, NULL, 0, 1, NULL);
 
        if (conf) {
@@ -4853,13 +4853,13 @@ static int conf_exec(struct ast_channel *chan, const char *data)
        } else {
                notdata = data;
        }
-       
+
        if (ast_channel_state(chan) != AST_STATE_UP)
                ast_answer(chan);
 
        info = ast_strdupa(notdata);
 
-       AST_STANDARD_APP_ARGS(args, info);      
+       AST_STANDARD_APP_ARGS(args, info);
 
        if (args.confno) {
                ast_copy_string(confno, args.confno, sizeof(confno));
@@ -4867,7 +4867,7 @@ static int conf_exec(struct ast_channel *chan, const char *data)
                        allowretry = 1;
                }
        }
-       
+
        if (args.pin)
                ast_copy_string(the_pin, args.pin, sizeof(the_pin));
 
@@ -5015,12 +5015,12 @@ static int conf_exec(struct ast_channel *chan, const char *data)
                }
                if (!ast_strlen_zero(confno)) {
                        /* Check the validity of the conference */
-                       cnf = find_conf(chan, confno, 1, dynamic, the_pin, 
+                       cnf = find_conf(chan, confno, 1, dynamic, the_pin,
                                sizeof(the_pin), 1, &confflags);
                        if (!cnf) {
                                int too_early = 0;
 
-                               cnf = find_conf_realtime(chan, confno, 1, dynamic, 
+                               cnf = find_conf_realtime(chan, confno, 1, dynamic,
                                        the_pin, sizeof(the_pin), 1, &confflags, &too_early, optargs);
                                if (rt_schedule && too_early)
                                        allowretry = 0;
@@ -5128,7 +5128,7 @@ static int conf_exec(struct ast_channel *chan, const char *data)
                                        /* No pin required */
                                        allowretry = 0;
 
-                                       /* For RealTime conferences without a pin 
+                                       /* For RealTime conferences without a pin
                                         * should still support loading options
                                         */
                                        if (!ast_strlen_zero(cnf->useropts)) {
@@ -5147,7 +5147,7 @@ static int conf_exec(struct ast_channel *chan, const char *data)
 
        if (cnf)
                dispose_conf(cnf);
-       
+
        return res;
 }
 
@@ -5211,7 +5211,7 @@ static int user_chan_cb(void *obj, void *args, int flags)
        return 0;
 }
 
-/*! \brief The MeetMeadmin application 
+/*! \brief The MeetMeadmin application
 
   MeetMeAdmin(confno, command, caller) */
 static int admin_exec(struct ast_channel *chan, const char *data) {
@@ -5282,10 +5282,10 @@ static int admin_exec(struct ast_channel *chan, const char *data) {
        }
 
        switch (*args.command) {
-       case 76: /* L: Lock */ 
+       case 76: /* L: Lock */
                cnf->locked = 1;
                break;
-       case 108: /* l: Unlock */ 
+       case 108: /* l: Unlock */
                cnf->locked = 0;
                break;
        case 75: /* K: kick all users */
@@ -5312,19 +5312,19 @@ static int admin_exec(struct ast_channel *chan, const char *data) {
                }
                break;
        }
-       case 77: /* M: Mute */ 
+       case 77: /* M: Mute */
                user->adminflags |= ADMINFLAG_MUTED;
                break;
        case 78: /* N: Mute all (non-admin) users */
                ao2_callback(cnf->usercontainer, OBJ_NODATA, user_set_muted_cb, &cnf);
-               break;                                  
-       case 109: /* m: Unmute */ 
+               break;
+       case 109: /* m: Unmute */
                user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED | ADMINFLAG_T_REQUEST);
                break;
        case 110: /* n: Unmute all users */
                ao2_callback(cnf->usercontainer, OBJ_NODATA, user_set_unmuted_cb, NULL);
                break;
-       case 107: /* k: Kick user */ 
+       case 107: /* k: Kick user */
                user->adminflags |= ADMINFLAG_KICKME;
                break;
        case 118: /* v: Lower all users listen volume */
@@ -5377,7 +5377,7 @@ usernotfound:
        return 0;
 }
 
-/*! \brief The MeetMeChannelAdmin application 
+/*! \brief The MeetMeChannelAdmin application
        MeetMeChannelAdmin(channel, command) */
 static int channel_admin_exec(struct ast_channel *chan, const char *data) {
        char *params;
@@ -5392,7 +5392,7 @@ static int channel_admin_exec(struct ast_channel *chan, const char *data) {
                ast_log(LOG_WARNING, "MeetMeChannelAdmin requires two arguments!\n");
                return -1;
        }
-       
+
        params = ast_strdupa(data);
        AST_STANDARD_APP_ARGS(args, params);
 
@@ -5412,22 +5412,22 @@ static int channel_admin_exec(struct ast_channel *chan, const char *data) {
                        break;
                }
        }
-       
+
        if (!user) {
                ast_log(LOG_NOTICE, "Specified user (%s) not found\n", args.channel);
                AST_LIST_UNLOCK(&confs);
                return 0;
        }
-       
+
        /* perform the specified action */
        switch (*args.command) {
-               case 77: /* M: Mute */ 
+               case 77: /* M: Mute */
                        user->adminflags |= ADMINFLAG_MUTED;
                        break;
-               case 109: /* m: Unmute */ 
+               case 109: /* m: Unmute */
                        user->adminflags &= ~ADMINFLAG_MUTED;
                        break;
-               case 107: /* k: Kick user */ 
+               case 107: /* k: Kick user */
                        user->adminflags |= ADMINFLAG_KICKME;
                        break;
                default: /* unknown command */
@@ -5436,7 +5436,7 @@ static int channel_admin_exec(struct ast_channel *chan, const char *data) {
        }
        ao2_ref(user, -1);
        AST_LIST_UNLOCK(&confs);
-       
+
        return 0;
 }
 
@@ -5635,7 +5635,7 @@ static int action_meetmelistrooms(struct mansession *s, const struct message *m)
                markedusers,
                hr,  min, sec,
                cnf->isdynamic ? "Dynamic" : "Static",
-               cnf->locked ? "Yes" : "No"); 
+               cnf->locked ? "Yes" : "No");
        }
        AST_LIST_UNLOCK(&confs);
 
@@ -5703,7 +5703,7 @@ static void *recordthread(void *args)
                        s = ast_writefile(filename_buffer, cnf->recordingformat, NULL, flags, 0, AST_FILE_MODE);
                        oldrecordingfilename = filename_buffer;
                }
-               
+
                f = ast_read(cnf->lchan);
                if (!f) {
                        res = -1;
@@ -5734,7 +5734,7 @@ static void *recordthread(void *args)
        cnf->recording = MEETME_RECORD_OFF;
        if (s)
                ast_closestream(s);
-       
+
        pthread_exit(0);
 }
 
@@ -5819,25 +5819,25 @@ static void load_config_meetme(int reload)
                if ((sscanf(val, "%30d", &fuzzystart) != 1)) {
                        ast_log(LOG_WARNING, "fuzzystart must be a number, not '%s'\n", val);
                        fuzzystart = 0;
-               } 
+               }
        }
        if ((val = ast_variable_retrieve(cfg, "general", "earlyalert"))) {
                if ((sscanf(val, "%30d", &earlyalert) != 1)) {
                        ast_log(LOG_WARNING, "earlyalert must be a number, not '%s'\n", val);
                        earlyalert = 0;
-               } 
+               }
        }
        if ((val = ast_variable_retrieve(cfg, "general", "endalert"))) {
                if ((sscanf(val, "%30d", &endalert) != 1)) {
                        ast_log(LOG_WARNING, "endalert must be a number, not '%s'\n", val);
                        endalert = 0;
-               } 
+               }
        }
        if ((val = ast_variable_retrieve(cfg, "general", "extendby"))) {
                if ((sscanf(val, "%30d", &extendby) != 1)) {
                        ast_log(LOG_WARNING, "extendby must be a number, not '%s'\n", val);
                        extendby = 0;
-               } 
+               }
        }
 
        ast_config_destroy(cfg);
@@ -5908,12 +5908,12 @@ static struct sla_trunk_ref *sla_find_trunk_ref_byname(const struct sla_station
                if (strcasecmp(trunk_ref->trunk->name, name))
                        continue;
 
-               if ( (trunk_ref->trunk->barge_disabled 
+               if ( (trunk_ref->trunk->barge_disabled
                        && trunk_ref->state == SLA_TRUNK_STATE_UP) ||
-                       (trunk_ref->trunk->hold_stations 
+                       (trunk_ref->trunk->hold_stations
                        && trunk_ref->trunk->hold_access == SLA_HOLD_PRIVATE
                        && trunk_ref->state != SLA_TRUNK_STATE_ONHOLD_BYME) ||
-                       sla_check_station_hold_access(trunk_ref->trunk, station) ) 
+                       sla_check_station_hold_access(trunk_ref->trunk, station) )
                {
                        trunk_ref = NULL;
                }
@@ -6018,7 +6018,7 @@ static enum ast_device_state sla_state_to_devstate(enum sla_trunk_state state)
        return AST_DEVICE_UNKNOWN;
 }
 
-static void sla_change_trunk_state(const struct sla_trunk *trunk, enum sla_trunk_state state, 
+static void sla_change_trunk_state(const struct sla_trunk *trunk, enum sla_trunk_state state,
        enum sla_which_trunk_refs inactive_only, const struct sla_trunk_ref *exclude)
 {
        struct sla_station *station;
@@ -6077,7 +6077,7 @@ static void *run_station(void *data)
 
        ast_atomic_fetchadd_int((int *) &trunk_ref->trunk->active_stations, 1);
        ast_str_set(&conf_name, 0, "SLA_%s", trunk_ref->trunk->name);
-       ast_set_flag64(&conf_flags, 
+       ast_set_flag64(&conf_flags,
                CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_PASS_DTMF | CONFFLAG_SLA_STATION);
        answer_trunk_chan(trunk_ref->chan);
        conf = build_conf(ast_str_buffer(conf_name), "", "", 0, 0, 1, trunk_ref->chan, NULL);
@@ -6185,7 +6185,7 @@ static int sla_check_timed_out_station(const struct sla_ringing_trunk *ringing_t
  * \return a pointer to the selected ringing trunk, or NULL if none found
  * \note Assumes that sla.lock is locked
  */
-static struct sla_ringing_trunk *sla_choose_ringing_trunk(struct sla_station *station, 
+static struct sla_ringing_trunk *sla_choose_ringing_trunk(struct sla_station *station,
        struct sla_trunk_ref **trunk_ref, int rm)
 {
        struct sla_trunk_ref *s_trunk_ref;
@@ -6213,7 +6213,7 @@ static struct sla_ringing_trunk *sla_choose_ringing_trunk(struct sla_station *st
                        break;
                }
                AST_LIST_TRAVERSE_SAFE_END;
-       
+
                if (ringing_trunk)
                        break;
        }
@@ -6303,8 +6303,8 @@ static void sla_handle_dial_state_event(void)
        AST_LIST_TRAVERSE_SAFE_END;
 }
 
-/*! \brief Check to see if this station is already ringing 
- * \note Assumes sla.lock is locked 
+/*! \brief Check to see if this station is already ringing
+ * \note Assumes sla.lock is locked
  */
 static int sla_check_ringing_station(const struct sla_station *station)
 {
@@ -6374,13 +6374,13 @@ static int sla_ring_station(struct sla_ringing_trunk *ringing_trunk, struct sla_
        }
 
        res = ast_dial_run(dial, ringing_trunk->trunk->chan, 1);
-       
+
        /* Restore saved caller ID */
        if (caller_is_saved) {
                ast_party_caller_free(ast_channel_caller(ringing_trunk->trunk->chan));
                ast_channel_caller_set(ringing_trunk->trunk->chan, &caller);
        }
-       
+
        if (res != AST_DIAL_RESULT_TRYING) {
                struct sla_failed_station *failed_station;
                ast_dial_destroy(dial);
@@ -6436,7 +6436,7 @@ static struct sla_trunk_ref *sla_find_trunk_ref(const struct sla_station *statio
  * \param ringing_trunk the trunk.  If NULL, the highest priority ringing trunk will be used
  * \return the number of ms left before the delay is complete, or INT_MAX if there is no delay
  */
-static int sla_check_station_delay(struct sla_station *station, 
+static int sla_check_station_delay(struct sla_station *station,
        struct sla_ringing_trunk *ringing_trunk)
 {
        RAII_VAR(struct sla_trunk_ref *, trunk_ref, NULL, ao2_cleanup);
@@ -6554,7 +6554,7 @@ static void sla_handle_hold_event(struct sla_event *event)
        event->trunk_ref->state = SLA_TRUNK_STATE_ONHOLD_BYME;
        ast_devstate_changed(AST_DEVICE_ONHOLD, AST_DEVSTATE_CACHABLE, "SLA:%s_%s",
                             event->station->name, event->trunk_ref->trunk->name);
-       sla_change_trunk_state(event->trunk_ref->trunk, SLA_TRUNK_STATE_ONHOLD, 
+       sla_change_trunk_state(event->trunk_ref->trunk, SLA_TRUNK_STATE_ONHOLD,
                INACTIVE_TRUNK_REFS, event->trunk_ref);
 
        if (event->trunk_ref->trunk->active_stations == 1) {
@@ -6712,7 +6712,7 @@ static int sla_calc_station_delays(unsigned int *timeout)
                        continue;
 
                /* If there is no time left, then the station needs to start ringing.
-                * Return non-zero so that an event will be queued up an event to 
+                * Return non-zero so that an event will be queued up an event to
                 * make that happen. */
                if (time_left <= 0) {
                        res = 1;
@@ -6950,8 +6950,8 @@ static void *dial_trunk(void *data)
        }
 
        snprintf(conf_name, sizeof(conf_name), "SLA_%s", trunk_ref->trunk->name);
-       ast_set_flag64(&conf_flags, 
-               CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_MARKEDUSER | 
+       ast_set_flag64(&conf_flags,
+               CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_MARKEDUSER |
                CONFFLAG_PASS_DTMF | CONFFLAG_SLA_TRUNK);
        conf = build_conf(conf_name, "", "", 1, 1, 1, trunk_ref->trunk->chan, NULL);
 
@@ -7141,7 +7141,7 @@ static int sla_station_exec(struct ast_channel *chan, const char *data)
                trunk_ref->trunk->hold_stations = 0;
                sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
        }
-       
+
        pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "SUCCESS");
 
        return 0;
@@ -7274,7 +7274,7 @@ static int sla_trunk_exec(struct ast_channel *chan, const char *data)
                pbx_builtin_setvar_helper(chan, "SLATRUNK_STATUS", "FAILURE");
                return 0;
        }
-       ast_set_flag64(&conf_flags, 
+       ast_set_flag64(&conf_flags,
                CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_MARKEDUSER | CONFFLAG_PASS_DTMF | CONFFLAG_NO_AUDIO_UNTIL_UP);
 
        if (ast_test_flag(&opt_flags, SLA_TRUNK_OPT_MOH)) {
@@ -7383,9 +7383,9 @@ static void sla_station_destructor(void *obj)
                        char hint[AST_MAX_APP];
                        snprintf(exten, sizeof(exten), "%s_%s", station->name, trunk_ref->trunk->name);
                        snprintf(hint, sizeof(hint), "SLA:%s", exten);
-                       ast_context_remove_extension(station->autocontext, exten, 
+                       ast_context_remove_extension(station->autocontext, exten,
                                1, sla_registrar);
-                       ast_context_remove_extension(station->autocontext, hint, 
+                       ast_context_remove_extension(station->autocontext, hint,
                                PRIORITY_HINT, sla_registrar);
                }
        }
@@ -7735,7 +7735,7 @@ static int sla_build_station(struct ast_config *cfg, const char *cat)
                        char hint[AST_MAX_APP];
                        snprintf(exten, sizeof(exten), "%s_%s", station->name, trunk_ref->trunk->name);
                        snprintf(hint, sizeof(hint), "SLA:%s", exten);
-                       /* Extension for this line button 
+                       /* Extension for this line button
                         * exten => station1_line1,1,SLAStation(station1_line1) */
                        if (ast_add_extension(station->autocontext, 0 /* don't replace */, exten, 1,
                                NULL, NULL, slastation_app, ast_strdup(exten), ast_free_ptr, sla_registrar)) {
@@ -7743,7 +7743,7 @@ static int sla_build_station(struct ast_config *cfg, const char *cat)
                                        "for trunk '%s'!\n", station->name);
                                return -1;
                        }
-                       /* Hint for this line button 
+                       /* Hint for this line button
                         * exten => station1_line1,hint,SLA:station1_line1 */
                        if (ast_add_extension(station->autocontext, 0 /* don't replace */, exten, PRIORITY_HINT,
                                NULL, NULL, hint, NULL, NULL, sla_registrar)) {
@@ -7985,7 +7985,7 @@ static int acf_meetme_info(struct ast_channel *chan, const char *cmd, char *data
                ast_log(LOG_NOTICE, "Error: invalid keyword: '%s'\n", args.keyword);
                snprintf(buf, len, "0");
        } else if (result == -2) {
-               ast_log(LOG_NOTICE, "Error: conference (%s) not found\n", args.confno); 
+               ast_log(LOG_NOTICE, "Error: conference (%s) not found\n", args.confno);
                snprintf(buf, len, "0");
        }
 
@@ -8008,7 +8008,7 @@ static int load_config(int reload)
 static int unload_module(void)
 {
        int res = 0;
-       
+
        ast_cli_unregister_multiple(cli_meetme, ARRAY_LEN(cli_meetme));
        res = ast_manager_unregister("MeetmeMute");
        res |= ast_manager_unregister("MeetmeUnmute");
@@ -8023,9 +8023,9 @@ static int unload_module(void)
 
        ast_devstate_prov_del("Meetme");
        ast_devstate_prov_del("SLA");
-       
+
        sla_destroy();
-       
+
        res |= ast_custom_function_unregister(&meetme_info_acf);
        ast_unload_realtime("meetme");
 
@@ -8040,8 +8040,8 @@ static int unload_module(void)
  * Module loading including tests for configuration or dependencies.
  * This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE,
  * or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails
- * tests return AST_MODULE_LOAD_FAILURE. If the module can not load the 
- * configuration file or other non-critical problem return 
+ * tests return AST_MODULE_LOAD_FAILURE. If the module can not load the
+ * configuration file or other non-critical problem return
  * AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
  */
 static int load_module(void)
@@ -8085,5 +8085,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "MeetMe conference bri
        .unload = unload_module,
        .reload = reload,
        .load_pri = AST_MODPRI_DEVSTATE_PROVIDER,
+       .optional_modules = "func_speex",
 );
-