#include "asterisk.h"
#include <dahdi/user.h>
#include "asterisk/lock.h"
#include "asterisk/file.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/cli.h"
#include "asterisk/say.h"
#include "asterisk/utils.h"
#include "asterisk/translate.h"
#include "asterisk/ulaw.h"
#include "asterisk/astobj2.h"
#include "asterisk/devicestate.h"
#include "asterisk/dial.h"
#include "asterisk/causes.h"
#include "asterisk/paths.h"
#include "enter.h"
#include "leave.h"

Go to the source code of this file.
Data Structures | |
| struct | announce_listitem |
| struct | ast_conf_user |
| The MeetMe User object. More... | |
| struct | ast_conference |
| The MeetMe Conference object. More... | |
| struct | confs |
| 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_stations |
| struct | sla_trunk |
| struct | sla_trunk_ref |
| struct | sla_trunks |
| struct | volume |
Defines | |
| #define | AST_FRAME_BITS 32 |
| #define | CONF_SIZE 320 |
| #define | CONFIG_FILE_NAME "meetme.conf" |
| #define | DATE_FORMAT "%Y-%m-%d %H:%M:%S" |
| #define | DEFAULT_AUDIO_BUFFERS 32 |
| #define | MAX_CONFNUM 80 |
| #define | MAX_PIN 80 |
| #define | MAX_SETTINGS (MAX_CONFNUM + MAX_PIN + MAX_PIN + 3) |
| #define | MC_DATA_FORMAT "%-12.12s %4.4d %4.4s %02d:%02d:%02d %-8s %-6s\n" |
| #define | MC_HEADER_FORMAT "%-14s %-14s %-10s %-8s %-8s %-6s\n" |
| #define | MEETME_DELAYDETECTENDTALK 1000 |
| #define | MEETME_DELAYDETECTTALK 300 |
| #define | OPTIONS_LEN 100 |
| #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), ADMINFLAG_T_REQUEST = (1 << 4) } |
| enum | { CONFFLAG_ADMIN = (1 << 0), CONFFLAG_MONITOR = (1 << 1), CONFFLAG_KEYEXIT = (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), CONFFLAG_KICK_CONTINUE = (1 << 28), CONFFLAG_DURATION_STOP = (1 << 29), CONFFLAG_DURATION_LIMIT = (1 << 30), CONFFLAG_NO_AUDIO_UNTIL_UP = (1 << 31) } |
| enum | { OPT_ARG_WAITMARKED = 0, OPT_ARG_EXITKEYS = 1, OPT_ARG_DURATION_STOP = 2, OPT_ARG_DURATION_LIMIT = 3, OPT_ARG_MOH_CLASS = 4, OPT_ARG_ARRAY_SIZE = 5 } |
| enum | { SLA_TRUNK_OPT_MOH = (1 << 0) } |
| enum | { SLA_TRUNK_OPT_ARG_MOH_CLASS = 0, SLA_TRUNK_OPT_ARG_ARRAY_SIZE = 1 } |
| enum | announcetypes { CONF_HASJOIN, CONF_HASLEFT } |
| 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, SLA_EVENT_RELOAD, SLA_EVENT_CHECK_RELOAD } |
| 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 void | __reg_module (void) |
| static void | __unreg_module (void) |
| static int | acf_meetme_info (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
| static int | acf_meetme_info_eval (char *keyword, struct ast_conference *conf) |
| static int | action_meetmelist (struct mansession *s, const struct message *m) |
| 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. | |
| static void * | announce_thread (void *data) |
| static void | answer_trunk_chan (struct ast_channel *chan) |
| static struct ast_conference * | build_conf (char *confno, char *pin, char *pinadmin, int make, int dynamic, int refcount, const struct ast_channel *chan) |
| Find or create a conference. | |
| static int | can_write (struct ast_channel *chan, int confflags) |
| static int | careful_write (int fd, unsigned char *data, int len, int block) |
| static int | channel_admin_exec (struct ast_channel *chan, void *data) |
| 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 void | conf_start_moh (struct ast_channel *chan, const char *musicclass) |
| 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, int *too_early, char **optargs) |
| static struct ast_conf_user * | find_user (struct ast_conference *conf, char *callerident) |
| static const char * | get_announce_filename (enum announcetypes type) |
| static char * | istalking (int x) |
| static int | load_config (int reload) |
| static void | load_config_meetme (void) |
| static int | load_module (void) |
| static char * | meetme_cmd (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
| static char * | meetme_show_cmd (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
| static int | meetmemute (struct mansession *s, const struct message *m, int mute) |
| static enum ast_device_state | 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 int | rt_extend_conf (char *confno) |
| static void * | run_station (void *data) |
| static void | send_talking_event (struct ast_channel *chan, struct ast_conference *conf, struct ast_conf_user *user, int talking) |
| 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 | set_user_talking (struct ast_channel *chan, struct ast_conference *conf, struct ast_conf_user *user, int talking, int monitor) |
| 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 void | sla_check_reload (void) |
| Check if we can do a reload of SLA, and do it if we can. | |
| 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 rm) |
| 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 (int reload) |
| 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 char * | sla_show_stations (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
| static char * | sla_show_trunks (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
| static enum ast_device_state | sla_state (const char *data) |
| static enum ast_device_state | sla_state_to_devstate (enum sla_trunk_state state) |
| 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) |
| static int | user_chan_cb (void *obj, void *args, int flags) |
| static int | user_listen_voldown_cb (void *obj, void *unused, int flags) |
| static int | user_listen_volup_cb (void *obj, void *unused, int flags) |
| static int | user_max_cmp (void *obj, void *arg, int flags) |
| static int | user_no_cmp (void *obj, void *arg, int flags) |
| static int | user_reset_vol_cb (void *obj, void *unused, int flags) |
| static int | user_set_kickme_cb (void *obj, void *unused, int flags) |
| static int | user_set_muted_cb (void *obj, void *unused, int flags) |
| static int | user_set_unmuted_cb (void *obj, void *unused, int flags) |
| static int | user_talk_voldown_cb (void *obj, void *unused, int flags) |
| static int | user_talk_volup_cb (void *obj, void *unused, int flags) |
Variables | |
| static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "MeetMe conference bridge" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .reload = reload, } |
| static const char * | app = "MeetMe" |
| static const char * | app2 = "MeetMeCount" |
| static const char * | app3 = "MeetMeAdmin" |
| static const char * | app4 = "MeetMeChannelAdmin" |
| static struct ast_module_info * | ast_module_info = &__mod_info |
| static int | audio_buffers |
| static struct ast_cli_entry | cli_meetme [] |
| static unsigned int | conf_map [1024] = {0, } |
| static int | earlyalert |
| static int | endalert |
| static int | extendby |
| static int | fuzzystart |
| static char const | gain_map [] |
| static char | mandescr_meetmelist [] |
| static struct ast_custom_function | meetme_info_acf |
| static struct ast_app_option | meetme_opts [128] = { [ 'A' ] = { .flag = CONFFLAG_MARKEDUSER }, [ 'a' ] = { .flag = CONFFLAG_ADMIN }, [ 'b' ] = { .flag = CONFFLAG_AGI }, [ 'c' ] = { .flag = CONFFLAG_ANNOUNCEUSERCOUNT }, [ 'C' ] = { .flag = CONFFLAG_KICK_CONTINUE }, [ 'D' ] = { .flag = CONFFLAG_DYNAMICPIN }, [ 'd' ] = { .flag = CONFFLAG_DYNAMIC }, [ 'E' ] = { .flag = CONFFLAG_EMPTYNOPIN }, [ 'e' ] = { .flag = CONFFLAG_EMPTY }, [ 'F' ] = { .flag = CONFFLAG_PASS_DTMF }, [ 'i' ] = { .flag = CONFFLAG_INTROUSER }, [ 'I' ] = { .flag = CONFFLAG_INTROUSERNOREVIEW }, [ 'M' ] = { .flag = CONFFLAG_MOH , .arg_index = OPT_ARG_MOH_CLASS + 1 }, [ 'm' ] = { .flag = CONFFLAG_STARTMUTED }, [ 'o' ] = { .flag = CONFFLAG_OPTIMIZETALKER }, [ 'P' ] = { .flag = CONFFLAG_ALWAYSPROMPT }, [ 'p' ] = { .flag = CONFFLAG_KEYEXIT , .arg_index = OPT_ARG_EXITKEYS + 1 }, [ 'q' ] = { .flag = CONFFLAG_QUIET }, [ 'r' ] = { .flag = CONFFLAG_RECORDCONF }, [ 's' ] = { .flag = CONFFLAG_STARMENU }, [ 'T' ] = { .flag = CONFFLAG_MONITORTALKER }, [ 'l' ] = { .flag = CONFFLAG_MONITOR }, [ 't' ] = { .flag = CONFFLAG_TALKER }, [ 'w' ] = { .flag = CONFFLAG_WAITMARKED , .arg_index = OPT_ARG_WAITMARKED + 1 }, [ 'X' ] = { .flag = CONFFLAG_EXIT_CONTEXT }, [ 'x' ] = { .flag = CONFFLAG_MARKEDEXIT }, [ '1' ] = { .flag = CONFFLAG_NOONLYPERSON }, [ 'S' ] = { .flag = CONFFLAG_DURATION_STOP , .arg_index = OPT_ARG_DURATION_STOP + 1 }, [ 'L' ] = { .flag = CONFFLAG_DURATION_LIMIT , .arg_index = OPT_ARG_DURATION_LIMIT + 1 }, } |
| static int | rt_log_members |
| static int | rt_schedule |
| struct { | |
| unsigned int attempt_callerid:1 | |
| ast_cond_t cond | |
| struct { | |
| struct sla_event * first | |
| struct sla_event * last | |
| } event_q | |
| struct { | |
| struct sla_failed_station * first | |
| struct sla_failed_station * last | |
| } failed_stations | |
| ast_mutex_t lock | |
| unsigned int reload:1 | |
| struct { | |
| struct sla_ringing_station * first | |
| struct sla_ringing_station * last | |
| } ringing_stations | |
| struct { | |
| struct sla_ringing_trunk * first | |
| struct sla_ringing_trunk * last | |
| } ringing_trunks | |
| unsigned int stop:1 | |
| pthread_t thread | |
| } | sla |
| A structure for data used by the sla thread. | |
| static const char | sla_registrar [] = "SLA" |
| static struct ast_app_option | sla_trunk_opts [128] = { [ 'M' ] = { .flag = SLA_TRUNK_OPT_MOH , .arg_index = SLA_TRUNK_OPT_ARG_MOH_CLASS + 1 }, } |
| static const char * | slastation_app = "SLAStation" |
| static const char * | slatrunk_app = "SLATrunk" |
Definition in file app_meetme.c.
| #define AST_FRAME_BITS 32 |
Definition at line 445 of file app_meetme.c.
Referenced by conf_free(), conf_run(), and recordthread().
| #define CONF_SIZE 320 |
Definition at line 464 of file app_meetme.c.
| #define CONFIG_FILE_NAME "meetme.conf" |
Definition at line 425 of file app_meetme.c.
Referenced by _dsp_init(), conf_exec(), find_conf(), and load_config_meetme().
| #define DATE_FORMAT "%Y-%m-%d %H:%M:%S" |
String format for scheduled conferences
Definition at line 432 of file app_meetme.c.
Referenced by append_date(), build_radius_record(), conf_run(), execute_cb(), find_conf_realtime(), format_date(), get_date(), manager_log(), pgsql_log(), and rt_extend_conf().
| #define DEFAULT_AUDIO_BUFFERS 32 |
each buffer is 20ms, so this is 640ms total
Definition at line 429 of file app_meetme.c.
Referenced by load_config_meetme().
| #define MAX_CONFNUM 80 |
Definition at line 585 of file app_meetme.c.
Referenced by conf_exec(), dial_trunk(), meetme_cmd(), meetme_show_cmd(), sla_station_exec(), and sla_trunk_exec().
| #define MAX_PIN 80 |
| #define MAX_SETTINGS (MAX_CONFNUM + MAX_PIN + MAX_PIN + 3) |
| #define MC_DATA_FORMAT "%-12.12s %4.4d %4.4s %02d:%02d:%02d %-8s %-6s\n" |
Referenced by meetme_show_cmd().
| #define MC_HEADER_FORMAT "%-14s %-14s %-10s %-8s %-8s %-6s\n" |
Referenced by meetme_show_cmd().
| #define MEETME_DELAYDETECTENDTALK 1000 |
| #define MEETME_DELAYDETECTTALK 300 |
| #define OPTIONS_LEN 100 |
| #define S | ( | e | ) | case e: return # e; |
Referenced by sms_readfile(), and trunkstate2str().
| #define SLA_CONFIG_FILE "sla.conf" |
Definition at line 426 of file app_meetme.c.
Referenced by sla_build_station(), sla_build_trunk(), and sla_load_config().
| anonymous enum |
| ADMINFLAG_MUTED | User is muted |
| ADMINFLAG_SELFMUTED | User muted self |
| ADMINFLAG_KICKME | User has been kicked |
| ADMINFLAG_T_REQUEST | User has requested to speak |
Definition at line 434 of file app_meetme.c.
00434 { 00435 ADMINFLAG_MUTED = (1 << 1), /*!< User is muted */ 00436 ADMINFLAG_SELFMUTED = (1 << 2), /*!< User muted self */ 00437 ADMINFLAG_KICKME = (1 << 3), /*!< User has been kicked */ 00438 /*! User has requested to speak */ 00439 ADMINFLAG_T_REQUEST = (1 << 4), 00440 };
| anonymous enum |
| CONFFLAG_ADMIN | user has admin access on the conference |
| CONFFLAG_MONITOR | If set the user can only receive audio from the conference |
| CONFFLAG_KEYEXIT | If set asterisk will exit conference when key defined in p() option is pressed |
| CONFFLAG_STARMENU | If set asterisk will provide a menu to the user when '*' is pressed |
| CONFFLAG_TALKER | If set the use can only send audio to the conference |
| CONFFLAG_QUIET | If set there will be no enter or leave sounds |
| CONFFLAG_ANNOUNCEUSERCOUNT | If set, when user joins the conference, they will be told the number of users that are already in |
| CONFFLAG_AGI | Set to run AGI Script in Background |
| CONFFLAG_MOH | Set to have music on hold when user is alone in conference |
| CONFFLAG_MARKEDEXIT | If set the MeetMe will return if all marked with this flag left |
| CONFFLAG_WAITMARKED | If set, the MeetMe will wait until a marked user enters |
| CONFFLAG_EXIT_CONTEXT | If set, the MeetMe will exit to the specified context |
| CONFFLAG_MARKEDUSER | If set, the user will be marked |
| CONFFLAG_INTROUSER | If set, user will be ask record name on entry of conference |
| CONFFLAG_RECORDCONF | If set, the MeetMe will be recorded |
| CONFFLAG_MONITORTALKER | If set, the user will be monitored if the user is talking or not |
| CONFFLAG_DYNAMIC | |
| CONFFLAG_DYNAMICPIN | |
| CONFFLAG_EMPTY | |
| CONFFLAG_EMPTYNOPIN | |
| CONFFLAG_ALWAYSPROMPT | |
| CONFFLAG_OPTIMIZETALKER | If set, treat talking users as muted users |
| CONFFLAG_NOONLYPERSON | If set, won't speak the extra prompt when the first person enters the conference |
| CONFFLAG_INTROUSERNOREVIEW | If set, user will be asked to record name on entry of conference without review |
| CONFFLAG_STARTMUTED | If set, the user will be initially self-muted |
| CONFFLAG_PASS_DTMF | Pass DTMF through the conference |
| CONFFLAG_SLA_STATION | |
| CONFFLAG_SLA_TRUNK | |
| CONFFLAG_KICK_CONTINUE | If set, the user should continue in the dialplan if kicked out |
| CONFFLAG_DURATION_STOP | |
| CONFFLAG_DURATION_LIMIT | |
| CONFFLAG_NO_AUDIO_UNTIL_UP | Do not write any audio to this channel until the state is up. |
Definition at line 466 of file app_meetme.c.
00466 { 00467 /*! user has admin access on the conference */ 00468 CONFFLAG_ADMIN = (1 << 0), 00469 /*! If set the user can only receive audio from the conference */ 00470 CONFFLAG_MONITOR = (1 << 1), 00471 /*! If set asterisk will exit conference when key defined in p() option is pressed */ 00472 CONFFLAG_KEYEXIT = (1 << 2), 00473 /*! If set asterisk will provide a menu to the user when '*' is pressed */ 00474 CONFFLAG_STARMENU = (1 << 3), 00475 /*! If set the use can only send audio to the conference */ 00476 CONFFLAG_TALKER = (1 << 4), 00477 /*! If set there will be no enter or leave sounds */ 00478 CONFFLAG_QUIET = (1 << 5), 00479 /*! If set, when user joins the conference, they will be told the number 00480 * of users that are already in */ 00481 CONFFLAG_ANNOUNCEUSERCOUNT = (1 << 6), 00482 /*! Set to run AGI Script in Background */ 00483 CONFFLAG_AGI = (1 << 7), 00484 /*! Set to have music on hold when user is alone in conference */ 00485 CONFFLAG_MOH = (1 << 8), 00486 /*! If set the MeetMe will return if all marked with this flag left */ 00487 CONFFLAG_MARKEDEXIT = (1 << 9), 00488 /*! If set, the MeetMe will wait until a marked user enters */ 00489 CONFFLAG_WAITMARKED = (1 << 10), 00490 /*! If set, the MeetMe will exit to the specified context */ 00491 CONFFLAG_EXIT_CONTEXT = (1 << 11), 00492 /*! If set, the user will be marked */ 00493 CONFFLAG_MARKEDUSER = (1 << 12), 00494 /*! If set, user will be ask record name on entry of conference */ 00495 CONFFLAG_INTROUSER = (1 << 13), 00496 /*! If set, the MeetMe will be recorded */ 00497 CONFFLAG_RECORDCONF = (1<< 14), 00498 /*! If set, the user will be monitored if the user is talking or not */ 00499 CONFFLAG_MONITORTALKER = (1 << 15), 00500 CONFFLAG_DYNAMIC = (1 << 16), 00501 CONFFLAG_DYNAMICPIN = (1 << 17), 00502 CONFFLAG_EMPTY = (1 << 18), 00503 CONFFLAG_EMPTYNOPIN = (1 << 19), 00504 CONFFLAG_ALWAYSPROMPT = (1 << 20), 00505 /*! If set, treat talking users as muted users */ 00506 CONFFLAG_OPTIMIZETALKER = (1 << 21), 00507 /*! If set, won't speak the extra prompt when the first person 00508 * enters the conference */ 00509 CONFFLAG_NOONLYPERSON = (1 << 22), 00510 /*! If set, user will be asked to record name on entry of conference 00511 * without review */ 00512 CONFFLAG_INTROUSERNOREVIEW = (1 << 23), 00513 /*! If set, the user will be initially self-muted */ 00514 CONFFLAG_STARTMUTED = (1 << 24), 00515 /*! Pass DTMF through the conference */ 00516 CONFFLAG_PASS_DTMF = (1 << 25), 00517 CONFFLAG_SLA_STATION = (1 << 26), 00518 CONFFLAG_SLA_TRUNK = (1 << 27), 00519 /*! If set, the user should continue in the dialplan if kicked out */ 00520 CONFFLAG_KICK_CONTINUE = (1 << 28), 00521 CONFFLAG_DURATION_STOP = (1 << 29), 00522 CONFFLAG_DURATION_LIMIT = (1 << 30), 00523 /*! Do not write any audio to this channel until the state is up. */ 00524 CONFFLAG_NO_AUDIO_UNTIL_UP = (1 << 31), 00525 };
| anonymous enum |
| OPT_ARG_WAITMARKED | |
| OPT_ARG_EXITKEYS | |
| OPT_ARG_DURATION_STOP | |
| OPT_ARG_DURATION_LIMIT | |
| OPT_ARG_MOH_CLASS | |
| OPT_ARG_ARRAY_SIZE |
Definition at line 527 of file app_meetme.c.
00527 { 00528 OPT_ARG_WAITMARKED = 0, 00529 OPT_ARG_EXITKEYS = 1, 00530 OPT_ARG_DURATION_STOP = 2, 00531 OPT_ARG_DURATION_LIMIT = 3, 00532 OPT_ARG_MOH_CLASS = 4, 00533 OPT_ARG_ARRAY_SIZE = 5, 00534 };
| anonymous enum |
| anonymous enum |
Definition at line 5982 of file app_meetme.c.
05982 { 05983 SLA_TRUNK_OPT_ARG_MOH_CLASS = 0, 05984 SLA_TRUNK_OPT_ARG_ARRAY_SIZE = 1, 05985 };
| enum announcetypes |
Definition at line 592 of file app_meetme.c.
00592 { 00593 CONF_HASJOIN, 00594 CONF_HASLEFT 00595 };
| enum entrance_sound |
| enum recording_state |
Definition at line 457 of file app_meetme.c.
00457 { 00458 MEETME_RECORD_OFF, 00459 MEETME_RECORD_STARTED, 00460 MEETME_RECORD_ACTIVE, 00461 MEETME_RECORD_TERMINATE 00462 };
| 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 |
| SLA_EVENT_RELOAD | A reload of configuration has been requested |
| SLA_EVENT_CHECK_RELOAD | Poke the SLA thread so it can check if it can perform a reload |
Definition at line 785 of file app_meetme.c.
00785 { 00786 /*! A station has put the call on hold */ 00787 SLA_EVENT_HOLD, 00788 /*! The state of a dial has changed */ 00789 SLA_EVENT_DIAL_STATE, 00790 /*! The state of a ringing trunk has changed */ 00791 SLA_EVENT_RINGING_TRUNK, 00792 /*! A reload of configuration has been requested */ 00793 SLA_EVENT_RELOAD, 00794 /*! Poke the SLA thread so it can check if it can perform a reload */ 00795 SLA_EVENT_CHECK_RELOAD, 00796 };
| enum sla_hold_access |
Definition at line 695 of file app_meetme.c.
00695 { 00696 /*! This means that any station can put it on hold, and any station 00697 * can retrieve the call from hold. */ 00698 SLA_HOLD_OPEN, 00699 /*! This means that only the station that put the call on hold may 00700 * retrieve it from hold. */ 00701 SLA_HOLD_PRIVATE, 00702 };
| enum sla_station_hangup |
Definition at line 822 of file app_meetme.c.
00822 { 00823 SLA_STATION_HANGUP_NORMAL, 00824 SLA_STATION_HANGUP_TIMEOUT, 00825 };
| 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 687 of file app_meetme.c.
00687 { 00688 SLA_TRUNK_STATE_IDLE, 00689 SLA_TRUNK_STATE_RINGING, 00690 SLA_TRUNK_STATE_UP, 00691 SLA_TRUNK_STATE_ONHOLD, 00692 SLA_TRUNK_STATE_ONHOLD_BYME, 00693 };
| enum sla_which_trunk_refs |
Definition at line 682 of file app_meetme.c.
00682 { 00683 ALL_TRUNK_REFS, 00684 INACTIVE_TRUNK_REFS, 00685 };
| enum volume_action |
| static void __reg_module | ( | void | ) | [static] |
Definition at line 6685 of file app_meetme.c.
| static void __unreg_module | ( | void | ) | [static] |
Definition at line 6685 of file app_meetme.c.
| static int acf_meetme_info | ( | struct ast_channel * | chan, | |
| const char * | cmd, | |||
| char * | data, | |||
| char * | buf, | |||
| size_t | len | |||
| ) | [static] |
Definition at line 6540 of file app_meetme.c.
References acf_meetme_info_eval(), AST_APP_ARG, AST_DECLARE_APP_ARGS, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_conference::confno, ast_conference::list, LOG_ERROR, LOG_NOTICE, and parse().
06541 { 06542 struct ast_conference *conf; 06543 char *parse; 06544 int result = -2; /* only non-negative numbers valid, -1 is used elsewhere */ 06545 AST_DECLARE_APP_ARGS(args, 06546 AST_APP_ARG(keyword); 06547 AST_APP_ARG(confno); 06548 ); 06549 06550 if (ast_strlen_zero(data)) { 06551 ast_log(LOG_ERROR, "Syntax: MEETME_INFO() requires two arguments\n"); 06552 return -1; 06553 } 06554 06555 parse = ast_strdupa(data); 06556 AST_STANDARD_APP_ARGS(args, parse); 06557 06558 if (ast_strlen_zero(args.keyword)) { 06559 ast_log(LOG_ERROR, "Syntax: MEETME_INFO() requires a keyword\n"); 06560 return -1; 06561 } 06562 06563 if (ast_strlen_zero(args.confno)) { 06564 ast_log(LOG_ERROR, "Syntax: MEETME_INFO() requires a conference number\n"); 06565 return -1; 06566 } 06567 06568 AST_LIST_LOCK(&confs); 06569 AST_LIST_TRAVERSE(&confs, conf, list) { 06570 if (!strcmp(args.confno, conf->confno)) { 06571 result = acf_meetme_info_eval(args.keyword, conf); 06572 break; 06573 } 06574 } 06575 AST_LIST_UNLOCK(&confs); 06576 06577 if (result > -1) { 06578 snprintf(buf, len, "%d", result); 06579 } else if (result == -1) { 06580 ast_log(LOG_NOTICE, "Error: invalid keyword: '%s'\n", args.keyword); 06581 snprintf(buf, len, "0"); 06582 } else if (result == -2) { 06583 ast_log(LOG_NOTICE, "Error: conference (%s) not found\n", args.confno); 06584 snprintf(buf, len, "0"); 06585 } 06586 06587 return 0; 06588 }
| static int acf_meetme_info_eval | ( | char * | keyword, | |
| struct ast_conference * | conf | |||
| ) | [static] |
Definition at line 6522 of file app_meetme.c.
References ast_conference::isdynamic, ast_conference::locked, ast_conference::start, and ast_conference::users.
Referenced by acf_meetme_info().
06523 { 06524 if (!strcasecmp("lock", keyword)) { 06525 return conf->locked; 06526 } else if (!strcasecmp("parties", keyword)) { 06527 return conf->users; 06528 } else if (!strcasecmp("activity", keyword)) { 06529 time_t now; 06530 now = time(NULL); 06531 return (now - conf->start); 06532 } else if (!strcasecmp("dynamic", keyword)) { 06533 return conf->isdynamic; 06534 } else { 06535 return -1; 06536 } 06537 06538 }
| static int action_meetmelist | ( | struct mansession * | s, | |
| const struct message * | m | |||
| ) | [static] |
Definition at line 4457 of file app_meetme.c.
References ADMINFLAG_MUTED, ADMINFLAG_SELFMUTED, ast_conf_user::adminflags, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, AST_LIST_EMPTY, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strlen_zero(), astman_append(), astman_get_header(), astman_send_error(), astman_send_listack(), ast_conf_user::chan, ast_channel::cid, ast_callerid::cid_name, ast_callerid::cid_num, CONFFLAG_ADMIN, CONFFLAG_MARKEDUSER, CONFFLAG_MONITOR, CONFFLAG_TALKER, ast_conference::confno, ast_channel::name, S_OR, ast_conf_user::talking, total, ast_conf_user::user_no, ast_conference::usercontainer, and ast_conf_user::userflags.
Referenced by load_module().
04458 { 04459 const char *actionid = astman_get_header(m, "ActionID"); 04460 const char *conference = astman_get_header(m, "Conference"); 04461 char idText[80] = ""; 04462 struct ast_conference *cnf; 04463 struct ast_conf_user *user; 04464 struct ao2_iterator user_iter; 04465 int total = 0; 04466 04467 if (!ast_strlen_zero(actionid)) 04468 snprintf(idText, sizeof(idText), "ActionID: %s\r\n", actionid); 04469 04470 if (AST_LIST_EMPTY(&confs)) { 04471 astman_send_error(s, m, "No active conferences."); 04472 return 0; 04473 } 04474 04475 astman_send_listack(s, m, "Meetme user list will follow", "start"); 04476 04477 /* Find the right conference */ 04478 AST_LIST_LOCK(&confs); 04479 AST_LIST_TRAVERSE(&confs, cnf, list) { 04480 user_iter = ao2_iterator_init(cnf->usercontainer, 0); 04481 /* If we ask for one particular, and this isn't it, skip it */ 04482 if (!ast_strlen_zero(conference) && strcmp(cnf->confno, conference)) 04483 continue; 04484 04485 /* Show all the users */ 04486 while ((user = ao2_iterator_next(&user_iter))) { 04487 total++; 04488 astman_append(s, 04489 "Event: MeetmeList\r\n" 04490 "%s" 04491 "Conference: %s\r\n" 04492 "UserNumber: %d\r\n" 04493 "CallerIDNum: %s\r\n" 04494 "CallerIDName: %s\r\n" 04495 "Channel: %s\r\n" 04496 "Admin: %s\r\n" 04497 "Role: %s\r\n" 04498 "MarkedUser: %s\r\n" 04499 "Muted: %s\r\n" 04500 "Talking: %s\r\n" 04501 "\r\n", 04502 idText, 04503 cnf->confno, 04504 user->user_no, 04505 S_OR(user->chan->cid.cid_num, "<unknown>"), 04506 S_OR(user->chan->cid.cid_name, "<no name>"), 04507 user->chan->name, 04508 user->userflags & CONFFLAG_ADMIN ? "Yes" : "No", 04509 user->userflags & CONFFLAG_MONITOR ? "Listen only" : user->userflags & CONFFLAG_TALKER ? "Talk only" : "Talk and listen", 04510 user->userflags & CONFFLAG_MARKEDUSER ? "Yes" : "No", 04511 user->adminflags & ADMINFLAG_MUTED ? "By admin" : user->adminflags & ADMINFLAG_SELFMUTED ? "By self" : "No", 04512 user->talking > 0 ? "Yes" : user->talking == 0 ? "No" : "Not monitored"); 04513 ao2_ref(user, -1); 04514 } 04515 ao2_iterator_destroy(&user_iter); 04516 } 04517 AST_LIST_UNLOCK(&confs); 04518 /* Send final confirmation */ 04519 astman_append(s, 04520 "Event: MeetmeListComplete\r\n" 04521 "EventList: Complete\r\n" 04522 "ListItems: %d\r\n" 04523 "%s" 04524 "\r\n", total, idText); 04525 return 0; 04526 }
| static int action_meetmemute | ( | struct mansession * | s, | |
| const struct message * | m | |||
| ) | [static] |
Definition at line 4439 of file app_meetme.c.
References meetmemute().
Referenced by load_module().
04440 { 04441 return meetmemute(s, m, 1); 04442 }
| static int action_meetmeunmute | ( | struct mansession * | s, | |
| const struct message * | m | |||
| ) | [static] |
Definition at line 4444 of file app_meetme.c.
References meetmemute().
Referenced by load_module().
04445 { 04446 return meetmemute(s, m, 0); 04447 }
| static int admin_exec | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
The MeetMeadmin application.
Definition at line 4172 of file app_meetme.c.
References ADMINFLAG_KICKME, ADMINFLAG_MUTED, ADMINFLAG_SELFMUTED, ADMINFLAG_T_REQUEST, ast_conf_user::adminflags, ao2_callback, ao2_find, ao2_ref, AST_APP_ARG, ast_atomic_fetchadd_int(), AST_DECLARE_APP_ARGS, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), CONFFLAG_ADMIN, ast_conference::confno, dispose_conf(), find_user(), ast_conf_user::list, ast_conference::locked, LOG_NOTICE, LOG_WARNING, OBJ_NODATA, pbx_builtin_setvar_helper(), ast_conference::refcount, reset_volumes(), rt_extend_conf(), tweak_listen_volume(), tweak_talk_volume(), user_listen_voldown_cb(), user_listen_volup_cb(), user_max_cmp(), user_reset_vol_cb(), user_set_kickme_cb(), user_set_muted_cb(), user_set_unmuted_cb(), user_talk_voldown_cb(), user_talk_volup_cb(), ast_conference::usercontainer, ast_conf_user::userflags, VOL_DOWN, and VOL_UP.
Referenced by load_module(), meetme_cmd(), meetme_show_cmd(), run_station(), sla_station_exec(), and sla_stop_ringing_trunk().
04172 { 04173 char *params; 04174 struct ast_conference *cnf; 04175 struct ast_conf_user *user = NULL; 04176 AST_DECLARE_APP_ARGS(args, 04177 AST_APP_ARG(confno); 04178 AST_APP_ARG(command); 04179 AST_APP_ARG(user); 04180 ); 04181 int res = 0; 04182 04183 if (ast_strlen_zero(data)) { 04184 ast_log(LOG_WARNING, "MeetMeAdmin requires an argument!\n"); 04185 pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE"); 04186 return -1; 04187 } 04188 04189 params = ast_strdupa(data); 04190 AST_STANDARD_APP_ARGS(args, params); 04191 04192 if (!args.command) { 04193 ast_log(LOG_WARNING, "MeetmeAdmin requires a command!\n"); 04194 pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE"); 04195 return -1; 04196 } 04197 04198 AST_LIST_LOCK(&confs); 04199 AST_LIST_TRAVERSE(&confs, cnf, list) { 04200 if (!strcmp(cnf->confno, args.confno)) 04201 break; 04202 } 04203 04204 if (!cnf) { 04205 ast_log(LOG_WARNING, "Conference number '%s' not found!\n", args.confno); 04206 AST_LIST_UNLOCK(&confs); 04207 pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOTFOUND"); 04208 return 0; 04209 } 04210 04211 ast_atomic_fetchadd_int(&cnf->refcount, 1); 04212 04213 if (args.user) { 04214 user = find_user(cnf, args.user); 04215 if (!user) { 04216 ast_log(LOG_NOTICE, "Specified User not found!\n"); 04217 res = -2; 04218 goto usernotfound; 04219 } 04220 } 04221 04222 switch (*args.command) { 04223 case 76: /* L: Lock */ 04224 cnf->locked = 1; 04225 break; 04226 case 108: /* l: Unlock */ 04227 cnf->locked = 0; 04228 break; 04229 case 75: /* K: kick all users */ 04230 ao2_callback(cnf->usercontainer, OBJ_NODATA, user_set_kickme_cb, NULL); 04231 break; 04232 case 101: /* e: Eject last user*/ 04233 { 04234 int max_no = 0; 04235 ao2_callback(cnf->usercontainer, OBJ_NODATA, user_max_cmp, &max_no); 04236 user = ao2_find(cnf->usercontainer, &max_no, 0); 04237 if (!(user->userflags & CONFFLAG_ADMIN)) 04238 user->adminflags |= ADMINFLAG_KICKME; 04239 else { 04240 res = -1; 04241 ast_log(LOG_NOTICE, "Not kicking last user, is an Admin!\n"); 04242 } 04243 ao2_ref(user, -1); 04244 break; 04245 } 04246 case 77: /* M: Mute */ 04247 if (user) { 04248 user->adminflags |= ADMINFLAG_MUTED; 04249 } else { 04250 res = -2; 04251 ast_log(LOG_NOTICE, "Specified User not found!\n"); 04252 } 04253 break; 04254 case 78: /* N: Mute all (non-admin) users */ 04255 ao2_callback(cnf->usercontainer, OBJ_NODATA, user_set_muted_cb, NULL); 04256 break; 04257 case 109: /* m: Unmute */ 04258 user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED | ADMINFLAG_T_REQUEST); 04259 break; 04260 case 110: /* n: Unmute all users */ 04261 ao2_callback(cnf->usercontainer, OBJ_NODATA, user_set_unmuted_cb, NULL); 04262 break; 04263 case 107: /* k: Kick user */ 04264 user->adminflags |= ADMINFLAG_KICKME; 04265 break; 04266 case 118: /* v: Lower all users listen volume */ 04267 ao2_callback(cnf->usercontainer, OBJ_NODATA, user_listen_voldown_cb, NULL); 04268 break; 04269 case 86: /* V: Raise all users listen volume */ 04270 ao2_callback(cnf->usercontainer, OBJ_NODATA, user_listen_volup_cb, NULL); 04271 break; 04272 case 115: /* s: Lower all users speaking volume */ 04273 ao2_callback(cnf->usercontainer, OBJ_NODATA, user_talk_voldown_cb, NULL); 04274 break; 04275 case 83: /* S: Raise all users speaking volume */ 04276 ao2_callback(cnf->usercontainer, OBJ_NODATA, user_talk_volup_cb, NULL); 04277 break; 04278 case 82: /* R: Reset all volume levels */ 04279 ao2_callback(cnf->usercontainer, OBJ_NODATA, user_reset_vol_cb, NULL); 04280 break; 04281 case 114: /* r: Reset user's volume level */ 04282 reset_volumes(user); 04283 break; 04284 case 85: /* U: Raise user's listen volume */ 04285 tweak_listen_volume(user, VOL_UP); 04286 break; 04287 case 117: /* u: Lower user's listen volume */ 04288 tweak_listen_volume(user, VOL_DOWN); 04289 break; 04290 case 84: /* T: Raise user's talk volume */ 04291 tweak_talk_volume(user, VOL_UP); 04292 break; 04293 case 116: /* t: Lower user's talk volume */ 04294 tweak_talk_volume(user, VOL_DOWN); 04295 break; 04296 case 'E': /* E: Extend conference */ 04297 if (rt_extend_conf(args.confno)) { 04298 res = -1; 04299 } 04300 break; 04301 } 04302 04303 if (args.user) { 04304 /* decrement reference from find_user */ 04305 ao2_ref(user, -1); 04306 } 04307 usernotfound: 04308 AST_LIST_UNLOCK(&confs); 04309 04310 dispose_conf(cnf); 04311 pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", res == -2 ? "NOTFOUND" : res ? "FAILED" : "OK"); 04312 04313 return 0; 04314 }
| static void* announce_thread | ( | void * | data | ) | [static] |
Definition at line 1952 of file app_meetme.c.
References ast_conference::announcelist, ast_conference::announcelist_addition, ast_conference::announcelistlock, ast_conference::announcethread_stop, announce_listitem::announcetype, ao2_ref, ast_check_hangup(), ast_cond_wait(), ast_copy_string(), ast_filedelete(), ast_fileexists(), AST_LIST_APPEND_LIST, AST_LIST_EMPTY, AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_HEAD_NOLOCK, AST_LIST_REMOVE_HEAD, ast_log(), ast_mutex_lock(), ast_mutex_unlock(), ast_streamfile(), ast_waitstream(), CONF_HASLEFT, announce_listitem::confchan, announce_listitem::confusers, get_announce_filename(), announce_listitem::language, LOG_DEBUG, and announce_listitem::namerecloc.
Referenced by conf_run().
01953 { 01954 struct announce_listitem *current; 01955 struct ast_conference *conf = data; 01956 int res; 01957 char filename[PATH_MAX] = ""; 01958 AST_LIST_HEAD_NOLOCK(, announce_listitem) local_list; 01959 AST_LIST_HEAD_INIT_NOLOCK(&local_list); 01960 01961 while (!conf->announcethread_stop) { 01962 ast_mutex_lock(&conf->announcelistlock); 01963 if (conf->announcethread_stop) { 01964 ast_mutex_unlock(&conf->announcelistlock); 01965 break; 01966 } 01967 if (AST_LIST_EMPTY(&conf->announcelist)) 01968 ast_cond_wait(&conf->announcelist_addition, &conf->announcelistlock); 01969 01970 AST_LIST_APPEND_LIST(&local_list, &conf->announcelist, entry); 01971 AST_LIST_HEAD_INIT_NOLOCK(&conf->announcelist); 01972 01973 ast_mutex_unlock(&conf->announcelistlock); 01974 if (conf->announcethread_stop) { 01975 break; 01976 } 01977 01978 for (res = 1; !conf->announcethread_stop && (current = AST_LIST_REMOVE_HEAD(&local_list, entry)); ao2_ref(current, -1)) { 01979 ast_log(LOG_DEBUG, "About to play %s\n", current->namerecloc); 01980 if (!ast_fileexists(current->namerecloc, NULL, NULL)) 01981 continue; 01982 if ((current->confchan) && (current->confusers > 1) && !ast_check_hangup(current->confchan)) { 01983 if (!ast_streamfile(current->confchan, current->namerecloc, current->language)) 01984 res = ast_waitstream(current->confchan, ""); 01985 if (!res) { 01986 ast_copy_string(filename, get_announce_filename(current->announcetype), sizeof(filename)); 01987 if (!ast_streamfile(current->confchan, filename, current->language)) 01988 ast_waitstream(current->confchan, ""); 01989 } 01990 } 01991 if (current->announcetype == CONF_HASLEFT) { 01992 ast_filedelete(current->namerecloc, NULL); 01993 } 01994 } 01995 } 01996 01997 /* thread marked to stop, clean up */ 01998 while ((current = AST_LIST_REMOVE_HEAD(&local_list, entry))) { 01999 ast_filedelete(current->namerecloc, NULL); 02000 ao2_ref(current, -1); 02001 } 02002 return NULL; 02003 }
| static void answer_trunk_chan | ( | struct ast_channel * | chan | ) | [static] |
Definition at line 4836 of file app_meetme.c.
References ast_answer(), and ast_indicate().
Referenced by run_station(), sla_handle_dial_state_event(), and sla_station_exec().
04837 { 04838 ast_answer(chan); 04839 ast_indicate(chan, -1); 04840 }
| static struct ast_conference* build_conf | ( | char * | confno, | |
| char * | pin, | |||
| char * | pinadmin, | |||
| int | make, | |||
| int | dynamic, | |||
| int | refcount, | |||
| const struct ast_channel * | chan | |||
| ) | [static, read] |
Find or create a conference.
| confno | The conference name/number | |
| pin | The regular user pin | |
| pinadmin | The admin pin | |
| make | Make the conf if it doesn't exist | |
| dynamic | Mark the newly created conference as dynamic | |
| refcount | How many references to mark on the conference | |
| chan | The asterisk channel |
Definition at line 1085 of file app_meetme.c.
References ast_conference::announcethread, ast_conference::announcethreadlock, ao2_container_alloc, ast_atomic_fetchadd_int(), ast_calloc, ast_copy_string(), AST_FORMAT_SLINEAR, ast_free, ast_hangup(), AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log(), ast_mutex_init(), AST_PTHREADT_NULL, ast_request(), ast_set_read_format(), ast_set_write_format(), ast_verb, ast_conference::chan, conf_map, ast_conference::confno, ast_conference::dahdiconf, ast_conference::fd, ast_channel::fds, ast_conference::isdynamic, ast_conference::listenlock, LOG_WARNING, ast_conference::maxusers, ast_conference::pin, ast_conference::pinadmin, ast_conference::playlock, ast_conference::recordthread, ast_conference::recordthreadlock, ast_conference::refcount, ast_conference::start, ast_channel::uniqueid, ast_conference::uniqueid, user_no_cmp(), and ast_conference::usercontainer.
Referenced by dial_trunk(), find_conf(), find_conf_realtime(), run_station(), sla_station_exec(), and sla_trunk_exec().
01086 { 01087 struct ast_conference *cnf; 01088 struct dahdi_confinfo dahdic = { 0, }; 01089 int confno_int = 0; 01090 01091 AST_LIST_LOCK(&confs); 01092 01093 AST_LIST_TRAVERSE(&confs, cnf, list) { 01094 if (!strcmp(confno, cnf->confno)) 01095 break; 01096 } 01097 01098 if (cnf || (!make && !dynamic)) 01099 goto cnfout; 01100 01101 /* Make a new one */ 01102 if (!(cnf = ast_calloc(1, sizeof(*cnf))) || 01103 !(cnf->usercontainer = ao2_container_alloc(1, NULL, user_no_cmp))) { 01104 goto cnfout; 01105 } 01106 01107 ast_mutex_init(&cnf->playlock); 01108 ast_mutex_init(&cnf->listenlock); 01109 cnf->recordthread = AST_PTHREADT_NULL; 01110 ast_mutex_init(&cnf->recordthreadlock); 01111 cnf->announcethread = AST_PTHREADT_NULL; 01112 ast_mutex_init(&cnf->announcethreadlock); 01113 ast_copy_string(cnf->confno, confno, sizeof(cnf->confno)); 01114 ast_copy_string(cnf->pin, pin, sizeof(cnf->pin)); 01115 ast_copy_string(cnf->pinadmin, pinadmin, sizeof(cnf->pinadmin)); 01116 ast_copy_string(cnf->uniqueid, chan->uniqueid, sizeof(cnf->uniqueid)); 01117 01118 /* Setup a new dahdi conference */ 01119 dahdic.confno = -1; 01120 dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON; 01121 cnf->fd = open("/dev/dahdi/pseudo", O_RDWR); 01122 if (cnf->fd < 0 || ioctl(cnf->fd, DAHDI_SETCONF, &dahdic)) { 01123 ast_log(LOG_WARNING, "Unable to open pseudo device\n"); 01124 if (cnf->fd >= 0) 01125 close(cnf->fd); 01126 ast_free(cnf); 01127 cnf = NULL; 01128 goto cnfout; 01129 } 01130 01131 cnf->dahdiconf = dahdic.confno; 01132 01133 /* Setup a new channel for playback of audio files */ 01134 cnf->chan = ast_request("DAHDI", AST_FORMAT_SLINEAR, "pseudo", NULL); 01135 if (cnf->chan) { 01136 ast_set_read_format(cnf->chan, AST_FORMAT_SLINEAR); 01137 ast_set_write_format(cnf->chan, AST_FORMAT_SLINEAR); 01138 dahdic.chan = 0; 01139 dahdic.confno = cnf->dahdiconf; 01140 dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON; 01141 if (ioctl(cnf->chan->fds[0], DAHDI_SETCONF, &dahdic)) { 01142 ast_log(LOG_WARNING, "Error setting conference\n"); 01143 if (cnf->chan) 01144 ast_hangup(cnf->chan); 01145 else 01146 close(cnf->fd); 01147 01148 ast_free(cnf); 01149 cnf = NULL; 01150 goto cnfout; 01151 } 01152 } 01153 01154 /* Fill the conference struct */ 01155 cnf->start = time(NULL); 01156 cnf->maxusers = 0x7fffffff; 01157 cnf->isdynamic = dynamic ? 1 : 0; 01158 ast_verb(3, "Created MeetMe conference %d for conference '%s'\n", cnf->dahdiconf, cnf->confno); 01159 AST_LIST_INSERT_HEAD(&confs, cnf, list); 01160 01161 /* Reserve conference number in map */ 01162 if ((sscanf(cnf->confno, "%30d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024)) 01163 conf_map[confno_int] = 1; 01164 01165 cnfout: 01166 if (cnf) 01167 ast_atomic_fetchadd_int(&cnf->refcount, refcount); 01168 01169 AST_LIST_UNLOCK(&confs); 01170 01171 return cnf; 01172 }
| static int can_write | ( | struct ast_channel * | chan, | |
| int | confflags | |||
| ) | [static] |
Definition at line 2005 of file app_meetme.c.
References ast_channel::_state, AST_STATE_UP, and CONFFLAG_NO_AUDIO_UNTIL_UP.
Referenced by conf_run().
02006 { 02007 if (!(confflags & CONFFLAG_NO_AUDIO_UNTIL_UP)) { 02008 return 1; 02009 } 02010 02011 return (chan->_state == AST_STATE_UP); 02012 }
| static int careful_write | ( | int | fd, | |
| unsigned char * | data, | |||
| int | len, | |||
| int | block | |||
| ) | [static] |
Definition at line 895 of file app_meetme.c.
References ast_log(), errno, and LOG_WARNING.
Referenced by conf_play(), and conf_run().
00896 { 00897 int res; 00898 int x; 00899 00900 while (len) { 00901 if (block) { 00902 x = DAHDI_IOMUX_WRITE | DAHDI_IOMUX_SIGEVENT; 00903 res = ioctl(fd, DAHDI_IOMUX, &x); 00904 } else 00905 res = 0; 00906 if (res >= 0) 00907 res = write(fd, data, len); 00908 if (res < 1) { 00909 if (errno != EAGAIN) { 00910 ast_log(LOG_WARNING, "Failed to write audio data to conference: %s\n", strerror(errno)); 00911 return -1; 00912 } else 00913 return 0; 00914 } 00915 len -= res; 00916 data += res; 00917 } 00918 00919 return 0; 00920 }
| static int channel_admin_exec | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 4318 of file app_meetme.c.
References ADMINFLAG_KICKME, ADMINFLAG_MUTED, ast_conf_user::adminflags, ao2_callback, ao2_ref, AST_APP_ARG, AST_DECLARE_APP_ARGS, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_conf_user::list, LOG_NOTICE, LOG_WARNING, user_chan_cb(), and ast_conference::usercontainer.
Referenced by load_module().
04318 { 04319 char *params; 04320 struct ast_conference *conf = NULL; 04321 struct ast_conf_user *user = NULL; 04322 AST_DECLARE_APP_ARGS(args, 04323 AST_APP_ARG(channel); 04324 AST_APP_ARG(command); 04325 ); 04326 04327 if (ast_strlen_zero(data)) { 04328 ast_log(LOG_WARNING, "MeetMeChannelAdmin requires two arguments!\n"); 04329 return -1; 04330 } 04331 04332 params = ast_strdupa(data); 04333 AST_STANDARD_APP_ARGS(args, params); 04334 04335 if (!args.channel) { 04336 ast_log(LOG_WARNING, "MeetMeChannelAdmin requires a channel name!\n"); 04337 return -1; 04338 } 04339 04340 if (!args.command) { 04341 ast_log(LOG_WARNING, "MeetMeChannelAdmin requires a command!\n"); 04342 return -1; 04343 } 04344 04345 AST_LIST_LOCK(&confs); 04346 AST_LIST_TRAVERSE(&confs, conf, list) { 04347 if ((user = ao2_callback(conf->usercontainer, 0, user_chan_cb, args.channel))) { 04348 break; 04349 } 04350 } 04351 04352 if (!user) { 04353 ast_log(LOG_NOTICE, "Specified user (%s) not found\n", args.channel); 04354 AST_LIST_UNLOCK(&confs); 04355 return 0; 04356 } 04357 04358 /* perform the specified action */ 04359 switch (*args.command) { 04360 case 77: /* M: Mute */ 04361 user->adminflags |= ADMINFLAG_MUTED; 04362 break; 04363 case 109: /* m: Unmute */ 04364 user->adminflags &= ~ADMINFLAG_MUTED; 04365 break; 04366 case 107: /* k: Kick user */ 04367 user->adminflags |= ADMINFLAG_KICKME; 04368 break; 04369 default: /* unknown command */ 04370 ast_log(LOG_WARNING, "Unknown MeetMeChannelAdmin command '%s'\n", args.command); 04371 break; 04372 } 04373 ao2_ref(user, -1); 04374 AST_LIST_UNLOCK(&confs); 04375 04376 return 0; 04377 }
| static char* complete_meetmecmd | ( | const char * | line, | |
| const char * | word, | |||
| int | pos, | |||
| int | state | |||
| ) | [static] |
Definition at line 1174 of file app_meetme.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_cli_complete(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strdup, ast_strdupa, ast_conference::confno, len(), ast_conf_user::list, strsep(), ast_conf_user::user_no, and ast_conference::usercontainer.
Referenced by meetme_cmd(), and meetme_show_cmd().
01175 { 01176 static char *cmds[] = {"concise", "lock", "unlock", "mute", "unmute", "kick", "list", NULL}; 01177 01178 int len = strlen(word); 01179 int which = 0; 01180 struct ast_conference *cnf = NULL; 01181 struct ast_conf_user *usr = NULL; 01182 char *confno = NULL; 01183 char usrno[50] = ""; 01184 char *myline, *ret = NULL; 01185 01186 if (pos == 1) { /* Command */ 01187 return ast_cli_complete(word, cmds, state); 01188 } else if (pos == 2) { /* Conference Number */ 01189 AST_LIST_LOCK(&confs); 01190 AST_LIST_TRAVERSE(&confs, cnf, list) { 01191 if (!strncasecmp(word, cnf->confno, len) && ++which > state) { 01192 ret = cnf->confno; 01193 break; 01194 } 01195 } 01196 ret = ast_strdup(ret); /* dup before releasing the lock */ 01197 AST_LIST_UNLOCK(&confs); 01198 return ret; 01199 } else if (pos == 3) { 01200 /* User Number || Conf Command option*/ 01201 if (strstr(line, "mute") || strstr(line, "kick")) { 01202 if (state == 0 && (strstr(line, "kick") || strstr(line, "mute")) && !strncasecmp(word, "all", len)) 01203 return ast_strdup("all"); 01204 which++; 01205 AST_LIST_LOCK(&confs); 01206 01207 /* TODO: Find the conf number from the cmdline (ignore spaces) <- test this and make it fail-safe! */ 01208 myline = ast_strdupa(line); 01209 if (strsep(&myline, " ") && strsep(&myline, " ") && !confno) { 01210 while((confno = strsep(&myline, " ")) && (strcmp(confno, " ") == 0)) 01211 ; 01212 } 01213 01214 AST_LIST_TRAVERSE(&confs, cnf, list) { 01215 if (!strcmp(confno, cnf->confno)) 01216 break; 01217 } 01218 01219 if (cnf) { 01220 struct ao2_iterator user_iter; 01221 user_iter = ao2_iterator_init(cnf->usercontainer, 0); 01222 /* Search for the user */ 01223 while((usr = ao2_iterator_next(&user_iter))) { 01224 snprintf(usrno, sizeof(usrno), "%d", usr->user_no); 01225 if (!strncasecmp(word, usrno, len) && ++which > state) { 01226 ao2_ref(usr, -1); 01227 break; 01228 } 01229 ao2_ref(usr, -1); 01230 } 01231 ao2_iterator_destroy(&user_iter); 01232 AST_LIST_UNLOCK(&confs); 01233 return usr ? ast_strdup(usrno) : NULL; 01234 } 01235 } 01236 } 01237 01238 return NULL; 01239 }
| static int conf_exec | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
The meetme() application.
Definition at line 3781 of file app_meetme.c.
References ast_channel::_state, ast_conference::adminopts, ARRAY_LEN, ast_answer(), AST_APP_ARG, ast_app_getdata(), ast_app_parse_options(), ast_category_browse(), ast_config_destroy(), ast_config_load, ast_copy_string(), AST_DECLARE_APP_ARGS, AST_DIGIT_ANY, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_load_realtime_multientry(), ast_log(), ast_say_digits(), AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_stopstream(), ast_strdupa, ast_streamfile(), ast_strlen_zero(), ast_test_flag, ast_variable_browse(), ast_variable_retrieve(), ast_verb, ast_waitstream(), conf_map, conf_run(), CONFFLAG_ADMIN, CONFFLAG_ALWAYSPROMPT, CONFFLAG_DYNAMIC, CONFFLAG_DYNAMICPIN, CONFFLAG_EMPTY, CONFFLAG_EMPTYNOPIN, CONFFLAG_QUIET, CONFIG_FILE_NAME, config_flags, CONFIG_STATUS_FILEINVALID, ast_conference::confno, dispose_conf(), find_conf(), find_conf_realtime(), ast_flags::flags, ast_conference::isdynamic, ast_channel::language, LOG_ERROR, LOG_WARNING, MAX_CONFNUM, MAX_PIN, MAX_SETTINGS, meetme_opts, ast_variable::name, ast_variable::next, OPT_ARG_ARRAY_SIZE, parse(), ast_conference::pin, ast_conference::pinadmin, ast_conference::recordingfilename, ast_conference::recordingformat, SENTINEL, strsep(), ast_conference::useropts, ast_conference::users, ast_variable::value, and var.
Referenced by load_module().
03782 { 03783 int res = -1; 03784 char confno[MAX_CONFNUM] = ""; 03785 int allowretry = 0; 03786 int retrycnt = 0; 03787 struct ast_conference *cnf = NULL; 03788 struct ast_flags confflags = {0}, config_flags = { 0 }; 03789 int dynamic = 0; 03790 int empty = 0, empty_no_pin = 0; 03791 int always_prompt = 0; 03792 char *notdata, *info, the_pin[MAX_PIN] = ""; 03793 AST_DECLARE_APP_ARGS(args, 03794 AST_APP_ARG(confno); 03795 AST_APP_ARG(options); 03796 AST_APP_ARG(pin); 03797 ); 03798 char *optargs[OPT_ARG_ARRAY_SIZE] = { NULL, }; 03799 03800 if (ast_strlen_zero(data)) { 03801 allowretry = 1; 03802 notdata = ""; 03803 } else { 03804 notdata = data; 03805 } 03806 03807 if (chan->_state != AST_STATE_UP) 03808 ast_answer(chan); 03809 03810 info = ast_strdupa(notdata); 03811 03812 AST_STANDARD_APP_ARGS(args, info); 03813 03814 if (args.confno) { 03815 ast_copy_string(confno, args.confno, sizeof(confno)); 03816 if (ast_strlen_zero(confno)) { 03817 allowretry = 1; 03818 } 03819 } 03820 03821 if (args.pin) 03822 ast_copy_string(the_pin, args.pin, sizeof(the_pin)); 03823 03824 if (args.options) { 03825 ast_app_parse_options(meetme_opts, &confflags, optargs, args.options); 03826 dynamic = ast_test_flag(&confflags, CONFFLAG_DYNAMIC | CONFFLAG_DYNAMICPIN); 03827 if (ast_test_flag(&confflags, CONFFLAG_DYNAMICPIN) && ast_strlen_zero(args.pin)) 03828 strcpy(the_pin, "q"); 03829 03830 empty = ast_test_flag(&confflags, CONFFLAG_EMPTY | CONFFLAG_EMPTYNOPIN); 03831 empty_no_pin = ast_test_flag(&confflags, CONFFLAG_EMPTYNOPIN); 03832 always_prompt = ast_test_flag(&confflags, CONFFLAG_ALWAYSPROMPT | CONFFLAG_DYNAMICPIN); 03833 } 03834 03835 do { 03836 if (retrycnt > 3) 03837 allowretry = 0; 03838 if (empty) { 03839 int i; 03840 struct ast_config *cfg; 03841 struct ast_variable *var; 03842 int confno_int; 03843 03844 /* We only need to load the config file for static and empty_no_pin (otherwise we don't care) */ 03845 if ((empty_no_pin) || (!dynamic)) { 03846 cfg = ast_config_load(CONFIG_FILE_NAME, config_flags); 03847 if (cfg && cfg != CONFIG_STATUS_FILEINVALID) { 03848 var = ast_variable_browse(cfg, "rooms"); 03849 while (var) { 03850 char parse[MAX_SETTINGS], *stringp = parse, *confno_tmp; 03851 if (!strcasecmp(var->name, "conf")) { 03852 int found = 0; 03853 ast_copy_string(parse, var->value, sizeof(parse)); 03854 confno_tmp = strsep(&stringp, "|,"); 03855 if (!dynamic) { 03856 /* For static: run through the list and see if this conference is empty */ 03857 AST_LIST_LOCK(&confs); 03858 AST_LIST_TRAVERSE(&confs, cnf, list) { 03859 if (!strcmp(confno_tmp, cnf->confno)) { 03860 /* The conference exists, therefore it's not empty */ 03861 found = 1; 03862 break; 03863 } 03864 } 03865 AST_LIST_UNLOCK(&confs); 03866 if (!found) { 03867 /* At this point, we have a confno_tmp (static conference) that is empty */ 03868 if ((empty_no_pin && ast_strlen_zero(stringp)) || (!empty_no_pin)) { 03869 /* Case 1: empty_no_pin and pin is nonexistent (NULL) 03870 * Case 2: empty_no_pin and pin is blank (but not NULL) 03871 * Case 3: not empty_no_pin 03872 */ 03873 ast_copy_string(confno, confno_tmp, sizeof(confno)); 03874 break; 03875 } 03876 } 03877 } 03878 } 03879 var = var->next; 03880 } 03881 ast_config_destroy(cfg); 03882 } 03883 03884 if (ast_strlen_zero(confno) && (cfg = ast_load_realtime_multientry("meetme", "confno LIKE", "%", SENTINEL))) { 03885 const char *catg; 03886 for (catg = ast_category_browse(cfg, NULL); catg; catg = ast_category_browse(cfg, catg)) { 03887 const char *confno_tmp = ast_variable_retrieve(cfg, catg, "confno"); 03888 const char *pin_tmp = ast_variable_retrieve(cfg, catg, "pin"); 03889 if (ast_strlen_zero(confno_tmp)) { 03890 continue; 03891 } 03892 if (!dynamic) { 03893 int found = 0; 03894 /* For static: run through the list and see if this conference is empty */ 03895 AST_LIST_LOCK(&confs); 03896 AST_LIST_TRAVERSE(&confs, cnf, list) { 03897 if (!strcmp(confno_tmp, cnf->confno)) { 03898 /* The conference exists, therefore it's not empty */ 03899 found = 1; 03900 break; 03901 } 03902 } 03903 AST_LIST_UNLOCK(&confs); 03904 if (!found) { 03905 /* At this point, we have a confno_tmp (realtime conference) that is empty */ 03906 if ((empty_no_pin && ast_strlen_zero(pin_tmp)) || (!empty_no_pin)) { 03907 /* Case 1: empty_no_pin and pin is nonexistent (NULL) 03908 * Case 2: empty_no_pin and pin is blank (but not NULL) 03909 * Case 3: not empty_no_pin 03910 */ 03911 ast_copy_string(confno, confno_tmp, sizeof(confno)); 03912 break; 03913 } 03914 } 03915 } 03916 } 03917 ast_config_destroy(cfg); 03918 } 03919 } 03920 03921 /* Select first conference number not in use */ 03922 if (ast_strlen_zero(confno) && dynamic) { 03923 AST_LIST_LOCK(&confs); 03924 for (i = 0; i < ARRAY_LEN(conf_map); i++) { 03925 if (!conf_map[i]) { 03926 snprintf(confno, sizeof(confno), "%d", i); 03927 conf_map[i] = 1; 03928 break; 03929 } 03930 } 03931 AST_LIST_UNLOCK(&confs); 03932 } 03933 03934 /* Not found? */ 03935 if (ast_strlen_zero(confno)) { 03936 res = ast_streamfile(chan, "conf-noempty", chan->language); 03937 if (!res) 03938 ast_waitstream(chan, ""); 03939 } else { 03940 if (sscanf(confno, "%30d", &confno_int) == 1) { 03941 if (!ast_test_flag(&confflags, CONFFLAG_QUIET)) { 03942 res = ast_streamfile(chan, "conf-enteringno", chan->language); 03943 if (!res) { 03944 ast_waitstream(chan, ""); 03945 res = ast_say_digits(chan, confno_int, "", chan->language); 03946 } 03947 } 03948 } else { 03949 ast_log(LOG_ERROR, "Could not scan confno '%s'\n", confno); 03950 } 03951 } 03952 } 03953 03954 while (allowretry && (ast_strlen_zero(confno)) && (++retrycnt < 4)) { 03955 /* Prompt user for conference number */ 03956 res = ast_app_getdata(chan, "conf-getconfno", confno, sizeof(confno) - 1, 0); 03957 if (res < 0) { 03958 /* Don't try to validate when we catch an error */ 03959 confno[0] = '\0'; 03960 allowretry = 0; 03961 break; 03962 } 03963 } 03964 if (!ast_strlen_zero(confno)) { 03965 /* Check the validity of the conference */ 03966 cnf = find_conf(chan, confno, 1, dynamic, the_pin, 03967 sizeof(the_pin), 1, &confflags); 03968 if (!cnf) { 03969 int too_early = 0; 03970 03971 cnf = find_conf_realtime(chan, confno, 1, dynamic, 03972 the_pin, sizeof(the_pin), 1, &confflags, &too_early, optargs); 03973 if (rt_schedule && too_early) 03974 allowretry = 0; 03975 } 03976 03977 if (!cnf) { 03978 if (allowretry) { 03979 confno[0] = '\0'; 03980 res = ast_streamfile(chan, "conf-invalid", chan->language); 03981 if (!res) 03982 ast_waitstream(chan, ""); 03983 res = -1; 03984 } 03985 } else { 03986 if (((!ast_strlen_zero(cnf->pin) && 03987 !ast_test_flag(&confflags, CONFFLAG_ADMIN)) || 03988 (!ast_strlen_zero(cnf->pinadmin) && 03989 ast_test_flag(&confflags, CONFFLAG_ADMIN)) || 03990 (!ast_strlen_zero(cnf->pin) && 03991 ast_strlen_zero(cnf->pinadmin) && 03992 ast_test_flag(&confflags, CONFFLAG_ADMIN))) && 03993 (!(cnf->users == 0 && cnf->isdynamic))) { 03994 char pin[MAX_PIN] = ""; 03995 int j; 03996 03997 /* Allow the pin to be retried up to 3 times */ 03998 for (j = 0; j < 3; j++) { 03999 if (*the_pin && (always_prompt == 0)) { 04000 ast_copy_string(pin, the_pin, sizeof(pin)); 04001 res = 0; 04002 } else { 04003 /* Prompt user for pin if pin is required */ 04004 res = ast_app_getdata(chan, "conf-getpin", pin + strlen(pin), sizeof(pin) - 1 - strlen(pin), 0); 04005 } 04006 if (res >= 0) { 04007 if ((!strcasecmp(pin, cnf->pin) && 04008 (ast_strlen_zero(cnf->pinadmin) || 04009 !ast_test_flag(&confflags, CONFFLAG_ADMIN))) || 04010 (!ast_strlen_zero(cnf->pinadmin) && 04011 !strcasecmp(pin, cnf->pinadmin))) { 04012 /* Pin correct */ 04013 allowretry = 0; 04014 if (!ast_strlen_zero(cnf->pinadmin) && !strcasecmp(pin, cnf->pinadmin)) { 04015 if (!ast_strlen_zero(cnf->adminopts)) { 04016 char *opts = ast_strdupa(cnf->adminopts); 04017 ast_app_parse_options(meetme_opts, &confflags, optargs, opts); 04018 } 04019 } else { 04020 if (!ast_strlen_zero(cnf->useropts)) { 04021 char *opts = ast_strdupa(cnf->useropts); 04022 ast_app_parse_options(meetme_opts, &confflags, optargs, opts); 04023 } 04024 } 04025 /* Run the conference */ 04026 ast_verb(4, "Starting recording of MeetMe Conference %s into file %s.%s.\n", cnf->confno, cnf->recordingfilename, cnf->recordingformat); 04027 res = conf_run(chan, cnf, confflags.flags, optargs); 04028 break; 04029 } else { 04030 /* Pin invalid */ 04031 if (!ast_streamfile(chan, "conf-invalidpin", chan->language)) { 04032 res = ast_waitstream(chan, AST_DIGIT_ANY); 04033 ast_stopstream(chan); 04034 } else { 04035 ast_log(LOG_WARNING, "Couldn't play invalid pin msg!\n"); 04036 break; 04037 } 04038 if (res < 0) 04039 break; 04040 pin[0] = res; 04041 pin[1] = '\0'; 04042 res = -1; 04043 if (allowretry) 04044 confno[0] = '\0'; 04045 } 04046 } else { 04047 /* failed when getting the pin */ 04048 res = -1; 04049 allowretry = 0; 04050 /* see if we need to get rid of the conference */ 04051 break; 04052 } 04053 04054 /* Don't retry pin with a static pin */ 04055 if (*the_pin && (always_prompt == 0)) { 04056 break; 04057 } 04058 } 04059 } else { 04060 /* No pin required */ 04061 allowretry = 0; 04062 04063 /* For RealTime conferences without a pin 04064 * should still support loading options 04065 */ 04066 if (!ast_strlen_zero(cnf->useropts)) { 04067 char *opts = ast_strdupa(cnf->useropts); 04068 ast_app_parse_options(meetme_opts, &confflags, optargs, opts); 04069 } 04070 04071 /* Run the conference */ 04072 res = conf_run(chan, cnf, confflags.flags, optargs); 04073 } 04074 dispose_conf(cnf); 04075 cnf = NULL; 04076 } 04077 } 04078 } while (allowretry); 04079 04080 if (cnf) 04081 dispose_conf(cnf); 04082 04083 return res; 04084 }
| static void conf_flush | ( | int | fd, | |
| struct ast_channel * | chan | |||
| ) | [static] |
Definition at line 1653 of file app_meetme.c.
References ast_frfree, ast_log(), ast_read(), ast_waitfor(), f, and LOG_WARNING.
Referenced by conf_run().
01654 { 01655 int x; 01656 01657 /* read any frames that may be waiting on the channel 01658 and throw them away 01659 */ 01660 if (chan) { 01661 struct ast_frame *f; 01662 01663 /* when no frames are available, this will wait 01664 for 1 millisecond maximum 01665 */ 01666 while (ast_waitfor(chan, 1)) { 01667 f = ast_read(chan); 01668 if (f) 01669 ast_frfree(f); 01670 else /* channel was hung up or something else happened */ 01671 break; 01672 } 01673 } 01674 01675 /* flush any data sitting in the pseudo channel */ 01676 x = DAHDI_FLUSH_ALL; 01677 if (ioctl(fd, DAHDI_FLUSH, &x)) 01678 ast_log(LOG_WARNING, "Error flushing channel\n"); 01679 01680 }
| static int conf_free | ( | struct ast_conference * | conf | ) | [static] |
Definition at line 1684 of file app_meetme.c.
References ast_conference::announcelist, ast_conference::announcelist_addition, ast_conference::announcelistlock, ast_conference::announcethread, ast_conference::announcethread_stop, ast_conference::announcethreadlock, ao2_ref, ast_cond_signal(), ast_filedelete(), AST_FRAME_BITS, ast_free, ast_frfree, ast_hangup(), AST_LIST_LOCK, AST_LIST_REMOVE, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_mutex_destroy(), ast_mutex_lock(), ast_mutex_unlock(), AST_PTHREADT_NULL, ast_softhangup(), AST_SOFTHANGUP_EXPLICIT, ast_translator_free_path(), ast_conference::chan, ast_conference::confno, EVENT_FLAG_CALL, ast_conference::fd, ast_conference::lchan, ast_conference::listenlock, manager_event, MEETME_RECORD_ACTIVE, MEETME_RECORD_OFF, MEETME_RECORD_TERMINATE, announce_listitem::namerecloc, ast_conference::origframe, ast_conference::playlock, ast_conference::recordingfilename, ast_conference::recordingformat, ast_conference::recordthreadlock, ast_conference::transframe, ast_conference::transpath, and ast_conference::usercontainer.
Referenced by dispose_conf().
01685 { 01686 int x; 01687 struct announce_listitem *item; 01688 01689 AST_LIST_REMOVE(&confs, conf, list); 01690 manager_event(EVENT_FLAG_CALL, "MeetmeEnd", "Meetme: %s\r\n", conf->confno); 01691 01692 if (conf->recording == MEETME_RECORD_ACTIVE) { 01693 conf->recording = MEETME_RECORD_TERMINATE; 01694 AST_LIST_UNLOCK(&confs); 01695 while (1) { 01696 usleep(1); 01697 AST_LIST_LOCK(&confs); 01698 if (conf->recording == MEETME_RECORD_OFF) 01699 break; 01700 AST_LIST_UNLOCK(&confs); 01701 } 01702 } 01703 01704 for (x = 0; x < AST_FRAME_BITS; x++) { 01705 if (conf->transframe[x]) 01706 ast_frfree(conf->transframe[x]); 01707 if (conf->transpath[x]) 01708 ast_translator_free_path(conf->transpath[x]); 01709 } 01710 if (conf->announcethread != AST_PTHREADT_NULL) { 01711 ast_mutex_lock(&conf->announcelistlock); 01712 conf->announcethread_stop = 1; 01713 ast_softhangup(conf->chan, AST_SOFTHANGUP_EXPLICIT); 01714 ast_cond_signal(&conf->announcelist_addition); 01715 ast_mutex_unlock(&conf->announcelistlock); 01716 pthread_join(conf->announcethread, NULL); 01717 01718 while ((item = AST_LIST_REMOVE_HEAD(&conf->announcelist, entry))) { 01719 ast_filedelete(item->namerecloc, NULL); 01720 ao2_ref(item, -1); 01721 } 01722 ast_mutex_destroy(&conf->announcelistlock); 01723 } 01724 if (conf->origframe) 01725 ast_frfree(conf->origframe); 01726 if (conf->lchan) 01727 ast_hangup(conf->lchan); 01728 if (conf->chan) 01729 ast_hangup(conf->chan); 01730 if (conf->fd >= 0) 01731 close(conf->fd); 01732 if (conf->recordingfilename) { 01733 ast_free(conf->recordingfilename); 01734 } 01735 if (conf->recordingformat) { 01736 ast_free(conf->recordingformat); 01737 } 01738 if (conf->usercontainer) { 01739 ao2_ref(conf->usercontainer, -1); 01740 } 01741 ast_mutex_destroy(&conf->playlock); 01742 ast_mutex_destroy(&conf->listenlock); 01743 ast_mutex_destroy(&conf->recordthreadlock); 01744 ast_mutex_destroy(&conf->announcethreadlock); 01745 ast_free(conf); 01746 01747 return 0; 01748 }
| static void conf_play | ( | struct ast_channel * | chan, | |
| struct ast_conference * | conf, | |||
| enum entrance_sound | sound | |||
| ) | [static] |
Definition at line 1013 of file app_meetme.c.
References ast_autoservice_start(), ast_autoservice_stop(), ast_check_hangup(), AST_LIST_LOCK, AST_LIST_UNLOCK, careful_write(), enter, ENTER, ast_conference::fd, leave, LEAVE, and len().
Referenced by conf_run().
01014 { 01015 unsigned char *data; 01016 int len; 01017 int res = -1; 01018 01019 if (!ast_check_hangup(chan)) 01020 res = ast_autoservice_start(chan); 01021 01022 AST_LIST_LOCK(&confs); 01023 01024 switch(sound) { 01025 case ENTER: 01026 data = enter; 01027 len = sizeof(enter); 01028 break; 01029 case LEAVE: 01030 data = leave; 01031 len = sizeof(leave); 01032 break; 01033 default: 01034 data = NULL; 01035 len = 0; 01036 } 01037 if (data) { 01038 careful_write(conf->fd, data, len, 1); 01039 } 01040 01041 AST_LIST_UNLOCK(&confs); 01042 01043 if (!res) 01044 ast_autoservice_stop(chan); 01045 }
| static void conf_queue_dtmf | ( | const struct ast_conference * | conf, | |
| const struct ast_conf_user * | sender, | |||
| struct ast_frame * | f | |||
| ) | [static] |
Definition at line 1750 of file app_meetme.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_log(), ast_write(), ast_conf_user::chan, LOG_WARNING, ast_channel::name, and ast_conference::usercontainer.
Referenced by conf_run().
01752 { 01753 struct ast_conf_user *user; 01754 struct ao2_iterator user_iter; 01755 01756 user_iter = ao2_iterator_init(conf->usercontainer, 0); 01757 while ((user = ao2_iterator_next(&user_iter))) { 01758 if (user == sender) { 01759 ao2_ref(user, -1); 01760 continue; 01761 } 01762 if (ast_write(user->chan, f) < 0) 01763 ast_log(LOG_WARNING, "Error writing frame to channel %s\n", user->chan->name); 01764 ao2_ref(user, -1); 01765 } 01766 ao2_iterator_destroy(&user_iter); 01767 }
| static int conf_run | ( | struct ast_channel * | chan, | |
| struct ast_conference * | conf, | |||
| int | confflags, | |||
| char * | optargs[] | |||
| ) | [static] |
Definition at line 2043 of file app_meetme.c.
References volume::actual, ADMINFLAG_KICKME, ADMINFLAG_MUTED, ADMINFLAG_SELFMUTED, ADMINFLAG_T_REQUEST, ast_conf_user::adminflags, announce_thread(), ast_conference::announcelist, ast_conference::announcelist_addition, ast_conference::announcelistlock, ast_conference::announcethread, ast_conference::announcethreadlock, announce_listitem::announcetype, ao2_alloc, ao2_callback, ao2_find, ao2_link, ao2_lock(), ao2_ref, ao2_unlink, ao2_unlock(), ast_channel_lock, ast_channel_setoption(), ast_channel_unlock, ast_check_hangup(), ast_cond_signal(), ast_config_AST_SPOOL_DIR, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_HOLD, ast_copy_string(), ast_debug, AST_DEVICE_INUSE, AST_DEVICE_NOT_INUSE, ast_devstate_changed(), AST_DIGIT_ANY, ast_dsp_free(), ast_dsp_get_threshold_from_settings(), ast_dsp_new(), ast_dsp_silence(), ast_exists_extension(), ast_filedelete(), AST_FORMAT_SLINEAR, ast_frame_adjust_volume(), AST_FRAME_BITS, AST_FRAME_CONTROL, AST_FRAME_DTMF, AST_FRAME_DTMF_BEGIN, AST_FRAME_DTMF_END, AST_FRAME_NULL, AST_FRAME_VOICE, ast_frfree, AST_FRIENDLY_OFFSET, ast_goto_if_exists(), ast_hangup(), ast_indicate(), AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_NEXT, AST_LIST_UNLOCK, ast_load_realtime(), ast_localtime(), ast_log(), AST_MAX_CONTEXT, AST_MAX_EXTENSION, ast_mkdir(), ast_mktime(), ast_moh_start(), ast_moh_stop(), ast_mutex_init(), ast_mutex_lock(), ast_mutex_unlock(), ast_null_frame, AST_OPTION_TONE_VERIFY, ast_play_and_record(), ast_pthread_create_background, ast_pthread_create_detached_background, AST_PTHREADT_NULL, ast_read(), ast_read_noaudio(), ast_realtime_require_field(), ast_record_review(), ast_request(), ast_safe_sleep(), ast_samp2tv(), ast_say_digits(), ast_say_number(), ast_set_read_format(), ast_set_write_format(), ast_stopstream(), ast_strdup, ast_strdupa, ast_streamfile(), ast_strftime(), ast_strlen_zero(), ast_strptime(), ast_translate(), ast_translator_build_path(), ast_tvadd(), ast_tvdiff_ms(), ast_tvnow(), ast_tvsub(), ast_tvzero(), ast_update_realtime(), ast_variables_destroy(), ast_verb, ast_verbose, ast_waitfor_nandfds(), ast_waitstream(), ast_write(), ast_channel::audiohooks, ast_conference::bookid, buf, can_write(), careful_write(), ast_conference::chan, ast_conf_user::chan, ast_channel::cid, ast_callerid::cid_name, ast_callerid::cid_num, conf_flush(), CONF_HASJOIN, CONF_HASLEFT, conf_play(), conf_queue_dtmf(), CONF_SIZE, conf_start_moh(), announce_listitem::confchan, CONFFLAG_ADMIN, CONFFLAG_AGI, CONFFLAG_ANNOUNCEUSERCOUNT, CONFFLAG_DURATION_LIMIT, CONFFLAG_DURATION_STOP, CONFFLAG_EXIT_CONTEXT, CONFFLAG_INTROUSER, CONFFLAG_INTROUSERNOREVIEW, CONFFLAG_KEYEXIT, CONFFLAG_KICK_CONTINUE, CONFFLAG_MARKEDEXIT, CONFFLAG_MARKEDUSER, CONFFLAG_MOH, CONFFLAG_MONITOR, CONFFLAG_MONITORTALKER, CONFFLAG_NO_AUDIO_UNTIL_UP, CONFFLAG_NOONLYPERSON, CONFFLAG_OPTIMIZETALKER, CONFFLAG_PASS_DTMF, CONFFLAG_QUIET, CONFFLAG_RECORDCONF, CONFFLAG_SLA_STATION, CONFFLAG_STARMENU, CONFFLAG_STARTMUTED, CONFFLAG_TALKER, CONFFLAG_WAITMARKED, ast_conference::confno, announce_listitem::confusers, ast_channel::context, ast_conf_user::dahdichannel, ast_conference::dahdiconf, ast_frame::data, ast_frame::datalen, DATE_FORMAT, volume::desired, dtmfstr, ast_conf_user::end_sound, ast_conference::endalert, ast_conference::endtime, ENTER, errno, EVENT_FLAG_CALL, exitcontext, f, ast_channel::fds, ast_frame::frametype, ast_conf_user::jointime, ast_conf_user::kicktime, announce_listitem::language, ast_channel::language, ast_conference::lchan, LEAVE, ast_conf_user::listen, ast_conference::listenlock, ast_conference::locked, LOG_WARNING, ast_channel::macrocontext, manager_event, ast_conference::markedusers, ast_conference::maxusers, MEETME_DELAYDETECTENDTALK, MEETME_DELAYDETECTTALK, ast_channel::monitor, ast_variable::name, ast_channel::name, announce_listitem::namerecloc, ast_conf_user::namerecloc, ast_variable::next, OBJ_NODATA, ast_frame::offset, OPT_ARG_DURATION_LIMIT, OPT_ARG_DURATION_STOP, OPT_ARG_EXITKEYS, OPT_ARG_MOH_CLASS, OPT_ARG_WAITMARKED, ast_conference::origframe, parse(), pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), pbx_exec(), pbx_findapp(), ast_conf_user::play_warning, ast_conference::playlock, ast_frame::ptr, ast_channel::rawwriteformat, ast_conference::recordingfilename, ast_conference::recordingformat, ast_conference::recordthread, ast_conference::recordthreadlock, reset_volumes(), RQ_UINTEGER1, RQ_UINTEGER2, RQ_UINTEGER3, RQ_UINTEGER4, rt_extend_conf(), S_OR, ast_frame::samples, sec, set_talk_volume(), set_user_talking(), SLA_EVENT_HOLD, sla_queue_event_conf(), ast_conf_user::start_time, strsep(), ast_frame::subclass, ast_conf_user::talk, ast_conf_user::talking, ast_channel::tech, THRESHOLD_SILENCE, ast_conf_user::timelimit, ast_conference::transframe, ast_conference::transpath, tweak_listen_volume(), tweak_talk_volume(), ast_channel_tech::type, ast_conference::uniqueid, ast_channel::uniqueid, user_max_cmp(), ast_conf_user::user_no, ast_conference::usercontainer, ast_conf_user::userflags, ast_conference::users, ast_variable::value, var, VOL_DOWN, VOL_UP, ast_conf_user::warning_freq, and ast_conf_user::warning_sound.
Referenced by conf_exec(), dial_trunk(), run_station(), sla_station_exec(), and sla_trunk_exec().
02044 { 02045 struct ast_conf_user *user = NULL; 02046 struct ast_conf_user *usr = NULL; 02047 int fd; 02048 struct dahdi_confinfo dahdic, dahdic_empty; 02049 struct ast_frame *f; 02050 struct ast_channel *c; 02051 struct ast_frame fr; 02052 int outfd; 02053 int ms; 02054 int nfds; 02055 int res; 02056 int retrydahdi; 02057 int origfd; 02058 int musiconhold = 0, mohtempstopped = 0; 02059 int firstpass = 0; 02060 int lastmarked = 0; 02061 int currentmarked = 0; 02062 int ret = -1; 02063 int x; 02064 int menu_active = 0; 02065 int talkreq_manager = 0; 02066 int using_pseudo = 0; 02067 int duration = 20; 02068 int hr, min, sec; 02069 int sent_event = 0; 02070 int checked = 0; 02071 int announcement_played = 0; 02072 struct timeval now; 02073 struct ast_dsp *dsp = NULL; 02074 struct ast_app *agi_app; 02075 char *agifile; 02076 const char *agifiledefault = "conf-background.agi", *tmpvar; 02077 char meetmesecs[30] = ""; 02078 char exitcontext[AST_MAX_CONTEXT] = ""; 02079 char recordingtmp[AST_MAX_EXTENSION] = ""; 02080 char members[10] = ""; 02081 int dtmf, opt_waitmarked_timeout = 0; 02082 time_t timeout = 0; 02083 struct dahdi_bufferinfo bi; 02084 char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET]; 02085 char *buf = __buf + AST_FRIENDLY_OFFSET; 02086 char *exitkeys = NULL; 02087 unsigned int calldurationlimit = 0; 02088 long timelimit = 0; 02089 long play_warning = 0; 02090 long warning_freq = 0; 02091 const char *warning_sound = NULL; 02092 const char *end_sound = NULL; 02093 char *parse; 02094 long time_left_ms = 0; 02095 struct timeval nexteventts = { 0, }; 02096 int to; 02097 int setusercount = 0; 02098 int confsilence = 0, totalsilence = 0; 02099 02100 if (!(user = ao2_alloc(sizeof(*user), NULL))) { 02101 return ret; 02102 } 02103 02104 /* Possible timeout waiting for marked user */ 02105 if ((confflags & CONFFLAG_WAITMARKED) && 02106 !ast_strlen_zero(optargs[OPT_ARG_WAITMARKED]) && 02107 (sscanf(optargs[OPT_ARG_WAITMARKED], "%30d", &opt_waitmarked_timeout) == 1) && 02108 (opt_waitmarked_timeout > 0)) { 02109 timeout = time(NULL) + opt_waitmarked_timeout; 02110 } 02111 02112 if ((confflags & CONFFLAG_DURATION_STOP) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_STOP])) { 02113 calldurationlimit = atoi(optargs[OPT_ARG_DURATION_STOP]); 02114 ast_verb(3, "Setting call duration limit to %d seconds.\n", calldurationlimit); 02115 } 02116 02117 if ((confflags & CONFFLAG_DURATION_LIMIT) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_LIMIT])) { 02118 char *limit_str, *warning_str, *warnfreq_str; 02119 const char *var; 02120 02121 parse = optargs[OPT_ARG_DURATION_LIMIT]; 02122 limit_str = strsep(&parse, ":"); 02123 warning_str = strsep(&parse, ":"); 02124 warnfreq_str = parse; 02125 02126 timelimit = atol(limit_str); 02127 if (warning_str) 02128 play_warning = atol(warning_str); 02129 if (warnfreq_str) 02130 warning_freq = atol(warnfreq_str); 02131 02132 if (!timelimit) { 02133 timelimit = play_warning = warning_freq = 0; 02134 warning_sound = NULL; 02135 } else if (play_warning > timelimit) { 02136 if (!warning_freq) { 02137 play_warning = 0; 02138 } else { 02139 while (play_warning > timelimit) 02140 play_warning -= warning_freq; 02141 if (play_warning < 1) 02142 play_warning = warning_freq = 0; 02143 } 02144 } 02145 02146 ast_channel_lock(chan); 02147 if ((var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_WARNING_FILE"))) { 02148 var = ast_strdupa(var); 02149 } 02150 ast_channel_unlock(chan); 02151 02152 warning_sound = var ? var : "timeleft"; 02153 02154 ast_channel_lock(chan); 02155 if ((var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_TIMEOUT_FILE"))) { 02156 var = ast_strdupa(var); 02157 } 02158 ast_channel_unlock(chan); 02159 02160 end_sound = var ? var : NULL; 02161 02162 /* undo effect of S(x) in case they are both used */ 02163 calldurationlimit = 0; 02164 /* more efficient do it like S(x) does since no advanced opts */ 02165 if (!play_warning && !end_sound && timelimit) { 02166 calldurationlimit = timelimit / 1000; 02167 timelimit = play_warning = warning_freq = 0; 02168 } else { 02169 ast_debug(2, "Limit Data for this call:\n"); 02170 ast_debug(2, "- timelimit = %ld\n", timelimit); 02171 ast_debug(2, "- play_warning = %ld\n", play_warning); 02172 ast_debug(2, "- warning_freq = %ld\n", warning_freq); 02173 ast_debug(2, "- warning_sound = %s\n", warning_sound ? warning_sound : "UNDEF"); 02174 ast_debug(2, "- end_sound = %s\n", end_sound ? end_sound : "UNDEF"); 02175 } 02176 } 02177 02178 /* Get exit keys */ 02179 if ((confflags & CONFFLAG_KEYEXIT)) { 02180 if (!ast_strlen_zero(optargs[OPT_ARG_EXITKEYS])) 02181 exitkeys = ast_strdupa(optargs[OPT_ARG_EXITKEYS]); 02182 else 02183 exitkeys = ast_strdupa("#"); /* Default */ 02184 } 02185 02186 if (confflags & CONFFLAG_RECORDCONF) { 02187 if (!conf->recordingfilename) { 02188 const char *var; 02189 ast_channel_lock(chan); 02190 if ((var = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFILE"))) { 02191 conf->recordingfilename = ast_strdup(var); 02192 } 02193 if ((var = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFORMAT"))) { 02194 conf->recordingformat = ast_strdup(var); 02195 } 02196 ast_channel_unlock(chan); 02197 if (!conf->recordingfilename) { 02198 snprintf(recordingtmp, sizeof(recordingtmp), "meetme-conf-rec-%s-%s", conf->confno, chan->uniqueid); 02199 conf->recordingfilename = ast_strdup(recordingtmp); 02200 } 02201 if (!conf->recordingformat) { 02202 conf->recordingformat = ast_strdup("wav"); 02203 } 02204 ast_verb(4, "Starting recording of MeetMe Conference %s into file %s.%s.\n", 02205 conf->confno, conf->recordingfilename, conf->recordingformat); 02206 } 02207 } 02208 02209 ast_mutex_lock(&conf->recordthreadlock); 02210 if ((conf->recordthread == AST_PTHREADT_NULL) && (confflags & CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("DAHDI", AST_FORMAT_SLINEAR, "pseudo", NULL)))) { 02211 ast_set_read_format(conf->lchan, AST_FORMAT_SLINEAR); 02212 ast_set_write_format(conf->lchan, AST_FORMAT_SLINEAR); 02213 dahdic.chan = 0; 02214 dahdic.confno = conf->dahdiconf; 02215 dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON; 02216 if (ioctl(conf->lchan->fds[0], DAHDI_SETCONF, &dahdic)) { 02217 ast_log(LOG_WARNING, "Error starting listen channel\n"); 02218 ast_hangup(conf->lchan); 02219 conf->lchan = NULL; 02220 } else { 02221 ast_pthread_create_detached_background(&conf->recordthread, NULL, recordthread, conf); 02222 } 02223 } 02224 ast_mutex_unlock(&conf->recordthreadlock); 02225 02226 ast_mutex_lock(&conf->announcethreadlock); 02227 if ((conf->announcethread == AST_PTHREADT_NULL) && !(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW))) { 02228 ast_mutex_init(&conf->announcelistlock); 02229 AST_LIST_HEAD_INIT_NOLOCK(&conf->announcelist); 02230 ast_pthread_create_background(&conf->announcethread, NULL, announce_thread, conf); 02231 } 02232 ast_mutex_unlock(&conf->announcethreadlock); 02233 02234 time(&user->jointime); 02235 02236 user->timelimit = timelimit; 02237 user->play_warning = play_warning; 02238 user->warning_freq = warning_freq; 02239 user->warning_sound = warning_sound; 02240 user->end_sound = end_sound; 02241 02242 if (calldurationlimit > 0) { 02243 time(&user->kicktime); 02244 user->kicktime = user->kicktime + calldurationlimit; 02245 } 02246 02247 if (ast_tvzero(user->start_time)) 02248 user->start_time = ast_tvnow(); 02249 time_left_ms = user->timelimit; 02250 02251 if (user->timelimit) { 02252 nexteventts = ast_tvadd(user->start_time, ast_samp2tv(user->timelimit, 1000)); 02253 nexteventts = ast_tvsub(nexteventts, ast_samp2tv(user->play_warning, 1000)); 02254 } 02255 02256 if (conf->locked && (!(confflags & CONFFLAG_ADMIN))) { 02257 /* Sorry, but this conference is locked! */ 02258 if (!ast_streamfile(chan, "conf-locked", chan->language)) 02259 ast_waitstream(chan, ""); 02260 goto outrun; 02261 } 02262 02263 ast_mutex_lock(&conf->playlock); 02264 02265 if (rt_schedule && conf->maxusers) { 02266 if (conf->users >= conf->maxusers) { 02267 /* Sorry, but this confernce has reached the participant limit! */ 02268 if (!ast_streamfile(chan, "conf-full", chan->language)) 02269 ast_waitstream(chan, ""); 02270 ast_mutex_unlock(&conf->playlock); 02271 goto outrun; 02272 } 02273 } 02274 02275 ao2_lock(conf->usercontainer); 02276 ao2_callback(conf->usercontainer, OBJ_NODATA, user_max_cmp, &user->user_no); 02277 user->user_no++; 02278 ao2_link(conf->usercontainer, user); 02279 ao2_unlock(conf->usercontainer); 02280 02281 user->chan = chan; 02282 user->userflags = confflags; 02283 user->adminflags = (confflags & CONFFLAG_STARTMUTED) ? ADMINFLAG_SELFMUTED : 0; 02284 user->talking = -1; 02285 02286 ast_mutex_unlock(&conf->playlock); 02287 02288 if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW))) { 02289 char destdir[PATH_MAX]; 02290 02291 snprintf(destdir, sizeof(destdir), "%s/meetme", ast_config_AST_SPOOL_DIR); 02292 02293 if (ast_mkdir(destdir, 0777) != 0) { 02294 ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", destdir, strerror(errno)); 02295 goto outrun; 02296 } 02297 02298 snprintf(user->namerecloc, sizeof(user->namerecloc), 02299 "%s/meetme-username-%s-%d", destdir, 02300 conf->confno, user->user_no); 02301 if (confflags & CONFFLAG_INTROUSERNOREVIEW) 02302 res = ast_play_and_record(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE), 0, NULL); 02303 else 02304 res = ast_record_review(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, NULL); 02305 if (res == -1) 02306 goto outrun; 02307 } 02308 02309 ast_mutex_lock(&conf->playlock); 02310 02311 if (confflags & CONFFLAG_MARKEDUSER) 02312 conf->markedusers++; 02313 conf->users++; 02314 if (rt_log_members) { 02315 /* Update table */ 02316 snprintf(members, sizeof(members), "%d", conf->users); 02317 ast_realtime_require_field("meetme", 02318 "confno", strlen(conf->confno) > 7 ? RQ_UINTEGER4 : strlen(conf->confno) > 4 ? RQ_UINTEGER3 : RQ_UINTEGER2, strlen(conf->confno), 02319 "members", RQ_UINTEGER1, strlen(members), 02320 NULL); 02321 ast_update_realtime("meetme", "confno", conf->confno, "members", members, NULL); 02322 } 02323 setusercount = 1; 02324 02325 /* This device changed state now - if this is the first user */ 02326 if (conf->users == 1) 02327 ast_devstate_changed(AST_DEVICE_INUSE, "meetme:%s", conf->confno); 02328 02329 ast_mutex_unlock(&conf->playlock); 02330 02331 /* return the unique ID of the conference */ 02332 pbx_builtin_setvar_helper(chan, "MEETMEUNIQUEID", conf->uniqueid); 02333 02334 if (confflags & CONFFLAG_EXIT_CONTEXT) { 02335 ast_channel_lock(chan); 02336 if ((tmpvar = pbx_builtin_getvar_helper(chan, "MEETME_EXIT_CONTEXT"))) { 02337 ast_copy_string(exitcontext, tmpvar, sizeof(exitcontext)); 02338 } else if (!ast_strlen_zero(chan->macrocontext)) { 02339 ast_copy_string(exitcontext, chan->macrocontext, sizeof(exitcontext)); 02340 } else { 02341 ast_copy_string(exitcontext, chan->context, sizeof(exitcontext)); 02342 } 02343 ast_channel_unlock(chan); 02344 } 02345 02346 if (!(confflags & (CONFFLAG_QUIET | CONFFLAG_NOONLYPERSON))) { 02347 if (conf->users == 1 && !(confflags & CONFFLAG_WAITMARKED)) 02348 if (!ast_streamfile(chan, "conf-onlyperson", chan->language)) 02349 ast_waitstream(chan, ""); 02350 if ((confflags & CONFFLAG_WAITMARKED) && conf->markedusers == 0) 02351 if (!ast_streamfile(chan, "conf-waitforleader", chan->language)) 02352 ast_waitstream(chan, ""); 02353 } 02354 02355 if (!(confflags & CONFFLAG_QUIET) && (confflags & CONFFLAG_ANNOUNCEUSERCOUNT) && conf->users > 1) { 02356 int keepplaying = 1; 02357 02358 if (conf->users == 2) { 02359 if (!ast_streamfile(chan, "conf-onlyone", chan->language)) { 02360 res = ast_waitstream(chan, AST_DIGIT_ANY); 02361 ast_stopstream(chan); 02362 if (res > 0) 02363 keepplaying = 0; 02364 else if (res == -1) 02365 goto outrun; 02366 } 02367 } else { 02368 if (!ast_streamfile(chan, "conf-thereare", chan->language)) { 02369 res = ast_waitstream(chan, AST_DIGIT_ANY); 02370 ast_stopstream(chan); 02371 if (res > 0) 02372 keepplaying = 0; 02373 else if (res == -1) 02374 goto outrun; 02375 } 02376 if (keepplaying) { 02377 res = ast_say_number(chan, conf->users - 1, AST_DIGIT_ANY, chan->language, (char *) NULL); 02378 if (res > 0) 02379 keepplaying = 0; 02380 else if (res == -1) 02381 goto outrun; 02382 } 02383 if (keepplaying && !ast_streamfile(chan, "conf-otherinparty", chan->language)) { 02384 res = ast_waitstream(chan, AST_DIGIT_ANY); 02385 ast_stopstream(chan); 02386 if (res > 0) 02387 keepplaying = 0; 02388 else if (res == -1) 02389 goto outrun; 02390 } 02391 } 02392 } 02393 02394 if (!(confflags & CONFFLAG_NO_AUDIO_UNTIL_UP)) { 02395 /* We're leaving this alone until the state gets changed to up */ 02396 ast_indicate(chan, -1); 02397 } 02398 02399 if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) { 02400 ast_log(LOG_WARNING, "Unable to set '%s' to write linear mode\n", chan->name); 02401 goto outrun; 02402 } 02403 02404 if (ast_set_read_format(chan, AST_FORMAT_SLINEAR) < 0) { 02405 ast_log(LOG_WARNING, "Unable to set '%s' to read linear mode\n", chan->name); 02406 goto outrun; 02407 } 02408 02409 retrydahdi = (strcasecmp(chan->tech->type, "DAHDI") || (chan->audiohooks || chan->monitor) ? 1 : 0); 02410 user->dahdichannel = !retrydahdi; 02411 02412 dahdiretry: 02413 origfd = chan->fds[0]; 02414 if (retrydahdi) { 02415 /* open pseudo in non-blocking mode */ 02416 fd = open("/dev/dahdi/pseudo", O_RDWR | O_NONBLOCK); 02417 if (fd < 0) { 02418 ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno)); 02419 goto outrun; 02420 } 02421 using_pseudo = 1; 02422 /* Setup buffering information */ 02423 memset(&bi, 0, sizeof(bi)); 02424 bi.bufsize = CONF_SIZE / 2; 02425 bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE; 02426 bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE; 02427 bi.numbufs = audio_buffers; 02428 if (ioctl(fd, DAHDI_SET_BUFINFO, &bi)) { 02429 ast_log(LOG_WARNING, "Unable to set buffering information: %s\n", strerror(errno)); 02430 close(fd); 02431 goto outrun; 02432 } 02433 x = 1; 02434 if (ioctl(fd, DAHDI_SETLINEAR, &x)) { 02435 ast_log(LOG_WARNING, "Unable to set linear mode: %s\n", strerror(errno)); 02436 close(fd); 02437 goto outrun; 02438 } 02439 nfds = 1; 02440 } else { 02441 /* XXX Make sure we're not running on a pseudo channel XXX */ 02442 fd = chan->fds[0]; 02443 nfds = 0; 02444 } 02445 memset(&dahdic, 0, sizeof(dahdic)); 02446 memset(&dahdic_empty, 0, sizeof(dahdic_empty)); 02447 /* Check to see if we're in a conference... */ 02448 dahdic.chan = 0; 02449 if (ioctl(fd, DAHDI_GETCONF, &dahdic)) { 02450 ast_log(LOG_WARNING, "Error getting conference\n"); 02451 close(fd); 02452 goto outrun; 02453 } 02454 if (dahdic.confmode) { 02455 /* Whoa, already in a conference... Retry... */ 02456 if (!retrydahdi) { 02457 ast_debug(1, "DAHDI channel is in a conference already, retrying with pseudo\n"); 02458 retrydahdi = 1; 02459 goto dahdiretry; 02460 } 02461 } 02462 memset(&dahdic, 0, sizeof(dahdic)); 02463 /* Add us to the conference */ 02464 dahdic.chan = 0; 02465 dahdic.confno = conf->dahdiconf; 02466 02467 if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW)) && conf->users > 1) { 02468 struct announce_listitem *item; 02469 if (!(item = ao2_alloc(sizeof(*item), NULL))) 02470 return -1; 02471 ast_copy_string(item->namerecloc, user->namerecloc, sizeof(item->namerecloc)); 02472 ast_copy_string(item->language, chan->language, sizeof(item->language)); 02473 item->confchan = conf->chan; 02474 item->confusers = conf->users; 02475 item->announcetype = CONF_HASJOIN; 02476 ast_mutex_lock(&conf->announcelistlock); 02477 ao2_ref(item, +1); /* add one more so we can determine when announce_thread is done playing it */ 02478 AST_LIST_INSERT_TAIL(&conf->announcelist, item, entry); 02479 ast_cond_signal(&conf->announcelist_addition); 02480 ast_mutex_unlock(&conf->announcelistlock); 02481 02482 while (!ast_check_hangup(conf->chan) && ao2_ref(item, 0) == 2 && !ast_safe_sleep(chan, 1000)) { 02483 ; 02484 } 02485 ao2_ref(item, -1); 02486 } 02487 02488 if (confflags & CONFFLAG_WAITMARKED && !conf->markedusers) 02489 dahdic.confmode = DAHDI_CONF_CONF; 02490 else if (confflags & CONFFLAG_MONITOR) 02491 dahdic.confmode = DAHDI_CONF_CONFMON | DAHDI_CONF_LISTENER; 02492 else if (confflags & CONFFLAG_TALKER) 02493 dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER; 02494 else 02495 dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER; 02496 02497 if (ioctl(fd, DAHDI_SETCONF, &dahdic)) { 02498 ast_log(LOG_WARNING, "Error setting conference\n"); 02499 close(fd); 02500 goto outrun; 02501 } 02502 ast_debug(1, "Placed channel %s in DAHDI conf %d\n", chan->name, conf->dahdiconf); 02503 02504 if (!sent_event) { 02505 manager_event(EVENT_FLAG_CALL, "MeetmeJoin", 02506 "Channel: %s\r\n" 02507 "Uniqueid: %s\r\n" 02508 "Meetme: %s\r\n" 02509 "Usernum: %d\r\n" 02510 "CallerIDnum: %s\r\n" 02511 "CallerIDname: %s\r\n", 02512 chan->name, chan->uniqueid, conf->confno, 02513 user->user_no, 02514 S_OR(user->chan->cid.cid_num, "<unknown>"), 02515 S_OR(user->chan->cid.cid_name, "<unknown>") 02516 ); 02517 sent_event = 1; 02518 } 02519 02520 if (!firstpass && !(confflags & CONFFLAG_MONITOR) && !(confflags & CONFFLAG_ADMIN)) { 02521 firstpass = 1; 02522 if (!(confflags & CONFFLAG_QUIET)) 02523 if (!(confflags & CONFFLAG_WAITMARKED) || ((confflags & CONFFLAG_MARKEDUSER) && (conf->markedusers >= 1))) 02524 conf_play(chan, conf, ENTER); 02525 } 02526 02527 conf_flush(fd, chan); 02528 02529 if (dsp) 02530 ast_dsp_free(dsp); 02531 02532 if (!(dsp = ast_dsp_new())) { 02533 ast_log(LOG_WARNING, "Unable to allocate DSP!\n"); 02534 res = -1; 02535 } 02536 02537 if (confflags & CONFFLAG_AGI) { 02538 /* Get name of AGI file to run from $(MEETME_AGI_BACKGROUND) 02539 or use default filename of conf-background.agi */ 02540 02541 ast_channel_lock(chan); 02542 if ((tmpvar = pbx_builtin_getvar_helper(chan, "MEETME_AGI_BACKGROUND"))) { 02543 agifile = ast_strdupa(tmpvar); 02544 } else { 02545 agifile = ast_strdupa(agifiledefault); 02546 } 02547 ast_channel_unlock(chan); 02548 02549 if (user->dahdichannel) { 02550 /* Set CONFMUTE mode on DAHDI channel to mute DTMF tones */ 02551 x = 1; 02552 ast_channel_setoption(chan, AST_OPTION_TONE_VERIFY, &x, sizeof(char), 0); 02553 } 02554 /* Find a pointer to the agi app and execute the script */ 02555 agi_app = pbx_findapp("agi"); 02556 if (agi_app) { 02557 ret = pbx_exec(chan, agi_app, agifile); 02558 } else { 02559 ast_log(LOG_WARNING, "Could not find application (agi)\n"); 02560 ret = -2; 02561 } 02562 if (user->dahdichannel) { 02563 /* Remove CONFMUTE mode on DAHDI channel */ 02564 x = 0; 02565 ast_channel_setoption(chan, AST_OPTION_TONE_VERIFY, &x, sizeof(char), 0); 02566 } 02567 } else { 02568 if (user->dahdichannel && (confflags & CONFFLAG_STARMENU)) { 02569 /* Set CONFMUTE mode on DAHDI channel to mute DTMF tones when the menu is enabled */ 02570 x = 1; 02571 ast_channel_setoption(chan, AST_OPTION_TONE_VERIFY, &x, sizeof(char), 0); 02572 } 02573 for (;;) { 02574 int menu_was_active = 0; 02575 02576 outfd = -1; 02577 ms = -1; 02578 now = ast_tvnow(); 02579 02580 if (rt_schedule && conf->endtime) { 02581 char currenttime[32]; 02582 long localendtime = 0; 02583 int extended = 0; 02584 struct ast_tm tm; 02585 struct ast_variable *var, *origvar; 02586 struct timeval tmp; 02587 02588 if (now.tv_sec % 60 == 0) { 02589 if (!checked) { 02590 ast_localtime(&now, &tm, NULL); 02591 ast_strftime(currenttime, sizeof(currenttime), DATE_FORMAT, &tm); 02592 var = origvar = ast_load_realtime("meetme", "confno", 02593 conf->confno, "starttime <=", currenttime, 02594 "endtime >=", currenttime, NULL); 02595 02596 for ( ; var; var = var->next) { 02597 if (!strcasecmp(var->name, "endtime")) { 02598 struct ast_tm endtime_tm; 02599 ast_strptime(var->value, "%Y-%m-%d %H:%M:%S", &endtime_tm); 02600 tmp = ast_mktime(&endtime_tm, NULL); 02601 localendtime = tmp.tv_sec; 02602 } 02603 } 02604 ast_variables_destroy(origvar); 02605 02606 /* A conference can be extended from the 02607 Admin/User menu or by an external source */ 02608 if (localendtime > conf->endtime){ 02609 conf->endtime = localendtime; 02610 extended = 1; 02611 } 02612 02613 if (conf->endtime && (now.tv_sec >= conf->endtime)) { 02614 ast_verbose("Quitting time...\n"); 02615 goto outrun; 02616 } 02617 02618 if (!announcement_played && conf->endalert) { 02619 if (now.tv_sec + conf->endalert >= conf->endtime) { 02620 if (!ast_streamfile(chan, "conf-will-end-in", chan->language)) 02621 ast_waitstream(chan, ""); 02622 ast_say_digits(chan, (conf->endtime - now.tv_sec) / 60, "", chan->language); 02623 if (!ast_streamfile(chan, "minutes", chan->language)) 02624 ast_waitstream(chan, ""); 02625 if (musiconhold) { 02626 conf_start_moh(chan, optargs[OPT_ARG_MOH_CLASS]); 02627 } 02628 announcement_played = 1; 02629 } 02630 } 02631 02632 if (extended) { 02633 announcement_played = 0; 02634 } 02635 02636 checked = 1; 02637 } 02638 } else { 02639 checked = 0; 02640 } 02641 } 02642 02643 if (user->kicktime && (user->kicktime <= now.tv_sec)) { 02644 break; 02645 } 02646 02647 to = -1; 02648 if (user->timelimit) { 02649 int minutes = 0, seconds = 0, remain = 0; 02650 02651 to = ast_tvdiff_ms(nexteventts, now); 02652 if (to < 0) { 02653 to = 0; 02654 } 02655 time_left_ms = user->timelimit - ast_tvdiff_ms(now, user->start_time); 02656 if (time_left_ms < to) { 02657 to = time_left_ms; 02658 } 02659 02660 if (time_left_ms <= 0) { 02661 if (user->end_sound) { 02662 res = ast_streamfile(chan, user->end_sound, chan->language); 02663 res = ast_waitstream(chan, ""); 02664 } 02665 break; 02666 } 02667 02668 if (!to) { 02669 if (time_left_ms >= 5000) { 02670 02671 remain = (time_left_ms + 500) / 1000; 02672 if (remain / 60 >= 1) { 02673 minutes = remain / 60; 02674 seconds = remain % 60; 02675 } else { 02676 seconds = remain; 02677 } 02678 02679 /* force the time left to round up if appropriate */ 02680 if (user->warning_sound && user->play_warning) { 02681 if (!strcmp(user->warning_sound, "timeleft")) { 02682 02683 res = ast_streamfile(chan, "vm-youhave", chan->language); 02684 res = ast_waitstream(chan, ""); 02685 if (minutes) { 02686 res = ast_say_number(chan, minutes, AST_DIGIT_ANY, chan->language, (char *) NULL); 02687 res = ast_streamfile(chan, "queue-minutes", chan->language); 02688 res = ast_waitstream(chan, ""); 02689 } 02690 if (seconds) { 02691 res = ast_say_number(chan, seconds, AST_DIGIT_ANY, chan->language, (char *) NULL); 02692 res = ast_streamfile(chan, "queue-seconds", chan->language); 02693 res = ast_waitstream(chan, ""); 02694 } 02695 } else { 02696 res = ast_streamfile(chan, user->warning_sound, chan->language); 02697 res = ast_waitstream(chan, ""); 02698 } 02699 if (musiconhold) { 02700 conf_start_moh(chan, optargs[OPT_ARG_MOH_CLASS]); 02701 } 02702 } 02703 } 02704 if (user->warning_freq) { 02705 nexteventts = ast_tvadd(nexteventts, ast_samp2tv(user->warning_freq, 1000)); 02706 } else { 02707 nexteventts = ast_tvadd(user->start_time, ast_samp2tv(user->timelimit, 1000)); 02708 } 02709 } 02710 } 02711 02712 now = ast_tvnow(); 02713 if (timeout && now.tv_sec >= timeout) { 02714 break; 02715 } 02716 02717 /* if we have just exited from the menu, and the user had a channel-driver 02718 volume adjustment, restore it 02719 */ 02720 if (!menu_active && menu_was_active && user->listen.desired && !user->listen.actual) { 02721 set_talk_volume(user, user->listen.desired); 02722 } 02723 02724 menu_was_active = menu_active; 02725 02726 currentmarked = conf->markedusers; 02727 if (!(confflags & CONFFLAG_QUIET) && 02728 (confflags & CONFFLAG_MARKEDUSER) && 02729 (confflags & CONFFLAG_WAITMARKED) && 02730 lastmarked == 0) { 02731 if (currentmarked == 1 && conf->users > 1) { 02732 ast_say_number(chan, conf->users - 1, AST_DIGIT_ANY, chan->language, (char *) NULL); 02733 if (conf->users - 1 == 1) { 02734 if (!ast_streamfile(chan, "conf-userwilljoin", chan->language)) { 02735 ast_waitstream(chan, ""); 02736 } 02737 } else { 02738 if (!ast_streamfile(chan, "conf-userswilljoin", chan->language)) { 02739 ast_waitstream(chan, ""); 02740 } 02741 } 02742 } 02743 if (conf->users == 1 && ! (confflags & CONFFLAG_MARKEDUSER)) { 02744 if (!ast_streamfile(chan, "conf-onlyperson", chan->language)) { 02745 ast_waitstream(chan, ""); 02746 } 02747 } 02748 } 02749 02750 /* Update the struct with the actual confflags */ 02751 user->userflags = confflags; 02752 02753 if (confflags & CONFFLAG_WAITMARKED) { 02754 if (currentmarked == 0) { 02755 if (lastmarked != 0) { 02756 if (!(confflags & CONFFLAG_QUIET)) { 02757 if (!ast_streamfile(chan, "conf-leaderhasleft", chan->language)) { 02758 ast_waitstream(chan, ""); 02759 } 02760 } 02761 if (confflags & CONFFLAG_MARKEDEXIT) { 02762 if (confflags & CONFFLAG_KICK_CONTINUE) { 02763 ret = 0; 02764 } 02765 break; 02766 } else { 02767 dahdic.confmode = DAHDI_CONF_CONF; 02768 if (ioctl(fd, DAHDI_SETCONF, &dahdic)) { 02769 ast_log(LOG_WARNING, "Error setting conference\n"); 02770 close(fd); 02771 goto outrun; 02772 } 02773 } 02774 } 02775 if (!musiconhold && (confflags & CONFFLAG_MOH)) { 02776 conf_start_moh(chan, optargs[OPT_ARG_MOH_CLASS]); 02777 musiconhold = 1; 02778 } 02779 } else if (currentmarked >= 1 && lastmarked == 0) { 02780 /* Marked user entered, so cancel timeout */ 02781 timeout = 0; 02782 if (confflags & CONFFLAG_MONITOR) { 02783 dahdic.confmode = DAHDI_CONF_CONFMON | DAHDI_CONF_LISTENER; 02784 } else if (confflags & CONFFLAG_TALKER) { 02785 dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER; 02786 } else { 02787 dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER; 02788 } 02789 if (ioctl(fd, DAHDI_SETCONF, &dahdic)) { 02790 ast_log(LOG_WARNING, "Error setting conference\n"); 02791 close(fd); 02792 goto outrun; 02793 } 02794 if (musiconhold && (confflags & CONFFLAG_MOH)) { 02795 ast_moh_stop(chan); 02796 musiconhold = 0; 02797 } 02798 if (!(confflags & CONFFLAG_QUIET) && !(confflags & CONFFLAG_MARKEDUSER)) { 02799 if (!ast_streamfile(chan, "conf-placeintoconf", chan->language)) { 02800 ast_waitstream(chan, ""); 02801 } 02802 conf_play(chan, conf, ENTER); 02803 } 02804 } 02805 } 02806 02807 /* trying to add moh for single person conf */ 02808 if ((confflags & CONFFLAG_MOH) && !(confflags & CONFFLAG_WAITMARKED)) { 02809 if (conf->users == 1) { 02810 if (!musiconhold) { 02811 conf_start_moh(chan, optargs[OPT_ARG_MOH_CLASS]); 02812 musiconhold = 1; 02813 } 02814 } else { 02815 if (musiconhold) { 02816 ast_moh_stop(chan); 02817 musiconhold = 0; 02818 } 02819 } 02820 } 02821 02822 /* Leave if the last marked user left */ 02823 if (currentmarked == 0 && lastmarked != 0 && (confflags & CONFFLAG_MARKEDEXIT)) { 02824 if (confflags & CONFFLAG_KICK_CONTINUE) { 02825 ret = 0; 02826 } else { 02827 ret = -1; 02828 } 02829 break; 02830 } 02831 02832 /* Check if my modes have changed */ 02833 02834 /* If I should be muted but am still talker, mute me */ 02835 if ((user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) && (dahdic.confmode & DAHDI_CONF_TALKER)) { 02836 dahdic.confmode ^= DAHDI_CONF_TALKER; 02837 if (ioctl(fd, DAHDI_SETCONF, &dahdic)) { 02838 ast_log(LOG_WARNING, "Error setting conference - Un/Mute \n"); 02839 ret = -1; 02840 break; 02841 } 02842 02843 /* Indicate user is not talking anymore - change him to unmonitored state */ 02844 if ((confflags & (CONFFLAG_MONITORTALKER | CONFFLAG_OPTIMIZETALKER))) { 02845 set_user_talking(chan, conf, user, -1, confflags & CONFFLAG_MONITORTALKER); 02846 } 02847 02848 manager_event(EVENT_FLAG_CALL, "MeetmeMute", 02849 "Channel: %s\r\n" 02850 "Uniqueid: %s\r\n" 02851 "Meetme: %s\r\n" 02852 "Usernum: %i\r\n" 02853 "Status: on\r\n", 02854 chan->name, chan->uniqueid, conf->confno, user->user_no); 02855 } 02856 02857 /* If I should be un-muted but am not talker, un-mute me */ 02858 if (!(user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) && !(confflags & CONFFLAG_MONITOR) && !(dahdic.confmode & DAHDI_CONF_TALKER)) { 02859 dahdic.confmode |= DAHDI_CONF_TALKER; 02860 if (ioctl(fd, DAHDI_SETCONF, &dahdic)) { 02861 ast_log(LOG_WARNING, "Error setting conference - Un/Mute \n"); 02862 ret = -1; 02863 break; 02864 } 02865 02866 manager_event(EVENT_FLAG_CALL, "MeetmeMute", 02867 "Channel: %s\r\n" 02868 "Uniqueid: %s\r\n" 02869 "Meetme: %s\r\n" 02870 "Usernum: %i\r\n" 02871 "Status: off\r\n", 02872 chan->name, chan->uniqueid, conf->confno, user->user_no); 02873 } 02874 02875 if ((user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) && 02876 (user->adminflags & ADMINFLAG_T_REQUEST) && !(talkreq_manager)) { 02877 talkreq_manager = 1; 02878 02879 manager_event(EVENT_FLAG_CALL, "MeetmeTalkRequest", 02880 "Channel: %s\r\n" 02881 "Uniqueid: %s\r\n" 02882 "Meetme: %s\r\n" 02883 "Usernum: %i\r\n" 02884 "Status: on\r\n", 02885 chan->name, chan->uniqueid, conf->confno, user->user_no); 02886 } 02887 02888 02889 if (!(user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) && 02890 !(user->adminflags & ADMINFLAG_T_REQUEST) && (talkreq_manager)) { 02891 talkreq_manager = 0; 02892 manager_event(EVENT_FLAG_CALL, "MeetmeTalkRequest", 02893 "Channel: %s\r\n" 02894 "Uniqueid: %s\r\n" 02895 "Meetme: %s\r\n" 02896 "Usernum: %i\r\n" 02897 "Status: off\r\n", 02898 chan->name, chan->uniqueid, conf->confno, user->user_no); 02899 } 02900 02901 /* If I have been kicked, exit the conference */ 02902 if (user->adminflags & ADMINFLAG_KICKME) { 02903 /* You have been kicked. */ 02904 if (!(confflags & CONFFLAG_QUIET) && 02905 !ast_streamfile(chan, "conf-kicked", chan->language)) { 02906 ast_waitstream(chan, ""); 02907 } 02908 ret = 0; 02909 break; 02910 } 02911 02912 /* Perform an extra hangup check just in case */ 02913 if (ast_check_hangup(chan)) { 02914 break; 02915 } 02916 02917 c = ast_waitfor_nandfds(&chan, 1, &fd, nfds, NULL, &outfd, &ms); 02918 02919 if (c) { 02920 char dtmfstr[2] = ""; 02921 02922 if (c->fds[0] != origfd || (user->dahdichannel && (c->audiohooks || c->monitor))) { 02923 if (using_pseudo) { 02924 /* Kill old pseudo */ 02925 close(fd); 02926 using_pseudo = 0; 02927 } 02928 ast_debug(1, "Ooh, something swapped out under us, starting over\n"); 02929 retrydahdi = (strcasecmp(c->tech->type, "DAHDI") || (c->audiohooks || c->monitor) ? 1 : 0); 02930 user->dahdichannel = !retrydahdi; 02931 goto dahdiretry; 02932 } 02933 if ((confflags & CONFFLAG_MONITOR) || (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED))) { 02934 f = ast_read_noaudio(c); 02935 } else { 02936 f = ast_read(c); 02937 } 02938 if (!f) { 02939 break; 02940 } 02941 if (f->frametype == AST_FRAME_DTMF) { 02942 dtmfstr[0] = f->subclass; 02943 dtmfstr[1] = '\0'; 02944 } 02945 02946 if ((f->frametype == AST_FRAME_VOICE) && (f->subclass == AST_FORMAT_SLINEAR)) { 02947 if (user->talk.actual) { 02948 ast_frame_adjust_volume(f, user->talk.actual); 02949 } 02950 02951 if (confflags & (CONFFLAG_OPTIMIZETALKER | CONFFLAG_MONITORTALKER)) { 02952 if (user->talking == -1) { 02953 user->talking = 0; 02954 } 02955 02956 res = ast_dsp_silence(dsp, f, &totalsilence); 02957 if (totalsilence < MEETME_DELAYDETECTTALK) { 02958 set_user_talking(chan, conf, user, 1, confflags & CONFFLAG_MONITORTALKER); 02959 } 02960 if (totalsilence > MEETME_DELAYDETECTENDTALK) { 02961 set_user_talking(chan, conf, user, 0, confflags & CONFFLAG_MONITORTALKER); 02962 } 02963 } 02964 if (using_pseudo) { 02965 /* Absolutely do _not_ use careful_write here... 02966 it is important that we read data from the channel 02967 as fast as it arrives, and feed it into the conference. 02968 The buffering in the pseudo channel will take care of any 02969 timing differences, unless they are so drastic as to lose 02970 audio frames (in which case carefully writing would only 02971 have delayed the audio even further). 02972 */ 02973 /* As it turns out, we do want to use careful write. We just 02974 don't want to block, but we do want to at least *try* 02975 to write out all the samples. 02976 */ 02977 if (user->talking || !(confflags & CONFFLAG_OPTIMIZETALKER)) { 02978 careful_write(fd, f->data.ptr, f->datalen, 0); 02979 } 02980 } 02981 } else if (((f->frametype == AST_FRAME_DTMF) && (f->subclass == '*') && (confflags & CONFFLAG_STARMENU)) || ((f->frametype == AST_FRAME_DTMF) && menu_active)) { 02982 if (confflags & CONFFLAG_PASS_DTMF) { 02983 conf_queue_dtmf(conf, user, f); 02984 } 02985 if (ioctl(fd, DAHDI_SETCONF, &dahdic_empty)) { 02986 ast_log(LOG_WARNING, "Error setting conference\n"); 02987 close(fd); 02988 ast_frfree(f); 02989 goto outrun; 02990 } 02991 02992 /* if we are entering the menu, and the user has a channel-driver 02993 volume adjustment, clear it 02994 */ 02995 if (!menu_active && user->talk.desired && !user->talk.actual) { 02996 set_talk_volume(user, 0); 02997 } 02998 02999 if (musiconhold) { 03000 ast_moh_stop(chan); 03001 } 03002 if ((confflags & CONFFLAG_ADMIN)) { 03003 /* Admin menu */ 03004 if (!menu_active) { 03005 menu_active = 1; 03006 /* Record this sound! */ 03007 if (!ast_streamfile(chan, "conf-adminmenu-162", chan->language)) { 03008 dtmf = ast_waitstream(chan, AST_DIGIT_ANY); 03009 ast_stopstream(chan); 03010 } else { 03011 dtmf = 0; 03012 } 03013 } else { 03014 dtmf = f->subclass; 03015 } 03016 if (dtmf) { 03017 switch(dtmf) { 03018 case '1': /* Un/Mute */ 03019 menu_active = 0; 03020 03021 /* for admin, change both admin and use flags */ 03022 if (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) { 03023 user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED); 03024 } else { 03025 user->adminflags |= (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED); 03026 } 03027 03028 if ((confflags & CONFFLAG_MONITOR) || (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED))) { 03029 if (!ast_streamfile(chan, "conf-muted", chan->language)) { 03030 ast_waitstream(chan, ""); 03031 } 03032 } else { 03033 if (!ast_streamfile(chan, "conf-unmuted", chan->language)) { 03034 ast_waitstream(chan, ""); 03035 } 03036 } 03037 break; 03038 case '2': /* Un/Lock the Conference */ 03039 menu_active = 0; 03040 if (conf->locked) { 03041 conf->locked = 0; 03042 if (!ast_streamfile(chan, "conf-unlockednow", chan->language)) { 03043 ast_waitstream(chan, ""); 03044 } 03045 } else { 03046 conf->locked = 1; 03047 if (!ast_streamfile(chan, "conf-lockednow", chan->language)) { 03048 ast_waitstream(chan, ""); 03049 } 03050 } 03051 break; 03052 case '3': /* Eject last user */ 03053 { 03054 int max_no = 0; 03055 menu_active = 0; 03056 ao2_callback(conf->usercontainer, OBJ_NODATA, user_max_cmp, &max_no); 03057 usr = ao2_find(conf->usercontainer, &max_no, 0); 03058 if ((usr->chan->name == chan->name)||(usr->userflags & CONFFLAG_ADMIN)) { 03059 if(!ast_streamfile(chan, "conf-errormenu", chan->language)) 03060 ast_waitstream(chan, ""); 03061 } else { 03062 usr->adminflags |= ADMINFLAG_KICKME; 03063 } 03064 ao2_ref(user, -1); 03065 ast_stopstream(chan); 03066 break; 03067 } 03068 case '4': 03069 tweak_listen_volume(user, VOL_DOWN); 03070 break; 03071 case '5': 03072 /* Extend RT conference */ 03073 if (rt_schedule) { 03074 if (!rt_extend_conf(conf->confno)) { 03075 if (!ast_streamfile(chan, "conf-extended", chan->language)) { 03076 ast_waitstream(chan, ""); 03077 } 03078 } else { 03079 if (!ast_streamfile(chan, "conf-nonextended", chan->language)) { 03080 ast_waitstream(chan, ""); 03081 } 03082 } 03083 ast_stopstream(chan); 03084 } 03085 menu_active = 0; 03086 break; 03087 case '6': 03088 tweak_listen_volume(user, VOL_UP); 03089 break; 03090 case '7': 03091 tweak_talk_volume(user, VOL_DOWN); 03092 break; 03093 case '8': 03094 menu_active = 0; 03095 break; 03096 case '9': 03097 tweak_talk_volume(user, VOL_UP); 03098 break; 03099 default: 03100 menu_active = 0; 03101 /* Play an error message! */ 03102 if (!ast_streamfile(chan, "conf-errormenu", chan->language)) { 03103 ast_waitstream(chan, ""); 03104 } 03105 break; 03106 } 03107 } 03108 } else { 03109 /* User menu */ 03110 if (!menu_active) { 03111 menu_active = 1; 03112 if (!ast_streamfile(chan, "conf-usermenu-162", chan->language)) { 03113 dtmf = ast_waitstream(chan, AST_DIGIT_ANY); 03114 ast_stopstream(chan); 03115 } else { 03116 dtmf = 0; 03117 } 03118 } else { 03119 dtmf = f->subclass; 03120 } 03121 if (dtmf) { 03122 switch (dtmf) { 03123 case '1': /* Un/Mute */ 03124 menu_active = 0; 03125 03126 /* user can only toggle the self-muted state */ 03127 user->adminflags ^= ADMINFLAG_SELFMUTED; 03128 03129 /* they can't override the admin mute state */ 03130 if ((confflags & CONFFLAG_MONITOR) || (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED))) { 03131 if (!ast_streamfile(chan, "conf-muted", chan->language)) { 03132 ast_waitstream(chan, ""); 03133 } 03134 } else { 03135 if (!ast_streamfile(chan, "conf-unmuted", chan->language)) { 03136 ast_waitstream(chan, ""); 03137 } 03138 } 03139 break; 03140 case '2': 03141 menu_active = 0; 03142 if (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) { 03143 user->adminflags |= ADMINFLAG_T_REQUEST; 03144 } 03145 03146 if (user->adminflags & ADMINFLAG_T_REQUEST) { 03147 if (!ast_streamfile(chan, "beep", chan->language)) { 03148 ast_waitstream(chan, ""); 03149 } 03150 } 03151 break; 03152 case '4': 03153 tweak_listen_volume(user, VOL_DOWN); 03154 break; 03155 case '5': 03156 /* Extend RT conference */ 03157 if (rt_schedule) { 03158 rt_extend_conf(conf->confno); 03159 } 03160 menu_active = 0; 03161 break; 03162 case '6': 03163 tweak_listen_volume(user, VOL_UP); 03164 break; 03165 case '7': 03166 tweak_talk_volume(user, VOL_DOWN); 03167 break; 03168 case '8': 03169 menu_active = 0; 03170 break; 03171 case '9': 03172 tweak_talk_volume(user, VOL_UP); 03173 break; 03174 default: 03175 menu_active = 0; 03176 if (!ast_streamfile(chan, "conf-errormenu", chan->language)) { 03177 ast_waitstream(chan, ""); 03178 } 03179 break; 03180 } 03181 } 03182 } 03183 if (musiconhold) { 03184 conf_start_moh(chan, optargs[OPT_ARG_MOH_CLASS]); 03185 } 03186 03187 if (ioctl(fd, DAHDI_SETCONF, &dahdic)) { 03188 ast_log(LOG_WARNING, "Error setting conference\n"); 03189 close(fd); 03190 ast_frfree(f); 03191 goto outrun; 03192 } 03193 03194 conf_flush(fd, chan); 03195 /* Since this option could absorb DTMF meant for the previous (menu), we have to check this one last */ 03196 } else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_EXIT_CONTEXT) && ast_exists_extension(chan, exitcontext, dtmfstr, 1, "")) { 03197 if (confflags & CONFFLAG_PASS_DTMF) { 03198 conf_queue_dtmf(conf, user, f); 03199 } 03200 03201 if (!ast_goto_if_exists(chan, exitcontext, dtmfstr, 1)) { 03202 ast_debug(1, "Got DTMF %c, goto context %s\n", dtmfstr[0], exitcontext); 03203 ret = 0; 03204 ast_frfree(f); 03205 break; 03206 } else { 03207 ast_debug(2, "Exit by single digit did not work in meetme. Extension %s does not exist in context %s\n", dtmfstr, exitcontext); 03208 } 03209 } else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_KEYEXIT) && (strchr(exitkeys, f->subclass))) { 03210 pbx_builtin_setvar_helper(chan, "MEETME_EXIT_KEY", dtmfstr); 03211 03212 if (confflags & CONFFLAG_PASS_DTMF) { 03213 conf_queue_dtmf(conf, user, f); 03214 } 03215 ret = 0; 03216 ast_frfree(f); 03217 break; 03218 } else if ((f->frametype == AST_FRAME_DTMF_BEGIN || f->frametype == AST_FRAME_DTMF_END) 03219 && confflags & CONFFLAG_PASS_DTMF) { 03220 conf_queue_dtmf(conf, user, f); 03221 } else if ((confflags & CONFFLAG_SLA_STATION) && f->frametype == AST_FRAME_CONTROL) { 03222 switch (f->subclass) { 03223 case AST_CONTROL_HOLD: 03224 sla_queue_event_conf(SLA_EVENT_HOLD, chan, conf); 03225 break; 03226 default: 03227 break; 03228 } 03229 } else if (f->frametype == AST_FRAME_NULL) { 03230 /* Ignore NULL frames. It is perfectly normal to get these if the person is muted. */ 03231 } else if (f->frametype == AST_FRAME_CONTROL) { 03232 switch (f->subclass) { 03233 case AST_CONTROL_BUSY: 03234 case AST_CONTROL_CONGESTION: 03235 ast_frfree(f); 03236 goto outrun; 03237 break; 03238 default: 03239 ast_debug(1, 03240 "Got ignored control frame on channel %s, f->frametype=%d,f->subclass=%d\n", 03241 chan->name, f->frametype, f->subclass); 03242 } 03243 } else { 03244 ast_debug(1, 03245 "Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n", 03246 chan->name, f->frametype, f->subclass); 03247 } 03248 ast_frfree(f); 03249 } else if (outfd > -1) { 03250 res = read(outfd, buf, CONF_SIZE); 03251 if (res > 0) { 03252 memset(&fr, 0, sizeof(fr)); 03253 fr.frametype = AST_FRAME_VOICE; 03254 fr.subclass = AST_FORMAT_SLINEAR; 03255 fr.datalen = res; 03256 fr.samples = res / 2; 03257 fr.data.ptr = buf; 03258 fr.offset = AST_FRIENDLY_OFFSET; 03259 if (!user->listen.actual && 03260 ((confflags & CONFFLAG_MONITOR) || 03261 (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) || 03262 (!user->talking && (confflags & CONFFLAG_OPTIMIZETALKER)) 03263 )) { 03264 int idx; 03265 for (idx = 0; idx < AST_FRAME_BITS; idx++) { 03266 if (chan->rawwriteformat & (1 << idx)) { 03267 break; 03268 } 03269 } 03270 if (idx >= AST_FRAME_BITS) { 03271 goto bailoutandtrynormal; 03272 } 03273 ast_mutex_lock(&conf->listenlock); 03274 if (!conf->transframe[idx]) { 03275 if (conf->origframe) { 03276 if (musiconhold && !ast_dsp_silence(dsp, conf->origframe, &confsilence) && confsilence < MEETME_DELAYDETECTTALK) { 03277 ast_moh_stop(chan); 03278 mohtempstopped = 1; 03279 } 03280 if (!conf->transpath[idx]) { 03281 conf->transpath[idx] = ast_translator_build_path((1 << idx), AST_FORMAT_SLINEAR); 03282 } 03283 if (conf->transpath[idx]) { 03284 conf->transframe[idx] = ast_translate(conf->transpath[idx], conf->origframe, 0); 03285 if (!conf->transframe[idx]) { 03286 conf->transframe[idx] = &ast_null_frame; 03287 } 03288 } 03289 } 03290 } 03291 if (conf->transframe[idx]) { 03292 if ((conf->transframe[idx]->frametype != AST_FRAME_NULL) && 03293 can_write(chan, confflags)) { 03294 struct ast_frame *cur; 03295 /* the translator may have returned a list of frames, so 03296 write each one onto the channel 03297 */ 03298 for (cur = conf->transframe[idx]; cur; cur = AST_LIST_NEXT(cur, frame_list)) { 03299 if (ast_write(chan, cur)) { 03300 ast_log(LOG_WARNING, "Unable to write frame to channel %s\n", chan->name); 03301 break; 03302 } 03303 } 03304 if (musiconhold && mohtempstopped && confsilence > MEETME_DELAYDETECTENDTALK) { 03305 mohtempstopped = 0; 03306 ast_moh_start(chan, NULL, NULL); 03307 } 03308 } 03309 } else { 03310 ast_mutex_unlock(&conf->listenlock); 03311 goto bailoutandtrynormal; 03312 } 03313 ast_mutex_unlock(&conf->listenlock); 03314 } else { 03315 bailoutandtrynormal: 03316 if (musiconhold && !ast_dsp_silence(dsp, &fr, &confsilence) && confsilence < MEETME_DELAYDETECTTALK) { 03317 ast_moh_stop(chan); 03318 mohtempstopped = 1; 03319 } 03320 if (user->listen.actual) { 03321 ast_frame_adjust_volume(&fr, user->listen.actual); 03322 } 03323 if (can_write(chan, confflags) && ast_write(chan, &fr) < 0) { 03324 ast_log(LOG_WARNING, "Unable to write frame to channel %s\n", chan->name); 03325 } 03326 if (musiconhold && mohtempstopped && confsilence > MEETME_DELAYDETECTENDTALK) { 03327 mohtempstopped = 0; 03328 ast_moh_start(chan, NULL, NULL); 03329 } 03330 } 03331 } else { 03332 ast_log(LOG_WARNING, "Failed to read frame: %s\n", strerror(errno)); 03333 } 03334 } 03335 lastmarked = currentmarked; 03336 } 03337 } 03338 03339 if (musiconhold) { 03340 ast_moh_stop(chan); 03341 } 03342 03343 if (using_pseudo) { 03344 close(fd); 03345 } else { 03346 /* Take out of conference */ 03347 dahdic.chan = 0; 03348 dahdic.confno = 0; 03349 dahdic.confmode = 0; 03350 if (ioctl(fd, DAHDI_SETCONF, &dahdic)) { 03351 ast_log(LOG_WARNING, "Error setting conference\n"); 03352 } 03353 } 03354 03355 reset_volumes(user); 03356 03357 if (!(confflags & CONFFLAG_QUIET) && !(confflags & CONFFLAG_MONITOR) && !(confflags & CONFFLAG_ADMIN)) { 03358 conf_play(chan, conf, LEAVE); 03359 } 03360 03361 if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW)) && conf->users > 1) { 03362 struct announce_listitem *item; 03363 if (!(item = ao2_alloc(sizeof(*item), NULL))) 03364 return -1; 03365 ast_copy_string(item->namerecloc, user->namerecloc, sizeof(item->namerecloc)); 03366 ast_copy_string(item->language, chan->language, sizeof(item->language)); 03367 item->confchan = conf->chan; 03368 item->confusers = conf->users; 03369 item->announcetype = CONF_HASLEFT; 03370 ast_mutex_lock(&conf->announcelistlock); 03371 AST_LIST_INSERT_TAIL(&conf->announcelist, item, entry); 03372 ast_cond_signal(&conf->announcelist_addition); 03373 ast_mutex_unlock(&conf->announcelistlock); 03374 } else if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW)) && conf->users == 1) { 03375 /* Last person is leaving, so no reason to try and announce, but should delete the name recording */ 03376 ast_filedelete(user->namerecloc, NULL); 03377 } 03378 03379 outrun: 03380 AST_LIST_LOCK(&confs); 03381 03382 if (dsp) { 03383 ast_dsp_free(dsp); 03384 } 03385 03386 if (!user->user_no) { 03387 ao2_ref(user, -1); 03388 } else { /* Only cleanup users who really joined! */ 03389 now = ast_tvnow(); 03390 hr = (now.tv_sec - user->jointime) / 3600; 03391 min = ((now.tv_sec - user->jointime) % 3600) / 60; 03392 sec = (now.tv_sec - user->jointime) % 60; 03393 03394 if (sent_event) { 03395 manager_event(EVENT_FLAG_CALL, "MeetmeLeave", 03396 "Channel: %s\r\n" 03397 "Uniqueid: %s\r\n" 03398 "Meetme: %s\r\n" 03399 "Usernum: %d\r\n" 03400 "CallerIDNum: %s\r\n" 03401 "CallerIDName: %s\r\n" 03402 "Duration: %ld\r\n", 03403 chan->name, chan->uniqueid, conf->confno, 03404 user->user_no, 03405 S_OR(user->chan->cid.cid_num, "<unknown>"), 03406 S_OR(user->chan->cid.cid_name, "<unknown>"), 03407 (long)(now.tv_sec - user->jointime)); 03408 } 03409 03410 if (setusercount) { 03411 conf->users--; 03412 if (rt_log_members) { 03413 /* Update table */ 03414 snprintf(members, sizeof(members), "%d", conf->users); 03415 ast_realtime_require_field("meetme", 03416 "confno", strlen(conf->confno) > 7 ? RQ_UINTEGER4 : strlen(conf->confno) > 4 ? RQ_UINTEGER3 : RQ_UINTEGER2, strlen(conf->confno), 03417 "members", RQ_UINTEGER1, strlen(members), 03418 NULL); 03419 ast_update_realtime("meetme", "confno", conf->confno, "members", members, NULL); 03420 } 03421 if (confflags & CONFFLAG_MARKEDUSER) { 03422 conf->markedusers--; 03423 } 03424 } 03425 /* Remove ourselves from the container */ 03426 ao2_unlink(conf->usercontainer, user); 03427 03428 /* Change any states */ 03429 if (!conf->users) { 03430 ast_devstate_changed(AST_DEVICE_NOT_INUSE, "meetme:%s", conf->confno); 03431 } 03432 03433 /* Return the number of seconds the user was in the conf */ 03434 snprintf(meetmesecs, sizeof(meetmesecs), "%d", (int) (time(NULL) - user->jointime)); 03435 pbx_builtin_setvar_helper(chan, "MEETMESECS", meetmesecs); 03436 03437 /* Return the RealTime bookid for CDR linking */ 03438 if (rt_schedule) { 03439 pbx_builtin_setvar_helper(chan, "MEETMEBOOKID", conf->bookid); 03440 } 03441 } 03442 AST_LIST_UNLOCK(&confs); 03443 03444 return ret; 03445 }
| static void conf_start_moh | ( | struct ast_channel * | chan, | |
| const char * | musicclass | |||
| ) | [static] |
Definition at line 1922 of file app_meetme.c.
References ast_channel_lock, ast_channel_unlock, ast_moh_start(), ast_strdupa, ast_string_field_set, and ast_channel::musicclass.
Referenced by conf_run().
01923 { 01924 char *original_moh; 01925 01926 ast_channel_lock(chan); 01927 original_moh = ast_strdupa(chan->musicclass); 01928 ast_string_field_set(chan, musicclass, musicclass); 01929 ast_channel_unlock(chan); 01930 01931 ast_moh_start(chan, original_moh, NULL); 01932 01933 ast_channel_lock(chan); 01934 ast_string_field_set(chan, musicclass, original_moh); 01935 ast_channel_unlock(chan); 01936 }
| static int count_exec | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
The MeetmeCount application.
Definition at line 3735 of file app_meetme.c.
References ast_channel::_state, ast_answer(), AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log(), ast_say_number(), AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_strdupa, ast_strlen_zero(), dispose_conf(), find_conf(), ast_channel::language, LOG_WARNING, pbx_builtin_setvar_helper(), and ast_conference::users.
Referenced by load_module().
03736 { 03737 int res = 0; 03738 struct ast_conference *conf; 03739 int count; 03740 char *localdata; 03741 char val[80] = "0"; 03742 AST_DECLARE_APP_ARGS(args, 03743 AST_APP_ARG(confno); 03744 AST_APP_ARG(varname); 03745 ); 03746 03747 if (ast_strlen_zero(data)) { 03748 ast_log(LOG_WARNING, "MeetMeCount requires an argument (conference number)\n"); 03749 return -1; 03750 } 03751 03752 if (!(localdata = ast_strdupa(data))) 03753 return -1; 03754 03755 AST_STANDARD_APP_ARGS(args, localdata); 03756 03757 conf = find_conf(chan, args.confno, 0, 0, NULL, 0, 1, NULL); 03758 03759 if (conf) { 03760 count = conf->users; 03761 dispose_conf(conf); 03762 conf = NULL; 03763 } else 03764 count = 0; 03765 03766 if (!ast_strlen_zero(args.varname)) { 03767 /* have var so load it and exit */ 03768 snprintf(val, sizeof(val), "%d", count); 03769 pbx_builtin_setvar_helper(chan, args.varname, val); 03770 } else { 03771 if (chan->_state != AST_STATE_UP) { 03772 ast_answer(chan); 03773 } 03774 res = ast_say_number(chan, count, "", chan->language, (char *) NULL); /* Needs gender */ 03775 } 03776 03777 return res; 03778 }
| static struct sla_trunk_ref* create_trunk_ref | ( | struct sla_trunk * | trunk | ) | [static, read] |
Definition at line 5945 of file app_meetme.c.
References ast_calloc, and sla_trunk_ref::trunk.
Referenced by sla_add_trunk_to_station().
05946 { 05947 struct sla_trunk_ref *trunk_ref; 05948 05949 if (!(trunk_ref = ast_calloc(1, sizeof(*trunk_ref)))) 05950 return NULL; 05951 05952 trunk_ref->trunk = trunk; 05953 05954 return trunk_ref; 05955 }
| static void destroy_station | ( | struct sla_station * | station | ) | [static] |
Definition at line 6155 of file app_meetme.c.
References ast_context_remove_extension(), ast_free, AST_LIST_REMOVE_HEAD, AST_LIST_TRAVERSE, AST_MAX_APP, AST_MAX_EXTENSION, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_string_field_free_memory, ast_strlen_zero(), sla_station::autocontext, exten, sla_trunk::name, sla_station::name, PRIORITY_HINT, sla_registrar, sla_trunk_ref::trunk, and sla_station::trunks.
Referenced by sla_build_station(), and sla_destroy().
06156 { 06157 struct sla_trunk_ref *trunk_ref; 06158 06159 if (!ast_strlen_zero(station->autocontext)) { 06160 AST_RWLIST_RDLOCK(&sla_trunks); 06161 AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) { 06162 char exten[AST_MAX_EXTENSION]; 06163 char hint[AST_MAX_APP]; 06164 snprintf(exten, sizeof(exten), "%s_%s", station->name, trunk_ref->trunk->name); 06165 snprintf(hint, sizeof(hint), "SLA:%s", exten); 06166 ast_context_remove_extension(station->autocontext, exten, 06167 1, sla_registrar); 06168 ast_context_remove_extension(station->autocontext, hint, 06169 PRIORITY_HINT, sla_registrar); 06170 } 06171 AST_RWLIST_UNLOCK(&sla_trunks); 06172 } 06173 06174 while ((trunk_ref = AST_LIST_REMOVE_HEAD(&station->trunks, entry))) 06175 ast_free(trunk_ref); 06176 06177 ast_string_field_free_memory(station); 06178 ast_free(station); 06179 }
| static void destroy_trunk | ( | struct sla_trunk * | trunk | ) | [static] |
Definition at line 6141 of file app_meetme.c.
References ast_context_remove_extension(), ast_free, AST_LIST_REMOVE_HEAD, ast_string_field_free_memory, ast_strlen_zero(), sla_trunk::autocontext, sla_registrar, and sla_trunk::stations.
Referenced by sla_build_trunk(), and sla_destroy().
06142 { 06143 struct sla_station_ref *station_ref; 06144 06145 if (!ast_strlen_zero(trunk->autocontext)) 06146 ast_context_remove_extension(trunk->autocontext, "s", 1, sla_registrar); 06147 06148 while ((station_ref = AST_LIST_REMOVE_HEAD(&trunk->stations, entry))) 06149 ast_free(station_ref); 06150 06151 ast_string_field_free_memory(trunk); 06152 ast_free(trunk); 06153 }
| static void* dial_trunk | ( | void * | data | ) | [static] |
Definition at line 5657 of file app_meetme.c.
References ALL_TRUNK_REFS, ast_cond_signal(), ast_dial_answered(), ast_dial_append(), ast_dial_create(), ast_dial_destroy(), ast_dial_join(), AST_DIAL_RESULT_ANSWERED, AST_DIAL_RESULT_FAILED, AST_DIAL_RESULT_HANGUP, AST_DIAL_RESULT_INVALID, AST_DIAL_RESULT_PROCEEDING, AST_DIAL_RESULT_PROGRESS, AST_DIAL_RESULT_RINGING, AST_DIAL_RESULT_TIMEOUT, AST_DIAL_RESULT_TRYING, AST_DIAL_RESULT_UNANSWERED, ast_dial_run(), ast_dial_state(), ast_free, ast_mutex_lock(), ast_mutex_unlock(), ast_set_flag, ast_strdup, ast_strdupa, ast_strlen_zero(), build_conf(), sla_trunk::chan, sla_trunk_ref::chan, ast_channel::cid, ast_callerid::cid_name, cid_name, ast_callerid::cid_num, cid_num, dial_trunk_args::cond, dial_trunk_args::cond_lock, conf_run(), CONFFLAG_MARKEDEXIT, CONFFLAG_MARKEDUSER, CONFFLAG_PASS_DTMF, CONFFLAG_QUIET, CONFFLAG_SLA_TRUNK, sla_trunk::device, dispose_conf(), ast_flags::flags, MAX_CONFNUM, sla_trunk::name, sla_trunk::on_hold, sla, sla_change_trunk_state(), SLA_TRUNK_STATE_IDLE, strsep(), sla_trunk_ref::trunk, and dial_trunk_args::trunk_ref.
Referenced by sla_station_exec().
05658 { 05659 struct dial_trunk_args *args = data; 05660 struct ast_dial *dial; 05661 char *tech, *tech_data; 05662 enum ast_dial_result dial_res; 05663 char conf_name[MAX_CONFNUM]; 05664 struct ast_conference *conf; 05665 struct ast_flags conf_flags = { 0 }; 05666 struct sla_trunk_ref *trunk_ref = args->trunk_ref; 05667 const char *cid_name = NULL, *cid_num = NULL; 05668 05669 if (!(dial = ast_dial_create())) { 05670 ast_mutex_lock(args->cond_lock); 05671 ast_cond_signal(args->cond); 05672 ast_mutex_unlock(args->cond_lock); 05673 return NULL; 05674 } 05675 05676 tech_data = ast_strdupa(trunk_ref->trunk->device); 05677 tech = strsep(&tech_data, "/"); 05678 if (ast_dial_append(dial, tech, tech_data) == -1) { 05679 ast_mutex_lock(args->cond_lock); 05680 ast_cond_signal(args->cond); 05681 ast_mutex_unlock(args->cond_lock); 05682 ast_dial_destroy(dial); 05683 return NULL; 05684 } 05685 05686 if (!sla.attempt_callerid && !ast_strlen_zero(trunk_ref->chan->cid.cid_name)) { 05687 cid_name = ast_strdupa(trunk_ref->chan->cid.cid_name); 05688 ast_free(trunk_ref->chan->cid.cid_name); 05689 trunk_ref->chan->cid.cid_name = NULL; 05690 } 05691 if (!sla.attempt_callerid && !ast_strlen_zero(trunk_ref->chan->cid.cid_num)) { 05692 cid_num = ast_strdupa(trunk_ref->chan->cid.cid_num); 05693 ast_free(trunk_ref->chan->cid.cid_num); 05694 trunk_ref->chan->cid.cid_num = NULL; 05695 } 05696 05697 dial_res = ast_dial_run(dial, trunk_ref->chan, 1); 05698 05699 if (cid_name) 05700 trunk_ref->chan->cid.cid_name = ast_strdup(cid_name); 05701 if (cid_num) 05702 trunk_ref->chan->cid.cid_num = ast_strdup(cid_num); 05703 05704 if (dial_res != AST_DIAL_RESULT_TRYING) { 05705 ast_mutex_lock(args->cond_lock); 05706 ast_cond_signal(args->cond); 05707 ast_mutex_unlock(args->cond_lock); 05708 ast_dial_destroy(dial); 05709 return NULL; 05710 } 05711 05712 for (;;) { 05713 unsigned int done = 0; 05714 switch ((dial_res = ast_dial_state(dial))) { 05715 case AST_DIAL_RESULT_ANSWERED: 05716 trunk_ref->trunk->chan = ast_dial_answered(dial); 05717 case AST_DIAL_RESULT_HANGUP: 05718 case AST_DIAL_RESULT_INVALID: 05719 case AST_DIAL_RESULT_FAILED: 05720 case AST_DIAL_RESULT_TIMEOUT: 05721 case AST_DIAL_RESULT_UNANSWERED: 05722 done = 1; 05723 case AST_DIAL_RESULT_TRYING: 05724 case AST_DIAL_RESULT_RINGING: 05725 case AST_DIAL_RESULT_PROGRESS: 05726 case AST_DIAL_RESULT_PROCEEDING: 05727 break; 05728 } 05729 if (done) 05730 break; 05731 } 05732 05733 if (!trunk_ref->trunk->chan) { 05734 ast_mutex_lock(args->cond_lock); 05735 ast_cond_signal(args->cond); 05736 ast_mutex_unlock(args->cond_lock); 05737 ast_dial_join(dial); 05738 ast_dial_destroy(dial); 05739 return NULL; 05740 } 05741 05742 snprintf(conf_name, sizeof(conf_name), "SLA_%s", trunk_ref->trunk->name); 05743 ast_set_flag(&conf_flags, 05744 CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_MARKEDUSER | 05745 CONFFLAG_PASS_DTMF | CONFFLAG_SLA_TRUNK); 05746 conf = build_conf(conf_name, "", "", 1, 1, 1, trunk_ref->trunk->chan); 05747 05748 ast_mutex_lock(args->cond_lock); 05749 ast_cond_signal(args->cond); 05750 ast_mutex_unlock(args->cond_lock); 05751 05752 if (conf) { 05753 conf_run(trunk_ref->trunk->chan, conf, conf_flags.flags, NULL); 05754 dispose_conf(conf); 05755 conf = NULL; 05756 } 05757 05758 /* If the trunk is going away, it is definitely now IDLE. */ 05759 sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL); 05760 05761 trunk_ref->trunk->chan = NULL; 05762 trunk_ref->trunk->on_hold = 0; 05763 05764 ast_dial_join(dial); 05765 ast_dial_destroy(dial); 05766 05767 return NULL; 05768 }
| static int dispose_conf | ( | struct ast_conference * | conf | ) | [static] |
Definition at line 1841 of file app_meetme.c.
References ast_atomic_dec_and_test(), AST_LIST_LOCK, AST_LIST_UNLOCK, conf_free(), conf_map, ast_conference::confno, and ast_conference::refcount.
Referenced by admin_exec(), conf_exec(), count_exec(), dial_trunk(), run_station(), sla_station_exec(), and sla_trunk_exec().
01842 { 01843 int res = 0; 01844 int confno_int = 0; 01845 01846 AST_LIST_LOCK(&confs); 01847 if (ast_atomic_dec_and_test(&conf->refcount)) { 01848 /* Take the conference room number out of an inuse state */ 01849 if ((sscanf(conf->confno, "%4d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024)) { 01850 conf_map[confno_int] = 0; 01851 } 01852 conf_free(conf); 01853 res = 1; 01854 } 01855 AST_LIST_UNLOCK(&confs); 01856 01857 return res; 01858 }
| 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, read] |
Definition at line 3631 of file app_meetme.c.
References AST_APP_ARG, ast_app_getdata(), ast_clear_flag, ast_config_destroy(), ast_config_load, ast_copy_string(), ast_debug, AST_DECLARE_APP_ARGS, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log(), AST_STANDARD_APP_ARGS, ast_test_flag, ast_variable_browse(), build_conf(), ast_conference::chan, CONFFLAG_INTROUSER, CONFFLAG_INTROUSERNOREVIEW, CONFFLAG_QUIET, CONFFLAG_RECORDCONF, CONFIG_FILE_NAME, CONFIG_STATUS_FILEINVALID, ast_conference::confno, ast_conference::list, LOG_ERROR, LOG_WARNING, MAX_SETTINGS, ast_variable::name, ast_variable::next, parse(), ast_conference::refcount, S_OR, ast_variable::value, and var.
Referenced by conf_exec(), and count_exec().
03633 { 03634 struct ast_config *cfg; 03635 struct ast_variable *var; 03636 struct ast_flags config_flags = { 0 }; 03637 struct ast_conference *cnf; 03638 03639 AST_DECLARE_APP_ARGS(args, 03640 AST_APP_ARG(confno); 03641 AST_APP_ARG(pin); 03642 AST_APP_ARG(pinadmin); 03643 ); 03644 03645 /* Check first in the conference list */ 03646 ast_debug(1, "The requested confno is '%s'?\n", confno); 03647 AST_LIST_LOCK(&confs); 03648 AST_LIST_TRAVERSE(&confs, cnf, list) { 03649 ast_debug(3, "Does conf %s match %s?\n", confno, cnf->confno); 03650 if (!strcmp(confno, cnf->confno)) 03651 break; 03652 } 03653 if (cnf) { 03654 cnf->refcount += refcount; 03655 } 03656 AST_LIST_UNLOCK(&confs); 03657 03658 if (!cnf) { 03659 if (dynamic) { 03660 /* No need to parse meetme.conf */ 03661 ast_debug(1, "Building dynamic conference '%s'\n", confno); 03662 if (dynamic_pin) { 03663 if (dynamic_pin[0] == 'q') { 03664 /* Query the user to enter a PIN */ 03665 if (ast_app_getdata(chan, "conf-getpin", dynamic_pin, pin_buf_len - 1, 0) < 0) 03666 return NULL; 03667 } 03668 cnf = build_conf(confno, dynamic_pin, "", make, dynamic, refcount, chan); 03669 } else { 03670 cnf = build_conf(confno, "", "", make, dynamic, refcount, chan); 03671 } 03672 } else { 03673 /* Check the config */ 03674 cfg = ast_config_load(CONFIG_FILE_NAME, config_flags); 03675 if (!cfg) { 03676 ast_log(LOG_WARNING, "No %s file :(\n", CONFIG_FILE_NAME); 03677 return NULL; 03678 } else if (cfg == CONFIG_STATUS_FILEINVALID) { 03679 ast_log(LOG_ERROR, "Config file " CONFIG_FILE_NAME " is in an invalid format. Aborting.\n"); 03680 return NULL; 03681 } 03682 03683 for (var = ast_variable_browse(cfg, "rooms"); var; var = var->next) { 03684 char parse[MAX_SETTINGS]; 03685 03686 if (strcasecmp(var->name, "conf")) 03687 continue; 03688 03689 ast_copy_string(parse, var->value, sizeof(parse)); 03690 03691 AST_STANDARD_APP_ARGS(args, parse); 03692 ast_debug(3, "Will conf %s match %s?\n", confno, args.confno); 03693 if (!strcasecmp(args.confno, confno)) { 03694 /* Bingo it's a valid conference */ 03695 cnf = build_conf(args.confno, 03696 S_OR(args.pin, ""), 03697 S_OR(args.pinadmin, ""), 03698 make, dynamic, refcount, chan); 03699 break; 03700 } 03701 } 03702 if (!var) { 03703 ast_debug(1, "%s isn't a valid conference\n", confno); 03704 } 03705 ast_config_destroy(cfg); 03706 } 03707 } else if (dynamic_pin) { 03708 /* Correct for the user selecting 'D' instead of 'd' to have 03709 someone join into a conference that has already been created 03710 with a pin. */ 03711 if (dynamic_pin[0] == 'q') { 03712 dynamic_pin[0] = '\0'; 03713 } 03714 } 03715 03716 if (cnf) { 03717 if (confflags && !cnf->chan && 03718 !ast_test_flag(confflags, CONFFLAG_QUIET) && 03719 ast_test_flag(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW)) { 03720 ast_log(LOG_WARNING, "No DAHDI channel available for conference, user introduction disabled (is chan_dahdi loaded?)\n"); 03721 ast_clear_flag(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW); 03722 } 03723 03724 if (confflags && !cnf->chan && 03725 ast_test_flag(confflags, CONFFLAG_RECORDCONF)) { 03726 ast_log(LOG_WARNING, "No DAHDI channel available for conference, conference recording disabled (is chan_dahdi loaded?)\n"); 03727 ast_clear_flag(confflags, CONFFLAG_RECORDCONF); 03728 } 03729 } 03730 03731 return cnf; 03732 }
| 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, | |||
| int * | too_early, | |||
| char ** | optargs | |||
| ) | [static, read] |
Definition at line 3447 of file app_meetme.c.
References ast_conference::adminopts, ast_app_parse_options(), ast_channel_lock, ast_channel_unlock, ast_clear_flag, ast_copy_flags, ast_copy_string(), ast_debug, ast_free, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_load_realtime(), ast_localtime(), ast_log(), AST_MAX_EXTENSION, ast_mktime(), ast_strdup, ast_strdupa, ast_streamfile(), ast_strftime(), ast_strlen_zero(), ast_strptime(), ast_test_flag, ast_tvnow(), ast_variables_destroy(), ast_verb, ast_waitstream(), ast_conference::bookid, build_conf(), ast_conference::chan, CONFFLAG_INTROUSER, CONFFLAG_INTROUSERNOREVIEW, CONFFLAG_QUIET, CONFFLAG_RECORDCONF, ast_conference::confno, DATE_FORMAT, ast_conference::endalert, ast_conference::endtime, ast_flags::flags, ast_channel::language, ast_conference::list, LOG_WARNING, ast_conference::maxusers, meetme_opts, ast_variable::name, ast_variable::next, OPTIONS_LEN, pbx_builtin_getvar_helper(), ast_conference::recordingfilename, ast_conference::recordingformat, ast_conference::refcount, ast_channel::uniqueid, ast_conference::useropts, ast_variable::value, and var.
Referenced by conf_exec().
03449 { 03450 struct ast_variable *var, *origvar; 03451 struct ast_conference *cnf; 03452 03453 *too_early = 0; 03454 03455 /* Check first in the conference list */ 03456 AST_LIST_LOCK(&confs); 03457 AST_LIST_TRAVERSE(&confs, cnf, list) { 03458 if (!strcmp(confno, cnf->confno)) { 03459 break; 03460 } 03461 } 03462 if (cnf) { 03463 cnf->refcount += refcount; 03464 } 03465 AST_LIST_UNLOCK(&confs); 03466 03467 if (!cnf) { 03468 char *pin = NULL, *pinadmin = NULL; /* For temp use */ 03469 int maxusers = 0; 03470 struct timeval now; 03471 char recordingfilename[256] = ""; 03472 char recordingformat[11] = ""; 03473 char currenttime[19] = ""; 03474 char eatime[19] = ""; 03475 char bookid[51] = ""; 03476 char recordingtmp[AST_MAX_EXTENSION] = ""; 03477 char useropts[OPTIONS_LEN + 1]; /* Used for RealTime conferences */ 03478 char adminopts[OPTIONS_LEN + 1]; 03479 struct ast_tm tm, etm; 03480 struct timeval endtime = { .tv_sec = 0 }; 03481 const char *var2; 03482 03483 if (rt_schedule) { 03484 now = ast_tvnow(); 03485 03486 ast_localtime(&now, &tm, NULL); 03487 ast_strftime(currenttime, sizeof(currenttime), DATE_FORMAT, &tm); 03488 03489 ast_debug(1, "Looking for conference %s that starts after %s\n", confno, eatime); 03490 03491 var = ast_load_realtime("meetme", "confno", 03492 confno, "starttime <= ", currenttime, "endtime >= ", 03493 currenttime, NULL); 03494 03495 if (!var && fuzzystart) { 03496 now = ast_tvnow(); 03497 now.tv_sec += fuzzystart; 03498 03499 ast_localtime(&now, &tm, NULL); 03500 ast_strftime(currenttime, sizeof(currenttime), DATE_FORMAT, &tm); 03501 var = ast_load_realtime("meetme", "confno", 03502 confno, "starttime <= ", currenttime, "endtime >= ", 03503 currenttime, NULL); 03504 } 03505 03506 if (!var && earlyalert) { 03507 now = ast_tvnow(); 03508 now.tv_sec += earlyalert; 03509 ast_localtime(&now, &etm, NULL); 03510 ast_strftime(eatime, sizeof(eatime), DATE_FORMAT, &etm); 03511 var = ast_load_realtime("meetme", "confno", 03512 confno, "starttime <= ", eatime, "endtime >= ", 03513 currenttime, NULL); 03514 if (var) { 03515 *too_early = 1; 03516 } 03517 } 03518 03519 } else { 03520 var = ast_load_realtime("meetme", "confno", confno, NULL); 03521 } 03522 03523 if (!var) { 03524 return NULL; 03525 } 03526 03527 if (rt_schedule && *too_early) { 03528 /* Announce that the caller is early and exit */ 03529 if (!ast_streamfile(chan, "conf-has-not-started", chan->language)) { 03530 ast_waitstream(chan, ""); 03531 } 03532 ast_variables_destroy(var); 03533 return NULL; 03534 } 03535 03536 for (origvar = var; var; var = var->next) { 03537 if (!strcasecmp(var->name, "pin")) { 03538 pin = ast_strdupa(var->value); 03539 } else if (!strcasecmp(var->name, "adminpin")) { 03540 pinadmin = ast_strdupa(var->value); 03541 } else if (!strcasecmp(var->name, "bookId")) { 03542 ast_copy_string(bookid, var->value, sizeof(bookid)); 03543 } else if (!strcasecmp(var->name, "opts")) { 03544 ast_copy_string(useropts, var->value, sizeof(char[OPTIONS_LEN + 1])); 03545 } else if (!strcasecmp(var->name, "maxusers")) { 03546 maxusers = atoi(var->value); 03547 } else if (!strcasecmp(var->name, "adminopts")) { 03548 ast_copy_string(adminopts, var->value, sizeof(char[OPTIONS_LEN + 1])); 03549 } else if (!strcasecmp(var->name, "recordingfilename")) { 03550 ast_copy_string(recordingfilename, var->value, sizeof(recordingfilename)); 03551 } else if (!strcasecmp(var->name, "recordingformat")) { 03552 ast_copy_string(recordingformat, var->value, sizeof(recordingformat)); 03553 } else if (!strcasecmp(var->name, "endtime")) { 03554 struct ast_tm endtime_tm; 03555 ast_strptime(var->value, "%Y-%m-%d %H:%M:%S", &endtime_tm); 03556 endtime = ast_mktime(&endtime_tm, NULL); 03557 } 03558 } 03559 03560 ast_variables_destroy(origvar); 03561 03562 cnf = build_conf(confno, pin ? pin : "", pinadmin ? pinadmin : "", make, dynamic, refcount, chan); 03563 03564 if (cnf) { 03565 struct ast_flags tmp_flags; 03566 03567 cnf->maxusers = maxusers; 03568 cnf->endalert = endalert; 03569 cnf->endtime = endtime.tv_sec; 03570 cnf->useropts = ast_strdup(useropts); 03571 cnf->adminopts = ast_strdup(adminopts); 03572 cnf->bookid = ast_strdup(bookid); 03573 cnf->recordingfilename = ast_strdup(recordingfilename); 03574 cnf->recordingformat = ast_strdup(recordingformat); 03575 03576 /* Parse the other options into confflags -- need to do this in two 03577 * steps, because the parse_options routine zeroes the buffer. */ 03578 ast_app_parse_options(meetme_opts, &tmp_flags, optargs, useropts); 03579 ast_copy_flags(confflags, &tmp_flags, tmp_flags.flags); 03580 03581 if (strchr(cnf->useropts, 'r')) { 03582 if (ast_strlen_zero(recordingfilename)) { /* If the recordingfilename in the database is empty, use the channel definition or use the default. */ 03583 ast_channel_lock(chan); 03584 if ((var2 = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFILE"))) { 03585 ast_free(cnf->recordingfilename); 03586 cnf->recordingfilename = ast_strdup(var2); 03587 } 03588 ast_channel_unlock(chan); 03589 if (ast_strlen_zero(cnf->recordingfilename)) { 03590 snprintf(recordingtmp, sizeof(recordingtmp), "meetme-conf-rec-%s-%s", cnf->confno, chan->uniqueid); 03591 ast_free(cnf->recordingfilename); 03592 cnf->recordingfilename = ast_strdup(recordingtmp); 03593 } 03594 } 03595 if (ast_strlen_zero(cnf->recordingformat)) {/* If the recording format is empty, use the wav as default */ 03596 ast_channel_lock(chan); 03597 if ((var2 = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFORMAT"))) { 03598 ast_free(cnf->recordingformat); 03599 cnf->recordingformat = ast_strdup(var2); 03600 } 03601 ast_channel_unlock(chan); 03602 if (ast_strlen_zero(cnf->recordingformat)) { 03603 ast_free(cnf->recordingformat); 03604 cnf->recordingformat = ast_strdup("wav"); 03605 } 03606 } 03607 ast_verb(4, "Starting recording of MeetMe Conference %s into file %s.%s.\n", cnf->confno, cnf->recordingfilename, cnf->recordingformat); 03608 } 03609 } 03610 } 03611 03612 if (cnf) { 03613 if (confflags && !cnf->chan && 03614 !ast_test_flag(confflags, CONFFLAG_QUIET) && 03615 ast_test_flag(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW)) { 03616 ast_log(LOG_WARNING, "No DAHDI channel available for conference, user introduction disabled (is chan_dahdi loaded?)\n"); 03617 ast_clear_flag(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW); 03618 } 03619 03620 if (confflags && !cnf->chan && 03621 ast_test_flag(confflags, CONFFLAG_RECORDCONF)) { 03622 ast_log(LOG_WARNING, "No DAHDI channel available for conference, conference recording disabled (is chan_dahdi loaded?)\n"); 03623 ast_clear_flag(confflags, CONFFLAG_RECORDCONF); 03624 } 03625 } 03626 03627 return cnf; 03628 }
| static struct ast_conf_user* find_user | ( | struct ast_conference * | conf, | |
| char * | callerident | |||
| ) | [static, read] |
Definition at line 4086 of file app_meetme.c.
References ao2_find, and ast_conference::usercontainer.
Referenced by admin_exec().
04087 { 04088 struct ast_conf_user *user = NULL; 04089 int cid; 04090 04091 sscanf(callerident, "%30i", &cid); 04092 if (conf && callerident) { 04093 user = ao2_find(conf->usercontainer, &cid, 0); 04094 /* reference decremented later in admin_exec */ 04095 return user; 04096 } 04097 return NULL; 04098 }
| static const char* get_announce_filename | ( | enum announcetypes | type | ) | [static] |
Definition at line 1938 of file app_meetme.c.
References CONF_HASJOIN, and CONF_HASLEFT.
Referenced by announce_thread().
01939 { 01940 switch (type) { 01941 case CONF_HASLEFT: 01942 return "conf-hasleft"; 01943 break; 01944 case CONF_HASJOIN: 01945 return "conf-hasjoin"; 01946 break; 01947 default: 01948 return ""; 01949 } 01950 }
| static char* istalking | ( | int | x | ) | [static] |
Definition at line 885 of file app_meetme.c.
Referenced by meetme_show_cmd().
00886 { 00887 if (x > 0) 00888 return "(talking)"; 00889 else if (x < 0) 00890 return "(unmonitored)"; 00891 else 00892 return "(not talking)"; 00893 }
| static int load_config | ( | int | reload | ) | [static] |
Definition at line 6606 of file app_meetme.c.
References ast_log(), AST_PTHREADT_NULL, load_config_meetme(), LOG_NOTICE, sla, SLA_EVENT_RELOAD, sla_load_config(), and sla_queue_event().
Referenced by load_module(), and reload().
06607 { 06608 load_config_meetme(); 06609 06610 if (reload && sla.thread != AST_PTHREADT_NULL) { 06611 sla_queue_event(SLA_EVENT_RELOAD); 06612 ast_log(LOG_NOTICE, "A reload of the SLA configuration has been requested " 06613 "and will be completed when the system is idle.\n"); 06614 return 0; 06615 } 06616 06617 return sla_load_config(0); 06618 }
| static void load_config_meetme | ( | void | ) | [static] |
Definition at line 4615 of file app_meetme.c.
References ast_config_destroy(), ast_config_load, ast_log(), ast_true(), ast_variable_retrieve(), CONFIG_FILE_NAME, CONFIG_STATUS_FILEINVALID, DEFAULT_AUDIO_BUFFERS, LOG_ERROR, LOG_NOTICE, and LOG_WARNING.
Referenced by load_config().
04616 { 04617 struct ast_config *cfg; 04618 struct ast_flags config_flags = { 0 }; 04619 const char *val; 04620 04621 if (!(cfg = ast_config_load(CONFIG_FILE_NAME, config_flags))) { 04622 return; 04623 } else if (cfg == CONFIG_STATUS_FILEINVALID) { 04624 ast_log(LOG_ERROR, "Config file " CONFIG_FILE_NAME " is in an invalid format. Aborting.\n"); 04625 return; 04626 } 04627 04628 audio_buffers = DEFAULT_AUDIO_BUFFERS; 04629 04630 /* Scheduling support is off by default */ 04631 rt_schedule = 0; 04632 fuzzystart = 0; 04633 earlyalert = 0; 04634 endalert = 0; 04635 extendby = 0; 04636 04637 /* Logging of participants defaults to ON for compatibility reasons */ 04638 rt_log_members = 1; 04639 04640 if ((val = ast_variable_retrieve(cfg, "general", "audiobuffers"))) { 04641 if ((sscanf(val, "%30d", &audio_buffers) != 1)) { 04642 ast_log(LOG_WARNING, "audiobuffers setting must be a number, not '%s'\n", val); 04643 audio_buffers = DEFAULT_AUDIO_BUFFERS; 04644 } else if ((audio_buffers < DAHDI_DEFAULT_NUM_BUFS) || (audio_buffers > DAHDI_MAX_NUM_BUFS)) { 04645 ast_log(LOG_WARNING, "audiobuffers setting must be between %d and %d\n", 04646 DAHDI_DEFAULT_NUM_BUFS, DAHDI_MAX_NUM_BUFS); 04647 audio_buffers = DEFAULT_AUDIO_BUFFERS; 04648 } 04649 if (audio_buffers != DEFAULT_AUDIO_BUFFERS) 04650 ast_log(LOG_NOTICE, "Audio buffers per channel set to %d\n", audio_buffers); 04651 } 04652 04653 if ((val = ast_variable_retrieve(cfg, "general", "schedule"))) 04654 rt_schedule = ast_true(val); 04655 if ((val = ast_variable_retrieve(cfg, "general", "logmembercount"))) 04656 rt_log_members = ast_true(val); 04657 if ((val = ast_variable_retrieve(cfg, "general", "fuzzystart"))) { 04658 if ((sscanf(val, "%30d", &fuzzystart) != 1)) { 04659 ast_log(LOG_WARNING, "fuzzystart must be a number, not '%s'\n", val); 04660 fuzzystart = 0; 04661 } 04662 } 04663 if ((val = ast_variable_retrieve(cfg, "general", "earlyalert"))) { 04664 if ((sscanf(val, "%30d", &earlyalert) != 1)) { 04665 ast_log(LOG_WARNING, "earlyalert must be a number, not '%s'\n", val); 04666 earlyalert = 0; 04667 } 04668 } 04669 if ((val = ast_variable_retrieve(cfg, "general", "endalert"))) { 04670 if ((sscanf(val, "%30d", &endalert) != 1)) { 04671 ast_log(LOG_WARNING, "endalert must be a number, not '%s'\n", val); 04672 endalert = 0; 04673 } 04674 } 04675 if ((val = ast_variable_retrieve(cfg, "general", "extendby"))) { 04676 if ((sscanf(val, "%30d", &extendby) != 1)) { 04677 ast_log(LOG_WARNING, "extendby must be a number, not '%s'\n", val); 04678 extendby = 0; 04679 } 04680 } 04681 04682 ast_config_destroy(cfg); 04683 }
| static int load_module | ( | void | ) | [static] |
Definition at line 6646 of file app_meetme.c.
References action_meetmelist(), action_meetmemute(), action_meetmeunmute(), admin_exec(), ARRAY_LEN, ast_cli_register_multiple(), ast_custom_function_register, ast_devstate_prov_add(), ast_manager_register, ast_manager_register2(), ast_realtime_require_field(), ast_register_application_xml, channel_admin_exec(), conf_exec(), count_exec(), EVENT_FLAG_CALL, EVENT_FLAG_REPORTING, load_config(), meetmestate(), RQ_UINTEGER1, RQ_UINTEGER2, sla_state(), sla_station_exec(), and sla_trunk_exec().
06647 { 06648 int res = 0; 06649 06650 res |= load_config(0); 06651 06652 ast_cli_register_multiple(cli_meetme, ARRAY_LEN(cli_meetme)); 06653 res |= ast_manager_register("MeetmeMute", EVENT_FLAG_CALL, 06654 action_meetmemute, "Mute a Meetme user"); 06655 res |= ast_manager_register("MeetmeUnmute", EVENT_FLAG_CALL, 06656 action_meetmeunmute, "Unmute a Meetme user"); 06657 res |= ast_manager_register2("MeetmeList", EVENT_FLAG_REPORTING, 06658 action_meetmelist, "List participants in a conference", mandescr_meetmelist); 06659 res |= ast_register_application_xml(app4, channel_admin_exec); 06660 res |= ast_register_application_xml(app3, admin_exec); 06661 res |= ast_register_application_xml(app2, count_exec); 06662 res |= ast_register_application_xml(app, conf_exec); 06663 res |= ast_register_application_xml(slastation_app, sla_station_exec); 06664 res |= ast_register_application_xml(slatrunk_app, sla_trunk_exec); 06665 06666 res |= ast_devstate_prov_add("Meetme", meetmestate); 06667 res |= ast_devstate_prov_add("SLA", sla_state); 06668 06669 res |= ast_custom_function_register(&meetme_info_acf); 06670 ast_realtime_require_field("meetme", "confno", RQ_UINTEGER2, 3, "members", RQ_UINTEGER1, 3, NULL); 06671 06672 return res; 06673 }
| static char* meetme_cmd | ( | struct ast_cli_entry * | e, | |
| int | cmd, | |||
| struct ast_cli_args * | a | |||
| ) | [static] |
Definition at line 1399 of file app_meetme.c.
References admin_exec(), ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_debug, ast_free, ast_str_append(), ast_str_buffer(), ast_str_create(), ast_str_set(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_meetmecmd(), ast_cli_args::fd, ast_cli_args::line, MAX_CONFNUM, ast_cli_args::n, ast_cli_args::pos, ast_cli_entry::usage, and ast_cli_args::word.
01400 { 01401 /* Process the command */ 01402 struct ast_str *cmdline = NULL; 01403 int i = 0; 01404 01405 switch (cmd) { 01406 case CLI_INIT: 01407 e->command = "meetme {lock|unlock|mute|unmute|kick}"; 01408 e->usage = 01409 "Usage: meetme (un)lock|(un)mute|kick <confno> <usernumber>\n" 01410 " Executes a command for the conference or on a conferee\n"; 01411 return NULL; 01412 case CLI_GENERATE: 01413 return complete_meetmecmd(a->line, a->word, a->pos, a->n); 01414 } 01415 01416 if (a->argc > 8) 01417 ast_cli(a->fd, "Invalid Arguments.\n"); 01418 /* Check for length so no buffer will overflow... */ 01419 for (i = 0; i < a->argc; i++) { 01420 if (strlen(a->argv[i]) > 100) 01421 ast_cli(a->fd, "Invalid Arguments.\n"); 01422 } 01423 01424 /* Max confno length */ 01425 if (!(cmdline = ast_str_create(MAX_CONFNUM))) { 01426 return CLI_FAILURE; 01427 } 01428 01429 if (a->argc < 1) { 01430 ast_free(cmdline); 01431 return CLI_SHOWUSAGE; 01432 } 01433 01434 ast_str_set(&cmdline, 0, "%s", a->argv[2]); /* Argv 2: conference number */ 01435 if (strstr(a->argv[1], "lock")) { 01436 if (strcmp(a->argv[1], "lock") == 0) { 01437 /* Lock */ 01438 ast_str_append(&cmdline, 0, ",L"); 01439 } else { 01440 /* Unlock */ 01441 ast_str_append(&cmdline, 0, ",l"); 01442 } 01443 } else if (strstr(a->argv[1], "mute")) { 01444 if (a->argc < 4) { 01445 ast_free(cmdline); 01446 return CLI_SHOWUSAGE; 01447 } 01448 if (strcmp(a->argv[1], "mute") == 0) { 01449 /* Mute */ 01450 if (strcmp(a->argv[3], "all") == 0) { 01451 ast_str_append(&cmdline, 0, ",N"); 01452 } else { 01453 ast_str_append(&cmdline, 0, ",M,%s", a->argv[3]); 01454 } 01455 } else { 01456 /* Unmute */ 01457 if (strcmp(a->argv[3], "all") == 0) { 01458 ast_str_append(&cmdline, 0, ",n"); 01459 } else { 01460 ast_str_append(&cmdline, 0, ",m,%s", a->argv[3]); 01461 } 01462 } 01463 } else if (strcmp(a->argv[1], "kick") == 0) { 01464 if (a->argc < 4) { 01465 ast_free(cmdline); 01466 return CLI_SHOWUSAGE; 01467 } 01468 if (strcmp(a->argv[3], "all") == 0) { 01469 /* Kick all */ 01470 ast_str_append(&cmdline, 0, ",K"); 01471 } else { 01472 /* Kick a single user */ 01473 ast_str_append(&cmdline, 0, ",k,%s", a->argv[3]); 01474 } 01475 } else { 01476 ast_free(cmdline); 01477 return CLI_SHOWUSAGE; 01478 } 01479 01480 ast_debug(1, "Cmdline: %s\n", ast_str_buffer(cmdline)); 01481 01482 admin_exec(NULL, ast_str_buffer(cmdline)); 01483 ast_free(cmdline); 01484 01485 return CLI_SUCCESS; 01486 }
| static char* meetme_show_cmd | ( | struct ast_cli_entry * | e, | |
| int | cmd, | |||
| struct ast_cli_args * | a | |||
| ) | [static] |
Definition at line 1241 of file app_meetme.c.
References admin_exec(), ADMINFLAG_MUTED, ADMINFLAG_SELFMUTED, ADMINFLAG_T_REQUEST, ast_conf_user::adminflags, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_debug, ast_free, AST_LIST_EMPTY, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_str_buffer(), ast_str_create(), ast_str_set(), ast_conf_user::chan, ast_channel::cid, ast_callerid::cid_name, ast_callerid::cid_num, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_meetmecmd(), CONFFLAG_ADMIN, CONFFLAG_MONITOR, ast_conference::confno, ast_cli_args::fd, ast_conference::isdynamic, istalking(), ast_conf_user::jointime, ast_cli_args::line, ast_conference::locked, ast_conference::markedusers, MAX_CONFNUM, MC_DATA_FORMAT, MC_HEADER_FORMAT, ast_cli_args::n, ast_channel::name, ast_cli_args::pos, S_OR, sec, ast_conference::start, ast_conf_user::talking, total, ast_cli_entry::usage, ast_conf_user::user_no, ast_conference::usercontainer, ast_conf_user::userflags, ast_conference::users, and ast_cli_args::word.
01242 { 01243 /* Process the command */ 01244 struct ast_conf_user *user; 01245 struct ast_conference *cnf; 01246 int hr, min, sec; 01247 int i = 0, total = 0; 01248 time_t now; 01249 struct ast_str *cmdline = NULL; 01250 #define MC_HEADER_FORMAT "%-14s %-14s %-10s %-8s %-8s %-6s\n" 01251 #define MC_DATA_FORMAT "%-12.12s %4.4d %4.4s %02d:%02d:%02d %-8s %-6s\n" 01252 01253 switch (cmd) { 01254 case CLI_INIT: 01255 e->command = "meetme list [concise]"; 01256 e->usage = 01257 "Usage: meetme list [concise] <confno> \n" 01258 " List all or a specific conference.\n"; 01259 return NULL; 01260 case CLI_GENERATE: 01261 return complete_meetmecmd(a->line, a->word, a->pos, a->n); 01262 } 01263 01264 /* Check for length so no buffer will overflow... */ 01265 for (i = 0; i < a->argc; i++) { 01266 if (strlen(a->argv[i]) > 100) 01267 ast_cli(a->fd, "Invalid Arguments.\n"); 01268 } 01269 01270 /* Max confno length */ 01271 if (!(cmdline = ast_str_create(MAX_CONFNUM))) { 01272 return CLI_FAILURE; 01273 } 01274 01275 if (a->argc == 2 || (a->argc == 3 && !strcasecmp(a->argv[2], "concise"))) { 01276 /* List all the conferences */ 01277 int concise = (a->argc == 3 && !strcasecmp(a->argv[2], "concise")); 01278 now = time(NULL); 01279 AST_LIST_LOCK(&confs); 01280 if (AST_LIST_EMPTY(&confs)) { 01281 if (!concise) { 01282 ast_cli(a->fd, "No active MeetMe conferences.\n"); 01283 } 01284 AST_LIST_UNLOCK(&confs); 01285 ast_free(cmdline); 01286 return CLI_SUCCESS; 01287 } 01288 if (!concise) { 01289 ast_cli(a->fd, MC_HEADER_FORMAT, "Conf Num", "Parties", "Marked", "Activity", "Creation", "Locked"); 01290 } 01291 AST_LIST_TRAVERSE(&confs, cnf, list) { 01292 if (cnf->markedusers == 0) { 01293 ast_str_set(&cmdline, 0, "N/A "); 01294 } else { 01295 ast_str_set(&cmdline, 0, "%4.4d", cnf->markedusers); 01296 } 01297 hr = (now - cnf->start) / 3600; 01298 min = ((now - cnf->start) % 3600) / 60; 01299 sec = (now - cnf->start) % 60; 01300 if (!concise) { 01301 ast_cli(a->fd, MC_DATA_FORMAT, cnf->confno, cnf->users, ast_str_buffer(cmdline), hr, min, sec, cnf->isdynamic ? "Dynamic" : "Static", cnf->locked ? "Yes" : "No"); 01302 } else { 01303 ast_cli(a->fd, "%s!%d!%d!%02d:%02d:%02d!%d!%d\n", 01304 cnf->confno, 01305 cnf->users, 01306 cnf->markedusers, 01307 hr, min, sec, 01308 cnf->isdynamic, 01309 cnf->locked); 01310 } 01311 01312 total += cnf->users; 01313 } 01314 AST_LIST_UNLOCK(&confs); 01315 if (!concise) { 01316 ast_cli(a->fd, "* Total number of MeetMe users: %d\n", total); 01317 } 01318 ast_free(cmdline); 01319 return CLI_SUCCESS; 01320 } else if (strcmp(a->argv[1], "list") == 0) { 01321 struct ao2_iterator user_iter; 01322 int concise = (a->argc == 4 && (!strcasecmp(a->argv[3], "concise"))); 01323 /* List all the users in a conference */ 01324 if (AST_LIST_EMPTY(&confs)) { 01325 if (!concise) { 01326 ast_cli(a->fd, "No active MeetMe conferences.\n"); 01327 } 01328 ast_free(cmdline); 01329 return CLI_SUCCESS; 01330 } 01331 /* Find the right conference */ 01332 AST_LIST_LOCK(&confs); 01333 AST_LIST_TRAVERSE(&confs, cnf, list) { 01334 if (strcmp(cnf->confno, a->argv[2]) == 0) { 01335 break; 01336 } 01337 } 01338 if (!cnf) { 01339 if (!concise) 01340 ast_cli(a->fd, "No such conference: %s.\n", a->argv[2]); 01341 AST_LIST_UNLOCK(&confs); 01342 ast_free(cmdline); 01343 return CLI_SUCCESS; 01344 } 01345 /* Show all the users */ 01346 time(&now); 01347 user_iter = ao2_iterator_init(cnf->usercontainer, 0); 01348 while((user = ao2_iterator_next(&user_iter))) { 01349 hr = (now - user->jointime) / 3600; 01350 min = ((now - user->jointime) % 3600) / 60; 01351 sec = (now - user->jointime) % 60; 01352 if (!concise) { 01353 ast_cli(a->fd, "User #: %-2.2d %12.12s %-20.20s Channel: %s %s %s %s %s %s %02d:%02d:%02d\n", 01354 user->user_no, 01355 S_OR(user->chan->cid.cid_num, "<unknown>"), 01356 S_OR(user->chan->cid.cid_name, "<no name>"), 01357 user->chan->name, 01358 user->userflags & CONFFLAG_ADMIN ? "(Admin)" : "", 01359 user->userflags & CONFFLAG_MONITOR ? "(Listen only)" : "", 01360 user->adminflags & ADMINFLAG_MUTED ? "(Admin Muted)" : user->adminflags & ADMINFLAG_SELFMUTED ? "(Muted)" : "", 01361 user->adminflags & ADMINFLAG_T_REQUEST ? "(Request to Talk)" : "", 01362 istalking(user->talking), hr, min, sec); 01363 } else { 01364 ast_cli(a->fd, "%d!%s!%s!%s!%s!%s!%s!%s!%d!%02d:%02d:%02d\n", 01365 user->user_no, 01366 S_OR(user->chan->cid.cid_num, ""), 01367 S_OR(user->chan->cid.cid_name, ""), 01368 user->chan->name, 01369 user->userflags & CONFFLAG_ADMIN ? "1" : "", 01370 user->userflags & CONFFLAG_MONITOR ? "1" : "", 01371 user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED) ? "1" : "", 01372 user->adminflags & ADMINFLAG_T_REQUEST ? "1" : "", 01373 user->talking, hr, min, sec); 01374 } 01375 ao2_ref(user, -1); 01376 } 01377 ao2_iterator_destroy(&user_iter); 01378 if (!concise) { 01379 ast_cli(a->fd, "%d users in that conference.\n", cnf->users); 01380 } 01381 AST_LIST_UNLOCK(&confs); 01382 ast_free(cmdline); 01383 return CLI_SUCCESS; 01384 } 01385 if (a->argc < 2) { 01386 ast_free(cmdline); 01387 return CLI_SHOWUSAGE; 01388 } 01389 01390 ast_debug(1, "Cmdline: %s\n", ast_str_buffer(cmdline)); 01391 01392 admin_exec(NULL, ast_str_buffer(cmdline)); 01393 ast_free(cmdline); 01394 01395 return CLI_SUCCESS; 01396 }
| static int meetmemute | ( | struct mansession * | s, | |
| const struct message * | m, | |||
| int | mute | |||
| ) | [static] |
Definition at line 4379 of file app_meetme.c.
References ADMINFLAG_MUTED, ADMINFLAG_SELFMUTED, ADMINFLAG_T_REQUEST, ast_conf_user::adminflags, ao2_find, ao2_ref, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log(), ast_strdupa, ast_strlen_zero(), astman_get_header(), astman_send_ack(), astman_send_error(), ast_conf_user::chan, ast_conference::confno, ast_conf_user::list, LOG_NOTICE, ast_channel::name, ast_channel::uniqueid, ast_conf_user::user_no, and ast_conference::usercontainer.
Referenced by action_meetmemute(), and action_meetmeunmute().
04380 { 04381 struct ast_conference *conf; 04382 struct ast_conf_user *user; 04383 const char *confid = astman_get_header(m, "Meetme"); 04384 char *userid = ast_strdupa(astman_get_header(m, "Usernum")); 04385 int userno; 04386 04387 if (ast_strlen_zero(confid)) { 04388 astman_send_error(s, m, "Meetme conference not specified"); 04389 return 0; 04390 } 04391 04392 if (ast_strlen_zero(userid)) { 04393 astman_send_error(s, m, "Meetme user number not specified"); 04394 return 0; 04395 } 04396 04397 userno = strtoul(userid, &userid, 10); 04398 04399 if (*userid) { 04400 astman_send_error(s, m, "Invalid user number"); 04401 return 0; 04402 } 04403 04404 /* Look in the conference list */ 04405 AST_LIST_LOCK(&confs); 04406 AST_LIST_TRAVERSE(&confs, conf, list) { 04407 if (!strcmp(confid, conf->confno)) 04408 break; 04409 } 04410 04411 if (!conf) { 04412 AST_LIST_UNLOCK(&confs); 04413 astman_send_error(s, m, "Meetme conference does not exist"); 04414 return 0; 04415 } 04416 04417 user = ao2_find(conf->usercontainer, &userno, 0); 04418 04419 if (!user) { 04420 AST_LIST_UNLOCK(&confs); 04421 astman_send_error(s, m, "User number not found"); 04422 return 0; 04423 } 04424 04425 if (mute) 04426 user->adminflags |= ADMINFLAG_MUTED; /* request user muting */ 04427 else 04428 user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED | ADMINFLAG_T_REQUEST); /* request user unmuting */ 04429 04430 AST_LIST_UNLOCK(&confs); 04431 04432 ast_log(LOG_NOTICE, "Requested to %smute conf %s user %d userchan %s uniqueid %s\n", mute ? "" : "un", conf->confno, user->user_no, user->chan->name, user->chan->uniqueid); 04433 04434 ao2_ref(user, -1); 04435 astman_send_ack(s, m, mute ? "User muted" : "User unmuted"); 04436 return 0; 04437 }
| static enum ast_device_state meetmestate | ( | const char * | data | ) | [static] |
Callback for devicestate providers.
Definition at line 4593 of file app_meetme.c.
References AST_DEVICE_INUSE, AST_DEVICE_INVALID, AST_DEVICE_NOT_INUSE, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_conference::confno, ast_conference::list, and ast_conference::users.
Referenced by load_module().
04594 { 04595 struct ast_conference *conf; 04596 04597 /* Find conference */ 04598 AST_LIST_LOCK(&confs); 04599 AST_LIST_TRAVERSE(&confs, conf, list) { 04600 if (!strcmp(data, conf->confno)) 04601 break; 04602 } 04603 AST_LIST_UNLOCK(&confs); 04604 if (!conf) 04605 return AST_DEVICE_INVALID; 04606 04607 04608 /* SKREP to fill */ 04609 if (!conf->users) 04610 return AST_DEVICE_NOT_INUSE; 04611 04612 return AST_DEVICE_INUSE; 04613 }
| static struct sla_ringing_trunk* queue_ringing_trunk | ( | struct sla_trunk * | trunk | ) | [static, read] |
Definition at line 5957 of file app_meetme.c.
References ALL_TRUNK_REFS, ast_calloc, AST_LIST_INSERT_HEAD, ast_mutex_lock(), ast_mutex_unlock(), ast_tvnow(), sla_ringing_trunk::ring_begin, sla, sla_change_trunk_state(), SLA_EVENT_RINGING_TRUNK, sla_queue_event(), SLA_TRUNK_STATE_RINGING, and sla_ringing_trunk::trunk.
Referenced by sla_trunk_exec().
05958 { 05959 struct sla_ringing_trunk *ringing_trunk; 05960 05961 if (!(ringing_trunk = ast_calloc(1, sizeof(*ringing_trunk)))) 05962 return NULL; 05963 05964 ringing_trunk->trunk = trunk; 05965 ringing_trunk->ring_begin = ast_tvnow(); 05966 05967 sla_change_trunk_state(trunk, SLA_TRUNK_STATE_RINGING, ALL_TRUNK_REFS, NULL); 05968 05969 ast_mutex_lock(&sla.lock); 05970 AST_LIST_INSERT_HEAD(&sla.ringing_trunks, ringing_trunk, entry); 05971 ast_mutex_unlock(&sla.lock); 05972 05973 sla_queue_event(SLA_EVENT_RINGING_TRUNK); 05974 05975 return ringing_trunk; 05976 }
| static void * recordthread | ( | void * | args | ) | [static] |
Definition at line 4528 of file app_meetme.c.
References ast_closestream(), AST_FILE_MODE, AST_FRAME_BITS, AST_FRAME_VOICE, ast_frdup(), ast_frfree, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_mutex_lock(), ast_mutex_unlock(), ast_read(), ast_stopstream(), ast_waitfor(), ast_writefile(), ast_writestream(), f, ast_frame::flags, ast_frame::frametype, ast_conference::lchan, ast_conference::listenlock, MEETME_RECORD_ACTIVE, MEETME_RECORD_OFF, MEETME_RECORD_TERMINATE, ast_conference::origframe, ast_conference::recordingfilename, ast_conference::recordingformat, s, and ast_conference::transframe.
04529 { 04530 struct ast_conference *cnf = args; 04531 struct ast_frame *f = NULL; 04532 int flags; 04533 struct ast_filestream *s = NULL; 04534 int res = 0; 04535 int x; 04536 const char *oldrecordingfilename = NULL; 04537 04538 if (!cnf || !cnf->lchan) { 04539 pthread_exit(0); 04540 } 04541 04542 ast_stopstream(cnf->lchan); 04543 flags = O_CREAT | O_TRUNC | O_WRONLY; 04544 04545 04546 cnf->recording = MEETME_RECORD_ACTIVE; 04547 while (ast_waitfor(cnf->lchan, -1) > -1) { 04548 if (cnf->recording == MEETME_RECORD_TERMINATE) { 04549 AST_LIST_LOCK(&confs); 04550 AST_LIST_UNLOCK(&confs); 04551 break; 04552 } 04553 if (!s && cnf->recordingfilename && (cnf->recordingfilename != oldrecordingfilename)) { 04554 s = ast_writefile(cnf->recordingfilename, cnf->recordingformat, NULL, flags, 0, AST_FILE_MODE); 04555 oldrecordingfilename = cnf->recordingfilename; 04556 } 04557 04558 f = ast_read(cnf->lchan); 04559 if (!f) { 04560 res = -1; 04561 break; 04562 } 04563 if (f->frametype == AST_FRAME_VOICE) { 04564 ast_mutex_lock(&cnf->listenlock); 04565 for (x = 0; x < AST_FRAME_BITS; x++) { 04566 /* Free any translations that have occured */ 04567 if (cnf->transframe[x]) { 04568 ast_frfree(cnf->transframe[x]); 04569 cnf->transframe[x] = NULL; 04570 } 04571 } 04572 if (cnf->origframe) 04573 ast_frfree(cnf->origframe); 04574 cnf->origframe = ast_frdup(f); 04575 ast_mutex_unlock(&cnf->listenlock); 04576 if (s) 04577 res = ast_writestream(s, f); 04578 if (res) { 04579 ast_frfree(f); 04580 break; 04581 } 04582 } 04583 ast_frfree(f); 04584 } 04585 cnf->recording = MEETME_RECORD_OFF; 04586 if (s) 04587 ast_closestream(s); 04588 04589 pthread_exit(0); 04590 }
| static int reload | ( | void | ) | [static] |
Definition at line 6675 of file app_meetme.c.
References ast_unload_realtime(), and load_config().
06676 { 06677 ast_unload_realtime("meetme"); 06678 return load_config(1); 06679 }
| static void reset_volumes | ( | struct ast_conf_user * | user | ) | [static] |
Definition at line 1005 of file app_meetme.c.
References ast_channel_setoption(), AST_OPTION_RXGAIN, AST_OPTION_TXGAIN, and ast_conf_user::chan.
Referenced by admin_exec(), conf_run(), and user_reset_vol_cb().
01006 { 01007 signed char zero_volume = 0; 01008 01009 ast_channel_setoption(user->chan, AST_OPTION_TXGAIN, &zero_volume, sizeof(zero_volume), 0); 01010 ast_channel_setoption(user->chan, AST_OPTION_RXGAIN, &zero_volume, sizeof(zero_volume), 0); 01011 }
| static int rt_extend_conf | ( | char * | confno | ) | [static] |
Definition at line 1860 of file app_meetme.c.
References ast_copy_string(), ast_debug, ast_load_realtime(), ast_localtime(), ast_mktime(), ast_strftime(), ast_strptime(), ast_tvnow(), ast_update_realtime(), ast_variables_destroy(), DATE_FORMAT, ast_variable::name, ast_variable::next, ast_variable::value, and var.
Referenced by admin_exec(), and conf_run().
01861 { 01862 char currenttime[32]; 01863 char endtime[32]; 01864 struct timeval now; 01865 struct ast_tm tm; 01866 struct ast_variable *var, *orig_var; 01867 char bookid[51]; 01868 01869 if (!extendby) { 01870 return 0; 01871 } 01872 01873 now = ast_tvnow(); 01874 01875 ast_localtime(&now, &tm, NULL); 01876 ast_strftime(currenttime, sizeof(currenttime), DATE_FORMAT, &tm); 01877 01878 var = ast_load_realtime("meetme", "confno", 01879 confno, "startTime<= ", currenttime, 01880 "endtime>= ", currenttime, NULL); 01881 01882 orig_var = var; 01883 01884 /* Identify the specific RealTime conference */ 01885 while (var) { 01886 if (!strcasecmp(var->name, "bookid")) { 01887 ast_copy_string(bookid, var->value, sizeof(bookid)); 01888 } 01889 if (!strcasecmp(var->name, "endtime")) { 01890 ast_copy_string(endtime, var->value, sizeof(endtime)); 01891 } 01892 01893 var = var->next; 01894 } 01895 ast_variables_destroy(orig_var); 01896 01897 ast_strptime(endtime, DATE_FORMAT, &tm); 01898 now = ast_mktime(&tm, NULL); 01899 01900 now.tv_sec += extendby; 01901 01902 ast_localtime(&now, &tm, NULL); 01903 ast_strftime(currenttime, sizeof(currenttime), DATE_FORMAT, &tm); 01904 strcat(currenttime, "0"); /* Seconds needs to be 00 */ 01905 01906 var = ast_load_realtime("meetme", "confno", 01907 confno, "startTime<= ", currenttime, 01908 "endtime>= ", currenttime, NULL); 01909 01910 /* If there is no conflict with extending the conference, update the DB */ 01911 if (!var) { 01912 ast_debug(3, "Trying to update the endtime of Conference %s to %s\n", confno, currenttime); 01913 ast_update_realtime("meetme", "bookid", bookid, "endtime", currenttime, NULL); 01914 return 0; 01915 01916 } 01917 01918 ast_variables_destroy(var); 01919 return -1; 01920 }
| static void* run_station | ( | void * | data | ) | [static] |
Definition at line 4842 of file app_meetme.c.
References sla_trunk::active_stations, admin_exec(), ALL_TRUNK_REFS, answer_trunk_chan(), ast_atomic_dec_and_test(), ast_atomic_fetchadd_int(), ast_cond_signal(), ast_dial_destroy(), ast_dial_join(), ast_free, ast_mutex_lock(), ast_mutex_unlock(), ast_set_flag, ast_str_append(), ast_str_buffer(), ast_str_create(), ast_str_set(), build_conf(), sla_trunk_ref::chan, run_station_args::cond, run_station_args::cond_lock, conf_run(), CONFFLAG_MARKEDEXIT, CONFFLAG_PASS_DTMF, CONFFLAG_QUIET, CONFFLAG_SLA_STATION, sla_station::dial, dispose_conf(), ast_flags::flags, sla_trunk::hold_stations, sla_trunk::name, sla_change_trunk_state(), SLA_TRUNK_STATE_IDLE, SLA_TRUNK_STATE_ONHOLD_BYME, sla_trunk_ref::state, run_station_args::station, sla_trunk_ref::trunk, and run_station_args::trunk_ref.
Referenced by sla_handle_dial_state_event().
04843 { 04844 struct sla_station *station; 04845 struct sla_trunk_ref *trunk_ref; 04846 struct ast_str *conf_name = ast_str_create(16); 04847 struct ast_flags conf_flags = { 0 }; 04848 struct ast_conference *conf; 04849 04850 { 04851 struct run_station_args *args = data; 04852 station = args->station; 04853 trunk_ref = args->trunk_ref; 04854 ast_mutex_lock(args->cond_lock); 04855 ast_cond_signal(args->cond); 04856 ast_mutex_unlock(args->cond_lock); 04857 /* args is no longer valid here. */ 04858 } 04859 04860 ast_atomic_fetchadd_int((int *) &trunk_ref->trunk->active_stations, 1); 04861 ast_str_set(&conf_name, 0, "SLA_%s", trunk_ref->trunk->name); 04862 ast_set_flag(&conf_flags, 04863 CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_PASS_DTMF | CONFFLAG_SLA_STATION); 04864 answer_trunk_chan(trunk_ref->chan); 04865 conf = build_conf(ast_str_buffer(conf_name), "", "", 0, 0, 1, trunk_ref->chan); 04866 if (conf) { 04867 conf_run(trunk_ref->chan, conf, conf_flags.flags, NULL); 04868 dispose_conf(conf); 04869 conf = NULL; 04870 } 04871 trunk_ref->chan = NULL; 04872 if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->active_stations) && 04873 trunk_ref->state != SLA_TRUNK_STATE_ONHOLD_BYME) { 04874 ast_str_append(&conf_name, 0, ",K"); 04875 admin_exec(NULL, ast_str_buffer(conf_name)); 04876 trunk_ref->trunk->hold_stations = 0; 04877 sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL); 04878 } 04879 04880 ast_dial_join(station->dial); 04881 ast_dial_destroy(station->dial); 04882 station->dial = NULL; 04883 ast_free(conf_name); 04884 04885 return NULL; 04886 }
| static void send_talking_event | ( | struct ast_channel * | chan, | |
| struct ast_conference * | conf, | |||
| struct ast_conf_user * | user, | |||
| int | talking | |||
| ) | [static] |
Definition at line 2014 of file app_meetme.c.
References ast_conference::confno, EVENT_FLAG_CALL, manager_event, ast_channel::name, ast_channel::uniqueid, and ast_conf_user::user_no.
Referenced by set_user_talking().
02015 { 02016 manager_event(EVENT_FLAG_CALL, "MeetmeTalking", 02017 "Channel: %s\r\n" 02018 "Uniqueid: %s\r\n" 02019 "Meetme: %s\r\n" 02020 "Usernum: %d\r\n" 02021 "Status: %s\r\n", 02022 chan->name, chan->uniqueid, conf->confno, user->user_no, talking ? "on" : "off"); 02023 }
| static int set_listen_volume | ( | struct ast_conf_user * | user, | |
| int | volume | |||
| ) | [static] |
Definition at line 934 of file app_meetme.c.
References ast_channel_setoption(), AST_OPTION_TXGAIN, and ast_conf_user::chan.
Referenced by tweak_listen_volume().
00935 { 00936 char gain_adjust; 00937 00938 /* attempt to make the adjustment in the channel driver; 00939 if successful, don't adjust in the frame reading routine 00940 */ 00941 gain_adjust = gain_map[volume + 5]; 00942 00943 return ast_channel_setoption(user->chan, AST_OPTION_TXGAIN, &gain_adjust, sizeof(gain_adjust), 0); 00944 }
| static int set_talk_volume | ( | struct ast_conf_user * | user, | |
| int | volume | |||
| ) | [static] |
Definition at line 922 of file app_meetme.c.
References ast_channel_setoption(), AST_OPTION_RXGAIN, and ast_conf_user::chan.
Referenced by conf_run(), and tweak_talk_volume().
00923 { 00924 char gain_adjust; 00925 00926 /* attempt to make the adjustment in the channel driver; 00927 if successful, don't adjust in the frame reading routine 00928 */ 00929 gain_adjust = gain_map[volume + 5]; 00930 00931 return ast_channel_setoption(user->chan, AST_OPTION_RXGAIN, &gain_adjust, sizeof(gain_adjust), 0); 00932 }
| static void set_user_talking | ( | struct ast_channel * | chan, | |
| struct ast_conference * | conf, | |||
| struct ast_conf_user * | user, | |||
| int | talking, | |||
| int | monitor | |||
| ) | [static] |
Definition at line 2025 of file app_meetme.c.
References send_talking_event(), and ast_conf_user::talking.
Referenced by conf_run().
02026 { 02027 int last_talking = user->talking; 02028 if (last_talking == talking) 02029 return; 02030 02031 user->talking = talking; 02032 02033 if (monitor) { 02034 /* Check if talking state changed. Take care of -1 which means unmonitored */ 02035 int was_talking = (last_talking > 0); 02036 int now_talking = (talking > 0); 02037 if (was_talking != now_talking) { 02038 send_talking_event(chan, conf, user, now_talking); 02039 } 02040 } 02041 }
| static void sla_add_trunk_to_station | ( | struct sla_station * | station, | |
| struct ast_variable * | var | |||
| ) | [static] |
Definition at line 6302 of file app_meetme.c.
References ast_atomic_fetchadd_int(), ast_free, AST_LIST_INSERT_TAIL, ast_log(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strdupa, create_trunk_ref(), LOG_ERROR, LOG_WARNING, sla_station::name, sla_trunk::name, sla_trunk::num_stations, sla_trunk_ref::ring_delay, sla_trunk_ref::ring_timeout, sla_create_station_ref(), SLA_TRUNK_STATE_IDLE, sla_trunk_ref::state, sla_trunk::stations, strsep(), sla_station::trunks, and ast_variable::value.
Referenced by sla_build_station().
06303 { 06304 struct sla_trunk *trunk; 06305 struct sla_trunk_ref *trunk_ref; 06306 struct sla_station_ref *station_ref; 06307 char *trunk_name, *options, *cur; 06308 06309 options = ast_strdupa(var->value); 06310 trunk_name = strsep(&options, ","); 06311 06312 AST_RWLIST_RDLOCK(&sla_trunks); 06313 AST_RWLIST_TRAVERSE(&sla_trunks, trunk, entry) { 06314 if (!strcasecmp(trunk->name, trunk_name)) 06315 break; 06316 } 06317 06318 AST_RWLIST_UNLOCK(&sla_trunks); 06319 if (!trunk) { 06320 ast_log(LOG_ERROR, "Trunk '%s' not found!\n", var->value); 06321 return; 06322 } 06323 if (!(trunk_ref = create_trunk_ref(trunk))) 06324 return; 06325 trunk_ref->state = SLA_TRUNK_STATE_IDLE; 06326 06327 while ((cur = strsep(&options, ","))) { 06328 char *name, *value = cur; 06329 name = strsep(&value, "="); 06330 if (!strcasecmp(name, "ringtimeout")) { 06331 if (sscanf(value, "%30u", &trunk_ref->ring_timeout) != 1) { 06332 ast_log(LOG_WARNING, "Invalid ringtimeout value '%s' for " 06333 "trunk '%s' on station '%s'\n", value, trunk->name, station->name); 06334 trunk_ref->ring_timeout = 0; 06335 } 06336 } else if (!strcasecmp(name, "ringdelay")) { 06337 if (sscanf(value, "%30u", &trunk_ref->ring_delay) != 1) { 06338 ast_log(LOG_WARNING, "Invalid ringdelay value '%s' for " 06339 "trunk '%s' on station '%s'\n", value, trunk->name, station->name); 06340 trunk_ref->ring_delay = 0; 06341 } 06342 } else { 06343 ast_log(LOG_WARNING, "Invalid option '%s' for " 06344 "trunk '%s' on station '%s'\n", name, trunk->name, station->name); 06345 } 06346 } 06347 06348 if (!(station_ref = sla_create_station_ref(station))) { 06349 ast_free(trunk_ref); 06350 return; 06351 } 06352 ast_atomic_fetchadd_int((int *) &trunk->num_stations, 1); 06353 AST_RWLIST_WRLOCK(&sla_trunks); 06354 AST_LIST_INSERT_TAIL(&trunk->stations, station_ref, entry); 06355 AST_RWLIST_UNLOCK(&sla_trunks); 06356 AST_LIST_INSERT_TAIL(&station->trunks, trunk_ref, entry); 06357 }
| static int sla_build_station | ( | struct ast_config * | cfg, | |
| const char * | cat | |||
| ) | [static] |
Definition at line 6359 of file app_meetme.c.
References ast_add_extension2(), ast_calloc, ast_context_find_or_create(), ast_free, ast_free_ptr, AST_LIST_TRAVERSE, ast_log(), AST_MAX_APP, AST_MAX_EXTENSION, AST_RWLIST_INSERT_TAIL, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strdup, ast_string_field_init, ast_string_field_set, ast_strlen_zero(), ast_variable_browse(), ast_variable_retrieve(), sla_station::autocontext, context, destroy_station(), exten, sla_station::hold_access, ast_variable::lineno, LOG_ERROR, LOG_WARNING, sla_trunk::name, sla_station::name, ast_variable::name, ast_variable::next, PRIORITY_HINT, sla_station::ring_delay, sla_station::ring_timeout, sla_add_trunk_to_station(), SLA_CONFIG_FILE, SLA_HOLD_OPEN, SLA_HOLD_PRIVATE, sla_registrar, sla_trunk_ref::trunk, sla_station::trunks, ast_variable::value, and var.
Referenced by sla_load_config().
06360 { 06361 struct sla_station *station; 06362 struct ast_variable *var; 06363 const char *dev; 06364 06365 if (!(dev = ast_variable_retrieve(cfg, cat, "device"))) { 06366 ast_log(LOG_ERROR, "SLA Station '%s' defined with no device!\n", cat); 06367 return -1; 06368 } 06369 06370 if (!(station = ast_calloc(1, sizeof(*station)))) 06371 return -1; 06372 if (ast_string_field_init(station, 32)) { 06373 ast_free(station); 06374 return -1; 06375 } 06376 06377 ast_string_field_set(station, name, cat); 06378 ast_string_field_set(station, device, dev); 06379 06380 for (var = ast_variable_browse(cfg, cat); var; var = var->next) { 06381 if (!strcasecmp(var->name, "trunk")) 06382 sla_add_trunk_to_station(station, var); 06383 else if (!strcasecmp(var->name, "autocontext")) 06384 ast_string_field_set(station, autocontext, var->value); 06385 else if (!strcasecmp(var->name, "ringtimeout")) { 06386 if (sscanf(var->value, "%30u", &station->ring_timeout) != 1) { 06387 ast_log(LOG_WARNING, "Invalid ringtimeout '%s' specified for station '%s'\n", 06388 var->value, station->name); 06389 station->ring_timeout = 0; 06390 } 06391 } else if (!strcasecmp(var->name, "ringdelay")) { 06392 if (sscanf(var->value, "%30u", &station->ring_delay) != 1) { 06393 ast_log(LOG_WARNING, "Invalid ringdelay '%s' specified for station '%s'\n", 06394 var->value, station->name); 06395 station->ring_delay = 0; 06396 } 06397 } else if (!strcasecmp(var->name, "hold")) { 06398 if (!strcasecmp(var->value, "private")) 06399 station->hold_access = SLA_HOLD_PRIVATE; 06400 else if (!strcasecmp(var->value, "open")) 06401 station->hold_access = SLA_HOLD_OPEN; 06402 else { 06403 ast_log(LOG_WARNING, "Invalid value '%s' for hold on station %s\n", 06404 var->value, station->name); 06405 } 06406 06407 } else if (strcasecmp(var->name, "type") && strcasecmp(var->name, "device")) { 06408 ast_log(LOG_ERROR, "Invalid option '%s' specified at line %d of %s!\n", 06409 var->name, var->lineno, SLA_CONFIG_FILE); 06410 } 06411 } 06412 06413 if (!ast_strlen_zero(station->autocontext)) { 06414 struct ast_context *context; 06415 struct sla_trunk_ref *trunk_ref; 06416 context = ast_context_find_or_create(NULL, NULL, station->autocontext, sla_registrar); 06417 if (!context) { 06418 ast_log(LOG_ERROR, "Failed to automatically find or create " 06419 "context '%s' for SLA!\n", station->autocontext); 06420 destroy_station(station); 06421 return -1; 06422 } 06423 /* The extension for when the handset goes off-hook. 06424 * exten => station1,1,SLAStation(station1) */ 06425 if (ast_add_extension2(context, 0 /* don't replace */, station->name, 1, 06426 NULL, NULL, slastation_app, ast_strdup(station->name), ast_free_ptr, sla_registrar)) { 06427 ast_log(LOG_ERROR, "Failed to automatically create extension " 06428 "for trunk '%s'!\n", station->name); 06429 destroy_station(station); 06430 return -1; 06431 } 06432 AST_RWLIST_RDLOCK(&sla_trunks); 06433 AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) { 06434 char exten[AST_MAX_EXTENSION]; 06435 char hint[AST_MAX_APP]; 06436 snprintf(exten, sizeof(exten), "%s_%s", station->name, trunk_ref->trunk->name); 06437 snprintf(hint, sizeof(hint), "SLA:%s", exten); 06438 /* Extension for this line button 06439 * exten => station1_line1,1,SLAStation(station1_line1) */ 06440 if (ast_add_extension2(context, 0 /* don't replace */, exten, 1, 06441 NULL, NULL, slastation_app, ast_strdup(exten), ast_free_ptr, sla_registrar)) { 06442 ast_log(LOG_ERROR, "Failed to automatically create extension " 06443 "for trunk '%s'!\n", station->name); 06444 destroy_station(station); 06445 return -1; 06446 } 06447 /* Hint for this line button 06448 * exten => station1_line1,hint,SLA:station1_line1 */ 06449 if (ast_add_extension2(context, 0 /* don't replace */, exten, PRIORITY_HINT, 06450 NULL, NULL, hint, NULL, NULL, sla_registrar)) { 06451 ast_log(LOG_ERROR, "Failed to automatically create hint " 06452 "for trunk '%s'!\n", station->name); 06453 destroy_station(station); 06454 return -1; 06455 } 06456 } 06457 AST_RWLIST_UNLOCK(&sla_trunks); 06458 } 06459 06460 AST_RWLIST_WRLOCK(&sla_stations); 06461 AST_RWLIST_INSERT_TAIL(&sla_stations, station, entry); 06462 AST_RWLIST_UNLOCK(&sla_stations); 06463 06464 return 0; 06465 }
| static int sla_build_trunk | ( | struct ast_config * | cfg, | |
| const char * | cat | |||
| ) | [static] |
Definition at line 6224 of file app_meetme.c.
References ast_add_extension2(), ast_calloc, ast_context_find_or_create(), ast_false(), ast_free, ast_free_ptr, ast_log(), AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strdup, ast_string_field_init, ast_string_field_set, ast_strlen_zero(), ast_variable_browse(), ast_variable_retrieve(), sla_trunk::autocontext, sla_trunk::barge_disabled, context, destroy_trunk(), sla_trunk::hold_access, ast_variable::lineno, LOG_ERROR, LOG_WARNING, sla_trunk::name, ast_variable::name, ast_variable::next, sla_trunk::ring_timeout, sla_check_device(), SLA_CONFIG_FILE, SLA_HOLD_OPEN, SLA_HOLD_PRIVATE, sla_registrar, ast_variable::value, and var.
Referenced by sla_load_config().
06225 { 06226 struct sla_trunk *trunk; 06227 struct ast_variable *var; 06228 const char *dev; 06229 06230 if (!(dev = ast_variable_retrieve(cfg, cat, "device"))) { 06231 ast_log(LOG_ERROR, "SLA Trunk '%s' defined with no device!\n", cat); 06232 return -1; 06233 } 06234 06235 if (sla_check_device(dev)) { 06236 ast_log(LOG_ERROR, "SLA Trunk '%s' define with invalid device '%s'!\n", 06237 cat, dev); 06238 return -1; 06239 } 06240 06241 if (!(trunk = ast_calloc(1, sizeof(*trunk)))) 06242 return -1; 06243 if (ast_string_field_init(trunk, 32)) { 06244 ast_free(trunk); 06245 return -1; 06246 } 06247 06248 ast_string_field_set(trunk, name, cat); 06249 ast_string_field_set(trunk, device, dev); 06250 06251 for (var = ast_variable_browse(cfg, cat); var; var = var->next) { 06252 if (!strcasecmp(var->name, "autocontext")) 06253 ast_string_field_set(trunk, autocontext, var->value); 06254 else if (!strcasecmp(var->name, "ringtimeout")) { 06255 if (sscanf(var->value, "%30u", &trunk->ring_timeout) != 1) { 06256 ast_log(LOG_WARNING, "Invalid ringtimeout '%s' specified for trunk '%s'\n", 06257 var->value, trunk->name); 06258 trunk->ring_timeout = 0; 06259 } 06260 } else if (!strcasecmp(var->name, "barge")) 06261 trunk->barge_disabled = ast_false(var->value); 06262 else if (!strcasecmp(var->name, "hold")) { 06263 if (!strcasecmp(var->value, "private")) 06264 trunk->hold_access = SLA_HOLD_PRIVATE; 06265 else if (!strcasecmp(var->value, "open")) 06266 trunk->hold_access = SLA_HOLD_OPEN; 06267 else { 06268 ast_log(LOG_WARNING, "Invalid value '%s' for hold on trunk %s\n", 06269 var->value, trunk->name); 06270 } 06271 } else if (strcasecmp(var->name, "type") && strcasecmp(var->name, "device")) { 06272 ast_log(LOG_ERROR, "Invalid option '%s' specified at line %d of %s!\n", 06273 var->name, var->lineno, SLA_CONFIG_FILE); 06274 } 06275 } 06276 06277 if (!ast_strlen_zero(trunk->autocontext)) { 06278 struct ast_context *context; 06279 context = ast_context_find_or_create(NULL, NULL, trunk->autocontext, sla_registrar); 06280 if (!context) { 06281 ast_log(LOG_ERROR, "Failed to automatically find or create " 06282 "context '%s' for SLA!\n", trunk->autocontext); 06283 destroy_trunk(trunk); 06284 return -1; 06285 } 06286 if (ast_add_extension2(context, 0 /* don't replace */, "s", 1, 06287 NULL, NULL, slatrunk_app, ast_strdup(trunk->name), ast_free_ptr, sla_registrar)) { 06288 ast_log(LOG_ERROR, "Failed to automatically create extension " 06289 "for trunk '%s'!\n", trunk->name); 06290 destroy_trunk(trunk); 06291 return -1; 06292 } 06293 } 06294 06295 AST_RWLIST_WRLOCK(&sla_trunks); 06296 AST_RWLIST_INSERT_TAIL(&sla_trunks, trunk, entry); 06297 AST_RWLIST_UNLOCK(&sla_trunks); 06298 06299 return 0; 06300 }
| static int sla_calc_station_delays | ( | unsigned int * | timeout | ) | [static] |
Calculate the ring delay for a station.
Definition at line 5455 of file app_meetme.c.
References AST_LIST_TRAVERSE, sla_check_inuse_station(), sla_check_ringing_station(), sla_check_station_delay(), and sla_choose_ringing_trunk().
Referenced by sla_process_timers().
05456 { 05457 struct sla_station *station; 05458 int res = 0; 05459 05460 AST_LIST_TRAVERSE(&sla_stations, station, entry) { 05461 struct sla_ringing_trunk *ringing_trunk; 05462 int time_left; 05463 05464 /* Ignore stations already ringing */ 05465 if (sla_check_ringing_station(station)) 05466 continue; 05467 05468 /* Ignore stations already on a call */ 05469 if (sla_check_inuse_station(station)) 05470 continue; 05471 05472 /* Ignore stations that don't have one of their trunks ringing */ 05473 if (!(ringing_trunk = sla_choose_ringing_trunk(station, NULL, 0))) 05474 continue; 05475 05476 if ((time_left = sla_check_station_delay(station, ringing_trunk)) == INT_MAX) 05477 continue; 05478 05479 /* If there is no time left, then the station needs to start ringing. 05480 * Return non-zero so that an event will be queued up an event to 05481 * make that happen. */ 05482 if (time_left <= 0) { 05483 res = 1; 05484 continue; 05485 } 05486 05487 if (time_left < *timeout) 05488 *timeout = time_left; 05489 } 05490 05491 return res; 05492 }
| static int sla_calc_station_timeouts | ( | unsigned int * | timeout | ) | [static] |
Process station ring timeouts.
Definition at line 5372 of file app_meetme.c.
References AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_tvdiff_ms(), ast_tvnow(), sla_ringing_station::ring_begin, sla_ringing_trunk::ring_begin, sla_station::ring_timeout, sla_trunk_ref::ring_timeout, sla, SLA_STATION_HANGUP_TIMEOUT, sla_stop_ringing_station(), sla_station_ref::station, sla_ringing_station::station, sla_ringing_trunk::timed_out_stations, sla_trunk_ref::trunk, sla_ringing_trunk::trunk, and sla_station::trunks.
Referenced by sla_process_timers().
05373 { 05374 struct sla_ringing_trunk *ringing_trunk; 05375 struct sla_ringing_station *ringing_station; 05376 int res = 0; 05377 05378 AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_stations, ringing_station, entry) { 05379 unsigned int ring_timeout = 0; 05380 int time_elapsed, time_left = INT_MAX, final_trunk_time_left = INT_MIN; 05381 struct sla_trunk_ref *trunk_ref; 05382 05383 /* If there are any ring timeouts specified for a specific trunk 05384 * on the station, then use the highest per-trunk ring timeout. 05385 * Otherwise, use the ring timeout set for the entire station. */ 05386 AST_LIST_TRAVERSE(&ringing_station->station->trunks, trunk_ref, entry) { 05387 struct sla_station_ref *station_ref; 05388 int trunk_time_elapsed, trunk_time_left; 05389 05390 AST_LIST_TRAVERSE(&sla.ringing_trunks, ringing_trunk, entry) { 05391 if (ringing_trunk->trunk == trunk_ref->trunk) 05392 break; 05393 } 05394 if (!ringing_trunk) 05395 continue; 05396 05397 /* If there is a trunk that is ringing without a timeout, then the 05398 * only timeout that could matter is a global station ring timeout. */ 05399 if (!trunk_ref->ring_timeout) 05400 break; 05401 05402 /* This trunk on this station is ringing and has a timeout. 05403 * However, make sure this trunk isn't still ringing from a 05404 * previous timeout. If so, don't consider it. */ 05405 AST_LIST_TRAVERSE(&ringing_trunk->timed_out_stations, station_ref, entry) { 05406 if (station_ref->station == ringing_station->station) 05407 break; 05408 } 05409 if (station_ref) 05410 continue; 05411 05412 trunk_time_elapsed = ast_tvdiff_ms(ast_tvnow(), ringing_trunk->ring_begin); 05413 trunk_time_left = (trunk_ref->ring_timeout * 1000) - trunk_time_elapsed; 05414 if (trunk_time_left > final_trunk_time_left) 05415 final_trunk_time_left = trunk_time_left; 05416 } 05417 05418 /* No timeout was found for ringing trunks, and no timeout for the entire station */ 05419 if (final_trunk_time_left == INT_MIN && !ringing_station->station->ring_timeout) 05420 continue; 05421 05422 /* Compute how much time is left for a global station timeout */ 05423 if (ringing_station->station->ring_timeout) { 05424 ring_timeout = ringing_station->station->ring_timeout; 05425 time_elapsed = ast_tvdiff_ms(ast_tvnow(), ringing_station->ring_begin); 05426 time_left = (ring_timeout * 1000) - time_elapsed; 05427 } 05428 05429 /* If the time left based on the per-trunk timeouts is smaller than the 05430 * global station ring timeout, use that. */ 05431 if (final_trunk_time_left > INT_MIN && final_trunk_time_left < time_left) 05432 time_left = final_trunk_time_left; 05433 05434 /* If there is no time left, the station needs to stop ringing */ 05435 if (time_left <= 0) { 05436 AST_LIST_REMOVE_CURRENT(entry); 05437 sla_stop_ringing_station(ringing_station, SLA_STATION_HANGUP_TIMEOUT); 05438 res = 1; 05439 continue; 05440 } 05441 05442 /* There is still some time left for this station to ring, so save that 05443 * timeout if it is the first event scheduled to occur */ 05444 if (time_left < *timeout) 05445 *timeout = time_left; 05446 } 05447 AST_LIST_TRAVERSE_SAFE_END; 05448 05449 return res; 05450 }
| static int sla_calc_trunk_timeouts | ( | unsigned int * | timeout | ) | [static] |
Process trunk ring timeouts.
Definition at line 5342 of file app_meetme.c.
References AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_tvdiff_ms(), ast_tvnow(), sla_trunk::chan, pbx_builtin_setvar_helper(), sla_ringing_trunk::ring_begin, sla_trunk::ring_timeout, sla, sla_stop_ringing_trunk(), and sla_ringing_trunk::trunk.
Referenced by sla_process_timers().
05343 { 05344 struct sla_ringing_trunk *ringing_trunk; 05345 int res = 0; 05346 05347 AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_trunks, ringing_trunk, entry) { 05348 int time_left, time_elapsed; 05349 if (!ringing_trunk->trunk->ring_timeout) 05350 continue; 05351 time_elapsed = ast_tvdiff_ms(ast_tvnow(), ringing_trunk->ring_begin); 05352 time_left = (ringing_trunk->trunk->ring_timeout * 1000) - time_elapsed; 05353 if (time_left <= 0) { 05354 pbx_builtin_setvar_helper(ringing_trunk->trunk->chan, "SLATRUNK_STATUS", "RINGTIMEOUT"); 05355 AST_LIST_REMOVE_CURRENT(entry); 05356 sla_stop_ringing_trunk(ringing_trunk); 05357 res = 1; 05358 continue; 05359 } 05360 if (time_left < *timeout) 05361 *timeout = time_left; 05362 } 05363 AST_LIST_TRAVERSE_SAFE_END; 05364 05365 return res; 05366 }
| 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] |
Definition at line 4810 of file app_meetme.c.
References ast_devstate_changed(), AST_LIST_TRAVERSE, sla_trunk_ref::chan, sla_trunk::name, sla_station::name, sla_state_to_devstate(), sla_trunk_ref::state, sla_trunk_ref::trunk, and sla_station::trunks.
Referenced by dial_trunk(), queue_ringing_trunk(), run_station(), sla_handle_dial_state_event(), sla_handle_hold_event(), sla_station_exec(), sla_stop_ringing_trunk(), and sla_trunk_exec().
04812 { 04813 struct sla_station *station; 04814 struct sla_trunk_ref *trunk_ref; 04815 04816 AST_LIST_TRAVERSE(&sla_stations, station, entry) { 04817 AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) { 04818 if (trunk_ref->trunk != trunk || (inactive_only ? trunk_ref->chan : 0) 04819 || trunk_ref == exclude) 04820 continue; 04821 trunk_ref->state = state; 04822 ast_devstate_changed(sla_state_to_devstate(state), 04823 "SLA:%s_%s", station->name, trunk->name); 04824 break; 04825 } 04826 } 04827 }
| static int sla_check_device | ( | const char * | device | ) | [static] |
Definition at line 6211 of file app_meetme.c.
References ast_strdupa, ast_strlen_zero(), and strsep().
Referenced by sla_build_trunk().
06212 { 06213 char *tech, *tech_data; 06214 06215 tech_data = ast_strdupa(device); 06216 tech = strsep(&tech_data, "/"); 06217 06218 if (ast_strlen_zero(tech) || ast_strlen_zero(tech_data)) 06219 return -1; 06220 06221 return 0; 06222 }
| static int sla_check_failed_station | ( | const struct sla_station * | station | ) | [static] |
Check to see if this station has failed to be dialed in the past minute.
Definition at line 5090 of file app_meetme.c.
References ast_free, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_tvdiff_ms(), ast_tvnow(), sla_failed_station::last_try, sla, and sla_failed_station::station.
Referenced by sla_ring_stations().
05091 { 05092 struct sla_failed_station *failed_station; 05093 int res = 0; 05094 05095 AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.failed_stations, failed_station, entry) { 05096 if (station != failed_station->station) 05097 continue; 05098 if (ast_tvdiff_ms(ast_tvnow(), failed_station->last_try) > 1000) { 05099 AST_LIST_REMOVE_CURRENT(entry); 05100 ast_free(failed_station); 05101 break; 05102 } 05103 res = 1; 05104 } 05105 AST_LIST_TRAVERSE_SAFE_END 05106 05107 return res; 05108 }
| static int sla_check_inuse_station | ( | const struct sla_station * | station | ) | [static] |
Check to see if a station is in use.
Definition at line 5176 of file app_meetme.c.
References AST_LIST_TRAVERSE, sla_trunk_ref::chan, and sla_station::trunks.
Referenced by sla_calc_station_delays(), and sla_ring_stations().
05177 { 05178 struct sla_trunk_ref *trunk_ref; 05179 05180 AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) { 05181 if (trunk_ref->chan) 05182 return 1; 05183 } 05184 05185 return 0; 05186 }
| static void sla_check_reload | ( | void | ) | [static] |
Check if we can do a reload of SLA, and do it if we can.
Definition at line 5534 of file app_meetme.c.
References ast_free, AST_LIST_EMPTY, ast_mutex_lock(), ast_mutex_unlock(), AST_RWLIST_RDLOCK, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, sla_trunk::ref_count, sla_station::ref_count, sla, and sla_load_config().
Referenced by sla_thread().
05535 { 05536 struct sla_station *station; 05537 struct sla_trunk *trunk; 05538 05539 ast_mutex_lock(&sla.lock); 05540 05541 if (!AST_LIST_EMPTY(&sla.event_q) || !AST_LIST_EMPTY(&sla.ringing_trunks) 05542 || !AST_LIST_EMPTY(&sla.ringing_stations)) { 05543 ast_mutex_unlock(&sla.lock); 05544 return; 05545 } 05546 05547 AST_RWLIST_RDLOCK(&sla_stations); 05548 AST_RWLIST_TRAVERSE(&sla_stations, station, entry) { 05549 if (station->ref_count) 05550 break; 05551 } 05552 AST_RWLIST_UNLOCK(&sla_stations); 05553 if (station) { 05554 ast_mutex_unlock(&sla.lock); 05555 return; 05556 } 05557 05558 AST_RWLIST_RDLOCK(&sla_trunks); 05559 AST_RWLIST_TRAVERSE(&sla_trunks, trunk, entry) { 05560 if (trunk->ref_count) 05561 break; 05562 } 05563 AST_RWLIST_UNLOCK(&sla_trunks); 05564 if (trunk) { 05565 ast_mutex_unlock(&sla.lock); 05566 return; 05567 } 05568 05569 /* We need to actually delete the previous versions of trunks and stations now */ 05570 AST_RWLIST_TRAVERSE_SAFE_BEGIN(&sla_stations, station, entry) { 05571 AST_RWLIST_REMOVE_CURRENT(entry); 05572 ast_free(station); 05573 } 05574 AST_RWLIST_TRAVERSE_SAFE_END; 05575 05576 AST_RWLIST_TRAVERSE_SAFE_BEGIN(&sla_trunks, trunk, entry) { 05577 AST_RWLIST_REMOVE_CURRENT(entry); 05578 ast_free(trunk); 05579 } 05580 AST_RWLIST_TRAVERSE_SAFE_END; 05581 05582 /* yay */ 05583 sla_load_config(1); 05584 sla.reload = 0; 05585 05586 ast_mutex_unlock(&sla.lock); 05587 }
| static int sla_check_ringing_station | ( | const struct sla_station * | station | ) | [static] |
Check to see if this station is already ringing.
Definition at line 5075 of file app_meetme.c.
References AST_LIST_TRAVERSE, sla, and sla_ringing_station::station.
Referenced by sla_calc_station_delays(), and sla_ring_stations().
05076 { 05077 struct sla_ringing_station *ringing_station; 05078 05079 AST_LIST_TRAVERSE(&sla.ringing_stations, ringing_station, entry) { 05080 if (station == ringing_station->station) 05081 return 1; 05082 } 05083 05084 return 0; 05085 }
| static int sla_check_station_delay | ( | struct sla_station * | station, | |
| struct sla_ringing_trunk * | ringing_trunk | |||
| ) | [static] |
Calculate the ring delay for a given ringing trunk on a station.
| station | the station | |
| ringing_trunk | the trunk. If NULL, the highest priority ringing trunk will be used |
Definition at line 5206 of file app_meetme.c.
References ast_tvdiff_ms(), ast_tvnow(), sla_ringing_trunk::ring_begin, sla_station::ring_delay, sla_trunk_ref::ring_delay, sla_choose_ringing_trunk(), sla_find_trunk_ref(), and sla_ringing_trunk::trunk.
Referenced by sla_calc_station_delays(), and sla_ring_stations().
05208 { 05209 struct sla_trunk_ref *trunk_ref; 05210 unsigned int delay = UINT_MAX; 05211 int time_left, time_elapsed; 05212 05213 if (!ringing_trunk) 05214 ringing_trunk = sla_choose_ringing_trunk(station, &trunk_ref, 0); 05215 else 05216 trunk_ref = sla_find_trunk_ref(station, ringing_trunk->trunk); 05217 05218 if (!ringing_trunk || !trunk_ref) 05219 return delay; 05220 05221 /* If this station has a ring delay specific to the highest priority 05222 * ringing trunk, use that. Otherwise, use the ring delay specified 05223 * globally for the station. */ 05224 delay = trunk_ref->ring_delay; 05225 if (!delay) 05226 delay = station->ring_delay; 05227 if (!delay) 05228 return INT_MAX; 05229 05230 time_elapsed = ast_tvdiff_ms(ast_tvnow(), ringing_trunk->ring_begin); 05231 time_left = (delay * 1000) - time_elapsed; 05232 05233 return time_left; 05234 }
| static int sla_check_station_hold_access | ( | const struct sla_trunk * | trunk, | |
| const struct sla_station * | station | |||
| ) | [static] |
Definition at line 4715 of file app_meetme.c.
References AST_LIST_TRAVERSE, sla_station::hold_access, SLA_HOLD_PRIVATE, SLA_TRUNK_STATE_ONHOLD_BYME, sla_trunk_ref::state, sla_station_ref::station, sla_trunk::stations, sla_trunk_ref::trunk, and sla_station::trunks.
Referenced by sla_find_trunk_ref_byname().
04717 { 04718 struct sla_station_ref *station_ref; 04719 struct sla_trunk_ref *trunk_ref; 04720 04721 /* For each station that has this call on hold, check for private hold. */ 04722 AST_LIST_TRAVERSE(&trunk->stations, station_ref, entry) { 04723 AST_LIST_TRAVERSE(&station_ref->station->trunks, trunk_ref, entry) { 04724 if (trunk_ref->trunk != trunk || station_ref->station == station) 04725 continue; 04726 if (trunk_ref->state == SLA_TRUNK_STATE_ONHOLD_BYME && 04727 station_ref->station->hold_access == SLA_HOLD_PRIVATE) 04728 return 1; 04729 return 0; 04730 } 04731 } 04732 04733 return 0; 04734 }
| static int sla_check_timed_out_station | ( | const struct sla_ringing_trunk * | ringing_trunk, | |
| const struct sla_station * | station | |||
| ) | [static] |
Check to see if dialing this station already timed out for this ringing trunk.
Definition at line 4946 of file app_meetme.c.
References AST_LIST_TRAVERSE, sla_station_ref::station, and sla_ringing_trunk::timed_out_stations.
Referenced by sla_choose_ringing_trunk(), and sla_ring_stations().
04948 { 04949 struct sla_station_ref *timed_out_station; 04950 04951 AST_LIST_TRAVERSE(&ringing_trunk->timed_out_stations, timed_out_station, entry) { 04952 if (station == timed_out_station->station) 04953 return 1; 04954 } 04955 04956 return 0; 04957 }
| static struct sla_trunk_ref* sla_choose_idle_trunk | ( | const struct sla_station * | station | ) | [static, read] |
For a given station, choose the highest priority idle trunk.
Definition at line 5772 of file app_meetme.c.
References AST_LIST_TRAVERSE, SLA_TRUNK_STATE_IDLE, sla_trunk_ref::state, and sla_station::trunks.
Referenced by sla_station_exec().
05773 { 05774 struct sla_trunk_ref *trunk_ref = NULL; 05775 05776 AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) { 05777 if (trunk_ref->state == SLA_TRUNK_STATE_IDLE) 05778 break; 05779 } 05780 05781 return trunk_ref; 05782 }
| static struct sla_ringing_trunk* sla_choose_ringing_trunk | ( | struct sla_station * | station, | |
| struct sla_trunk_ref ** | trunk_ref, | |||
| int | rm | |||
| ) | [static, read] |
Choose the highest priority ringing trunk for a station.
| station | the station | |
| remove | remove the ringing trunk once selected | |
| trunk_ref | a place to store the pointer to this stations reference to the selected trunk |
Definition at line 4967 of file app_meetme.c.
References AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, sla, sla_check_timed_out_station(), sla_ringing_trunk::trunk, sla_trunk_ref::trunk, and sla_station::trunks.
Referenced by sla_calc_station_delays(), sla_check_station_delay(), and sla_handle_dial_state_event().
04969 { 04970 struct sla_trunk_ref *s_trunk_ref; 04971 struct sla_ringing_trunk *ringing_trunk = NULL; 04972 04973 AST_LIST_TRAVERSE(&station->trunks, s_trunk_ref, entry) { 04974 AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_trunks, ringing_trunk, entry) { 04975 /* Make sure this is the trunk we're looking for */ 04976 if (s_trunk_ref->trunk != ringing_trunk->trunk) 04977 continue; 04978 04979 /* This trunk on the station is ringing. But, make sure this station 04980 * didn't already time out while this trunk was ringing. */ 04981 if (sla_check_timed_out_station(ringing_trunk, station)) 04982 continue; 04983 04984 if (rm) 04985 AST_LIST_REMOVE_CURRENT(entry); 04986 04987 if (trunk_ref) 04988 *trunk_ref = s_trunk_ref; 04989 04990 break; 04991 } 04992 AST_LIST_TRAVERSE_SAFE_END; 04993 04994 if (ringing_trunk) 04995 break; 04996 } 04997 04998 return ringing_trunk; 04999 }
| static struct sla_ringing_station* sla_create_ringing_station | ( | struct sla_station * | station | ) | [static, read] |
Definition at line 4780 of file app_meetme.c.
References ast_calloc, ast_tvnow(), sla_ringing_station::ring_begin, and sla_ringing_station::station.
Referenced by sla_ring_station().
04781 { 04782 struct sla_ringing_station *ringing_station; 04783 04784 if (!(ringing_station = ast_calloc(1, sizeof(*ringing_station)))) 04785 return NULL; 04786 04787 ringing_station->station = station; 04788 ringing_station->ring_begin = ast_tvnow(); 04789 04790 return ringing_station; 04791 }
| static struct sla_station_ref* sla_create_station_ref | ( | struct sla_station * | station | ) | [static, read] |
Definition at line 4768 of file app_meetme.c.
References ast_calloc, and sla_station_ref::station.
Referenced by sla_add_trunk_to_station(), and sla_stop_ringing_station().
04769 { 04770 struct sla_station_ref *station_ref; 04771 04772 if (!(station_ref = ast_calloc(1, sizeof(*station_ref)))) 04773 return NULL; 04774 04775 station_ref->station = station; 04776 04777 return station_ref; 04778 }
| static void sla_destroy | ( | void | ) | [static] |
Definition at line 6181 of file app_meetme.c.
References ast_cond_destroy(), ast_cond_signal(), ast_context_destroy(), ast_mutex_destroy(), ast_mutex_lock(), ast_mutex_unlock(), AST_PTHREADT_NULL, AST_RWLIST_REMOVE_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, destroy_station(), destroy_trunk(), sla, and sla_registrar.
Referenced by unload_module().
06182 { 06183 struct sla_trunk *trunk; 06184 struct sla_station *station; 06185 06186 AST_RWLIST_WRLOCK(&sla_trunks); 06187 while ((trunk = AST_RWLIST_REMOVE_HEAD(&sla_trunks, entry))) 06188 destroy_trunk(trunk); 06189 AST_RWLIST_UNLOCK(&sla_trunks); 06190 06191 AST_RWLIST_WRLOCK(&sla_stations); 06192 while ((station = AST_RWLIST_REMOVE_HEAD(&sla_stations, entry))) 06193 destroy_station(station); 06194 AST_RWLIST_UNLOCK(&sla_stations); 06195 06196 if (sla.thread != AST_PTHREADT_NULL) { 06197 ast_mutex_lock(&sla.lock); 06198 sla.stop = 1; 06199 ast_cond_signal(&sla.cond); 06200 ast_mutex_unlock(&sla.lock); 06201 pthread_join(sla.thread, NULL); 06202 } 06203 06204 /* Drop any created contexts from the dialplan */ 06205 ast_context_destroy(NULL, sla_registrar); 06206 06207 ast_mutex_destroy(&sla.lock); 06208 ast_cond_destroy(&sla.cond); 06209 }
| static void sla_dial_state_callback | ( | struct ast_dial * | dial | ) | [static] |
Definition at line 4938 of file app_meetme.c.
References SLA_EVENT_DIAL_STATE, and sla_queue_event().
Referenced by sla_ring_station().
04939 { 04940 sla_queue_event(SLA_EVENT_DIAL_STATE); 04941 }
| static struct sla_station* sla_find_station | ( | const char * | name | ) | [static, read] |
Find an SLA station by name.
Definition at line 4703 of file app_meetme.c.
References AST_RWLIST_TRAVERSE, and sla_station::name.
Referenced by sla_station_exec().
04704 { 04705 struct sla_station *station = NULL; 04706 04707 AST_RWLIST_TRAVERSE(&sla_stations, station, entry) { 04708 if (!strcasecmp(station->name, name)) 04709 break; 04710 } 04711 04712 return station; 04713 }
| static struct sla_trunk* sla_find_trunk | ( | const char * | name | ) | [static, read] |
Find an SLA trunk by name.
Definition at line 4688 of file app_meetme.c.
References AST_RWLIST_TRAVERSE, and sla_trunk::name.
Referenced by sla_trunk_exec().
04689 { 04690 struct sla_trunk *trunk = NULL; 04691 04692 AST_RWLIST_TRAVERSE(&sla_trunks, trunk, entry) { 04693 if (!strcasecmp(trunk->name, name)) 04694 break; 04695 } 04696 04697 return trunk; 04698 }
| static struct sla_trunk_ref* sla_find_trunk_ref | ( | const struct sla_station * | station, | |
| const struct sla_trunk * | trunk | |||
| ) | [static, read] |
Definition at line 5188 of file app_meetme.c.
References AST_LIST_TRAVERSE, sla_trunk_ref::trunk, and sla_station::trunks.
Referenced by sla_check_station_delay().
05190 { 05191 struct sla_trunk_ref *trunk_ref = NULL; 05192 05193 AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) { 05194 if (trunk_ref->trunk == trunk) 05195 break; 05196 } 05197 05198 return trunk_ref; 05199 }
| static struct sla_trunk_ref* sla_find_trunk_ref_byname | ( | const struct sla_station * | station, | |
| const char * | name | |||
| ) | [static, read] |
Find a trunk reference on a station by name.
| station | the station | |
| name | the trunk's name |
Definition at line 4743 of file app_meetme.c.
References AST_LIST_TRAVERSE, sla_trunk::barge_disabled, sla_trunk::hold_access, sla_trunk::hold_stations, sla_trunk::name, sla_check_station_hold_access(), SLA_HOLD_PRIVATE, SLA_TRUNK_STATE_ONHOLD_BYME, SLA_TRUNK_STATE_UP, sla_trunk_ref::state, sla_trunk_ref::trunk, and sla_station::trunks.
Referenced by sla_station_exec().
04745 { 04746 struct sla_trunk_ref *trunk_ref = NULL; 04747 04748 AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) { 04749 if (strcasecmp(trunk_ref->trunk->name, name)) 04750 continue; 04751 04752 if ( (trunk_ref->trunk->barge_disabled 04753 && trunk_ref->state == SLA_TRUNK_STATE_UP) || 04754 (trunk_ref->trunk->hold_stations 04755 && trunk_ref->trunk->hold_access == SLA_HOLD_PRIVATE 04756 && trunk_ref->state != SLA_TRUNK_STATE_ONHOLD_BYME) || 04757 sla_check_station_hold_access(trunk_ref->trunk, station) ) 04758 { 04759 trunk_ref = NULL; 04760 } 04761 04762 break; 04763 } 04764 04765 return trunk_ref; 04766 }
| static void sla_handle_dial_state_event | ( | void | ) | [static] |
Definition at line 5001 of file app_meetme.c.
References ALL_TRUNK_REFS, answer_trunk_chan(), ast_cond_destroy(), ast_cond_init(), ast_cond_wait(), ast_debug, ast_dial_answered(), AST_DIAL_RESULT_ANSWERED, AST_DIAL_RESULT_FAILED, AST_DIAL_RESULT_HANGUP, AST_DIAL_RESULT_INVALID, AST_DIAL_RESULT_PROCEEDING, AST_DIAL_RESULT_PROGRESS, AST_DIAL_RESULT_RINGING, AST_DIAL_RESULT_TIMEOUT, AST_DIAL_RESULT_TRYING, AST_DIAL_RESULT_UNANSWERED, ast_dial_state(), ast_free, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_mutex_destroy(), ast_mutex_init(), ast_mutex_lock(), ast_mutex_unlock(), ast_pthread_create_detached_background, sla_trunk::chan, sla_trunk_ref::chan, run_station_args::cond, run_station_args::cond_lock, sla_station::dial, sla_station::name, run_station(), sla, sla_change_trunk_state(), sla_choose_ringing_trunk(), SLA_EVENT_DIAL_STATE, SLA_EVENT_RINGING_TRUNK, sla_queue_event(), SLA_STATION_HANGUP_NORMAL, sla_stop_ringing_station(), SLA_TRUNK_STATE_UP, run_station_args::station, sla_ringing_station::station, sla_ringing_trunk::trunk, and run_station_args::trunk_ref.
Referenced by sla_thread().
05002 { 05003 struct sla_ringing_station *ringing_station; 05004 05005 AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_stations, ringing_station, entry) { 05006 struct sla_trunk_ref *s_trunk_ref = NULL; 05007 struct sla_ringing_trunk *ringing_trunk = NULL; 05008 struct run_station_args args; 05009 enum ast_dial_result dial_res; 05010 pthread_t dont_care; 05011 ast_mutex_t cond_lock; 05012 ast_cond_t cond; 05013 05014 switch ((dial_res = ast_dial_state(ringing_station->station->dial))) { 05015 case AST_DIAL_RESULT_HANGUP: 05016 case AST_DIAL_RESULT_INVALID: 05017 case AST_DIAL_RESULT_FAILED: 05018 case AST_DIAL_RESULT_TIMEOUT: 05019 case AST_DIAL_RESULT_UNANSWERED: 05020 AST_LIST_REMOVE_CURRENT(entry); 05021 sla_stop_ringing_station(ringing_station, SLA_STATION_HANGUP_NORMAL); 05022 break; 05023 case AST_DIAL_RESULT_ANSWERED: 05024 AST_LIST_REMOVE_CURRENT(entry); 05025 /* Find the appropriate trunk to answer. */ 05026 ast_mutex_lock(&sla.lock); 05027 ringing_trunk = sla_choose_ringing_trunk(ringing_station->station, &s_trunk_ref, 1); 05028 ast_mutex_unlock(&sla.lock); 05029 if (!ringing_trunk) { 05030 ast_debug(1, "Found no ringing trunk for station '%s' to answer!\n", ringing_station->station->name); 05031 break; 05032 } 05033 /* Track the channel that answered this trunk */ 05034 s_trunk_ref->chan = ast_dial_answered(ringing_station->station->dial); 05035 /* Actually answer the trunk */ 05036 answer_trunk_chan(ringing_trunk->trunk->chan); 05037 sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL); 05038 /* Now, start a thread that will connect this station to the trunk. The rest of 05039 * the code here sets up the thread and ensures that it is able to save the arguments 05040 * before they are no longer valid since they are allocated on the stack. */ 05041 args.trunk_ref = s_trunk_ref; 05042 args.station = ringing_station->station; 05043 args.cond = &cond; 05044 args.cond_lock = &cond_lock; 05045 ast_free(ringing_trunk); 05046 ast_free(ringing_station); 05047 ast_mutex_init(&cond_lock); 05048 ast_cond_init(&cond, NULL); 05049 ast_mutex_lock(&cond_lock); 05050 ast_pthread_create_detached_background(&dont_care, NULL, run_station, &args); 05051 ast_cond_wait(&cond, &cond_lock); 05052 ast_mutex_unlock(&cond_lock); 05053 ast_mutex_destroy(&cond_lock); 05054 ast_cond_destroy(&cond); 05055 break; 05056 case AST_DIAL_RESULT_TRYING: 05057 case AST_DIAL_RESULT_RINGING: 05058 case AST_DIAL_RESULT_PROGRESS: 05059 case AST_DIAL_RESULT_PROCEEDING: 05060 break; 05061 } 05062 if (dial_res == AST_DIAL_RESULT_ANSWERED) { 05063 /* Queue up reprocessing ringing trunks, and then ringing stations again */ 05064 sla_queue_event(SLA_EVENT_RINGING_TRUNK); 05065 sla_queue_event(SLA_EVENT_DIAL_STATE); 05066 break; 05067 } 05068 } 05069 AST_LIST_TRAVERSE_SAFE_END; 05070 }
| static void sla_handle_hold_event | ( | struct sla_event * | event | ) | [static] |
Definition at line 5318 of file app_meetme.c.
References sla_trunk::active_stations, ast_atomic_fetchadd_int(), AST_CONTROL_HOLD, AST_DEVICE_ONHOLD, ast_devstate_changed(), ast_indicate(), ast_softhangup(), AST_SOFTHANGUP_DEV, sla_trunk_ref::chan, sla_trunk::chan, sla_trunk::hold_stations, INACTIVE_TRUNK_REFS, sla_trunk::name, sla_station::name, sla_change_trunk_state(), SLA_TRUNK_STATE_ONHOLD, SLA_TRUNK_STATE_ONHOLD_BYME, sla_event::station, sla_trunk_ref::trunk, and sla_event::trunk_ref.
Referenced by sla_thread().
05319 { 05320 ast_atomic_fetchadd_int((int *) &event->trunk_ref->trunk->hold_stations, 1); 05321 event->trunk_ref->state = SLA_TRUNK_STATE_ONHOLD_BYME; 05322 ast_devstate_changed(AST_DEVICE_ONHOLD, "SLA:%s_%s", 05323 event->station->name, event->trunk_ref->trunk->name); 05324 sla_change_trunk_state(event->trunk_ref->trunk, SLA_TRUNK_STATE_ONHOLD, 05325 INACTIVE_TRUNK_REFS, event->trunk_ref); 05326 05327 if (event->trunk_ref->trunk->active_stations == 1) { 05328 /* The station putting it on hold is the only one on the call, so start 05329 * Music on hold to the trunk. */ 05330 event->trunk_ref->trunk->on_hold = 1; 05331 ast_indicate(event->trunk_ref->trunk->chan, AST_CONTROL_HOLD); 05332 } 05333 05334 ast_softhangup(event->trunk_ref->chan, AST_SOFTHANGUP_DEV); 05335 event->trunk_ref->chan = NULL; 05336 }
| static void sla_handle_ringing_trunk_event | ( | void | ) | [static] |
Definition at line 5308 of file app_meetme.c.
References ast_mutex_lock(), ast_mutex_unlock(), sla, sla_hangup_stations(), and sla_ring_stations().
Referenced by sla_thread().
05309 { 05310 ast_mutex_lock(&sla.lock); 05311 sla_ring_stations(); 05312 ast_mutex_unlock(&sla.lock); 05313 05314 /* Find stations that shouldn't be ringing anymore. */ 05315 sla_hangup_stations(); 05316 }
| static void sla_hangup_stations | ( | void | ) | [static] |
Definition at line 5280 of file app_meetme.c.
References ast_dial_destroy(), ast_dial_join(), ast_free, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_mutex_lock(), ast_mutex_unlock(), sla_station::dial, sla, sla_ringing_station::station, sla_ringing_trunk::trunk, sla_trunk_ref::trunk, and sla_station::trunks.
Referenced by sla_handle_ringing_trunk_event().
05281 { 05282 struct sla_trunk_ref *trunk_ref; 05283 struct sla_ringing_station *ringing_station; 05284 05285 AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_stations, ringing_station, entry) { 05286 AST_LIST_TRAVERSE(&ringing_station->station->trunks, trunk_ref, entry) { 05287 struct sla_ringing_trunk *ringing_trunk; 05288 ast_mutex_lock(&sla.lock); 05289 AST_LIST_TRAVERSE(&sla.ringing_trunks, ringing_trunk, entry) { 05290 if (trunk_ref->trunk == ringing_trunk->trunk) 05291 break; 05292 } 05293 ast_mutex_unlock(&sla.lock); 05294 if (ringing_trunk) 05295 break; 05296 } 05297 if (!trunk_ref) { 05298 AST_LIST_REMOVE_CURRENT(entry); 05299 ast_dial_join(ringing_station->station->dial); 05300 ast_dial_destroy(ringing_station->station->dial); 05301 ringing_station->station->dial = NULL; 05302 ast_free(ringing_station); 05303 } 05304 } 05305 AST_LIST_TRAVERSE_SAFE_END 05306 }
| static const char* sla_hold_str | ( | unsigned int | hold_access | ) | [static] |
Definition at line 1488 of file app_meetme.c.
References SLA_HOLD_OPEN, and SLA_HOLD_PRIVATE.
Referenced by sla_show_stations(), and sla_show_trunks().
01489 { 01490 const char *hold = "Unknown"; 01491 01492 switch (hold_access) { 01493 case SLA_HOLD_OPEN: 01494 hold = "Open"; 01495 break; 01496 case SLA_HOLD_PRIVATE: 01497 hold = "Private"; 01498 default: 01499 break; 01500 } 01501 01502 return hold; 01503 }
| static int sla_load_config | ( | int | reload | ) | [static] |
Definition at line 6467 of file app_meetme.c.
References ast_category_browse(), ast_cond_init(), ast_config_destroy(), ast_config_load, AST_LIST_EMPTY, ast_log(), ast_mutex_init(), ast_pthread_create, AST_PTHREADT_NULL, ast_true(), ast_variable_retrieve(), CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEUNCHANGED, LOG_ERROR, LOG_WARNING, sla, sla_build_station(), sla_build_trunk(), SLA_CONFIG_FILE, sla_thread(), and type.
Referenced by load_config(), and sla_check_reload().
06468 { 06469 struct ast_config *cfg; 06470 struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; 06471 const char *cat = NULL; 06472 int res = 0; 06473 const char *val; 06474 06475 if (!reload) { 06476 ast_mutex_init(&sla.lock); 06477 ast_cond_init(&sla.cond, NULL); 06478 } 06479 06480 if (!(cfg = ast_config_load(SLA_CONFIG_FILE, config_flags))) { 06481 return 0; /* Treat no config as normal */ 06482 } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) { 06483 return 0; 06484 } else if (cfg == CONFIG_STATUS_FILEINVALID) { 06485 ast_log(LOG_ERROR, "Config file " SLA_CONFIG_FILE " is in an invalid format. Aborting.\n"); 06486 return 0; 06487 } 06488 06489 if ((val = ast_variable_retrieve(cfg, "general", "attemptcallerid"))) 06490 sla.attempt_callerid = ast_true(val); 06491 06492 while ((cat = ast_category_browse(cfg, cat)) && !res) { 06493 const char *type; 06494 if (!strcasecmp(cat, "general")) 06495 continue; 06496 if (!(type = ast_variable_retrieve(cfg, cat, "type"))) { 06497 ast_log(LOG_WARNING, "Invalid entry in %s defined with no type!\n", 06498 SLA_CONFIG_FILE); 06499 continue; 06500 } 06501 if (!strcasecmp(type, "trunk")) 06502 res = sla_build_trunk(cfg, cat); 06503 else if (!strcasecmp(type, "station")) 06504 res = sla_build_station(cfg, cat); 06505 else { 06506 ast_log(LOG_WARNING, "Entry in %s defined with invalid type '%s'!\n", 06507 SLA_CONFIG_FILE, type); 06508 } 06509 } 06510 06511 ast_config_destroy(cfg); 06512 06513 /* Even if we don't have any stations, we may after a reload and we need to 06514 * be able to process the SLA_EVENT_RELOAD event in that case */ 06515 if (sla.thread == AST_PTHREADT_NULL && (!AST_LIST_EMPTY(&sla_stations) || !AST_LIST_EMPTY(&sla_trunks))) { 06516 ast_pthread_create(&sla.thread, NULL, sla_thread, NULL); 06517 } 06518 06519 return res; 06520 }
| static int sla_process_timers | ( | struct timespec * | ts | ) | [static] |
Calculate the time until the next known event.
Definition at line 5496 of file app_meetme.c.
References ast_samp2tv(), ast_tvadd(), ast_tvnow(), sla_calc_station_delays(), sla_calc_station_timeouts(), sla_calc_trunk_timeouts(), SLA_EVENT_RINGING_TRUNK, and sla_queue_event_nolock().
Referenced by sla_thread().
05497 { 05498 unsigned int timeout = UINT_MAX; 05499 struct timeval wait; 05500 unsigned int change_made = 0; 05501 05502 /* Check for ring timeouts on ringing trunks */ 05503 if (sla_calc_trunk_timeouts(&timeout)) 05504 change_made = 1; 05505 05506 /* Check for ring timeouts on ringing stations */ 05507 if (sla_calc_station_timeouts(&timeout)) 05508 change_made = 1; 05509 05510 /* Check for station ring delays */ 05511 if (sla_calc_station_delays(&timeout)) 05512 change_made = 1; 05513 05514 /* queue reprocessing of ringing trunks */ 05515 if (change_made) 05516 sla_queue_event_nolock(SLA_EVENT_RINGING_TRUNK); 05517 05518 /* No timeout */ 05519 if (timeout == UINT_MAX) 05520 return 0; 05521 05522 if (ts) { 05523 wait = ast_tvadd(ast_tvnow(), ast_samp2tv(timeout, 1000)); 05524 ts->tv_sec = wait.tv_sec; 05525 ts->tv_nsec = wait.tv_usec * 1000; 05526 } 05527 05528 return 1; 05529 }
| static void sla_queue_event | ( | enum sla_event_type | type | ) | [static] |
Definition at line 1801 of file app_meetme.c.
References sla_queue_event_full().
Referenced by load_config(), queue_ringing_trunk(), sla_dial_state_callback(), sla_handle_dial_state_event(), sla_station_exec(), and sla_trunk_exec().
01802 { 01803 sla_queue_event_full(type, NULL, NULL, 1); 01804 }
| static void sla_queue_event_conf | ( | enum sla_event_type | type, | |
| struct ast_channel * | chan, | |||
| struct ast_conference * | conf | |||
| ) | [static] |
Queue a SLA event from the conference.
Definition at line 1807 of file app_meetme.c.
References ast_debug, AST_LIST_TRAVERSE, ast_log(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strdupa, ast_strlen_zero(), sla_trunk_ref::chan, ast_conference::confno, LOG_ERROR, sla_trunk::name, sla_queue_event_full(), strsep(), sla_trunk_ref::trunk, and sla_station::trunks.
Referenced by conf_run().
01809 { 01810 struct sla_station *station; 01811 struct sla_trunk_ref *trunk_ref = NULL; 01812 char *trunk_name; 01813 01814 trunk_name = ast_strdupa(conf->confno); 01815 strsep(&trunk_name, "_"); 01816 if (ast_strlen_zero(trunk_name)) { 01817 ast_log(LOG_ERROR, "Invalid conference name for SLA - '%s'!\n", conf->confno); 01818 return; 01819 } 01820 01821 AST_RWLIST_RDLOCK(&sla_stations); 01822 AST_RWLIST_TRAVERSE(&sla_stations, station, entry) { 01823 AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) { 01824 if (trunk_ref->chan == chan && !strcmp(trunk_ref->trunk->name, trunk_name)) 01825 break; 01826 } 01827 if (trunk_ref) 01828 break; 01829 } 01830 AST_RWLIST_UNLOCK(&sla_stations); 01831 01832 if (!trunk_ref) { 01833 ast_debug(1, "Trunk not found for event!\n"); 01834 return; 01835 } 01836 01837 sla_queue_event_full(type, trunk_ref, station, 1); 01838 }
| static void sla_queue_event_full | ( | enum sla_event_type | type, | |
| struct sla_trunk_ref * | trunk_ref, | |||
| struct sla_station * | station, | |||
| int | lock | |||
| ) | [static] |
Definition at line 1769 of file app_meetme.c.
References ast_calloc, ast_cond_signal(), AST_LIST_INSERT_TAIL, ast_mutex_lock(), ast_mutex_unlock(), AST_PTHREADT_NULL, and sla.
Referenced by sla_queue_event(), sla_queue_event_conf(), and sla_queue_event_nolock().
01771 { 01772 struct sla_event *event; 01773 01774 if (sla.thread == AST_PTHREADT_NULL) { 01775 return; 01776 } 01777 01778 if (!(event = ast_calloc(1, sizeof(*event)))) 01779 return; 01780 01781 event->type = type; 01782 event->trunk_ref = trunk_ref; 01783 event->station = station; 01784 01785 if (!lock) { 01786 AST_LIST_INSERT_TAIL(&sla.event_q, event, entry); 01787 return; 01788 } 01789 01790 ast_mutex_lock(&sla.lock); 01791 AST_LIST_INSERT_TAIL(&sla.event_q, event, entry); 01792 ast_cond_signal(&sla.cond); 01793 ast_mutex_unlock(&sla.lock); 01794 }
| static void sla_queue_event_nolock | ( | enum sla_event_type | type | ) | [static] |
Definition at line 1796 of file app_meetme.c.
References sla_queue_event_full().
Referenced by sla_process_timers().
01797 { 01798 sla_queue_event_full(type, NULL, NULL, 0); 01799 }
| static int sla_ring_station | ( | struct sla_ringing_trunk * | ringing_trunk, | |
| struct sla_station * | station | |||
| ) | [static] |
Ring a station.
Definition at line 5113 of file app_meetme.c.
References ast_calloc, ast_dial_append(), ast_dial_create(), ast_dial_destroy(), ast_dial_join(), AST_DIAL_RESULT_TRYING, ast_dial_run(), ast_dial_set_state_callback(), ast_free, AST_LIST_INSERT_HEAD, ast_strdup, ast_strdupa, ast_strlen_zero(), ast_tvnow(), sla_trunk::chan, ast_channel::cid, ast_callerid::cid_name, cid_name, ast_callerid::cid_num, cid_num, sla_station::device, sla_station::dial, sla_failed_station::last_try, sla, sla_create_ringing_station(), sla_dial_state_callback(), sla_failed_station::station, strsep(), and sla_ringing_trunk::trunk.
Referenced by sla_ring_stations().
05114 { 05115 char *tech, *tech_data; 05116 struct ast_dial *dial; 05117 struct sla_ringing_station *ringing_station; 05118 const char *cid_name = NULL, *cid_num = NULL; 05119 enum ast_dial_result res; 05120 05121 if (!(dial = ast_dial_create())) 05122 return -1; 05123 05124 ast_dial_set_state_callback(dial, sla_dial_state_callback); 05125 tech_data = ast_strdupa(station->device); 05126 tech = strsep(&tech_data, "/"); 05127 05128 if (ast_dial_append(dial, tech, tech_data) == -1) { 05129 ast_dial_destroy(dial); 05130 return -1; 05131 } 05132 05133 if (!sla.attempt_callerid && !ast_strlen_zero(ringing_trunk->trunk->chan->cid.cid_name)) { 05134 cid_name = ast_strdupa(ringing_trunk->trunk->chan->cid.cid_name); 05135 ast_free(ringing_trunk->trunk->chan->cid.cid_name); 05136 ringing_trunk->trunk->chan->cid.cid_name = NULL; 05137 } 05138 if (!sla.attempt_callerid && !ast_strlen_zero(ringing_trunk->trunk->chan->cid.cid_num)) { 05139 cid_num = ast_strdupa(ringing_trunk->trunk->chan->cid.cid_num); 05140 ast_free(ringing_trunk->trunk->chan->cid.cid_num); 05141 ringing_trunk->trunk->chan->cid.cid_num = NULL; 05142 } 05143 05144 res = ast_dial_run(dial, ringing_trunk->trunk->chan, 1); 05145 05146 if (cid_name) 05147 ringing_trunk->trunk->chan->cid.cid_name = ast_strdup(cid_name); 05148 if (cid_num) 05149 ringing_trunk->trunk->chan->cid.cid_num = ast_strdup(cid_num); 05150 05151 if (res != AST_DIAL_RESULT_TRYING) { 05152 struct sla_failed_station *failed_station; 05153 ast_dial_destroy(dial); 05154 if (!(failed_station = ast_calloc(1, sizeof(*failed_station)))) 05155 return -1; 05156 failed_station->station = station; 05157 failed_station->last_try = ast_tvnow(); 05158 AST_LIST_INSERT_HEAD(&sla.failed_stations, failed_station, entry); 05159 return -1; 05160 } 05161 if (!(ringing_station = sla_create_ringing_station(station))) { 05162 ast_dial_join(dial); 05163 ast_dial_destroy(dial); 05164 return -1; 05165 } 05166 05167 station->dial = dial; 05168 05169 AST_LIST_INSERT_HEAD(&sla.ringing_stations, ringing_station, entry); 05170 05171 return 0; 05172 }
| static void sla_ring_stations | ( | void | ) | [static] |
Ring stations based on current set of ringing trunks.
Definition at line 5239 of file app_meetme.c.
References AST_LIST_TRAVERSE, sla, sla_check_failed_station(), sla_check_inuse_station(), sla_check_ringing_station(), sla_check_station_delay(), sla_check_timed_out_station(), sla_ring_station(), sla_station_ref::station, sla_trunk::stations, and sla_ringing_trunk::trunk.
Referenced by sla_handle_ringing_trunk_event().
05240 { 05241 struct sla_station_ref *station_ref; 05242 struct sla_ringing_trunk *ringing_trunk; 05243 05244 /* Make sure that every station that uses at least one of the ringing 05245 * trunks, is ringing. */ 05246 AST_LIST_TRAVERSE(&sla.ringing_trunks, ringing_trunk, entry) { 05247 AST_LIST_TRAVERSE(&ringing_trunk->trunk->stations, station_ref, entry) { 05248 int time_left; 05249 05250 /* Is this station already ringing? */ 05251 if (sla_check_ringing_station(station_ref->station)) 05252 continue; 05253 05254 /* Is this station already in a call? */ 05255 if (sla_check_inuse_station(station_ref->station)) 05256 continue; 05257 05258 /* Did we fail to dial this station earlier? If so, has it been 05259 * a minute since we tried? */ 05260 if (sla_check_failed_station(station_ref->station)) 05261 continue; 05262 05263 /* If this station already timed out while this trunk was ringing, 05264 * do not dial it again for this ringing trunk. */ 05265 if (sla_check_timed_out_station(ringing_trunk, station_ref->station)) 05266 continue; 05267 05268 /* Check for a ring delay in progress */ 05269 time_left = sla_check_station_delay(station_ref->station, ringing_trunk); 05270 if (time_left != INT_MAX && time_left > 0) 05271 continue; 05272 05273 /* It is time to make this station begin to ring. Do it! */ 05274 sla_ring_station(ringing_trunk, station_ref->station); 05275 } 05276 } 05277 /* Now, all of the stations that should be ringing, are ringing. */ 05278 }
| static char* sla_show_stations | ( | struct ast_cli_entry * | e, | |
| int | cmd, | |||
| struct ast_cli_args * | a | |||
| ) | [static] |
Definition at line 1570 of file app_meetme.c.
References ast_cli(), AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, sla_station::autocontext, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, sla_station::device, ast_cli_args::fd, sla_station::hold_access, sla_trunk::name, sla_station::name, sla_trunk_ref::ring_delay, sla_station::ring_delay, sla_trunk_ref::ring_timeout, sla_station::ring_timeout, S_OR, sla_hold_str(), sla_trunk_ref::state, sla_trunk_ref::trunk, sla_station::trunks, trunkstate2str(), and ast_cli_entry::usage.
01571 { 01572 const struct sla_station *station; 01573 01574 switch (cmd) { 01575 case CLI_INIT: 01576 e->command = "sla show stations"; 01577 e->usage = 01578 "Usage: sla show stations\n" 01579 " This will list all stations defined in sla.conf\n"; 01580 return NULL; 01581 case CLI_GENERATE: 01582 return NULL; 01583 } 01584 01585 ast_cli(a->fd, "\n" 01586 "=============================================================\n" 01587 "=== Configured SLA Stations =================================\n" 01588 "=============================================================\n" 01589 "===\n"); 01590 AST_RWLIST_RDLOCK(&sla_stations); 01591 AST_RWLIST_TRAVERSE(&sla_stations, station, entry) { 01592 struct sla_trunk_ref *trunk_ref; 01593 char ring_timeout[16] = "(none)"; 01594 char ring_delay[16] = "(none)"; 01595 if (station->ring_timeout) { 01596 snprintf(ring_timeout, sizeof(ring_timeout), 01597 "%u", station->ring_timeout); 01598 } 01599 if (station->ring_delay) { 01600 snprintf(ring_delay, sizeof(ring_delay), 01601 "%u", station->ring_delay); 01602 } 01603 ast_cli(a->fd, "=== ---------------------------------------------------------\n" 01604 "=== Station Name: %s\n" 01605 "=== ==> Device: %s\n" 01606 "=== ==> AutoContext: %s\n" 01607 "=== ==> RingTimeout: %s\n" 01608 "=== ==> RingDelay: %s\n" 01609 "=== ==> HoldAccess: %s\n" 01610 "=== ==> Trunks ...\n", 01611 station->name, station->device, 01612 S_OR(station->autocontext, "(none)"), 01613 ring_timeout, ring_delay, 01614 sla_hold_str(station->hold_access)); 01615 AST_RWLIST_RDLOCK(&sla_trunks); 01616 AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) { 01617 if (trunk_ref->ring_timeout) { 01618 snprintf(ring_timeout, sizeof(ring_timeout), 01619 "%u", trunk_ref->ring_timeout); 01620 } else 01621 strcpy(ring_timeout, "(none)"); 01622 if (trunk_ref->ring_delay) { 01623 snprintf(ring_delay, sizeof(ring_delay), 01624 "%u", trunk_ref->ring_delay); 01625 } else 01626 strcpy(ring_delay, "(none)"); 01627 ast_cli(a->fd, "=== ==> Trunk Name: %s\n" 01628 "=== ==> State: %s\n" 01629 "=== ==> RingTimeout: %s\n" 01630 "=== ==> RingDelay: %s\n", 01631 trunk_ref->trunk->name, 01632 trunkstate2str(trunk_ref->state), 01633 ring_timeout, ring_delay); 01634 } 01635 AST_RWLIST_UNLOCK(&sla_trunks); 01636 ast_cli(a->fd, "=== ---------------------------------------------------------\n" 01637 "===\n"); 01638 } 01639 AST_RWLIST_UNLOCK(&sla_stations); 01640 ast_cli(a->fd, "============================================================\n" 01641 "\n"); 01642 01643 return CLI_SUCCESS; 01644 }
| static char* sla_show_trunks | ( | struct ast_cli_entry * | e, | |
| int | cmd, | |||
| struct ast_cli_args * | a | |||
| ) | [static] |
Definition at line 1505 of file app_meetme.c.
References ast_cli(), AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, sla_trunk::autocontext, sla_trunk::barge_disabled, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, sla_trunk::device, ast_cli_args::fd, sla_trunk::hold_access, sla_station::name, sla_trunk::name, sla_trunk::ring_timeout, S_OR, sla_hold_str(), sla_station_ref::station, sla_trunk::stations, and ast_cli_entry::usage.
01506 { 01507 const struct sla_trunk *trunk; 01508 01509 switch (cmd) { 01510 case CLI_INIT: 01511 e->command = "sla show trunks"; 01512 e->usage = 01513 "Usage: sla show trunks\n" 01514 " This will list all trunks defined in sla.conf\n"; 01515 return NULL; 01516 case CLI_GENERATE: 01517 return NULL; 01518 } 01519 01520 ast_cli(a->fd, "\n" 01521 "=============================================================\n" 01522 "=== Configured SLA Trunks ===================================\n" 01523 "=============================================================\n" 01524 "===\n"); 01525 AST_RWLIST_RDLOCK(&sla_trunks); 01526 AST_RWLIST_TRAVERSE(&sla_trunks, trunk, entry) { 01527 struct sla_station_ref *station_ref; 01528 char ring_timeout[16] = "(none)"; 01529 if (trunk->ring_timeout) 01530 snprintf(ring_timeout, sizeof(ring_timeout), "%u Seconds", trunk->ring_timeout); 01531 ast_cli(a->fd, "=== ---------------------------------------------------------\n" 01532 "=== Trunk Name: %s\n" 01533 "=== ==> Device: %s\n" 01534 "=== ==> AutoContext: %s\n" 01535 "=== ==> RingTimeout: %s\n" 01536 "=== ==> BargeAllowed: %s\n" 01537 "=== ==> HoldAccess: %s\n" 01538 "=== ==> Stations ...\n", 01539 trunk->name, trunk->device, 01540 S_OR(trunk->autocontext, "(none)"), 01541 ring_timeout, 01542 trunk->barge_disabled ? "No" : "Yes", 01543 sla_hold_str(trunk->hold_access)); 01544 AST_RWLIST_RDLOCK(&sla_stations); 01545 AST_LIST_TRAVERSE(&trunk->stations, station_ref, entry) 01546 ast_cli(a->fd, "=== ==> Station name: %s\n", station_ref->station->name); 01547 AST_RWLIST_UNLOCK(&sla_stations); 01548 ast_cli(a->fd, "=== ---------------------------------------------------------\n===\n"); 01549 } 01550 AST_RWLIST_UNLOCK(&sla_trunks); 01551 ast_cli(a->fd, "=============================================================\n\n"); 01552 01553 return CLI_SUCCESS; 01554 }
| static enum ast_device_state sla_state | ( | const char * | data | ) | [static] |
Definition at line 6105 of file app_meetme.c.
References AST_DEVICE_INVALID, AST_LIST_TRAVERSE, ast_log(), AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_strdupa, buf, LOG_ERROR, sla_trunk::name, sla_station::name, sla_state_to_devstate(), sla_trunk_ref::state, strsep(), sla_trunk_ref::trunk, and sla_station::trunks.
Referenced by load_module().
06106 { 06107 char *buf, *station_name, *trunk_name; 06108 struct sla_station *station; 06109 struct sla_trunk_ref *trunk_ref; 06110 enum ast_device_state res = AST_DEVICE_INVALID; 06111 06112 trunk_name = buf = ast_strdupa(data); 06113 station_name = strsep(&trunk_name, "_"); 06114 06115 AST_RWLIST_RDLOCK(&sla_stations); 06116 AST_LIST_TRAVERSE(&sla_stations, station, entry) { 06117 if (strcasecmp(station_name, station->name)) 06118 continue; 06119 AST_RWLIST_RDLOCK(&sla_trunks); 06120 AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) { 06121 if (!strcasecmp(trunk_name, trunk_ref->trunk->name)) 06122 break; 06123 } 06124 if (!trunk_ref) { 06125 AST_RWLIST_UNLOCK(&sla_trunks); 06126 break; 06127 } 06128 res = sla_state_to_devstate(trunk_ref->state); 06129 AST_RWLIST_UNLOCK(&sla_trunks); 06130 } 06131 AST_RWLIST_UNLOCK(&sla_stations); 06132 06133 if (res == AST_DEVICE_INVALID) { 06134 ast_log(LOG_ERROR, "Could not determine state for trunk %s on station %s!\n", 06135 trunk_name, station_name); 06136 } 06137 06138 return res; 06139 }
| static enum ast_device_state sla_state_to_devstate | ( | enum sla_trunk_state | state | ) | [static] |
Definition at line 4793 of file app_meetme.c.
References AST_DEVICE_INUSE, AST_DEVICE_NOT_INUSE, AST_DEVICE_ONHOLD, AST_DEVICE_RINGING, AST_DEVICE_UNKNOWN, SLA_TRUNK_STATE_IDLE, SLA_TRUNK_STATE_ONHOLD, SLA_TRUNK_STATE_ONHOLD_BYME, SLA_TRUNK_STATE_RINGING, and SLA_TRUNK_STATE_UP.
Referenced by sla_change_trunk_state(), and sla_state().
04794 { 04795 switch (state) { 04796 case SLA_TRUNK_STATE_IDLE: 04797 return AST_DEVICE_NOT_INUSE; 04798 case SLA_TRUNK_STATE_RINGING: 04799 return AST_DEVICE_RINGING; 04800 case SLA_TRUNK_STATE_UP: 04801 return AST_DEVICE_INUSE; 04802 case SLA_TRUNK_STATE_ONHOLD: 04803 case SLA_TRUNK_STATE_ONHOLD_BYME: 04804 return AST_DEVICE_ONHOLD; 04805 } 04806 04807 return AST_DEVICE_UNKNOWN; 04808 }
| static int sla_station_exec | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 5784 of file app_meetme.c.
References sla_trunk::active_stations, admin_exec(), ALL_TRUNK_REFS, answer_trunk_chan(), ast_answer(), ast_atomic_dec_and_test(), ast_atomic_fetchadd_int(), ast_autoservice_start(), ast_autoservice_stop(), ast_cond_destroy(), ast_cond_init(), ast_cond_wait(), AST_CONTROL_UNHOLD, ast_debug, AST_DEVICE_INUSE, ast_devstate_changed(), ast_indicate(), AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_log(), ast_mutex_destroy(), ast_mutex_init(), ast_mutex_lock(), ast_mutex_unlock(), ast_pthread_create_detached_background, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_set_flag, ast_strdupa, ast_strlen_zero(), build_conf(), sla_trunk_ref::chan, sla_trunk::chan, conf_run(), CONFFLAG_MARKEDEXIT, CONFFLAG_PASS_DTMF, CONFFLAG_QUIET, CONFFLAG_SLA_STATION, dial_trunk(), dispose_conf(), ast_flags::flags, free, sla_trunk::hold_stations, LOG_NOTICE, LOG_WARNING, MAX_CONFNUM, sla_trunk::name, sla_station::name, sla_trunk::on_hold, pbx_builtin_setvar_helper(), sla_station::ref_count, sla, sla_change_trunk_state(), sla_choose_idle_trunk(), SLA_EVENT_CHECK_RELOAD, SLA_EVENT_DIAL_STATE, SLA_EVENT_RINGING_TRUNK, sla_find_station(), sla_find_trunk_ref_byname(), sla_queue_event(), SLA_TRUNK_STATE_IDLE, SLA_TRUNK_STATE_ONHOLD_BYME, SLA_TRUNK_STATE_RINGING, SLA_TRUNK_STATE_UP, sla_trunk_ref::state, strsep(), sla_ringing_trunk::trunk, sla_trunk_ref::trunk, and dial_trunk_args::trunk_ref.
Referenced by load_module().
05785 { 05786 char *station_name, *trunk_name; 05787 struct sla_station *station; 05788 struct sla_trunk_ref *trunk_ref = NULL; 05789 char conf_name[MAX_CONFNUM]; 05790 struct ast_flags conf_flags = { 0 }; 05791 struct ast_conference *conf; 05792 05793 if (ast_strlen_zero(data)) { 05794 ast_log(LOG_WARNING, "Invalid Arguments to SLAStation!\n"); 05795 pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "FAILURE"); 05796 return 0; 05797 } 05798 05799 trunk_name = ast_strdupa(data); 05800 station_name = strsep(&trunk_name, "_"); 05801 05802 if (ast_strlen_zero(station_name)) { 05803 ast_log(LOG_WARNING, "Invalid Arguments to SLAStation!\n"); 05804 pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "FAILURE"); 05805 return 0; 05806 } 05807 05808 AST_RWLIST_RDLOCK(&sla_stations); 05809 station = sla_find_station(station_name); 05810 if (station) 05811 ast_atomic_fetchadd_int((int *) &station->ref_count, 1); 05812 AST_RWLIST_UNLOCK(&sla_stations); 05813 05814 if (!station) { 05815 ast_log(LOG_WARNING, "Station '%s' not found!\n", station_name); 05816 pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "FAILURE"); 05817 sla_queue_event(SLA_EVENT_CHECK_RELOAD); 05818 return 0; 05819 } 05820 05821 AST_RWLIST_RDLOCK(&sla_trunks); 05822 if (!ast_strlen_zero(trunk_name)) { 05823 trunk_ref = sla_find_trunk_ref_byname(station, trunk_name); 05824 } else 05825 trunk_ref = sla_choose_idle_trunk(station); 05826 AST_RWLIST_UNLOCK(&sla_trunks); 05827 05828 if (!trunk_ref) { 05829 if (ast_strlen_zero(trunk_name)) 05830 ast_log(LOG_NOTICE, "No trunks available for call.\n"); 05831 else { 05832 ast_log(LOG_NOTICE, "Can't join existing call on trunk " 05833 "'%s' due to access controls.\n", trunk_name); 05834 } 05835 pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "CONGESTION"); 05836 ast_atomic_fetchadd_int((int *) &station->ref_count, -1); 05837 sla_queue_event(SLA_EVENT_CHECK_RELOAD); 05838 return 0; 05839 } 05840 05841 if (trunk_ref->state == SLA_TRUNK_STATE_ONHOLD_BYME) { 05842 if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->hold_stations) == 1) 05843 sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL); 05844 else { 05845 trunk_ref->state = SLA_TRUNK_STATE_UP; 05846 ast_devstate_changed(AST_DEVICE_INUSE, 05847 "SLA:%s_%s", station->name, trunk_ref->trunk->name); 05848 } 05849 } else if (trunk_ref->state == SLA_TRUNK_STATE_RINGING) { 05850 struct sla_ringing_trunk *ringing_trunk; 05851 05852 ast_mutex_lock(&sla.lock); 05853 AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_trunks, ringing_trunk, entry) { 05854 if (ringing_trunk->trunk == trunk_ref->trunk) { 05855 AST_LIST_REMOVE_CURRENT(entry); 05856 break; 05857 } 05858 } 05859 AST_LIST_TRAVERSE_SAFE_END 05860 ast_mutex_unlock(&sla.lock); 05861 05862 if (ringing_trunk) { 05863 answer_trunk_chan(ringing_trunk->trunk->chan); 05864 sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL); 05865 05866 free(ringing_trunk); 05867 05868 /* Queue up reprocessing ringing trunks, and then ringing stations again */ 05869 sla_queue_event(SLA_EVENT_RINGING_TRUNK); 05870 sla_queue_event(SLA_EVENT_DIAL_STATE); 05871 } 05872 } 05873 05874 trunk_ref->chan = chan; 05875 05876 if (!trunk_ref->trunk->chan) { 05877 ast_mutex_t cond_lock; 05878 ast_cond_t cond; 05879 pthread_t dont_care; 05880 struct dial_trunk_args args = { 05881 .trunk_ref = trunk_ref, 05882 .station = station, 05883 .cond_lock = &cond_lock, 05884 .cond = &cond, 05885 }; 05886 sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL); 05887 /* Create a thread to dial the trunk and dump it into the conference. 05888 * However, we want to wait until the trunk has been dialed and the 05889 * conference is created before continuing on here. */ 05890 ast_autoservice_start(chan); 05891 ast_mutex_init(&cond_lock); 05892 ast_cond_init(&cond, NULL); 05893 ast_mutex_lock(&cond_lock); 05894 ast_pthread_create_detached_background(&dont_care, NULL, dial_trunk, &args); 05895 ast_cond_wait(&cond, &cond_lock); 05896 ast_mutex_unlock(&cond_lock); 05897 ast_mutex_destroy(&cond_lock); 05898 ast_cond_destroy(&cond); 05899 ast_autoservice_stop(chan); 05900 if (!trunk_ref->trunk->chan) { 05901 ast_debug(1, "Trunk didn't get created. chan: %lx\n", (long) trunk_ref->trunk->chan); 05902 pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "CONGESTION"); 05903 sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL); 05904 trunk_ref->chan = NULL; 05905 ast_atomic_fetchadd_int((int *) &station->ref_count, -1); 05906 sla_queue_event(SLA_EVENT_CHECK_RELOAD); 05907 return 0; 05908 } 05909 } 05910 05911 if (ast_atomic_fetchadd_int((int *) &trunk_ref->trunk->active_stations, 1) == 0 && 05912 trunk_ref->trunk->on_hold) { 05913 trunk_ref->trunk->on_hold = 0; 05914 ast_indicate(trunk_ref->trunk->chan, AST_CONTROL_UNHOLD); 05915 sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL); 05916 } 05917 05918 snprintf(conf_name, sizeof(conf_name), "SLA_%s", trunk_ref->trunk->name); 05919 ast_set_flag(&conf_flags, 05920 CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_PASS_DTMF | CONFFLAG_SLA_STATION); 05921 ast_answer(chan); 05922 conf = build_conf(conf_name, "", "", 0, 0, 1, chan); 05923 if (conf) { 05924 conf_run(chan, conf, conf_flags.flags, NULL); 05925 dispose_conf(conf); 05926 conf = NULL; 05927 } 05928 trunk_ref->chan = NULL; 05929 if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->active_stations) && 05930 trunk_ref->state != SLA_TRUNK_STATE_ONHOLD_BYME) { 05931 strncat(conf_name, ",K", sizeof(conf_name) - strlen(conf_name) - 1); 05932 admin_exec(NULL, conf_name); 05933 trunk_ref->trunk->hold_stations = 0; 05934 sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL); 05935 } 05936 05937 pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "SUCCESS"); 05938 05939 ast_atomic_fetchadd_int((int *) &station->ref_count, -1); 05940 sla_queue_event(SLA_EVENT_CHECK_RELOAD); 05941 05942 return 0; 05943 }
| static void sla_stop_ringing_station | ( | struct sla_ringing_station * | ringing_station, | |
| enum sla_station_hangup | hangup | |||
| ) | [static] |
Definition at line 4903 of file app_meetme.c.
References ast_dial_destroy(), ast_dial_join(), ast_free, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, sla_station::dial, sla, sla_create_station_ref(), SLA_STATION_HANGUP_NORMAL, sla_ringing_station::station, sla_ringing_trunk::timed_out_stations, sla_trunk_ref::trunk, sla_ringing_trunk::trunk, and sla_station::trunks.
Referenced by sla_calc_station_timeouts(), and sla_handle_dial_state_event().
04905 { 04906 struct sla_ringing_trunk *ringing_trunk; 04907 struct sla_trunk_ref *trunk_ref; 04908 struct sla_station_ref *station_ref; 04909 04910 ast_dial_join(ringing_station->station->dial); 04911 ast_dial_destroy(ringing_station->station->dial); 04912 ringing_station->station->dial = NULL; 04913 04914 if (hangup == SLA_STATION_HANGUP_NORMAL) 04915 goto done; 04916 04917 /* If the station is being hung up because of a timeout, then add it to the 04918 * list of timed out stations on each of the ringing trunks. This is so 04919 * that when doing further processing to figure out which stations should be 04920 * ringing, which trunk to answer, determining timeouts, etc., we know which 04921 * ringing trunks we should ignore. */ 04922 AST_LIST_TRAVERSE(&sla.ringing_trunks, ringing_trunk, entry) { 04923 AST_LIST_TRAVERSE(&ringing_station->station->trunks, trunk_ref, entry) { 04924 if (ringing_trunk->trunk == trunk_ref->trunk) 04925 break; 04926 } 04927 if (!trunk_ref) 04928 continue; 04929 if (!(station_ref = sla_create_station_ref(ringing_station->station))) 04930 continue; 04931 AST_LIST_INSERT_TAIL(&ringing_trunk->timed_out_stations, station_ref, entry); 04932 } 04933 04934 done: 04935 ast_free(ringing_station); 04936 }
| static void sla_stop_ringing_trunk | ( | struct sla_ringing_trunk * | ringing_trunk | ) | [static] |
Definition at line 4888 of file app_meetme.c.
References admin_exec(), ALL_TRUNK_REFS, ast_free, AST_LIST_REMOVE_HEAD, buf, sla_trunk::name, sla_change_trunk_state(), SLA_TRUNK_STATE_IDLE, sla_ringing_trunk::timed_out_stations, and sla_ringing_trunk::trunk.
Referenced by sla_calc_trunk_timeouts().
04889 { 04890 char buf[80]; 04891 struct sla_station_ref *station_ref; 04892 04893 snprintf(buf, sizeof(buf), "SLA_%s,K", ringing_trunk->trunk->name); 04894 admin_exec(NULL, buf); 04895 sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL); 04896 04897 while ((station_ref = AST_LIST_REMOVE_HEAD(&ringing_trunk->timed_out_stations, entry))) 04898 ast_free(station_ref); 04899 04900 ast_free(ringing_trunk); 04901 }
| static void* sla_thread | ( | void * | data | ) | [static] |
Definition at line 5589 of file app_meetme.c.
References ast_cond_timedwait(), ast_cond_wait(), ast_free, AST_LIST_EMPTY, AST_LIST_REMOVE_HEAD, ast_mutex_lock(), ast_mutex_unlock(), sla, sla_check_reload(), SLA_EVENT_CHECK_RELOAD, SLA_EVENT_DIAL_STATE, SLA_EVENT_HOLD, SLA_EVENT_RELOAD, SLA_EVENT_RINGING_TRUNK, sla_handle_dial_state_event(), sla_handle_hold_event(), sla_handle_ringing_trunk_event(), sla_process_timers(), and sla_event::type.
Referenced by sla_load_config().
05590 { 05591 struct sla_failed_station *failed_station; 05592 struct sla_ringing_station *ringing_station; 05593 05594 ast_mutex_lock(&sla.lock); 05595 05596 while (!sla.stop) { 05597 struct sla_event *event; 05598 struct timespec ts = { 0, }; 05599 unsigned int have_timeout = 0; 05600 05601 if (AST_LIST_EMPTY(&sla.event_q)) { 05602 if ((have_timeout = sla_process_timers(&ts))) 05603 ast_cond_timedwait(&sla.cond, &sla.lock, &ts); 05604 else 05605 ast_cond_wait(&sla.cond, &sla.lock); 05606 if (sla.stop) 05607 break; 05608 } 05609 05610 if (have_timeout) 05611 sla_process_timers(NULL); 05612 05613 while ((event = AST_LIST_REMOVE_HEAD(&sla.event_q, entry))) { 05614 ast_mutex_unlock(&sla.lock); 05615 switch (event->type) { 05616 case SLA_EVENT_HOLD: 05617 sla_handle_hold_event(event); 05618 break; 05619 case SLA_EVENT_DIAL_STATE: 05620 sla_handle_dial_state_event(); 05621 break; 05622 case SLA_EVENT_RINGING_TRUNK: 05623 sla_handle_ringing_trunk_event(); 05624 break; 05625 case SLA_EVENT_RELOAD: 05626 sla.reload = 1; 05627 case SLA_EVENT_CHECK_RELOAD: 05628 break; 05629 } 05630 ast_free(event); 05631 ast_mutex_lock(&sla.lock); 05632 } 05633 05634 if (sla.reload) { 05635 sla_check_reload(); 05636 } 05637 } 05638 05639 ast_mutex_unlock(&sla.lock); 05640 05641 while ((ringing_station = AST_LIST_REMOVE_HEAD(&sla.ringing_stations, entry))) 05642 ast_free(ringing_station); 05643 05644 while ((failed_station = AST_LIST_REMOVE_HEAD(&sla.failed_stations, entry))) 05645 ast_free(failed_station); 05646 05647 return NULL; 05648 }
| static int sla_trunk_exec | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 5991 of file app_meetme.c.
References ALL_TRUNK_REFS, AST_APP_ARG, ast_app_parse_options(), ast_atomic_fetchadd_int(), AST_CONTROL_RINGING, AST_DECLARE_APP_ARGS, ast_free, ast_indicate(), AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_log(), ast_mutex_lock(), ast_mutex_unlock(), AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_set_flag, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_test_flag, build_conf(), sla_trunk::chan, conf_run(), CONFFLAG_MARKEDEXIT, CONFFLAG_MARKEDUSER, CONFFLAG_MOH, CONFFLAG_NO_AUDIO_UNTIL_UP, CONFFLAG_PASS_DTMF, CONFFLAG_QUIET, dispose_conf(), ast_flags::flags, LOG_ERROR, MAX_CONFNUM, sla_trunk::on_hold, OPT_ARG_ARRAY_SIZE, OPT_ARG_MOH_CLASS, parse(), pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), queue_ringing_trunk(), sla_trunk::ref_count, sla, sla_change_trunk_state(), SLA_EVENT_CHECK_RELOAD, SLA_EVENT_RINGING_TRUNK, sla_find_trunk(), sla_queue_event(), SLA_TRUNK_OPT_ARG_ARRAY_SIZE, SLA_TRUNK_OPT_ARG_MOH_CLASS, SLA_TRUNK_OPT_MOH, sla_trunk_opts, SLA_TRUNK_STATE_IDLE, and sla_ringing_trunk::trunk.
Referenced by load_module().
05992 { 05993 char conf_name[MAX_CONFNUM]; 05994 struct ast_conference *conf; 05995 struct ast_flags conf_flags = { 0 }; 05996 struct sla_trunk *trunk; 05997 struct sla_ringing_trunk *ringing_trunk; 05998 AST_DECLARE_APP_ARGS(args, 05999 AST_APP_ARG(trunk_name); 06000 AST_APP_ARG(options); 06001 ); 06002 char *opts[SLA_TRUNK_OPT_ARG_ARRAY_SIZE] = { NULL, }; 06003 char *conf_opt_args[OPT_ARG_ARRAY_SIZE] = { NULL, }; 06004 struct ast_flags opt_flags = { 0 }; 06005 char *parse; 06006 06007 if (ast_strlen_zero(data)) { 06008 ast_log(LOG_ERROR, "The SLATrunk application requires an argument, the trunk name\n"); 06009 return -1; 06010 } 06011 06012 parse = ast_strdupa(data); 06013 AST_STANDARD_APP_ARGS(args, parse); 06014 if (args.argc == 2) { 06015 if (ast_app_parse_options(sla_trunk_opts, &opt_flags, opts, args.options)) { 06016 ast_log(LOG_ERROR, "Error parsing options for SLATrunk\n"); 06017 return -1; 06018 } 06019 } 06020 06021 AST_RWLIST_RDLOCK(&sla_trunks); 06022 trunk = sla_find_trunk(args.trunk_name); 06023 if (trunk) 06024 ast_atomic_fetchadd_int((int *) &trunk->ref_count, 1); 06025 AST_RWLIST_UNLOCK(&sla_trunks); 06026 06027 if (!trunk) { 06028 ast_log(LOG_ERROR, "SLA Trunk '%s' not found!\n", args.trunk_name); 06029 pbx_builtin_setvar_helper(chan, "SLATRUNK_STATUS", "FAILURE"); 06030 sla_queue_event(SLA_EVENT_CHECK_RELOAD); 06031 return 0; 06032 } 06033 06034 if (trunk->chan) { 06035 ast_log(LOG_ERROR, "Call came in on %s, but the trunk is already in use!\n", 06036 args.trunk_name); 06037 pbx_builtin_setvar_helper(chan, "SLATRUNK_STATUS", "FAILURE"); 06038 ast_atomic_fetchadd_int((int *) &trunk->ref_count, -1); 06039 sla_queue_event(SLA_EVENT_CHECK_RELOAD); 06040 return 0; 06041 } 06042 06043 trunk->chan = chan; 06044 06045 if (!(ringing_trunk = queue_ringing_trunk(trunk))) { 06046 pbx_builtin_setvar_helper(chan, "SLATRUNK_STATUS", "FAILURE"); 06047 ast_atomic_fetchadd_int((int *) &trunk->ref_count, -1); 06048 sla_queue_event(SLA_EVENT_CHECK_RELOAD); 06049 return 0; 06050 } 06051 06052 snprintf(conf_name, sizeof(conf_name), "SLA_%s", args.trunk_name); 06053 conf = build_conf(conf_name, "", "", 1, 1, 1, chan); 06054 if (!conf) { 06055 pbx_builtin_setvar_helper(chan, "SLATRUNK_STATUS", "FAILURE"); 06056 ast_atomic_fetchadd_int((int *) &trunk->ref_count, -1); 06057 sla_queue_event(SLA_EVENT_CHECK_RELOAD); 06058 return 0; 06059 } 06060 ast_set_flag(&conf_flags, 06061 CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_MARKEDUSER | CONFFLAG_PASS_DTMF | CONFFLAG_NO_AUDIO_UNTIL_UP); 06062 06063 if (ast_test_flag(&opt_flags, SLA_TRUNK_OPT_MOH)) { 06064 ast_indicate(chan, -1); 06065 ast_set_flag(&conf_flags, CONFFLAG_MOH); 06066 conf_opt_args[OPT_ARG_MOH_CLASS] = opts[SLA_TRUNK_OPT_ARG_MOH_CLASS]; 06067 } else 06068 ast_indicate(chan, AST_CONTROL_RINGING); 06069 06070 conf_run(chan, conf, conf_flags.flags, opts); 06071 dispose_conf(conf); 06072 conf = NULL; 06073 trunk->chan = NULL; 06074 trunk->on_hold = 0; 06075 06076 sla_change_trunk_state(trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL); 06077 06078 if (!pbx_builtin_getvar_helper(chan, "SLATRUNK_STATUS")) 06079 pbx_builtin_setvar_helper(chan, "SLATRUNK_STATUS", "SUCCESS"); 06080 06081 /* Remove the entry from the list of ringing trunks if it is still there. */ 06082 ast_mutex_lock(&sla.lock); 06083 AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_trunks, ringing_trunk, entry) { 06084 if (ringing_trunk->trunk == trunk) { 06085 AST_LIST_REMOVE_CURRENT(entry); 06086 break; 06087 } 06088 } 06089 AST_LIST_TRAVERSE_SAFE_END; 06090 ast_mutex_unlock(&sla.lock); 06091 if (ringing_trunk) { 06092 ast_free(ringing_trunk); 06093 pbx_builtin_setvar_helper(chan, "SLATRUNK_STATUS", "UNANSWERED"); 06094 /* Queue reprocessing of ringing trunks to make stations stop ringing 06095 * that shouldn't be ringing after this trunk stopped. */ 06096 sla_queue_event(SLA_EVENT_RINGING_TRUNK); 06097 } 06098 06099 ast_atomic_fetchadd_int((int *) &trunk->ref_count, -1); 06100 sla_queue_event(SLA_EVENT_CHECK_RELOAD); 06101 06102 return 0; 06103 }
| static const char* trunkstate2str | ( | enum sla_trunk_state | state | ) | [static] |
Definition at line 1556 of file app_meetme.c.
References S, SLA_TRUNK_STATE_IDLE, SLA_TRUNK_STATE_ONHOLD, SLA_TRUNK_STATE_ONHOLD_BYME, SLA_TRUNK_STATE_RINGING, and SLA_TRUNK_STATE_UP.
Referenced by sla_show_stations().
01557 { 01558 #define S(e) case e: return # e; 01559 switch (state) { 01560 S(SLA_TRUNK_STATE_IDLE) 01561 S(SLA_TRUNK_STATE_RINGING) 01562 S(SLA_TRUNK_STATE_UP) 01563 S(SLA_TRUNK_STATE_ONHOLD) 01564 S(SLA_TRUNK_STATE_ONHOLD_BYME) 01565 } 01566 return "Uknown State"; 01567 #undef S 01568 }
| static void tweak_listen_volume | ( | struct ast_conf_user * | user, | |
| enum volume_action | action | |||
| ) | [static] |
Definition at line 993 of file app_meetme.c.
References volume::actual, volume::desired, ast_conf_user::listen, set_listen_volume(), and tweak_volume().
Referenced by admin_exec(), conf_run(), user_listen_voldown_cb(), and user_listen_volup_cb().
00994 { 00995 tweak_volume(&user->listen, action); 00996 /* attempt to make the adjustment in the channel driver; 00997 if successful, don't adjust in the frame reading routine 00998 */ 00999 if (!set_listen_volume(user, user->listen.desired)) 01000 user->listen.actual = 0; 01001 else 01002 user->listen.actual = user->listen.desired; 01003 }
| static void tweak_talk_volume | ( | struct ast_conf_user * | user, | |
| enum volume_action | action | |||
| ) | [static] |
Definition at line 981 of file app_meetme.c.
References volume::actual, volume::desired, set_talk_volume(), ast_conf_user::talk, and tweak_volume().
Referenced by admin_exec(), conf_run(), user_talk_voldown_cb(), and user_talk_volup_cb().
00982 { 00983 tweak_volume(&user->talk, action); 00984 /* attempt to make the adjustment in the channel driver; 00985 if successful, don't adjust in the frame reading routine 00986 */ 00987 if (!set_talk_volume(user, user->talk.desired)) 00988 user->talk.actual = 0; 00989 else 00990 user->talk.actual = user->talk.desired; 00991 }
| static void tweak_volume | ( | struct volume * | vol, | |
| enum volume_action | action | |||
| ) | [static] |
Definition at line 946 of file app_meetme.c.
References volume::desired, VOL_DOWN, and VOL_UP.
Referenced by tweak_listen_volume(), and tweak_talk_volume().
00947 { 00948 switch (action) { 00949 case VOL_UP: 00950 switch (vol->desired) { 00951 case 5: 00952 break; 00953 case 0: 00954 vol->desired = 2; 00955 break; 00956 case -2: 00957 vol->desired = 0; 00958 break; 00959 default: 00960 vol->desired++; 00961 break; 00962 } 00963 break; 00964 case VOL_DOWN: 00965 switch (vol->desired) { 00966 case -5: 00967 break; 00968 case 2: 00969 vol->desired = 0; 00970 break; 00971 case 0: 00972 vol->desired = -2; 00973 break; 00974 default: 00975 vol->desired--; 00976 break; 00977 } 00978 } 00979 }
| static int unload_module | ( | void | ) | [static] |
Definition at line 6620 of file app_meetme.c.
References ARRAY_LEN, ast_cli_unregister_multiple(), ast_custom_function_unregister(), ast_devstate_prov_del(), ast_manager_unregister(), ast_unload_realtime(), ast_unregister_application(), and sla_destroy().
06621 { 06622 int res = 0; 06623 06624 ast_cli_unregister_multiple(cli_meetme, ARRAY_LEN(cli_meetme)); 06625 res = ast_manager_unregister("MeetmeMute"); 06626 res |= ast_manager_unregister("MeetmeUnmute"); 06627 res |= ast_manager_unregister("MeetmeList"); 06628 res |= ast_unregister_application(app4); 06629 res |= ast_unregister_application(app3); 06630 res |= ast_unregister_application(app2); 06631 res |= ast_unregister_application(app); 06632 res |= ast_unregister_application(slastation_app); 06633 res |= ast_unregister_application(slatrunk_app); 06634 06635 ast_devstate_prov_del("Meetme"); 06636 ast_devstate_prov_del("SLA"); 06637 06638 sla_destroy(); 06639 06640 res |= ast_custom_function_unregister(&meetme_info_acf); 06641 ast_unload_realtime("meetme"); 06642 06643 return res; 06644 }
| static int user_chan_cb | ( | void * | obj, | |
| void * | args, | |||
| int | flags | |||
| ) | [static] |
Definition at line 4158 of file app_meetme.c.
References ast_conf_user::chan, CMP_MATCH, CMP_STOP, and ast_channel::name.
Referenced by channel_admin_exec().
04159 { 04160 struct ast_conf_user *user = obj; 04161 const char *channel = args; 04162 04163 if (!strcmp(user->chan->name, channel)) { 04164 return (CMP_MATCH | CMP_STOP); 04165 } 04166 04167 return 0; 04168 }
| static int user_listen_voldown_cb | ( | void * | obj, | |
| void * | unused, | |||
| int | flags | |||
| ) | [static] |
Definition at line 4130 of file app_meetme.c.
References tweak_listen_volume(), and VOL_DOWN.
Referenced by admin_exec().
04131 { 04132 struct ast_conf_user *user = obj; 04133 tweak_listen_volume(user, VOL_DOWN); 04134 return 0; 04135 }
| static int user_listen_volup_cb | ( | void * | obj, | |
| void * | unused, | |||
| int | flags | |||
| ) | [static] |
Definition at line 4123 of file app_meetme.c.
References tweak_listen_volume(), and VOL_UP.
Referenced by admin_exec().
04124 { 04125 struct ast_conf_user *user = obj; 04126 tweak_listen_volume(user, VOL_UP); 04127 return 0; 04128 }
| static int user_max_cmp | ( | void * | obj, | |
| void * | arg, | |||
| int | flags | |||
| ) | [static] |
Definition at line 1059 of file app_meetme.c.
References ast_conf_user::user_no.
Referenced by admin_exec(), and conf_run().
01060 { 01061 struct ast_conf_user *user = obj; 01062 int *max_no = arg; 01063 01064 if (user->user_no > *max_no) { 01065 *max_no = user->user_no; 01066 } 01067 01068 return 0; 01069 }
| static int user_no_cmp | ( | void * | obj, | |
| void * | arg, | |||
| int | flags | |||
| ) | [static] |
Definition at line 1047 of file app_meetme.c.
References CMP_MATCH, CMP_STOP, and ast_conf_user::user_no.
Referenced by build_conf().
01048 { 01049 struct ast_conf_user *user = obj; 01050 int *user_no = arg; 01051 01052 if (user->user_no == *user_no) { 01053 return (CMP_MATCH | CMP_STOP); 01054 } 01055 01056 return 0; 01057 }
| static int user_reset_vol_cb | ( | void * | obj, | |
| void * | unused, | |||
| int | flags | |||
| ) | [static] |
Definition at line 4151 of file app_meetme.c.
References reset_volumes().
Referenced by admin_exec().
04152 { 04153 struct ast_conf_user *user = obj; 04154 reset_volumes(user); 04155 return 0; 04156 }
| static int user_set_kickme_cb | ( | void * | obj, | |
| void * | unused, | |||
| int | flags | |||
| ) | [static] |
Definition at line 4100 of file app_meetme.c.
References ADMINFLAG_KICKME, and ast_conf_user::adminflags.
Referenced by admin_exec().
04101 { 04102 struct ast_conf_user *user = obj; 04103 user->adminflags |= ADMINFLAG_KICKME; 04104 return 0; 04105 }
| static int user_set_muted_cb | ( | void * | obj, | |
| void * | unused, | |||
| int | flags | |||
| ) | [static] |
Definition at line 4107 of file app_meetme.c.
References ADMINFLAG_MUTED, ast_conf_user::adminflags, CONFFLAG_ADMIN, and ast_conf_user::userflags.
Referenced by admin_exec().
04108 { 04109 struct ast_conf_user *user = obj; 04110 if (!(user->userflags & CONFFLAG_ADMIN)) { 04111 user->adminflags |= ADMINFLAG_MUTED; 04112 } 04113 return 0; 04114 }
| static int user_set_unmuted_cb | ( | void * | obj, | |
| void * | unused, | |||
| int | flags | |||
| ) | [static] |
Definition at line 4116 of file app_meetme.c.
References ADMINFLAG_MUTED, ADMINFLAG_SELFMUTED, and ast_conf_user::adminflags.
Referenced by admin_exec().
04117 { 04118 struct ast_conf_user *user = obj; 04119 user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED); 04120 return 0; 04121 }
| static int user_talk_voldown_cb | ( | void * | obj, | |
| void * | unused, | |||
| int | flags | |||
| ) | [static] |
Definition at line 4144 of file app_meetme.c.
References tweak_talk_volume(), and VOL_DOWN.
Referenced by admin_exec().
04145 { 04146 struct ast_conf_user *user = obj; 04147 tweak_talk_volume(user, VOL_DOWN); 04148 return 0; 04149 }
| static int user_talk_volup_cb | ( | void * | obj, | |
| void * | unused, | |||
| int | flags | |||
| ) | [static] |
Definition at line 4137 of file app_meetme.c.
References tweak_talk_volume(), and VOL_UP.
Referenced by admin_exec().
04138 { 04139 struct ast_conf_user *user = obj; 04140 tweak_talk_volume(user, VOL_UP); 04141 return 0; 04142 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "MeetMe conference bridge" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .reload = reload, } [static] |
Definition at line 6685 of file app_meetme.c.
const char* app = "MeetMe" [static] |
Definition at line 568 of file app_meetme.c.
const char* app2 = "MeetMeCount" [static] |
Definition at line 569 of file app_meetme.c.
const char* app3 = "MeetMeAdmin" [static] |
Definition at line 570 of file app_meetme.c.
const char* app4 = "MeetMeChannelAdmin" [static] |
Definition at line 571 of file app_meetme.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 6685 of file app_meetme.c.
| unsigned int attempt_callerid |
Attempt to handle CallerID, even though it is known not to work properly in some situations.
Definition at line 850 of file app_meetme.c.
int audio_buffers [static] |
The number of audio buffers to be allocated on pseudo channels when in a conference
Definition at line 859 of file app_meetme.c.
struct ast_cli_entry cli_meetme[] [static] |
Definition at line 1646 of file app_meetme.c.
Definition at line 841 of file app_meetme.c.
Referenced by _macro_exec(), ast_safe_sleep_conditional(), gosubif_exec(), and smdi_message_wait().
unsigned int conf_map[1024] = {0, } [static] |
Definition at line 652 of file app_meetme.c.
Referenced by build_conf(), conf_exec(), and dispose_conf().
int earlyalert [static] |
Definition at line 578 of file app_meetme.c.
int endalert [static] |
Definition at line 579 of file app_meetme.c.
| struct { ... } event_q |
int extendby [static] |
Definition at line 580 of file app_meetme.c.
| struct { ... } failed_stations |
Definition at line 843 of file app_meetme.c.
Referenced by ast_format_str_reduce(), ast_print_group(), ast_str_substitute_variables(), ast_xmldoc_build_seealso(), cdr_handler(), check_goto(), context_merge(), gen_prios(), generic_thread_loop(), get_goto_target(), h261_encap(), h263_encap(), h263p_encap(), h264_encap(), listfilter(), log_jack_status(), misdn_lib_init(), mpeg4_encap(), multiplexed_thread_function(), odbc_log(), pgsql_log(), realtime_update2_handler(), realtimefield_read(), update2_curl(), update2_pgsql(), update2_prepare(), xmldoc_get_syntax_cmd(), and xmldoc_parse_cmd_enumlist().
int fuzzystart [static] |
Definition at line 577 of file app_meetme.c.
char const gain_map[] [static] |
Map 'volume' levels from -5 through +5 into decibel (dB) settings for channel drivers Note: these are not a straight linear-to-dB conversion... the numbers have been modified to give the user a better level of adjustability
Definition at line 867 of file app_meetme.c.
Definition at line 843 of file app_meetme.c.
Referenced by __ao2_callback(), __verboser(), add_extensions(), aji_handle_presence(), apply_outgoing(), ast_config_engine_deregister(), ast_db_freetree(), ast_db_gettree(), config_odbc(), config_pgsql(), do_monitor(), gtalk_free_candidates(), jingle_free_candidates(), load_password(), node_lookup(), scan_thread(), and try_firmware().
Definition at line 842 of file app_meetme.c.
Referenced by dahdi_request(), dahdi_restart(), dahdi_set_swgain(), dahdi_show_channel(), dahdi_show_channels(), handle_ss7_block_cic(), handle_ss7_block_linkset(), handle_ss7_unblock_cic(), handle_ss7_unblock_linkset(), load_config(), load_module(), load_rpt_vars(), reload(), rpt_master(), smdi_message_wait(), unload_module(), and write_cdr().
char mandescr_meetmelist[] [static] |
Definition at line 4449 of file app_meetme.c.
struct ast_custom_function meetme_info_acf [static] |
Definition at line 6591 of file app_meetme.c.
struct ast_app_option meetme_opts[128] = { [ 'A' ] = { .flag = CONFFLAG_MARKEDUSER }, [ 'a' ] = { .flag = CONFFLAG_ADMIN }, [ 'b' ] = { .flag = CONFFLAG_AGI }, [ 'c' ] = { .flag = CONFFLAG_ANNOUNCEUSERCOUNT }, [ 'C' ] = { .flag = CONFFLAG_KICK_CONTINUE }, [ 'D' ] = { .flag = CONFFLAG_DYNAMICPIN }, [ 'd' ] = { .flag = CONFFLAG_DYNAMIC }, [ 'E' ] = { .flag = CONFFLAG_EMPTYNOPIN }, [ 'e' ] = { .flag = CONFFLAG_EMPTY }, [ 'F' ] = { .flag = CONFFLAG_PASS_DTMF }, [ 'i' ] = { .flag = CONFFLAG_INTROUSER }, [ 'I' ] = { .flag = CONFFLAG_INTROUSERNOREVIEW }, [ 'M' ] = { .flag = CONFFLAG_MOH , .arg_index = OPT_ARG_MOH_CLASS + 1 }, [ 'm' ] = { .flag = CONFFLAG_STARTMUTED }, [ 'o' ] = { .flag = CONFFLAG_OPTIMIZETALKER }, [ 'P' ] = { .flag = CONFFLAG_ALWAYSPROMPT }, [ 'p' ] = { .flag = CONFFLAG_KEYEXIT , .arg_index = OPT_ARG_EXITKEYS + 1 }, [ 'q' ] = { .flag = CONFFLAG_QUIET }, [ 'r' ] = { .flag = CONFFLAG_RECORDCONF }, [ 's' ] = { .flag = CONFFLAG_STARMENU }, [ 'T' ] = { .flag = CONFFLAG_MONITORTALKER }, [ 'l' ] = { .flag = CONFFLAG_MONITOR }, [ 't' ] = { .flag = CONFFLAG_TALKER }, [ 'w' ] = { .flag = CONFFLAG_WAITMARKED , .arg_index = OPT_ARG_WAITMARKED + 1 }, [ 'X' ] = { .flag = CONFFLAG_EXIT_CONTEXT }, [ 'x' ] = { .flag = CONFFLAG_MARKEDEXIT }, [ '1' ] = { .flag = CONFFLAG_NOONLYPERSON }, [ 'S' ] = { .flag = CONFFLAG_DURATION_STOP , .arg_index = OPT_ARG_DURATION_STOP + 1 }, [ 'L' ] = { .flag = CONFFLAG_DURATION_LIMIT , .arg_index = OPT_ARG_DURATION_LIMIT + 1 }, } [static] |
| static int reload |
A reload has been requested
reload: Part of Asterisk module interface ---
Definition at line 852 of file app_meetme.c.
Referenced by handle_cli_moh_reload(), handle_minivm_reload(), reload(), rpt_do_reload(), and show_console().
| struct { ... } ringing_stations |
| struct { ... } ringing_trunks |
int rt_log_members [static] |
Definition at line 583 of file app_meetme.c.
int rt_schedule [static] |
Definition at line 576 of file app_meetme.c.
struct { ... } sla [static] |
A structure for data used by the sla thread.
Referenced by dial_trunk(), load_config(), queue_ringing_trunk(), sla_calc_station_timeouts(), sla_calc_trunk_timeouts(), sla_check_failed_station(), sla_check_reload(), sla_check_ringing_station(), sla_choose_ringing_trunk(), sla_destroy(), sla_handle_dial_state_event(), sla_handle_ringing_trunk_event(), sla_hangup_stations(), sla_load_config(), sla_queue_event_full(), sla_ring_station(), sla_ring_stations(), sla_station_exec(), sla_stop_ringing_station(), sla_thread(), and sla_trunk_exec().
const char sla_registrar[] = "SLA" [static] |
Definition at line 782 of file app_meetme.c.
Referenced by destroy_station(), destroy_trunk(), sla_build_station(), sla_build_trunk(), and sla_destroy().
struct ast_app_option sla_trunk_opts[128] = { [ 'M' ] = { .flag = SLA_TRUNK_OPT_MOH , .arg_index = SLA_TRUNK_OPT_ARG_MOH_CLASS + 1 }, } [static] |
const char* slastation_app = "SLAStation" [static] |
Definition at line 572 of file app_meetme.c.
const char* slatrunk_app = "SLATrunk" [static] |
Definition at line 573 of file app_meetme.c.
| unsigned int stop |
Definition at line 847 of file app_meetme.c.
Referenced by controlplayback_exec(), handle_controlstreamfile(), and queue_exec().
| pthread_t thread |
The SLA thread ID
Definition at line 840 of file app_meetme.c.
Referenced by __schedule_action(), ast_bridge_depart(), bridge_call_thread_launch(), cleanup_thread_list(), find_idle_thread(), handle_cli_iax2_show_threads(), iax2_process_thread(), iax2_process_thread_cleanup(), launch_monitor_thread(), load_module(), multiplexed_add_or_remove(), socket_read(), start_network_thread(), and unload_module().
1.5.9