Index: apps/app_meetme.c =================================================================== --- apps/app_meetme.c (revision 294817) +++ apps/app_meetme.c (working copy) @@ -608,6 +608,7 @@ /* !If set play an intro announcement at start of conference */ #define CONFFLAG_INTROMSG ((uint64_t)1 << 32) +#define CONFFLAG_INTROUSER_VMREC ((uint64_t)1 << 33) enum { OPT_ARG_WAITMARKED = 0, @@ -631,6 +632,7 @@ AST_APP_OPTION('e', CONFFLAG_EMPTY ), AST_APP_OPTION('F', CONFFLAG_PASS_DTMF ), AST_APP_OPTION_ARG('G', CONFFLAG_INTROMSG, OPT_ARG_INTROMSG ), + AST_APP_OPTION('h', CONFFLAG_INTROUSER_VMREC ), AST_APP_OPTION('i', CONFFLAG_INTROUSER ), AST_APP_OPTION('I', CONFFLAG_INTROUSERNOREVIEW ), AST_APP_OPTION_ARG('M', CONFFLAG_MOH, OPT_ARG_MOH_CLASS ), @@ -687,6 +689,7 @@ char language[MAX_LANGUAGE]; struct ast_channel *confchan; int confusers; + int vmrec; enum announcetypes announcetype; }; @@ -1818,7 +1821,10 @@ pthread_join(conf->announcethread, NULL); while ((item = AST_LIST_REMOVE_HEAD(&conf->announcelist, entry))) { - ast_filedelete(item->namerecloc, NULL); + //If it's a voicemail greeting file we don't want to remove it + if(!item->vmrec){ + ast_filedelete(item->namerecloc, NULL); + } ao2_ref(item, -1); } ast_mutex_destroy(&conf->announcelistlock); @@ -2091,15 +2097,22 @@ ast_waitstream(current->confchan, ""); } } - if (current->announcetype == CONF_HASLEFT) { - ast_filedelete(current->namerecloc, NULL); + if (current->announcetype == CONF_HASLEFT && current->announcetype) { + //only remove it if it isn't a VM recording file + if(!current->vmrec){ + ast_filedelete(current->namerecloc, NULL); + } + } } } /* thread marked to stop, clean up */ while ((current = AST_LIST_REMOVE_HEAD(&local_list, entry))) { - ast_filedelete(current->namerecloc, NULL); + //only delete if it's a vm rec + if(!current->vmrec) { + ast_filedelete(current->namerecloc, NULL); + } ao2_ref(current, -1); } return NULL; @@ -2363,7 +2376,7 @@ ast_mutex_lock(&conf->announcethreadlock); if ((conf->announcethread == AST_PTHREADT_NULL) && !ast_test_flag64(confflags, CONFFLAG_QUIET) && - (ast_test_flag64(confflags, CONFFLAG_INTROUSER) || ast_test_flag64(confflags, CONFFLAG_INTROUSERNOREVIEW))) { + (ast_test_flag64(confflags, CONFFLAG_INTROUSER) || ast_test_flag64(confflags, CONFFLAG_INTROUSERNOREVIEW) || ast_test_flag64(confflags, CONFFLAG_INTROUSER_VMREC))) { ast_mutex_init(&conf->announcelistlock); AST_LIST_HEAD_INIT_NOLOCK(&conf->announcelist); ast_pthread_create_background(&conf->announcethread, NULL, announce_thread, conf); @@ -2426,7 +2439,7 @@ ast_mutex_unlock(&conf->playlock); if (!ast_test_flag64(confflags, CONFFLAG_QUIET) && (ast_test_flag64(confflags, CONFFLAG_INTROUSER) || - ast_test_flag64(confflags, CONFFLAG_INTROUSERNOREVIEW))) { + ast_test_flag64(confflags, CONFFLAG_INTROUSERNOREVIEW) || ast_test_flag64(confflags,CONFFLAG_INTROUSER_VMREC))) { char destdir[PATH_MAX]; snprintf(destdir, sizeof(destdir), "%s/meetme", ast_config_AST_SPOOL_DIR); @@ -2435,16 +2448,25 @@ ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", destdir, strerror(errno)); goto outrun; } + if( ast_test_flag64(confflags,CONFFLAG_INTROUSER_VMREC)){ + snprintf(user->namerecloc, sizeof(user->namerecloc), + "%s/voicemail/default/%s/greet",ast_config_AST_SPOOL_DIR,user->chan->caller.id.number.str); - snprintf(user->namerecloc, sizeof(user->namerecloc), - "%s/meetme-username-%s-%d", destdir, - conf->confno, user->user_no); + } + else{ + snprintf(user->namerecloc, sizeof(user->namerecloc), + "%s/meetme-username-%s-%d", destdir, + conf->confno, user->user_no); + } + + res=0; if (ast_test_flag64(confflags, CONFFLAG_INTROUSERNOREVIEW)) res = ast_play_and_record(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE), 0, NULL); - else + else if (!ast_fileexists(user->namerecloc, NULL, NULL) || ast_test_flag64(confflags, CONFFLAG_INTROUSER)) res = ast_record_review(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, NULL); if (res == -1) goto outrun; + } ast_mutex_lock(&conf->playlock); @@ -2621,7 +2643,7 @@ dahdic.confno = conf->dahdiconf; if (!ast_test_flag64(confflags, CONFFLAG_QUIET) && (ast_test_flag64(confflags, CONFFLAG_INTROUSER) || - ast_test_flag64(confflags, CONFFLAG_INTROUSERNOREVIEW)) && conf->users > 1) { + ast_test_flag64(confflags, CONFFLAG_INTROUSERNOREVIEW) || ast_test_flag64(confflags, CONFFLAG_INTROUSER_VMREC)) && conf->users > 1) { struct announce_listitem *item; if (!(item = ao2_alloc(sizeof(*item), NULL))) return -1; @@ -2629,6 +2651,9 @@ ast_copy_string(item->language, chan->language, sizeof(item->language)); item->confchan = conf->chan; item->confusers = conf->users; + if(ast_test_flag64(confflags, CONFFLAG_INTROUSER_VMREC)){ + item->vmrec = 1; + } item->announcetype = CONF_HASJOIN; ast_mutex_lock(&conf->announcelistlock); ao2_ref(item, +1); /* add one more so we can determine when announce_thread is done playing it */ @@ -3670,7 +3695,7 @@ conf_play(chan, conf, LEAVE); } - if (!ast_test_flag64(confflags, CONFFLAG_QUIET) && (ast_test_flag64(confflags, CONFFLAG_INTROUSER) || ast_test_flag64(confflags, CONFFLAG_INTROUSERNOREVIEW)) && conf->users > 1) { + if (!ast_test_flag64(confflags, CONFFLAG_QUIET) && (ast_test_flag64(confflags, CONFFLAG_INTROUSER) || ast_test_flag64(confflags, CONFFLAG_INTROUSERNOREVIEW) || ast_test_flag64(confflags, CONFFLAG_INTROUSER_VMREC)) && conf->users > 1) { struct announce_listitem *item; if (!(item = ao2_alloc(sizeof(*item), NULL))) return -1; @@ -3679,6 +3704,9 @@ item->confchan = conf->chan; item->confusers = conf->users; item->announcetype = CONF_HASLEFT; + if(ast_test_flag64(confflags, CONFFLAG_INTROUSER_VMREC)){ + item->vmrec = 1; + } ast_mutex_lock(&conf->announcelistlock); AST_LIST_INSERT_TAIL(&conf->announcelist, item, entry); ast_cond_signal(&conf->announcelist_addition); @@ -3925,9 +3953,9 @@ if (cnf) { if (confflags->flags && !cnf->chan && !ast_test_flag64(confflags, CONFFLAG_QUIET) && - ast_test_flag64(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW)) { + ast_test_flag64(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW) | CONFFLAG_INTROUSER_VMREC) { ast_log(LOG_WARNING, "No DAHDI channel available for conference, user introduction disabled (is chan_dahdi loaded?)\n"); - ast_clear_flag64(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW); + ast_clear_flag64(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW | CONFFLAG_INTROUSER_VMREC); } if (confflags && !cnf->chan && @@ -4029,9 +4057,9 @@ if (cnf) { if (confflags && !cnf->chan && !ast_test_flag64(confflags, CONFFLAG_QUIET) && - ast_test_flag64(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW)) { + ast_test_flag64(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW | CONFFLAG_INTROUSER_VMREC)) { ast_log(LOG_WARNING, "No DAHDI channel available for conference, user introduction disabled (is chan_dahdi loaded?)\n"); - ast_clear_flag64(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW); + ast_clear_flag64(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW | CONFFLAG_INTROUSER_VMREC); } if (confflags && !cnf->chan &&