From c4d4c636d0a249eca13af323d35e4242eb954718 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Fri, 25 Jul 2008 22:08:06 +0000 Subject: Hebrew syntax for voicemail prompts (closes issue #13155) Reported by: greenfieldtech Patches: app_voicemail.c.patch uploaded by greenfieldtech (license 369) hebrew.ods uploaded by greenfieldtech (license 369) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@133904 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_voicemail.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 128 insertions(+), 4 deletions(-) (limited to 'apps') diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 63974d20b..e83eaf270 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -5715,10 +5715,33 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc adsi_message(chan, vms); ast_debug(5,"************** About to check urgent flag, set to:%s\n", flag); - if (!vms->curmsg) - res = wait_file2(chan, vms, "vm-first"); /* "First" */ - else if (vms->curmsg == vms->lastmsg) - res = wait_file2(chan, vms, "vm-last"); /* "last" */ + if (!strcasecmp(chan->language, "he")) { /* HEBREW FORMAT */ + /* + * The syntax in hebrew for counting the number of message is up side down + * in comparison to english. + */ + if (!vms->curmsg) { + res = wait_file2(chan, vms, "vm-message"); + res = wait_file2(chan, vms, "vm-first"); /* "First" */ + } else if (vms->curmsg == vms->lastmsg) { + res = wait_file2(chan, vms, "vm-message"); + res = wait_file2(chan, vms, "vm-last"); /* "last" */ + } else { + res = wait_file2(chan, vms, "vm-message"); /* "message" */ + if (vms->curmsg && (vms->curmsg != vms->lastmsg)) { + ast_log(LOG_DEBUG, "curmsg: %s\n", vms->curmsg); + ast_log(LOG_DEBUG, "lagmsg: %s\n", vms->lastmsg); + if (!res) { + res = ast_say_number(chan, vms->curmsg + 1, AST_DIGIT_ANY, chan->language, "f"); + } + } + } + } else { + if (!vms->curmsg) + res = wait_file2(chan, vms, "vm-first"); /* "First" */ + else if (vms->curmsg == vms->lastmsg) + res = wait_file2(chan, vms, "vm-last"); /* "last" */ + } /* Play the word urgent if we are listening to urgent messages */ if (!ast_strlen_zero(flag) && !strcmp(flag, "Urgent")) { res = wait_file2(chan, vms, "vm-Urgent"); /* "urgent" */ @@ -5849,6 +5872,19 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc } if (!res) res = wait_file2(chan, vms, "vm-message"); + /* HEBREW syntax */ + } else if (!strcasecmp(chan->language, "he")) { + if (!vms->curmsg) { + res = wait_file2(chan, vms, "vm-message"); + res = wait_file2(chan, vms, "vm-first"); + } else if (vms->curmsg == vms->lastmsg) { + res = wait_file2(chan, vms, "vm-message"); + res = wait_file2(chan, vms, "vm-last"); + } else { + res = wait_file2(chan, vms, "vm-message"); + res = wait_file2(chan, vms, "vm-number"); + res = ast_say_number(chan, vms->curmsg + 1, AST_DIGIT_ANY, chan->language, "f"); + } } else { if (!strcasecmp(chan->language, "se")) /* SWEDISH syntax */ res = wait_file2(chan, vms, "vm-meddelandet"); /* "message" */ @@ -6442,6 +6478,73 @@ static int vm_intro_gr(struct ast_channel *chan, struct vm_state *vms) res = ast_play_and_wait(chan, "vm-denExeteMynhmata"); return res; } + +/* Hebrew syntax */ +static int vm_intro_he(struct ast_channel *chan, struct vm_state *vms) +{ + int res = 0; + + /* Introduce messages they have */ + if (!res) { + if ((vms->newmessages) || (vms->oldmessages)) { + res = ast_play_and_wait(chan, "vm-youhave"); + } + /* + * The word "shtei" refers to the number 2 in hebrew when performing a count + * of elements. In Hebrew, there are 6 forms of enumerating the number 2 for + * an element, this is one of them. + */ + if (vms->newmessages) { + if (!res) { + if (vms->newmessages == 1) { + res = ast_play_and_wait(chan, "vm-INBOX1"); + } else { + if (vms->newmessages == 2) { + res = ast_play_and_wait(chan, "vm-shtei"); + } else { + res = ast_say_number(chan, vms->newmessages, AST_DIGIT_ANY, chan->language, "f"); + } + res = ast_play_and_wait(chan, "vm-INBOX"); + } + } + if (vms->oldmessages && !res) { + res = ast_play_and_wait(chan, "vm-and"); + if (vms->oldmessages == 1) { + res = ast_play_and_wait(chan, "vm-Old1"); + } else { + if (vms->oldmessages == 2) { + res = ast_play_and_wait(chan, "vm-shtei"); + } else { + res = ast_say_number(chan, vms->oldmessages, AST_DIGIT_ANY, chan->language, "f"); + } + res = ast_play_and_wait(chan, "vm-Old"); + } + } + } + if (!res && vms->oldmessages && !vms->newmessages) { + if (!res) { + if (vms->oldmessages == 1) { + res = ast_play_and_wait(chan, "vm-Old1"); + } else { + if (vms->oldmessages == 2) { + res = ast_play_and_wait(chan, "vm-shtei"); + } else { + res = ast_say_number(chan, vms->oldmessages, AST_DIGIT_ANY, chan->language, "f"); + } + res = ast_play_and_wait(chan, "vm-Old"); + } + } + } + if (!res) { + if (!vms->oldmessages && !vms->newmessages) { + if (!res) { + res = ast_play_and_wait(chan, "vm-nomessages"); + } + } + } + } + return res; +} /* Default English syntax */ static int vm_intro_en(struct ast_channel *chan, struct vm_state *vms) @@ -7283,6 +7386,8 @@ static int vm_intro(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm return vm_intro_tw(chan, vms); } else if (!strcasecmp(chan->language, "ua")) { /* UKRAINIAN syntax */ return vm_intro_ua(chan, vms); + } else if (!strcasecmp(chan->language, "he")) { /* HEBREW syntax */ + return vm_intro_he(chan, vms); } else { /* Default to ENGLISH */ return vm_intro_en(chan, vms); } @@ -7748,6 +7853,23 @@ static int vm_browse_messages_gr(struct ast_channel *chan, struct vm_state *vms, return cmd; } +/* Hebrew Syntax */ +static int vm_browse_messages_he(struct ast_channel *chan, struct vm_state *vms, struct ast_vm_user *vmu) +{ + int cmd = 0; + + if (vms->lastmsg > -1) { + cmd = play_message(chan, vmu, vms); + } else { + if (!strcasecmp(vms->fn, "INBOX")) { + cmd = ast_play_and_wait(chan, "vm-nonewmessages"); + } else { + cmd = ast_play_and_wait(chan, "vm-nomessages"); + } + } + return cmd; +} + /*! * \brief Default English syntax for 'You have N messages' greeting. * \param chan @@ -7905,6 +8027,8 @@ static int vm_browse_messages(struct ast_channel *chan, struct vm_state *vms, st return vm_browse_messages_gr(chan, vms, vmu); /* GREEK */ } else if (!strcasecmp(chan->language, "tw")){ return vm_browse_messages_tw(chan, vms, vmu); /* CHINESE (Taiwan) */ + } else if (!strcasecmp(chan->language, "he")) { + return vm_browse_messages_he(chan, vms, vmu); /* HEBREW */ } else { /* Default to English syntax */ return vm_browse_messages_en(chan, vms, vmu); } -- cgit v1.2.3