@ -200,7 +200,7 @@ static void *recordthread(void *args);
# define CONFFLAG_ADMIN (1 << 1) /* If set the user has admin access on the conference */
# define CONFFLAG_MONITOR (1 << 2) /* If set the user can only receive audio from the conference */
# define CONFFLAG_POUNDEXIT (1 << 3) /* If set asterisk will exit conference when '#' is pressed */
# define CONFFLAG_STARMENU (1 << 4) /* If set asterisk will provide a menu to the user wh at '*' is pressed */
# define CONFFLAG_STARMENU (1 << 4) /* If set asterisk will provide a menu to the user wh en '*' is pressed */
# define CONFFLAG_TALKER (1 << 5) /* If set the use can only send audio to the conference */
# define CONFFLAG_QUIET (1 << 6) /* If set there will be no enter or leave sounds */
# define CONFFLAG_VIDEO (1 << 7) /* Set to enable video mode */
@ -259,7 +259,8 @@ static int careful_write(int fd, unsigned char *data, int len)
{
int res ;
int x ;
while ( len ) {
while ( len ) {
x = ZT_IOMUX_WRITE | ZT_IOMUX_SIGEVENT ;
res = ioctl ( fd , ZT_IOMUX , & x ) ;
if ( res > = 0 )
@ -274,6 +275,7 @@ static int careful_write(int fd, unsigned char *data, int len)
len - = res ;
data + = res ;
}
return 0 ;
}
@ -305,6 +307,7 @@ static int set_talk_volume(struct ast_conf_user *user, int volume)
if successful , don ' t adjust in the frame reading routine
*/
gain_adjust = gain_map [ volume + 5 ] ;
return ast_channel_setoption ( user - > chan , AST_OPTION_RXGAIN , & gain_adjust , sizeof ( gain_adjust ) , 0 ) ;
}
@ -316,6 +319,7 @@ static int set_listen_volume(struct ast_conf_user *user, int volume)
if successful , don ' t adjust in the frame reading routine
*/
gain_adjust = gain_map [ volume + 5 ] ;
return ast_channel_setoption ( user - > chan , AST_OPTION_TXGAIN , & gain_adjust , sizeof ( gain_adjust ) , 0 ) ;
}
@ -390,10 +394,13 @@ static void conf_play(struct ast_channel *chan, struct ast_conference *conf, int
{
unsigned char * data ;
int len ;
int res = - 1 ;
int res = - 1 ;
if ( ! chan - > _softhangup )
res = ast_autoservice_start ( chan ) ;
ast_mutex_lock ( & conflock ) ;
switch ( sound ) {
case ENTER :
data = enter ;
@ -409,7 +416,9 @@ static void conf_play(struct ast_channel *chan, struct ast_conference *conf, int
}
if ( data )
careful_write ( conf - > fd , data , len ) ;
ast_mutex_unlock ( & conflock ) ;
if ( ! res )
ast_autoservice_stop ( chan ) ;
}
@ -418,18 +427,18 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
{
struct ast_conference * cnf ;
struct zt_confinfo ztc ;
ast_mutex_lock ( & conflock ) ;
cnf = confs ;
while( cnf ) {
for ( cnf = confs ; cnf ; cnf = cnf - > next ) {
if ( ! strcmp ( confno , cnf - > confno ) )
break ;
cnf = cnf - > next ;
}
if ( ! cnf & & ( make | | dynamic ) ) {
cnf = malloc ( sizeof ( struct ast_conference ) ) ;
if ( cnf ) {
/* Make a new one */
memset ( cnf , 0 , sizeof ( struct ast_conference ) ) ;
cnf = calloc ( 1 , sizeof ( * cnf ) ) ;
if ( cnf ) {
ast_copy_string ( cnf - > confno , confno , sizeof ( cnf - > confno ) ) ;
ast_copy_string ( cnf - > pin , pin , sizeof ( cnf - > pin ) ) ;
ast_copy_string ( cnf - > pinadmin , pinadmin , sizeof ( cnf - > pinadmin ) ) ;
@ -476,7 +485,7 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
} else
ast_log ( LOG_WARNING , " Out of memory \n " ) ;
}
cnfout :
cnfout :
ast_mutex_unlock ( & conflock ) ;
return cnf ;
}
@ -484,6 +493,7 @@ cnfout:
static int confs_show ( int fd , int argc , char * * argv )
{
ast_cli ( fd , " Deprecated! Please use 'meetme' instead. \n " ) ;
return RESULT_SUCCESS ;
}
@ -599,22 +609,29 @@ static int conf_cmd(int fd, int argc, char **argv) {
}
}
/* Show all the users */
user = cnf - > firstuser ;
while ( user ) {
ast_cli ( fd , " User #: %-2.2d %12.12s %-20.20s Channel: %s %s %s %s %s \n " , user - > user_no , user - > chan - > cid . cid_num ? user - > chan - > cid . cid_num : " <unknown> " , user - > chan - > cid . cid_name ? user - > chan - > cid . cid_name : " <no name> " , user - > chan - > name , ( user - > userflags & CONFFLAG_ADMIN ) ? " (Admin) " : " " , ( user - > userflags & CONFFLAG_MONITOR ) ? " (Listen only) " : " " , ( user - > adminflags & ADMINFLAG_MUTED ) ? " (Admn Muted) " : " " , istalking ( user - > talking ) ) ;
user = user - > nextuser ;
}
for ( user = cnf - > firstuser ; user ; user = user - > nextuser )
ast_cli ( fd , " User #: %-2.2d %12.12s %-20.20s Channel: %s %s %s %s %s \n " ,
user - > user_no ,
user - > chan - > cid . cid_num ? user - > chan - > cid . cid_num : " <unknown> " ,
user - > chan - > cid . cid_name ? user - > chan - > cid . cid_name : " <no name> " ,
user - > chan - > name ,
user - > userflags & CONFFLAG_ADMIN ? " (Admin) " : " " ,
user - > userflags & CONFFLAG_MONITOR ? " (Listen only) " : " " ,
user - > adminflags & ADMINFLAG_MUTED ? " (Admn Muted) " : " " ,
istalking ( user - > talking ) ) ;
ast_cli ( fd , " %d users in that conference. \n " , cnf - > users ) ;
return RESULT_SUCCESS ;
} else
return RESULT_SHOWUSAGE ;
ast_log ( LOG_DEBUG , " Cmdline: %s \n " , cmdline ) ;
admin_exec ( NULL , cmdline ) ;
return 0 ;
}
static char * complete_confcmd ( char * line , char * word , int pos , int state ) {
# define CONF_COMMANDS 6
# define CONF_COMMANDS 6
int which = 0 , x = 0 ;
struct ast_conference * cnf = NULL ;
struct ast_conf_user * usr = NULL ;
@ -653,7 +670,6 @@ static char *complete_confcmd(char *line, char *word, int pos, int state) {
}
which + + ;
ast_mutex_lock ( & conflock ) ;
cnf = confs ;
/* TODO: Find the conf number from the cmdline (ignore spaces) <- test this and make it fail-safe! */
myline = ast_strdupa ( line ) ;
@ -662,28 +678,26 @@ static char *complete_confcmd(char *line, char *word, int pos, int state) {
;
}
while( cnf ) {
if ( strcmp ( confno , cnf - > confno ) = = 0 ) {
for ( cnf = confs ; cnf ; cnf = cnf - > next ) {
if ( ! strcmp ( confno , cnf - > confno ) )
break ;
}
cnf = cnf - > next ;
}
if ( cnf ) {
/* Search for the user */
usr = cnf - > firstuser ;
while ( usr ) {
for ( usr = cnf - > firstuser ; usr ; usr = usr - > nextuser ) {
snprintf ( usrno , sizeof ( usrno ) , " %d " , usr - > user_no ) ;
if ( ! strncasecmp ( word , usrno , strlen ( word ) ) ) {
if ( + + which > state )
break ;
}
usr = usr - > nextuser ;
}
}
ast_mutex_unlock ( & conflock ) ;
return usr ? strdup ( usrno ) : NULL ;
}
}
return NULL ;
}
@ -698,6 +712,7 @@ static struct ast_cli_entry cli_conf = {
static void conf_flush ( int fd )
{
int x ;
x = ZT_FLUSH_ALL ;
if ( ioctl ( fd , ZT_FLUSH , & x ) )
ast_log ( LOG_WARNING , " Error flushing channel \n " ) ;
@ -709,7 +724,7 @@ static int conf_free(struct ast_conference *conf)
{
struct ast_conference * prev = NULL , * cur = confs ;
while ( cur ) {
while ( cur ) {
if ( cur = = conf ) {
if ( prev )
prev - > next = conf - > next ;
@ -747,7 +762,7 @@ static int conf_free(struct ast_conference *conf)
static int conf_run ( struct ast_channel * chan , struct ast_conference * conf , int confflags )
{
struct ast_conf_user * user = malloc( sizeof ( struct ast_conf_ user) ) ;
struct ast_conf_user * user = calloc( 1 , sizeof ( * user) ) ;
struct ast_conf_user * usr = NULL ;
int fd ;
struct zt_confinfo ztc , ztc_empty ;
@ -763,7 +778,6 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
int origfd ;
int musiconhold = 0 ;
int firstpass = 0 ;
int origquiet ;
int lastmarked = 0 ;
int currentmarked = 0 ;
int ret = - 1 ;
@ -772,7 +786,6 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
int using_pseudo = 0 ;
int duration = 20 ;
struct ast_dsp * dsp = NULL ;
struct ast_app * app ;
char * agifile ;
char * agifiledefault = " conf-background.agi " ;
@ -780,36 +793,33 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
char exitcontext [ AST_MAX_CONTEXT ] = " " ;
char recordingtmp [ AST_MAX_EXTENSION ] = " " ;
int dtmf ;
ZT_BUFFERINFO bi ;
char __buf [ CONF_SIZE + AST_FRIENDLY_OFFSET ] ;
char * buf = __buf + AST_FRIENDLY_OFFSET ;
if ( ! user ) {
ast_log ( LOG_ERROR , " Out of memory \n " ) ;
return ( ret ) ;
return ret ;
}
memset ( user , 0 , sizeof ( struct ast_conf_user ) ) ;
if ( confflags & CONFFLAG_RECORDCONF & & conf - > recording ! = MEETME_RECORD_ACTIVE ) {
conf - > recordingfilename = pbx_builtin_getvar_helper ( chan , " MEETME_RECORDINGFILE " ) ;
conf - > recordingfilename = pbx_builtin_getvar_helper ( chan , " MEETME_RECORDINGFILE " ) ;
if ( ! conf - > recordingfilename ) {
snprintf ( recordingtmp , sizeof ( recordingtmp ) , " meetme-conf-rec-%s-%s " , conf - > confno , chan - > uniqueid ) ;
snprintf ( recordingtmp , sizeof ( recordingtmp ) , " meetme-conf-rec-%s-%s " , conf - > confno , chan - > uniqueid ) ;
conf - > recordingfilename = ast_strdupa ( recordingtmp ) ;
}
conf - > recordingformat = pbx_builtin_getvar_helper ( chan , " MEETME_RECORDINGFORMAT " ) ;
if ( ! conf - > recordingformat ) {
snprintf ( recordingtmp , sizeof ( recordingtmp ) , " wav " ) ;
snprintf ( recordingtmp , sizeof ( recordingtmp ) , " wav " ) ;
conf - > recordingformat = ast_strdupa ( recordingtmp ) ;
}
pthread_attr_init ( & conf - > attr ) ;
pthread_attr_setdetachstate ( & conf - > attr , PTHREAD_CREATE_DETACHED ) ;
ast_verbose ( VERBOSE_PREFIX_4 " Starting recording of MeetMe Conference %s into file %s.%s. \n " , conf - > confno , conf - > recordingfilename , conf - > recordingformat ) ;
ast_verbose ( VERBOSE_PREFIX_4 " Starting recording of MeetMe Conference %s into file %s.%s. \n " ,
conf - > confno , conf - > recordingfilename , conf - > recordingformat ) ;
ast_pthread_create ( & conf - > recordthread , & conf - > attr , recordthread , conf ) ;
}
user - > user_no = 0 ; /* User number 0 means starting up user! (dead - not in the list!) */
time ( & user - > jointime ) ;
if ( conf - > locked ) {
@ -823,19 +833,16 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
conf - > markedusers + + ;
ast_mutex_lock ( & conflock ) ;
if ( conf - > firstuser = = NULL ) {
if ( ! conf - > firstuser ) {
/* Fill the first new User struct */
user - > user_no = 1 ;
user - > nextuser = NULL ;
user - > prevuser = NULL ;
conf - > firstuser = user ;
conf - > lastuser = user ;
} else {
/* Fill the new user struct */
user - > user_no = conf - > lastuser - > user_no + 1 ;
user - > prevuser = conf - > lastuser ;
user - > nextuser = NULL ;
if ( conf - > lastuser - > nextuser ! = NULL ) {
if ( conf - > lastuser - > nextuser ) {
ast_log ( LOG_WARNING , " Error in User Management! \n " ) ;
ast_mutex_unlock ( & conflock ) ;
goto outrun ;
@ -844,12 +851,14 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
conf - > lastuser = user ;
}
}
user - > chan = chan ;
user - > userflags = confflags ;
user - > adminflags = 0 ;
user - > talking = - 1 ;
conf - > users + + ;
ast_mutex_unlock ( & conflock ) ;
origquiet = confflags & CONFFLAG_QUIET ;
if ( confflags & CONFFLAG_EXIT_CONTEXT ) {
if ( ( agifile = pbx_builtin_getvar_helper ( chan , " MEETME_EXIT_CONTEXT " ) ) )
ast_copy_string ( exitcontext , agifile , sizeof ( exitcontext ) ) ;
@ -860,12 +869,12 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
}
if ( ! ( confflags & CONFFLAG_QUIET ) & & ( confflags & CONFFLAG_INTROUSER ) ) {
snprintf ( user - > namerecloc , sizeof ( user - > namerecloc ) , " %s/meetme/meetme-username-%s-%d " , ast_config_AST_SPOOL_DIR , conf - > confno , user - > user_no ) ;
ast_record_review ( chan , " vm-rec-name " , user - > namerecloc , 10 , " sln " , & duration , NULL ) ;
snprintf ( user - > namerecloc , sizeof ( user - > namerecloc ) ,
" %s/meetme/meetme-username-%s-%d " , ast_config_AST_SPOOL_DIR ,
conf - > confno , user - > user_no ) ;
ast_record_review ( chan , " vm-rec-name " , user - > namerecloc , 10 , " sln " , & duration , NULL ) ;
}
conf - > users + + ;
if ( ! ( confflags & CONFFLAG_QUIET ) ) {
if ( conf - > users = = 1 & & ! ( confflags & CONFFLAG_WAITMARKED ) )
if ( ! ast_streamfile ( chan , " conf-onlyperson " , chan - > language ) )
@ -876,7 +885,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
}
if ( ! ( confflags & CONFFLAG_QUIET ) & & ( confflags & CONFFLAG_ANNOUNCEUSERCOUNT ) & & conf - > users > 1 ) {
int keepplaying = 1 ;
int keepplaying = 1 ;
if ( conf - > users = = 2 ) {
if ( ! ast_streamfile ( chan , " conf-onlyone " , chan - > language ) ) {
@ -911,21 +920,21 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
}
}
/* Set it into linear mode (write) */
if ( ast_set_write_format ( chan , AST_FORMAT_SLINEAR ) < 0 ) {
ast_log ( LOG_WARNING , " Unable to set '%s' to write linear mode \n " , chan - > name ) ;
goto outrun ;
}
/* Set it into linear mode (read) */
if ( ast_set_read_format ( chan , AST_FORMAT_SLINEAR ) < 0 ) {
ast_log ( LOG_WARNING , " Unable to set '%s' to read linear mode \n " , chan - > name ) ;
goto outrun ;
}
ast_indicate ( chan , - 1 ) ;
retryzap = strcasecmp ( chan - > type , " Zap " ) ;
user - > zapchannel = ! retryzap ;
zapretry :
zapretry :
origfd = chan - > fds [ 0 ] ;
if ( retryzap ) {
fd = open ( " /dev/zap/pseudo " , O_RDWR ) ;
@ -990,7 +999,9 @@ zapretry:
/* Add us to the conference */
ztc . chan = 0 ;
ztc . confno = conf - > zapconf ;
ast_mutex_lock ( & conflock ) ;
if ( ! ( confflags & CONFFLAG_QUIET ) & & ( confflags & CONFFLAG_INTROUSER ) & & conf - > users > 1 ) {
if ( conf - > chan & & ast_fileexists ( user - > namerecloc , NULL , NULL ) ) {
if ( ! ast_streamfile ( conf - > chan , user - > namerecloc , chan - > language ) )
@ -1028,21 +1039,23 @@ zapretry:
if ( ! ( confflags & CONFFLAG_WAITMARKED ) | | ( conf - > markedusers > = 1 ) )
conf_play ( chan , conf , ENTER ) ;
}
conf_flush ( fd ) ;
ast_mutex_unlock ( & conflock ) ;
if ( confflags & CONFFLAG_AGI ) {
conf_flush ( fd ) ;
if ( confflags & CONFFLAG_AGI ) {
/* Get name of AGI file to run from $(MEETME_AGI_BACKGROUND)
or use default filename of conf - background . agi */
agifile = pbx_builtin_getvar_helper ( chan , " MEETME_AGI_BACKGROUND " ) ;
agifile = pbx_builtin_getvar_helper ( chan , " MEETME_AGI_BACKGROUND " ) ;
if ( ! agifile )
agifile = agifiledefault ;
if ( user - > zapchannel ) {
/* Set CONFMUTE mode on Zap channel to mute DTMF tones */
x = 1 ;
ast_channel_setoption ( chan , AST_OPTION_TONE_VERIFY , & x , sizeof ( char ) , 0 ) ;
ast_channel_setoption ( chan , AST_OPTION_TONE_VERIFY , & x , sizeof ( char ) , 0 ) ;
}
/* Find a pointer to the agi app and execute the script */
app = pbx_findapp ( " agi " ) ;
@ -1055,13 +1068,13 @@ zapretry:
if ( user - > zapchannel ) {
/* Remove CONFMUTE mode on Zap channel */
x = 0 ;
ast_channel_setoption ( chan , AST_OPTION_TONE_VERIFY , & x , sizeof ( char ) , 0 ) ;
ast_channel_setoption ( chan , AST_OPTION_TONE_VERIFY , & x , sizeof ( char ) , 0 ) ;
}
} else {
if ( user - > zapchannel & & ( confflags & CONFFLAG_STARMENU ) ) {
/* Set CONFMUTE mode on Zap channel to mute DTMF tones when the menu is enabled */
x = 1 ;
ast_channel_setoption ( chan , AST_OPTION_TONE_VERIFY , & x , sizeof ( char ) , 0 ) ;
ast_channel_setoption ( chan , AST_OPTION_TONE_VERIFY , & x , sizeof ( char ) , 0 ) ;
}
if ( confflags & CONFFLAG_MONITORTALKER & & ! ( dsp = ast_dsp_new ( ) ) ) {
ast_log ( LOG_WARNING , " Unable to allocate DSP! \n " ) ;
@ -1082,7 +1095,10 @@ zapretry:
menu_was_active = menu_active ;
currentmarked = conf - > markedusers ;
if ( ! ( confflags & CONFFLAG_QUIET ) & & ( confflags & CONFFLAG_MARKEDUSER ) & & ( confflags & CONFFLAG_WAITMARKED ) & & lastmarked = = 0 ) {
if ( ! ( confflags & CONFFLAG_QUIET ) & &
( confflags & CONFFLAG_MARKEDUSER ) & &
( confflags & CONFFLAG_WAITMARKED ) & &
lastmarked = = 0 ) {
if ( currentmarked = = 1 & & conf - > users > 1 ) {
ast_say_number ( chan , conf - > users - 1 , AST_DIGIT_ANY , chan - > language , ( char * ) NULL ) ;
if ( conf - > users - 1 = = 1 ) {
@ -1232,6 +1248,7 @@ zapretry:
if ( confflags & CONFFLAG_MONITORTALKER ) {
int totalsilence ;
if ( user - > talking = = - 1 )
user - > talking = 0 ;
@ -1261,6 +1278,7 @@ zapretry:
}
} else if ( ( f - > frametype = = AST_FRAME_DTMF ) & & ( confflags & CONFFLAG_EXIT_CONTEXT ) ) {
char tmp [ 2 ] ;
tmp [ 0 ] = f - > subclass ;
tmp [ 1 ] = ' \0 ' ;
if ( ast_goto_if_exists ( chan , exitcontext , tmp , 1 ) ) {
@ -1275,7 +1293,6 @@ zapretry:
if ( ioctl ( fd , ZT_SETCONF , & ztc_empty ) ) {
ast_log ( LOG_WARNING , " Error setting conference \n " ) ;
close ( fd ) ;
ast_mutex_unlock ( & conflock ) ;
goto outrun ;
}
@ -1345,27 +1362,21 @@ zapretry:
usr - > adminflags | = ADMINFLAG_KICKME ;
ast_stopstream ( chan ) ;
break ;
case ' 4 ' :
tweak_listen_volume ( user , VOL_DOWN ) ;
break ;
case ' 6 ' :
tweak_listen_volume ( user , VOL_UP ) ;
break ;
case ' 7 ' :
tweak_talk_volume ( user , VOL_DOWN ) ;
break ;
case ' 8 ' :
menu_active = 0 ;
break ;
case ' 9 ' :
tweak_talk_volume ( user , VOL_UP ) ;
break ;
default :
menu_active = 0 ;
/* Play an error message! */
@ -1378,7 +1389,6 @@ zapretry:
/* User menu */
if ( ! menu_active ) {
menu_active = 1 ;
/* Record this sound! */
if ( ! ast_streamfile ( chan , " conf-usermenu " , chan - > language ) )
dtmf = ast_waitstream ( chan , AST_DIGIT_ANY ) ;
else
@ -1412,35 +1422,28 @@ zapretry:
case ' 4 ' :
tweak_listen_volume ( user , VOL_DOWN ) ;
break ;
case ' 6 ' :
tweak_listen_volume ( user , VOL_UP ) ;
break ;
case ' 7 ' :
tweak_talk_volume ( user , VOL_DOWN ) ;
break ;
case ' 8 ' :
menu_active = 0 ;
break ;
case ' 9 ' :
tweak_talk_volume ( user , VOL_UP ) ;
break ;
default :
menu_active = 0 ;
/* Play an error message! */
if ( ! ast_streamfile ( chan , " conf-errormenu " , chan - > language ) )
ast_waitstream ( chan , " " ) ;
break ;
}
}
}
if ( musiconhold ) {
if ( musiconhold )
ast_moh_start ( chan , NULL ) ;
}
if ( ioctl ( fd , ZT_SETCONF , & ztc ) ) {
ast_log ( LOG_WARNING , " Error setting conference \n " ) ;
@ -1450,7 +1453,9 @@ zapretry:
}
conf_flush ( fd ) ;
} else if ( option_debug ) {
ast_log ( LOG_DEBUG , " Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d \n " , chan - > name , f - > frametype , f - > subclass ) ;
ast_log ( LOG_DEBUG ,
" Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d \n " ,
chan - > name , f - > frametype , f - > subclass ) ;
}
ast_frfree ( f ) ;
} else if ( outfd > - 1 ) {
@ -1467,7 +1472,6 @@ zapretry:
ast_frame_adjust_volume ( & fr , user - > listen . actual ) ;
if ( ast_write ( chan , & fr ) < 0 ) {
ast_log ( LOG_WARNING , " Unable to write frame to channel: %s \n " , strerror ( errno ) ) ;
/* break; */
}
} else
ast_log ( LOG_WARNING , " Failed to read frame: %s \n " , strerror ( errno ) ) ;
@ -1506,9 +1510,9 @@ zapretry:
}
ast_mutex_unlock ( & conflock ) ;
outrun :
outrun :
ast_mutex_lock ( & conflock ) ;
if ( confflags & CONFFLAG_MONITORTALKER & & dsp )
ast_dsp_free ( dsp ) ;
@ -1560,6 +1564,7 @@ outrun:
}
free ( user ) ;
ast_mutex_unlock ( & conflock ) ;
return ret ;
}
@ -1571,11 +1576,9 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno,
/* Check first in the conference list */
ast_mutex_lock ( & conflock ) ;
cnf = confs ;
while ( cnf ) {
for ( cnf = confs ; cnf ; cnf = cnf - > next ) {
if ( ! strcmp ( confno , cnf - > confno ) )
break ;
cnf = cnf - > next ;
}
ast_mutex_unlock ( & conflock ) ;
@ -1600,7 +1603,7 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno,
return NULL ;
}
var = ast_variable_browse ( cfg , " rooms " ) ;
while ( var ) {
while ( var ) {
if ( ! strcasecmp ( var - > name , " conf " ) ) {
/* Separate the PIN */
char * pin , * pinadmin , * conf ;
@ -1638,6 +1641,7 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno,
if ( dynamic_pin [ 0 ] = = ' q ' )
dynamic_pin [ 0 ] = ' \0 ' ;
}
return cnf ;
}
@ -1674,14 +1678,15 @@ static int count_exec(struct ast_channel *chan, void *data)
if ( ! ast_strlen_zero ( localdata ) ) {
/* have var so load it and exit */
snprintf ( val , sizeof ( val ) , " %d " , count ) ;
pbx_builtin_setvar_helper ( chan , localdata , val ) ;
snprintf ( val , sizeof ( val ) , " %d " , count ) ;
pbx_builtin_setvar_helper ( chan , localdata , val ) ;
} else {
if ( chan - > _state ! = AST_STATE_UP )
ast_answer ( chan ) ;
res = ast_say_number ( chan , count , " " , chan - > language , ( char * ) NULL ) ; /* Needs gender */
}
LOCAL_USER_REMOVE ( u ) ;
return res ;
}
@ -1767,7 +1772,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
cfg = ast_config_load ( " meetme.conf " ) ;
if ( cfg ) {
var = ast_variable_browse ( cfg , " rooms " ) ;
while ( var ) {
while ( var ) {
if ( ! strcasecmp ( var - > name , " conf " ) ) {
char * stringp = ast_strdupa ( var - > value ) ;
if ( stringp ) {
@ -1780,7 +1785,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
}
}
}
if ( ! dynamic ) {
if ( ! dynamic ) {
/* For static: run through the list and see if this conference is empty */
ast_mutex_lock ( & conflock ) ;
cnf = confs ;
@ -1863,13 +1868,16 @@ static int conf_exec(struct ast_channel *chan, void *data)
if ( allowretry )
confno [ 0 ] = ' \0 ' ;
} else {
if ( ( ! ast_strlen_zero ( cnf - > pin ) & & ! ast_test_flag ( & confflags , CONFFLAG_ADMIN ) ) | | ( ! ast_strlen_zero ( cnf - > pinadmin ) & & ast_test_flag ( & confflags , CONFFLAG_ADMIN ) ) ) {
if ( ( ! ast_strlen_zero ( cnf - > pin ) & &
! ast_test_flag ( & confflags , CONFFLAG_ADMIN ) ) | |
( ! ast_strlen_zero ( cnf - > pinadmin ) & &
ast_test_flag ( & confflags , CONFFLAG_ADMIN ) ) ) {
char pin [ AST_MAX_EXTENSION ] = " " ;
int j ;
/* Allow the pin to be retried up to 3 times */
for ( j = 0 ; j < 3 ; j + + ) {
if ( * the_pin & & ( always_prompt = = 0 ) ) {
for ( j = 0 ; j < 3 ; j + + ) {
if ( * the_pin & & ( always_prompt = = 0 ) ) {
ast_copy_string ( pin , the_pin , sizeof ( pin ) ) ;
res = 0 ;
} else {
@ -1877,8 +1885,9 @@ static int conf_exec(struct ast_channel *chan, void *data)
res = ast_app_getdata ( chan , " conf-getpin " , pin + strlen ( pin ) , sizeof ( pin ) - 1 - strlen ( pin ) , 0 ) ;
}
if ( res > = 0 ) {
if ( ! strcasecmp ( pin , cnf - > pin ) | | ( ! ast_strlen_zero ( cnf - > pinadmin ) & & ! strcasecmp ( pin , cnf - > pinadmin ) ) ) {
if ( ! strcasecmp ( pin , cnf - > pin ) | |
( ! ast_strlen_zero ( cnf - > pinadmin ) & &
! strcasecmp ( pin , cnf - > pinadmin ) ) ) {
/* Pin correct */
allowretry = 0 ;
if ( ! ast_strlen_zero ( cnf - > pinadmin ) & & ! strcasecmp ( pin , cnf - > pinadmin ) )
@ -1936,9 +1945,10 @@ static int conf_exec(struct ast_channel *chan, void *data)
static struct ast_conf_user * find_user ( struct ast_conference * conf , char * callerident ) {
struct ast_conf_user * user = NULL ;
char usrno [ 1024 ] = " " ;
if ( conf & & callerident ) {
user = conf - > firstuser ;
while ( user ) {
while ( user ) {
snprintf ( usrno , sizeof ( usrno ) , " %d " , user - > user_no ) ;
if ( strcmp ( usrno , callerident ) = = 0 )
return user ;
@ -1972,11 +1982,9 @@ static int admin_exec(struct ast_channel *chan, void *data) {
LOCAL_USER_REMOVE ( u ) ;
return - 1 ;
}
cnf = confs ;
while ( cnf ) {
if ( strcmp ( cnf - > confno , conf ) = = 0 )
for ( cnf = confs ; cnf ; cnf = cnf - > next ) {
if ( ! strcmp ( cnf - > confno , conf ) )
break ;
cnf = cnf - > next ;
}
if ( caller )
@ -2069,14 +2077,13 @@ static int admin_exec(struct ast_channel *chan, void *data) {
static void * recordthread ( void * args )
{
struct ast_conference * cnf ;
struct ast_conference * cnf = args ;
struct ast_frame * f = NULL ;
int flags ;
struct ast_filestream * s ;
int res = 0 ;
cnf = ( struct ast_conference * ) args ;
if ( ! cnf | | ! cnf - > chan ) {
if ( ! cnf | | ! cnf - > chan ) {
pthread_exit ( 0 ) ;
}
ast_stopstream ( cnf - > chan ) ;
@ -2145,7 +2152,9 @@ char *description(void)
int usecount ( void )
{
int res ;
STANDARD_USECOUNT ( res ) ;
return res ;
}