+/*--- ast_say_number_full_se: Swedish/norwegian syntax */
+/* This is the default syntax, if no other syntax defined in this file is used */
+static int ast_say_number_full_se(struct ast_channel *chan, int num, char *ints, char *language, char *options, int audiofd, int ctrlfd)
+{
+ int res = 0;
+ int playh = 0;
+ char fn[256] = "";
+ int cn = 1; /* +1 = Commune; -1 = Neutrum */
+ if (!num)
+ return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd);
+ if (options && !strncasecmp(options, "n",1)) cn = -1;
+
+ 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 == 1 && cn == -1) { /* En eller ett? */
+ snprintf(fn, sizeof(fn), "digits/1N");
+ 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_se(chan, num / 1000, ints, language, options, audiofd, ctrlfd);
+ if (res)
+ return res;
+ num = num % 1000;
+ snprintf(fn, sizeof(fn), "digits/thousand");
+ } else {
+ if (num < 1000000000) { /* 1,000,000,000 */
+ res = ast_say_number_full_se(chan, num / 1000000, ints, language, options, 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 && ctrlfd)
+ res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
+ else
+ res = ast_waitstream(chan, ints);
+ }
+ ast_stopstream(chan);
+
+ }
+
+ }
+ return res;
+}
+
+
+