Index: res/res_musiconhold.c =================================================================== RCS file: /usr/cvsroot/asterisk/res/res_musiconhold.c,v retrieving revision 1.24 diff -u -r1.24 res_musiconhold.c --- res/res_musiconhold.c 6 Apr 2004 22:17:32 -0000 1.24 +++ res/res_musiconhold.c 28 Apr 2004 20:27:25 -0000 @@ -75,6 +75,7 @@ int destroyme; int pid; /* PID of mpg123 */ int quiet; + int single; pthread_t thread; struct mohdata *members; /* Source of audio */ @@ -107,7 +108,7 @@ char *argv[MAX_MP3S + 50]; char xargs[256]; char *argptr; - int argc; + int argc = 0; DIR *dir; struct dirent *de; dir = opendir(class->dir); @@ -115,16 +116,20 @@ ast_log(LOG_WARNING, "%s is not a valid directory\n", class->dir); return -1; } - argv[0] = "mpg123"; - argv[1] = "-q"; - argv[2] = "-s"; - argv[3] = "--mono"; - argv[4] = "-r"; - argv[5] = "8000"; - argv[6] = "-b"; - argv[7] = "2048"; - argv[8] = "-f"; - argc = 9; + argv[argc++] = "mpg123"; + argv[argc++] = "-q"; + argv[argc++] = "-s"; + argv[argc++] = "--mono"; + argv[argc++] = "-r"; + argv[argc++] = "8000"; + + if (!class->single) { + argv[argc++] = "-b"; + argv[argc++] = "2048"; + } + + argv[argc++] = "-f"; + if (class->quiet) { argv[argc++] = "4096"; } else @@ -498,8 +503,10 @@ strncpy(moh->class, classname, sizeof(moh->class) - 1); if (miscargs) strncpy(moh->miscargs, miscargs, sizeof(moh->miscargs) - 1); - if (!strcasecmp(mode, "mp3") || !strcasecmp(mode, "quietmp3") || !strcasecmp(mode, "httpmp3")) { - if (!strcasecmp(mode, "quietmp3")) + if (!strcasecmp(mode, "mp3") || !strcasecmp(mode, "mp3nb") || !strcasecmp(mode, "quietmp3") || !strcasecmp(mode, "quietmp3nb") || !strcasecmp(mode, "httpmp3")) { + if (!strcasecmp(mode, "mp3nb") || !strcasecmp(mode, "quietmp3nb")) + moh->single = 1; + if (!strcasecmp(mode, "quietmp3") || !strcasecmp(mode, "quietmp3nb")) moh->quiet = 1; strncpy(moh->dir, param, sizeof(moh->dir) - 1); moh->srcfd = -1; @@ -596,7 +603,7 @@ ast_log(LOG_DEBUG, "mpg123 pid %d and child died after %d bytes read\n", moh->pid, tbytes); close(moh->srcfd); moh->pid = 0; - } + } moh = moh->next; } ast_mutex_unlock(&moh_lock); Index: configs/musiconhold.conf.sample =================================================================== RCS file: /usr/cvsroot/asterisk/configs/musiconhold.conf.sample,v retrieving revision 1.1 diff -u -r1.1 musiconhold.conf.sample --- configs/musiconhold.conf.sample 12 May 2002 11:48:14 -0000 1.1 +++ configs/musiconhold.conf.sample 28 Apr 2004 20:27:25 -0000 @@ -5,3 +5,5 @@ ;default => quietmp3:/var/lib/asterisk/mohmp3 ;loud => mp3:/var/lib/asterisk/mohmp3 ;random => quietmp3:/var/lib/asterisk/mohmp3,-z +;unbuffered => mp3nb:/var/lib/asterisk/mohmp3 +;quietunbuf => quietmp3nb:/var/lib/asterisk/mohmp3