144a145
> 	int playy = 0;
151,169c152,174
< 		/* Use english numbers */
< 		language = "en";
< 		while(!res && (num || playh)) {
< 			if (playh) {
< 				snprintf(fn, sizeof(fn), "digits/hundred");
< 				playh = 0;
< 			} else
< 			if (num < 20) {
< 				snprintf(fn, sizeof(fn), "digits/%d", num);
< 				num = 0;
< 			} else
< 			if (num < 100) {
< 				snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
< 				num -= ((num / 10) * 10);
< 			} else {
< 				if (num < 1000){
< 					snprintf(fn, sizeof(fn), "digits/%d", (num/100));
< 					playh++;
< 					num -= ((num / 100) * 100);
---
> 	/* 
> 	 * Not any more... now it also works for Spanish 
> 	 * Modification made by : Angel Gomez <angom@telnor.net>
> 	 */
> 		if (!strncmp(language, "es", 2)) {
> 			while (!res && num) {
> 				if (playy) {
> 					snprintf(fn, sizeof(fn), "digits/y");
> 					playy = 0;
> 				} else
> 				if (num < 31) {
> 					snprintf(fn, sizeof(fn), "digits/%d", num);
> 					num = 0;
> 				} else
> 				if (num < 100) {
> 					snprintf(fn, sizeof(fn), "digits/%d", (num/10)*10);
> 					num -= ((num/10)*10);
> 					if (num)
> 						playy++;
> 				} else
> 				if (num == 100) {
> 					snprintf(fn, sizeof(fn), "digits/cien");
> 					num = 0;
171,176c176,178
< 					if (num < 1000000) {
< 						res = ast_say_number(chan, num / 1000, ints, language);
< 						if (res)
< 							return res;
< 						num = num % 1000;
< 						snprintf(fn, sizeof(fn), "digits/thousand");
---
> 					if (num < 1000) {
> 						snprintf(fn, sizeof(fn), "digits/%d", (num/100)*100);
> 						num -= ((num/100)*100);
178,179c180,181
< 						if (num < 1000000000) {
< 							res = ast_say_number(chan, num / 1000000, ints, language);
---
> 						if (num < 1000000) {
> 							res = ast_say_number(chan, num / 1000, ints, language);
182,183c184,185
< 							num = num % 1000000;
< 							snprintf(fn, sizeof(fn), "digits/million");
---
> 							num = num % 1000;
> 							snprintf(fn, sizeof(fn), "digits/mil");
185,186c187,200
< 							ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
< 							res = -1;
---
> 							if (num < 2147483640) {
> 								res = ast_say_number(chan, num / 1000000, ints, language);
> 								if (res)
> 									return res;
> 								if ((num/1000000) == 1) {
> 									snprintf(fn, sizeof(fn), "digits/millon");
> 								} else {
> 									snprintf(fn, sizeof(fn), "digits/millones");
> 								}
> 								num = num % 1000000;
> 							} else {
> 								ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
> 								res = -1;
> 							}
189a204,209
> 				if (!res) {
> 					res = ast_streamfile(chan, fn, language);
> 					if (!res)
> 						res = ast_waitstream(chan, ints);
> 					ast_stopstream(chan);
> 				}
191,195c211,257
< 			if (!res) {
< 				res = ast_streamfile(chan, fn, language);
< 				if (!res) 
< 					res = ast_waitstream(chan, ints);
< 				ast_stopstream(chan);
---
> 		} else {
> 			/* Use english numbers */
> 			language = "en";
> 			while(!res && (num || playh)) {
> 				if (playh) {
> 					snprintf(fn, sizeof(fn), "digits/hundred");
> 					playh = 0;
> 				} else
> 				if (num < 20) {
> 					snprintf(fn, sizeof(fn), "digits/%d", num);
> 					num = 0;
> 				} else
> 				if (num < 100) {
> 					snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
> 					num -= ((num / 10) * 10);
> 				} else {
> 					if (num < 1000){
> 						snprintf(fn, sizeof(fn), "digits/%d", (num/100));
> 						playh++;
> 						num -= ((num / 100) * 100);
> 					} else {
> 						if (num < 1000000) {
> 							res = ast_say_number(chan, num / 1000, ints, language);
> 							if (res)
> 								return res;
> 							num = num % 1000;
> 							snprintf(fn, sizeof(fn), "digits/thousand");
> 						} else {
> 							if (num < 1000000000) {
> 								res = ast_say_number(chan, num / 1000000, ints, language);
> 								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) {
> 					res = ast_streamfile(chan, fn, language);
> 					if (!res) 
> 						res = ast_waitstream(chan, ints);
> 					ast_stopstream(chan);
> 				}
197d258
< 			
