mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 03:18:30 +00:00
Bug 5702 - Realtime patch for meetme
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@12232 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Asterisk -- An open source telephony toolkit.
|
* Asterisk -- An open source telephony toolkit.
|
||||||
*
|
*
|
||||||
@@ -147,9 +148,9 @@ struct ast_conference {
|
|||||||
struct ast_conf_user *firstuser; /* Pointer to the first user struct */
|
struct ast_conf_user *firstuser; /* Pointer to the first user struct */
|
||||||
struct ast_conf_user *lastuser; /* Pointer to the last user struct */
|
struct ast_conf_user *lastuser; /* Pointer to the last user struct */
|
||||||
time_t start; /* Start time (s) */
|
time_t start; /* Start time (s) */
|
||||||
int recording; /* recording status */
|
unsigned int recording:2; /* recording status */
|
||||||
int isdynamic; /* Created on the fly? */
|
unsigned int isdynamic:1; /* Created on the fly? */
|
||||||
int locked; /* Is the conference locked? */
|
unsigned int locked:1; /* Is the conference locked? */
|
||||||
pthread_t recordthread; /* thread for recording */
|
pthread_t recordthread; /* thread for recording */
|
||||||
pthread_attr_t attr; /* thread attribute */
|
pthread_attr_t attr; /* thread attribute */
|
||||||
const char *recordingfilename; /* Filename to record the Conference into */
|
const char *recordingfilename; /* Filename to record the Conference into */
|
||||||
@@ -518,7 +519,7 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
|
|||||||
/* Fill the conference struct */
|
/* Fill the conference struct */
|
||||||
cnf->start = time(NULL);
|
cnf->start = time(NULL);
|
||||||
cnf->zapconf = ztc.confno;
|
cnf->zapconf = ztc.confno;
|
||||||
cnf->isdynamic = dynamic;
|
cnf->isdynamic = dynamic ? 1 : 0;
|
||||||
cnf->firstuser = NULL;
|
cnf->firstuser = NULL;
|
||||||
cnf->lastuser = NULL;
|
cnf->lastuser = NULL;
|
||||||
cnf->locked = 0;
|
cnf->locked = 0;
|
||||||
@@ -851,6 +852,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
char meetmesecs[30] = "";
|
char meetmesecs[30] = "";
|
||||||
char exitcontext[AST_MAX_CONTEXT] = "";
|
char exitcontext[AST_MAX_CONTEXT] = "";
|
||||||
char recordingtmp[AST_MAX_EXTENSION] = "";
|
char recordingtmp[AST_MAX_EXTENSION] = "";
|
||||||
|
char members[10] = "";
|
||||||
int dtmf;
|
int dtmf;
|
||||||
ZT_BUFFERINFO bi;
|
ZT_BUFFERINFO bi;
|
||||||
char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
|
char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
|
||||||
@@ -920,6 +922,10 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
user->adminflags = 0;
|
user->adminflags = 0;
|
||||||
user->talking = -1;
|
user->talking = -1;
|
||||||
conf->users++;
|
conf->users++;
|
||||||
|
/* Update table */
|
||||||
|
snprintf(members, sizeof(members), "%d", conf->users);
|
||||||
|
ast_update_realtime("meetme", "confno", conf->confno, "members", members , NULL);
|
||||||
|
|
||||||
ast_mutex_unlock(&conf->playlock);
|
ast_mutex_unlock(&conf->playlock);
|
||||||
|
|
||||||
if (confflags & CONFFLAG_EXIT_CONTEXT) {
|
if (confflags & CONFFLAG_EXIT_CONTEXT) {
|
||||||
@@ -1665,6 +1671,9 @@ bailoutandtrynormal:
|
|||||||
"<no name>", hr, min, sec);
|
"<no name>", hr, min, sec);
|
||||||
|
|
||||||
conf->users--;
|
conf->users--;
|
||||||
|
/* Update table */
|
||||||
|
snprintf(members, sizeof(members), "%d", conf->users);
|
||||||
|
ast_update_realtime("meetme", "confno", conf->confno, "members", members, NULL);
|
||||||
if (confflags & CONFFLAG_MARKEDUSER)
|
if (confflags & CONFFLAG_MARKEDUSER)
|
||||||
conf->markedusers--;
|
conf->markedusers--;
|
||||||
if (!conf->users) {
|
if (!conf->users) {
|
||||||
@@ -1709,6 +1718,52 @@ bailoutandtrynormal:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
This function looks for a conference via the RealTime module
|
||||||
|
*/
|
||||||
|
static struct ast_conference *find_conf_realtime(struct ast_channel *chan, char *confno, int make, int dynamic, char *dynamic_pin)
|
||||||
|
{
|
||||||
|
|
||||||
|
struct ast_variable *var;
|
||||||
|
struct ast_conference *cnf;
|
||||||
|
|
||||||
|
/* Check first in the conference list */
|
||||||
|
AST_LIST_LOCK(&confs);
|
||||||
|
AST_LIST_TRAVERSE(&confs, cnf, list) {
|
||||||
|
if (!strcmp(confno, cnf->confno))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
AST_LIST_UNLOCK(&confs);
|
||||||
|
|
||||||
|
if (!cnf) {
|
||||||
|
char *pin = NULL, *pinadmin = NULL; /* For temp use */
|
||||||
|
|
||||||
|
cnf = ast_calloc(1, sizeof(struct ast_conference));
|
||||||
|
if (!cnf) {
|
||||||
|
ast_log(LOG_ERROR, "Out of memory\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
var = ast_load_realtime("meetme", "confno", confno, NULL);
|
||||||
|
while (var) {
|
||||||
|
if (!strcasecmp(var->name, "confno")) {
|
||||||
|
ast_copy_string(cnf->confno, var->value, sizeof(cnf->confno));
|
||||||
|
} else if (!strcasecmp(var->name, "pin")) {
|
||||||
|
pin = ast_strdupa(var->value);
|
||||||
|
} else if (!strcasecmp(var->name, "adminpin")) {
|
||||||
|
pinadmin = ast_strdupa(var->value);
|
||||||
|
}
|
||||||
|
var = var->next;
|
||||||
|
}
|
||||||
|
ast_variables_destroy(var);
|
||||||
|
|
||||||
|
cnf = build_conf(confno, pin ? pin : "", pinadmin ? pinadmin : "", make, dynamic);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct ast_conference *find_conf(struct ast_channel *chan, char *confno, int make, int dynamic, char *dynamic_pin)
|
static struct ast_conference *find_conf(struct ast_channel *chan, char *confno, int make, int dynamic, char *dynamic_pin)
|
||||||
{
|
{
|
||||||
struct ast_config *cfg;
|
struct ast_config *cfg;
|
||||||
@@ -2006,6 +2061,9 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
|||||||
if (!ast_strlen_zero(confno)) {
|
if (!ast_strlen_zero(confno)) {
|
||||||
/* Check the validity of the conference */
|
/* Check the validity of the conference */
|
||||||
cnf = find_conf(chan, confno, 1, dynamic, the_pin);
|
cnf = find_conf(chan, confno, 1, dynamic, the_pin);
|
||||||
|
if (!cnf) {
|
||||||
|
cnf = find_conf_realtime(chan, confno, 1, dynamic, the_pin);
|
||||||
|
}
|
||||||
if (!cnf) {
|
if (!cnf) {
|
||||||
res = ast_streamfile(chan, "conf-invalid", chan->language);
|
res = ast_streamfile(chan, "conf-invalid", chan->language);
|
||||||
if (!res)
|
if (!res)
|
||||||
|
|||||||
12
contrib/scripts/meetme.sql
Normal file
12
contrib/scripts/meetme.sql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
--
|
||||||
|
-- Table structure for Realtime meetme
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE meetme (
|
||||||
|
confno char(80) DEFAULT '0' NOT NULL,
|
||||||
|
pin char(20) NULL,
|
||||||
|
adminpin char(20) NULL,
|
||||||
|
members integer DEFAULT 0 NOT NULL,
|
||||||
|
PRIMARY KEY (confno)
|
||||||
|
);
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ int ast_category_exist(const struct ast_config *config, const char *category_nam
|
|||||||
* This will use builtin configuration backends to look up a particular
|
* This will use builtin configuration backends to look up a particular
|
||||||
* entity in realtime and return a variable list of its parameters. Note
|
* entity in realtime and return a variable list of its parameters. Note
|
||||||
* that unlike the variables in ast_config, the resulting list of variables
|
* that unlike the variables in ast_config, the resulting list of variables
|
||||||
* MUST be fred with ast_free_runtime() as there is no container.
|
* MUST be freed with ast_variables_destroy() as there is no container.
|
||||||
*/
|
*/
|
||||||
struct ast_variable *ast_load_realtime(const char *family, ...);
|
struct ast_variable *ast_load_realtime(const char *family, ...);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user