#include <sys/types.h>#include <string.h>#include <stdlib.h>#include <netinet/in.h>#include <time.h>#include <ctype.h>#include <math.h>#include <asterisk/file.h>#include <asterisk/channel.h>#include <asterisk/logger.h>#include <asterisk/say.h>#include <asterisk/lock.h>#include <asterisk/localtime.h>#include <asterisk/utils.h>#include "asterisk.h"#include <stdio.h>Go to the source code of this file.
Data Structures | |
| struct | odmiana |
Functions | |
| int | ast_say_digit_str (struct ast_channel *chan, char *fn2, char *ints, char *lang) |
| says digits of a string | |
| int | ast_say_character_str (struct ast_channel *chan, char *fn2, char *ints, char *lang) |
| int | ast_say_phonetic_str (struct ast_channel *chan, char *fn2, char *ints, char *lang) |
| int | ast_say_digit_str_full (struct ast_channel *chan, char *fn2, char *ints, char *lang, int audiofd, int ctrlfd) |
| int | ast_say_character_str_full (struct ast_channel *chan, char *fn2, char *ints, char *lang, int audiofd, int ctrlfd) |
| int | ast_say_phonetic_str_full (struct ast_channel *chan, char *fn2, char *ints, char *lang, int audiofd, int ctrlfd) |
| int | ast_say_digits (struct ast_channel *chan, int num, char *ints, char *lang) |
| says digits | |
| int | ast_say_digits_full (struct ast_channel *chan, int num, char *ints, char *lang, int audiofd, int ctrlfd) |
| int | ast_say_number_full (struct ast_channel *chan, int num, char *ints, char *language, char *options, int audiofd, int ctrlfd) |
| int | ast_say_number (struct ast_channel *chan, int num, char *ints, char *language, char *options) |
| says a number | |
| int | ast_say_date (struct ast_channel *chan, time_t t, char *ints, char *lang) |
| int | ast_say_date_with_format (struct ast_channel *chan, time_t time, char *ints, char *lang, char *format, char *timezone) |
| int | ast_say_time (struct ast_channel *chan, time_t t, char *ints, char *lang) |
| int | ast_say_datetime (struct ast_channel *chan, time_t t, char *ints, char *lang) |
| int | ast_say_datetime_from_now (struct ast_channel *chan, time_t t, char *ints, char *lang) |
|
||||||||||||||||||||
|
Definition at line 69 of file say.c. References ast_stopstream(), ast_streamfile(), and ast_waitstream(). 00070 { 00071 /* XXX Merge with full version? XXX */ 00072 char fn[256] = ""; 00073 char ltr; 00074 int num = 0; 00075 int res = 0; 00076 while(fn2[num] && !res) { 00077 fn[0] = '\0'; 00078 switch (fn2[num]) { 00079 case ('*'): 00080 snprintf(fn, sizeof(fn), "digits/star"); 00081 break; 00082 case ('#'): 00083 snprintf(fn, sizeof(fn), "digits/pound"); 00084 break; 00085 case ('0'): 00086 case ('1'): 00087 case ('2'): 00088 case ('3'): 00089 case ('4'): 00090 case ('5'): 00091 case ('6'): 00092 case ('7'): 00093 case ('8'): 00094 case ('9'): 00095 snprintf(fn, sizeof(fn), "digits/%c", fn2[num]); 00096 break; 00097 case ('!'): 00098 strncpy(fn, "letters/exclaimation-point", sizeof(fn)); 00099 break; 00100 case ('@'): 00101 strncpy(fn, "letters/at", sizeof(fn)); 00102 break; 00103 case ('$'): 00104 strncpy(fn, "letters/dollar", sizeof(fn)); 00105 break; 00106 case ('-'): 00107 strncpy(fn, "letters/dash", sizeof(fn)); 00108 break; 00109 case ('.'): 00110 strncpy(fn, "letters/dot", sizeof(fn)); 00111 break; 00112 case ('='): 00113 strncpy(fn, "letters/equals", sizeof(fn)); 00114 break; 00115 case ('+'): 00116 strncpy(fn, "letters/plus", sizeof(fn)); 00117 break; 00118 case ('/'): 00119 strncpy(fn, "letters/slash", sizeof(fn)); 00120 break; 00121 case (' '): 00122 strncpy(fn, "letters/space", sizeof(fn)); 00123 break; 00124 default: 00125 ltr = fn2[num]; 00126 if ('A' <= ltr && ltr <= 'Z') ltr += 'a' - 'A'; /* file names are all lower-case */ 00127 snprintf(fn, sizeof(fn), "letters/%c", ltr); 00128 } 00129 if(!ast_strlen_zero(fn)) { /* if length == 0, then skip this digit as it is invalid */ 00130 res = ast_streamfile(chan, fn, lang); 00131 if (!res) 00132 res = ast_waitstream(chan, ints); 00133 } ast_stopstream(chan); 00134 num++; 00135 } 00136 return res; 00137 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 257 of file say.c. References ast_stopstream(), ast_streamfile(), and ast_waitstream_full(). 00258 { 00259 char fn[256] = ""; 00260 char ltr; 00261 int num = 0; 00262 int res = 0; 00263 while(fn2[num] && !res) { 00264 switch (fn2[num]) { 00265 case ('*'): 00266 snprintf(fn, sizeof(fn), "digits/star"); 00267 break; 00268 case ('#'): 00269 snprintf(fn, sizeof(fn), "digits/pound"); 00270 break; 00271 case ('0'): 00272 case ('1'): 00273 case ('2'): 00274 case ('3'): 00275 case ('4'): 00276 case ('5'): 00277 case ('6'): 00278 case ('7'): 00279 case ('8'): 00280 case ('9'): 00281 snprintf(fn, sizeof(fn), "digits/%c", fn2[num]); 00282 break; 00283 case ('!'): 00284 strncpy(fn, "letters/exclaimation-point", sizeof(fn)); 00285 break; 00286 case ('@'): 00287 strncpy(fn, "letters/at", sizeof(fn)); 00288 break; 00289 case ('$'): 00290 strncpy(fn, "letters/dollar", sizeof(fn)); 00291 break; 00292 case ('-'): 00293 strncpy(fn, "letters/dash", sizeof(fn)); 00294 break; 00295 case ('.'): 00296 strncpy(fn, "letters/dot", sizeof(fn)); 00297 break; 00298 case ('='): 00299 strncpy(fn, "letters/equals", sizeof(fn)); 00300 break; 00301 case ('+'): 00302 strncpy(fn, "letters/plus", sizeof(fn)); 00303 break; 00304 case ('/'): 00305 strncpy(fn, "letters/slash", sizeof(fn)); 00306 break; 00307 case (' '): 00308 strncpy(fn, "letters/space", sizeof(fn)); 00309 break; 00310 default: 00311 ltr = fn2[num]; 00312 if ('A' <= ltr && ltr <= 'Z') ltr += 'a' - 'A'; /* file names are all lower-case */ 00313 snprintf(fn, sizeof(fn), "letters/%c", ltr); 00314 } 00315 /* snprintf(fn, sizeof(fn), "digits/%c", fn2[num]); */ 00316 res = ast_streamfile(chan, fn, lang); 00317 if (!res) 00318 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd); 00319 ast_stopstream(chan); 00320 num++; 00321 } 00322 return res; 00323 }
|
|
||||||||||||||||||||
|
Definition at line 1827 of file say.c. 01828 { 01829 if (!strcasecmp(lang,"en") ) { /* English syntax */ 01830 return(ast_say_date_en(chan, t, ints, lang)); 01831 } else if (!strcasecmp(lang, "nl") ) { /* Dutch syntax */ 01832 return(ast_say_date_nl(chan, t, ints, lang)); 01833 } else if (!strcasecmp(lang, "pt") ) { /* Portuguese syntax */ 01834 return(ast_say_date_pt(chan, t, ints, lang)); 01835 } 01836 01837 /* Default to English */ 01838 return(ast_say_date_en(chan, t, ints, lang)); 01839 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 1923 of file say.c. 01924 { 01925 if (!strcasecmp(lang, "en") ) { /* English syntax */ 01926 return(ast_say_date_with_format_en(chan, time, ints, lang, format, timezone)); 01927 } else if (!strcasecmp(lang, "de") ) { /* German syntax */ 01928 return(ast_say_date_with_format_de(chan, time, ints, lang, format, timezone)); 01929 } else if (!strcasecmp(lang, "es") || !strcasecmp(lang, "mx")) { /* Spanish syntax */ 01930 return(ast_say_date_with_format_es(chan, time, ints, lang, format, timezone)); 01931 } else if (!strcasecmp(lang, "nl") ) { /* Dutch syntax */ 01932 return(ast_say_date_with_format_nl(chan, time, ints, lang, format, timezone)); 01933 } else if (!strcasecmp(lang, "pt") ) { /* Portuguese syntax */ 01934 return(ast_say_date_with_format_pt(chan, time, ints, lang, format, timezone)); 01935 } else if (!strcasecmp(lang, "tw") ) { /* Taiwanese syntax */ 01936 return(ast_say_date_with_format_tw(chan, time, ints, lang, format, timezone)); 01937 } 01938 01939 /* Default to English */ 01940 return(ast_say_date_with_format_en(chan, time, ints, lang, format, timezone)); 01941 }
|
|
||||||||||||||||||||
|
Definition at line 3512 of file say.c. 03513 { 03514 if (!strcasecmp(lang, "en") ) { /* English syntax */ 03515 return(ast_say_datetime_en(chan, t, ints, lang)); 03516 } else if (!strcasecmp(lang, "nl") ) { /* Dutch syntax */ 03517 return(ast_say_datetime_nl(chan, t, ints, lang)); 03518 } else if (!strcasecmp(lang, "pt") ) { /* Portuguese syntax */ 03519 return(ast_say_datetime_pt(chan, t, ints, lang)); 03520 } else if (!strcasecmp(lang, "tw") ) { /* Taiwanese syntax */ 03521 return(ast_say_datetime_tw(chan, t, ints, lang)); 03522 } 03523 03524 /* Default to English */ 03525 return(ast_say_datetime_en(chan, t, ints, lang)); 03526 }
|
|
||||||||||||||||||||
|
Definition at line 3734 of file say.c. 03735 { 03736 if (!strcasecmp(lang, "en") ) { /* English syntax */ 03737 return(ast_say_datetime_from_now_en(chan, t, ints, lang)); 03738 } else if (!strcasecmp(lang, "pt") ) { /* Portuguese syntax */ 03739 return(ast_say_datetime_from_now_pt(chan, t, ints, lang)); 03740 } 03741 03742 /* Default to English */ 03743 return(ast_say_datetime_from_now_en(chan, t, ints, lang)); 03744 }
|
|
||||||||||||||||||||
|
says digits of a string
Definition at line 35 of file say.c. References ast_stopstream(), ast_streamfile(), and ast_waitstream(). Referenced by ast_say_digits(). 00036 { 00037 /* XXX Merge with full version? XXX */ 00038 char fn[256] = ""; 00039 int num = 0; 00040 int res = 0; 00041 while(fn2[num] && !res) { 00042 fn[0] = '\0'; 00043 switch (fn2[num]) { 00044 case ('*'): 00045 snprintf(fn, sizeof(fn), "digits/star"); 00046 break; 00047 case ('#'): 00048 snprintf(fn, sizeof(fn), "digits/pound"); 00049 break; 00050 case ('-'): 00051 snprintf(fn, sizeof(fn), "digits/minus"); 00052 break; 00053 default: 00054 if((fn2[num] >= '0') && (fn2[num] <= '9')){ /* Must be in {0-9} */ 00055 snprintf(fn, sizeof(fn), "digits/%c", fn2[num]); 00056 } 00057 } 00058 if(!ast_strlen_zero(fn)){ /* if length == 0, then skip this digit as it is invalid */ 00059 res = ast_streamfile(chan, fn, lang); 00060 if (!res) 00061 res = ast_waitstream(chan, ints); 00062 ast_stopstream(chan); 00063 } 00064 num++; 00065 } 00066 return res; 00067 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 241 of file say.c. References ast_stopstream(), ast_streamfile(), and ast_waitstream_full(). Referenced by ast_say_digits_full(). 00242 { 00243 char fn[256] = ""; 00244 int num = 0; 00245 int res = 0; 00246 while(fn2[num] && !res) { 00247 snprintf(fn, sizeof(fn), "digits/%c", fn2[num]); 00248 res = ast_streamfile(chan, fn, lang); 00249 if (!res) 00250 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd); 00251 ast_stopstream(chan); 00252 num++; 00253 } 00254 return res; 00255 }
|
|
||||||||||||||||||||
|
says digits
Definition at line 392 of file say.c. References ast_say_digit_str(). 00393 { 00394 /* XXX Should I be merged with say_digits_full XXX */ 00395 char fn2[256]; 00396 snprintf(fn2, sizeof(fn2), "%d", num); 00397 return ast_say_digit_str(chan, fn2, ints, lang); 00398 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 400 of file say.c. References ast_say_digit_str_full(). 00401 { 00402 char fn2[256]; 00403 snprintf(fn2, sizeof(fn2), "%d", num); 00404 return ast_say_digit_str_full(chan, fn2, ints, lang, audiofd, ctrlfd); 00405 }
|
|
||||||||||||||||||||||||
|
says a number
Definition at line 532 of file say.c. References ast_say_number_full(). 00533 { 00534 return(ast_say_number_full(chan, num, ints, language, options, -1, -1)); 00535 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 499 of file say.c. Referenced by ast_say_number(). 00500 { 00501 if (!strcasecmp(language,"en") ) { /* English syntax */ 00502 return(ast_say_number_full_en(chan, num, ints, language, audiofd, ctrlfd)); 00503 } else if (!strcasecmp(language, "da") ) { /* Danish syntax */ 00504 return(ast_say_number_full_da(chan, num, ints, language, options, audiofd, ctrlfd)); 00505 } else if (!strcasecmp(language, "de") ) { /* German syntax */ 00506 return(ast_say_number_full_de(chan, num, ints, language, options, audiofd, ctrlfd)); 00507 } else if (!strcasecmp(language, "es") || !strcasecmp(language, "mx")) { /* Spanish syntax */ 00508 return(ast_say_number_full_es(chan, num, ints, language, options, audiofd, ctrlfd)); 00509 } else if (!strcasecmp(language, "fr") ) { /* French syntax */ 00510 return(ast_say_number_full_fr(chan, num, ints, language, options, audiofd, ctrlfd)); 00511 } else if (!strcasecmp(language, "it") ) { /* Italian syntax */ 00512 return(ast_say_number_full_it(chan, num, ints, language, audiofd, ctrlfd)); 00513 } else if (!strcasecmp(language, "nl") ) { /* Dutch syntax */ 00514 return(ast_say_number_full_nl(chan, num, ints, language, audiofd, ctrlfd)); 00515 } else if (!strcasecmp(language, "pl") ) { /* Polish syntax */ 00516 return(ast_say_number_full_pl(chan, num, ints, language, options, audiofd, ctrlfd)); 00517 } else if (!strcasecmp(language, "pt") ) { /* Portuguese syntax */ 00518 return(ast_say_number_full_pt(chan, num, ints, language, options, audiofd, ctrlfd)); 00519 } else if (!strcasecmp(language, "se") ) { /* Swedish syntax */ 00520 return(ast_say_number_full_se(chan, num, ints, language, options, audiofd, ctrlfd)); 00521 } else if (!strcasecmp(language, "tw")) { /* Taiwanese syntax */ 00522 return(ast_say_number_full_tw(chan, num, ints, language, audiofd, ctrlfd)); 00523 } else if (!strcasecmp(language, "cz") ) { /* Czech syntax */ 00524 return(ast_say_number_full_cz(chan, num, ints, language, options, audiofd, ctrlfd)); 00525 } 00526 00527 /* Default to english */ 00528 return(ast_say_number_full_en(chan, num, ints, language, audiofd, ctrlfd)); 00529 }
|
|
||||||||||||||||||||
|
Definition at line 139 of file say.c. References ast_stopstream(), ast_streamfile(), and ast_waitstream(). 00140 { 00141 /* XXX Merge with full version? XXX */ 00142 char fn[256] = ""; 00143 char ltr; 00144 int num = 0; 00145 int res = 0; 00146 int temp; 00147 int play; 00148 char hex[3]; 00149 /* while(fn2[num] && !res) { */ 00150 while(fn2[num]) { 00151 play=1; 00152 switch (fn2[num]) { 00153 case ('*'): 00154 snprintf(fn, sizeof(fn), "digits/star"); 00155 break; 00156 case ('#'): 00157 snprintf(fn, sizeof(fn), "digits/pound"); 00158 break; 00159 case ('0'): 00160 case ('1'): 00161 case ('2'): 00162 case ('3'): 00163 case ('4'): 00164 case ('5'): 00165 case ('6'): 00166 case ('7'): 00167 case ('8'): 00168 snprintf(fn, sizeof(fn), "digits/%c", fn2[num]); 00169 break; 00170 case ('!'): 00171 strncpy(fn, "letters/exclaimation-point", sizeof(fn)); 00172 break; 00173 case ('@'): 00174 strncpy(fn, "letters/at", sizeof(fn)); 00175 break; 00176 case ('$'): 00177 strncpy(fn, "letters/dollar", sizeof(fn)); 00178 break; 00179 case ('-'): 00180 strncpy(fn, "letters/dash", sizeof(fn)); 00181 break; 00182 case ('.'): 00183 strncpy(fn, "letters/dot", sizeof(fn)); 00184 break; 00185 case ('='): 00186 strncpy(fn, "letters/equals", sizeof(fn)); 00187 break; 00188 case ('+'): 00189 strncpy(fn, "letters/plus", sizeof(fn)); 00190 break; 00191 case ('/'): 00192 strncpy(fn, "letters/slash", sizeof(fn)); 00193 break; 00194 case (' '): 00195 strncpy(fn, "letters/space", sizeof(fn)); 00196 break; 00197 case ('%'): 00198 play=0; 00199 /* check if we have 2 chars after the % */ 00200 if (strlen(fn2) > num+2) 00201 { 00202 hex[0]=fn2[num+1]; 00203 hex[1]=fn2[num+2]; 00204 hex[2]='\0'; 00205 if (sscanf(hex,"%x", &temp)) 00206 { /* Hex to char convertion successfull */ 00207 fn2[num+2]=temp; 00208 num++; 00209 if (temp==37) 00210 { /* If it is a percent, play it now */ 00211 strncpy(fn, "percent", sizeof(fn)); 00212 num++; 00213 play=1; 00214 } 00215 /* check for invalid characters */ 00216 if ((temp<32) || (temp>126)) 00217 { 00218 num++; 00219 } 00220 } 00221 } 00222 else 00223 num++; 00224 break; 00225 default: /* '9' falls through to here, too */ 00226 ltr = tolower(fn2[num]); 00227 snprintf(fn, sizeof(fn), "phonetic/%c_p", ltr); 00228 } 00229 if (play) 00230 { 00231 res = ast_streamfile(chan, fn, lang); 00232 if (!res) 00233 res = ast_waitstream(chan, ints); 00234 ast_stopstream(chan); 00235 } 00236 num++; 00237 } 00238 return res; 00239 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 325 of file say.c. References ast_stopstream(), ast_streamfile(), and ast_waitstream_full(). 00326 { 00327 char fn[256] = ""; 00328 char ltr; 00329 int num = 0; 00330 int res = 0; 00331 while(fn2[num] && !res) { 00332 switch (fn2[num]) { 00333 case ('*'): 00334 snprintf(fn, sizeof(fn), "digits/star"); 00335 break; 00336 case ('#'): 00337 snprintf(fn, sizeof(fn), "digits/pound"); 00338 break; 00339 case ('0'): 00340 case ('1'): 00341 case ('2'): 00342 case ('3'): 00343 case ('4'): 00344 case ('5'): 00345 case ('6'): 00346 case ('7'): 00347 case ('8'): 00348 snprintf(fn, sizeof(fn), "digits/%c", fn2[num]); 00349 break; 00350 case ('!'): 00351 strncpy(fn, "letters/exclaimation-point", sizeof(fn)); 00352 break; 00353 case ('@'): 00354 strncpy(fn, "letters/at", sizeof(fn)); 00355 break; 00356 case ('$'): 00357 strncpy(fn, "letters/dollar", sizeof(fn)); 00358 break; 00359 case ('-'): 00360 strncpy(fn, "letters/dash", sizeof(fn)); 00361 break; 00362 case ('.'): 00363 strncpy(fn, "letters/dot", sizeof(fn)); 00364 break; 00365 case ('='): 00366 strncpy(fn, "letters/equals", sizeof(fn)); 00367 break; 00368 case ('+'): 00369 strncpy(fn, "letters/plus", sizeof(fn)); 00370 break; 00371 case ('/'): 00372 strncpy(fn, "letters/slash", sizeof(fn)); 00373 break; 00374 case (' '): 00375 strncpy(fn, "letters/space", sizeof(fn)); 00376 break; 00377 default: /* '9' falls here... */ 00378 ltr = fn2[num]; 00379 if ('A' <= ltr && ltr <= 'Z') ltr += 'a' - 'A'; /* file names are all lower-case */ 00380 snprintf(fn, sizeof(fn), "phonetic/%c", ltr); 00381 } 00382 /* snprintf(fn, sizeof(fn), "digits/%c", fn2[num]); */ 00383 res = ast_streamfile(chan, fn, lang); 00384 if (!res) 00385 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd); 00386 ast_stopstream(chan); 00387 num++; 00388 } 00389 return res; 00390 }
|
|
||||||||||||||||||||
|
Definition at line 3360 of file say.c. 03361 { 03362 if (!strcasecmp(lang, "en") ) { /* English syntax */ 03363 return(ast_say_time_en(chan, t, ints, lang)); 03364 } else if (!strcasecmp(lang, "nl") ) { /* Dutch syntax */ 03365 return(ast_say_time_nl(chan, t, ints, lang)); 03366 } else if (!strcasecmp(lang, "pt") ) { /* Portuguese syntax */ 03367 return(ast_say_time_pt(chan, t, ints, lang)); 03368 } else if (!strcasecmp(lang, "tw") ) { /* Taiwanese syntax */ 03369 return(ast_say_time_tw(chan, t, ints, lang)); 03370 } 03371 03372 /* Default to English */ 03373 return(ast_say_time_en(chan, t, ints, lang)); 03374 }
|
1.4.4