[Asterisk-Dev] say.c Support for Urdu
Tzafrir Cohen
tzafrir.cohen at xorcom.com
Wed Jul 13 01:03:55 MST 2005
On Wed, Jul 13, 2005 at 12:28:26PM +0500, Atif Rasheed wrote:
> Hello Russel, Fleming:
>
> I am not a good coder, but just able to change ast_say_number_full_en to
> add support for URDU Digits. specially required if you want to announce
> currency amount and units in URDU. in URDU digits break down starts
> after 100 as compared to 20 in english.
Awful lot of sounds. This will mean recording many more Urdu sounds. No
way to save part of this?
> so a little change was required,
> if good enough you can add it to CVS.
As others have noted, please submit a patch created using 'diff -u' vs.
the latest CVS. As this is just one file you don't need extra switches
such as -r.
>
> Regards,
> --
> Atif
>
>
> > static int ast_say_number_full_urdu(struct ast_channel *chan, int
> num, char *ints, char *language, int audiofd, int ctrlfd);
>
> > } else if (!strcasecmp(language, "urdu") ) { /* Urdu syntax */
What's the language code for Urdu? "ur"? "urd"?
http://www.loc.gov/standards/iso639-2/englangn.html#uvwxyz
> > return(ast_say_number_full_urdu(chan, num, ints, language,
> audiofd, ctrlfd));
>
>
> /*---- Urdu sound files needed for Time/Date functions:
> minute
> second
> ---- Urdu sound files needed for Currency:
> Rupay
> Rupia
> Paisa
> Paisay
> /*
>
> /*--- ast_say_number_full_urdu: Urdu syntax */
> /*--- Urdu syntax is little different, so we will require alot of extra
> files. from 0 - 99 */
> static int ast_say_number_full_urdu(struct ast_channel *chan, int num,
> char *ints, char *language, int audiofd, int ctrlfd)
> {
> int res = 0;
> int playh = 0;
> char fn[256] = "";
> if (!num)
> return ast_say_digits_full(chan, 0,ints, language,
> audiofd, ctrlfd);
>
> while(!res && (num || playh)) {
> if (playh) {
> snprintf(fn, sizeof(fn), "digits/hundred");
> playh = 0;
> } else if (num < 100) {
> snprintf(fn, sizeof(fn), "digits/%d", num);
> num = 0;
> } else {
> if (num < 1000){
> snprintf(fn, sizeof(fn),
> "digits/%d", (num/100));
> playh++;
> num -= ((num / 100) * 100);
> } else {
> if (num < 1000000) { /* 1,000,000 */
> res =
> ast_say_number_full_en(chan, num / 1000, ints, language, audiofd, ctrlfd);
> if (res)
> return res;
> num = num % 1000;
> snprintf(fn, sizeof(fn),
> "digits/thousand");
> } else {
Is it just me, or the part below is replicated in too many functions?
> if (num < 1000000000) {
> /* 1,000,000,000 */
> res =
> ast_say_number_full_en(chan, num / 1000000, ints, language, audiofd,
> ctrlfd);
> if (res)
> return res;
> num = num % 1000000;
> snprintf(fn,
> sizeof(fn), "digits/million");
> } else {
>
> ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
> res = -1;
> }
> }
> }
> }
> if (!res) {
> if(!ast_streamfile(chan, fn, language)) {
> if ((audiofd > -1) && (ctrlfd > -1))
> res =
> ast_waitstream_full(chan, ints, audiofd, ctrlfd);
> else
> res =
> ast_waitstream(chan, ints);
> }
> ast_stopstream(chan);
> }
> }
> return res;
> }
--
Tzafrir Cohen icq#16849755 +972-50-7952406
tzafrir.cohen at xorcom.com http://www.xorcom.com
More information about the asterisk-dev
mailing list