]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
this is for 8778 (pt_BR backport to 1.4). It was committed to trunk via 7663. But...
authorSteve Murphy <murf@digium.com>
Mon, 29 Jan 2007 17:57:08 +0000 (17:57 +0000)
committerSteve Murphy <murf@digium.com>
Mon, 29 Jan 2007 17:57:08 +0000 (17:57 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@52535 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c
main/say.c

index 6da5c7bd6261dd77162ecfd668773e639f66ce38..e95e59c6d2a0f748b6a0dac71d9da5d42e219872 100644 (file)
@@ -223,6 +223,7 @@ static int load_config(void);
        \arg \b nl - Dutch
        \arg \b pt - Polish
        \arg \b pt - Portuguese
+       \arg \b pt_BR - Portuguese (Brazil)
        \arg \b gr - Greek
        \arg \b no - Norwegian
        \arg \b se - Swedish
@@ -4241,6 +4242,8 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v
                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"))
                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
                res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' IMp", NULL);
 #if 0
@@ -4870,7 +4873,7 @@ static int vm_play_folder_name(struct ast_channel *chan, char *mbox)
 {
        int cmd;
 
-       if (!strcasecmp(chan->language, "it") || !strcasecmp(chan->language, "es") || !strcasecmp(chan->language, "fr") || !strcasecmp(chan->language, "pt")) { /* Italian, Spanish, French or Portuguese syntax */
+       if (!strcasecmp(chan->language, "it") || !strcasecmp(chan->language, "es") || !strcasecmp(chan->language, "fr") || !strcasecmp(chan->language, "pt") || !strcasecmp(chan->language, "pt_BR")) { /* Italian, Spanish, French 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")){
@@ -5272,6 +5275,54 @@ static int vm_intro_es(struct ast_channel *chan,struct vm_state *vms)
 return res;
 }
 
+/* BRAZILIAN PORTUGUESE syntax */
+static int vm_intro_pt_BR(struct ast_channel *chan,struct vm_state *vms) {
+       /* Introduce messages they have */
+       int res;
+       if (!vms->oldmessages && !vms->newmessages) {
+               res = ast_play_and_wait(chan, "vm-nomessages");
+               return res;
+       }
+       else {
+               res = ast_play_and_wait(chan, "vm-youhave");
+       }
+       if (vms->newmessages) {
+               if (!res)
+                       res = ast_say_number(chan, vms->newmessages, AST_DIGIT_ANY, chan->language, "f");
+               if ((vms->newmessages == 1)) {
+                       if (!res)
+                               res = ast_play_and_wait(chan, "vm-message");
+                       if (!res)
+                               res = ast_play_and_wait(chan, "vm-INBOXs");
+               }
+               else {
+                       if (!res)
+                               res = ast_play_and_wait(chan, "vm-messages");
+                       if (!res)
+                               res = ast_play_and_wait(chan, "vm-INBOX");
+               }
+               if (vms->oldmessages && !res)
+                       res = ast_play_and_wait(chan, "vm-and");
+       }
+       if (vms->oldmessages) {
+               if (!res)
+                       res = ast_say_number(chan, vms->oldmessages, AST_DIGIT_ANY, chan->language, "f");
+               if (vms->oldmessages == 1) {
+                       if (!res)
+                               res = ast_play_and_wait(chan, "vm-message");
+                       if (!res)
+                               res = ast_play_and_wait(chan, "vm-Olds");
+               }
+               else {
+                       if (!res)
+               res = ast_play_and_wait(chan, "vm-messages");
+                       if (!res)
+                               res = ast_play_and_wait(chan, "vm-Old");
+               }
+       }
+       return res;
+}
+
 /* FRENCH syntax */
 static int vm_intro_fr(struct ast_channel *chan,struct vm_state *vms)
 {
@@ -5587,6 +5638,8 @@ static int vm_intro(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm
                return vm_intro_nl(chan, vms);
        } else if (!strcasecmp(chan->language, "pt")) { /* 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 */
@@ -6005,7 +6058,7 @@ static int vm_browse_messages(struct ast_channel *chan, struct vm_state *vms, st
                return vm_browse_messages_es(chan, vms, vmu);
        } else if (!strcasecmp(chan->language, "it")) { /* ITALIAN */
                return vm_browse_messages_it(chan, vms, vmu);
-       } else if (!strcasecmp(chan->language, "pt")) { /* PORTUGUESE */
+       } else if (!strcasecmp(chan->language, "pt") || !strcasecmp(chan->language, "pt_BR")) { /* PORTUGUESE */
                return vm_browse_messages_pt(chan, vms, vmu);
        } else if (!strcasecmp(chan->language, "gr")){
                return vm_browse_messages_gr(chan, vms, vmu);   /* GREEK */
index d51cda9864b7b2ad49ca093c27d4b61b21c8306e..a8a207135dbe085ed2e2b4689a24a96bf79d1ec5 100644 (file)
@@ -270,6 +270,7 @@ static int say_digit_str_full(struct ast_channel *chan, const char *str, const c
       \arg \b no    - Norwegian
       \arg \b pl    - Polish       
       \arg \b pt    - Portuguese
+      \arg \b pt_BR - Portuguese (Brazil)
       \arg \b se    - Swedish
       \arg \b tw    - Taiwanese / Chinese
       \arg \b ru    - Russian
@@ -360,6 +361,7 @@ static int ast_say_time_de(struct ast_channel *chan, time_t t, const char *ints,
 static int ast_say_time_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_time_nl(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_time_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
+static int ast_say_time_pt_BR(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_time_tw(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_time_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 
@@ -368,6 +370,7 @@ static int ast_say_datetime_de(struct ast_channel *chan, time_t t, const char *i
 static int ast_say_datetime_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_nl(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
+static int ast_say_datetime_pt_BR(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_tw(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 
@@ -413,7 +416,7 @@ static int say_number_full(struct ast_channel *chan, int num, const char *ints,
           return(ast_say_number_full_nl(chan, num, ints, language, audiofd, ctrlfd));
        } else if (!strcasecmp(language, "pl") ) {      /* Polish syntax */
           return(ast_say_number_full_pl(chan, num, ints, language, options, audiofd, ctrlfd));
-       } else if (!strcasecmp(language, "pt") ) {      /* Portuguese syntax */
+       } else if (!strcasecmp(language, "pt") || !strcasecmp(language, "pt_BR")) {     /* Portuguese syntax */
           return(ast_say_number_full_pt(chan, num, ints, language, options, audiofd, ctrlfd));
        } else if (!strcasecmp(language, "se") ) {      /* Swedish syntax */
           return(ast_say_number_full_se(chan, num, ints, language, options, audiofd, ctrlfd));
@@ -1980,6 +1983,10 @@ static int ast_say_number_full_pt(struct ast_channel *chan, int num, const char
                                (!(num % 1000) && (((num / 1000) % 1000) < 100 || !((num / 1000) % 100))) ) )
                                playh = 1;
                        num = num % 1000000;
+               } else {
+                       /* number is too big */
+                       ast_log(LOG_WARNING, "Number '%d' is too big to say.", num);
+                       res = -1;                       
                }
                if (!res) {
                        if (!ast_streamfile(chan, fn, language)) {
@@ -2696,7 +2703,7 @@ static int say_date(struct ast_channel *chan, time_t t, const char *ints, const
                return(ast_say_date_fr(chan, t, ints, lang));
        } else if (!strcasecmp(lang, "nl") ) {  /* Dutch syntax */
                return(ast_say_date_nl(chan, t, ints, lang));
-       } else if (!strcasecmp(lang, "pt") ) {  /* Portuguese syntax */
+       } else if (!strcasecmp(lang, "pt") || !strcasecmp(lang, "pt_BR")) {     /* Portuguese syntax */
                return(ast_say_date_pt(chan, t, ints, lang));
        } else if (!strcasecmp(lang, "gr") ) {                          /* Greek syntax */
                return(ast_say_date_gr(chan, t, ints, lang));
@@ -2933,7 +2940,7 @@ static int say_date_with_format(struct ast_channel *chan, time_t time, const cha
                return(ast_say_date_with_format_nl(chan, time, ints, lang, format, timezone));
        } else if (!strcasecmp(lang, "pl") ) {  /* Polish syntax */
                return(ast_say_date_with_format_pl(chan, time, ints, lang, format, timezone));
-       } else if (!strcasecmp(lang, "pt") ) {  /* Portuguese syntax */
+       } else if (!strcasecmp(lang, "pt") || !strcasecmp(lang, "pt_BR")) {     /* Portuguese syntax */
                return(ast_say_date_with_format_pt(chan, time, ints, lang, format, timezone));
        } else if (!strcasecmp(lang, "tw") || !strcasecmp(lang, "zh") ) {       /* Taiwanese / Chinese syntax */
                return(ast_say_date_with_format_tw(chan, time, ints, lang, format, timezone));
@@ -4916,8 +4923,12 @@ int ast_say_date_with_format_pt(struct ast_channel *chan, time_t time, const cha
                                break;
                        case 'm':
                                /* First - Twelfth */
-                               snprintf(nextmsg,sizeof(nextmsg), "digits/h-%d", tm.tm_mon +1);
-                               res = wait_file(chan,ints,nextmsg,lang);
+                               if (!strcasecmp(lang, "pt_BR")) {
+                                       res = ast_say_number(chan, tm.tm_mon+1, ints, lang, (char *) NULL);
+                               } else {
+                                       snprintf(nextmsg,sizeof(nextmsg), "digits/h-%d", tm.tm_mon +1);
+                                       res = wait_file(chan,ints,nextmsg,lang);
+                               }
                                break;
                        case 'd':
                        case 'e':
@@ -4931,66 +4942,126 @@ int ast_say_date_with_format_pt(struct ast_channel *chan, time_t time, const cha
                        case 'I':
                        case 'l':
                                /* 12-Hour */
-                               if (tm.tm_hour == 0) {
-                                       if (format[offset] == 'I')
-                                               res = wait_file(chan, ints, "digits/pt-ah", lang);
-                                       if (!res)
-                                               res = wait_file(chan, ints, "digits/pt-meianoite", lang);
-                               }
-                               else if (tm.tm_hour == 12) {
-                                       if (format[offset] == 'I')
-                                               res = wait_file(chan, ints, "digits/pt-ao", lang);
-                                       if (!res)
-                                               res = wait_file(chan, ints, "digits/pt-meiodia", lang);
-                               }
-                               else {
-                                       if (format[offset] == 'I') {
-                                               res = wait_file(chan, ints, "digits/pt-ah", lang);
-                                               if ((tm.tm_hour % 12) != 1)
-                                                       if (!res)
-                                                               res = wait_file(chan, ints, "digits/pt-sss", lang);
+                               if (!strcasecmp(lang, "pt_BR")) {
+                                       if (tm.tm_hour == 0) {
+                                               if (format[offset] == 'I')
+                                                       res = wait_file(chan, ints, "digits/pt-a", lang);
+                                               if (!res)
+                                                       res = wait_file(chan, ints, "digits/pt-meianoite", lang);
+                                       } else if (tm.tm_hour == 12) {
+                                               if (format[offset] == 'I')
+                                                       res = wait_file(chan, ints, "digits/pt-ao", lang);
+                                               if (!res)
+                                                       res = wait_file(chan, ints, "digits/pt-meiodia", lang);
+                                               } else {
+                                               if (format[offset] == 'I') {
+                                                       if ((tm.tm_hour % 12) != 1)
+                                                               res = wait_file(chan, ints, "digits/pt-as", lang);
+                                                       else
+                                                               res = wait_file(chan, ints, "digits/pt-a", lang);
+                                               }
+                                               if (!res)
+                                                       res = ast_say_number(chan, (tm.tm_hour % 12), ints, lang, "f");
+                                               if ((!res) && (format[offset] == 'I'))
+                                               res = ast_say_date_with_format(chan, time, ints, lang, "P", timezone);
+                                       }
+                               } else {
+                                       if (tm.tm_hour == 0) {
+                                               if (format[offset] == 'I')
+                                                       res = wait_file(chan, ints, "digits/pt-ah", lang);
+                                               if (!res)
+                                                       res = wait_file(chan, ints, "digits/pt-meianoite", lang);
+                                               }
+                                       else if (tm.tm_hour == 12) {
+                                               if (format[offset] == 'I')
+                                                       res = wait_file(chan, ints, "digits/pt-ao", lang);
+                                               if (!res)
+                                                       res = wait_file(chan, ints, "digits/pt-meiodia", lang);
+                                       }
+                                       else {
+                                               if (format[offset] == 'I') {
+                                                       res = wait_file(chan, ints, "digits/pt-ah", lang);
+                                                       if ((tm.tm_hour % 12) != 1)
+                                                               if (!res)
+                                                                       res = wait_file(chan, ints, "digits/pt-sss", lang);
+                                               }
+                                               if (!res)
+                                                       res = ast_say_number(chan, (tm.tm_hour % 12), ints, lang, "f");
                                        }
-                                       if (!res)
-                                               res = ast_say_number(chan, (tm.tm_hour % 12), ints, lang, "f");
                                }
                                break;
                        case 'H':
                        case 'k':
                                /* 24-Hour */
-                               res = ast_say_number(chan, -tm.tm_hour, ints, lang, NULL);
-                               if (!res) {
-                                       if (tm.tm_hour != 0) {
-                                               int remainder = tm.tm_hour;
-                                               if (tm.tm_hour > 20) {
-                                                       res = wait_file(chan,ints, "digits/20",lang);
-                                                       remainder -= 20;
+                               if (!strcasecmp(lang, "pt_BR")) {
+                                       res = ast_say_number(chan, tm.tm_hour, ints, lang, "f");
+                                       if ((!res) && (format[offset] == 'H')) {
+                                               if (tm.tm_hour > 1) {
+                                                       res = wait_file(chan,ints,"digits/hours",lang);
+                                               } else {
+                                                       res = wait_file(chan,ints,"digits/hour",lang);
                                                }
-                                               if (!res) {
-                                                       snprintf(nextmsg,sizeof(nextmsg), "digits/%d", remainder);
-                                                       res = wait_file(chan,ints,nextmsg,lang);
+                                       }
+                               } else {
+                                       res = ast_say_number(chan, -tm.tm_hour, ints, lang, NULL);
+                                       if (!res) {
+                                               if (tm.tm_hour != 0) {
+                                                       int remainder = tm.tm_hour;
+                                                       if (tm.tm_hour > 20) {
+                                                               res = wait_file(chan,ints, "digits/20",lang);
+                                                               remainder -= 20;
+                                                       }
+                                                       if (!res) {
+                                                               snprintf(nextmsg,sizeof(nextmsg), "digits/%d", remainder);
+                                                               res = wait_file(chan,ints,nextmsg,lang);
+                                                       }                                               
                                                }
                                        }
                                }
                                break;
                        case 'M':
                                /* Minute */
-                               if (tm.tm_min == 0) {
-                                       res = wait_file(chan, ints, "digits/pt-hora", lang);
-                                       if (tm.tm_hour != 1)
+                               if (!strcasecmp(lang, "pt_BR")) {
+                                       res = ast_say_number(chan, tm.tm_min, ints, lang, NULL);
+                                       if (!res) {
+                                               if (tm.tm_min > 1) {
+                                                       res = wait_file(chan,ints,"digits/minutes",lang);
+                                               } else {
+                                                       res = wait_file(chan,ints,"digits/minute",lang);
+                                               }
+                                       }
+                               } else {
+                                       if (tm.tm_min == 0) {
+                                               res = wait_file(chan, ints, "digits/pt-hora", lang);
+                                               if (tm.tm_hour != 1)
+                                                       if (!res)
+                                                               res = wait_file(chan, ints, "digits/pt-sss", lang);                     } else {
+                                               res = wait_file(chan,ints,"digits/pt-e",lang);
                                                if (!res)
-                                                       res = wait_file(chan, ints, "digits/pt-sss", lang);                     } else {
-                                       res = wait_file(chan,ints,"digits/pt-e",lang);
-                                       if (!res)
-                                               res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);       
+                                                       res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);       
+                                       }
                                }
                                break;
                        case 'P':
                        case 'p':
                                /* AM/PM */
-                               if (tm.tm_hour > 12)
-                                       res = wait_file(chan, ints, "digits/p-m", lang);
-                               else if (tm.tm_hour  && tm.tm_hour < 12)
-                                       res = wait_file(chan, ints, "digits/a-m", lang);
+                               if (!strcasecmp(lang, "pt_BR")) {
+                                       if ((tm.tm_hour != 0) && (tm.tm_hour != 12)) {
+                                               res = wait_file(chan, ints, "digits/pt-da", lang);
+                                               if (!res) {
+                                                       if ((tm.tm_hour >= 0) && (tm.tm_hour < 12))
+                                                               res = wait_file(chan, ints, "digits/morning", lang);
+                                                       else if ((tm.tm_hour >= 12) && (tm.tm_hour < 18))
+                                                               res = wait_file(chan, ints, "digits/afternoon", lang);
+                                                       else res = wait_file(chan, ints, "digits/night", lang);
+                                               }
+                                       }
+                               } else {
+                                       if (tm.tm_hour > 12)
+                                               res = wait_file(chan, ints, "digits/p-m", lang);
+                                       else if (tm.tm_hour  && tm.tm_hour < 12)
+                                               res = wait_file(chan, ints, "digits/a-m", lang);
+                               }
                                break;
                        case 'Q':
                                /* Shorthand for "Today", "Yesterday", or ABdY */
@@ -5053,30 +5124,36 @@ int ast_say_date_with_format_pt(struct ast_channel *chan, time_t time, const cha
                                break;
                        case 'S':
                                /* Seconds */
-                               if (tm.tm_sec == 0) {
-                                       snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_sec);
-                                       res = wait_file(chan,ints,nextmsg,lang);
-                               } else if (tm.tm_sec < 10) {
-                                       res = wait_file(chan,ints, "digits/oh",lang);
-                                       if (!res) {
-                                               snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_sec);
-                                               res = wait_file(chan,ints,nextmsg,lang);
-                                       }
-                               } else if ((tm.tm_sec < 21) || (tm.tm_sec % 10 == 0)) {
-                                       snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_sec);
-                                       res = wait_file(chan,ints,nextmsg,lang);
-                               } else {
-                                       int ten, one;
-                                       ten = (tm.tm_sec / 10) * 10;
-                                       one = (tm.tm_sec % 10);
-                                       snprintf(nextmsg,sizeof(nextmsg), "digits/%d", ten);
-                                       res = wait_file(chan,ints,nextmsg,lang);
+                               if (!strcasecmp(lang, "pt_BR")) {
+                                       res = ast_say_number(chan, tm.tm_sec, ints, lang, NULL);
                                        if (!res) {
-                                               /* Fifty, not fifty-zero */
-                                               if (one != 0) {
-                                                       snprintf(nextmsg,sizeof(nextmsg), "digits/%d", one);
+                                               if (tm.tm_sec > 1) {
+                                                       res = wait_file(chan,ints,"digits/seconds",lang);
+                                               } else {
+                                                       res = wait_file(chan,ints,"digits/second",lang);
+                                               }
+                                       } else if (tm.tm_sec < 10) {
+                                               res = wait_file(chan,ints, "digits/oh",lang);
+                                               if (!res) {
+                                                       snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_sec);
                                                        res = wait_file(chan,ints,nextmsg,lang);
                                                }
+                                       } else if ((tm.tm_sec < 21) || (tm.tm_sec % 10 == 0)) {
+                                               snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_sec);
+                                               res = wait_file(chan,ints,nextmsg,lang);
+                                       } else {
+                                               int ten, one;
+                                               ten = (tm.tm_sec / 10) * 10;
+                                               one = (tm.tm_sec % 10);
+                                               snprintf(nextmsg,sizeof(nextmsg), "digits/%d", ten);
+                                               res = wait_file(chan,ints,nextmsg,lang);
+                                               if (!res) {
+                                                       /* Fifty, not fifty-zero */
+                                                       if (one != 0) {
+                                                               snprintf(nextmsg,sizeof(nextmsg), "digits/%d", one);
+                                                               res = wait_file(chan,ints,nextmsg,lang);
+                                                       }
+                                               }                                               
                                        }
                                }
                                break;
@@ -5383,6 +5460,8 @@ static int say_time(struct ast_channel *chan, time_t t, const char *ints, const
                return(ast_say_time_nl(chan, t, ints, lang));
        } else if (!strcasecmp(lang, "pt") ) {  /* Portuguese syntax */
                return(ast_say_time_pt(chan, t, ints, lang));
+       } else if (!strcasecmp(lang, "pt_BR") ) {       /* Brazilian Portuguese syntax */
+               return(ast_say_time_pt_BR(chan, t, ints, lang));                
        } else if (!strcasecmp(lang, "tw") || !strcasecmp(lang, "zh") ) {       /* Taiwanese / Chinese syntax */
                return(ast_say_time_tw(chan, t, ints, lang));
        } else if (!strcasecmp(lang, "gr") ) {                          /* Greek syntax */
@@ -5520,6 +5599,34 @@ int ast_say_time_pt(struct ast_channel *chan, time_t t, const char *ints, const
        return res;
 }
 
+/* Brazilian Portuguese syntax */
+int ast_say_time_pt_BR(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
+{
+       struct tm tm;
+       int res = 0;
+       localtime_r(&t,&tm);
+
+       res = ast_say_number(chan, tm.tm_hour, ints, lang, "f");
+       if (!res) {
+               if (tm.tm_hour > 1)
+                       res = wait_file(chan, ints, "digits/hours", lang);
+               else
+                       res = wait_file(chan, ints, "digits/hour", lang);
+       }
+       if ((!res) && (tm.tm_min)) {
+               res = wait_file(chan, ints, "digits/pt-e", lang);
+               if (!res)
+                       res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
+               if (!res) {
+                       if (tm.tm_min > 1)
+                               res = wait_file(chan, ints, "digits/minutes", lang);
+                       else
+                               res = wait_file(chan, ints, "digits/minute", lang);
+               }
+       }
+       return res;
+}
+
 /* Taiwanese / Chinese  syntax */
 int ast_say_time_tw(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 {
@@ -5572,6 +5679,8 @@ static int say_datetime(struct ast_channel *chan, time_t t, const char *ints, co
                return(ast_say_datetime_nl(chan, t, ints, lang));
        } else if (!strcasecmp(lang, "pt") ) {  /* Portuguese syntax */
                return(ast_say_datetime_pt(chan, t, ints, lang));
+       } else if (!strcasecmp(lang, "pt_BR") ) {       /* Brazilian Portuguese syntax */
+               return(ast_say_datetime_pt_BR(chan, t, ints, lang));            
        } else if (!strcasecmp(lang, "tw") || !strcasecmp(lang, "zh") ) {       /* Taiwanese / Chinese syntax */
                return(ast_say_datetime_tw(chan, t, ints, lang));
        } else if (!strcasecmp(lang, "gr") ) {                          /* Greek syntax */
@@ -5781,6 +5890,18 @@ int ast_say_datetime_pt(struct ast_channel *chan, time_t t, const char *ints, co
        return res;
 }
 
+/* Brazilian Portuguese syntax */
+int ast_say_datetime_pt_BR(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
+{
+       struct tm tm;
+       int res = 0;
+       localtime_r(&t,&tm);
+       res = ast_say_date(chan, t, ints, lang);
+       if (!res)
+               res = ast_say_time(chan, t, ints, lang);
+       return res;
+}
+
 /* Taiwanese / Chinese syntax */
 int ast_say_datetime_tw(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 {
@@ -5845,7 +5966,7 @@ static int say_datetime_from_now(struct ast_channel *chan, time_t t, const char
                return(ast_say_datetime_from_now_en(chan, t, ints, lang));
        } else if (!strcasecmp(lang, "fr") ) {  /* French syntax */
                return(ast_say_datetime_from_now_fr(chan, t, ints, lang));
-       } else if (!strcasecmp(lang, "pt") ) {  /* Portuguese syntax */
+       } else if (!strcasecmp(lang, "pt") || !strcasecmp(lang, "pt_BR")) {     /* Portuguese syntax */
                return(ast_say_datetime_from_now_pt(chan, t, ints, lang));
        }
 
@@ -5964,14 +6085,24 @@ int ast_say_datetime_from_now_pt(struct ast_channel *chan, time_t t, const char
                if (!res)
                        res = wait_file(chan, ints, fn, lang);
        }       /* Otherwise, it was today */
-       snprintf(fn, sizeof(fn), "digits/pt-ah");
-       if (!res)
-               res = wait_file(chan, ints, fn, lang);
-       if (tm.tm_hour != 1)
-       if (!res)
-               res = wait_file(chan, ints, "digits/pt-sss", lang);
-       if (!res)
-               res = ast_say_time(chan, t, ints, lang);
+       if (!strcasecmp(lang, "pt_BR")) {
+               if (tm.tm_hour > 1) {
+                       snprintf(fn, sizeof(fn), "digits/pt-as");
+               } else {
+                       snprintf(fn, sizeof(fn), "digits/pt-a");
+               }
+               if (!res)
+                       res = wait_file(chan, ints, fn, lang);
+       } else {
+               snprintf(fn, sizeof(fn), "digits/pt-ah");
+               if (!res)
+                       res = wait_file(chan, ints, fn, lang);
+               if (tm.tm_hour != 1)
+               if (!res)
+                       res = wait_file(chan, ints, "digits/pt-sss", lang);
+               if (!res)
+                       res = ast_say_time(chan, t, ints, lang);
+       }
        return res;
 }