#include "asterisk.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/config.h"
#include "asterisk/app.h"
#include "asterisk/dsp.h"
#include "asterisk/musiconhold.h"
#include "asterisk/manager.h"
#include "asterisk/options.h"
#include "asterisk/cli.h"
#include "asterisk/say.h"
#include "asterisk/utils.h"
#include "asterisk/translate.h"
#include "asterisk/ulaw.h"
#include "asterisk/astobj.h"
#include "asterisk/devicestate.h"
#include "asterisk/dial.h"
#include "asterisk/causes.h"
#include "asterisk/dahdi_compat.h"
#include "enter.h"
#include "leave.h"
Include dependency graph for app_meetme.c:

Go to the source code of this file.
Data Structures | |
| struct | ast_conf_user |
| struct | ast_conference |
| The MeetMe Conference object. More... | |
| struct | dial_trunk_args |
| struct | run_station_args |
| struct | sla_event |
| struct | sla_failed_station |
| A station that failed to be dialed. More... | |
| struct | sla_ringing_station |
| A station that is ringing. More... | |
| struct | sla_ringing_trunk |
| A trunk that is ringing. More... | |
| struct | sla_station |
| struct | sla_station_ref |
| struct | sla_trunk |
| struct | sla_trunk_ref |
| struct | volume |
Defines | |
| #define | AST_FRAME_BITS 32 |
| #define | CONF_SIZE 320 |
| #define | CONFIG_FILE_NAME "meetme.conf" |
| #define | DEFAULT_AUDIO_BUFFERS 32 |
| #define | MAX_CONFNUM 80 |
| #define | MAX_PIN 80 |
| #define | MEETME_DELAYDETECTENDTALK 1000 |
| #define | MEETME_DELAYDETECTTALK 300 |
| #define | S(e) case e: return # e; |
| #define | SLA_CONFIG_FILE "sla.conf" |
Enumerations | |
| enum | { ADMINFLAG_MUTED = (1 << 1), ADMINFLAG_SELFMUTED = (1 << 2), ADMINFLAG_KICKME = (1 << 3) } |
| enum | { CONFFLAG_ADMIN = (1 << 0), CONFFLAG_MONITOR = (1 << 1), CONFFLAG_POUNDEXIT = (1 << 2), CONFFLAG_STARMENU = (1 << 3), CONFFLAG_TALKER = (1 << 4), CONFFLAG_QUIET = (1 << 5), CONFFLAG_ANNOUNCEUSERCOUNT = (1 << 6), CONFFLAG_AGI = (1 << 7), CONFFLAG_MOH = (1 << 8), CONFFLAG_MARKEDEXIT = (1 << 9), CONFFLAG_WAITMARKED = (1 << 10), CONFFLAG_EXIT_CONTEXT = (1 << 11), CONFFLAG_MARKEDUSER = (1 << 12), CONFFLAG_INTROUSER = (1 << 13), CONFFLAG_RECORDCONF = (1<< 14), CONFFLAG_MONITORTALKER = (1 << 15), CONFFLAG_DYNAMIC = (1 << 16), CONFFLAG_DYNAMICPIN = (1 << 17), CONFFLAG_EMPTY = (1 << 18), CONFFLAG_EMPTYNOPIN = (1 << 19), CONFFLAG_ALWAYSPROMPT = (1 << 20), CONFFLAG_OPTIMIZETALKER = (1 << 21), CONFFLAG_NOONLYPERSON = (1 << 22), CONFFLAG_INTROUSERNOREVIEW = (1 << 23), CONFFLAG_STARTMUTED = (1 << 24), CONFFLAG_PASS_DTMF = (1 << 25), CONFFLAG_SLA_STATION = (1 << 26), CONFFLAG_SLA_TRUNK = (1 << 27) } |
| enum | { OPT_ARG_WAITMARKED = 0, OPT_ARG_ARRAY_SIZE = 1 } |
| enum | entrance_sound { ENTER, LEAVE } |
| enum | recording_state { MEETME_RECORD_OFF, MEETME_RECORD_STARTED, MEETME_RECORD_ACTIVE, MEETME_RECORD_TERMINATE } |
| enum | sla_event_type { SLA_EVENT_HOLD, SLA_EVENT_DIAL_STATE, SLA_EVENT_RINGING_TRUNK } |
| Event types that can be queued up for the SLA thread. More... | |
| enum | sla_hold_access { SLA_HOLD_OPEN, SLA_HOLD_PRIVATE } |
| enum | sla_station_hangup { SLA_STATION_HANGUP_NORMAL, SLA_STATION_HANGUP_TIMEOUT } |
| enum | sla_trunk_state { SLA_TRUNK_STATE_IDLE, SLA_TRUNK_STATE_RINGING, SLA_TRUNK_STATE_UP, SLA_TRUNK_STATE_ONHOLD, SLA_TRUNK_STATE_ONHOLD_BYME } |
| enum | sla_which_trunk_refs { ALL_TRUNK_REFS, INACTIVE_TRUNK_REFS } |
| enum | volume_action { VOL_UP, VOL_DOWN } |
Functions | |
| static int | action_meetmemute (struct mansession *s, const struct message *m) |
| static int | action_meetmeunmute (struct mansession *s, const struct message *m) |
| static int | admin_exec (struct ast_channel *chan, void *data) |
| The MeetMeadmin application. | |
| AST_APP_OPTIONS (meetme_opts, BEGIN_OPTIONS AST_APP_OPTION('A', CONFFLAG_MARKEDUSER), AST_APP_OPTION('a', CONFFLAG_ADMIN), AST_APP_OPTION('b', CONFFLAG_AGI), AST_APP_OPTION('c', CONFFLAG_ANNOUNCEUSERCOUNT), AST_APP_OPTION('D', CONFFLAG_DYNAMICPIN), AST_APP_OPTION('d', CONFFLAG_DYNAMIC), AST_APP_OPTION('E', CONFFLAG_EMPTYNOPIN), AST_APP_OPTION('e', CONFFLAG_EMPTY), AST_APP_OPTION('F', CONFFLAG_PASS_DTMF), AST_APP_OPTION('i', CONFFLAG_INTROUSER), AST_APP_OPTION('I', CONFFLAG_INTROUSERNOREVIEW), AST_APP_OPTION('M', CONFFLAG_MOH), AST_APP_OPTION('m', CONFFLAG_STARTMUTED), AST_APP_OPTION('o', CONFFLAG_OPTIMIZETALKER), AST_APP_OPTION('P', CONFFLAG_ALWAYSPROMPT), AST_APP_OPTION('p', CONFFLAG_POUNDEXIT), AST_APP_OPTION('q', CONFFLAG_QUIET), AST_APP_OPTION('r', CONFFLAG_RECORDCONF), AST_APP_OPTION('s', CONFFLAG_STARMENU), AST_APP_OPTION('T', CONFFLAG_MONITORTALKER), AST_APP_OPTION('l', CONFFLAG_MONITOR), AST_APP_OPTION('t', CONFFLAG_TALKER), AST_APP_OPTION_ARG('w', CONFFLAG_WAITMARKED, OPT_ARG_WAITMARKED), AST_APP_OPTION('X', CONFFLAG_EXIT_CONTEXT), AST_APP_OPTION('x', CONFFLAG_MARKEDEXIT), AST_APP_OPTION('1', CONFFLAG_NOONLYPERSON), END_OPTIONS) | |
| static | AST_LIST_HEAD_STATIC (confs, ast_conference) |
| AST_MODULE_INFO (ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,"MeetMe conference bridge",.load=load_module,.unload=unload_module,.reload=reload,) | |
| static | AST_RWLIST_HEAD_STATIC (sla_trunks, sla_trunk) |
| static | AST_RWLIST_HEAD_STATIC (sla_stations, sla_station) |
| static struct ast_conference * | build_conf (char *confno, char *pin, char *pinadmin, int make, int dynamic, int refcount) |
| Find or create a conference. | |
| static int | careful_write (int fd, unsigned char *data, int len, int block) |
| static char * | complete_meetmecmd (const char *line, const char *word, int pos, int state) |
| static int | conf_exec (struct ast_channel *chan, void *data) |
| The meetme() application. | |
| static void | conf_flush (int fd, struct ast_channel *chan) |
| static int | conf_free (struct ast_conference *conf) |
| static void | conf_play (struct ast_channel *chan, struct ast_conference *conf, enum entrance_sound sound) |
| static void | conf_queue_dtmf (const struct ast_conference *conf, const struct ast_conf_user *sender, struct ast_frame *f) |
| static int | conf_run (struct ast_channel *chan, struct ast_conference *conf, int confflags, char *optargs[]) |
| static int | count_exec (struct ast_channel *chan, void *data) |
| The MeetmeCount application. | |
| static struct sla_trunk_ref * | create_trunk_ref (struct sla_trunk *trunk) |
| static void | destroy_station (struct sla_station *station) |
| static void | destroy_trunk (struct sla_trunk *trunk) |
| static void * | dial_trunk (void *data) |
| static int | dispose_conf (struct ast_conference *conf) |
| 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_flags *confflags) |
| 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_flags *confflags) |
| static struct ast_conf_user * | find_user (struct ast_conference *conf, char *callerident) |
| static char * | istalking (int x) |
| static int | load_config (int reload) |
| static void | load_config_meetme (void) |
| static int | load_module (void) |
| static int | meetme_cmd (int fd, int argc, char **argv) |
| static int | meetmemute (struct mansession *s, const struct message *m, int mute) |
| static int | meetmestate (const char *data) |
| Callback for devicestate providers. | |
| static struct sla_ringing_trunk * | queue_ringing_trunk (struct sla_trunk *trunk) |
| static void * | recordthread (void *args) |
| static int | reload (void) |
| static void | reset_volumes (struct ast_conf_user *user) |
| static void * | run_station (void *data) |
| static int | set_listen_volume (struct ast_conf_user *user, int volume) |
| static int | set_talk_volume (struct ast_conf_user *user, int volume) |
| static void | sla_add_trunk_to_station (struct sla_station *station, struct ast_variable *var) |
| static int | sla_build_station (struct ast_config *cfg, const char *cat) |
| static int | sla_build_trunk (struct ast_config *cfg, const char *cat) |
| static int | sla_calc_station_delays (unsigned int *timeout) |
| Calculate the ring delay for a station. | |
| static int | sla_calc_station_timeouts (unsigned int *timeout) |
| Process station ring timeouts. | |
| static int | sla_calc_trunk_timeouts (unsigned int *timeout) |
| Process trunk ring timeouts. | |
| 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) |
| static int | sla_check_device (const char *device) |
| static int | sla_check_failed_station (const struct sla_station *station) |
| Check to see if this station has failed to be dialed in the past minute. | |
| static int | sla_check_inuse_station (const struct sla_station *station) |
| Check to see if a station is in use. | |
| static int | sla_check_ringing_station (const struct sla_station *station) |
| Check to see if this station is already ringing. | |
| static int | sla_check_station_delay (struct sla_station *station, struct sla_ringing_trunk *ringing_trunk) |
| Calculate the ring delay for a given ringing trunk on a station. | |
| static int | sla_check_station_hold_access (const struct sla_trunk *trunk, const struct sla_station *station) |
| static int | sla_check_timed_out_station (const struct sla_ringing_trunk *ringing_trunk, const struct sla_station *station) |
| Check to see if dialing this station already timed out for this ringing trunk. | |
| static struct sla_trunk_ref * | sla_choose_idle_trunk (const struct sla_station *station) |
| For a given station, choose the highest priority idle trunk. | |
| static struct sla_ringing_trunk * | sla_choose_ringing_trunk (struct sla_station *station, struct sla_trunk_ref **trunk_ref, int remove) |
| Choose the highest priority ringing trunk for a station. | |
| static struct sla_ringing_station * | sla_create_ringing_station (struct sla_station *station) |
| static struct sla_station_ref * | sla_create_station_ref (struct sla_station *station) |
| static void | sla_destroy (void) |
| static void | sla_dial_state_callback (struct ast_dial *dial) |
| static struct sla_station * | sla_find_station (const char *name) |
| Find an SLA station by name. | |
| static struct sla_trunk * | sla_find_trunk (const char *name) |
| Find an SLA trunk by name. | |
| static struct sla_trunk_ref * | sla_find_trunk_ref (const struct sla_station *station, const struct sla_trunk *trunk) |
| static struct sla_trunk_ref * | sla_find_trunk_ref_byname (const struct sla_station *station, const char *name) |
| Find a trunk reference on a station by name. | |
| static void | sla_handle_dial_state_event (void) |
| static void | sla_handle_hold_event (struct sla_event *event) |
| static void | sla_handle_ringing_trunk_event (void) |
| static void | sla_hangup_stations (void) |
| static const char * | sla_hold_str (unsigned int hold_access) |
| static int | sla_load_config (void) |
| static int | sla_process_timers (struct timespec *ts) |
| Calculate the time until the next known event. | |
| static void | sla_queue_event (enum sla_event_type type) |
| static void | sla_queue_event_conf (enum sla_event_type type, struct ast_channel *chan, struct ast_conference *conf) |
| Queue a SLA event from the conference. | |
| static void | sla_queue_event_full (enum sla_event_type type, struct sla_trunk_ref *trunk_ref, struct sla_station *station, int lock) |
| static void | sla_queue_event_nolock (enum sla_event_type type) |
| static int | sla_ring_station (struct sla_ringing_trunk *ringing_trunk, struct sla_station *station) |
| Ring a station. | |
| static void | sla_ring_stations (void) |
| Ring stations based on current set of ringing trunks. | |
| static int | sla_show_stations (int fd, int argc, char **argv) |
| static int | sla_show_trunks (int fd, int argc, char **argv) |
| static int | sla_state (const char *data) |
| static int | sla_station_exec (struct ast_channel *chan, void *data) |
| static void | sla_stop_ringing_station (struct sla_ringing_station *ringing_station, enum sla_station_hangup hangup) |
| static void | sla_stop_ringing_trunk (struct sla_ringing_trunk *ringing_trunk) |
| static void * | sla_thread (void *data) |
| static int | sla_trunk_exec (struct ast_channel *chan, void *data) |
| static const char * | trunkstate2str (enum sla_trunk_state state) |
| static void | tweak_listen_volume (struct ast_conf_user *user, enum volume_action action) |
| static void | tweak_talk_volume (struct ast_conf_user *user, enum volume_action action) |
| static void | tweak_volume (struct volume *vol, enum volume_action action) |
| static int | unload_module (void) |
Variables | |
| static const char * | app = "MeetMe" |
| static const char * | app2 = "MeetMeCount" |
| static const char * | app3 = "MeetMeAdmin" |
| static int | audio_buffers |
| static struct ast_cli_entry | cli_meetme [] |
| static unsigned int | conf_map [1024] = {0, } |
| static const char * | descrip |
| static const char * | descrip2 |
| static const char * | descrip3 |
| static char const | gain_map [] |
| static char | meetme_usage [] |
| struct { | |
| ast_cond_t cond | |
| ast_mutex_t lock | |
| pthread_t thread | |
| } | sla |
| A structure for data used by the sla thread. | |
| static const char | sla_registrar [] = "SLA" |
| static const char | sla_show_stations_usage [] |
| static const char | sla_show_trunks_usage [] |
| static const char * | slastation_app = "SLAStation" |
| static const char * | slastation_desc |
| static const char * | slastation_synopsis = "Shared Line Appearance Station" |
| static const char * | slatrunk_app = "SLATrunk" |
| static const char * | slatrunk_desc |
| static const char * | slatrunk_synopsis = "Shared Line Appearance Trunk" |
| static const char * | synopsis = "MeetMe conference bridge" |
| static const char * | synopsis2 = "MeetMe participant count" |
| static const char * | synopsis3 = "MeetMe conference Administration" |
Definition in file app_meetme.c.
| #define AST_FRAME_BITS 32 |
Definition at line 91 of file app_meetme.c.
Referenced by conf_free(), conf_run(), and recordthread().
| #define CONF_SIZE 320 |
Definition at line 110 of file app_meetme.c.
| #define CONFIG_FILE_NAME "meetme.conf" |
Definition at line 76 of file app_meetme.c.
Referenced by conf_exec(), find_conf(), and load_config_meetme().
| #define DEFAULT_AUDIO_BUFFERS 32 |
each buffer is 20ms, so this is 640ms total
Definition at line 80 of file app_meetme.c.
Referenced by load_config_meetme().
| #define MAX_CONFNUM 80 |
Definition at line 316 of file app_meetme.c.
Referenced by conf_exec(), dial_trunk(), run_station(), sla_station_exec(), and sla_trunk_exec().
| #define MAX_PIN 80 |
| #define MEETME_DELAYDETECTENDTALK 1000 |
| #define MEETME_DELAYDETECTTALK 300 |
| #define S | ( | e | ) | case e: return # e; |
Referenced by sms_readfile(), and trunkstate2str().
| #define SLA_CONFIG_FILE "sla.conf" |
| anonymous enum |
| ADMINFLAG_MUTED | User is muted |
| ADMINFLAG_SELFMUTED | User muted self |
| ADMINFLAG_KICKME | User has been kicked |
Definition at line 82 of file app_meetme.c.
00082 { 00083 ADMINFLAG_MUTED = (1 << 1), /*!< User is muted */ 00084 ADMINFLAG_SELFMUTED = (1 << 2), /*!< User muted self */ 00085 ADMINFLAG_KICKME = (1 << 3) /*!< User has been kicked */ 00086 };
| anonymous enum |
Definition at line 112 of file app_meetme.c.
00112 { 00113 /*! user has admin access on the conference */ 00114 CONFFLAG_ADMIN = (1 << 0), 00115 /*! If set the user can only receive audio from the conference */ 00116 CONFFLAG_MONITOR = (1 << 1), 00117 /*! If set asterisk will exit conference when '#' is pressed */ 00118 CONFFLAG_POUNDEXIT = (1 << 2), 00119 /*! If set asterisk will provide a menu to the user when '*' is pressed */ 00120 CONFFLAG_STARMENU = (1 << 3), 00121 /*! If set the use can only send audio to the conference */ 00122 CONFFLAG_TALKER = (1 << 4), 00123 /*! If set there will be no enter or leave sounds */ 00124 CONFFLAG_QUIET = (1 << 5), 00125 /*! If set, when user joins the conference, they will be told the number 00126 * of users that are already in */ 00127 CONFFLAG_ANNOUNCEUSERCOUNT = (1 << 6), 00128 /*! Set to run AGI Script in Background */ 00129 CONFFLAG_AGI = (1 << 7), 00130 /*! Set to have music on hold when user is alone in conference */ 00131 CONFFLAG_MOH = (1 << 8), 00132 /*! If set the MeetMe will return if all marked with this flag left */ 00133 CONFFLAG_MARKEDEXIT = (1 << 9), 00134 /*! If set, the MeetMe will wait until a marked user enters */ 00135 CONFFLAG_WAITMARKED = (1 << 10), 00136 /*! If set, the MeetMe will exit to the specified context */ 00137 CONFFLAG_EXIT_CONTEXT = (1 << 11), 00138 /*! If set, the user will be marked */ 00139 CONFFLAG_MARKEDUSER = (1 << 12), 00140 /*! If set, user will be ask record name on entry of conference */ 00141 CONFFLAG_INTROUSER = (1 << 13), 00142 /*! If set, the MeetMe will be recorded */ 00143 CONFFLAG_RECORDCONF = (1<< 14), 00144 /*! If set, the user will be monitored if the user is talking or not */ 00145 CONFFLAG_MONITORTALKER = (1 << 15), 00146 CONFFLAG_DYNAMIC = (1 << 16), 00147 CONFFLAG_DYNAMICPIN = (1 << 17), 00148 CONFFLAG_EMPTY = (1 << 18), 00149 CONFFLAG_EMPTYNOPIN = (1 << 19), 00150 CONFFLAG_ALWAYSPROMPT = (1 << 20), 00151 /*! If set, treats talking users as muted users */ 00152 CONFFLAG_OPTIMIZETALKER = (1 << 21), 00153 /*! If set, won't speak the extra prompt when the first person 00154 * enters the conference */ 00155 CONFFLAG_NOONLYPERSON = (1 << 22), 00156 /*! If set, user will be asked to record name on entry of conference 00157 * without review */ 00158 CONFFLAG_INTROUSERNOREVIEW = (1 << 23), 00159 /*! If set, the user will be initially self-muted */ 00160 CONFFLAG_STARTMUTED = (1 << 24), 00161 /*! Pass DTMF through the conference */ 00162 CONFFLAG_PASS_DTMF = (1 << 25), 00163 /*! This is a SLA station. (Only for use by the SLA applications.) */ 00164 CONFFLAG_SLA_STATION = (1 << 26), 00165 /*! This is a SLA trunk. (Only for use by the SLA applications.) */ 00166 CONFFLAG_SLA_TRUNK = (1 << 27), 00167 };
| anonymous enum |
Definition at line 169 of file app_meetme.c.
00169 { 00170 OPT_ARG_WAITMARKED = 0, 00171 OPT_ARG_ARRAY_SIZE = 1, 00172 };
| enum entrance_sound |
| enum recording_state |
Definition at line 103 of file app_meetme.c.
00103 { 00104 MEETME_RECORD_OFF, 00105 MEETME_RECORD_STARTED, 00106 MEETME_RECORD_ACTIVE, 00107 MEETME_RECORD_TERMINATE 00108 };
| enum sla_event_type |
Event types that can be queued up for the SLA thread.
| SLA_EVENT_HOLD | A station has put the call on hold |
| SLA_EVENT_DIAL_STATE | The state of a dial has changed |
| SLA_EVENT_RINGING_TRUNK | The state of a ringing trunk has changed |
Definition at line 472 of file app_meetme.c.
00472 { 00473 /*! A station has put the call on hold */ 00474 SLA_EVENT_HOLD, 00475 /*! The state of a dial has changed */ 00476 SLA_EVENT_DIAL_STATE, 00477 /*! The state of a ringing trunk has changed */ 00478 SLA_EVENT_RINGING_TRUNK, 00479 };
| enum sla_hold_access |
Definition at line 386 of file app_meetme.c.
00386 { 00387 /*! This means that any station can put it on hold, and any station 00388 * can retrieve the call from hold. */ 00389 SLA_HOLD_OPEN, 00390 /*! This means that only the station that put the call on hold may 00391 * retrieve it from hold. */ 00392 SLA_HOLD_PRIVATE, 00393 };
| enum sla_station_hangup |
Definition at line 505 of file app_meetme.c.
00505 { 00506 SLA_STATION_HANGUP_NORMAL, 00507 SLA_STATION_HANGUP_TIMEOUT, 00508 };
| enum sla_trunk_state |
| SLA_TRUNK_STATE_IDLE | |
| SLA_TRUNK_STATE_RINGING | |
| SLA_TRUNK_STATE_UP | |
| SLA_TRUNK_STATE_ONHOLD | |
| SLA_TRUNK_STATE_ONHOLD_BYME |
Definition at line 378 of file app_meetme.c.
00378 { 00379 SLA_TRUNK_STATE_IDLE, 00380 SLA_TRUNK_STATE_RINGING, 00381 SLA_TRUNK_STATE_UP, 00382 SLA_TRUNK_STATE_ONHOLD, 00383 SLA_TRUNK_STATE_ONHOLD_BYME, 00384 };
| enum sla_which_trunk_refs |
Definition at line 373 of file app_meetme.c.
00373 { 00374 ALL_TRUNK_REFS, 00375 INACTIVE_TRUNK_REFS, 00376 };
| enum volume_action |
| static int action_meetmemute | ( | struct mansession * | s, | |
| const struct message * | m | |||
| ) | [static] |
Definition at line 3012 of file app_meetme.c.
References meetmemute(), and s.
Referenced by load_module().
03013 { 03014 return meetmemute(s, m, 1); 03015 }
| static int action_meetmeunmute | ( | struct mansession * | s, | |
| const struct message * | m | |||
| ) | [static] |
Definition at line 3017 of file app_meetme.c.
References meetmemute(), and s.
Referenced by load_module().
03018 { 03019 return meetmemute(s, m, 0); 03020 }
| static int admin_exec | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
The MeetMeadmin application.
Definition at line 2798 of file app_meetme.c.
References ADMINFLAG_KICKME, ADMINFLAG_MUTED, ADMINFLAG_SELFMUTED, ast_conf_user::adminflags, AST_APP_ARG, AST_DECLARE_APP_ARGS, AST_LIST_LAST, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log(), ast_module_user_add, ast_module_user_remove, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_conference::chan, ast_conference::confno, dispose_conf(), find_user(), ast_conference::locked, LOG_NOTICE, LOG_WARNING, ast_conference::refcount, reset_volumes(), tweak_listen_volume(), tweak_talk_volume(), ast_conf_user::userflags, and VOL_UP.
Referenced by load_module(), meetme_cmd(), run_station(), sla_station_exec(), and sla_stop_ringing_trunk().
02798 { 02799 char *params; 02800 struct ast_conference *cnf; 02801 struct ast_conf_user *user = NULL; 02802 struct ast_module_user *u; 02803 AST_DECLARE_APP_ARGS(args, 02804 AST_APP_ARG(confno); 02805 AST_APP_ARG(command); 02806 AST_APP_ARG(user); 02807 ); 02808 02809 if (ast_strlen_zero(data)) { 02810 ast_log(LOG_WARNING, "MeetMeAdmin requires an argument!\n"); 02811 return -1; 02812 } 02813 02814 u = ast_module_user_add(chan); 02815 02816 AST_LIST_LOCK(&confs); 02817 02818 params = ast_strdupa(data); 02819 AST_STANDARD_APP_ARGS(args, params); 02820 02821 if (!args.command) { 02822 ast_log(LOG_WARNING, "MeetmeAdmin requires a command!\n"); 02823 AST_LIST_UNLOCK(&confs); 02824 ast_module_user_remove(u); 02825 return -1; 02826 } 02827 AST_LIST_TRAVERSE(&confs, cnf, list) { 02828 if (!strcmp(cnf->confno, args.confno)) 02829 break; 02830 } 02831 02832 if (!cnf) { 02833 ast_log(LOG_WARNING, "Conference number '%s' not found!\n", args.confno); 02834 AST_LIST_UNLOCK(&confs); 02835 ast_module_user_remove(u); 02836 return 0; 02837 } 02838 02839 ast_atomic_fetchadd_int(&cnf->refcount, 1); 02840 02841 if (args.user) 02842 user = find_user(cnf, args.user); 02843 02844 switch (*args.command) { 02845 case 76: /* L: Lock */ 02846 cnf->locked = 1; 02847 break; 02848 case 108: /* l: Unlock */ 02849 cnf->locked = 0; 02850 break; 02851 case 75: /* K: kick all users */ 02852 AST_LIST_TRAVERSE(&cnf->userlist, user, list) 02853 user->adminflags |= ADMINFLAG_KICKME; 02854 break; 02855 case 101: /* e: Eject last user*/ 02856 user = AST_LIST_LAST(&cnf->userlist); 02857 if (!(user->userflags & CONFFLAG_ADMIN)) 02858 user->adminflags |= ADMINFLAG_KICKME; 02859 else 02860 ast_log(LOG_NOTICE, "Not kicking last user, is an Admin!\n"); 02861 break; 02862 case 77: /* M: Mute */ 02863 if (user) { 02864 user->adminflags |= ADMINFLAG_MUTED; 02865 } else 02866 ast_log(LOG_NOTICE, "Specified User not found!\n"); 02867 break; 02868 case 78: /* N: Mute all (non-admin) users */ 02869 AST_LIST_TRAVERSE(&cnf->userlist, user, list) { 02870 if (!(user->userflags & CONFFLAG_ADMIN)) 02871 user->