Index: apps/app_mp3.c =================================================================== --- apps/app_mp3.c (revision 232226) +++ apps/app_mp3.c (working copy) @@ -104,6 +104,9 @@ for (x=STDERR_FILENO + 1;x<256;x++) { close(x); } + + setpgid(0, getpid()); + /* Execute mpg123, but buffer if it's a net connection */ if (!strncasecmp(filename, "http://", 7)) { /* Most commonly installed in /usr/local/bin */ @@ -121,7 +124,7 @@ /* As a last-ditch effort, try to use PATH */ execlp("mpg123", "mpg123", "-q", "-s", "-f", "8192", "--mono", "-r", "8000", filename, (char *)NULL); } - ast_log(LOG_WARNING, "Execute of mpg123 failed\n"); + fprintf(stderr, "Execute of mpg123 failed\n"); _exit(0); } @@ -244,8 +247,12 @@ close(fds[0]); close(fds[1]); - if (pid > -1) - kill(pid, SIGKILL); + if (pid > 0) { + killpg(pid, SIGTERM); + usleep(100000); + killpg(pid, SIGKILL); + waitpid(pid, NULL, 0); + } if (!res && owriteformat) ast_set_write_format(chan, owriteformat); Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 232226) +++ apps/app_voicemail.c (working copy) @@ -5445,28 +5445,29 @@ /* Can't think of how other diffs might be helpful, but I'm sure somebody will think of something. */ #endif - if (the_zone) + if (the_zone) { res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, the_zone->msg_format, the_zone->timezone); - else if (!strcasecmp(chan->language,"pl")) /* POLISH syntax */ - res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q HM", NULL); - else if (!strcasecmp(chan->language,"se")) /* SWEDISH syntax */ - res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' dB 'digits/at' k 'and' M", NULL); - else if (!strcasecmp(chan->language,"no")) /* NORWEGIAN syntax */ + } else if (!strncasecmp(chan->language, "de", 2)) { /* GERMAN syntax */ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL); - else if (!strcasecmp(chan->language,"de")) /* GERMAN syntax */ - res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL); - else if (!strcasecmp(chan->language,"nl")) /* DUTCH syntax */ - res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/nl-om' HM", NULL); - else if (!strcasecmp(chan->language,"it")) /* ITALIAN syntax */ - res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' 'digits/hours' k 'digits/e' M 'digits/minutes'", NULL); - else if (!strcasecmp(chan->language,"gr")) + } else if (!strncasecmp(chan->language, "gr", 2)) { /* GREEK syntax */ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q H 'digits/kai' M ", NULL); - else if (!strcasecmp(chan->language,"pt_BR")) - res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Ad 'digits/pt-de' B 'digits/pt-de' Y 'digits/pt-as' HM ", NULL); - else if (!strcasecmp(chan->language,"he")) + } else if (!strncasecmp(chan->language, "he", 2)) { /* HEBREW syntax */ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Ad 'at2' kM", NULL); - else + } else if (!strncasecmp(chan->language, "it", 2)) { /* ITALIAN syntax */ + res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' 'digits/hours' k 'digits/e' M 'digits/minutes'", NULL); + } else if (!strncasecmp(chan->language, "nl", 2)) { /* DUTCH syntax */ + res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/nl-om' HM", NULL); + } else if (!strncasecmp(chan->language, "no", 2)) { /* NORWEGIAN syntax */ + res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL); + } else if (!strncasecmp(chan->language, "pl", 2)) { /* POLISH syntax */ + res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q HM", NULL); + } else if (!strncasecmp(chan->language, "pt_BR", 5)) { /* PORTUGUESE syntax */ + res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Ad 'digits/pt-de' B 'digits/pt-de' Y 'digits/pt-as' HM ", NULL); + } else if (!strncasecmp(chan->language, "se", 2)) { /* SWEDISH syntax */ + res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' dB 'digits/at' k 'and' M", NULL); + } else { res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' IMp", NULL); + } #if 0 pbx_builtin_setvar_helper(chan, "DIFF_DAY", NULL); #endif @@ -5562,7 +5563,7 @@ res = wait_file2(chan, vms, "vm-duration"); /* POLISH syntax */ - if (!strcasecmp(chan->language, "pl")) { + if (!strncasecmp(chan->language, "pl", 2)) { div_t num = div(durationm, 10); if (durationm == 1) { @@ -5604,7 +5605,7 @@ make_file(vms->fn, sizeof(vms->fn), vms->curdir, vms->curmsg); adsi_message(chan, vms); - if (!strcasecmp(chan->language, "he")) { /* HEBREW FORMAT */ + if (!strncasecmp(chan->language, "he", 2)) { /* HEBREW FORMAT */ /* * The syntax in hebrew for counting the number of message is up side down * in comparison to english. @@ -5624,15 +5625,15 @@ res = ast_say_number(chan, vms->curmsg + 1, AST_DIGIT_ANY, chan->language, "f"); } } - } + } - } else if (!strcasecmp(chan->language, "pl")) { /* POLISH FORMAT */ + } else if (!strncasecmp(chan->language, "pl", 2)) { /* POLISH FORMAT */ if (vms->curmsg && (vms->curmsg != vms->lastmsg)) { int ten, one; char nextmsg[256]; ten = (vms->curmsg + 1) / 10; one = (vms->curmsg + 1) % 10; - + if (vms->curmsg < 20) { snprintf(nextmsg, sizeof(nextmsg), "digits/n-%d", vms->curmsg + 1); res = wait_file2(chan, vms, nextmsg); @@ -5650,7 +5651,7 @@ if (!res) res = wait_file2(chan, vms, "vm-message"); - } else if (!strcasecmp(chan->language, "se")) { /* SWEDISH FORMAT */ + } else if (!strncasecmp(chan->language, "se", 2)) { /* SWEDISH FORMAT */ if (!vms->curmsg) res = wait_file2(chan, vms, "vm-first"); /* "First" */ else if (vms->curmsg == vms->lastmsg) @@ -5896,16 +5897,18 @@ { int cmd; - if (!strcasecmp(chan->language, "it") || !strcasecmp(chan->language, "es") || !strcasecmp(chan->language, "pt") || !strcasecmp(chan->language, "pt_BR")) { /* Italian, Spanish, French or Portuguese syntax */ + if ( !strncasecmp(chan->language, "it", 2) || + !strncasecmp(chan->language, "es", 2) || + !strncasecmp(chan->language, "pt", 2)) { /* Italian, Spanish, or Portuguese syntax */ cmd = ast_play_and_wait(chan, "vm-messages"); /* "messages */ return cmd ? cmd : ast_play_and_wait(chan, mbox); - } else if (!strcasecmp(chan->language, "gr")){ + } else if (!strncasecmp(chan->language, "gr", 2)) { return vm_play_folder_name_gr(chan, mbox); - } else if (!strcasecmp(chan->language, "pl")){ + } else if (!strncasecmp(chan->language, "pl", 2)) { return vm_play_folder_name_pl(chan, mbox); - } else if (!strcasecmp(chan->language, "ua")){ /* Ukrainian syntax */ + } else if (!strncasecmp(chan->language, "ua", 2)) { /* Ukrainian syntax */ return vm_play_folder_name_ua(chan, mbox); - } else if (!strcasecmp(chan->language, "he")){ /* Hebrew syntax */ + } else if (!strncasecmp(chan->language, "he", 2)) { /* Hebrew syntax */ cmd = ast_play_and_wait(chan, mbox); return cmd; } else { /* Default English */ @@ -6673,7 +6676,7 @@ * vm-no : no ( no messages ) */ -static int vm_intro_cz(struct ast_channel *chan,struct vm_state *vms) +static int vm_intro_cs(struct ast_channel *chan,struct vm_state *vms) { int res; res = ast_play_and_wait(chan, "vm-youhave"); @@ -6747,37 +6750,44 @@ } /* Play voicemail intro - syntax is different for different languages */ - if (!strcasecmp(chan->language, "de")) { /* GERMAN syntax */ + if (0) { + } else if (!strncasecmp(chan->language, "cs", 2)) { /* CZECH syntax */ + return vm_intro_cs(chan, vms); + } else if (!strncasecmp(chan->language, "cz", 2)) { /* deprecated CZECH syntax */ + static int deprecation_warning = 0; + if (deprecation_warning++ % 10 == 0) { + ast_log(LOG_WARNING, "cz is not a standard language code. Please switch to using cs instead.\n"); + } + return vm_intro_cs(chan, vms); + } else if (!strncasecmp(chan->language, "de", 2)) { /* GERMAN syntax */ return vm_intro_de(chan, vms); - } else if (!strcasecmp(chan->language, "es")) { /* SPANISH syntax */ + } else if (!strncasecmp(chan->language, "es", 2)) { /* SPANISH syntax */ return vm_intro_es(chan, vms); - } else if (!strcasecmp(chan->language, "it")) { /* ITALIAN syntax */ + } else if (!strncasecmp(chan->language, "fr", 2)) { /* FRENCH syntax */ + return vm_intro_fr(chan, vms); + } else if (!strncasecmp(chan->language, "gr", 2)) { /* GREEK syntax */ + return vm_intro_gr(chan, vms); + } else if (!strncasecmp(chan->language, "he", 2)) { /* HEBREW syntax */ + return vm_intro_he(chan, vms); + } else if (!strncasecmp(chan->language, "it", 2)) { /* ITALIAN syntax */ return vm_intro_it(chan, vms); - } else if (!strcasecmp(chan->language, "fr")) { /* FRENCH syntax */ - return vm_intro_fr(chan, vms); - } else if (!strcasecmp(chan->language, "nl")) { /* DUTCH syntax */ + } else if (!strncasecmp(chan->language, "nl", 2)) { /* DUTCH syntax */ return vm_intro_nl(chan, vms); - } else if (!strcasecmp(chan->language, "pt")) { /* PORTUGUESE syntax */ + } else if (!strncasecmp(chan->language, "no", 2)) { /* NORWEGIAN syntax */ + return vm_intro_no(chan, vms); + } else if (!strncasecmp(chan->language, "pl", 2)) { /* POLISH syntax */ + return vm_intro_pl(chan, vms); + } else if (!strncasecmp(chan->language, "pt_BR", 5)) { /* BRAZILIAN PORTUGUESE syntax */ + return vm_intro_pt_BR(chan, vms); + } else if (!strncasecmp(chan->language, "pt", 2)) { /* PORTUGUESE syntax */ return vm_intro_pt(chan, vms); - } else if (!strcasecmp(chan->language, "pt_BR")) { /* BRAZILIAN PORTUGUESE syntax */ - return vm_intro_pt_BR(chan, vms); - } else if (!strcasecmp(chan->language, "cz")) { /* CZECH syntax */ - return vm_intro_cz(chan, vms); - } else if (!strcasecmp(chan->language, "gr")) { /* GREEK syntax */ - return vm_intro_gr(chan, vms); - } else if (!strcasecmp(chan->language, "pl")) { /* POLISH syntax */ - return vm_intro_pl(chan, vms); - } else if (!strcasecmp(chan->language, "se")) { /* SWEDISH syntax */ + } else if (!strncasecmp(chan->language, "ru", 2)) { /* RUSSIAN syntax */ + return vm_intro_multilang(chan, vms, "n"); + } else if (!strncasecmp(chan->language, "se", 2)) { /* SWEDISH syntax */ return vm_intro_se(chan, vms); - } else if (!strcasecmp(chan->language, "no")) { /* NORWEGIAN syntax */ - return vm_intro_no(chan, vms); - } else if (!strcasecmp(chan->language, "ru")) { /* RUSSIAN syntax */ + } else if (!strncasecmp(chan->language, "ua", 2)) { /* UKRAINIAN syntax */ return vm_intro_multilang(chan, vms, "n"); - } else if (!strcasecmp(chan->language, "ua")) { /* UKRAINIAN syntax */ - return vm_intro_multilang(chan, vms, "n"); - } else if (!strcasecmp(chan->language, "he")) { /* HEBREW syntax */ - return vm_intro_he(chan, vms); - } else { /* Default to ENGLISH */ + } else { /* Default to ENGLISH */ return vm_intro_en(chan, vms); } } @@ -6790,8 +6800,9 @@ if (vms->starting) { if (vms->lastmsg > -1) { res = ast_play_and_wait(chan, "vm-onefor"); - if (!strcasecmp(chan->language, "he")) + if (!strncasecmp(chan->language, "he", 2)) { res = ast_play_and_wait(chan, "vm-for"); + } if (!res) res = vm_play_folder_name(chan, vms->vmbox); } @@ -7219,17 +7230,17 @@ static int vm_browse_messages(struct ast_channel *chan, struct vm_state *vms, struct ast_vm_user *vmu) { - if (!strcasecmp(chan->language, "es")) { /* SPANISH */ + if (!strncasecmp(chan->language, "es", 2)) { /* SPANISH */ return vm_browse_messages_es(chan, vms, vmu); - } else if (!strcasecmp(chan->language, "it")) { /* ITALIAN */ + } else if (!strncasecmp(chan->language, "gr", 2)) { /* GREEK */ + return vm_browse_messages_gr(chan, vms, vmu); + } else if (!strncasecmp(chan->language, "he", 2)) { /* HEBREW */ + return vm_browse_messages_he(chan, vms, vmu); + } else if (!strncasecmp(chan->language, "it", 2)) { /* ITALIAN */ return vm_browse_messages_it(chan, vms, vmu); - } else if (!strcasecmp(chan->language, "pt") || !strcasecmp(chan->language, "pt_BR")) { /* PORTUGUESE */ + } else if (!strncasecmp(chan->language, "pt", 2)) { /* PORTUGUESE */ return vm_browse_messages_pt(chan, vms, vmu); - } else if (!strcasecmp(chan->language, "gr")){ - return vm_browse_messages_gr(chan, vms, vmu); /* GREEK */ - } else if (!strcasecmp(chan->language, "he")) { - return vm_browse_messages_he(chan, vms, vmu); /* HEBREW */ - } else { /* Default to English syntax */ + } else { /* Default to English syntax */ return vm_browse_messages_en(chan, vms, vmu); } } @@ -7829,8 +7840,9 @@ case '*': if (!vms.starting) { cmd = ast_play_and_wait(chan, "vm-onefor"); - if (!strcasecmp(chan->language, "he")) + if (!strncasecmp(chan->language, "he", 2)) { cmd = ast_play_and_wait(chan, "vm-for"); + } if (!cmd) cmd = vm_play_folder_name(chan, vms.vmbox); if (!cmd)