Merged revisions 80044 via svnmerge from
authorMark Michelson <mmichelson@digium.com>
Mon, 20 Aug 2007 15:37:13 +0000 (15:37 +0000)
committerMark Michelson <mmichelson@digium.com>
Mon, 20 Aug 2007 15:37:13 +0000 (15:37 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r80044 | mmichelson | 2007-08-20 10:34:43 -0500 (Mon, 20 Aug 2007) | 5 lines

Ukrainian language voicemail support.

(closes issue #10458, reported and patched by Oleh)

........

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

apps/app_voicemail.c

index 8dfffd5..46c57ec 100644 (file)
@@ -277,6 +277,7 @@ static int load_config(int reload);
        \arg \b no    - Norwegian
        \arg \b se    - Swedish
        \arg \b tw    - Chinese (Taiwan)
+       \arg \b ua - Ukrainian
 
 German requires the following additional soundfile:
 \arg \b 1F     einE (feminine)
@@ -321,6 +322,11 @@ Dutch also uses:
 Spanish also uses:
 \arg \b vm-youhaveno
 
+Ukrainian requires the following additional soundfile:
+\arg \b vm-nove                'nove'
+\arg \b vm-stare       'stare'
+\arg \b digits/ua/1e   'odne'
+
 Italian requires the following additional soundfile:
 
 For vm_intro_it:
@@ -5263,6 +5269,19 @@ static int vm_play_folder_name_pl(struct ast_channel *chan, char *mbox)
        }
 }
 
+static int vm_play_folder_name_ua(struct ast_channel *chan, char *mbox)
+{
+       int cmd;
+
+       if (!strcasecmp(mbox, "vm-Family") || !strcasecmp(mbox, "vm-Friends") || !strcasecmp(mbox, "vm-Work")){
+               cmd = ast_play_and_wait(chan, "vm-messages");
+               return cmd ? cmd : ast_play_and_wait(chan, mbox);
+       } else {
+               cmd = ast_play_and_wait(chan, mbox);
+               return cmd ? cmd : ast_play_and_wait(chan, "vm-messages");
+       }
+}
+
 static int vm_play_folder_name(struct ast_channel *chan, char *mbox)
 {
        int cmd;
@@ -5274,6 +5293,8 @@ static int vm_play_folder_name(struct ast_channel *chan, char *mbox)
                return vm_play_folder_name_gr(chan, mbox);
        } else if (!strcasecmp(chan->language, "pl")){
                return vm_play_folder_name_pl(chan, mbox);
+       } else if (!strcasecmp(chan->language, "ua")){  /* Ukrainian syntax */
+               return vm_play_folder_name_ua(chan, mbox);
        } else {  /* Default English */
                cmd = ast_play_and_wait(chan, mbox);
                return cmd ? cmd : ast_play_and_wait(chan, "vm-messages"); /* "messages */
@@ -6011,7 +6032,6 @@ static int vm_intro_ru(struct ast_channel *chan,struct vm_state *vms)
 static int vm_intro_tw(struct ast_channel *chan, struct vm_state *vms)
 {
        int res;
-
        /* Introduce messages they have */
        res = ast_play_and_wait(chan, "vm-you");
 
@@ -6048,8 +6068,79 @@ static int vm_intro_tw(struct ast_channel *chan, struct vm_state *vms)
     return res;
 }
 
+/* UKRAINIAN syntax */
+/* in ukrainian the syntax is different so we need the following files
+ * --------------------------------------------------------
+ * /digits/ua/1e 'odne'
+ * vm-nove       'nove'
+ * vm-stare      'stare'
+ */
+static int vm_intro_ua(struct ast_channel *chan,struct vm_state *vms)
+{
+       int res;
+       int lastnum = 0;
+       int dcnum;
+
+       res = ast_play_and_wait(chan, "vm-youhave");
+       if (!res && vms->newmessages) {
+               lastnum = get_lastdigits(vms->newmessages);
+               dcnum = vms->newmessages - lastnum;
+               if (dcnum)
+                       res = say_and_wait(chan, dcnum, chan->language);
+               if (!res && lastnum) {
+                       if (lastnum == 1) 
+                               res = ast_play_and_wait(chan, "digits/ua/1e");
+                       else
+                               res = say_and_wait(chan, lastnum, chan->language);
+               }
+
+               if (!res)
+                       res = ast_play_and_wait(chan, (lastnum == 1) ? "vm-nove" : "vm-INBOX");
+
+               if (!res && vms->oldmessages)
+                       res = ast_play_and_wait(chan, "vm-and");
+       }
+
+       if (!res && vms->oldmessages) {
+               lastnum = get_lastdigits(vms->oldmessages);
+               dcnum = vms->oldmessages - lastnum;
+               if (dcnum)
+                       res = say_and_wait(chan, dcnum, chan->language);
+               if (!res && lastnum) {
+                       if (lastnum == 1) 
+                               res = ast_play_and_wait(chan, "digits/ua/1e");
+                       else
+                               res = say_and_wait(chan, lastnum, chan->language);
+               }
+
+               if (!res)
+                       res = ast_play_and_wait(chan, (lastnum == 1) ? "vm-stare" : "vm-Old");
+       }
+
+       if (!res && !vms->newmessages && !vms->oldmessages) {
+               lastnum = 0;
+               res = ast_play_and_wait(chan, "vm-no");
+       }
+
+       if (!res) {
+               switch (lastnum) {
+               case 1:
+               case 2:
+               case 3:
+               case 4:
+                       res = ast_play_and_wait(chan, "vm-message");
+                       break;
+               default:
+                       res = ast_play_and_wait(chan, "vm-messages");
+                       break;
+               }
+       }
+
+       return res;
+}
 
 
+>>>>>>> .merge-right.r80044
 static int vm_intro(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms)
 {
        char prefile[256];
@@ -6090,6 +6181,8 @@ static int vm_intro(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm
                return vm_intro_ru(chan, vms);
        } else if (!strcasecmp(chan->language, "tw")) { /* CHINESE (Taiwan) syntax */
                return vm_intro_tw(chan, vms);
+       } else if (!strcasecmp(chan->language, "ua")) { /* UKRAINIAN syntax */
+               return vm_intro_ua(chan, vms);
        } else {                                        /* Default to ENGLISH */
                return vm_intro_en(chan, vms);
        }