app_meetme not setting filename and fileformat correctly for realtime
authorDavid Vossel <dvossel@digium.com>
Tue, 3 Mar 2009 22:01:24 +0000 (22:01 +0000)
committerDavid Vossel <dvossel@digium.com>
Tue, 3 Mar 2009 22:01:24 +0000 (22:01 +0000)
When app_meetme finds a realtime conference, it doesn't get the filename and fileformat correctly when 'r' is set.  Now app_meetme first checks to see if fileformat and filename are declared in the db, if they're not it checks the .conf file, if its not declared there either it then uses defaults.

(closes issue #14545)
Reported by: dalbaech
Patches:
app_meetme-realtime5.patch uploaded by dvossel (license 671)
Realtime_Conference_Record_workaround.txt uploaded by dalbaech (license 705)
Tested by: dvossel, dalbaech
Review: http://reviewboard.digium.com/r/180/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@179972 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_meetme.c

index e3b1541..e001f5e 100644 (file)
@@ -3347,6 +3347,8 @@ static struct ast_conference *find_conf_realtime(struct ast_channel *chan, char
                char *pin = NULL, *pinadmin = NULL; /* For temp use */
                int maxusers = 0;
                struct timeval now;
+               char recordingfilename[256] = "";
+               char recordingformat[10] = "";
                char currenttime[19] = "";
                char eatime[19] = "";
                char bookid[19] = "";
@@ -3355,6 +3357,7 @@ static struct ast_conference *find_conf_realtime(struct ast_channel *chan, char
                char adminopts[OPTIONS_LEN];
                struct ast_tm tm, etm;
                struct timeval endtime = { .tv_sec = 0 };
+               const char *var2;
 
                if (rt_schedule) {
                        now = ast_tvnow();
@@ -3420,6 +3423,10 @@ static struct ast_conference *find_conf_realtime(struct ast_channel *chan, char
                                maxusers = atoi(var->value);
                        } else if (!strcasecmp(var->name, "adminopts")) {
                                ast_copy_string(adminopts, var->value, sizeof(char[OPTIONS_LEN]));
+                       } else if (!strcasecmp(var->name, "recordingfilename")) {
+                               ast_copy_string(recordingfilename, var->value, sizeof(recordingfilename));
+                       } else if (!strcasecmp(var->name, "recordingformat")) {
+                               ast_copy_string(recordingformat, var->value, sizeof(recordingformat));
                        } else if (!strcasecmp(var->name, "endtime")) {
                                struct ast_tm endtime_tm;
                                ast_strptime(var->value, "%Y-%m-%d %H:%M:%S", &endtime_tm);
@@ -3438,9 +3445,37 @@ static struct ast_conference *find_conf_realtime(struct ast_channel *chan, char
                        cnf->useropts = ast_strdup(useropts);
                        cnf->adminopts = ast_strdup(adminopts);
                        cnf->bookid = ast_strdup(bookid);
-                       snprintf(recordingtmp, sizeof(recordingtmp), "%s/meetme/meetme-conf-rec-%s-%s", ast_config_AST_SPOOL_DIR, confno, bookid);
-                       cnf->recordingfilename = ast_strdup(recordingtmp);
-                       cnf->recordingformat = ast_strdup("wav");
+                       cnf->recordingfilename = ast_strdup(recordingfilename);
+                       cnf->recordingformat = ast_strdup(recordingformat);
+
+                       if (strchr(cnf->useropts, 'r')) {
+                               if (ast_strlen_zero(recordingfilename)) { /* If the recordingfilename in the database is empty, use the channel definition or use the default. */
+                                       ast_channel_lock(chan);
+                                       if ((var2 = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFILE"))) {
+                                               ast_free(cnf->recordingfilename);
+                                               cnf->recordingfilename = ast_strdup(var2);
+                                       }
+                                       ast_channel_unlock(chan);
+                                       if (ast_strlen_zero(cnf->recordingfilename)) {
+                                               snprintf(recordingtmp, sizeof(recordingtmp), "meetme-conf-rec-%s-%s", cnf->confno, chan->uniqueid);
+                                               ast_free(cnf->recordingfilename);
+                                               cnf->recordingfilename = ast_strdup(recordingtmp);
+                                       }
+                               }
+                               if (ast_strlen_zero(cnf->recordingformat)) {/* If the recording format is empty, use the wav as default */
+                                       ast_channel_lock(chan);
+                                       if ((var2 = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFORMAT"))) {
+                                               ast_free(cnf->recordingformat);
+                                               cnf->recordingformat = ast_strdup(var2);
+                                       }
+                                       ast_channel_unlock(chan);
+                                       if (ast_strlen_zero(cnf->recordingformat)) {
+                                               ast_free(cnf->recordingformat);
+                                               cnf->recordingformat = ast_strdup("wav");
+                                       }
+                               }
+                               ast_verb(4, "Starting recording of MeetMe Conference %s into file %s.%s.\n", cnf->confno, cnf->recordingfilename, cnf->recordingformat);
+                       }
                }
        }
 
@@ -3816,6 +3851,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
                                                                        }
                                                                }
                                                                /* Run the conference */
+                                                               ast_verb(4, "Starting recording of MeetMe Conference %s into file %s.%s.\n", cnf->confno, cnf->recordingfilename, cnf->recordingformat);
                                                                res = conf_run(chan, cnf, confflags.flags, optargs);
                                                                break;
                                                        } else {