Asterisk - The Open Source Telephony Project GIT-master-4f2b068
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
say.c File Reference

Say numbers and dates (maybe words one day too) More...

#include "asterisk.h"
#include <netinet/in.h>
#include <time.h>
#include <ctype.h>
#include <math.h>
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/say.h"
#include "asterisk/lock.h"
#include "asterisk/localtime.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
#include "asterisk/test.h"
#include "asterisk/cli.h"
Include dependency graph for say.c:

Go to the source code of this file.

Data Structures

struct  odmiana
 

Macros

#define IL_DATE_STR   "AdBY"
 
#define IL_DATE_STR_FULL   IL_DATE_STR " 'digits/at' " IL_TIME_STR
 
#define IL_TIME_STR   "HM" /* NOTE: In Hebrew we do not support 12 hours, only 24. No AM or PM exists in the Hebrew language */
 
#define SAY_NUM_BUF_SIZE   256
 

Functions

static void __say_init (void)
 remap the 'say' functions to use those in this file
 
struct ast_strast_get_character_str (const char *str, const char *lang, enum ast_say_case_sensitivity sensitivity)
 Returns an ast_str of files for SayAlpha playback.
 
struct ast_strast_get_digit_str (const char *str, const char *lang)
 Returns an ast_str of files for SayDigits playback.
 
static struct ast_strast_get_money_en_dollars_str (const char *str, const char *lang)
 
struct ast_strast_get_money_str (const char *str, const char *lang)
 ast_get_money_str: call language-specific functions
 
struct ast_strast_get_number_str (int num, const char *lang)
 ast_get_number_str: call language-specific functions
 
struct ast_strast_get_ordinal_str (int num, const char *lang)
 ast_get_ordinal_str: call language-specific functions
 
struct ast_strast_get_phonetic_str (const char *str, const char *lang)
 Returns an ast_str of files for SayPhonetic playback.
 
int ast_say_counted_adjective (struct ast_channel *chan, int num, const char adjective[], const char gender[])
 
int ast_say_counted_noun (struct ast_channel *chan, int num, const char noun[])
 
static int ast_say_date_da (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Danish syntax.
 
static int ast_say_date_de (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 German syntax.
 
static int ast_say_date_en (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 English syntax.
 
static int ast_say_date_fr (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 French syntax.
 
static int ast_say_date_gr (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Greek support.
 
static int ast_say_date_he (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Hebrew syntax.
 
static int ast_say_date_hu (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Hungarian syntax.
 
static int ast_say_date_is (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 
static int ast_say_date_ja (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 
static int ast_say_date_ka (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Georgian syntax. e.g. "oriatas xuti tslis 5 noemberi".
 
static int ast_say_date_nl (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Dutch syntax.
 
static int ast_say_date_pt (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Portuguese syntax.
 
static int ast_say_date_th (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Thai syntax.
 
static int ast_say_date_with_format_da (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 Danish syntax.
 
static int ast_say_date_with_format_de (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 German syntax.
 
static int ast_say_date_with_format_en (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 English syntax.
 
static int ast_say_date_with_format_es (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 Spanish syntax.
 
static int ast_say_date_with_format_fr (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 French syntax oclock = heure.
 
static int ast_say_date_with_format_gr (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 Greek support.
 
static int ast_say_date_with_format_he (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 ast_say_date_with_format_he Say formatted date in Hebrew
 
static int ast_say_date_with_format_is (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 
static int ast_say_date_with_format_it (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 Italian syntax.
 
static int ast_say_date_with_format_ja (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 
static int ast_say_date_with_format_nl (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 Dutch syntax.
 
static int ast_say_date_with_format_pl (struct ast_channel *chan, time_t thetime, const char *ints, const char *lang, const char *format, const char *tzone)
 Polish syntax.
 
static int ast_say_date_with_format_pt (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 Portuguese syntax.
 
static int ast_say_date_with_format_th (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 Thai syntax.
 
static int ast_say_date_with_format_vi (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 Vietnamese syntax.
 
static int ast_say_date_with_format_zh (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 Taiwanese / Chinese syntax.
 
static int ast_say_datetime_de (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 German syntax.
 
static int ast_say_datetime_en (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 English syntax.
 
static int ast_say_datetime_fr (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 French syntax.
 
static int ast_say_datetime_from_now_en (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 English syntax.
 
static int ast_say_datetime_from_now_fr (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 French syntax.
 
static int ast_say_datetime_from_now_he (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Hebrew syntax.
 
static int ast_say_datetime_from_now_ka (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Georgian syntax.
 
static int ast_say_datetime_from_now_pt (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Portuguese syntax.
 
static int ast_say_datetime_gr (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Greek support.
 
static int ast_say_datetime_he (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Hebrew syntax.
 
static int ast_say_datetime_hu (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Hungarian syntax.
 
static int ast_say_datetime_ja (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 
static int ast_say_datetime_ka (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Georgian syntax. Say date, then say time.
 
static int ast_say_datetime_nl (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Dutch syntax.
 
static int ast_say_datetime_pt (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Portuguese syntax.
 
static int ast_say_datetime_pt_BR (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Brazilian Portuguese syntax.
 
static int ast_say_datetime_th (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Thai syntax.
 
static int ast_say_datetime_zh (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Taiwanese / Chinese syntax.
 
static int ast_say_enumeration_full_da (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_enumeration_full_da: Danish syntax
 
static int ast_say_enumeration_full_de (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_enumeration_full_de: German syntax
 
static int ast_say_enumeration_full_dr (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 ast_say_enumeration_full_dr: Dari syntax
 
static int ast_say_enumeration_full_en (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 ast_say_enumeration_full_en: English syntax
 
static int ast_say_enumeration_full_he (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 
static int ast_say_enumeration_full_is (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_enumeration_full_is: Icelandic syntax
 
static int ast_say_enumeration_full_ps (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 ast_say_enumeration_full_ps: Pashto syntax
 
static int ast_say_enumeration_full_vi (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 
static int ast_say_number_full_cs (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_number_full_cs: Czech syntax
 
static int ast_say_number_full_da (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_number_full_da: Danish syntax New files:
 
static int ast_say_number_full_de (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_number_full_de: German syntax
 
static int ast_say_number_full_dr (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 ast_say_number_full_en_dr: Dari syntax New files:
 
static int ast_say_number_full_en (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 ast_say_number_full_en: English syntax
 
static int ast_say_number_full_en_GB (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 ast_say_number_full_en_GB: British syntax New files:
 
static int ast_say_number_full_es (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_number_full_es: Spanish syntax
 
static int ast_say_number_full_fr (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_number_full_fr: French syntax Extra sounds needed: 1F: feminin 'une' et: 'and'
 
static int ast_say_number_full_gr (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 Greek support A list of the files that you need to create -> digits/xilia = "xilia" -> digits/myrio = "ekatomyrio" -> digits/thousands = "xiliades" -> digits/millions = "ektatomyria" -> digits/[1..12] :: A pronunciation of th digits form 1 to 12 e.g. "tria" -> digits/[10..100] :: A pronunciation of the tens from 10 to 90 e.g. 80 = "ogdonta" Here we must note that we use digits/tens/100 to utter "ekato" and digits/hundred-100 to utter "ekaton" -> digits/hundred-[100...1000] :: A pronunciation of hundreds from 100 to 1000 e.g 400 = "terakosia". Here again we use hundreds/1000 for "xilia" and digits/thousands for "xiliades".
 
static int ast_say_number_full_he (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 
static int ast_say_number_full_hu (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 ast_say_number_full_hu: Hungarian syntax
 
static int ast_say_number_full_is (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_number_full_is: Icelandic syntax
 
static int ast_say_number_full_it (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 ast_say_number_full_it: Italian
 
static int ast_say_number_full_ja (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 
static int ast_say_number_full_ka (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_number_full_ka: Georgian syntax
 
static int ast_say_number_full_nl (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 ast_say_number_full_nl: dutch syntax New files: digits/nl-en
 
static int ast_say_number_full_no (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_number_full_no: Norwegian syntax New files: In addition to American English, the following sounds are required: "and", "1N"
 
static int ast_say_number_full_pl (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 
static int ast_say_number_full_ps (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_number_full_ps: Pashto syntax
 
static int ast_say_number_full_pt (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 
static int ast_say_number_full_ru (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_number_full_ru: Russian syntax
 
static int ast_say_number_full_se (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_number_full_se: Swedish syntax
 
static int ast_say_number_full_th (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 Thai syntax.
 
static int ast_say_number_full_ur (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 
static int ast_say_number_full_vi (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 ast_say_number_full_vi: Vietnamese syntax
 
static int ast_say_number_full_zh (struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
 ast_say_number_full_zh: Taiwanese / Chinese syntax
 
static int ast_say_time_de (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 German syntax.
 
static int ast_say_time_en (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 English syntax.
 
static int ast_say_time_fr (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 French syntax.
 
static int ast_say_time_gr (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Greek support.
 
static int ast_say_time_he (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Hebrew syntax.
 
static int ast_say_time_hu (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Hungarian syntax.
 
static int ast_say_time_ja (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 
static int ast_say_time_ka (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Georgian syntax. e.g. "otxi saati da eqvsi tsuti".
 
static int ast_say_time_nl (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Dutch syntax.
 
static int ast_say_time_pt (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Portuguese syntax.
 
static int ast_say_time_pt_BR (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Brazilian Portuguese syntax.
 
static int ast_say_time_th (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Thai syntax.
 
static int ast_say_time_zh (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 Taiwanese / Chinese syntax.
 
static char * ast_translate_number_ka (int num, char *res, int res_len)
 Georgian support.
 
static const char * counted_adjective_ending_ru (int num, const char gender[])
 In slavic languages such as Russian and Ukrainian the rules for declining adjectives are simpler than those for nouns. When counting we use only the singular (to which we give no suffix) and the genative plural (which we represent by adding an "x"). Oh, an in the singular gender matters so we append the supplied gender suffix ("m", "f", "n").
 
static const char * counted_noun_ending_en (int num)
 In English, we use the plural for everything but one. For example:
 
static const char * counted_noun_ending_slavic (int num)
 Counting of objects in slavic languages such as Russian and Ukrainian the rules are more complicated. There are two plural forms used in counting. They are the genative singular which we represent with the suffix "x1" and the genative plural which we represent with the suffix "x2". The base names of the soundfiles remain in English. For example:
 
static int exp10_int (int power)
 
static int get_lastdigits_ru (int num)
 determine last digits for thousands/millions (ru)
 
static struct ast_strget_number_str_en (int num, const char *lang)
 
static struct ast_strget_ordinal_str_en (int num, const char *lang)
 
static int gr_say_number_female (int num, struct ast_channel *chan, const char *ints, const char *lang)
 Greek digits/female-[1..4] : "Mia, dyo , treis, tessereis".
 
static char next_item (const char *format)
 
static char * pl_append (char *buffer, char *str)
 
static void pl_odtworz_plik (struct ast_channel *chan, const char *language, int audiofd, int ctrlfd, const char *ints, char *fn)
 
static char * pl_rzad_na_tekst (odmiana *odm, int i, int rzad)
 
static void powiedz (struct ast_channel *chan, const char *language, int audiofd, int ctrlfd, const char *ints, odmiana *odm, int rzad, int i)
 
static int say_character_str_full (struct ast_channel *chan, const char *str, const char *ints, const char *lang, enum ast_say_case_sensitivity sensitivity, int audiofd, int ctrlfd)
 
static int say_date (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 
static int say_date_with_format (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
 
static int say_datetime (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 
static int say_datetime_from_now (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 
static int say_digit_str_full (struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
 
static int say_enumeration_full (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_enumeration_full: call language-specific functions
 
static int say_filenames (struct ast_channel *chan, const char *ints, const char *lang, int audiofd, int ctrlfd, struct ast_str *filenames)
 
static int say_money_str_full (struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
 
static int say_number_full (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 ast_say_number_full: call language-specific functions
 
static int say_ordinal_full (struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
 say_ordinal_full
 
static int say_phonetic_str_full (struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
 
static int say_time (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 
static int wait_file (struct ast_channel *chan, const char *ints, const char *file, const char *lang)
 

Detailed Description

Say numbers and dates (maybe words one day too)

Author
Mark Spencer marks.nosp@m.ter@.nosp@m.digiu.nosp@m.m.co.nosp@m.m
Note
12-16-2004 : Support for Greek added by InAccess Networks (work funded by HOL, www.hol.gr) George Konstantoulakis gkon@.nosp@m.inac.nosp@m.cessn.nosp@m.etwo.nosp@m.rks.c.nosp@m.om
2007-02-08 : Support for Georgian added by Alexander Shaduri ashad.nosp@m.uri@.nosp@m.gmail.nosp@m..com, Next Generation Networks (NGN).
2007-03-20 : Support for Thai added by Dome C. dome@.nosp@m.tel..nosp@m.co.th, IP Crossing Co., Ltd.
2021-07-26 : Refactoring to separate string buildup and playback by Naveen Albert aster.nosp@m.isk@.nosp@m.phrea.nosp@m.knet.nosp@m..org

Definition in file say.c.

Macro Definition Documentation

◆ IL_DATE_STR

#define IL_DATE_STR   "AdBY"

◆ IL_DATE_STR_FULL

#define IL_DATE_STR_FULL   IL_DATE_STR " 'digits/at' " IL_TIME_STR

◆ IL_TIME_STR

#define IL_TIME_STR   "HM" /* NOTE: In Hebrew we do not support 12 hours, only 24. No AM or PM exists in the Hebrew language */

◆ SAY_NUM_BUF_SIZE

#define SAY_NUM_BUF_SIZE   256

Definition at line 1828 of file say.c.

Function Documentation

◆ __say_init()

static void __say_init ( void  )
static

remap the 'say' functions to use those in this file

Definition at line 10233 of file say.c.

10234{
10247}
static int say_datetime_from_now(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Definition say.c:8436
static int say_time(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Definition say.c:7666
static int say_digit_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
Definition say.c:348
static int say_phonetic_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
Definition say.c:294
static int say_date_with_format(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Definition say.c:4793
static int say_character_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, enum ast_say_case_sensitivity sensitivity, int audiofd, int ctrlfd)
Definition say.c:210
static int say_ordinal_full(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
say_ordinal_full
Definition say.c:948
static int say_datetime(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Definition say.c:7996
static int say_money_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
Definition say.c:460
static int say_date(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Definition say.c:4391
static int say_number_full(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full: call language-specific functions
Definition say.c:878
static int say_enumeration_full(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_enumeration_full: call language-specific functions
Definition say.c:3461
SAY_EXTERN int(* ast_say_money_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_money_str_full)
Definition say.h:170
SAY_EXTERN int(* ast_say_datetime_from_now)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_datetime_from_now)
Definition say.h:206
SAY_EXTERN int(* ast_say_date)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_date)
Definition say.h:204
SAY_EXTERN int(* ast_say_number_full)(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) SAY_INIT(ast_say_number_full)
Same as ast_say_number() with audiofd for received audio and returns 1 on ctrlfd being readable.
Definition say.h:86
SAY_EXTERN int(* ast_say_enumeration_full)(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) SAY_INIT(ast_say_enumeration_full)
Same as ast_say_enumeration() with audiofd for received audio and returns 1 on ctrlfd being readable.
Definition say.h:125
SAY_EXTERN int(* ast_say_ordinal_full)(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) SAY_INIT(ast_say_ordinal_full)
Same as ast_say_number() with audiofd for received audio and returns 1 on ctrlfd being readable.
Definition say.h:105
SAY_EXTERN int(* ast_say_character_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, enum ast_say_case_sensitivity sensitivity, int audiofd, int ctrlfd) SAY_INIT(ast_say_character_str_full)
Definition say.h:194
SAY_EXTERN int(* ast_say_date_with_format)(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *timezone) SAY_INIT(ast_say_date_with_format)
Definition say.h:208
SAY_EXTERN int(* ast_say_digit_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_digit_str_full)
Same as ast_say_digit_str() with audiofd for received audio and returns 1 on ctrlfd being readable.
Definition say.h:162
SAY_EXTERN int(* ast_say_time)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_time)
Definition say.h:202
SAY_EXTERN int(* ast_say_phonetic_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_phonetic_str_full)
Definition say.h:199
SAY_EXTERN int(* ast_say_datetime)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_datetime)
Definition say.h:201

References ast_say_character_str_full, ast_say_date, ast_say_date_with_format, ast_say_datetime, ast_say_datetime_from_now, ast_say_digit_str_full, ast_say_enumeration_full, ast_say_money_str_full, ast_say_number_full, ast_say_ordinal_full, ast_say_phonetic_str_full, ast_say_time, say_character_str_full(), say_date(), say_date_with_format(), say_datetime(), say_datetime_from_now(), say_digit_str_full(), say_enumeration_full(), say_money_str_full(), say_number_full(), say_ordinal_full(), say_phonetic_str_full(), and say_time().

◆ ast_get_character_str()

struct ast_str * ast_get_character_str ( const char *  str,
const char *  lang,
enum ast_say_case_sensitivity  sensitivity 
)

Returns an ast_str of files for SayAlpha playback.

Parameters
strText to be translated to the corresponding audio files.
langChannel language
sensitivityCase sensitivity

Computes the list of files to be played by SayAlpha.

Return values
ampersand-separatedstring of Asterisk sound files that can be played back.

Definition at line 64 of file say.c.

64 {
65 const char *fn;
66 char fnbuf[10], asciibuf[20] = "letters/ascii";
67 char ltr;
68 int num = 0;
69 int res = 0;
70 int upper = 0;
71 int lower = 0;
72
73 struct ast_str *filenames = ast_str_create(20);
74 if (!filenames) {
75 return NULL;
76 }
77 ast_str_reset(filenames);
78
79 while (str[num] && !res) {
80 fn = NULL;
81 switch (str[num]) {
82 case ('*'):
83 fn = "digits/star";
84 break;
85 case ('#'):
86 fn = "digits/pound";
87 break;
88 case ('!'):
89 fn = "letters/exclaimation-point";
90 break;
91 case ('@'):
92 fn = "letters/at";
93 break;
94 case ('$'):
95 fn = "letters/dollar";
96 break;
97 case ('-'):
98 fn = "letters/dash";
99 break;
100 case ('.'):
101 fn = "letters/dot";
102 break;
103 case ('='):
104 fn = "letters/equals";
105 break;
106 case ('+'):
107 fn = "letters/plus";
108 break;
109 case ('/'):
110 fn = "letters/slash";
111 break;
112 case (' '):
113 fn = "letters/space";
114 break;
115 case ('0'):
116 case ('1'):
117 case ('2'):
118 case ('3'):
119 case ('4'):
120 case ('5'):
121 case ('6'):
122 case ('7'):
123 case ('8'):
124 case ('9'):
125 strcpy(fnbuf, "digits/X");
126 fnbuf[7] = str[num];
127 fn = fnbuf;
128 break;
129 default:
130 ltr = str[num];
131 if ('A' <= ltr && ltr <= 'Z') {
132 ltr += 'a' - 'A'; /* file names are all lower-case */
133 switch (sensitivity) {
135 case AST_SAY_CASE_ALL:
136 upper = !upper;
139 break;
140 }
141 } else if ('a' <= ltr && ltr <= 'z') {
142 switch (sensitivity) {
144 case AST_SAY_CASE_ALL:
145 lower = !lower;
148 break;
149 }
150 }
151
152 if (upper) {
153 strcpy(fnbuf, "uppercase");
154 } else if (lower) {
155 strcpy(fnbuf, "lowercase");
156 } else {
157 strcpy(fnbuf, "letters/X");
158 fnbuf[8] = ltr;
159 }
160 fn = fnbuf;
161 }
162 if ((fn && ast_fileexists(fn, NULL, lang) > 0) ||
163 (snprintf(asciibuf + 13, sizeof(asciibuf) - 13, "%d", str[num]) > 0 && ast_fileexists(asciibuf, NULL, lang) > 0 && (fn = asciibuf))) {
164 ast_str_append(&filenames, 0, "%s%s", ast_str_strlen(filenames) ? "&" : "", fn);
165 }
166 if (upper || lower) {
167 continue;
168 }
169 num++;
170 }
171
172 return filenames;
173}
const char * str
Definition app_jack.c:150
int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
Checks for the existence of a given file.
Definition file.c:1148
#define NULL
Definition resample.c:96
@ AST_SAY_CASE_LOWER
Definition say.h:183
@ AST_SAY_CASE_ALL
Definition say.h:185
@ AST_SAY_CASE_UPPER
Definition say.h:184
@ AST_SAY_CASE_NONE
Definition say.h:182
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition strings.h:1139
size_t attribute_pure ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
Definition strings.h:730
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
Definition strings.h:693
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
Definition strings.h:659
Support for dynamic strings.
Definition strings.h:623

References ast_fileexists(), AST_SAY_CASE_ALL, AST_SAY_CASE_LOWER, AST_SAY_CASE_NONE, AST_SAY_CASE_UPPER, ast_str_append(), ast_str_create, ast_str_reset(), ast_str_strlen(), NULL, and str.

Referenced by say_character_str_full(), and sayfile_exec().

◆ ast_get_digit_str()

struct ast_str * ast_get_digit_str ( const char *  str,
const char *  lang 
)

Returns an ast_str of files for SayDigits playback.

Parameters
strText to be translated to the corresponding audio files.
langChannel language

Computes the list of files to be played by SayDigits.

Return values
ampersand-separatedstring of Asterisk sound files that can be played back.

Definition at line 300 of file say.c.

301{
302 const char *fn;
303 char fnbuf[256];
304 int num = 0;
305
306 struct ast_str *filenames = ast_str_create(20);
307 if (!filenames) {
308 return NULL;
309 }
310 ast_str_reset(filenames);
311
312 while (str[num]) {
313 fn = NULL;
314 switch (str[num]) {
315 case ('*'):
316 fn = "digits/star";
317 break;
318 case ('#'):
319 fn = "digits/pound";
320 break;
321 case ('-'):
322 fn = "digits/minus";
323 break;
324 case '0':
325 case '1':
326 case '2':
327 case '3':
328 case '4':
329 case '5':
330 case '6':
331 case '7':
332 case '8':
333 case '9':
334 strcpy(fnbuf, "digits/X");
335 fnbuf[7] = str[num];
336 fn = fnbuf;
337 break;
338 }
339 if (fn && ast_fileexists(fn, NULL, lang) > 0) {
340 ast_str_append(&filenames, 0, "%s%s", ast_str_strlen(filenames) ? "&" : "", fn);
341 }
342 num++;
343 }
344
345 return filenames;
346}

References ast_fileexists(), ast_str_append(), ast_str_create, ast_str_reset(), ast_str_strlen(), NULL, and str.

Referenced by ast_get_money_en_dollars_str(), get_number_str_en(), say_digit_str_full(), and sayfile_exec().

◆ ast_get_money_en_dollars_str()

static struct ast_str * ast_get_money_en_dollars_str ( const char *  str,
const char *  lang 
)
static

Definition at line 354 of file say.c.

355{
356 const char *fnr;
357 int amt, dollars = 0, cents = 0;
358 struct ast_str *fnrecurse = NULL;
359 struct ast_str *filenames;
360
361 if (ast_strlen_zero(str)) {
362 return NULL;
363 }
364
365 filenames = ast_str_create(20);
366 if (!filenames) {
367 return NULL;
368 }
369 ast_str_reset(filenames);
370
371 /* Don't use %f because floating point rounding
372 * could distort the cents units. Just parse as string. */
373 if (str && *str == '.') {
374 if (sscanf(str, ".%02u", &cents) < 1) {
375 dollars = cents = 0;
376 } else {
377 /* If we have a space instead of numbers after '.',
378 * then it's not quite valid. */
379 const char *period = strchr(str, '.');
380 if (period && !isdigit(*(period + 1))) {
381 cents = 0;
382 }
383 }
384 } else {
385 int res = sscanf(str, "%d.%02u", &dollars, &cents);
386 if (res < 1) {
387 dollars = cents = 0;
388 } else if (res == 2) {
389 const char *period = strchr(str, '.');
390 if (period && !isdigit(*(period + 1))) {
391 cents = 0;
392 }
393 }
394 }
395 amt = dollars * 100 + cents; /* convert everything to cents */
396
397 ast_debug(1, "Amount is %d (%d dollar%s, %d cent%s)\n", amt, dollars, ESS(dollars), cents, ESS(cents));
398
399 if (amt >= 100) {
400 fnrecurse = ast_get_number_str((amt / 100), lang);
401 if (!fnrecurse) {
402 ast_log(LOG_WARNING, "Couldn't get string for dollars\n");
403 } else {
404 fnr = ast_str_buffer(fnrecurse);
405 ast_str_append(&filenames, 0, "%s", fnr);
406 }
407
408 /* If this is it, end on a down pitch, otherwise up pitch */
409 if (amt < 200) {
410 ast_str_append(&filenames, 0, "&%s", (cents > 0) ? "letters/dollar_" : "letters/dollar");
411 } else {
412 ast_str_append(&filenames, 0, "&%s", "dollars");
413 }
414
415 /* If dollars and cents, add "and" in the middle */
416 if (cents > 0) {
417 ast_str_append(&filenames, 0, "&%s", "and");
418 }
419 }
420
421 if (cents > 0) {
422 fnrecurse = ast_get_number_str(cents, lang);
423 if (!fnrecurse) {
424 ast_log(LOG_ERROR, "Couldn't get string for cents\n");
425 } else {
426 fnr = ast_str_buffer(fnrecurse);
427 ast_str_append(&filenames, 0, (amt < 100 ? "%s" : "&%s"), fnr);
428 }
429 ast_str_append(&filenames, 0, "&%s", (cents == 1) ? "cent" : "cents");
430 } else if (amt == 0) {
431 fnrecurse = ast_get_digit_str("0", lang);
432 if (!fnrecurse) {
433 ast_log(LOG_ERROR, "Couldn't get string for cents\n");
434 } else {
435 fnr = ast_str_buffer(fnrecurse);
436 ast_str_append(&filenames, 0, "%s", fnr);
437 }
438 ast_str_append(&filenames, 0, "&%s", "cents");
439 }
440
441 if (fnrecurse) {
442 ast_free(fnrecurse);
443 }
444
445 return filenames;
446}
#define ast_free(a)
Definition astmm.h:180
#define ast_log
Definition astobj2.c:42
#define ESS(x)
Definition cli.h:59
#define ast_debug(level,...)
Log a DEBUG message.
#define LOG_ERROR
#define LOG_WARNING
struct ast_str * ast_get_number_str(int num, const char *lang)
ast_get_number_str: call language-specific functions
Definition say.c:566
struct ast_str * ast_get_digit_str(const char *str, const char *lang)
Returns an ast_str of files for SayDigits playback.
Definition say.c:300
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition strings.h:65
char *attribute_pure ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition strings.h:761

References ast_debug, ast_free, ast_get_digit_str(), ast_get_number_str(), ast_log, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_reset(), ast_strlen_zero(), ESS, LOG_ERROR, LOG_WARNING, NULL, and str.

Referenced by ast_get_money_str().

◆ ast_get_money_str()

struct ast_str * ast_get_money_str ( const char *  str,
const char *  lang 
)

ast_get_money_str: call language-specific functions

Returns an ast_str of files for SayMoney playback.

Definition at line 449 of file say.c.

450{
451 if (!strncasecmp(lang, "en", 2)) { /* English syntax */
452 return ast_get_money_en_dollars_str(str, lang);
453 }
454
455 ast_log(LOG_WARNING, "Language %s not currently supported, defaulting to US Dollars\n", lang);
456 /* Default to english */
457 return ast_get_money_en_dollars_str(str, lang);
458}
static struct ast_str * ast_get_money_en_dollars_str(const char *str, const char *lang)
Definition say.c:354

References ast_get_money_en_dollars_str(), ast_log, LOG_WARNING, and str.

Referenced by say_money_str_full(), and sayfile_exec().

◆ ast_get_number_str()

struct ast_str * ast_get_number_str ( int  num,
const char *  lang 
)

ast_get_number_str: call language-specific functions

Returns an ast_str of files for SayNumber playback.

Definition at line 566 of file say.c.

567{
568 if (!strncasecmp(lang, "en", 2)) { /* English syntax */
569 return get_number_str_en(num, lang);
570 }
571
572 ast_log(LOG_WARNING, "Language %s not currently supported, defaulting to English\n", lang);
573 /* Default to english */
574 return get_number_str_en(num, lang);
575}
static struct ast_str * get_number_str_en(int num, const char *lang)
Definition say.c:466

References ast_log, get_number_str_en(), and LOG_WARNING.

Referenced by ast_get_money_en_dollars_str(), ast_say_number_full_en(), and sayfile_exec().

◆ ast_get_ordinal_str()

struct ast_str * ast_get_ordinal_str ( int  num,
const char *  lang 
)

ast_get_ordinal_str: call language-specific functions

Returns an ast_str of files for SayOrdinal playback.

Definition at line 686 of file say.c.

687{
688 if (!strncasecmp(lang, "en", 2)) { /* English syntax */
689 return get_ordinal_str_en(num, lang);
690 }
691
692 ast_log(LOG_WARNING, "Language %s not currently supported, defaulting to English\n", lang);
693 /* Default to english */
694 return get_ordinal_str_en(num, lang);
695}
static struct ast_str * get_ordinal_str_en(int num, const char *lang)
Definition say.c:577

References ast_log, get_ordinal_str_en(), and LOG_WARNING.

Referenced by say_ordinal_full(), and sayfile_exec().

◆ ast_get_phonetic_str()

struct ast_str * ast_get_phonetic_str ( const char *  str,
const char *  lang 
)

Returns an ast_str of files for SayPhonetic playback.

Parameters
strText to be translated to the corresponding audio files.
langChannel language

Computes the list of files to be played by SayPhonetic.

Return values
ampersand-separatedstring of Asterisk sound files that can be played back.

Definition at line 216 of file say.c.

217{
218 const char *fn;
219 char fnbuf[256];
220 char ltr;
221 int num = 0;
222
223 struct ast_str *filenames = ast_str_create(20);
224 if (!filenames) {
225 return NULL;
226 }
227 ast_str_reset(filenames);
228
229 while (str[num]) {
230 fn = NULL;
231 switch (str[num]) {
232 case ('*'):
233 fn = "digits/star";
234 break;
235 case ('#'):
236 fn = "digits/pound";
237 break;
238 case ('!'):
239 fn = "letters/exclaimation-point";
240 break;
241 case ('@'):
242 fn = "letters/at";
243 break;
244 case ('$'):
245 fn = "letters/dollar";
246 break;
247 case ('-'):
248 fn = "letters/dash";
249 break;
250 case ('.'):
251 fn = "letters/dot";
252 break;
253 case ('='):
254 fn = "letters/equals";
255 break;
256 case ('+'):
257 fn = "letters/plus";
258 break;
259 case ('/'):
260 fn = "letters/slash";
261 break;
262 case (' '):
263 fn = "letters/space";
264 break;
265 case ('0'):
266 case ('1'):
267 case ('2'):
268 case ('3'):
269 case ('4'):
270 case ('5'):
271 case ('6'):
272 case ('7'):
273 case ('8'):
274 strcpy(fnbuf, "digits/X");
275 fnbuf[7] = str[num];
276 fn = fnbuf;
277 break;
278 default: /* '9' falls here... */
279 ltr = str[num];
280 if ('A' <= ltr && ltr <= 'Z') ltr += 'a' - 'A'; /* file names are all lower-case */
281 strcpy(fnbuf, "phonetic/X_p");
282 fnbuf[9] = ltr;
283 fn = fnbuf;
284 }
285 if (fn && ast_fileexists(fn, NULL, lang) > 0) {
286 ast_str_append(&filenames, 0, "%s%s", ast_str_strlen(filenames) ? "&" : "", fn);
287 }
288 num++;
289 }
290
291 return filenames;
292}

References ast_fileexists(), ast_str_append(), ast_str_create, ast_str_reset(), ast_str_strlen(), NULL, and str.

Referenced by say_phonetic_str_full(), and sayfile_exec().

◆ ast_say_counted_adjective()

int ast_say_counted_adjective ( struct ast_channel chan,
int  num,
const char  adjective[],
const char  gender[] 
)

Definition at line 10211 of file say.c.

10212{
10213 char *temp;
10214 int temp_len;
10215 const char *ending;
10216 if (!strncasecmp(ast_channel_language(chan), "ru", 2)) { /* Russian */
10217 ending = counted_adjective_ending_ru(num, gender);
10218 } else if (!strncasecmp(ast_channel_language(chan), "ua", 2)) { /* Ukrainian */
10219 ending = counted_adjective_ending_ru(num, gender);
10220 } else if (!strncasecmp(ast_channel_language(chan), "pl", 2)) { /* Polish */
10221 ending = counted_adjective_ending_ru(num, gender);
10222 } else { /* English and default */
10223 ending = "";
10224 }
10225 temp = ast_alloca((temp_len = (strlen(adjective) + strlen(ending) + 1)));
10226 snprintf(temp, temp_len, "%s%s", adjective, ending);
10227 return ast_play_and_wait(chan, temp);
10228}
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
Definition astmm.h:288
const char * ast_channel_language(const struct ast_channel *chan)
int ast_play_and_wait(struct ast_channel *chan, const char *fn)
Play a stream and wait for a digit, returning the digit that was pressed.
Definition main/app.c:1616
static const char * counted_adjective_ending_ru(int num, const char gender[])
In slavic languages such as Russian and Ukrainian the rules for declining adjectives are simpler than...
Definition say.c:10195

References ast_alloca, ast_channel_language(), ast_play_and_wait(), and counted_adjective_ending_ru().

◆ ast_say_counted_noun()

int ast_say_counted_noun ( struct ast_channel chan,
int  num,
const char  noun[] 
)

Definition at line 10169 of file say.c.

10170{
10171 char *temp;
10172 int temp_len;
10173 const char *ending;
10174 if (!strncasecmp(ast_channel_language(chan), "ru", 2)) { /* Russian */
10175 ending = counted_noun_ending_slavic(num);
10176 } else if (!strncasecmp(ast_channel_language(chan), "ua", 2)) { /* Ukrainian */
10177 ending = counted_noun_ending_slavic(num);
10178 } else if (!strncasecmp(ast_channel_language(chan), "pl", 2)) { /* Polish */
10179 ending = counted_noun_ending_slavic(num);
10180 } else { /* English and default */
10181 ending = counted_noun_ending_en(num);
10182 }
10183 temp = ast_alloca((temp_len = (strlen(noun) + strlen(ending) + 1)));
10184 snprintf(temp, temp_len, "%s%s", noun, ending);
10185 return ast_play_and_wait(chan, temp);
10186}
static const char * counted_noun_ending_slavic(int num)
Counting of objects in slavic languages such as Russian and Ukrainian the rules are more complicated....
Definition say.c:10150
static const char * counted_noun_ending_en(int num)
In English, we use the plural for everything but one. For example:
Definition say.c:10131

References ast_alloca, ast_channel_language(), ast_play_and_wait(), counted_noun_ending_en(), and counted_noun_ending_slavic().

◆ ast_say_date_da()

int ast_say_date_da ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Danish syntax.

Definition at line 4459 of file say.c.

4460{
4461 struct timeval when = { t, 0 };
4462 struct ast_tm tm;
4463 char fn[256];
4464 int res = 0;
4465 ast_localtime(&when, &tm, NULL);
4466 if (!res) {
4467 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
4468 res = ast_streamfile(chan, fn, lang);
4469 if (!res)
4470 res = ast_waitstream(chan, ints);
4471 }
4472 if (!res)
4473 res = ast_say_enumeration(chan, tm.tm_mday, ints, lang, (char * ) NULL);
4474 if (!res)
4475 res = ast_waitstream(chan, ints);
4476 if (!res) {
4477 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
4478 res = ast_streamfile(chan, fn, lang);
4479 if (!res)
4480 res = ast_waitstream(chan, ints);
4481 }
4482 if (!res) {
4483 /* Year */
4484 int year = tm.tm_year + 1900;
4485 if (year > 1999) { /* year 2000 and later */
4486 res = ast_say_number(chan, year, ints, lang, (char *) NULL);
4487 } else {
4488 if (year < 1100) {
4489 /* I'm not going to handle 1100 and prior */
4490 /* We'll just be silent on the year, instead of bombing out. */
4491 } else {
4492 /* year 1100 to 1999. will anybody need this?!? */
4493 snprintf(fn, sizeof(fn), "digits/%d", (year / 100));
4494 res = wait_file(chan, ints, fn, lang);
4495 if (!res) {
4496 res = wait_file(chan, ints, "digits/hundred", lang);
4497 if (!res && year % 100 != 0) {
4498 res = ast_say_number(chan, (year % 100), ints, lang, (char *) NULL);
4499 }
4500 }
4501 }
4502 }
4503 }
4504 return res;
4505}
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
Definition file.c:1312
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
Definition file.c:1874
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
Definition localtime.c:1739
static int wait_file(struct ast_channel *chan, const char *ints, const char *file, const char *lang)
Definition say.c:864
int ast_say_number(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options)
says a number
Definition channel.c:8279
int ast_say_enumeration(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options)
says an enumeration
Definition channel.c:8291

References ast_localtime(), ast_say_enumeration(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by say_date().

◆ ast_say_date_de()

int ast_say_date_de ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

German syntax.

Definition at line 4508 of file say.c.

4509{
4510 struct timeval when = { t, 0 };
4511 struct ast_tm tm;
4512 char fn[256];
4513 int res = 0;
4514 ast_localtime(&when, &tm, NULL);
4515 if (!res) {
4516 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
4517 res = ast_streamfile(chan, fn, lang);
4518 if (!res)
4519 res = ast_waitstream(chan, ints);
4520 }
4521 if (!res)
4522 res = ast_say_enumeration(chan, tm.tm_mday, ints, lang, (char * ) NULL);
4523 if (!res)
4524 res = ast_waitstream(chan, ints);
4525 if (!res) {
4526 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
4527 res = ast_streamfile(chan, fn, lang);
4528 if (!res)
4529 res = ast_waitstream(chan, ints);
4530 }
4531 if (!res) {
4532 /* Year */
4533 int year = tm.tm_year + 1900;
4534 if (year > 1999) { /* year 2000 and later */
4535 res = ast_say_number(chan, year, ints, lang, (char *) NULL);
4536 } else {
4537 if (year < 1100) {
4538 /* I'm not going to handle 1100 and prior */
4539 /* We'll just be silent on the year, instead of bombing out. */
4540 } else {
4541 /* year 1100 to 1999. will anybody need this?!? */
4542 /* say 1967 as 'neunzehn hundert sieben und sechzig' */
4543 snprintf(fn, sizeof(fn), "digits/%d", (year / 100) );
4544 res = wait_file(chan, ints, fn, lang);
4545 if (!res) {
4546 res = wait_file(chan, ints, "digits/hundred", lang);
4547 if (!res && year % 100 != 0) {
4548 res = ast_say_number(chan, (year % 100), ints, lang, (char *) NULL);
4549 }
4550 }
4551 }
4552 }
4553 }
4554 return res;
4555}

References ast_localtime(), ast_say_enumeration(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by say_date().

◆ ast_say_date_en()

int ast_say_date_en ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

English syntax.

Definition at line 4430 of file say.c.

4431{
4432 struct ast_tm tm;
4433 struct timeval when = { t, 0 };
4434 char fn[256];
4435 int res = 0;
4436 ast_localtime(&when, &tm, NULL);
4437 if (!res) {
4438 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
4439 res = ast_streamfile(chan, fn, lang);
4440 if (!res)
4441 res = ast_waitstream(chan, ints);
4442 }
4443 if (!res) {
4444 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
4445 res = ast_streamfile(chan, fn, lang);
4446 if (!res)
4447 res = ast_waitstream(chan, ints);
4448 }
4449 if (!res)
4450 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char * ) NULL);
4451 if (!res)
4452 res = ast_waitstream(chan, ints);
4453 if (!res)
4454 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
4455 return res;
4456}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_date().

◆ ast_say_date_fr()

int ast_say_date_fr ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

French syntax.

Definition at line 4590 of file say.c.

4591{
4592 struct timeval when = { t, 0 };
4593 struct ast_tm tm;
4594 char fn[256];
4595 int res = 0;
4596 ast_localtime(&when, &tm, NULL);
4597 if (!res) {
4598 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
4599 res = ast_streamfile(chan, fn, lang);
4600 if (!res)
4601 res = ast_waitstream(chan, ints);
4602 }
4603 if (!res)
4604 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char * ) NULL);
4605 if (!res)
4606 res = ast_waitstream(chan, ints);
4607 if (!res) {
4608 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
4609 res = ast_streamfile(chan, fn, lang);
4610 if (!res)
4611 res = ast_waitstream(chan, ints);
4612 }
4613 if (!res)
4614 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
4615 return res;
4616}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_date().

◆ ast_say_date_gr()

static int ast_say_date_gr ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Greek support.

The format is weekday - day - month -year

A list of the files that you need to create digits/day-[1..7] : "Deytera .. Paraskeyh" digits/months/1..12 : "Ianouariou .. Dekembriou" Attention the months are in "gekinh klhsh"

Definition at line 8814 of file say.c.

8815{
8816 struct ast_tm tm;
8817 struct timeval when = { t, 0 };
8818
8819 char fn[256];
8820 int res = 0;
8821
8822
8823 ast_localtime(&when, &tm, NULL);
8824 /* W E E K - D A Y */
8825 if (!res) {
8826 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
8827 res = ast_streamfile(chan, fn, lang);
8828 if (!res)
8829 res = ast_waitstream(chan, ints);
8830 }
8831 /* D A Y */
8832 if (!res) {
8833 gr_say_number_female(tm.tm_mday, chan, ints, lang);
8834 }
8835 /* M O N T H */
8836 if (!res) {
8837 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
8838 res = ast_streamfile(chan, fn, lang);
8839 if (!res)
8840 res = ast_waitstream(chan, ints);
8841 }
8842 /* Y E A R */
8843 if (!res)
8844 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
8845 return res;
8846}
static int gr_say_number_female(int num, struct ast_channel *chan, const char *ints, const char *lang)
Greek digits/female-[1..4] : "Mia, dyo , treis, tessereis".
Definition say.c:8625

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), gr_say_number_female(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_date().

◆ ast_say_date_he()

int ast_say_date_he ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Hebrew syntax.

Definition at line 4711 of file say.c.

4712{
4713 struct timeval when = { t, 0 };
4714 struct ast_tm tm;
4715 char fn[256];
4716 int res = 0;
4717 ast_localtime(&when, &tm, NULL);
4718 if (!res) {
4719 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
4720 res = ast_streamfile(chan, fn, lang);
4721 if (!res) {
4722 res = ast_waitstream(chan, ints);
4723 }
4724 }
4725 if (!res) {
4726 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
4727 res = ast_streamfile(chan, fn, lang);
4728 if (!res) {
4729 res = ast_waitstream(chan, ints);
4730 }
4731 }
4732 if (!res) {
4733 res = ast_say_number(chan, tm.tm_mday, ints, lang, "m");
4734 }
4735 if (!res) {
4736 res = ast_waitstream(chan, ints);
4737 }
4738 if (!res) {
4739 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, "m");
4740 }
4741 return res;
4742}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_date().

◆ ast_say_date_hu()

int ast_say_date_hu ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Hungarian syntax.

Definition at line 4558 of file say.c.

4559{
4560 struct timeval when = { t, 0 };
4561 struct ast_tm tm;
4562 char fn[256];
4563 int res = 0;
4564 ast_localtime(&when, &tm, NULL);
4565
4566 if (!res)
4567 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
4568 if (!res)
4569 res = ast_waitstream(chan, ints);
4570 if (!res) {
4571 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
4572 res = ast_streamfile(chan, fn, lang);
4573 if (!res)
4574 res = ast_waitstream(chan, ints);
4575 }
4576 if (!res)
4577 ast_say_number(chan, tm.tm_mday , ints, lang, (char *) NULL);
4578 if (!res)
4579 res = ast_waitstream(chan, ints);
4580 if (!res) {
4581 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
4582 res = ast_streamfile(chan, fn, lang);
4583 if (!res)
4584 res = ast_waitstream(chan, ints);
4585 }
4586 return res;
4587}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_date().

◆ ast_say_date_is()

int ast_say_date_is ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Definition at line 4745 of file say.c.

4746{
4747 struct timeval when = { t, 0 };
4748 struct ast_tm tm;
4749 char fn[256];
4750 int res = 0;
4751 ast_localtime(&when, &tm, NULL);
4752 if (!res) {
4753 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
4754 res = ast_streamfile(chan, fn, lang);
4755 if (!res)
4756 res = ast_waitstream(chan, ints);
4757 }
4758 if (!res)
4759 res = ast_say_enumeration(chan, tm.tm_mday, ints, lang, (char * ) NULL);
4760 if (!res)
4761 res = ast_waitstream(chan, ints);
4762 if (!res) {
4763 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
4764 res = ast_streamfile(chan, fn, lang);
4765 if (!res)
4766 res = ast_waitstream(chan, ints);
4767 }
4768 if (!res) {
4769 /* Year */
4770 int year = tm.tm_year + 1900;
4771 if (year > 1999) { /* year 2000 and later */
4772 res = ast_say_number(chan, year, ints, lang, (char *) NULL);
4773 } else {
4774 if (year < 1100) {
4775 /* I'm not going to handle 1100 and prior */
4776 /* We'll just be silent on the year, instead of bombing out. */
4777 } else {
4778 /* year 1100 to 1999. will anybody need this?!? */
4779 snprintf(fn, sizeof(fn), "digits/%d", (year / 100));
4780 res = wait_file(chan, ints, fn, lang);
4781 if (!res) {
4782 res = wait_file(chan, ints, "digits/hundred", lang);
4783 if (!res && year % 100 != 0) {
4784 res = ast_say_number(chan, (year % 100), ints, lang, (char *) NULL);
4785 }
4786 }
4787 }
4788 }
4789 }
4790 return res;
4791}

References ast_localtime(), ast_say_enumeration(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by say_date().

◆ ast_say_date_ja()

int ast_say_date_ja ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Definition at line 8850 of file say.c.

8851{
8852 struct ast_tm tm;
8853 struct timeval tv = { t, 0 };
8854 char fn[256];
8855 int res = 0;
8856
8857 ast_localtime(&tv, &tm, NULL);
8858
8859 if (!res)
8860 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
8861 if (!res)
8862 res = ast_waitstream(chan, ints);
8863 if (!res)
8864 res = ast_streamfile(chan, "digits/nen", lang);
8865 if (!res) {
8866 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
8867 res = ast_streamfile(chan, fn, lang);
8868 if (!res)
8869 res = ast_waitstream(chan, ints);
8870 }
8871 if (!res)
8872 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char * ) NULL);
8873 if (!res)
8874 res = ast_streamfile(chan, "digits/nichi", lang);
8875 if (!res) {
8876 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
8877 res = ast_streamfile(chan, fn, lang);
8878 if (!res)
8879 res = ast_waitstream(chan, ints);
8880 }
8881 return res;
8882}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_date().

◆ ast_say_date_ka()

static int ast_say_date_ka ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Georgian syntax. e.g. "oriatas xuti tslis 5 noemberi".

Georgian support for date/time requires the following files (*.gsm):

  • mon-1, mon-2, ... (ianvari, tebervali, ...)
  • day-1, day-2, ... (orshabati, samshabati, ...)
  • saati_da
  • tsuti
  • tslis

Definition at line 9982 of file say.c.

9983{
9984 struct timeval when = { t, 0 };
9985 struct ast_tm tm;
9986 char fn[256];
9987 int res = 0;
9988 ast_localtime(&when, &tm, NULL);
9989
9990 if (!res) {
9991 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
9992 }
9993
9994 if (!res) {
9995 snprintf(fn, sizeof(fn), "digits/tslis %d", tm.tm_wday);
9996 res = ast_streamfile(chan, fn, lang);
9997 if (!res) {
9998 res = ast_waitstream(chan, ints);
9999 }
10000 }
10001
10002 if (!res) {
10003 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char * ) NULL);
10004/* if (!res)
10005 res = ast_waitstream(chan, ints);
10006*/
10007 }
10008
10009 if (!res) {
10010 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
10011 res = ast_streamfile(chan, fn, lang);
10012 if (!res) {
10013 res = ast_waitstream(chan, ints);
10014 }
10015 }
10016 return res;
10017
10018}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_date().

◆ ast_say_date_nl()

int ast_say_date_nl ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Dutch syntax.

Definition at line 4619 of file say.c.

4620{
4621 struct timeval when = { t, 0 };
4622 struct ast_tm tm;
4623 char fn[256];
4624 int res = 0;
4625 ast_localtime(&when, &tm, NULL);
4626 if (!res) {
4627 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
4628 res = ast_streamfile(chan, fn, lang);
4629 if (!res)
4630 res = ast_waitstream(chan, ints);
4631 }
4632 if (!res)
4633 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char * ) NULL);
4634 if (!res) {
4635 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
4636 res = ast_streamfile(chan, fn, lang);
4637 if (!res)
4638 res = ast_waitstream(chan, ints);
4639 }
4640 if (!res)
4641 res = ast_waitstream(chan, ints);
4642 if (!res)
4643 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
4644 return res;
4645}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_date().

◆ ast_say_date_pt()

int ast_say_date_pt ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Portuguese syntax.

Definition at line 4684 of file say.c.

4685{
4686 struct timeval when = { t, 0 };
4687 struct ast_tm tm;
4688 char fn[256];
4689 int res = 0;
4690
4691 ast_localtime(&when, &tm, NULL);
4692 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
4693 if (!res)
4694 res = wait_file(chan, ints, fn, lang);
4695 if (!res)
4696 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
4697 if (!res)
4698 res = wait_file(chan, ints, "digits/pt-de", lang);
4699 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
4700 if (!res)
4701 res = wait_file(chan, ints, fn, lang);
4702 if (!res)
4703 res = wait_file(chan, ints, "digits/pt-de", lang);
4704 if (!res)
4705 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
4706
4707 return res;
4708}

References ast_localtime(), ast_say_number(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by say_date().

◆ ast_say_date_th()

int ast_say_date_th ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Thai syntax.

Definition at line 4648 of file say.c.

4649{
4650 struct timeval when = { t, 0 };
4651 struct ast_tm tm;
4652 char fn[256];
4653 int res = 0;
4654 ast_localtime(&when, &tm, NULL);
4655 if (!res) {
4656 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
4657 res = ast_streamfile(chan, fn, lang);
4658 ast_copy_string(fn, "digits/tee", sizeof(fn));
4659 res = ast_streamfile(chan, fn, lang);
4660 if (!res)
4661 res = ast_waitstream(chan, ints);
4662 }
4663 if (!res)
4664 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char * ) NULL);
4665 if (!res)
4666 res = ast_waitstream(chan, ints);
4667 if (!res) {
4668 ast_copy_string(fn, "digits/duan", sizeof(fn));
4669 res = ast_streamfile(chan, fn, lang);
4670 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
4671 res = ast_streamfile(chan, fn, lang);
4672 if (!res)
4673 res = ast_waitstream(chan, ints);
4674 }
4675 if (!res){
4676 ast_copy_string(fn, "digits/posor", sizeof(fn));
4677 res = ast_streamfile(chan, fn, lang);
4678 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
4679 }
4680 return res;
4681}
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition strings.h:425

References ast_copy_string(), ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_date().

◆ ast_say_date_with_format_da()

int ast_say_date_with_format_da ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

Danish syntax.

Definition at line 5112 of file say.c.

5113{
5114 struct timeval when = { t, 0 };
5115 struct ast_tm tm;
5116 int res=0, offset, sndoffset;
5117 char sndfile[256], nextmsg[256];
5118
5119 if (!format)
5120 format = "A dBY HMS";
5121
5122 ast_localtime(&when, &tm, tzone);
5123
5124 for (offset=0 ; format[offset] != '\0' ; offset++) {
5125 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5126 switch (format[offset]) {
5127 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
5128 case '\'':
5129 /* Literal name of a sound file */
5130 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
5131 sndfile[sndoffset] = format[offset];
5132 }
5133 sndfile[sndoffset] = '\0';
5134 res = wait_file(chan, ints, sndfile, lang);
5135 break;
5136 case 'A':
5137 case 'a':
5138 /* Sunday - Saturday */
5139 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
5140 res = wait_file(chan, ints, nextmsg, lang);
5141 break;
5142 case 'B':
5143 case 'b':
5144 case 'h':
5145 /* January - December */
5146 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
5147 res = wait_file(chan, ints, nextmsg, lang);
5148 break;
5149 case 'm':
5150 /* Month enumerated */
5151 res = ast_say_enumeration(chan, (tm.tm_mon + 1), ints, lang, "m");
5152 break;
5153 case 'd':
5154 case 'e':
5155 /* First - Thirtyfirst */
5156 res = ast_say_enumeration(chan, tm.tm_mday, ints, lang, "m");
5157 break;
5158 case 'Y':
5159 /* Year */
5160 {
5161 int year = tm.tm_year + 1900;
5162 if (year > 1999) { /* year 2000 and later */
5163 res = ast_say_number(chan, year, ints, lang, (char *) NULL);
5164 } else {
5165 if (year < 1100) {
5166 /* I'm not going to handle 1100 and prior */
5167 /* We'll just be silent on the year, instead of bombing out. */
5168 } else {
5169 /* year 1100 to 1999. will anybody need this?!? */
5170 /* say 1967 as 'nineteen hundred seven and sixty' */
5171 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", (year / 100) );
5172 res = wait_file(chan, ints, nextmsg, lang);
5173 if (!res) {
5174 res = wait_file(chan, ints, "digits/hundred", lang);
5175 if (!res && year % 100 != 0) {
5176 res = ast_say_number(chan, (year % 100), ints, lang, (char *) NULL);
5177 }
5178 }
5179 }
5180 }
5181 }
5182 break;
5183 case 'I':
5184 case 'l':
5185 /* 12-Hour */
5186 res = wait_file(chan, ints, "digits/oclock", lang);
5187 if (tm.tm_hour == 0)
5188 ast_copy_string(nextmsg, "digits/12", sizeof(nextmsg));
5189 else if (tm.tm_hour > 12)
5190 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
5191 else
5192 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
5193 if (!res) {
5194 res = wait_file(chan, ints, nextmsg, lang);
5195 }
5196 break;
5197 case 'H':
5198 /* 24-Hour, single digit hours preceded by "oh" (0) */
5199 if (tm.tm_hour < 10 && tm.tm_hour > 0) {
5200 res = wait_file(chan, ints, "digits/0", lang);
5201 }
5202 /* FALLTRHU */
5203 case 'k':
5204 /* 24-Hour */
5205 res = ast_say_number(chan, tm.tm_hour, ints, lang, (char *) NULL);
5206 break;
5207 case 'M':
5208 /* Minute */
5209 if (tm.tm_min > 0 || next_item(&format[offset + 1]) == 'S') { /* zero 'digits/0' only if seconds follow */
5210 res = ast_say_number(chan, tm.tm_min, ints, lang, "f");
5211 }
5212 if (!res && next_item(&format[offset + 1]) == 'S') { /* minutes only if seconds follow */
5213 if (tm.tm_min == 1) {
5214 res = wait_file(chan, ints, "minute", lang);
5215 } else {
5216 res = wait_file(chan, ints, "minutes", lang);
5217 }
5218 }
5219 break;
5220 case 'P':
5221 case 'p':
5222 /* AM/PM */
5223 if (tm.tm_hour > 11)
5224 ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
5225 else
5226 ast_copy_string(nextmsg, "digits/a-m", sizeof(nextmsg));
5227 res = wait_file(chan, ints, nextmsg, lang);
5228 break;
5229 case 'Q':
5230 /* Shorthand for "Today", "Yesterday", or AdBY */
5231 /* XXX As emphasized elsewhere, this should the native way in your
5232 * language to say the date, with changes in what you say, depending
5233 * upon how recent the date is. XXX */
5234 {
5235 struct timeval now = ast_tvnow();
5236 struct ast_tm tmnow;
5237 time_t beg_today;
5238
5239 ast_localtime(&now, &tmnow, tzone);
5240 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
5241 /* In any case, it saves not having to do ast_mktime() */
5242 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
5243 if (beg_today < t) {
5244 /* Today */
5245 res = wait_file(chan, ints, "digits/today", lang);
5246 } else if (beg_today - 86400 < t) {
5247 /* Yesterday */
5248 res = wait_file(chan, ints, "digits/yesterday", lang);
5249 } else {
5250 res = ast_say_date_with_format_da(chan, t, ints, lang, "AdBY", tzone);
5251 }
5252 }
5253 break;
5254 case 'q':
5255 /* Shorthand for "" (today), "Yesterday", A (weekday), or AdBY */
5256 /* XXX As emphasized elsewhere, this should the native way in your
5257 * language to say the date, with changes in what you say, depending
5258 * upon how recent the date is. XXX */
5259 {
5260 struct timeval now = ast_tvnow();
5261 struct ast_tm tmnow;
5262 time_t beg_today;
5263
5264 ast_localtime(&now, &tmnow, tzone);
5265 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
5266 /* In any case, it saves not having to do ast_mktime() */
5267 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
5268 if (beg_today < t) {
5269 /* Today */
5270 } else if ((beg_today - 86400) < t) {
5271 /* Yesterday */
5272 res = wait_file(chan, ints, "digits/yesterday", lang);
5273 } else if (beg_today - 86400 * 6 < t) {
5274 /* Within the last week */
5275 res = ast_say_date_with_format_da(chan, t, ints, lang, "A", tzone);
5276 } else {
5277 res = ast_say_date_with_format_da(chan, t, ints, lang, "AdBY", tzone);
5278 }
5279 }
5280 break;
5281 case 'R':
5282 res = ast_say_date_with_format_da(chan, t, ints, lang, "HM", tzone);
5283 break;
5284 case 'S':
5285 /* Seconds */
5286 res = wait_file(chan, ints, "digits/and", lang);
5287 if (!res) {
5288 res = ast_say_number(chan, tm.tm_sec, ints, lang, "f");
5289 if (!res) {
5290 res = wait_file(chan, ints, "seconds", lang);
5291 }
5292 }
5293 break;
5294 case 'T':
5295 res = ast_say_date_with_format_da(chan, t, ints, lang, "HMS", tzone);
5296 break;
5297 case ' ':
5298 case ' ':
5299 /* Just ignore spaces and tabs */
5300 break;
5301 default:
5302 /* Unknown character */
5303 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5304 }
5305 /* Jump out on DTMF */
5306 if (res) {
5307 break;
5308 }
5309 }
5310 return res;
5311}
static int ast_say_date_with_format_da(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Danish syntax.
Definition say.c:5112
static char next_item(const char *format)
Definition say.c:5105
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition time.h:159

References ast_copy_string(), ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_da(), ast_say_enumeration(), ast_say_number(), ast_tvnow(), LOG_WARNING, next_item(), NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by ast_say_date_with_format_da(), and say_date_with_format().

◆ ast_say_date_with_format_de()

int ast_say_date_with_format_de ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

German syntax.

Definition at line 5314 of file say.c.

5315{
5316 struct timeval when = { t, 0 };
5317 struct ast_tm tm;
5318 int res=0, offset, sndoffset;
5319 char sndfile[256], nextmsg[256];
5320
5321 if (!format)
5322 format = "A dBY HMS";
5323
5324 ast_localtime(&when, &tm, tzone);
5325
5326 for (offset=0 ; format[offset] != '\0' ; offset++) {
5327 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5328 switch (format[offset]) {
5329 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
5330 case '\'':
5331 /* Literal name of a sound file */
5332 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
5333 sndfile[sndoffset] = format[offset];
5334 }
5335 sndfile[sndoffset] = '\0';
5336 res = wait_file(chan, ints, sndfile, lang);
5337 break;
5338 case 'A':
5339 case 'a':
5340 /* Sunday - Saturday */
5341 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
5342 res = wait_file(chan, ints, nextmsg, lang);
5343 break;
5344 case 'B':
5345 case 'b':
5346 case 'h':
5347 /* January - December */
5348 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
5349 res = wait_file(chan, ints, nextmsg, lang);
5350 break;
5351 case 'm':
5352 /* Month enumerated */
5353 res = ast_say_enumeration(chan, (tm.tm_mon + 1), ints, lang, "m");
5354 break;
5355 case 'd':
5356 case 'e':
5357 /* First - Thirtyfirst */
5358 res = ast_say_enumeration(chan, tm.tm_mday, ints, lang, "m");
5359 break;
5360 case 'Y':
5361 /* Year */
5362 {
5363 int year = tm.tm_year + 1900;
5364 if (year > 1999) { /* year 2000 and later */
5365 res = ast_say_number(chan, year, ints, lang, (char *) NULL);
5366 } else {
5367 if (year < 1100) {
5368 /* I'm not going to handle 1100 and prior */
5369 /* We'll just be silent on the year, instead of bombing out. */
5370 } else {
5371 /* year 1100 to 1999. will anybody need this?!? */
5372 /* say 1967 as 'neunzehn hundert sieben und sechzig' */
5373 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", (year / 100) );
5374 res = wait_file(chan, ints, nextmsg, lang);
5375 if (!res) {
5376 res = wait_file(chan, ints, "digits/hundred", lang);
5377 if (!res && year % 100 != 0) {
5378 res = ast_say_number(chan, (year % 100), ints, lang, (char *) NULL);
5379 }
5380 }
5381 }
5382 }
5383 }
5384 break;
5385 case 'I':
5386 case 'l':
5387 /* 12-Hour */
5388 if (tm.tm_hour == 0)
5389 ast_copy_string(nextmsg, "digits/12", sizeof(nextmsg));
5390 else if (tm.tm_hour == 1)
5391 ast_copy_string(nextmsg, "digits/1N", sizeof(nextmsg));
5392 else if (tm.tm_hour > 12)
5393 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
5394 else
5395 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
5396 res = wait_file(chan, ints, nextmsg, lang);
5397 if (!res) {
5398 res = wait_file(chan, ints, "digits/oclock", lang);
5399 }
5400 break;
5401 case 'H':
5402 case 'k':
5403 /* 24-Hour */
5404 if (tm.tm_hour == 1) {
5405 res = wait_file(chan, ints, "digits/1N", lang);
5406 } else {
5407 res = ast_say_number(chan, tm.tm_hour, ints, lang, (char *) NULL);
5408 }
5409 if (!res) {
5410 res = wait_file(chan, ints, "digits/oclock", lang);
5411 }
5412 break;
5413 case 'M':
5414 /* Minute */
5415 if (next_item(&format[offset + 1]) == 'S') { /* zero 'digits/0' only if seconds follow */
5416 res = ast_say_number(chan, tm.tm_min, ints, lang, "f"); /* female only if we say minutes */
5417 } else if (tm.tm_min > 0) {
5418 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
5419 }
5420
5421 if (!res && next_item(&format[offset + 1]) == 'S') { /* minutes only if seconds follow */
5422 if (tm.tm_min == 1) {
5423 res = wait_file(chan, ints, "minute", lang);
5424 } else {
5425 res = wait_file(chan, ints, "minutes", lang);
5426 }
5427 }
5428 break;
5429 case 'P':
5430 case 'p':
5431 /* AM/PM */
5432 if (tm.tm_hour > 11)
5433 ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
5434 else
5435 ast_copy_string(nextmsg, "digits/a-m", sizeof(nextmsg));
5436 res = wait_file(chan, ints, nextmsg, lang);
5437 break;
5438 case 'Q':
5439 /* Shorthand for "Today", "Yesterday", or AdBY */
5440 /* XXX As emphasized elsewhere, this should the native way in your
5441 * language to say the date, with changes in what you say, depending
5442 * upon how recent the date is. XXX */
5443 {
5444 struct timeval now = ast_tvnow();
5445 struct ast_tm tmnow;
5446 time_t beg_today;
5447
5448 ast_localtime(&now, &tmnow, tzone);
5449 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
5450 /* In any case, it saves not having to do ast_mktime() */
5451 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
5452 if (beg_today < t) {
5453 /* Today */
5454 res = wait_file(chan, ints, "digits/today", lang);
5455 } else if (beg_today - 86400 < t) {
5456 /* Yesterday */
5457 res = wait_file(chan, ints, "digits/yesterday", lang);
5458 } else {
5459 res = ast_say_date_with_format_de(chan, t, ints, lang, "AdBY", tzone);
5460 }
5461 }
5462 break;
5463 case 'q':
5464 /* Shorthand for "" (today), "Yesterday", A (weekday), or AdBY */
5465 /* XXX As emphasized elsewhere, this should the native way in your
5466 * language to say the date, with changes in what you say, depending
5467 * upon how recent the date is. XXX */
5468 {
5469 struct timeval now = ast_tvnow();
5470 struct ast_tm tmnow;
5471 time_t beg_today;
5472
5473 ast_localtime(&now, &tmnow, tzone);
5474 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
5475 /* In any case, it saves not having to do ast_mktime() */
5476 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
5477 if (beg_today < t) {
5478 /* Today */
5479 } else if ((beg_today - 86400) < t) {
5480 /* Yesterday */
5481 res = wait_file(chan, ints, "digits/yesterday", lang);
5482 } else if (beg_today - 86400 * 6 < t) {
5483 /* Within the last week */
5484 res = ast_say_date_with_format_de(chan, t, ints, lang, "A", tzone);
5485 } else {
5486 res = ast_say_date_with_format_de(chan, t, ints, lang, "AdBY", tzone);
5487 }
5488 }
5489 break;
5490 case 'R':
5491 res = ast_say_date_with_format_de(chan, t, ints, lang, "HM", tzone);
5492 break;
5493 case 'S':
5494 /* Seconds */
5495 res = wait_file(chan, ints, "digits/and", lang);
5496 if (!res) {
5497 res = ast_say_number(chan, tm.tm_sec, ints, lang, "f");
5498 if (!res) {
5499 res = wait_file(chan, ints, tm.tm_sec == 1 ? "second" : "seconds", lang);
5500 }
5501 }
5502 break;
5503 case 'T':
5504 res = ast_say_date_with_format_de(chan, t, ints, lang, "HMS", tzone);
5505 break;
5506 case ' ':
5507 case ' ':
5508 /* Just ignore spaces and tabs */
5509 break;
5510 default:
5511 /* Unknown character */
5512 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5513 }
5514 /* Jump out on DTMF */
5515 if (res) {
5516 break;
5517 }
5518 }
5519 return res;
5520}
static int ast_say_date_with_format_de(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
German syntax.
Definition say.c:5314

References ast_copy_string(), ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_de(), ast_say_enumeration(), ast_say_number(), ast_tvnow(), LOG_WARNING, next_item(), NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by ast_say_date_with_format_de(), and say_date_with_format().

◆ ast_say_date_with_format_en()

int ast_say_date_with_format_en ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

English syntax.

Definition at line 4834 of file say.c.

4835{
4836 struct timeval when = { t, 0 };
4837 struct ast_tm tm;
4838 int res=0, offset, sndoffset;
4839 char sndfile[256], nextmsg[256];
4840
4841 if (format == NULL)
4842 format = "ABdY 'digits/at' IMp";
4843
4844 ast_localtime(&when, &tm, tzone);
4845
4846 for (offset=0 ; format[offset] != '\0' ; offset++) {
4847 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
4848 switch (format[offset]) {
4849 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
4850 case '\'':
4851 /* Literal name of a sound file */
4852 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
4853 sndfile[sndoffset] = format[offset];
4854 }
4855 sndfile[sndoffset] = '\0';
4856 res = wait_file(chan, ints, sndfile, lang);
4857 break;
4858 case 'A':
4859 case 'a':
4860 /* Sunday - Saturday */
4861 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
4862 res = wait_file(chan, ints, nextmsg, lang);
4863 break;
4864 case 'B':
4865 case 'b':
4866 case 'h':
4867 /* January - December */
4868 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
4869 res = wait_file(chan, ints, nextmsg, lang);
4870 break;
4871 case 'm':
4872 /* Month enumerated */
4873 res = ast_say_enumeration(chan, (tm.tm_mon + 1), ints, lang, (char *) NULL);
4874 break;
4875 case 'd':
4876 case 'e':
4877 /* First - Thirtyfirst */
4878 res = ast_say_enumeration(chan, tm.tm_mday, ints, lang, (char *) NULL);
4879 break;
4880 case 'Y':
4881 /* Year */
4882 if (tm.tm_year > 99) {
4883 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
4884 } else if (tm.tm_year < 1) {
4885 /* I'm not going to handle 1900 and prior */
4886 /* We'll just be silent on the year, instead of bombing out. */
4887 } else {
4888 res = wait_file(chan, ints, "digits/19", lang);
4889 if (!res) {
4890 if (tm.tm_year <= 9) {
4891 /* 1901 - 1909 */
4892 res = wait_file(chan, ints, "digits/oh", lang);
4893 }
4894
4895 res |= ast_say_number(chan, tm.tm_year, ints, lang, (char *) NULL);
4896 }
4897 }
4898 break;
4899 case 'I':
4900 case 'l':
4901 /* 12-Hour */
4902 if (tm.tm_hour == 0)
4903 ast_copy_string(nextmsg, "digits/12", sizeof(nextmsg));
4904 else if (tm.tm_hour > 12)
4905 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
4906 else
4907 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
4908 res = wait_file(chan, ints, nextmsg, lang);
4909 break;
4910 case 'H':
4911 case 'k':
4912 /* 24-Hour */
4913 if (format[offset] == 'H') {
4914 /* e.g. oh-eight */
4915 if (tm.tm_hour < 10) {
4916 res = wait_file(chan, ints, "digits/oh", lang);
4917 }
4918 } else {
4919 /* e.g. eight */
4920 if (tm.tm_hour == 0) {
4921 res = wait_file(chan, ints, "digits/oh", lang);
4922 }
4923 }
4924 if (!res) {
4925 if (tm.tm_hour != 0) {
4926 int remaining = tm.tm_hour;
4927 if (tm.tm_hour > 20) {
4928 res = wait_file(chan, ints, "digits/20", lang);
4929 remaining -= 20;
4930 }
4931 if (!res) {
4932 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", remaining);
4933 res = wait_file(chan, ints, nextmsg, lang);
4934 }
4935 }
4936 }
4937 break;
4938 case 'M':
4939 case 'N':
4940 /* Minute */
4941 if (tm.tm_min == 0) {
4942 if (format[offset] == 'M') {
4943 res = wait_file(chan, ints, "digits/oclock", lang);
4944 } else {
4945 res = wait_file(chan, ints, "digits/hundred", lang);
4946 }
4947 } else if (tm.tm_min < 10) {
4948 res = wait_file(chan, ints, "digits/oh", lang);
4949 if (!res) {
4950 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_min);
4951 res = wait_file(chan, ints, nextmsg, lang);
4952 }
4953 } else {
4954 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
4955 }
4956 break;
4957 case 'P':
4958 case 'p':
4959 /* AM/PM */
4960 if (tm.tm_hour > 11)
4961 ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
4962 else
4963 ast_copy_string(nextmsg, "digits/a-m", sizeof(nextmsg));
4964 res = wait_file(chan, ints, nextmsg, lang);
4965 break;
4966 case 'Q':
4967 /* Shorthand for "Today", "Yesterday", or ABdY */
4968 /* XXX As emphasized elsewhere, this should the native way in your
4969 * language to say the date, with changes in what you say, depending
4970 * upon how recent the date is. XXX */
4971 {
4972 struct timeval now = ast_tvnow();
4973 struct ast_tm tmnow;
4974 time_t beg_today;
4975
4976 gettimeofday(&now, NULL);
4977 ast_localtime(&now, &tmnow, tzone);
4978 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
4979 /* In any case, it saves not having to do ast_mktime() */
4980 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
4981 if (beg_today + 15768000 < t) {
4982 /* More than 6 months from now - "April nineteenth two thousand three" */
4983 res = ast_say_date_with_format_en(chan, t, ints, lang, "BdY", tzone);
4984 } else if (beg_today + 2628000 < t) {
4985 /* Less than 6 months from now - "August seventh" */
4986 res = ast_say_date_with_format_en(chan, t, ints, lang, "Bd", tzone);
4987 } else if (beg_today + 86400 * 6 < t) {
4988 /* Less than a month from now - "Sunday, October third" */
4989 res = ast_say_date_with_format_en(chan, t, ints, lang, "ABd", tzone);
4990 } else if (beg_today + 172800 < t) {
4991 /* Within the next week */
4992 res = ast_say_date_with_format_en(chan, t, ints, lang, "A", tzone);
4993 } else if (beg_today + 86400 < t) {
4994 /* Tomorrow */
4995 res = wait_file(chan, ints, "digits/tomorrow", lang);
4996 } else if (beg_today < t) {
4997 /* Today */
4998 res = wait_file(chan, ints, "digits/today", lang);
4999 } else if (beg_today - 86400 < t) {
5000 /* Yesterday */
5001 res = wait_file(chan, ints, "digits/yesterday", lang);
5002 } else if (beg_today - 86400 * 6 < t) {
5003 /* Within the last week */
5004 res = ast_say_date_with_format_en(chan, t, ints, lang, "A", tzone);
5005 } else if (beg_today - 2628000 < t) {
5006 /* Less than a month ago - "Sunday, October third" */
5007 res = ast_say_date_with_format_en(chan, t, ints, lang, "ABd", tzone);
5008 } else if (beg_today - 15768000 < t) {
5009 /* Less than 6 months ago - "August seventh" */
5010 res = ast_say_date_with_format_en(chan, t, ints, lang, "Bd", tzone);
5011 } else {
5012 /* More than 6 months ago - "April nineteenth two thousand three" */
5013 res = ast_say_date_with_format_en(chan, t, ints, lang, "BdY", tzone);
5014 }
5015 }
5016 break;
5017 case 'q':
5018 /* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
5019 /* XXX As emphasized elsewhere, this should the native way in your
5020 * language to say the date, with changes in what you say, depending
5021 * upon how recent the date is. XXX */
5022 {
5023 struct timeval now;
5024 struct ast_tm tmnow;
5025 time_t beg_today;
5026
5027 now = ast_tvnow();
5028 ast_localtime(&now, &tmnow, tzone);
5029 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
5030 /* In any case, it saves not having to do ast_mktime() */
5031 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
5032 if (beg_today + 15768000 < t) {
5033 /* More than 6 months from now - "April nineteenth two thousand three" */
5034 res = ast_say_date_with_format_en(chan, t, ints, lang, "BdY", tzone);
5035 } else if (beg_today + 2628000 < t) {
5036 /* Less than 6 months from now - "August seventh" */
5037 res = ast_say_date_with_format_en(chan, t, ints, lang, "Bd", tzone);
5038 } else if (beg_today + 86400 * 6 < t) {
5039 /* Less than a month from now - "Sunday, October third" */
5040 res = ast_say_date_with_format_en(chan, t, ints, lang, "ABd", tzone);
5041 } else if (beg_today + 172800 < t) {
5042 /* Within the next week */
5043 res = ast_say_date_with_format_en(chan, t, ints, lang, "A", tzone);
5044 } else if (beg_today + 86400 < t) {
5045 /* Tomorrow */
5046 res = wait_file(chan, ints, "digits/tomorrow", lang);
5047 } else if (beg_today < t) {
5048 /* Today */
5049 res = wait_file(chan, ints, "digits/today", lang);
5050 } else if (beg_today - 86400 < t) {
5051 /* Yesterday */
5052 res = wait_file(chan, ints, "digits/yesterday", lang);
5053 } else if (beg_today - 86400 * 6 < t) {
5054 /* Within the last week */
5055 res = ast_say_date_with_format_en(chan, t, ints, lang, "A", tzone);
5056 } else if (beg_today - 2628000 < t) {
5057 /* Less than a month ago - "Sunday, October third" */
5058 res = ast_say_date_with_format_en(chan, t, ints, lang, "ABd", tzone);
5059 } else if (beg_today - 15768000 < t) {
5060 /* Less than 6 months ago - "August seventh" */
5061 res = ast_say_date_with_format_en(chan, t, ints, lang, "Bd", tzone);
5062 } else {
5063 /* More than 6 months ago - "April nineteenth two thousand three" */
5064 res = ast_say_date_with_format_en(chan, t, ints, lang, "BdY", tzone);
5065 }
5066 }
5067 break;
5068 case 'R':
5069 res = ast_say_date_with_format_en(chan, t, ints, lang, "HM", tzone);
5070 break;
5071 case 'S':
5072 /* Seconds */
5073 if (tm.tm_sec == 0) {
5074 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec);
5075 res = wait_file(chan, ints, nextmsg, lang);
5076 } else if (tm.tm_sec < 10) {
5077 res = wait_file(chan, ints, "digits/oh", lang);
5078 if (!res) {
5079 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec);
5080 res = wait_file(chan, ints, nextmsg, lang);
5081 }
5082 } else {
5083 res = ast_say_number(chan, tm.tm_sec, ints, lang, (char *) NULL);
5084 }
5085 break;
5086 case 'T':
5087 res = ast_say_date_with_format_en(chan, t, ints, lang, "HMS", tzone);
5088 break;
5089 case ' ':
5090 case ' ':
5091 /* Just ignore spaces and tabs */
5092 break;
5093 default:
5094 /* Unknown character */
5095 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5096 }
5097 /* Jump out on DTMF */
5098 if (res) {
5099 break;
5100 }
5101 }
5102 return res;
5103}
static int ast_say_date_with_format_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
English syntax.
Definition say.c:4834

References ast_copy_string(), ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_en(), ast_say_enumeration(), ast_say_number(), ast_tvnow(), LOG_WARNING, NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by ast_say_date_with_format_en(), ast_say_date_with_format_th(), ast_say_date_with_format_vi(), and say_date_with_format().

◆ ast_say_date_with_format_es()

int ast_say_date_with_format_es ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

Spanish syntax.

Definition at line 6067 of file say.c.

6068{
6069 struct timeval when = { t, 0 };
6070 struct ast_tm tm;
6071 int res=0, offset, sndoffset;
6072 char sndfile[256], nextmsg[256];
6073
6074 if (format == NULL)
6075 format = "'digits/es-el' Ad 'digits/es-de' B 'digits/es-de' Y 'digits/at' IMp";
6076
6077 ast_localtime(&when, &tm, tzone);
6078
6079 for (offset=0 ; format[offset] != '\0' ; offset++) {
6080 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6081 switch (format[offset]) {
6082 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
6083 case '\'':
6084 /* Literal name of a sound file */
6085 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
6086 sndfile[sndoffset] = format[offset];
6087 }
6088 sndfile[sndoffset] = '\0';
6089 snprintf(nextmsg, sizeof(nextmsg), "%s", sndfile);
6090 res = wait_file(chan, ints, nextmsg, lang);
6091 break;
6092 case 'A':
6093 case 'a':
6094 /* Sunday - Saturday */
6095 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
6096 res = wait_file(chan, ints, nextmsg, lang);
6097 break;
6098 case 'B':
6099 case 'b':
6100 case 'h':
6101 /* January - December */
6102 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
6103 res = wait_file(chan, ints, nextmsg, lang);
6104 break;
6105 case 'm':
6106 /* First - Twelfth */
6107 snprintf(nextmsg, sizeof(nextmsg), "digits/h-%d", tm.tm_mon +1);
6108 res = wait_file(chan, ints, nextmsg, lang);
6109 break;
6110 case 'd':
6111 case 'e':
6112 /* First - Thirtyfirst */
6113 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
6114 break;
6115 case 'Y':
6116 /* Year */
6117 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
6118 break;
6119 case 'I':
6120 case 'l':
6121 /* 12-Hour */
6122 if (tm.tm_hour == 0)
6123 ast_copy_string(nextmsg, "digits/12", sizeof(nextmsg));
6124 else if (tm.tm_hour == 1 || tm.tm_hour == 13)
6125 snprintf(nextmsg,sizeof(nextmsg), "digits/1F");
6126 else if (tm.tm_hour > 12)
6127 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
6128 else
6129 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
6130 res = wait_file(chan, ints, nextmsg, lang);
6131 break;
6132 case 'H':
6133 case 'k':
6134 /* 24-Hour */
6135 res = ast_say_number(chan, tm.tm_hour, ints, lang, NULL);
6136 break;
6137 case 'M':
6138 /* Minute */
6139 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
6140 break;
6141 case 'P':
6142 case 'p':
6143 /* AM/PM */
6144 if (tm.tm_hour > 18)
6145 res = wait_file(chan, ints, "digits/p-m", lang);
6146 else if (tm.tm_hour > 12)
6147 res = wait_file(chan, ints, "digits/afternoon", lang);
6148 else if (tm.tm_hour)
6149 res = wait_file(chan, ints, "digits/a-m", lang);
6150 break;
6151 case 'Q':
6152 /* Shorthand for "Today", "Yesterday", or ABdY */
6153 /* XXX As emphasized elsewhere, this should the native way in your
6154 * language to say the date, with changes in what you say, depending
6155 * upon how recent the date is. XXX */
6156 {
6157 struct timeval now = ast_tvnow();
6158 struct ast_tm tmnow;
6159 time_t beg_today;
6160
6161 ast_localtime(&now, &tmnow, tzone);
6162 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
6163 /* In any case, it saves not having to do ast_mktime() */
6164 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
6165 if (beg_today < t) {
6166 /* Today */
6167 res = wait_file(chan, ints, "digits/today", lang);
6168 } else if (beg_today - 86400 < t) {
6169 /* Yesterday */
6170 res = wait_file(chan, ints, "digits/yesterday", lang);
6171 } else {
6172 res = ast_say_date_with_format_es(chan, t, ints, lang, "'digits/es-el' Ad 'digits/es-de' B 'digits/es-de' Y", tzone);
6173 }
6174 }
6175 break;
6176 case 'q':
6177 /* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
6178 /* XXX As emphasized elsewhere, this should the native way in your
6179 * language to say the date, with changes in what you say, depending
6180 * upon how recent the date is. XXX */
6181 {
6182 struct timeval now = ast_tvnow();
6183 struct ast_tm tmnow;
6184 time_t beg_today;
6185
6186 ast_localtime(&now, &tmnow, tzone);
6187 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
6188 /* In any case, it saves not having to do ast_mktime() */
6189 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
6190 if (beg_today < t) {
6191 /* Today */
6192 res = wait_file(chan, ints, "digits/today", lang);
6193 } else if ((beg_today - 86400) < t) {
6194 /* Yesterday */
6195 res = wait_file(chan, ints, "digits/yesterday", lang);
6196 } else if (beg_today - 86400 * 6 < t) {
6197 /* Within the last week */
6198 res = ast_say_date_with_format_es(chan, t, ints, lang, "A", tzone);
6199 } else {
6200 res = ast_say_date_with_format_es(chan, t, ints, lang, "'digits/es-el' Ad 'digits/es-de' B 'digits/es-de' Y", tzone);
6201 }
6202 }
6203 break;
6204 case 'R':
6205 res = ast_say_date_with_format_es(chan, t, ints, lang, "H 'digits/y' M", tzone);
6206 break;
6207 case 'S':
6208 /* Seconds */
6209 if (tm.tm_sec == 0) {
6210 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec);
6211 res = wait_file(chan, ints, nextmsg, lang);
6212 } else if (tm.tm_sec < 10) {
6213 res = wait_file(chan, ints, "digits/oh", lang);
6214 if (!res) {
6215 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec);
6216 res = wait_file(chan, ints, nextmsg, lang);
6217 }
6218 } else if ((tm.tm_sec < 21) || (tm.tm_sec % 10 == 0)) {
6219 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec);
6220 res = wait_file(chan, ints, nextmsg, lang);
6221 } else {
6222 int ten, one;
6223 ten = (tm.tm_sec / 10) * 10;
6224 one = (tm.tm_sec % 10);
6225 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", ten);
6226 res = wait_file(chan, ints, nextmsg, lang);
6227 if (!res) {
6228 /* Fifty, not fifty-zero */
6229 if (one != 0) {
6230 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", one);
6231 res = wait_file(chan, ints, nextmsg, lang);
6232 }
6233 }
6234 }
6235 break;
6236 case 'T':
6237 res = ast_say_date_with_format_es(chan, t, ints, lang, "HMS", tzone);
6238 break;
6239 case ' ':
6240 case ' ':
6241 /* Just ignore spaces and tabs */
6242 break;
6243 default:
6244 /* Unknown character */
6245 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6246 }
6247 /* Jump out on DTMF */
6248 if (res) {
6249 break;
6250 }
6251 }
6252 return res;
6253}
static int ast_say_date_with_format_es(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Spanish syntax.
Definition say.c:6067

References ast_copy_string(), ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_es(), ast_say_number(), ast_tvnow(), LOG_WARNING, NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by ast_say_date_with_format_es(), and say_date_with_format().

◆ ast_say_date_with_format_fr()

int ast_say_date_with_format_fr ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

French syntax oclock = heure.

Definition at line 6258 of file say.c.

6259{
6260 struct timeval when = { t, 0 };
6261 struct ast_tm tm;
6262 int res=0, offset, sndoffset;
6263 char sndfile[256], nextmsg[256];
6264
6265 if (format == NULL)
6266 format = "AdBY 'digits/at' IMp";
6267
6268 ast_localtime(&when, &tm, tzone);
6269
6270 for (offset=0 ; format[offset] != '\0' ; offset++) {
6271 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6272 switch (format[offset]) {
6273 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
6274 case '\'':
6275 /* Literal name of a sound file */
6276 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
6277 sndfile[sndoffset] = format[offset];
6278 }
6279 sndfile[sndoffset] = '\0';
6280 res = wait_file(chan, ints, sndfile, lang);
6281 break;
6282 case 'A':
6283 case 'a':
6284 /* Sunday - Saturday */
6285 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
6286 res = wait_file(chan, ints, nextmsg, lang);
6287 break;
6288 case 'B':
6289 case 'b':
6290 case 'h':
6291 /* January - December */
6292 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
6293 res = wait_file(chan, ints, nextmsg, lang);
6294 break;
6295 case 'm':
6296 /* First - Twelfth */
6297 snprintf(nextmsg, sizeof(nextmsg), "digits/h-%d", tm.tm_mon +1);
6298 res = wait_file(chan, ints, nextmsg, lang);
6299 break;
6300 case 'd':
6301 case 'e':
6302 /* First */
6303 if (tm.tm_mday == 1) {
6304 snprintf(nextmsg, sizeof(nextmsg), "digits/h-%d", tm.tm_mday);
6305 res = wait_file(chan, ints, nextmsg, lang);
6306 } else {
6307 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char * ) NULL);
6308 }
6309 break;
6310 case 'Y':
6311 /* Year */
6312 if (tm.tm_year > 99) {
6313 res = wait_file(chan, ints, "digits/2", lang);
6314 if (!res) {
6315 res = wait_file(chan, ints, "digits/thousand", lang);
6316 }
6317 if (tm.tm_year > 100) {
6318 if (!res) {
6319 res = ast_say_number(chan, tm.tm_year - 100, ints, lang, (char * ) NULL);
6320 }
6321 }
6322 } else {
6323 if (tm.tm_year < 1) {
6324 /* I'm not going to handle 1900 and prior */
6325 /* We'll just be silent on the year, instead of bombing out. */
6326 } else {
6327 res = wait_file(chan, ints, "digits/thousand", lang);
6328 if (!res) {
6329 wait_file(chan, ints, "digits/9", lang);
6330 wait_file(chan, ints, "digits/hundred", lang);
6331 res = ast_say_number(chan, tm.tm_year, ints, lang, (char * ) NULL);
6332 }
6333 }
6334 }
6335 break;
6336 case 'I':
6337 case 'l':
6338 /* 12-Hour */
6339 if (tm.tm_hour == 0)
6340 ast_copy_string(nextmsg, "digits/12", sizeof(nextmsg));
6341 else if (tm.tm_hour > 12)
6342 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
6343 else
6344 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
6345 res = wait_file(chan, ints, nextmsg, lang);
6346 if (!res)
6347 res = wait_file(chan, ints, "digits/oclock", lang);
6348 break;
6349 case 'H':
6350 case 'k':
6351 /* 24-Hour */
6352 res = ast_say_number(chan, tm.tm_hour, ints, lang, (char * ) NULL);
6353 if (!res)
6354 res = wait_file(chan, ints, "digits/oclock", lang);
6355 break;
6356 case 'M':
6357 /* Minute */
6358 if (tm.tm_min == 0) {
6359 break;
6360 }
6361 res = ast_say_number(chan, tm.tm_min, ints, lang, (char * ) NULL);
6362 break;
6363 case 'P':
6364 case 'p':
6365 /* AM/PM */
6366 if (tm.tm_hour > 11)
6367 ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
6368 else
6369 ast_copy_string(nextmsg, "digits/a-m", sizeof(nextmsg));
6370 res = wait_file(chan, ints, nextmsg, lang);
6371 break;
6372 case 'Q':
6373 /* Shorthand for "Today", "Yesterday", or AdBY */
6374 /* XXX As emphasized elsewhere, this should the native way in your
6375 * language to say the date, with changes in what you say, depending
6376 * upon how recent the date is. XXX */
6377 {
6378 struct timeval now = ast_tvnow();
6379 struct ast_tm tmnow;
6380 time_t beg_today;
6381
6382 ast_localtime(&now, &tmnow, tzone);
6383 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
6384 /* In any case, it saves not having to do ast_mktime() */
6385 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
6386 if (beg_today < t) {
6387 /* Today */
6388 res = wait_file(chan, ints, "digits/today", lang);
6389 } else if (beg_today - 86400 < t) {
6390 /* Yesterday */
6391 res = wait_file(chan, ints, "digits/yesterday", lang);
6392 } else {
6393 res = ast_say_date_with_format_fr(chan, t, ints, lang, "AdBY", tzone);
6394 }
6395 }
6396 break;
6397 case 'q':
6398 /* Shorthand for "" (today), "Yesterday", A (weekday), or AdBY */
6399 /* XXX As emphasized elsewhere, this should the native way in your
6400 * language to say the date, with changes in what you say, depending
6401 * upon how recent the date is. XXX */
6402 {
6403 struct timeval now = ast_tvnow();
6404 struct ast_tm tmnow;
6405 time_t beg_today;
6406
6407 ast_localtime(&now, &tmnow, tzone);
6408 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
6409 /* In any case, it saves not having to do ast_mktime() */
6410 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
6411 if (beg_today < t) {
6412 /* Today */
6413 } else if ((beg_today - 86400) < t) {
6414 /* Yesterday */
6415 res = wait_file(chan, ints, "digits/yesterday", lang);
6416 } else if (beg_today - 86400 * 6 < t) {
6417 /* Within the last week */
6418 res = ast_say_date_with_format_fr(chan, t, ints, lang, "A", tzone);
6419 } else {
6420 res = ast_say_date_with_format_fr(chan, t, ints, lang, "AdBY", tzone);
6421 }
6422 }
6423 break;
6424 case 'R':
6425 res = ast_say_date_with_format_fr(chan, t, ints, lang, "HM", tzone);
6426 break;
6427 case 'S':
6428 /* Seconds */
6429 res = ast_say_number(chan, tm.tm_sec, ints, lang, (char * ) NULL);
6430 if (!res) {
6431 res = wait_file(chan, ints, "second", lang);
6432 }
6433 break;
6434 case 'T':
6435 res = ast_say_date_with_format_fr(chan, t, ints, lang, "HMS", tzone);
6436 break;
6437 case ' ':
6438 case ' ':
6439 /* Just ignore spaces and tabs */
6440 break;
6441 default:
6442 /* Unknown character */
6443 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6444 }
6445 /* Jump out on DTMF */
6446 if (res) {
6447 break;
6448 }
6449 }
6450 return res;
6451}
static int ast_say_date_with_format_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
French syntax oclock = heure.
Definition say.c:6258

References ast_copy_string(), ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_fr(), ast_say_number(), ast_tvnow(), LOG_WARNING, NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by ast_say_date_with_format_fr(), and say_date_with_format().

◆ ast_say_date_with_format_gr()

static int ast_say_date_with_format_gr ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

Greek support.

Definition at line 9089 of file say.c.

9090{
9091 struct timeval when = { t, 0 };
9092 struct ast_tm tm;
9093 int res=0, offset, sndoffset;
9094 char sndfile[256], nextmsg[256];
9095
9096 if (!format)
9097 format = "AdBY 'digits/at' IMp";
9098
9099 ast_localtime(&when, &tm, tzone);
9100
9101 for (offset=0 ; format[offset] != '\0' ; offset++) {
9102 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
9103 switch (format[offset]) {
9104 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
9105 case '\'':
9106 /* Literal name of a sound file */
9107 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
9108 sndfile[sndoffset] = format[offset];
9109 }
9110 sndfile[sndoffset] = '\0';
9111 res = wait_file(chan, ints, sndfile, lang);
9112 break;
9113 case 'A':
9114 case 'a':
9115 /* Sunday - Saturday */
9116 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
9117 res = wait_file(chan, ints, nextmsg, lang);
9118 break;
9119 case 'B':
9120 case 'b':
9121 case 'h':
9122 /* January - December */
9123 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
9124 res = wait_file(chan, ints, nextmsg, lang);
9125 break;
9126 case 'd':
9127 case 'e':
9128 /* first - thirtyfirst */
9129 gr_say_number_female(tm.tm_mday, chan, ints, lang);
9130 break;
9131 case 'Y':
9132 /* Year */
9133
9134 ast_say_number_full_gr(chan, 1900+tm.tm_year, ints, ast_channel_language(chan), -1, -1);
9135 break;
9136 case 'I':
9137 case 'l':
9138 /* 12-Hour */
9139 if (tm.tm_hour == 0)
9140 gr_say_number_female(12, chan, ints, lang);
9141 else if (tm.tm_hour > 12)
9142 gr_say_number_female(tm.tm_hour - 12, chan, ints, lang);
9143 else
9144 gr_say_number_female(tm.tm_hour, chan, ints, lang);
9145 break;
9146 case 'H':
9147 case 'k':
9148 /* 24-Hour */
9149 gr_say_number_female(tm.tm_hour, chan, ints, lang);
9150 break;
9151 case 'M':
9152 /* Minute */
9153 if (tm.tm_min) {
9154 if (!res)
9155 res = ast_streamfile(chan, "digits/kai", lang);
9156 if (!res)
9157 res = ast_waitstream(chan, ints);
9158 if (!res)
9159 res = ast_say_number_full_gr(chan, tm.tm_min, ints, lang, -1, -1);
9160 } else {
9161 if (!res)
9162 res = ast_streamfile(chan, "digits/oclock", lang);
9163 if (!res)
9164 res = ast_waitstream(chan, ints);
9165 }
9166 break;
9167 case 'P':
9168 case 'p':
9169 /* AM/PM */
9170 if (tm.tm_hour > 11)
9171 ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
9172 else
9173 ast_copy_string(nextmsg, "digits/a-m", sizeof(nextmsg));
9174 res = wait_file(chan, ints, nextmsg, lang);
9175 break;
9176 case 'Q':
9177 /* Shorthand for "Today", "Yesterday", or ABdY */
9178 /* XXX As emphasized elsewhere, this should the native way in your
9179 * language to say the date, with changes in what you say, depending
9180 * upon how recent the date is. XXX */
9181 {
9182 struct timeval now = ast_tvnow();
9183 struct ast_tm tmnow;
9184 time_t beg_today;
9185
9186 ast_localtime(&now, &tmnow, tzone);
9187 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
9188 /* In any case, it saves not having to do ast_mktime() */
9189 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
9190 if (beg_today < t) {
9191 /* Today */
9192 res = wait_file(chan, ints, "digits/today", lang);
9193 } else if (beg_today - 86400 < t) {
9194 /* Yesterday */
9195 res = wait_file(chan, ints, "digits/yesterday", lang);
9196 } else {
9197 res = ast_say_date_with_format_gr(chan, t, ints, lang, "AdBY", tzone);
9198 }
9199 }
9200 break;
9201 case 'q':
9202 /* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
9203 /* XXX As emphasized elsewhere, this should the native way in your
9204 * language to say the date, with changes in what you say, depending
9205 * upon how recent the date is. XXX */
9206 {
9207 struct timeval now = ast_tvnow();
9208 struct ast_tm tmnow;
9209 time_t beg_today;
9210
9211 ast_localtime(&now, &tmnow, tzone);
9212 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
9213 /* In any case, it saves not having to do ast_mktime() */
9214 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
9215 if (beg_today < t) {
9216 /* Today */
9217 } else if ((beg_today - 86400) < t) {
9218 /* Yesterday */
9219 res = wait_file(chan, ints, "digits/yesterday", lang);
9220 } else if (beg_today - 86400 * 6 < t) {
9221 /* Within the last week */
9222 res = ast_say_date_with_format_gr(chan, t, ints, lang, "A", tzone);
9223 } else {
9224 res = ast_say_date_with_format_gr(chan, t, ints, lang, "AdBY", tzone);
9225 }
9226 }
9227 break;
9228 case 'R':
9229 res = ast_say_date_with_format_gr(chan, t, ints, lang, "HM", tzone);
9230 break;
9231 case 'S':
9232 /* Seconds */
9233 ast_copy_string(nextmsg, "digits/kai", sizeof(nextmsg));
9234 res = wait_file(chan, ints, nextmsg, lang);
9235 if (!res)
9236 res = ast_say_number_full_gr(chan, tm.tm_sec, ints, lang, -1, -1);
9237 if (!res)
9238 ast_copy_string(nextmsg, "seconds", sizeof(nextmsg));
9239 res = wait_file(chan, ints, nextmsg, lang);
9240 break;
9241 case 'T':
9242 res = ast_say_date_with_format_gr(chan, t, ints, lang, "HMS", tzone);
9243 break;
9244 case ' ':
9245 case ' ':
9246 /* Just ignore spaces and tabs */
9247 break;
9248 default:
9249 /* Unknown character */
9250 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
9251 }
9252 /* Jump out on DTMF */
9253 if (res) {
9254 break;
9255 }
9256 }
9257 return res;
9258}
static int ast_say_date_with_format_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Greek support.
Definition say.c:9089
static int ast_say_number_full_gr(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
Greek support A list of the files that you need to create -> digits/xilia = "xilia" -> digits/myrio =...
Definition say.c:8670

References ast_channel_language(), ast_copy_string(), ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_gr(), ast_say_number_full_gr(), ast_streamfile(), ast_tvnow(), ast_waitstream(), gr_say_number_female(), LOG_WARNING, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by ast_say_date_with_format_gr(), and say_date_with_format().

◆ ast_say_date_with_format_he()

int ast_say_date_with_format_he ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

ast_say_date_with_format_he Say formatted date in Hebrew

ast_say_date_with_format_en for the details of the options

Changes from the English version:

  • don't replicate in here the logic of ast_say_number_full_he
  • year is always 4-digit (because it's simpler)
  • added c, x, and X. Mainly for my tests
  • The standard "long" format used in Hebrew is AdBY, rather than ABdY

    Todo:

Definition at line 5920 of file say.c.

5921{
5922#define IL_DATE_STR "AdBY"
5923#define IL_TIME_STR "HM" /* NOTE: In Hebrew we do not support 12 hours, only 24. No AM or PM exists in the Hebrew language */
5924#define IL_DATE_STR_FULL IL_DATE_STR " 'digits/at' " IL_TIME_STR
5925 /* TODO: This whole function is cut&paste from
5926 * ast_say_date_with_format_en . Is that considered acceptable?
5927 **/
5928 struct timeval when = { t, 0 };
5929 struct ast_tm tm;
5930 int res = 0, offset, sndoffset;
5931 char sndfile[256], nextmsg[256];
5932
5933 if (!format) {
5934 format = IL_DATE_STR_FULL;
5935 }
5936
5937 ast_localtime(&when, &tm, tzone);
5938
5939 for (offset = 0; format[offset] != '\0'; offset++) {
5940 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5941 switch (format[offset]) {
5942 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
5943 case '\'':
5944 /* Literal name of a sound file */
5945 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
5946 sndfile[sndoffset] = format[offset];
5947 }
5948 sndfile[sndoffset] = '\0';
5949 res = wait_file(chan, ints, sndfile, lang);
5950 break;
5951 case 'A':
5952 case 'a':
5953 /* Sunday - Saturday */
5954 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
5955 res = wait_file(chan, ints, nextmsg, lang);
5956 break;
5957 case 'B':
5958 case 'b':
5959 case 'h':
5960 /* January - December */
5961 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
5962 res = wait_file(chan, ints, nextmsg, lang);
5963 break;
5964 case 'd':
5965 case 'e': /* Day of the month */
5966 /* I'm not sure exactly what the parameters
5967 * audiofd and ctrlfd to
5968 * ast_say_number_full_he mean, but it seems
5969 * safe to pass -1 there.
5970 *
5971 * At least in one of the paths :-(
5972 */
5973 res = ast_say_number_full_he(chan, tm.tm_mday, ints, lang, "m", -1, -1);
5974 break;
5975 case 'Y': /* Year */
5976 res = ast_say_number_full_he(chan, tm.tm_year + 1900, ints, lang, "f", -1, -1);
5977 break;
5978 case 'I':
5979 case 'l': /* 12-Hour -> we do not support 12 hour based languages in Hebrew */
5980 case 'H':
5981 case 'k': /* 24-Hour */
5982 res = ast_say_number_full_he(chan, tm.tm_hour, ints, lang, "f", -1, -1);
5983 break;
5984 case 'M': /* Minute */
5985 if (tm.tm_min >= 0 && tm.tm_min <= 9) /* say a leading zero if needed */
5986 res = ast_say_number_full_he(chan, 0, ints, lang, "f", -1, -1);
5987 res = ast_say_number_full_he(chan, tm.tm_min, ints, lang, "f", -1, -1);
5988 break;
5989 case 'P':
5990 case 'p':
5991 /* AM/PM - There is no AM/PM in Hebrew... */
5992 break;
5993 case 'Q':
5994 /* Shorthand for "Today", "Yesterday", or "date" */
5995 case 'q':
5996 /* Shorthand for "" (today), "Yesterday", A
5997 * (weekday), or "date" */
5998 /* XXX As emphasized elsewhere, this should the native way in your
5999 * language to say the date, with changes in what you say, depending
6000 * upon how recent the date is. XXX */
6001 {
6002 struct timeval now = ast_tvnow();
6003 struct ast_tm tmnow;
6004 time_t beg_today;
6005 char todo = format[offset]; /* The letter to format*/
6006
6007 ast_localtime(&now, &tmnow, tzone);
6008 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
6009 /* In any case, it saves not having to do ast_mktime() */
6010 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
6011 if (beg_today < t) {
6012 /* Today */
6013 if (todo == 'Q') {
6014 res = wait_file(chan, ints, "digits/today", lang);
6015 }
6016 } else if (beg_today - 86400 < t) {
6017 /* Yesterday */
6018 res = wait_file(chan, ints, "digits/yesterday", lang);
6019 } else if ((todo != 'Q') && (beg_today - 86400 * 6 < t)) {
6020 /* Within the last week */
6021 res = ast_say_date_with_format_he(chan, t, ints, lang, "A", tzone);
6022 } else {
6023 res = ast_say_date_with_format_he(chan, t, ints, lang, IL_DATE_STR, tzone);
6024 }
6025 }
6026 break;
6027 case 'R':
6028 res = ast_say_date_with_format_he(chan, t, ints, lang, "HM", tzone);
6029 break;
6030 case 'S': /* Seconds */
6031 res = ast_say_number_full_he(chan, tm.tm_sec,
6032 ints, lang, "f", -1, -1
6033 );
6034 break;
6035 case 'T':
6036 res = ast_say_date_with_format_he(chan, t, ints, lang, "HMS", tzone);
6037 break;
6038 /* c, x, and X seem useful for testing. Not sure
6039 * if they're good for the general public */
6040 case 'c':
6041 res = ast_say_date_with_format_he(chan, t, ints, lang, IL_DATE_STR_FULL, tzone);
6042 break;
6043 case 'x':
6044 res = ast_say_date_with_format_he(chan, t, ints, lang, IL_DATE_STR, tzone);
6045 break;
6046 case 'X': /* Currently not locale-dependent...*/
6047 res = ast_say_date_with_format_he(chan, t, ints, lang, IL_TIME_STR, tzone);
6048 break;
6049 case ' ':
6050 case ' ':
6051 /* Just ignore spaces and tabs */
6052 break;
6053 default:
6054 /* Unknown character */
6055 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6056 }
6057 /* Jump out on DTMF */
6058 if (res) {
6059 break;
6060 }
6061 }
6062 return res;
6063}
#define IL_DATE_STR
#define IL_DATE_STR_FULL
#define IL_TIME_STR
static int ast_say_number_full_he(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
Definition say.c:1829
static int ast_say_date_with_format_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
ast_say_date_with_format_he Say formatted date in Hebrew
Definition say.c:5920

References ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_he(), ast_say_number_full_he(), ast_tvnow(), IL_DATE_STR, IL_DATE_STR_FULL, IL_TIME_STR, LOG_WARNING, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by ast_say_date_with_format_he(), and say_date_with_format().

◆ ast_say_date_with_format_is()

int ast_say_date_with_format_is ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

Definition at line 5523 of file say.c.

5524{
5525 struct timeval when = { t, 0 };
5526 struct ast_tm tm;
5527 int res=0, offset, sndoffset;
5528 char sndfile[256], nextmsg[256];
5529
5530 if (!format)
5531 format = "A dBY HMS";
5532
5533 ast_localtime(&when, &tm, tzone);
5534
5535 for (offset=0 ; format[offset] != '\0' ; offset++) {
5536 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5537 switch (format[offset]) {
5538 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
5539 case '\'':
5540 /* Literal name of a sound file */
5541 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
5542 sndfile[sndoffset] = format[offset];
5543 }
5544 sndfile[sndoffset] = '\0';
5545 res = wait_file(chan, ints, sndfile, lang);
5546 break;
5547 case 'A':
5548 case 'a':
5549 /* Sunday - Saturday */
5550 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
5551 res = wait_file(chan, ints, nextmsg, lang);
5552 break;
5553 case 'B':
5554 case 'b':
5555 case 'h':
5556 /* January - December */
5557 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
5558 res = wait_file(chan, ints, nextmsg, lang);
5559 break;
5560 case 'm':
5561 /* Month enumerated */
5562 res = ast_say_enumeration(chan, (tm.tm_mon + 1), ints, lang, "m");
5563 break;
5564 case 'd':
5565 case 'e':
5566 /* First - Thirtyfirst */
5567 res = ast_say_enumeration(chan, tm.tm_mday, ints, lang, "m");
5568 break;
5569 case 'Y':
5570 /* Year */
5571 {
5572 int year = tm.tm_year + 1900;
5573 if (year > 1999) { /* year 2000 and later */
5574 res = ast_say_number(chan, year, ints, lang, (char *) NULL);
5575 } else {
5576 if (year < 1100) {
5577 /* I'm not going to handle 1100 and prior */
5578 /* We'll just be silent on the year, instead of bombing out. */
5579 } else {
5580 /* year 1100 to 1999. will anybody need this?!? */
5581 /* say 1967 as 'nineteen hundred seven and sixty' */
5582 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", (year / 100) );
5583 res = wait_file(chan, ints, nextmsg, lang);
5584 if (!res) {
5585 res = wait_file(chan, ints, "digits/hundred", lang);
5586 if (!res && year % 100 != 0) {
5587 res = ast_say_number(chan, (year % 100), ints, lang, (char *) NULL);
5588 }
5589 }
5590 }
5591 }
5592 }
5593 break;
5594 case 'I':
5595 case 'l':
5596 /* 12-Hour */
5597 res = wait_file(chan, ints, "digits/oclock", lang);
5598 if (tm.tm_hour == 0)
5599 ast_copy_string(nextmsg, "digits/12", sizeof(nextmsg));
5600 else if (tm.tm_hour > 12)
5601 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
5602 else
5603 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
5604 if (!res) {
5605 res = wait_file(chan, ints, nextmsg, lang);
5606 }
5607 break;
5608 case 'H':
5609 /* 24-Hour, single digit hours preceded by "oh" (0) */
5610 if (tm.tm_hour < 10 && tm.tm_hour > 0) {
5611 res = wait_file(chan, ints, "digits/0", lang);
5612 }
5613 /* FALLTRHU */
5614 case 'k':
5615 /* 24-Hour */
5616 res = ast_say_number(chan, tm.tm_hour, ints, lang, "n");
5617 break;
5618 case 'M':
5619 /* Minute */
5620 if (tm.tm_min > 0 || next_item(&format[offset + 1]) == 'S') { /* zero 'digits/0' only if seconds follow */
5621 if (tm.tm_min < 10)
5622 res = wait_file(chan, ints, "digits/0", lang);
5623 /* Gender depends on whether or not seconds follow */
5624 if (next_item(&format[offset + 1]) == 'S')
5625 res = ast_say_number(chan, tm.tm_min, ints, lang, "f");
5626 else
5627 res = ast_say_number(chan, tm.tm_min, ints, lang, "n");
5628 }
5629 if (!res && next_item(&format[offset + 1]) == 'S') { /* minutes only if seconds follow */
5630 /* Say minute/minutes depending on whether minutes end in 1 */
5631 if ((tm.tm_min % 10 == 1) && (tm.tm_min != 11)) {
5632 res = wait_file(chan, ints, "minute", lang);
5633 } else {
5634 res = wait_file(chan, ints, "minutes", lang);
5635 }
5636 }
5637 break;
5638 case 'P':
5639 case 'p':
5640 /* AM/PM */
5641 if (tm.tm_hour > 11)
5642 ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
5643 else
5644 ast_copy_string(nextmsg, "digits/a-m", sizeof(nextmsg));
5645 res = wait_file(chan, ints, nextmsg, lang);
5646 break;
5647 case 'Q':
5648 /* Shorthand for "Today", "Yesterday", or AdBY */
5649 /* XXX As emphasized elsewhere, this should the native way in your
5650 * language to say the date, with changes in what you say, depending
5651 * upon how recent the date is. XXX */
5652 {
5653 struct timeval now = ast_tvnow();
5654 struct ast_tm tmnow;
5655 time_t beg_today;
5656
5657 ast_localtime(&now, &tmnow, tzone);
5658 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
5659 /* In any case, it saves not having to do ast_mktime() */
5660 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
5661 if (beg_today < t) {
5662 /* Today */
5663 res = wait_file(chan, ints, "digits/today", lang);
5664 } else if (beg_today - 86400 < t) {
5665 /* Yesterday */
5666 res = wait_file(chan, ints, "digits/yesterday", lang);
5667 } else {
5668 res = ast_say_date_with_format_is(chan, t, ints, lang, "AdBY", tzone);
5669 }
5670 }
5671 break;
5672 case 'q':
5673 /* Shorthand for "" (today), "Yesterday", A (weekday), or AdBY */
5674 /* XXX As emphasized elsewhere, this should the native way in your
5675 * language to say the date, with changes in what you say, depending
5676 * upon how recent the date is. XXX */
5677 {
5678 struct timeval now = ast_tvnow();
5679 struct ast_tm tmnow;
5680 time_t beg_today;
5681
5682 ast_localtime(&now, &tmnow, tzone);
5683 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
5684 /* In any case, it saves not having to do ast_mktime() */
5685 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
5686 if (beg_today < t) {
5687 /* Today */
5688 } else if ((beg_today - 86400) < t) {
5689 /* Yesterday */
5690 res = wait_file(chan, ints, "digits/yesterday", lang);
5691 } else if (beg_today - 86400 * 6 < t) {
5692 /* Within the last week */
5693 res = ast_say_date_with_format_is(chan, t, ints, lang, "A", tzone);
5694 } else {
5695 res = ast_say_date_with_format_is(chan, t, ints, lang, "AdBY", tzone);
5696 }
5697 }
5698 break;
5699 case 'R':
5700 res = ast_say_date_with_format_is(chan, t, ints, lang, "HM", tzone);
5701 break;
5702 case 'S':
5703 /* Seconds */
5704 res = wait_file(chan, ints, "digits/and", lang);
5705 if (!res) {
5706 res = ast_say_number(chan, tm.tm_sec, ints, lang, "f");
5707 /* Say minute/minutes depending on whether seconds end in 1 */
5708 if (!res && (tm.tm_sec % 10 == 1) && (tm.tm_sec != 11)) {
5709 res = wait_file(chan, ints, "second", lang);
5710 } else {
5711 res = wait_file(chan, ints, "seconds", lang);
5712 }
5713 }
5714 break;
5715 case 'T':
5716 res = ast_say_date_with_format_is(chan, t, ints, lang, "HMS", tzone);
5717 break;
5718 case ' ':
5719 case ' ':
5720 /* Just ignore spaces and tabs */
5721 break;
5722 default:
5723 /* Unknown character */
5724 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5725 }
5726 /* Jump out on DTMF */
5727 if (res) {
5728 break;
5729 }
5730 }
5731 return res;
5732}
static int ast_say_date_with_format_is(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Definition say.c:5523

References ast_copy_string(), ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_is(), ast_say_enumeration(), ast_say_number(), ast_tvnow(), LOG_WARNING, next_item(), NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by ast_say_date_with_format_is(), and say_date_with_format().

◆ ast_say_date_with_format_it()

int ast_say_date_with_format_it ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

Italian syntax.

Definition at line 6454 of file say.c.

6455{
6456 struct timeval when = { t, 0 };
6457 struct ast_tm tm;
6458 int res=0, offset, sndoffset;
6459 char sndfile[256], nextmsg[256];
6460
6461 if (format == NULL)
6462 format = "AdB 'digits/at' IMp";
6463
6464 ast_localtime(&when, &tm, tzone);
6465
6466 for (offset=0 ; format[offset] != '\0' ; offset++) {
6467 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6468 switch (format[offset]) {
6469 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
6470 case '\'':
6471 /* Literal name of a sound file */
6472 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
6473 sndfile[sndoffset] = format[offset];
6474 }
6475 sndfile[sndoffset] = '\0';
6476 res = wait_file(chan, ints, sndfile, lang);
6477 break;
6478 case 'A':
6479 case 'a':
6480 /* Sunday - Saturday */
6481 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
6482 res = wait_file(chan, ints, nextmsg, lang);
6483 break;
6484 case 'B':
6485 case 'b':
6486 case 'h':
6487 /* January - December */
6488 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
6489 res = wait_file(chan, ints, nextmsg, lang);
6490 break;
6491 case 'm':
6492 /* First - Twelfth */
6493 snprintf(nextmsg, sizeof(nextmsg), "digits/h-%d", tm.tm_mon +1);
6494 res = wait_file(chan, ints, nextmsg, lang);
6495 break;
6496 case 'd':
6497 case 'e':
6498 /* First day of the month is spelled as ordinal */
6499 if (tm.tm_mday == 1) {
6500 snprintf(nextmsg, sizeof(nextmsg), "digits/h-%d", tm.tm_mday);
6501 res = wait_file(chan, ints, nextmsg, lang);
6502 } else {
6503 if (!res) {
6504 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
6505 }
6506 }
6507 break;
6508 case 'Y':
6509 /* Year */
6510 if (tm.tm_year > 99) {
6511 res = wait_file(chan, ints, "digits/ore-2000", lang);
6512 if (tm.tm_year > 100) {
6513 if (!res) {
6514 /* This works until the end of 2021 */
6515 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_year - 100);
6516 res = wait_file(chan, ints, nextmsg, lang);
6517 }
6518 }
6519 } else {
6520 if (tm.tm_year < 1) {
6521 /* I'm not going to handle 1900 and prior */
6522 /* We'll just be silent on the year, instead of bombing out. */
6523 } else {
6524 res = wait_file(chan, ints, "digits/ore-1900", lang);
6525 if ((!res) && (tm.tm_year != 0)) {
6526 if (tm.tm_year <= 21) {
6527 /* 1910 - 1921 */
6528 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_year);
6529 res = wait_file(chan, ints, nextmsg, lang);
6530 } else {
6531 /* 1922 - 1999, but sounds badly in 1928, 1931, 1938, etc... */
6532 int ten, one;
6533 ten = tm.tm_year / 10;
6534 one = tm.tm_year % 10;
6535 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", ten * 10);
6536 res = wait_file(chan, ints, nextmsg, lang);
6537 if (!res) {
6538 if (one != 0) {
6539 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", one);
6540 res = wait_file(chan, ints, nextmsg, lang);
6541 }
6542 }
6543 }
6544 }
6545 }
6546 }
6547 break;
6548 case 'I':
6549 case 'l':
6550 /* 12-Hour */
6551 if (tm.tm_hour == 0) {
6552 ast_copy_string(nextmsg, "digits/12", sizeof(nextmsg));
6553 } else if (tm.tm_hour > 12) {
6554 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
6555 } else {
6556 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
6557 }
6558 res = wait_file(chan, ints, nextmsg, lang);
6559 break;
6560 case 'H':
6561 case 'k':
6562 /* 24-Hour */
6563 if (tm.tm_hour == 0) {
6564 res = wait_file(chan, ints, "digits/ore-mezzanotte", lang);
6565 } else if (tm.tm_hour == 1) {
6566 res = wait_file(chan, ints, "digits/ore-una", lang);
6567 } else {
6568 res = ast_say_number(chan, tm.tm_hour, ints, lang, (char *) NULL);
6569 }
6570 break;
6571 case 'M':
6572 /* Minute */
6573 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
6574 break;
6575 case 'P':
6576 case 'p':
6577 /* AM/PM */
6578 if (tm.tm_hour > 11) {
6579 ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
6580 } else {
6581 ast_copy_string(nextmsg, "digits/a-m", sizeof(nextmsg));
6582 }
6583 res = wait_file(chan, ints, nextmsg, lang);
6584 break;
6585 case 'Q':
6586 /* Shorthand for "Today", "Yesterday", or ABdY */
6587 /* XXX As emphasized elsewhere, this should the native way in your
6588 * language to say the date, with changes in what you say, depending
6589 * upon how recent the date is. XXX */
6590 {
6591 struct timeval now = ast_tvnow();
6592 struct ast_tm tmnow;
6593 time_t beg_today;
6594
6595 ast_localtime(&now, &tmnow, tzone);
6596 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
6597 /* In any case, it saves not having to do ast_mktime() */
6598 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
6599 if (beg_today < t) {
6600 /* Today */
6601 res = wait_file(chan, ints, "digits/today", lang);
6602 } else if (beg_today - 86400 < t) {
6603 /* Yesterday */
6604 res = wait_file(chan, ints, "digits/yesterday", lang);
6605 } else {
6606 res = ast_say_date_with_format_it(chan, t, ints, lang, "AdB", tzone);
6607 }
6608 }
6609 break;
6610 case 'q':
6611 /* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
6612 {
6613 struct timeval now = ast_tvnow();
6614 struct ast_tm tmnow;
6615 time_t beg_today;
6616
6617 ast_localtime(&now, &tmnow, tzone);
6618 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
6619 /* In any case, it saves not having to do ast_mktime() */
6620 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
6621 if (beg_today < t) {
6622 /* Today */
6623 } else if ((beg_today - 86400) < t) {
6624 /* Yesterday */
6625 res = wait_file(chan, ints, "digits/yesterday", lang);
6626 } else if (beg_today - 86400 * 6 < t) {
6627 /* Within the last week */
6628 res = ast_say_date_with_format_it(chan, t, ints, lang, "A", tzone);
6629 } else {
6630 res = ast_say_date_with_format_it(chan, t, ints, lang, "AdB", tzone);
6631 }
6632 }
6633 break;
6634 case 'R':
6635 res = ast_say_date_with_format_it(chan, t, ints, lang, "HM", tzone);
6636 break;
6637 case 'S':
6638 /* Seconds */
6639 if (tm.tm_sec == 0) {
6640 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec);
6641 res = wait_file(chan, ints, nextmsg, lang);
6642 } else if (tm.tm_sec < 10) {
6643 res = wait_file(chan, ints, "digits/oh", lang);
6644 if (!res) {
6645 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec);
6646 res = wait_file(chan, ints, nextmsg, lang);
6647 }
6648 } else if ((tm.tm_sec < 21) || (tm.tm_sec % 10 == 0)) {
6649 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec);
6650 res = wait_file(chan, ints, nextmsg, lang);
6651 } else {
6652 int ten, one;
6653 ten = (tm.tm_sec / 10) * 10;
6654 one = (tm.tm_sec % 10);
6655 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", ten);
6656 res = wait_file(chan, ints, nextmsg, lang);
6657 if (!res) {
6658 /* Fifty, not fifty-zero */
6659 if (one != 0) {
6660 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", one);
6661 res = wait_file(chan, ints, nextmsg, lang);
6662 }
6663 }
6664 }
6665 break;
6666 case 'T':
6667 res = ast_say_date_with_format_it(chan, t, ints, lang, "HMS", tzone);
6668 break;
6669 case ' ':
6670 case ' ':
6671 /* Just ignore spaces and tabs */
6672 break;
6673 default:
6674 /* Unknown character */
6675 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6676 }
6677 /* Jump out on DTMF */
6678 if (res) {
6679 break;
6680 }
6681 }
6682 return res;
6683}
static int ast_say_date_with_format_it(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Italian syntax.
Definition say.c:6454

References ast_copy_string(), ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_it(), ast_say_number(), ast_tvnow(), LOG_WARNING, NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by ast_say_date_with_format_it(), and say_date_with_format().

◆ ast_say_date_with_format_ja()

int ast_say_date_with_format_ja ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

Definition at line 9261 of file say.c.

9262{
9263 struct timeval tv = { time, 0 };
9264 struct ast_tm tm;
9265 int res = 0, offset, sndoffset;
9266 char sndfile[256], nextmsg[256];
9267
9268 if (!format)
9269 format = "YbdAPIMS";
9270
9271 ast_localtime(&tv, &tm, timezone);
9272
9273 for (offset = 0; format[offset] != '\0'; offset++) {
9274 ast_log(LOG_DEBUG, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
9275 switch (format[offset]) {
9276 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
9277 case '\'':
9278 /* Literal name of a sound file */
9279 for (sndoffset = 0; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
9280 sndfile[sndoffset] = format[offset];
9281 }
9282 sndfile[sndoffset] = '\0';
9283 res = wait_file(chan,ints,sndfile,lang);
9284 break;
9285 case 'A':
9286 case 'a':
9287 /* Sunday - Saturday */
9288 snprintf(nextmsg,sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
9289 res = wait_file(chan,ints,nextmsg,lang);
9290 break;
9291 case 'B':
9292 case 'b':
9293 case 'h':
9294 /* January - December */
9295 snprintf(nextmsg,sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
9296 res = wait_file(chan,ints,nextmsg,lang);
9297 break;
9298 case 'd':
9299 case 'e':
9300 /* First - Thirtyfirst */
9301 if (tm.tm_mday < 21) {
9302 snprintf(nextmsg,sizeof(nextmsg), "digits/h-%d_2", tm.tm_mday);
9303 res = wait_file(chan,ints,nextmsg,lang);
9304 } else if (tm.tm_mday < 30) {
9305 /* Between 21 and 29 - two sounds */
9306 res = wait_file(chan,ints, "digits/20",lang);
9307 if (!res) {
9308 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_mday - 20);
9309 res = wait_file(chan,ints,nextmsg,lang);
9310 }
9311 res = wait_file(chan,ints, "digits/nichi",lang);
9312 } else if (tm.tm_mday == 30) {
9313 /* 30 */
9314 res = wait_file(chan,ints, "digits/h-30_2",lang);
9315 } else {
9316 /* 31 */
9317 res = wait_file(chan,ints, "digits/30",lang);
9318 res = wait_file(chan,ints, "digits/1",lang);
9319 res = wait_file(chan,ints, "digits/nichi",lang);
9320 }
9321 break;
9322 case 'Y':
9323 /* Year */
9324 if (tm.tm_year > 99) {
9325 res = wait_file(chan,ints, "digits/2",lang);
9326 if (!res) {
9327 res = wait_file(chan,ints, "digits/thousand",lang);
9328 }
9329 if (tm.tm_year > 100) {
9330 if (!res) {
9331 /* This works until the end of 2020 */
9332 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_year - 100);
9333 res = wait_file(chan,ints,nextmsg,lang);
9334 }
9335 }
9336 } else {
9337 if (tm.tm_year < 1) {
9338 /* I'm not going to handle 1900 and prior */
9339 /* We'll just be silent on the year, instead of bombing out. */
9340 } else {
9341 res = wait_file(chan,ints, "digits/19",lang);
9342 if (!res) {
9343 if (tm.tm_year <= 9) {
9344 /* 1901 - 1909 */
9345 res = wait_file(chan,ints, "digits/oh",lang);
9346 if (!res) {
9347 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_year);
9348 res = wait_file(chan,ints,nextmsg,lang);
9349 }
9350 } else if (tm.tm_year <= 20) {
9351 /* 1910 - 1920 */
9352 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_year);
9353 res = wait_file(chan,ints,nextmsg,lang);
9354 } else {
9355 /* 1921 - 1999 */
9356 int ten, one;
9357 ten = tm.tm_year / 10;
9358 one = tm.tm_year % 10;
9359 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", ten * 10);
9360 res = wait_file(chan,ints,nextmsg,lang);
9361 if (!res) {
9362 if (one != 0) {
9363 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", one);
9364 res = wait_file(chan,ints,nextmsg,lang);
9365 }
9366 }
9367 }
9368 }
9369 }
9370 }
9371 res = wait_file(chan,ints, "digits/nen",lang);
9372 break;
9373 case 'P':
9374 case 'p':
9375 /* AM/PM */
9376 if (tm.tm_hour > 11)
9377 snprintf(nextmsg,sizeof(nextmsg), "digits/p-m");
9378 else
9379 snprintf(nextmsg,sizeof(nextmsg), "digits/a-m");
9380 res = wait_file(chan,ints,nextmsg,lang);
9381 break;
9382 case 'I':
9383 case 'l':
9384 /* 12-Hour */
9385 if (tm.tm_hour == 0)
9386 snprintf(nextmsg,sizeof(nextmsg), "digits/12");
9387 else if (tm.tm_hour == 9 || tm.tm_hour == 21)
9388 snprintf(nextmsg,sizeof(nextmsg), "digits/9_2");
9389 else if (tm.tm_hour > 12)
9390 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
9391 else
9392 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_hour);
9393 res = wait_file(chan,ints,nextmsg,lang);
9394 if(!res) res = wait_file(chan,ints, "digits/ji",lang);
9395 break;
9396 case 'H':
9397 case 'k':
9398 if (!res) {
9399 if (tm.tm_hour != 0) {
9400 int remainder = tm.tm_hour;
9401 if (tm.tm_hour > 20) {
9402 res = wait_file(chan,ints, "digits/20",lang);
9403 remainder -= 20;
9404 }
9405 if (!res) {
9406 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", remainder);
9407 res = wait_file(chan,ints,nextmsg,lang);
9408 }
9409 }
9410 }
9411 res = wait_file(chan,ints, "digits/ji",lang);
9412 break;
9413 case 'M':
9414 /* Minute */
9415 if ((tm.tm_min < 21) || (tm.tm_min % 10 == 0)) {
9416 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_min);
9417 res = wait_file(chan,ints,nextmsg,lang);
9418 } else {
9419 int ten, one;
9420 ten = (tm.tm_min / 10) * 10;
9421 one = (tm.tm_min % 10);
9422 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", ten);
9423 res = wait_file(chan,ints,nextmsg,lang);
9424 if (!res) {
9425 /* Fifty, not fifty-zero */
9426 if (one != 0) {
9427 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", one);
9428 res = wait_file(chan,ints,nextmsg,lang);
9429 }
9430 }
9431 }
9432 res = wait_file(chan,ints, "digits/fun",lang);
9433 break;
9434 case 'Q':
9435 /* Shorthand for "Today", "Yesterday", or ABdY */
9436 {
9437 struct timeval now;
9438 struct ast_tm tmnow;
9439 time_t beg_today;
9440
9441 gettimeofday(&now,NULL);
9442 ast_localtime(&now,&tmnow,timezone);
9443 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
9444 /* In any case, it saves not having to do ast_mktime() */
9445 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
9446 if (beg_today < time) {
9447 /* Today */
9448 res = wait_file(chan,ints, "digits/today",lang);
9449 } else if (beg_today - 86400 < time) {
9450 /* Yesterday */
9451 res = wait_file(chan,ints, "digits/yesterday",lang);
9452 } else {
9453 res = ast_say_date_with_format(chan, time, ints, lang, "ABdY", timezone);
9454 }
9455 }
9456 break;
9457 case 'q':
9458 /* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
9459 {
9460 struct timeval now;
9461 struct ast_tm tmnow;
9462 time_t beg_today;
9463
9464 gettimeofday(&now,NULL);
9465 ast_localtime(&now,&tmnow,timezone);
9466 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
9467 /* In any case, it saves not having to do ast_mktime() */
9468 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
9469 if (beg_today < time) {
9470 /* Today */
9471 } else if ((beg_today - 86400) < time) {
9472 /* Yesterday */
9473 res = wait_file(chan,ints, "digits/yesterday",lang);
9474 } else if (beg_today - 86400 * 6 < time) {
9475 /* Within the last week */
9476 res = ast_say_date_with_format(chan, time, ints, lang, "A", timezone);
9477 } else {
9478 res = ast_say_date_with_format(chan, time, ints, lang, "ABdY", timezone);
9479 }
9480 }
9481 break;
9482 case 'R':
9483 res = ast_say_date_with_format(chan, time, ints, lang, "HM", timezone);
9484 break;
9485 case 'S':
9486 /* Seconds */
9487 if (tm.tm_sec == 0) {
9488 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_sec);
9489 res = wait_file(chan,ints,nextmsg,lang);
9490 } else if ((tm.tm_sec < 21) || (tm.tm_sec % 10 == 0)) {
9491 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_sec);
9492 res = wait_file(chan,ints,nextmsg,lang);
9493 } else {
9494 int ten, one;
9495 ten = (tm.tm_sec / 10) * 10;
9496 one = (tm.tm_sec % 10);
9497 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", ten);
9498 res = wait_file(chan,ints,nextmsg,lang);
9499 if (!res) {
9500 /* Fifty, not fifty-zero */
9501 if (one != 0) {
9502 snprintf(nextmsg,sizeof(nextmsg), "digits/%d", one);
9503 res = wait_file(chan,ints,nextmsg,lang);
9504 }
9505 }
9506 }
9507 res = wait_file(chan,ints, "digits/byou",lang);
9508 break;
9509 case 'T':
9510 res = ast_say_date_with_format(chan, time, ints, lang, "HMS", timezone);
9511 break;
9512 case ' ':
9513 case ' ':
9514 /* Just ignore spaces and tabs */
9515 break;
9516 default:
9517 /* Unknown character */
9518 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
9519 }
9520 /* Jump out on DTMF */
9521 if (res) {
9522 break;
9523 }
9524 }
9525 return res;
9526}
#define LOG_DEBUG

References ast_localtime(), ast_log, ast_say_date_with_format, LOG_DEBUG, LOG_WARNING, NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by say_date_with_format().

◆ ast_say_date_with_format_nl()

int ast_say_date_with_format_nl ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

Dutch syntax.

Definition at line 6686 of file say.c.

6687{
6688 struct timeval when = { t, 0 };
6689 struct ast_tm tm;
6690 int res=0, offset, sndoffset;
6691 char sndfile[256], nextmsg[256];
6692
6693 if (format == NULL)
6694 format = "AdBY 'digits/at' IMp";
6695
6696 ast_localtime(&when, &tm, tzone);
6697
6698 for (offset=0 ; format[offset] != '\0' ; offset++) {
6699 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6700 switch (format[offset]) {
6701 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
6702 case '\'':
6703 /* Literal name of a sound file */
6704 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
6705 sndfile[sndoffset] = format[offset];
6706 }
6707 sndfile[sndoffset] = '\0';
6708 res = wait_file(chan, ints, sndfile, lang);
6709 break;
6710 case 'A':
6711 case 'a':
6712 /* Sunday - Saturday */
6713 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
6714 res = wait_file(chan, ints, nextmsg, lang);
6715 break;
6716 case 'B':
6717 case 'b':
6718 case 'h':
6719 /* January - December */
6720 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
6721 res = wait_file(chan, ints, nextmsg, lang);
6722 break;
6723 case 'm':
6724 /* First - Twelfth */
6725 snprintf(nextmsg, sizeof(nextmsg), "digits/h-%d", tm.tm_mon +1);
6726 res = wait_file(chan, ints, nextmsg, lang);
6727 break;
6728 case 'd':
6729 case 'e':
6730 /* First - Thirtyfirst */
6731 res = ast_say_number(chan, tm.tm_mday, ints, lang, NULL);
6732 break;
6733 case 'Y':
6734 /* Year */
6735 if (tm.tm_year > 99) {
6736 res = wait_file(chan, ints, "digits/2", lang);
6737 if (!res) {
6738 res = wait_file(chan, ints, "digits/thousand", lang);
6739 }
6740 if (tm.tm_year > 100) {
6741 if (!res) {
6742 res = ast_say_number(chan, tm.tm_year - 100, ints, lang, (char *) NULL);
6743 }
6744 }
6745 } else {
6746 if (tm.tm_year < 1) {
6747 /* I'm not going to handle 1900 and prior */
6748 /* We'll just be silent on the year, instead of bombing out. */
6749 } else {
6750 res = wait_file(chan, ints, "digits/19", lang);
6751 if (!res) {
6752 if (tm.tm_year <= 9) {
6753 /* 1901 - 1909 */
6754 res = wait_file(chan, ints, "digits/oh", lang);
6755 if (!res) {
6756 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_year);
6757 res = wait_file(chan, ints, nextmsg, lang);
6758 }
6759 } else if (tm.tm_year <= 20) {
6760 /* 1910 - 1920 */
6761 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_year);
6762 res = wait_file(chan, ints, nextmsg, lang);
6763 } else {
6764 /* 1921 - 1999 */
6765 int ten, one;
6766 ten = tm.tm_year / 10;
6767 one = tm.tm_year % 10;
6768 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", ten * 10);
6769 res = wait_file(chan, ints, nextmsg, lang);
6770 if (!res) {
6771 if (one != 0) {
6772 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", one);
6773 res = wait_file(chan, ints, nextmsg, lang);
6774 }
6775 }
6776 }
6777 }
6778 }
6779 }
6780 break;
6781 case 'I':
6782 case 'l':
6783 /* 12-Hour */
6784 if (tm.tm_hour == 0)
6785 ast_copy_string(nextmsg, "digits/12", sizeof(nextmsg));
6786 else if (tm.tm_hour > 12)
6787 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
6788 else
6789 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
6790 res = wait_file(chan, ints, nextmsg, lang);
6791 break;
6792 case 'H':
6793 case 'k':
6794 /* 24-Hour */
6795 res = ast_say_number(chan, tm.tm_hour, ints, lang, (char *) NULL);
6796 if (!res) {
6797 res = wait_file(chan, ints, "digits/nl-uur", lang);
6798 }
6799 break;
6800 case 'M':
6801 /* Minute */
6802 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
6803 break;
6804 case 'P':
6805 case 'p':
6806 /* AM/PM */
6807 if (tm.tm_hour > 11)
6808 ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
6809 else
6810 ast_copy_string(nextmsg, "digits/a-m", sizeof(nextmsg));
6811 res = wait_file(chan, ints, nextmsg, lang);
6812 break;
6813 case 'Q':
6814 /* Shorthand for "Today", "Yesterday", or AdBY */
6815 /* XXX As emphasized elsewhere, this should the native way in your
6816 * language to say the date, with changes in what you say, depending
6817 * upon how recent the date is. XXX */
6818 {
6819 struct timeval now = ast_tvnow();
6820 struct ast_tm tmnow;
6821 time_t beg_today;
6822
6823 ast_localtime(&now, &tmnow, tzone);
6824 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
6825 /* In any case, it saves not having to do ast_mktime() */
6826 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
6827 if (beg_today < t) {
6828 /* Today */
6829 res = wait_file(chan, ints, "digits/today", lang);
6830 } else if (beg_today - 86400 < t) {
6831 /* Yesterday */
6832 res = wait_file(chan, ints, "digits/yesterday", lang);
6833 } else {
6834 res = ast_say_date_with_format_nl(chan, t, ints, lang, "AdBY", tzone);
6835 }
6836 }
6837 break;
6838 case 'q':
6839 /* Shorthand for "" (today), "Yesterday", A (weekday), or AdBY */
6840 {
6841 struct timeval now = ast_tvnow();
6842 struct ast_tm tmnow;
6843 time_t beg_today;
6844
6845 ast_localtime(&now, &tmnow, tzone);
6846 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
6847 /* In any case, it saves not having to do ast_mktime() */
6848 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
6849 if (beg_today < t) {
6850 /* Today */
6851 } else if ((beg_today - 86400) < t) {
6852 /* Yesterday */
6853 res = wait_file(chan, ints, "digits/yesterday", lang);
6854 } else if (beg_today - 86400 * 6 < t) {
6855 /* Within the last week */
6856 res = ast_say_date_with_format_nl(chan, t, ints, lang, "A", tzone);
6857 } else {
6858 res = ast_say_date_with_format_nl(chan, t, ints, lang, "AdBY", tzone);
6859 }
6860 }
6861 break;
6862 case 'R':
6863 res = ast_say_date_with_format_nl(chan, t, ints, lang, "HM", tzone);
6864 break;
6865 case 'S':
6866 /* Seconds */
6867 res = ast_say_number(chan, tm.tm_sec, ints, lang, (char *) NULL);
6868 break;
6869 case 'T':
6870 res = ast_say_date_with_format_nl(chan, t, ints, lang, "HMS", tzone);
6871 break;
6872 case ' ':
6873 case ' ':
6874 /* Just ignore spaces and tabs */
6875 break;
6876 default:
6877 /* Unknown character */
6878 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6879 }
6880 /* Jump out on DTMF */
6881 if (res) {
6882 break;
6883 }
6884 }
6885 return res;
6886}
static int ast_say_date_with_format_nl(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Dutch syntax.
Definition say.c:6686

References ast_copy_string(), ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_nl(), ast_say_number(), ast_tvnow(), LOG_WARNING, NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by ast_say_date_with_format_nl(), and say_date_with_format().

◆ ast_say_date_with_format_pl()

int ast_say_date_with_format_pl ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

Polish syntax.

Definition at line 6889 of file say.c.

6890{
6891 struct timeval when = { thetime, 0 };
6892 struct ast_tm tm;
6893 int res=0, offset, sndoffset;
6894 char sndfile[256], nextmsg[256];
6895
6896 ast_localtime(&when, &tm, tzone);
6897
6898 for (offset = 0 ; format[offset] != '\0' ; offset++) {
6899 int remaining;
6900 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6901 switch (format[offset]) {
6902 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
6903 case '\'':
6904 /* Literal name of a sound file */
6905 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
6906 sndfile[sndoffset] = format[offset];
6907 }
6908 sndfile[sndoffset] = '\0';
6909 res = wait_file(chan, ints, sndfile, lang);
6910 break;
6911 case 'A':
6912 case 'a':
6913 /* Sunday - Saturday */
6914 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
6915 res = wait_file(chan, ints, nextmsg, lang);
6916 break;
6917 case 'B':
6918 case 'b':
6919 case 'h':
6920 /* January - December */
6921 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
6922 res = wait_file(chan, ints, nextmsg, lang);
6923 break;
6924 case 'm':
6925 /* Month enumerated */
6926 res = ast_say_enumeration(chan, (tm.tm_mon + 1), ints, lang, NULL);
6927 break;
6928 case 'd':
6929 case 'e':
6930 /* First - Thirtyfirst */
6931 remaining = tm.tm_mday;
6932 if (tm.tm_mday > 30) {
6933 res = wait_file(chan, ints, "digits/h-30", lang);
6934 remaining -= 30;
6935 }
6936 if (tm.tm_mday > 20 && tm.tm_mday < 30) {
6937 res = wait_file(chan, ints, "digits/h-20", lang);
6938 remaining -= 20;
6939 }
6940 if (!res) {
6941 snprintf(nextmsg, sizeof(nextmsg), "digits/h-%d", remaining);
6942 res = wait_file(chan, ints, nextmsg, lang);
6943 }
6944 break;
6945 case 'Y':
6946 /* Year */
6947 if (tm.tm_year > 100) {
6948 res = wait_file(chan, ints, "digits/2", lang);
6949 if (!res)
6950 res = wait_file(chan, ints, "digits/1000.2", lang);
6951 if (tm.tm_year > 100) {
6952 if (!res)
6953 res = ast_say_enumeration(chan, tm.tm_year - 100, ints, lang, NULL);
6954 }
6955 } else if (tm.tm_year == 100) {
6956 res = wait_file(chan, ints, "digits/h-2000", lang);
6957 } else {
6958 if (tm.tm_year < 1) {
6959 /* I'm not going to handle 1900 and prior */
6960 /* We'll just be silent on the year, instead of bombing out. */
6961 break;
6962 } else {
6963 res = wait_file(chan, ints, "digits/1000", lang);
6964 if (!res) {
6965 wait_file(chan, ints, "digits/900", lang);
6966 res = ast_say_enumeration(chan, tm.tm_year, ints, lang, NULL);
6967 }
6968 }
6969 }
6970 if (!res)
6971 wait_file(chan, ints, "digits/year", lang);
6972 break;
6973 case 'I':
6974 case 'l':
6975 /* 12-Hour */
6976 if (tm.tm_hour == 0)
6977 ast_copy_string(nextmsg, "digits/t-12", sizeof(nextmsg));
6978 else if (tm.tm_hour > 12)
6979 snprintf(nextmsg, sizeof(nextmsg), "digits/t-%d", tm.tm_hour - 12);
6980 else
6981 snprintf(nextmsg, sizeof(nextmsg), "digits/t-%d", tm.tm_hour);
6982
6983 res = wait_file(chan, ints, nextmsg, lang);
6984 break;
6985 case 'H':
6986 case 'k':
6987 /* 24-Hour */
6988 if (tm.tm_hour != 0) {
6989 snprintf(nextmsg, sizeof(nextmsg), "digits/t-%d", tm.tm_hour);
6990 res = wait_file(chan, ints, nextmsg, lang);
6991 } else
6992 res = wait_file(chan, ints, "digits/t-24", lang);
6993 break;
6994 case 'M':
6995 case 'N':
6996 /* Minute */
6997 if (tm.tm_min == 0) {
6998 if (format[offset] == 'M') {
6999 res = wait_file(chan, ints, "digits/oclock", lang);
7000 } else {
7001 res = wait_file(chan, ints, "digits/100", lang);
7002 }
7003 } else
7004 res = ast_say_number(chan, tm.tm_min, ints, lang, "f");
7005 break;
7006 case 'P':
7007 case 'p':
7008 /* AM/PM */
7009 if (tm.tm_hour > 11)
7010 ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
7011 else
7012 ast_copy_string(nextmsg, "digits/a-m", sizeof(nextmsg));
7013 res = wait_file(chan, ints, nextmsg, lang);
7014 break;
7015 case 'Q':
7016 /* Shorthand for "Today", "Yesterday", or AdBY */
7017 {
7018 struct timeval now = ast_tvnow();
7019 struct ast_tm tmnow;
7020 time_t beg_today;
7021
7022 ast_localtime(&now, &tmnow, tzone);
7023 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
7024 /* In any case, it saves not having to do ast_mktime() */
7025 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
7026 if (beg_today < thetime) {
7027 /* Today */
7028 res = wait_file(chan, ints, "digits/today", lang);
7029 } else if (beg_today - 86400 < thetime) {
7030 /* Yesterday */
7031 res = wait_file(chan, ints, "digits/yesterday", lang);
7032 } else {
7033 res = ast_say_date_with_format(chan, thetime, ints, lang, "AdBY", tzone);
7034 }
7035 }
7036 break;
7037 case 'q':
7038 /* Shorthand for "" (today), "Yesterday", A (weekday), or AdBY */
7039 {
7040 struct timeval now = ast_tvnow();
7041 struct ast_tm tmnow;
7042 time_t beg_today;
7043
7044 ast_localtime(&now, &tmnow, tzone);
7045 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
7046 /* In any case, it saves not having to do ast_mktime() */
7047 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
7048 if (beg_today < thetime) {
7049 /* Today */
7050 } else if ((beg_today - 86400) < thetime) {
7051 /* Yesterday */
7052 res = wait_file(chan, ints, "digits/yesterday", lang);
7053 } else if (beg_today - 86400 * 6 < thetime) {
7054 /* Within the last week */
7055 res = ast_say_date_with_format(chan, thetime, ints, lang, "A", tzone);
7056 } else {
7057 res = ast_say_date_with_format(chan, thetime, ints, lang, "AdBY", tzone);
7058 }
7059 }
7060 break;
7061 case 'R':
7062 res = ast_say_date_with_format(chan, thetime, ints, lang, "HM", tzone);
7063 break;
7064 case 'S':
7065 /* Seconds */
7066 res = wait_file(chan, ints, "digits/and", lang);
7067 if (!res) {
7068 if (tm.tm_sec == 1) {
7069 res = wait_file(chan, ints, "digits/1z", lang);
7070 if (!res)
7071 res = wait_file(chan, ints, "digits/second-a", lang);
7072 } else {
7073 res = ast_say_number(chan, tm.tm_sec, ints, lang, "f");
7074 if (!res) {
7075 int ten, one;
7076 ten = tm.tm_sec / 10;
7077 one = tm.tm_sec % 10;
7078
7079 if (one > 1 && one < 5 && ten != 1)
7080 res = wait_file(chan, ints, "seconds", lang);
7081 else
7082 res = wait_file(chan, ints, "second", lang);
7083 }
7084 }
7085 }
7086 break;
7087 case 'T':
7088 res = ast_say_date_with_format(chan, thetime, ints, lang, "HMS", tzone);
7089 break;
7090 case ' ':
7091 case ' ':
7092 /* Just ignore spaces and tabs */
7093 break;
7094 default:
7095 /* Unknown character */
7096 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
7097 }
7098 /* Jump out on DTMF */
7099 if (res)
7100 break;
7101 }
7102 return res;
7103}

References ast_copy_string(), ast_debug, ast_localtime(), ast_log, ast_say_date_with_format, ast_say_enumeration(), ast_say_number(), ast_tvnow(), LOG_WARNING, NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by say_date_with_format().

◆ ast_say_date_with_format_pt()

int ast_say_date_with_format_pt ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

Portuguese syntax.

Definition at line 7106 of file say.c.

7107{
7108 struct timeval when = { t, 0 };
7109 struct ast_tm tm;
7110 int res=0, offset, sndoffset;
7111 char sndfile[256], nextmsg[256];
7112
7113 if (format == NULL)
7114 format = "Ad 'digits/pt-de' B 'digits/pt-de' Y I 'digits/pt-e' Mp";
7115
7116 ast_localtime(&when, &tm, tzone);
7117
7118 for (offset=0 ; format[offset] != '\0' ; offset++) {
7119 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
7120 switch (format[offset]) {
7121 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
7122 case '\'':
7123 /* Literal name of a sound file */
7124 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
7125 sndfile[sndoffset] = format[offset];
7126 }
7127 sndfile[sndoffset] = '\0';
7128 snprintf(nextmsg, sizeof(nextmsg), "%s", sndfile);
7129 res = wait_file(chan, ints, nextmsg, lang);
7130 break;
7131 case 'A':
7132 case 'a':
7133 /* Sunday - Saturday */
7134 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
7135 res = wait_file(chan, ints, nextmsg, lang);
7136 break;
7137 case 'B':
7138 case 'b':
7139 case 'h':
7140 /* January - December */
7141 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
7142 res = wait_file(chan, ints, nextmsg, lang);
7143 break;
7144 case 'm':
7145 /* First - Twelfth */
7146 if (!strcasecmp(lang, "pt_BR")) {
7147 res = ast_say_number(chan, tm.tm_mon+1, ints, lang, (char *) NULL);
7148 } else {
7149 snprintf(nextmsg, sizeof(nextmsg), "digits/h-%d", tm.tm_mon +1);
7150 res = wait_file(chan, ints, nextmsg, lang);
7151 }
7152 break;
7153 case 'd':
7154 case 'e':
7155 /* First - Thirtyfirst */
7156 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
7157 break;
7158 case 'Y':
7159 /* Year */
7160 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
7161 break;
7162 case 'I':
7163 case 'l':
7164 /* 12-Hour */
7165 if (!strcasecmp(lang, "pt_BR")) {
7166 if (tm.tm_hour == 0) {
7167 if (format[offset] == 'I')
7168 res = wait_file(chan, ints, "digits/pt-a", lang);
7169 if (!res)
7170 res = wait_file(chan, ints, "digits/pt-meianoite", lang);
7171 } else if (tm.tm_hour == 12) {
7172 if (format[offset] == 'I')
7173 res = wait_file(chan, ints, "digits/pt-ao", lang);
7174 if (!res)
7175 res = wait_file(chan, ints, "digits/pt-meiodia", lang);
7176 } else {
7177 if (format[offset] == 'I') {
7178 if ((tm.tm_hour % 12) != 1)
7179 res = wait_file(chan, ints, "digits/pt-as", lang);
7180 else
7181 res = wait_file(chan, ints, "digits/pt-a", lang);
7182 }
7183 if (!res)
7184 res = ast_say_number(chan, (tm.tm_hour % 12), ints, lang, "f");
7185 }
7186 } else {
7187 if (tm.tm_hour == 0) {
7188 if (format[offset] == 'I')
7189 res = wait_file(chan, ints, "digits/pt-ah", lang);
7190 if (!res)
7191 res = wait_file(chan, ints, "digits/pt-meianoite", lang);
7192 }
7193 else if (tm.tm_hour == 12) {
7194 if (format[offset] == 'I')
7195 res = wait_file(chan, ints, "digits/pt-ao", lang);
7196 if (!res)
7197 res = wait_file(chan, ints, "digits/pt-meiodia", lang);
7198 }
7199 else {
7200 if (format[offset] == 'I') {
7201 res = wait_file(chan, ints, "digits/pt-ah", lang);
7202 if ((tm.tm_hour % 12) != 1)
7203 if (!res)
7204 res = wait_file(chan, ints, "digits/pt-sss", lang);
7205 }
7206 if (!res)
7207 res = ast_say_number(chan, (tm.tm_hour % 12), ints, lang, "f");
7208 }
7209 }
7210 break;
7211 case 'H':
7212 case 'k':
7213 /* 24-Hour */
7214 if (!strcasecmp(lang, "pt_BR")) {
7215 res = ast_say_number(chan, tm.tm_hour, ints, lang, "f");
7216 if ((!res) && (format[offset] == 'H')) {
7217 if (tm.tm_hour > 1) {
7218 res = wait_file(chan, ints, "digits/hours", lang);
7219 } else {
7220 res = wait_file(chan, ints, "digits/hour", lang);
7221 }
7222 }
7223 } else {
7224 res = ast_say_number(chan, -tm.tm_hour, ints, lang, NULL);
7225 if (!res) {
7226 if (tm.tm_hour != 0) {
7227 int remaining = tm.tm_hour;
7228 if (tm.tm_hour > 20) {
7229 res = wait_file(chan, ints, "digits/20", lang);
7230 remaining -= 20;
7231 }
7232 if (!res) {
7233 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", remaining);
7234 res = wait_file(chan, ints, nextmsg, lang);
7235 }
7236 }
7237 }
7238 }
7239 break;
7240 case 'M':
7241 /* Minute */
7242 if (!strcasecmp(lang, "pt_BR")) {
7243 res = ast_say_number(chan, tm.tm_min, ints, lang, NULL);
7244 if (!res) {
7245 if (tm.tm_min > 1) {
7246 res = wait_file(chan, ints, "minutes", lang);
7247 } else {
7248 res = wait_file(chan, ints, "minute", lang);
7249 }
7250 }
7251 } else {
7252 if (tm.tm_min == 0) {
7253 res = wait_file(chan, ints, "digits/pt-hora", lang);
7254 if (tm.tm_hour != 1)
7255 if (!res)
7256 res = wait_file(chan, ints, "digits/pt-sss", lang);
7257 } else {
7258 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
7259 }
7260 }
7261 break;
7262 case 'P':
7263 case 'p':
7264 /* AM/PM */
7265 if (!strcasecmp(lang, "pt_BR")) {
7266 if ((tm.tm_hour != 0) && (tm.tm_hour != 12)) {
7267 res = wait_file(chan, ints, "digits/pt-da", lang);
7268 if (!res) {
7269 if ((tm.tm_hour >= 0) && (tm.tm_hour < 12))
7270 res = wait_file(chan, ints, "digits/morning", lang);
7271 else if ((tm.tm_hour >= 12) && (tm.tm_hour < 18))
7272 res = wait_file(chan, ints, "digits/afternoon", lang);
7273 else res = wait_file(chan, ints, "digits/night", lang);
7274 }
7275 }
7276 } else {
7277 if (tm.tm_hour > 12)
7278 res = wait_file(chan, ints, "digits/p-m", lang);
7279 else if (tm.tm_hour && tm.tm_hour < 12)
7280 res = wait_file(chan, ints, "digits/a-m", lang);
7281 }
7282 break;
7283 case 'Q':
7284 /* Shorthand for "Today", "Yesterday", or ABdY */
7285 /* XXX As emphasized elsewhere, this should the native way in your
7286 * language to say the date, with changes in what you say, depending
7287 * upon how recent the date is. XXX */
7288 {
7289 struct timeval now = ast_tvnow();
7290 struct ast_tm tmnow;
7291 time_t beg_today;
7292
7293 ast_localtime(&now, &tmnow, tzone);
7294 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
7295 /* In any case, it saves not having to do ast_mktime() */
7296 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
7297 if (beg_today < t) {
7298 /* Today */
7299 res = wait_file(chan, ints, "digits/today", lang);
7300 } else if (beg_today - 86400 < t) {
7301 /* Yesterday */
7302 res = wait_file(chan, ints, "digits/yesterday", lang);
7303 } else {
7304 res = ast_say_date_with_format_pt(chan, t, ints, lang, "Ad 'digits/pt-de' B 'digits/pt-de' Y", tzone);
7305 }
7306 }
7307 break;
7308 case 'q':
7309 /* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
7310 /* XXX As emphasized elsewhere, this should the native way in your
7311 * language to say the date, with changes in what you say, depending
7312 * upon how recent the date is. XXX */
7313 {
7314 struct timeval now = ast_tvnow();
7315 struct ast_tm tmnow;
7316 time_t beg_today;
7317
7318 ast_localtime(&now, &tmnow, tzone);
7319 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
7320 /* In any case, it saves not having to do ast_mktime() */
7321 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
7322 if (beg_today < t) {
7323 /* Today */
7324 } else if ((beg_today - 86400) < t) {
7325 /* Yesterday */
7326 res = wait_file(chan, ints, "digits/yesterday", lang);
7327 } else if (beg_today - 86400 * 6 < t) {
7328 /* Within the last week */
7329 res = ast_say_date_with_format_pt(chan, t, ints, lang, "A", tzone);
7330 } else {
7331 res = ast_say_date_with_format_pt(chan, t, ints, lang, "Ad 'digits/pt-de' B 'digits/pt-de' Y", tzone);
7332 }
7333 }
7334 break;
7335 case 'R':
7336 res = ast_say_date_with_format_pt(chan, t, ints, lang, "H 'digits/pt-e' M", tzone);
7337 break;
7338 case 'S':
7339 /* Seconds */
7340 if (!strcasecmp(lang, "pt_BR")) {
7341 res = ast_say_number(chan, tm.tm_sec, ints, lang, NULL);
7342 if (!res) {
7343 if (tm.tm_sec > 1) {
7344 res = wait_file(chan, ints, "seconds", lang);
7345 } else {
7346 res = wait_file(chan, ints, "second", lang);
7347 }
7348 }
7349 } else {
7350 if (tm.tm_sec == 0) {
7351 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec);
7352 res = wait_file(chan, ints, nextmsg, lang);
7353 } else if (tm.tm_sec < 10) {
7354 res = wait_file(chan, ints, "digits/oh", lang);
7355 if (!res) {
7356 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec);
7357 res = wait_file(chan, ints, nextmsg, lang);
7358 }
7359 } else if ((tm.tm_sec < 21) || (tm.tm_sec % 10 == 0)) {
7360 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec);
7361 res = wait_file(chan, ints, nextmsg, lang);
7362 } else {
7363 int ten, one;
7364 ten = (tm.tm_sec / 10) * 10;
7365 one = (tm.tm_sec % 10);
7366 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", ten);
7367 res = wait_file(chan, ints, nextmsg, lang);
7368 if (!res) {
7369 /* Fifty, not fifty-zero */
7370 if (one != 0) {
7371 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", one);
7372 res = wait_file(chan, ints, nextmsg, lang);
7373 }
7374 }
7375 }
7376 }
7377 break;
7378 case 'T':
7379 res = ast_say_date_with_format_pt(chan, t, ints, lang, "HMS", tzone);
7380 break;
7381 case ' ':
7382 case ' ':
7383 /* Just ignore spaces and tabs */
7384 break;
7385 default:
7386 /* Unknown character */
7387 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
7388 }
7389 /* Jump out on DTMF */
7390 if (res) {
7391 break;
7392 }
7393 }
7394 return res;
7395}
static int ast_say_date_with_format_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Portuguese syntax.
Definition say.c:7106

References ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_pt(), ast_say_number(), ast_tvnow(), LOG_WARNING, NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by ast_say_date_with_format_pt(), and say_date_with_format().

◆ ast_say_date_with_format_th()

int ast_say_date_with_format_th ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

Thai syntax.

Definition at line 5735 of file say.c.

5736{
5737 struct timeval when = { t, 0 };
5738 struct ast_tm tm;
5739 int res=0, offset, sndoffset;
5740 char sndfile[256], nextmsg[256];
5741
5742 if (format == NULL)
5743 format = "a 'digits/tee' e 'digits/duan' hY I 'digits/naliga' M 'digits/natee'";
5744
5745 ast_localtime(&when, &tm, tzone);
5746
5747 for (offset=0 ; format[offset] != '\0' ; offset++) {
5748 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5749 switch (format[offset]) {
5750 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
5751 case '\'':
5752 /* Literal name of a sound file */
5753 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
5754 sndfile[sndoffset] = format[offset];
5755 }
5756 sndfile[sndoffset] = '\0';
5757 res = wait_file(chan, ints, sndfile, lang);
5758 break;
5759 case 'A':
5760 case 'a':
5761 /* Sunday - Saturday */
5762 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
5763 res = wait_file(chan, ints, nextmsg, lang);
5764 break;
5765 case 'B':
5766 case 'b':
5767 case 'h':
5768 /* January - December */
5769 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
5770 res = wait_file(chan, ints, nextmsg, lang);
5771 break;
5772 case 'm':
5773 /* Month enumerated */
5774 res = ast_say_number(chan, (tm.tm_mon + 1), ints, lang, (char *) NULL);
5775 break;
5776 case 'd':
5777 case 'e':
5778 /* First - Thirtyfirst */
5779 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
5780 break;
5781 case 'Y':
5782 /* Year */
5783 res = ast_say_number(chan, tm.tm_year + 1900 + 543, ints, lang, (char *) NULL);
5784 break;
5785 case 'I':
5786 case 'l':
5787 /* 12-Hour */
5788 if (tm.tm_hour == 0)
5789 ast_copy_string(nextmsg, "digits/24", sizeof(nextmsg));
5790 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
5791 res = wait_file(chan, ints, nextmsg, lang);
5792 break;
5793 case 'H':
5794 case 'k':
5795 /* 24-Hour */
5796 if (tm.tm_hour == 0)
5797 ast_copy_string(nextmsg, "digits/24", sizeof(nextmsg));
5798 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
5799 res = wait_file(chan, ints, nextmsg, lang);
5800 break;
5801 case 'M':
5802 case 'N':
5803 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
5804 break;
5805 case 'P':
5806 case 'p':
5807 break;
5808 case 'Q':
5809 /* Shorthand for "Today", "Yesterday", or ABdY */
5810 /* XXX As emphasized elsewhere, this should the native way in your
5811 * language to say the date, with changes in what you say, depending
5812 * upon how recent the date is. XXX */
5813 {
5814 struct timeval now = ast_tvnow();
5815 struct ast_tm tmnow;
5816 time_t beg_today;
5817
5818 ast_localtime(&now, &tmnow, tzone);
5819 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
5820 /* In any case, it saves not having to do ast_mktime() */
5821 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
5822 if (beg_today < t) {
5823 /* Today */
5824 res = wait_file(chan, ints, "digits/today", lang);
5825 } else if (beg_today - 86400 < t) {
5826 /* Yesterday */
5827 res = wait_file(chan, ints, "digits/yesterday", lang);
5828 } else if (beg_today - 86400 * 6 < t) {
5829 /* Within the last week */
5830 res = ast_say_date_with_format_en(chan, t, ints, lang, "A", tzone);
5831 } else if (beg_today - 2628000 < t) {
5832 /* Less than a month ago - "Sunday, October third" */
5833 res = ast_say_date_with_format_en(chan, t, ints, lang, "ABd", tzone);
5834 } else if (beg_today - 15768000 < t) {
5835 /* Less than 6 months ago - "August seventh" */
5836 res = ast_say_date_with_format_en(chan, t, ints, lang, "Bd", tzone);
5837 } else {
5838 /* More than 6 months ago - "April nineteenth two thousand three" */
5839 res = ast_say_date_with_format_en(chan, t, ints, lang, "BdY", tzone);
5840 }
5841 }
5842 break;
5843 case 'q':
5844 /* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
5845 /* XXX As emphasized elsewhere, this should the native way in your
5846 * language to say the date, with changes in what you say, depending
5847 * upon how recent the date is. XXX */
5848 {
5849 struct timeval now = ast_tvnow();
5850 struct ast_tm tmnow;
5851 time_t beg_today;
5852
5853 ast_localtime(&now, &tmnow, tzone);
5854 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
5855 /* In any case, it saves not having to do ast_mktime() */
5856 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
5857 if (beg_today < t) {
5858 /* Today */
5859 } else if ((beg_today - 86400) < t) {
5860 /* Yesterday */
5861 res = wait_file(chan, ints, "digits/yesterday", lang);
5862 } else if (beg_today - 86400 * 6 < t) {
5863 /* Within the last week */
5864 res = ast_say_date_with_format_en(chan, t, ints, lang, "A", tzone);
5865 } else if (beg_today - 2628000 < t) {
5866 /* Less than a month ago - "Sunday, October third" */
5867 res = ast_say_date_with_format_en(chan, t, ints, lang, "ABd", tzone);
5868 } else if (beg_today - 15768000 < t) {
5869 /* Less than 6 months ago - "August seventh" */
5870 res = ast_say_date_with_format_en(chan, t, ints, lang, "Bd", tzone);
5871 } else {
5872 /* More than 6 months ago - "April nineteenth two thousand three" */
5873 res = ast_say_date_with_format_en(chan, t, ints, lang, "BdY", tzone);
5874 }
5875 }
5876 break;
5877 case 'R':
5878 res = ast_say_date_with_format_en(chan, t, ints, lang, "HM", tzone);
5879 break;
5880 case 'S':
5881 res = ast_say_number(chan, tm.tm_sec, ints, lang, (char *) NULL);
5882 break;
5883 case 'T':
5884 res = ast_say_date_with_format_en(chan, t, ints, lang, "HMS", tzone);
5885 break;
5886 case ' ':
5887 case ' ':
5888 /* Just ignore spaces and tabs */
5889 break;
5890 default:
5891 /* Unknown character */
5892 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5893 }
5894 /* Jump out on DTMF */
5895 if (res) {
5896 break;
5897 }
5898 }
5899 return res;
5900}

References ast_copy_string(), ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_en(), ast_say_number(), ast_tvnow(), LOG_WARNING, NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by say_date_with_format().

◆ ast_say_date_with_format_vi()

int ast_say_date_with_format_vi ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

Vietnamese syntax.

Definition at line 9529 of file say.c.

9530{
9531 struct timeval when = { t, 0 };
9532 struct ast_tm tm;
9533 int res = 0, offset, sndoffset;
9534 char sndfile[256], nextmsg[256];
9535
9536 if (format == NULL)
9537 format = "A 'digits/day' eB 'digits/year' Y 'digits/at' k 'hours' M 'minutes' p";
9538
9539 ast_localtime(&when, &tm, tzone);
9540
9541 for (offset=0 ; format[offset] != '\0' ; offset++) {
9542 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
9543 switch (format[offset]) {
9544 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
9545 case '\'':
9546 /* Literal name of a sound file */
9547 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
9548 sndfile[sndoffset] = format[offset];
9549 }
9550 sndfile[sndoffset] = '\0';
9551 res = wait_file(chan, ints, sndfile, lang);
9552 break;
9553 case 'A':
9554 case 'a':
9555 /* Sunday - Saturday */
9556 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
9557 res = wait_file(chan, ints, nextmsg, lang);
9558 break;
9559 case 'B':
9560 case 'b':
9561 case 'h':
9562 /* January - December */
9563 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
9564 res = wait_file(chan, ints, nextmsg, lang);
9565 break;
9566 case 'm':
9567 /* Month enumerated */
9568 res = ast_say_enumeration(chan, (tm.tm_mon + 1), ints, lang, (char *) NULL);
9569 break;
9570 case 'd':
9571 case 'e':
9572 /* 1 - 31 */
9573 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
9574 break;
9575 case 'Y':
9576 /* Year */
9577 if (tm.tm_year > 99) {
9578 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
9579 } else if (tm.tm_year < 1) {
9580 /* I'm not going to handle 1900 and prior */
9581 /* We'll just be silent on the year, instead of bombing out. */
9582 } else {
9583 res = wait_file(chan, ints, "digits/19", lang);
9584 if (!res) {
9585 if (tm.tm_year <= 9) {
9586 /* 1901 - 1909 */
9587 res = wait_file(chan, ints, "digits/odd", lang);
9588 }
9589
9590 res |= ast_say_number(chan, tm.tm_year, ints, lang, (char *) NULL);
9591 }
9592 }
9593 break;
9594 case 'I':
9595 case 'l':
9596 /* 12-Hour */
9597 if (tm.tm_hour == 0)
9598 ast_copy_string(nextmsg, "digits/12", sizeof(nextmsg));
9599 else if (tm.tm_hour > 12)
9600 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
9601 else
9602 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
9603 res = wait_file(chan, ints, nextmsg, lang);
9604 break;
9605 case 'H':
9606 case 'k':
9607 /* 24-Hour */
9608 if (format[offset] == 'H') {
9609 /* e.g. oh-eight */
9610 if (tm.tm_hour < 10) {
9611 res = wait_file(chan, ints, "digits/0", lang);
9612 }
9613 } else {
9614 /* e.g. eight */
9615 if (tm.tm_hour == 0) {
9616 res = wait_file(chan, ints, "digits/0", lang);
9617 }
9618 }
9619 if (!res) {
9620 if (tm.tm_hour != 0) {
9621 int remaining = tm.tm_hour;
9622 if (tm.tm_hour > 20) {
9623 res = wait_file(chan, ints, "digits/20", lang);
9624 remaining -= 20;
9625 }
9626 if (!res) {
9627 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", remaining);
9628 res = wait_file(chan, ints, nextmsg, lang);
9629 }
9630 }
9631 }
9632 break;
9633 case 'M':
9634 case 'N':
9635 /* Minute */
9636 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
9637 break;
9638 case 'P':
9639 case 'p':
9640 /* AM/PM */
9641 if (tm.tm_hour > 11)
9642 ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
9643 else
9644 ast_copy_string(nextmsg, "digits/a-m", sizeof(nextmsg));
9645 res = wait_file(chan, ints, nextmsg, lang);
9646 break;
9647 case 'Q':
9648 /* Shorthand for "Today", "Yesterday", or ABdY */
9649 /* XXX As emphasized elsewhere, this should the native way in your
9650 * language to say the date, with changes in what you say, depending
9651 * upon how recent the date is. XXX */
9652 {
9653 struct timeval now = ast_tvnow();
9654 struct ast_tm tmnow;
9655 time_t beg_today;
9656
9657 gettimeofday(&now, NULL);
9658 ast_localtime(&now, &tmnow, tzone);
9659 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
9660 /* In any case, it saves not having to do ast_mktime() */
9661 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
9662 if (beg_today < t) {
9663 /* Today */
9664 res = wait_file(chan, ints, "digits/today", lang);
9665 } else if (beg_today - 86400 < t) {
9666 /* Yesterday */
9667 res = wait_file(chan, ints, "digits/yesterday", lang);
9668 } else if (beg_today - 86400 * 6 < t) {
9669 /* Within the last week */
9670 res = ast_say_date_with_format_vi(chan, t, ints, lang, "A", tzone);
9671 } else if (beg_today - 2628000 < t) {
9672 /* Less than a month ago - "Chu nhat ngay 13 thang 2" */
9673 res = ast_say_date_with_format_vi(chan, t, ints, lang, "A 'digits/day' dB", tzone);
9674 } else if (beg_today - 15768000 < t) {
9675 /* Less than 6 months ago - "August seventh" */
9676 res = ast_say_date_with_format_vi(chan, t, ints, lang, "'digits/day' dB", tzone);
9677 } else {
9678 /* More than 6 months ago - "April nineteenth two thousand three" */
9679 res = ast_say_date_with_format_vi(chan, t, ints, lang, "'digits/day' dB 'digits/year' Y", tzone);
9680 }
9681 }
9682 break;
9683 case 'q':
9684 /* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
9685 /* XXX As emphasized elsewhere, this should the native way in your
9686 * language to say the date, with changes in what you say, depending
9687 * upon how recent the date is. XXX */
9688 {
9689 struct timeval now;
9690 struct ast_tm tmnow;
9691 time_t beg_today;
9692
9693 now = ast_tvnow();
9694 ast_localtime(&now, &tmnow, tzone);
9695 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
9696 /* In any case, it saves not having to do ast_mktime() */
9697 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
9698 if (beg_today < t) {
9699 /* Today */
9700 } else if ((beg_today - 86400) < t) {
9701 /* Yesterday */
9702 res = wait_file(chan, ints, "digits/yesterday", lang);
9703 } else if (beg_today - 86400 * 6 < t) {
9704 /* Within the last week */
9705 res = ast_say_date_with_format_en(chan, t, ints, lang, "A", tzone);
9706 } else if (beg_today - 2628000 < t) {
9707 /* Less than a month ago - "Chu nhat ngay 13 thang 2" */
9708 res = ast_say_date_with_format_vi(chan, t, ints, lang, "A 'digits/day' dB", tzone);
9709 } else if (beg_today - 15768000 < t) {
9710 /* Less than 6 months ago - "August seventh" */
9711 res = ast_say_date_with_format_vi(chan, t, ints, lang, "'digits/day' dB", tzone);
9712 } else {
9713 /* More than 6 months ago - "April nineteenth two thousand three" */
9714 res = ast_say_date_with_format_vi(chan, t, ints, lang, "'digits/day' dB 'digits/year' Y", tzone);
9715 }
9716 }
9717 break;
9718 case 'R':
9719 res = ast_say_date_with_format_vi(chan, t, ints, lang, "HM", tzone);
9720 break;
9721 case 'S':
9722 /* Seconds */
9723 res = ast_say_number(chan, tm.tm_sec, ints, lang, (char *) NULL);
9724 break;
9725 case 'T':
9726 res = ast_say_date_with_format_vi(chan, t, ints, lang, "H 'hours' M 'minutes' S 'seconds'", tzone);
9727 break;
9728 case ' ':
9729 case ' ':
9730 /* Just ignore spaces and tabs */
9731 break;
9732 default:
9733 /* Unknown character */
9734 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
9735 }
9736 /* Jump out on DTMF */
9737 if (res) {
9738 break;
9739 }
9740 }
9741 return res;
9742}
static int ast_say_date_with_format_vi(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Vietnamese syntax.
Definition say.c:9529

References ast_copy_string(), ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_en(), ast_say_date_with_format_vi(), ast_say_enumeration(), ast_say_number(), ast_tvnow(), LOG_WARNING, NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by ast_say_date_with_format_vi(), and say_date_with_format().

◆ ast_say_date_with_format_zh()

int ast_say_date_with_format_zh ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

Taiwanese / Chinese syntax.

Definition at line 7398 of file say.c.

7399{
7400 struct timeval when = { t, 0 };
7401 struct ast_tm tm;
7402 int res=0, offset, sndoffset;
7403 char sndfile[256], nextmsg[256];
7404
7405 if (format == NULL)
7406 format = "YBdAkM";
7407
7408 ast_localtime(&when, &tm, tzone);
7409
7410 for (offset=0 ; format[offset] != '\0' ; offset++) {
7411 ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
7412 switch (format[offset]) {
7413 /* NOTE: if you add more options here, please try to be consistent with strftime(3) */
7414 case '\'':
7415 /* Literal name of a sound file */
7416 for (sndoffset = 0; !strchr("\'\0", format[++offset]) && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {
7417 sndfile[sndoffset] = format[offset];
7418 }
7419 sndfile[sndoffset] = '\0';
7420 res = wait_file(chan, ints, sndfile, lang);
7421 break;
7422 case 'A':
7423 case 'a':
7424 /* Sunday - Saturday */
7425 snprintf(nextmsg, sizeof(nextmsg), "digits/day-%d", tm.tm_wday);
7426 res = wait_file(chan, ints, nextmsg, lang);
7427 break;
7428 case 'B':
7429 case 'b':
7430 case 'h':
7431 case 'm':
7432 /* January - December */
7433 snprintf(nextmsg, sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);
7434 res = wait_file(chan, ints, nextmsg, lang);
7435 break;
7436 case 'd':
7437 case 'e':
7438 /* First - Thirtyfirst */
7439 if (!(tm.tm_mday % 10) || (tm.tm_mday < 10)) {
7440 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_mday);
7441 res = wait_file(chan, ints, nextmsg, lang);
7442 } else {
7443 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_mday - (tm.tm_mday % 10));
7444 res = wait_file(chan, ints, nextmsg, lang);
7445 if (!res) {
7446 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_mday % 10);
7447 res = wait_file(chan, ints, nextmsg, lang);
7448 }
7449 }
7450 if (!res) res = wait_file(chan, ints, "digits/day", lang);
7451 break;
7452 case 'Y':
7453 /* Year */
7454 if (tm.tm_year > 99) {
7455 res = wait_file(chan, ints, "digits/2", lang);
7456 if (!res) {
7457 res = wait_file(chan, ints, "digits/thousand", lang);
7458 }
7459 if (tm.tm_year > 100) {
7460 if (!res) {
7461 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", (tm.tm_year - 100) / 10);
7462 res = wait_file(chan, ints, nextmsg, lang);
7463 if (!res) {
7464 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", (tm.tm_year - 100) % 10);
7465 res = wait_file(chan, ints, nextmsg, lang);
7466 }
7467 }
7468 }
7469 if (!res) {
7470 res = wait_file(chan, ints, "digits/year", lang);
7471 }
7472 } else {
7473 if (tm.tm_year < 1) {
7474 /* I'm not going to handle 1900 and prior */
7475 /* We'll just be silent on the year, instead of bombing out. */
7476 } else {
7477 res = wait_file(chan, ints, "digits/1", lang);
7478 if (!res) {
7479 res = wait_file(chan, ints, "digits/9", lang);
7480 }
7481 if (!res) {
7482 if (tm.tm_year <= 9) {
7483 /* 1901 - 1909 */
7484 res = wait_file(chan, ints, "digits/0", lang);
7485 if (!res) {
7486 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_year);
7487 res = wait_file(chan, ints, nextmsg, lang);
7488 }
7489 } else {
7490 /* 1910 - 1999 */
7491 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_year / 10);
7492 res = wait_file(chan, ints, nextmsg, lang);
7493 if (!res) {
7494 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_year % 10);
7495 res = wait_file(chan, ints, nextmsg, lang);
7496 }
7497 }
7498 }
7499 }
7500 if (!res) {
7501 res = wait_file(chan, ints, "digits/year", lang);
7502 }
7503 }
7504 break;
7505 case 'I':
7506 case 'l':
7507 /* 12-Hour */
7508 if (tm.tm_hour == 0)
7509 ast_copy_string(nextmsg, "digits/12", sizeof(nextmsg));
7510 else if (tm.tm_hour > 12)
7511 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
7512 else
7513 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
7514 res = wait_file(chan, ints, nextmsg, lang);
7515 if (!res) {
7516 res = wait_file(chan, ints, "digits/oclock", lang);
7517 }
7518 break;
7519 case 'H':
7520 if (tm.tm_hour < 10) {
7521 res = wait_file(chan, ints, "digits/0", lang);
7522 }
7523 /* XXX Static analysis warns of no break here. No idea if this is
7524 * correct or not
7525 */
7526 case 'k':
7527 /* 24-Hour */
7528 if (!(tm.tm_hour % 10) || tm.tm_hour < 10) {
7529 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
7530 res = wait_file(chan, ints, nextmsg, lang);
7531 } else {
7532 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour - (tm.tm_hour % 10));
7533 res = wait_file(chan, ints, nextmsg, lang);
7534 if (!res) {
7535 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour % 10);
7536 res = wait_file(chan, ints, nextmsg, lang);
7537 }
7538 }
7539 if (!res) {
7540 res = wait_file(chan, ints, "digits/oclock", lang);
7541 }
7542 break;
7543 case 'M':
7544 /* Minute */
7545 if (!(tm.tm_min % 10) || tm.tm_min < 10) {
7546 if (tm.tm_min < 10) {
7547 res = wait_file(chan, ints, "digits/0", lang);
7548 }
7549 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_min);
7550 res = wait_file(chan, ints, nextmsg, lang);
7551 } else {
7552 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_min - (tm.tm_min % 10));
7553 res = wait_file(chan, ints, nextmsg, lang);
7554 if (!res) {
7555 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_min % 10);
7556 res = wait_file(chan, ints, nextmsg, lang);
7557 }
7558 }
7559 if (!res) {
7560 res = wait_file(chan, ints, "minute", lang);
7561 }
7562 break;
7563 case 'P':
7564 case 'p':
7565 /* AM/PM */
7566 if (tm.tm_hour > 11)
7567 ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
7568 else
7569 ast_copy_string(nextmsg, "digits/a-m", sizeof(nextmsg));
7570 res = wait_file(chan, ints, nextmsg, lang);
7571 break;
7572 case 'Q':
7573 /* Shorthand for "Today", "Yesterday", or ABdY */
7574 /* XXX As emphasized elsewhere, this should the native way in your
7575 * language to say the date, with changes in what you say, depending
7576 * upon how recent the date is. XXX */
7577 {
7578 struct timeval now = ast_tvnow();
7579 struct ast_tm tmnow;
7580 time_t beg_today;
7581
7582 ast_localtime(&now, &tmnow, tzone);
7583 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
7584 /* In any case, it saves not having to do ast_mktime() */
7585 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
7586 if (beg_today < t) {
7587 /* Today */
7588 res = wait_file(chan, ints, "digits/today", lang);
7589 } else if (beg_today - 86400 < t) {
7590 /* Yesterday */
7591 res = wait_file(chan, ints, "digits/yesterday", lang);
7592 } else {
7593 res = ast_say_date_with_format_zh(chan, t, ints, lang, "YBdA", tzone);
7594 }
7595 }
7596 break;
7597 case 'q':
7598 /* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
7599 /* XXX As emphasized elsewhere, this should the native way in your
7600 * language to say the date, with changes in what you say, depending
7601 * upon how recent the date is. XXX */
7602 {
7603 struct timeval now = ast_tvnow();
7604 struct ast_tm tmnow;
7605 time_t beg_today;
7606
7607 ast_localtime(&now, &tmnow, tzone);
7608 /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
7609 /* In any case, it saves not having to do ast_mktime() */
7610 beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
7611 if (beg_today < t) {
7612 /* Today */
7613 } else if ((beg_today - 86400) < t) {
7614 /* Yesterday */
7615 res = wait_file(chan, ints, "digits/yesterday", lang);
7616 } else if (beg_today - 86400 * 6 < t) {
7617 /* Within the last week */
7618 res = ast_say_date_with_format_zh(chan, t, ints, lang, "A", tzone);
7619 } else {
7620 res = ast_say_date_with_format_zh(chan, t, ints, lang, "YBdA", tzone);
7621 }
7622 }
7623 break;
7624 case 'R':
7625 res = ast_say_date_with_format_zh(chan, t, ints, lang, "kM", tzone);
7626 break;
7627 case 'S':
7628 /* Seconds */
7629 if (!(tm.tm_sec % 10) || tm.tm_sec < 10) {
7630 if (tm.tm_sec < 10) {
7631 res = wait_file(chan, ints, "digits/0", lang);
7632 }
7633 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec);
7634 res = wait_file(chan, ints, nextmsg, lang);
7635 } else {
7636 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec - (tm.tm_sec % 10));
7637 res = wait_file(chan, ints, nextmsg, lang);
7638 if (!res) {
7639 snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_sec % 10);
7640 res = wait_file(chan, ints, nextmsg, lang);
7641 }
7642 }
7643 if (!res) {
7644 res = wait_file(chan, ints, "second", lang);
7645 }
7646 break;
7647 case 'T':
7648 res = ast_say_date_with_format_zh(chan, t, ints, lang, "HMS", tzone);
7649 break;
7650 case ' ':
7651 case ' ':
7652 /* Just ignore spaces and tabs */
7653 break;
7654 default:
7655 /* Unknown character */
7656 ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
7657 }
7658 /* Jump out on DTMF */
7659 if (res) {
7660 break;
7661 }
7662 }
7663 return res;
7664}
static int ast_say_date_with_format_zh(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Taiwanese / Chinese syntax.
Definition say.c:7398

References ast_copy_string(), ast_debug, ast_localtime(), ast_log, ast_say_date_with_format_zh(), ast_tvnow(), LOG_WARNING, NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_wday, ast_tm::tm_year, and wait_file().

Referenced by ast_say_date_with_format_zh(), and say_date_with_format().

◆ ast_say_datetime_de()

int ast_say_datetime_de ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

German syntax.

Definition at line 8098 of file say.c.

8099{
8100 struct timeval when = { t, 0 };
8101 struct ast_tm tm;
8102 int res = 0;
8103
8104 ast_localtime(&when, &tm, NULL);
8105 res = ast_say_date(chan, t, ints, lang);
8106 if (!res)
8107 ast_say_time(chan, t, ints, lang);
8108 return res;
8109
8110}

References ast_localtime(), ast_say_date, ast_say_time, and NULL.

Referenced by say_datetime().

◆ ast_say_datetime_en()

int ast_say_datetime_en ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

English syntax.

Definition at line 8031 of file say.c.

8032{
8033 struct timeval when = { t, 0 };
8034 struct ast_tm tm;
8035 char fn[256];
8036 int res = 0;
8037 int hour, pm=0;
8038
8039 ast_localtime(&when, &tm, NULL);
8040 if (!res) {
8041 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
8042 res = ast_streamfile(chan, fn, lang);
8043 if (!res)
8044 res = ast_waitstream(chan, ints);
8045 }
8046 if (!res) {
8047 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
8048 res = ast_streamfile(chan, fn, lang);
8049 if (!res)
8050 res = ast_waitstream(chan, ints);
8051 }
8052 if (!res)
8053 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
8054
8055 hour = tm.tm_hour;
8056 if (!hour)
8057 hour = 12;
8058 else if (hour == 12)
8059 pm = 1;
8060 else if (hour > 12) {
8061 hour -= 12;
8062 pm = 1;
8063 }
8064 if (!res)
8065 res = ast_say_number(chan, hour, ints, lang, (char *) NULL);
8066
8067 if (tm.tm_min > 9) {
8068 if (!res)
8069 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
8070 } else if (tm.tm_min) {
8071 if (!res)
8072 res = ast_streamfile(chan, "digits/oh", lang);
8073 if (!res)
8074 res = ast_waitstream(chan, ints);
8075 if (!res)
8076 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
8077 } else {
8078 if (!res)
8079 res = ast_streamfile(chan, "digits/oclock", lang);
8080 if (!res)
8081 res = ast_waitstream(chan, ints);
8082 }
8083 if (pm) {
8084 if (!res)
8085 res = ast_streamfile(chan, "digits/p-m", lang);
8086 } else {
8087 if (!res)
8088 res = ast_streamfile(chan, "digits/a-m", lang);
8089 }
8090 if (!res)
8091 res = ast_waitstream(chan, ints);
8092 if (!res)
8093 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
8094 return res;
8095}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_datetime().

◆ ast_say_datetime_fr()

int ast_say_datetime_fr ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

French syntax.

Definition at line 8127 of file say.c.

8128{
8129 struct timeval when = { t, 0 };
8130 struct ast_tm tm;
8131 char fn[256];
8132 int res = 0;
8133
8134 ast_localtime(&when, &tm, NULL);
8135
8136 if (!res)
8137 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
8138
8139 if (!res) {
8140 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
8141 res = ast_streamfile(chan, fn, lang);
8142 if (!res)
8143 res = ast_waitstream(chan, ints);
8144 }
8145 if (!res) {
8146 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
8147 res = ast_streamfile(chan, fn, lang);
8148 if (!res)
8149 res = ast_waitstream(chan, ints);
8150 }
8151
8152 if (!res)
8153 res = ast_say_number(chan, tm.tm_hour, ints, lang, "f");
8154 if (!res)
8155 res = ast_streamfile(chan, "digits/oclock", lang);
8156 if (tm.tm_min > 0) {
8157 if (!res)
8158 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
8159 }
8160 if (!res)
8161 res = ast_waitstream(chan, ints);
8162 if (!res)
8163 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
8164 return res;
8165}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_datetime().

◆ ast_say_datetime_from_now_en()

int ast_say_datetime_from_now_en ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

English syntax.

Definition at line 8455 of file say.c.

8456{
8457 int res=0;
8458 struct timeval nowtv = ast_tvnow(), when = { t, 0 };
8459 int daydiff;
8460 struct ast_tm tm;
8461 struct ast_tm now;
8462 char fn[256];
8463
8464 ast_localtime(&when, &tm, NULL);
8465 ast_localtime(&nowtv, &now, NULL);
8466 daydiff = now.tm_yday - tm.tm_yday;
8467 if ((daydiff < 0) || (daydiff > 6)) {
8468 /* Day of month and month */
8469 if (!res) {
8470 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
8471 res = ast_streamfile(chan, fn, lang);
8472 if (!res)
8473 res = ast_waitstream(chan, ints);
8474 }
8475 if (!res)
8476 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
8477
8478 } else if (daydiff) {
8479 /* Just what day of the week */
8480 if (!res) {
8481 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
8482 res = ast_streamfile(chan, fn, lang);
8483 if (!res)
8484 res = ast_waitstream(chan, ints);
8485 }
8486 } /* Otherwise, it was today */
8487 if (!res)
8488 res = ast_say_time(chan, t, ints, lang);
8489 return res;
8490}

References ast_localtime(), ast_say_number(), ast_say_time, ast_streamfile(), ast_tvnow(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_yday.

Referenced by say_datetime_from_now().

◆ ast_say_datetime_from_now_fr()

int ast_say_datetime_from_now_fr ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

French syntax.

Definition at line 8493 of file say.c.

8494{
8495 int res=0;
8496 struct timeval nowtv = ast_tvnow(), when = { t, 0 };
8497 int daydiff;
8498 struct ast_tm tm;
8499 struct ast_tm now;
8500 char fn[256];
8501
8502 ast_localtime(&when, &tm, NULL);
8503 ast_localtime(&nowtv, &now, NULL);
8504 daydiff = now.tm_yday - tm.tm_yday;
8505 if ((daydiff < 0) || (daydiff > 6)) {
8506 /* Day of month and month */
8507 if (!res) {
8508 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
8509 res = ast_streamfile(chan, fn, lang);
8510 if (!res)
8511 res = ast_waitstream(chan, ints);
8512 }
8513 if (!res)
8514 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
8515
8516 } else if (daydiff) {
8517 /* Just what day of the week */
8518 if (!res) {
8519 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
8520 res = ast_streamfile(chan, fn, lang);
8521 if (!res)
8522 res = ast_waitstream(chan, ints);
8523 }
8524 } /* Otherwise, it was today */
8525 if (!res)
8526 res = ast_say_time(chan, t, ints, lang);
8527 return res;
8528}

References ast_localtime(), ast_say_number(), ast_say_time, ast_streamfile(), ast_tvnow(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_yday.

Referenced by say_datetime_from_now().

◆ ast_say_datetime_from_now_he()

int ast_say_datetime_from_now_he ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Hebrew syntax.

Definition at line 8581 of file say.c.

8582{
8583 int res = 0;
8584 struct timeval nowt = ast_tvnow(), when = { t, 0 };
8585 int daydiff;
8586 struct ast_tm tm;
8587 struct ast_tm now;
8588 char fn[256];
8589
8590 ast_localtime(&when, &tm, NULL);
8591 ast_localtime(&nowt, &now, NULL);
8592 daydiff = now.tm_yday - tm.tm_yday;
8593 if ((daydiff < 0) || (daydiff > 6)) {
8594 /* Day of month and month */
8595 if (!res) {
8596 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
8597 res = ast_streamfile(chan, fn, lang);
8598 if (!res)
8599 res = ast_waitstream(chan, ints);
8600 }
8601 if (!res) {
8602 res = ast_say_number(chan, tm.tm_mday, ints, lang, "f");
8603 }
8604 } else if (daydiff) {
8605 /* Just what day of the week */
8606 if (!res) {
8607 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
8608 res = ast_streamfile(chan, fn, lang);
8609 if (!res) {
8610 res = ast_waitstream(chan, ints);
8611 }
8612 }
8613 } /* Otherwise, it was today */
8614 if (!res) {
8615 res = ast_say_time(chan, t, ints, lang);
8616 }
8617 return res;
8618}

References ast_localtime(), ast_say_number(), ast_say_time, ast_streamfile(), ast_tvnow(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_yday.

Referenced by say_datetime_from_now().

◆ ast_say_datetime_from_now_ka()

static int ast_say_datetime_from_now_ka ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Georgian syntax.

Definition at line 10078 of file say.c.

10079{
10080 int res=0;
10081 int daydiff;
10082 struct ast_tm tm;
10083 struct ast_tm now;
10084 struct timeval when = { t, 0 }, nowt = ast_tvnow();
10085 char fn[256];
10086
10087 ast_localtime(&when, &tm, NULL);
10088 ast_localtime(&nowt, &now, NULL);
10089 daydiff = now.tm_yday - tm.tm_yday;
10090 if ((daydiff < 0) || (daydiff > 6)) {
10091 /* Day of month and month */
10092 if (!res) {
10093 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
10094 }
10095 if (!res) {
10096 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
10097 res = ast_streamfile(chan, fn, lang);
10098 if (!res) {
10099 res = ast_waitstream(chan, ints);
10100 }
10101 }
10102
10103 } else if (daydiff) {
10104 /* Just what day of the week */
10105 if (!res) {
10106 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
10107 res = ast_streamfile(chan, fn, lang);
10108 if (!res) {
10109 res = ast_waitstream(chan, ints);
10110 }
10111 }
10112 } /* Otherwise, it was today */
10113 if (!res) {
10114 res = ast_say_time(chan, t, ints, lang);
10115 }
10116
10117 return res;
10118}

References ast_localtime(), ast_say_number(), ast_say_time, ast_streamfile(), ast_tvnow(), ast_waitstream(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_yday.

Referenced by say_datetime_from_now().

◆ ast_say_datetime_from_now_pt()

int ast_say_datetime_from_now_pt ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Portuguese syntax.

Definition at line 8531 of file say.c.

8532{
8533 int res=0;
8534 int daydiff;
8535 struct ast_tm tm;
8536 struct ast_tm now;
8537 struct timeval nowtv = ast_tvnow(), when = { t, 0 };
8538 char fn[256];
8539
8540 ast_localtime(&when, &tm, NULL);
8541 ast_localtime(&nowtv, &now, NULL);
8542 daydiff = now.tm_yday - tm.tm_yday;
8543 if ((daydiff < 0) || (daydiff > 6)) {
8544 /* Day of month and month */
8545 if (!res)
8546 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
8547 if (!res)
8548 res = wait_file(chan, ints, "digits/pt-de", lang);
8549 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
8550 if (!res)
8551 res = wait_file(chan, ints, fn, lang);
8552
8553 } else if (daydiff) {
8554 /* Just what day of the week */
8555 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
8556 if (!res)
8557 res = wait_file(chan, ints, fn, lang);
8558 } /* Otherwise, it was today */
8559 if (!strcasecmp(lang, "pt_BR")) {
8560 if (tm.tm_hour > 1) {
8561 ast_copy_string(fn, "digits/pt-as", sizeof(fn));
8562 } else {
8563 ast_copy_string(fn, "digits/pt-a", sizeof(fn));
8564 }
8565 if (!res)
8566 res = wait_file(chan, ints, fn, lang);
8567 } else {
8568 ast_copy_string(fn, "digits/pt-ah", sizeof(fn));
8569 if (!res)
8570 res = wait_file(chan, ints, fn, lang);
8571 if (tm.tm_hour != 1)
8572 if (!res)
8573 res = wait_file(chan, ints, "digits/pt-sss", lang);
8574 if (!res)
8575 res = ast_say_time(chan, t, ints, lang);
8576 }
8577 return res;
8578}

References ast_copy_string(), ast_localtime(), ast_say_number(), ast_say_time, ast_tvnow(), NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_mon, ast_tm::tm_wday, ast_tm::tm_yday, and wait_file().

Referenced by say_datetime_from_now().

◆ ast_say_datetime_gr()

static int ast_say_datetime_gr ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Greek support.

Definition at line 8989 of file say.c.

8990{
8991 struct timeval when = { t, 0 };
8992 struct ast_tm tm;
8993 char fn[256];
8994 int res = 0;
8995
8996 ast_localtime(&when, &tm, NULL);
8997
8998 /* W E E K - D A Y */
8999 if (!res) {
9000 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
9001 res = ast_streamfile(chan, fn, lang);
9002 if (!res)
9003 res = ast_waitstream(chan, ints);
9004 }
9005 /* D A Y */
9006 if (!res) {
9007 gr_say_number_female(tm.tm_mday, chan, ints, lang);
9008 }
9009 /* M O N T H */
9010 if (!res) {
9011 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
9012 res = ast_streamfile(chan, fn, lang);
9013 if (!res)
9014 res = ast_waitstream(chan, ints);
9015 }
9016
9017 res = ast_say_time_gr(chan, t, ints, lang);
9018 return res;
9019}
static int ast_say_time_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Greek support.
Definition say.c:8894

References ast_localtime(), ast_say_time_gr(), ast_streamfile(), ast_waitstream(), gr_say_number_female(), NULL, ast_tm::tm_mday, ast_tm::tm_mon, and ast_tm::tm_wday.

Referenced by say_datetime().

◆ ast_say_datetime_he()

int ast_say_datetime_he ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Hebrew syntax.

Definition at line 8371 of file say.c.

8372{
8373 struct timeval when = { t, 0 };
8374 struct ast_tm tm;
8375 char fn[256];
8376 int res = 0;
8377 int hour;
8378
8379 ast_localtime(&when, &tm, NULL);
8380 if (!res) {
8381 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
8382 res = ast_streamfile(chan, fn, lang);
8383 if (!res) {
8384 res = ast_waitstream(chan, ints);
8385 }
8386 }
8387 if (!res) {
8388 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
8389 res = ast_streamfile(chan, fn, lang);
8390 if (!res) {
8391 res = ast_waitstream(chan, ints);
8392 }
8393 }
8394 if (!res) {
8395 res = ast_say_number(chan, tm.tm_mday, ints, lang, "f");
8396 }
8397
8398 hour = tm.tm_hour;
8399 if (!hour) {
8400 hour = 12;
8401 }
8402
8403 if (!res) {
8404 res = ast_say_number(chan, hour, ints, lang, "f");
8405 }
8406
8407 if (tm.tm_min > 9) {
8408 if (!res) {
8409 res = ast_say_number(chan, tm.tm_min, ints, lang, "f");
8410 }
8411 } else if (tm.tm_min) {
8412 if (!res) {
8413 /* say a leading zero if needed */
8414 res = ast_say_number(chan, 0, ints, lang, "f");
8415 }
8416 if (!res) {
8417 res = ast_waitstream(chan, ints);
8418 }
8419 if (!res) {
8420 res = ast_say_number(chan, tm.tm_min, ints, lang, "f");
8421 }
8422 } else {
8423 if (!res) {
8424 res = ast_waitstream(chan, ints);
8425 }
8426 }
8427 if (!res) {
8428 res = ast_waitstream(chan, ints);
8429 }
8430 if (!res) {
8431 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, "f");
8432 }
8433 return res;
8434}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_datetime().

◆ ast_say_datetime_hu()

int ast_say_datetime_hu ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Hungarian syntax.

Definition at line 8113 of file say.c.

8114{
8115 struct timeval when = { t, 0 };
8116 struct ast_tm tm;
8117 int res = 0;
8118
8119 ast_localtime(&when, &tm, NULL);
8120 res = ast_say_date(chan, t, ints, lang);
8121 if (!res)
8122 ast_say_time(chan, t, ints, lang);
8123 return res;
8124}

References ast_localtime(), ast_say_date, ast_say_time, and NULL.

Referenced by say_datetime().

◆ ast_say_datetime_ja()

int ast_say_datetime_ja ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Definition at line 9022 of file say.c.

9023{
9024 struct timeval tv = { t, 0 };
9025 struct ast_tm tm;
9026 char fn[256];
9027 int res = 0;
9028 int hour, pm = 0;
9029
9030 ast_localtime(&tv, &tm, NULL);
9031
9032 if (!res)
9033 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
9034 if (!res)
9035 res = ast_streamfile(chan, "digits/nen", lang);
9036 if (!res) {
9037 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
9038 res = ast_streamfile(chan, fn, lang);
9039 if (!res)
9040 res = ast_waitstream(chan, ints);
9041 }
9042 if (!res)
9043 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
9044 if (!res)
9045 res = ast_streamfile(chan, "digits/nichi", lang);
9046 if (!res) {
9047 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
9048 res = ast_streamfile(chan, fn, lang);
9049 if (!res)
9050 res = ast_waitstream(chan, ints);
9051 }
9052
9053 hour = tm.tm_hour;
9054 if (!hour)
9055 hour = 12;
9056 else if (hour == 12)
9057 pm = 1;
9058 else if (hour > 12) {
9059 hour -= 12;
9060 pm = 1;
9061 }
9062 if (pm) {
9063 if (!res)
9064 res = ast_streamfile(chan, "digits/p-m", lang);
9065 } else {
9066 if (!res)
9067 res = ast_streamfile(chan, "digits/a-m", lang);
9068 }
9069 if (hour == 9 || hour == 21) {
9070 if (!res)
9071 res = ast_streamfile(chan, "digits/9_2", lang);
9072 } else {
9073 if (!res)
9074 res = ast_say_number(chan, hour, ints, lang, (char *) NULL);
9075 }
9076 if (!res)
9077 res = ast_streamfile(chan, "digits/ji", lang);
9078 if (!res)
9079 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
9080 if (!res)
9081 res = ast_streamfile(chan, "digits/fun", lang);
9082 if (!res)
9083 res = ast_waitstream(chan, ints);
9084 return res;
9085}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_datetime().

◆ ast_say_datetime_ka()

static int ast_say_datetime_ka ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Georgian syntax. Say date, then say time.

Definition at line 10059 of file say.c.

10060{
10061 struct timeval when = { t, 0 };
10062 struct ast_tm tm;
10063 int res = 0;
10064
10065 ast_localtime(&when, &tm, NULL);
10066 res = ast_say_date(chan, t, ints, lang);
10067 if (!res) {
10068 ast_say_time(chan, t, ints, lang);
10069 }
10070 return res;
10071
10072}

References ast_localtime(), ast_say_date, ast_say_time, and NULL.

Referenced by say_datetime().

◆ ast_say_datetime_nl()

int ast_say_datetime_nl ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Dutch syntax.

Definition at line 8168 of file say.c.

8169{
8170 struct timeval when = { t, 0 };
8171 struct ast_tm tm;
8172 int res = 0;
8173
8174 ast_localtime(&when, &tm, NULL);
8175 res = ast_say_date(chan, t, ints, lang);
8176 if (!res) {
8177 res = ast_streamfile(chan, "digits/nl-om", lang);
8178 if (!res)
8179 res = ast_waitstream(chan, ints);
8180 }
8181 if (!res)
8182 ast_say_time(chan, t, ints, lang);
8183 return res;
8184}

References ast_localtime(), ast_say_date, ast_say_time, ast_streamfile(), ast_waitstream(), and NULL.

Referenced by say_datetime().

◆ ast_say_datetime_pt()

int ast_say_datetime_pt ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Portuguese syntax.

Definition at line 8187 of file say.c.

8188{
8189 struct timeval when = { t, 0 };
8190 struct ast_tm tm;
8191 char fn[256];
8192 int res = 0;
8193 int hour, pm=0;
8194
8195 ast_localtime(&when, &tm, NULL);
8196 if (!res) {
8197 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
8198 res = ast_streamfile(chan, fn, lang);
8199 if (!res)
8200 res = ast_waitstream(chan, ints);
8201 }
8202 if (!res) {
8203 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
8204 res = ast_streamfile(chan, fn, lang);
8205 if (!res)
8206 res = ast_waitstream(chan, ints);
8207 }
8208 if (!res)
8209 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
8210
8211 hour = tm.tm_hour;
8212 if (!hour)
8213 hour = 12;
8214 else if (hour == 12)
8215 pm = 1;
8216 else if (hour > 12) {
8217 hour -= 12;
8218 pm = 1;
8219 }
8220 if (!res)
8221 res = ast_say_number(chan, hour, ints, lang, (char *) NULL);
8222
8223 if (tm.tm_min > 9) {
8224 if (!res)
8225 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
8226 } else if (tm.tm_min) {
8227 if (!res)
8228 res = ast_streamfile(chan, "digits/oh", lang);
8229 if (!res)
8230 res = ast_waitstream(chan, ints);
8231 if (!res)
8232 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
8233 } else {
8234 if (!res)
8235 res = ast_streamfile(chan, "digits/oclock", lang);
8236 if (!res)
8237 res = ast_waitstream(chan, ints);
8238 }
8239 if (pm) {
8240 if (!res)
8241 res = ast_streamfile(chan, "digits/p-m", lang);
8242 } else {
8243 if (!res)
8244 res = ast_streamfile(chan, "digits/a-m", lang);
8245 }
8246 if (!res)
8247 res = ast_waitstream(chan, ints);
8248 if (!res)
8249 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
8250 return res;
8251}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_datetime().

◆ ast_say_datetime_pt_BR()

int ast_say_datetime_pt_BR ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Brazilian Portuguese syntax.

Definition at line 8254 of file say.c.

8255{
8256 struct timeval when = { t, 0 };
8257 struct ast_tm tm;
8258 int res = 0;
8259
8260 ast_localtime(&when, &tm, NULL);
8261 res = ast_say_date(chan, t, ints, lang);
8262 if (!res)
8263 res = ast_say_time(chan, t, ints, lang);
8264 return res;
8265}

References ast_localtime(), ast_say_date, ast_say_time, and NULL.

Referenced by say_datetime().

◆ ast_say_datetime_th()

int ast_say_datetime_th ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Thai syntax.

Definition at line 8268 of file say.c.

8269{
8270 struct timeval when = { t, 0 };
8271 struct ast_tm tm;
8272 char fn[256];
8273 int res = 0;
8274 int hour;
8275 ast_localtime(&when, &tm, NULL);
8276 if (!res) {
8277 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
8278 res = ast_streamfile(chan, fn, lang);
8279 if (!res)
8280 res = ast_waitstream(chan, ints);
8281 }
8282 if (!res) {
8283 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
8284 res = ast_streamfile(chan, fn, lang);
8285 if (!res)
8286 res = ast_waitstream(chan, ints);
8287 }
8288 if (!res){
8289 ast_copy_string(fn, "digits/posor", sizeof(fn));
8290 res = ast_streamfile(chan, fn, lang);
8291 res = ast_say_number(chan, tm.tm_year + 1900 + 543, ints, lang, (char *) NULL);
8292 }
8293 if (!res)
8294 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
8295
8296 hour = tm.tm_hour;
8297 if (!hour)
8298 hour = 24;
8299 if (!res){
8300 ast_copy_string(fn, "digits/wela", sizeof(fn));
8301 res = ast_streamfile(chan, fn, lang);
8302 }
8303 if (!res)
8304 res = ast_say_number(chan, hour, ints, lang, (char *) NULL);
8305 if (!res)
8306 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
8307 return res;
8308}

References ast_copy_string(), ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_datetime().

◆ ast_say_datetime_zh()

int ast_say_datetime_zh ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Taiwanese / Chinese syntax.

Definition at line 8311 of file say.c.

8312{
8313 struct timeval when = { t, 0 };
8314 struct ast_tm tm;
8315 char fn[256];
8316 int res = 0;
8317 int hour, pm=0;
8318
8319 ast_localtime(&when, &tm, NULL);
8320 if (!res)
8321 res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
8322 if (!res) {
8323 snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
8324 res = ast_streamfile(chan, fn, lang);
8325 if (!res)
8326 res = ast_waitstream(chan, ints);
8327 }
8328 if (!res)
8329 res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
8330 if (!res) {
8331 snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
8332 res = ast_streamfile(chan, fn, lang);
8333 if (!res)
8334 res = ast_waitstream(chan, ints);
8335 }
8336
8337 hour = tm.tm_hour;
8338 if (!hour)
8339 hour = 12;
8340 else if (hour == 12)
8341 pm = 1;
8342 else if (hour > 12) {
8343 hour -= 12;
8344 pm = 1;
8345 }
8346 if (pm) {
8347 if (!res)
8348 res = ast_streamfile(chan, "digits/p-m", lang);
8349 } else {
8350 if (!res)
8351 res = ast_streamfile(chan, "digits/a-m", lang);
8352 }
8353 if (!res)
8354 res = ast_waitstream(chan, ints);
8355 if (!res)
8356 res = ast_say_number(chan, hour, ints, lang, (char *) NULL);
8357 if (!res)
8358 res = ast_streamfile(chan, "digits/oclock", lang);
8359 if (!res)
8360 res = ast_waitstream(chan, ints);
8361 if (!res)
8362 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
8363 if (!res)
8364 res = ast_streamfile(chan, "minute", lang);
8365 if (!res)
8366 res = ast_waitstream(chan, ints);
8367 return res;
8368}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_wday, and ast_tm::tm_year.

Referenced by say_datetime().

◆ ast_say_enumeration_full_da()

static int ast_say_enumeration_full_da ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_enumeration_full_da: Danish syntax

Definition at line 3802 of file say.c.

3803{
3804 /* options can be: '' or 'm' male gender; 'f' female gender; 'n' neuter gender */
3805 int res = 0, t = 0;
3806 char fn[256] = "", fna[256] = "";
3807 char *gender;
3808
3809 if (options && !strncasecmp(options, "f", 1)) {
3810 gender = "F";
3811 } else if (options && !strncasecmp(options, "n", 1)) {
3812 gender = "N";
3813 } else {
3814 gender = "";
3815 }
3816
3817 if (!num)
3818 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
3819
3820 while (!res && num) {
3821 if (num < 0) {
3822 ast_copy_string(fn, "digits/minus", sizeof(fn)); /* kind of senseless for enumerations, but our best effort for error checking */
3823 if ( num > INT_MIN ) {
3824 num = -num;
3825 } else {
3826 num = 0;
3827 }
3828 } else if (num < 100 && t) {
3829 ast_copy_string(fn, "digits/and", sizeof(fn));
3830 t = 0;
3831 } else if (num < 20) {
3832 snprintf(fn, sizeof(fn), "digits/h-%d%s", num, gender);
3833 num = 0;
3834 } else if (num < 100) {
3835 int ones = num % 10;
3836 if (ones) {
3837 snprintf(fn, sizeof(fn), "digits/%d-and", ones);
3838 num -= ones;
3839 } else {
3840 snprintf(fn, sizeof(fn), "digits/h-%d%s", num, gender);
3841 num = 0;
3842 }
3843 } else if (num == 100 && t == 0) {
3844 snprintf(fn, sizeof(fn), "digits/h-hundred%s", gender);
3845 num = 0;
3846 } else if (num < 1000) {
3847 int hundreds = num / 100;
3848 num = num % 100;
3849 if (hundreds == 1) {
3850 ast_copy_string(fn, "digits/1N", sizeof(fn));
3851 } else {
3852 snprintf(fn, sizeof(fn), "digits/%d", hundreds);
3853 }
3854 if (num) {
3855 ast_copy_string(fna, "digits/hundred", sizeof(fna));
3856 } else {
3857 snprintf(fna, sizeof(fna), "digits/h-hundred%s", gender);
3858 }
3859 t = 1;
3860 } else if (num < 1000000) {
3861 int thousands = num / 1000;
3862 num = num % 1000;
3863 if (thousands == 1) {
3864 if (num) {
3865 ast_copy_string(fn, "digits/1N", sizeof(fn));
3866 ast_copy_string(fna, "digits/thousand", sizeof(fna));
3867 } else {
3868 if (t) {
3869 ast_copy_string(fn, "digits/1N", sizeof(fn));
3870 snprintf(fna, sizeof(fna), "digits/h-thousand%s", gender);
3871 } else {
3872 snprintf(fn, sizeof(fn), "digits/h-thousand%s", gender);
3873 }
3874 }
3875 } else {
3876 res = ast_say_number_full_de(chan, thousands, ints, language, options, audiofd, ctrlfd);
3877 if (res) {
3878 return res;
3879 }
3880 if (num) {
3881 ast_copy_string(fn, "digits/thousand", sizeof(fn));
3882 } else {
3883 snprintf(fn, sizeof(fn), "digits/h-thousand%s", gender);
3884 }
3885 }
3886 t = 1;
3887 } else if (num < 1000000000) {
3888 int millions = num / 1000000;
3889 num = num % 1000000;
3890 if (millions == 1) {
3891 if (num) {
3892 ast_copy_string(fn, "digits/1F", sizeof(fn));
3893 ast_copy_string(fna, "digits/million", sizeof(fna));
3894 } else {
3895 ast_copy_string(fn, "digits/1N", sizeof(fn));
3896 snprintf(fna, sizeof(fna), "digits/h-million%s", gender);
3897 }
3898 } else {
3899 res = ast_say_number_full_de(chan, millions, ints, language, options, audiofd, ctrlfd);
3900 if (res) {
3901 return res;
3902 }
3903 if (num) {
3904 ast_copy_string(fn, "digits/millions", sizeof(fn));
3905 } else {
3906 snprintf(fn, sizeof(fn), "digits/h-million%s", gender);
3907 }
3908 }
3909 t = 1;
3910 } else if (num < INT_MAX) {
3911 int billions = num / 1000000000;
3912 num = num % 1000000000;
3913 if (billions == 1) {
3914 if (num) {
3915 ast_copy_string(fn, "digits/1F", sizeof(fn));
3916 ast_copy_string(fna, "digits/milliard", sizeof(fna));
3917 } else {
3918 ast_copy_string(fn, "digits/1N", sizeof(fn));
3919 snprintf(fna, sizeof(fna), "digits/h-milliard%s", gender);
3920 }
3921 } else {
3922 res = ast_say_number_full_de(chan, billions, ints, language, options, audiofd, ctrlfd);
3923 if (res)
3924 return res;
3925 if (num) {
3926 ast_copy_string(fn, "digits/milliards", sizeof(fna));
3927 } else {
3928 snprintf(fn, sizeof(fna), "digits/h-milliard%s", gender);
3929 }
3930 }
3931 t = 1;
3932 } else if (num == INT_MAX) {
3933 snprintf(fn, sizeof(fn), "digits/h-last%s", gender);
3934 num = 0;
3935 } else {
3936 ast_debug(1, "Number '%d' is too big for me\n", num);
3937 res = -1;
3938 }
3939
3940 if (!res) {
3941 if (!ast_streamfile(chan, fn, language)) {
3942 if ((audiofd > -1) && (ctrlfd > -1))
3943 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
3944 else
3945 res = ast_waitstream(chan, ints);
3946 }
3947 ast_stopstream(chan);
3948 if (!res) {
3949 if (strlen(fna) != 0 && !ast_streamfile(chan, fna, language)) {
3950 if ((audiofd > -1) && (ctrlfd > -1)) {
3951 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
3952 } else {
3953 res = ast_waitstream(chan, ints);
3954 }
3955 }
3956 ast_stopstream(chan);
3957 strcpy(fna, "");
3958 }
3959 }
3960 }
3961 return res;
3962}
static char language[MAX_LANGUAGE]
Definition chan_iax2.c:348
int ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int monfd)
Definition file.c:1883
int ast_stopstream(struct ast_channel *c)
Stops a stream.
Definition file.c:223
static int ast_say_number_full_de(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_de: German syntax
Definition say.c:1196
int ast_say_digits_full(struct ast_channel *chan, int num, const char *ints, const char *lang, int audiofd, int ctrlfd)
Same as ast_say_digits() with audiofd for received audio and returns 1 on ctrlfd being readable.
Definition channel.c:8327
static struct test_options options

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_de(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), language, and options.

Referenced by say_enumeration_full().

◆ ast_say_enumeration_full_de()

static int ast_say_enumeration_full_de ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_enumeration_full_de: German syntax

Definition at line 3965 of file say.c.

3966{
3967 /* options can be: '' or 'm' male gender; 'f' female gender; 'n' neuter gender */
3968 int res = 0, t = 0;
3969 char fn[256] = "", fna[256] = "";
3970 char *gender;
3971
3972 if (options && !strncasecmp(options, "f", 1)) {
3973 gender = "F";
3974 } else if (options && !strncasecmp(options, "n", 1)) {
3975 gender = "N";
3976 } else {
3977 gender = "";
3978 }
3979
3980 if (!num)
3981 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
3982
3983 while (!res && num) {
3984 if (num < 0) {
3985 ast_copy_string(fn, "digits/minus", sizeof(fn)); /* kind of senseless for enumerations, but our best effort for error checking */
3986 if ( num > INT_MIN ) {
3987 num = -num;
3988 } else {
3989 num = 0;
3990 }
3991 } else if (num < 100 && t) {
3992 ast_copy_string(fn, "digits/and", sizeof(fn));
3993 t = 0;
3994 } else if (num < 20) {
3995 snprintf(fn, sizeof(fn), "digits/h-%d%s", num, gender);
3996 num = 0;
3997 } else if (num < 100) {
3998 int ones = num % 10;
3999 if (ones) {
4000 snprintf(fn, sizeof(fn), "digits/%d-and", ones);
4001 num -= ones;
4002 } else {
4003 snprintf(fn, sizeof(fn), "digits/h-%d%s", num, gender);
4004 num = 0;
4005 }
4006 } else if (num == 100 && t == 0) {
4007 snprintf(fn, sizeof(fn), "digits/h-hundred%s", gender);
4008 num = 0;
4009 } else if (num < 1000) {
4010 int hundreds = num / 100;
4011 num = num % 100;
4012 if (hundreds == 1) {
4013 ast_copy_string(fn, "digits/1N", sizeof(fn));
4014 } else {
4015 snprintf(fn, sizeof(fn), "digits/%d", hundreds);
4016 }
4017 if (num) {
4018 ast_copy_string(fna, "digits/hundred", sizeof(fna));
4019 } else {
4020 snprintf(fna, sizeof(fna), "digits/h-hundred%s", gender);
4021 }
4022 t = 1;
4023 } else if (num < 1000000) {
4024 int thousands = num / 1000;
4025 num = num % 1000;
4026 if (thousands == 1) {
4027 if (num) {
4028 ast_copy_string(fn, "digits/1N", sizeof(fn));
4029 ast_copy_string(fna, "digits/thousand", sizeof(fna));
4030 } else {
4031 if (t) {
4032 ast_copy_string(fn, "digits/1N", sizeof(fn));
4033 snprintf(fna, sizeof(fna), "digits/h-thousand%s", gender);
4034 } else {
4035 snprintf(fn, sizeof(fn), "digits/h-thousand%s", gender);
4036 }
4037 }
4038 } else {
4039 res = ast_say_number_full_de(chan, thousands, ints, language, options, audiofd, ctrlfd);
4040 if (res) {
4041 return res;
4042 }
4043 if (num) {
4044 ast_copy_string(fn, "digits/thousand", sizeof(fn));
4045 } else {
4046 snprintf(fn, sizeof(fn), "digits/h-thousand%s", gender);
4047 }
4048 }
4049 t = 1;
4050 } else if (num < 1000000000) {
4051 int millions = num / 1000000;
4052 num = num % 1000000;
4053 if (millions == 1) {
4054 if (num) {
4055 ast_copy_string(fn, "digits/1F", sizeof(fn));
4056 ast_copy_string(fna, "digits/million", sizeof(fna));
4057 } else {
4058 ast_copy_string(fn, "digits/1N", sizeof(fn));
4059 snprintf(fna, sizeof(fna), "digits/h-million%s", gender);
4060 }
4061 } else {
4062 res = ast_say_number_full_de(chan, millions, ints, language, options, audiofd, ctrlfd);
4063 if (res) {
4064 return res;
4065 }
4066 if (num) {
4067 ast_copy_string(fn, "digits/millions", sizeof(fn));
4068 } else {
4069 snprintf(fn, sizeof(fn), "digits/h-million%s", gender);
4070 }
4071 }
4072 t = 1;
4073 } else if (num < INT_MAX) {
4074 int billions = num / 1000000000;
4075 num = num % 1000000000;
4076 if (billions == 1) {
4077 if (num) {
4078 ast_copy_string(fn, "digits/1F", sizeof(fn));
4079 ast_copy_string(fna, "digits/milliard", sizeof(fna));
4080 } else {
4081 ast_copy_string(fn, "digits/1N", sizeof(fn));
4082 snprintf(fna, sizeof(fna), "digits/h-milliard%s", gender);
4083 }
4084 } else {
4085 res = ast_say_number_full_de(chan, billions, ints, language, options, audiofd, ctrlfd);
4086 if (res)
4087 return res;
4088 if (num) {
4089 ast_copy_string(fn, "digits/milliards", sizeof(fna));
4090 } else {
4091 snprintf(fn, sizeof(fna), "digits/h-milliard%s", gender);
4092 }
4093 }
4094 t = 1;
4095 } else if (num == INT_MAX) {
4096 snprintf(fn, sizeof(fn), "digits/h-last%s", gender);
4097 num = 0;
4098 } else {
4099 ast_debug(1, "Number '%d' is too big for me\n", num);
4100 res = -1;
4101 }
4102
4103 if (!res) {
4104 if (!ast_streamfile(chan, fn, language)) {
4105 if ((audiofd > -1) && (ctrlfd > -1))
4106 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
4107 else
4108 res = ast_waitstream(chan, ints);
4109 }
4110 ast_stopstream(chan);
4111 if (!res) {
4112 if (strlen(fna) != 0 && !ast_streamfile(chan, fna, language)) {
4113 if ((audiofd > -1) && (ctrlfd > -1)) {
4114 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
4115 } else {
4116 res = ast_waitstream(chan, ints);
4117 }
4118 }
4119 ast_stopstream(chan);
4120 strcpy(fna, "");
4121 }
4122 }
4123 }
4124 return res;
4125}

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_de(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), language, and options.

Referenced by say_enumeration_full().

◆ ast_say_enumeration_full_dr()

static int ast_say_enumeration_full_dr ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

ast_say_enumeration_full_dr: Dari syntax

Note
This is the default syntax, if no other syntax defined in this file is used

Definition at line 3685 of file say.c.

3686{
3687 int res = 0, t = 0;
3688 char fn[256] = "";
3689
3690 while (!res && num) {
3691 if (num < 0) {
3692 ast_copy_string(fn, "digits/minus", sizeof(fn)); /* kind of senseless for enumerations, but our best effort for error checking */
3693 if ( num > INT_MIN ) {
3694 num = -num;
3695 } else {
3696 num = 0;
3697 }
3698 } else if (num <= 31) {
3699 snprintf(fn, sizeof(fn), "digits/h-%d", num);
3700 num = 0;
3701 } else if (num < 100) {
3702 int tens = num / 10;
3703 num = num % 10;
3704 if (num == 0) {
3705 snprintf(fn, sizeof(fn), "digits/h-%d", (tens * 10));
3706 } else {
3707 snprintf(fn, sizeof(fn), "digits/%d", (tens * 10));
3708 }
3709 } else if (num < 1000) {
3710 int hundreds = num / 100;
3711 num = num % 100;
3712 if (hundreds > 1 || t == 1) {
3713 res = ast_say_number_full_en(chan, hundreds, ints, language, audiofd, ctrlfd);
3714 }
3715 if (res)
3716 return res;
3717 if (num) {
3718 ast_copy_string(fn, "digits/hundred", sizeof(fn));
3719 } else {
3720 ast_copy_string(fn, "digits/h-hundred", sizeof(fn));
3721 }
3722 } else if (num < 1000000) {
3723 int thousands = num / 1000;
3724 num = num % 1000;
3725 if (thousands > 1 || t == 1) {
3726 res = ast_say_number_full_en(chan, thousands, ints, language, audiofd, ctrlfd);
3727 }
3728 if (res)
3729 return res;
3730 if (num) {
3731 ast_copy_string(fn, "digits/thousand", sizeof(fn));
3732 } else {
3733 ast_copy_string(fn, "digits/h-thousand", sizeof(fn));
3734 }
3735 t = 1;
3736 } else if (num < 1000000000) {
3737 int millions = num / 1000000;
3738 num = num % 1000000;
3739 t = 1;
3740 res = ast_say_number_full_en(chan, millions, ints, language, audiofd, ctrlfd);
3741 if (res)
3742 return res;
3743 if (num) {
3744 ast_copy_string(fn, "digits/million", sizeof(fn));
3745 } else {
3746 ast_copy_string(fn, "digits/h-million", sizeof(fn));
3747 }
3748 } else if (num < INT_MAX) {
3749 int billions = num / 1000000000;
3750 num = num % 1000000000;
3751 t = 1;
3752 res = ast_say_number_full_en(chan, billions, ints, language, audiofd, ctrlfd);
3753 if (res)
3754 return res;
3755 if (num) {
3756 ast_copy_string(fn, "digits/billion", sizeof(fn));
3757 } else {
3758 ast_copy_string(fn, "digits/h-billion", sizeof(fn));
3759 }
3760 } else if (num == INT_MAX) {
3761 ast_copy_string(fn, "digits/h-last", sizeof(fn));
3762 num = 0;
3763 } else {
3764 ast_debug(1, "Number '%d' is too big for me\n", num);
3765 res = -1;
3766 }
3767
3768 if (!res) {
3769 if (!ast_streamfile(chan, fn, language)) {
3770 if ((audiofd > -1) && (ctrlfd > -1)) {
3771 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
3772 } else {
3773 res = ast_waitstream(chan, ints);
3774 }
3775 }
3776 ast_stopstream(chan);
3777 }
3778 }
3779 return res;
3780}
static int ast_say_number_full_en(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_en: English syntax
Definition say.c:941

References ast_copy_string(), ast_debug, ast_say_number_full_en(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by say_enumeration_full().

◆ ast_say_enumeration_full_en()

static int ast_say_enumeration_full_en ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

ast_say_enumeration_full_en: English syntax

Note
This is the default syntax, if no other syntax defined in this file is used

Definition at line 3487 of file say.c.

3488{
3489 int res = 0, t = 0;
3490 char fn[256] = "";
3491
3492 while (!res && num) {
3493 if (num < 0) {
3494 ast_copy_string(fn, "digits/minus", sizeof(fn)); /* kind of senseless for enumerations, but our best effort for error checking */
3495 if ( num > INT_MIN ) {
3496 num = -num;
3497 } else {
3498 num = 0;
3499 }
3500 } else if (num < 20) {
3501 snprintf(fn, sizeof(fn), "digits/h-%d", num);
3502 num = 0;
3503 } else if (num < 100) {
3504 int tens = num / 10;
3505 num = num % 10;
3506 if (num == 0) {
3507 snprintf(fn, sizeof(fn), "digits/h-%d", (tens * 10));
3508 } else {
3509 snprintf(fn, sizeof(fn), "digits/%d", (tens * 10));
3510 }
3511 } else if (num < 1000) {
3512 int hundreds = num / 100;
3513 num = num % 100;
3514 if (hundreds > 1 || t == 1) {
3515 res = ast_say_number_full_en(chan, hundreds, ints, language, audiofd, ctrlfd);
3516 }
3517 if (res)
3518 return res;
3519 if (num) {
3520 ast_copy_string(fn, "digits/hundred", sizeof(fn));
3521 } else {
3522 ast_copy_string(fn, "digits/h-hundred", sizeof(fn));
3523 }
3524 } else if (num < 1000000) {
3525 int thousands = num / 1000;
3526 num = num % 1000;
3527 if (thousands > 1 || t == 1) {
3528 res = ast_say_number_full_en(chan, thousands, ints, language, audiofd, ctrlfd);
3529 }
3530 if (res)
3531 return res;
3532 if (num) {
3533 ast_copy_string(fn, "digits/thousand", sizeof(fn));
3534 } else {
3535 ast_copy_string(fn, "digits/h-thousand", sizeof(fn));
3536 }
3537 t = 1;
3538 } else if (num < 1000000000) {
3539 int millions = num / 1000000;
3540 num = num % 1000000;
3541 t = 1;
3542 res = ast_say_number_full_en(chan, millions, ints, language, audiofd, ctrlfd);
3543 if (res)
3544 return res;
3545 if (num) {
3546 ast_copy_string(fn, "digits/million", sizeof(fn));
3547 } else {
3548 ast_copy_string(fn, "digits/h-million", sizeof(fn));
3549 }
3550 } else if (num < INT_MAX) {
3551 int billions = num / 1000000000;
3552 num = num % 1000000000;
3553 t = 1;
3554 res = ast_say_number_full_en(chan, billions, ints, language, audiofd, ctrlfd);
3555 if (res)
3556 return res;
3557 if (num) {
3558 ast_copy_string(fn, "digits/billion", sizeof(fn));
3559 } else {
3560 ast_copy_string(fn, "digits/h-billion", sizeof(fn));
3561 }
3562 } else if (num == INT_MAX) {
3563 ast_copy_string(fn, "digits/h-last", sizeof(fn));
3564 num = 0;
3565 } else {
3566 ast_debug(1, "Number '%d' is too big for me\n", num);
3567 res = -1;
3568 }
3569
3570 if (!res) {
3571 if (!ast_streamfile(chan, fn, language)) {
3572 if ((audiofd > -1) && (ctrlfd > -1)) {
3573 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
3574 } else {
3575 res = ast_waitstream(chan, ints);
3576 }
3577 }
3578 ast_stopstream(chan);
3579 }
3580 }
3581 return res;
3582}

References ast_copy_string(), ast_debug, ast_say_number_full_en(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by say_enumeration_full().

◆ ast_say_enumeration_full_he()

static int ast_say_enumeration_full_he ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

Definition at line 4127 of file say.c.

4128{
4129 int res = 0;
4130 char fn[256] = "";
4131 int mf = -1; /* +1 = Masculin; -1 = Feminin */
4132 ast_verb(3, "ast_say_digits_full: started. num: %d, options=\"%s\"\n", num, options);
4133
4134 if (options && !strncasecmp(options, "m", 1)) {
4135 mf = -1;
4136 }
4137
4138 ast_verb(3, "ast_say_digits_full: num: %d, options=\"%s\", mf=%d\n", num, options, mf);
4139
4140 while (!res && num) {
4141 if (num < 0) {
4142 snprintf(fn, sizeof(fn), "digits/minus"); /* kind of senseless for enumerations, but our best effort for error checking */
4143 if (num > INT_MIN) {
4144 num = -num;
4145 } else {
4146 num = 0;
4147 }
4148 } else if (num < 21) {
4149 if (mf < 0) {
4150 if (num < 10) {
4151 snprintf(fn, sizeof(fn), "digits/f-0%d", num);
4152 } else {
4153 snprintf(fn, sizeof(fn), "digits/f-%d", num);
4154 }
4155 } else {
4156 if (num < 10) {
4157 snprintf(fn, sizeof(fn), "digits/m-0%d", num);
4158 } else {
4159 snprintf(fn, sizeof(fn), "digits/m-%d", num);
4160 }
4161 }
4162 num = 0;
4163 } else if ((num < 100) && num >= 20) {
4164 snprintf(fn, sizeof(fn), "digits/%d", (num / 10) * 10);
4165 num = num % 10;
4166 } else if ((num >= 100) && (num < 1000)) {
4167 int tmpnum = num / 100;
4168 snprintf(fn, sizeof(fn), "digits/%d00", tmpnum);
4169 num = num - (tmpnum * 100);
4170 } else if ((num >= 1000) && (num < 10000)) {
4171 int tmpnum = num / 1000;
4172 snprintf(fn, sizeof(fn), "digits/%dk", tmpnum);
4173 num = num - (tmpnum * 1000);
4174 } else if (num < 20000) {
4175 snprintf(fn, sizeof(fn), "digits/m-%d", (num / 1000));
4176 num = num % 1000;
4177 } else if (num < 1000000) {
4178 res = ast_say_number_full_he(chan, num / 1000, ints, language, "m", audiofd, ctrlfd);
4179 if (res) {
4180 return res;
4181 }
4182 snprintf(fn, sizeof(fn), "digits/1k");
4183 num = num % 1000;
4184 } else if (num < 2000000) {
4185 snprintf(fn, sizeof(fn), "digits/1m");
4186 num = num % 1000000;
4187 } else if (num < 3000000) {
4188 snprintf(fn, sizeof(fn), "digits/2m");
4189 num = num - 2000000;
4190 } else if (num < 1000000000) {
4191 res = ast_say_number_full_he(chan, num / 1000000, ints, language, "m", audiofd, ctrlfd);
4192 if (res) {
4193 return res;
4194 }
4195 snprintf(fn, sizeof(fn), "digits/1m");
4196 num = num % 1000000;
4197 } else {
4198 ast_debug(1, "Number '%d' is too big for me\n", num);
4199 res = -1;
4200 }
4201 if (!res) {
4202 if (!ast_streamfile(chan, fn, language)) {
4203 if ((audiofd > -1) && (ctrlfd > -1)) {
4204 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
4205 } else {
4206 res = ast_waitstream(chan, ints);
4207 }
4208 }
4209 ast_stopstream(chan);
4210 }
4211 }
4212 return res;
4213}
#define ast_verb(level,...)

References ast_debug, ast_say_number_full_he(), ast_stopstream(), ast_streamfile(), ast_verb, ast_waitstream(), ast_waitstream_full(), language, and options.

Referenced by say_enumeration_full().

◆ ast_say_enumeration_full_is()

static int ast_say_enumeration_full_is ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_enumeration_full_is: Icelandic syntax

Definition at line 4216 of file say.c.

4217{
4218 /* options can be: '' or 'm' male gender; 'f' female gender; 'n' neuter gender */
4219 int res = 0, t = 0;
4220 char fn[256] = "", fna[256] = "";
4221 char *gender;
4222
4223 if (options && !strncasecmp(options, "f", 1)) {
4224 gender = "F";
4225 } else if (options && !strncasecmp(options, "n", 1)) {
4226 gender = "N";
4227 } else {
4228 gender = "";
4229 }
4230
4231 if (!num)
4232 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
4233
4234 while (!res && num) {
4235 if (num < 0) {
4236 ast_copy_string(fn, "digits/minus", sizeof(fn)); /* kind of senseless for enumerations, but our best effort for error checking */
4237 if ( num > INT_MIN ) {
4238 num = -num;
4239 } else {
4240 num = 0;
4241 }
4242 } else if (num < 100 && t) {
4243 ast_copy_string(fn, "digits/and", sizeof(fn));
4244 t = 0;
4245 } else if (num < 20) {
4246 snprintf(fn, sizeof(fn), "digits/h-%d%s", num, gender);
4247 num = 0;
4248 } else if (num < 100) {
4249 int ones = num % 10;
4250 if (ones) {
4251 int tens = num - ones;
4252 snprintf(fn, sizeof(fn), "digits/h-%d%s", tens, gender);
4253 num = ones;
4254 t++;
4255 }
4256 else if (t) {
4257 snprintf(fn, sizeof(fn), "digits/and");
4258 t = 0;
4259 }
4260 else {
4261 snprintf(fn, sizeof(fn), "digits/h-%d%s", num, gender);
4262 num = 0;
4263 }
4264
4265 } else if (num == 100 && t == 0) {
4266 snprintf(fn, sizeof(fn), "digits/h-hundred%s", gender);
4267 num = 0;
4268 } else if (num < 1000) {
4269 int hundreds = num / 100;
4270 num = num % 100;
4271 if (hundreds == 1) {
4272 ast_copy_string(fn, "digits/1hk", sizeof(fn));
4273 } else {
4274 snprintf(fn, sizeof(fn), "digits/%d", hundreds);
4275 }
4276 if (num) {
4277 ast_copy_string(fna, "digits/hundred", sizeof(fna));
4278 } else {
4279 snprintf(fna, sizeof(fna), "digits/h-hundred%s", gender);
4280 }
4281 t = 1;
4282 } else if (num < 1000000) {
4283 int thousands = num / 1000;
4284 num = num % 1000;
4285 if (thousands == 1) {
4286 if (num) {
4287 /* Thousand is a neutral word, so use the neutral recording */
4288 ast_copy_string(fn, "digits/1hk", sizeof(fn));
4289 ast_copy_string(fna, "digits/thousand", sizeof(fna));
4290 } else {
4291 if (t) {
4292 ast_copy_string(fn, "digits/1hk", sizeof(fn));
4293 snprintf(fna, sizeof(fna), "digits/h-thousand%s", gender);
4294 } else {
4295 snprintf(fn, sizeof(fn), "digits/h-thousand%s", gender);
4296 }
4297 }
4298 } else {
4299 res = ast_say_number_full_is(chan, thousands, ints, language, options, audiofd, ctrlfd);
4300 if (res) {
4301 return res;
4302 }
4303 if (num) {
4304 ast_copy_string(fn, "digits/thousand", sizeof(fn));
4305 } else {
4306 snprintf(fn, sizeof(fn), "digits/h-thousand%s", gender);
4307 }
4308 }
4309 if (num)
4310 t = 1;
4311 } else if (num < 1000000000) {
4312 int millions = num / 1000000;
4313 num = num % 1000000;
4314 if (millions == 1) {
4315 if (num) {
4316 /* Million is a feminine word, so use the female form */
4317 ast_copy_string(fn, "digits/1kvk", sizeof(fn));
4318 ast_copy_string(fna, "digits/million", sizeof(fna));
4319 } else {
4320 ast_copy_string(fn, "digits/1hk", sizeof(fn));
4321 snprintf(fna, sizeof(fna), "digits/h-million%s", gender);
4322 }
4323 } else {
4324 res = ast_say_number_full_is(chan, millions, ints, language, options, audiofd, ctrlfd);
4325 if (res) {
4326 return res;
4327 }
4328 if (num) {
4329 ast_copy_string(fn, "digits/millions", sizeof(fn));
4330 } else {
4331 snprintf(fn, sizeof(fn), "digits/h-million%s", gender);
4332 }
4333 }
4334 if (num)
4335 t = 1;
4336 } else if (num < INT_MAX) {
4337 int billions = num / 1000000000;
4338 num = num % 1000000000;
4339 if (billions == 1) {
4340 if (num) {
4341 ast_copy_string(fn, "digits/1", sizeof(fn));
4342 ast_copy_string(fna, "digits/milliard", sizeof(fna));
4343 } else {
4344 ast_copy_string(fn, "digits/1hk", sizeof(fn));
4345 snprintf(fna, sizeof(fna), "digits/h-milliard%s", gender);
4346 }
4347 } else {
4348 res = ast_say_number_full_is(chan, billions, ints, language, options, audiofd, ctrlfd);
4349 if (res)
4350 return res;
4351 if (num) {
4352 ast_copy_string(fn, "digits/milliards", sizeof(fna));
4353 } else {
4354 snprintf(fn, sizeof(fna), "digits/h-milliard%s", gender);
4355 }
4356 }
4357 if (num)
4358 t = 1;
4359 } else if (num == INT_MAX) {
4360 snprintf(fn, sizeof(fn), "digits/h-last%s", gender);
4361 num = 0;
4362 } else {
4363 ast_debug(1, "Number '%d' is too big for me\n", num);
4364 res = -1;
4365 }
4366
4367 if (!res) {
4368 if (!ast_streamfile(chan, fn, language)) {
4369 if ((audiofd > -1) && (ctrlfd > -1))
4370 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
4371 else
4372 res = ast_waitstream(chan, ints);
4373 }
4374 ast_stopstream(chan);
4375 if (!res) {
4376 if (strlen(fna) != 0 && !ast_streamfile(chan, fna, language)) {
4377 if ((audiofd > -1) && (ctrlfd > -1)) {
4378 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
4379 } else {
4380 res = ast_waitstream(chan, ints);
4381 }
4382 }
4383 ast_stopstream(chan);
4384 strcpy(fna, "");
4385 }
4386 }
4387 }
4388 return res;
4389}
static int ast_say_number_full_is(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_is: Icelandic syntax
Definition say.c:2081

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_is(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), language, and options.

Referenced by say_enumeration_full().

◆ ast_say_enumeration_full_ps()

static int ast_say_enumeration_full_ps ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

ast_say_enumeration_full_ps: Pashto syntax

Note
This is the default syntax, if no other syntax defined in this file is used

Definition at line 3586 of file say.c.

3587{
3588 int res = 0, t = 0;
3589 char fn[256] = "";
3590
3591 while (!res && num) {
3592 if (num < 0) {
3593 ast_copy_string(fn, "digits/minus", sizeof(fn)); /* kind of senseless for enumerations, but our best effort for error checking */
3594 if ( num > INT_MIN ) {
3595 num = -num;
3596 } else {
3597 num = 0;
3598 }
3599 } else if (num <= 31) {
3600 snprintf(fn, sizeof(fn), "digits/h-%d", num);
3601 num = 0;
3602 } else if (num < 100) {
3603 int tens = num / 10;
3604 num = num % 10;
3605 if (num == 0) {
3606 snprintf(fn, sizeof(fn), "digits/h-%d", (tens * 10));
3607 } else {
3608 snprintf(fn, sizeof(fn), "digits/%d", (tens * 10));
3609 }
3610 } else if (num < 1000) {
3611 int hundreds = num / 100;
3612 num = num % 100;
3613 if (hundreds > 1 || t == 1) {
3614 res = ast_say_number_full_en(chan, hundreds, ints, language, audiofd, ctrlfd);
3615 }
3616 if (res)
3617 return res;
3618 if (num) {
3619 ast_copy_string(fn, "digits/hundred", sizeof(fn));
3620 } else {
3621 ast_copy_string(fn, "digits/h-hundred", sizeof(fn));
3622 }
3623 } else if (num < 1000000) {
3624 int thousands = num / 1000;
3625 num = num % 1000;
3626 if (thousands > 1 || t == 1) {
3627 res = ast_say_number_full_en(chan, thousands, ints, language, audiofd, ctrlfd);
3628 }
3629 if (res)
3630 return res;
3631 if (num) {
3632 ast_copy_string(fn, "digits/thousand", sizeof(fn));
3633 } else {
3634 ast_copy_string(fn, "digits/h-thousand", sizeof(fn));
3635 }
3636 t = 1;
3637 } else if (num < 1000000000) {
3638 int millions = num / 1000000;
3639 num = num % 1000000;
3640 t = 1;
3641 res = ast_say_number_full_en(chan, millions, ints, language, audiofd, ctrlfd);
3642 if (res)
3643 return res;
3644 if (num) {
3645 ast_copy_string(fn, "digits/million", sizeof(fn));
3646 } else {
3647 ast_copy_string(fn, "digits/h-million", sizeof(fn));
3648 }
3649 } else if (num < INT_MAX) {
3650 int billions = num / 1000000000;
3651 num = num % 1000000000;
3652 t = 1;
3653 res = ast_say_number_full_en(chan, billions, ints, language, audiofd, ctrlfd);
3654 if (res)
3655 return res;
3656 if (num) {
3657 ast_copy_string(fn, "digits/billion", sizeof(fn));
3658 } else {
3659 ast_copy_string(fn, "digits/h-billion", sizeof(fn));
3660 }
3661 } else if (num == INT_MAX) {
3662 ast_copy_string(fn, "digits/h-last", sizeof(fn));
3663 num = 0;
3664 } else {
3665 ast_debug(1, "Number '%d' is too big for me\n", num);
3666 res = -1;
3667 }
3668
3669 if (!res) {
3670 if (!ast_streamfile(chan, fn, language)) {
3671 if ((audiofd > -1) && (ctrlfd > -1)) {
3672 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
3673 } else {
3674 res = ast_waitstream(chan, ints);
3675 }
3676 }
3677 ast_stopstream(chan);
3678 }
3679 }
3680 return res;
3681}

References ast_copy_string(), ast_debug, ast_say_number_full_en(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by say_enumeration_full().

◆ ast_say_enumeration_full_vi()

static int ast_say_enumeration_full_vi ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

Definition at line 3782 of file say.c.

3783{
3784 int res = 0;
3785 char fn[256] = "";
3786 ast_copy_string(fn, "digits/h", sizeof(fn));
3787 if (!res) {
3788 if (!ast_streamfile(chan, fn, language)) {
3789 if ((audiofd > -1) && (ctrlfd > -1)) {
3790 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
3791 } else {
3792 res = ast_waitstream(chan, ints);
3793 }
3794 }
3795 ast_stopstream(chan);
3796 }
3797
3798 return ast_say_number_full_vi(chan, num, ints, language, audiofd, ctrlfd);
3799}
static int ast_say_number_full_vi(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_vi: Vietnamese syntax
Definition say.c:3365

References ast_copy_string(), ast_say_number_full_vi(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by say_enumeration_full().

◆ ast_say_number_full_cs()

static int ast_say_number_full_cs ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_cs: Czech syntax

files needed:

  • 1m,2m - gender male
  • 1w,2w - gender female
  • 3,4,...,20
  • 30,40,...,90
  • hundreds - 100 - sto, 200 - 2ste, 300,400 3,4sta, 500,600,...,900 5,6,...9set

for each number 10^(3n + 3) exist 3 files represented as: 1 thousand = jeden tisic = 1_E3 2,3,4 thousands = dva,tri,ctyri tisice = 2-3_E3 5,6,... thousands = pet,sest,... tisic = 5_E3

million = _E6 miliard = _E9 etc...

thousand, milion are gender male, so 1 and 2 is 1m 2m miliard is gender female, so 1 and 2 is 1w 2w

Definition at line 984 of file say.c.

985{
986 int res = 0;
987 int playh = 0;
988 char fn[256] = "";
989
990 int hundred = 0;
991 int left = 0;
992 int length = 0;
993
994 /* options - w = woman, m = man, n = neutral. Defaultl is woman */
995 if (!options)
996 options = "w";
997
998 if (!num)
999 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
1000
1001 while (!res && (num || playh)) {
1002 if (num < 0) {
1003 ast_copy_string(fn, "digits/minus", sizeof(fn));
1004 if ( num > INT_MIN ) {
1005 num = -num;
1006 } else {
1007 num = 0;
1008 }
1009 } else if (num < 3 ) {
1010 snprintf(fn, sizeof(fn), "digits/%d%c", num, options[0]);
1011 playh = 0;
1012 num = 0;
1013 } else if (num < 20) {
1014 snprintf(fn, sizeof(fn), "digits/%d", num);
1015 playh = 0;
1016 num = 0;
1017 } else if (num < 100) {
1018 snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
1019 num %= 10;
1020 } else if (num < 1000) {
1021 hundred = num / 100;
1022 if ( hundred == 1 ) {
1023 ast_copy_string(fn, "digits/1sto", sizeof(fn));
1024 } else if ( hundred == 2 ) {
1025 ast_copy_string(fn, "digits/2ste", sizeof(fn));
1026 } else {
1027 res = ast_say_number_full_cs(chan, hundred, ints, language, options, audiofd, ctrlfd);
1028 if (res)
1029 return res;
1030 if (hundred == 3 || hundred == 4) {
1031 ast_copy_string(fn, "digits/sta", sizeof(fn));
1032 } else if ( hundred > 4 ) {
1033 ast_copy_string(fn, "digits/set", sizeof(fn));
1034 }
1035 }
1036 num -= (hundred * 100);
1037 } else { /* num > 1000 */
1038 length = (int)log10(num)+1;
1039 while ( (length % 3 ) != 1 ) {
1040 length--;
1041 }
1042 left = num / (exp10_int(length-1));
1043 if ( left == 2 ) {
1044 switch (length-1) {
1045 case 9: options = "w"; /* 1,000,000,000 gender female */
1046 break;
1047 default : options = "m"; /* others are male */
1048 }
1049 }
1050 if ( left > 1 ) { /* we don't say "one thousand" but only thousand */
1051 res = ast_say_number_full_cs(chan, left, ints, language, options, audiofd, ctrlfd);
1052 if (res)
1053 return res;
1054 }
1055 if ( left >= 5 ) { /* >= 5 have the same declension */
1056 snprintf(fn, sizeof(fn), "digits/5_E%d", length - 1);
1057 } else if ( left >= 2 && left <= 4 ) {
1058 snprintf(fn, sizeof(fn), "digits/2-4_E%d", length - 1);
1059 } else { /* left == 1 */
1060 snprintf(fn, sizeof(fn), "digits/1_E%d", length - 1);
1061 }
1062 num -= left * (exp10_int(length-1));
1063 }
1064 if (!res) {
1065 if (!ast_streamfile(chan, fn, language)) {
1066 if ((audiofd > -1) && (ctrlfd > -1)) {
1067 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
1068 } else {
1069 res = ast_waitstream(chan, ints);
1070 }
1071 }
1072 ast_stopstream(chan);
1073 }
1074 }
1075 return res;
1076}
static int exp10_int(int power)
Definition say.c:954
static int ast_say_number_full_cs(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_cs: Czech syntax
Definition say.c:984

References ast_copy_string(), ast_say_digits_full(), ast_say_number_full_cs(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), exp10_int(), language, and options.

Referenced by ast_say_number_full_cs(), and say_number_full().

◆ ast_say_number_full_da()

static int ast_say_number_full_da ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_da: Danish syntax New files:

  • In addition to English, the following sounds are required: "1N", "millions", "and" and "1-and" through "9-and"

Definition at line 1082 of file say.c.

1083{
1084 int res = 0;
1085 int playh = 0;
1086 int playa = 0;
1087 int cn = 1; /* +1 = commune; -1 = neuter */
1088 char fn[256] = "";
1089 if (!num)
1090 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
1091
1092 if (options && !strncasecmp(options, "n", 1)) cn = -1;
1093
1094 while (!res && (num || playh || playa )) {
1095 /* The grammar for Danish numbers is the same as for English except
1096 * for the following:
1097 * - 1 exists in both commune ("en", file "1N") and neuter ("et", file "1")
1098 * - numbers 20 through 99 are said in reverse order, i.e. 21 is
1099 * "one-and twenty" and 68 is "eight-and sixty".
1100 * - "million" is different in singular and plural form
1101 * - numbers > 1000 with zero as the third digit from last have an
1102 * "and" before the last two digits, i.e. 2034 is "two thousand and
1103 * four-and thirty" and 1000012 is "one million and twelve".
1104 */
1105 if (num < 0) {
1106 ast_copy_string(fn, "digits/minus", sizeof(fn));
1107 if ( num > INT_MIN ) {
1108 num = -num;
1109 } else {
1110 num = 0;
1111 }
1112 } else if (playh) {
1113 ast_copy_string(fn, "digits/hundred", sizeof(fn));
1114 playh = 0;
1115 } else if (playa) {
1116 ast_copy_string(fn, "digits/and", sizeof(fn));
1117 playa = 0;
1118 } else if (num == 1 && cn == -1) {
1119 ast_copy_string(fn, "digits/1N", sizeof(fn));
1120 num = 0;
1121 } else if (num < 20) {
1122 snprintf(fn, sizeof(fn), "digits/%d", num);
1123 num = 0;
1124 } else if (num < 100) {
1125 int ones = num % 10;
1126 if (ones) {
1127 snprintf(fn, sizeof(fn), "digits/%d-and", ones);
1128 num -= ones;
1129 } else {
1130 snprintf(fn, sizeof(fn), "digits/%d", num);
1131 num = 0;
1132 }
1133 } else {
1134 if (num < 1000) {
1135 int hundreds = num / 100;
1136 if (hundreds == 1)
1137 ast_copy_string(fn, "digits/1N", sizeof(fn));
1138 else
1139 snprintf(fn, sizeof(fn), "digits/%d", (num / 100));
1140
1141 playh++;
1142 num -= 100 * hundreds;
1143 if (num)
1144 playa++;
1145
1146 } else {
1147 if (num < 1000000) {
1148 res = ast_say_number_full_da(chan, num / 1000, ints, language, "n", audiofd, ctrlfd);
1149 if (res)
1150 return res;
1151 num = num % 1000;
1152 ast_copy_string(fn, "digits/thousand", sizeof(fn));
1153 } else {
1154 if (num < 1000000000) {
1155 int millions = num / 1000000;
1156 res = ast_say_number_full_da(chan, millions, ints, language, "c", audiofd, ctrlfd);
1157 if (res)
1158 return res;
1159 if (millions == 1)
1160 ast_copy_string(fn, "digits/million", sizeof(fn));
1161 else
1162 ast_copy_string(fn, "digits/millions", sizeof(fn));
1163 num = num % 1000000;
1164 } else {
1165 ast_debug(1, "Number '%d' is too big for me\n", num);
1166 res = -1;
1167 }
1168 }
1169 if (num && num < 100)
1170 playa++;
1171 }
1172 }
1173 if (!res) {
1174 if (!ast_streamfile(chan, fn, language)) {
1175 if ((audiofd > -1) && (ctrlfd > -1))
1176 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
1177 else
1178 res = ast_waitstream(chan, ints);
1179 }
1180 ast_stopstream(chan);
1181 }
1182 }
1183 return res;
1184}
static int ast_say_number_full_da(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_da: Danish syntax New files:
Definition say.c:1082

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_da(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), language, and options.

Referenced by ast_say_number_full_da(), and say_number_full().

◆ ast_say_number_full_de()

static int ast_say_number_full_de ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_de: German syntax

New files: In addition to English, the following sounds are required:

  • "millions"
  • "1-and" through "9-and"
  • "1F" (eine)
  • "1N" (ein)
  • NB "1" is recorded as 'eins'

Definition at line 1196 of file say.c.

1197{
1198 int res = 0, t = 0;
1199 int mf = 1; /* +1 = male and neuter; -1 = female */
1200 char fn[256] = "";
1201 char fna[256] = "";
1202 if (!num)
1203 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
1204
1205 if (options && (!strncasecmp(options, "f", 1)))
1206 mf = -1;
1207
1208 while (!res && num) {
1209 /* The grammar for German numbers is the same as for English except
1210 * for the following:
1211 * - numbers 20 through 99 are said in reverse order, i.e. 21 is
1212 * "one-and twenty" and 68 is "eight-and sixty".
1213 * - "one" varies according to gender
1214 * - 100 is 'hundert', however all other instances are 'ein hundert'
1215 * - 1000 is 'tausend', however all other instances are 'ein tausend'
1216 * - 1000000 is always 'eine million'
1217 * - "million" is different in singular and plural form
1218 * - 'and' should not go between a hundreds place value and any
1219 * tens/ones place values that follows it. i.e 136 is ein hundert
1220 * sechs und dreizig, not ein hundert und sechs und dreizig.
1221 */
1222 if (num < 0) {
1223 ast_copy_string(fn, "digits/minus", sizeof(fn));
1224 if ( num > INT_MIN ) {
1225 num = -num;
1226 } else {
1227 num = 0;
1228 }
1229 } else if (num == 1 && mf == -1) {
1230 snprintf(fn, sizeof(fn), "digits/%dF", num);
1231 num = 0;
1232 } else if (num < 20) {
1233 snprintf(fn, sizeof(fn), "digits/%d", num);
1234 num = 0;
1235 } else if (num < 100) {
1236 int ones = num % 10;
1237 if (ones) {
1238 snprintf(fn, sizeof(fn), "digits/%d-and", ones);
1239 num -= ones;
1240 } else {
1241 snprintf(fn, sizeof(fn), "digits/%d", num);
1242 num = 0;
1243 }
1244 } else if (num == 100 && t == 0) {
1245 ast_copy_string(fn, "digits/hundred", sizeof(fn));
1246 num = 0;
1247 } else if (num < 1000) {
1248 int hundreds = num / 100;
1249 num = num % 100;
1250 if (hundreds == 1) {
1251 ast_copy_string(fn, "digits/1N", sizeof(fn));
1252 } else {
1253 snprintf(fn, sizeof(fn), "digits/%d", hundreds);
1254 }
1255 ast_copy_string(fna, "digits/hundred", sizeof(fna));
1256 } else if (num == 1000 && t == 0) {
1257 ast_copy_string(fn, "digits/thousand", sizeof(fn));
1258 num = 0;
1259 } else if (num < 1000000) {
1260 int thousands = num / 1000;
1261 num = num % 1000;
1262 t = 1;
1263 if (thousands == 1) {
1264 ast_copy_string(fn, "digits/1N", sizeof(fn));
1265 ast_copy_string(fna, "digits/thousand", sizeof(fna));
1266 } else {
1267 res = ast_say_number_full_de(chan, thousands, ints, language, options, audiofd, ctrlfd);
1268 if (res)
1269 return res;
1270 ast_copy_string(fn, "digits/thousand", sizeof(fn));
1271 }
1272 } else if (num < 1000000000) {
1273 int millions = num / 1000000;
1274 num = num % 1000000;
1275 t = 1;
1276 if (millions == 1) {
1277 ast_copy_string(fn, "digits/1F", sizeof(fn));
1278 ast_copy_string(fna, "digits/million", sizeof(fna));
1279 } else {
1280 res = ast_say_number_full_de(chan, millions, ints, language, options, audiofd, ctrlfd);
1281 if (res)
1282 return res;
1283 ast_copy_string(fn, "digits/millions", sizeof(fn));
1284 }
1285 } else if (num <= INT_MAX) {
1286 int billions = num / 1000000000;
1287 num = num % 1000000000;
1288 t = 1;
1289 if (billions == 1) {
1290 ast_copy_string(fn, "digits/1F", sizeof(fn));
1291 ast_copy_string(fna, "digits/milliard", sizeof(fna));
1292 } else {
1293 res = ast_say_number_full_de(chan, billions, ints, language, options, audiofd, ctrlfd);
1294 if (res) {
1295 return res;
1296 }
1297 ast_copy_string(fn, "digits/milliards", sizeof(fn));
1298 }
1299 } else {
1300 ast_debug(1, "Number '%d' is too big for me\n", num);
1301 res = -1;
1302 }
1303 if (!res) {
1304 if (!ast_streamfile(chan, fn, language)) {
1305 if ((audiofd > -1) && (ctrlfd > -1))
1306 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
1307 else
1308 res = ast_waitstream(chan, ints);
1309 }
1310 ast_stopstream(chan);
1311 if (!res) {
1312 if (strlen(fna) != 0 && !ast_streamfile(chan, fna, language)) {
1313 if ((audiofd > -1) && (ctrlfd > -1))
1314 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
1315 else
1316 res = ast_waitstream(chan, ints);
1317 }
1318 ast_stopstream(chan);
1319 strcpy(fna, "");
1320 }
1321 }
1322 }
1323 return res;
1324}

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_de(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), language, and options.

Referenced by ast_say_enumeration_full_da(), ast_say_enumeration_full_de(), ast_say_number_full_de(), and say_number_full().

◆ ast_say_number_full_dr()

static int ast_say_number_full_dr ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_en_dr: Dari syntax New files:

  • In addition to American English, the following sounds are required: "o"

Definition at line 1551 of file say.c.

1552{
1553 int res = 0;
1554 int playh = 0;
1555 int playa = 0;
1556 int say_o = 0;
1557 char fn[256] = "";
1558 if (!num)
1559 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
1560
1561 while (!res && (num || playh || playa )) {
1562 if (num < 0) {
1563 ast_copy_string(fn, "digits/minus", sizeof(fn));
1564 if ( num > INT_MIN ) {
1565 num = -num;
1566 } else {
1567 num = 0;
1568 }
1569 } else if (playh) {
1570 ast_copy_string(fn, "digits/hundred", sizeof(fn));
1571 playh = 0;
1572 } else if (playa) {
1573 ast_copy_string(fn, "digits/o", sizeof(fn));
1574 playa = 0;
1575 } else if (num < 20) {
1576 snprintf(fn, sizeof(fn), "digits/%d", num);
1577 num = 0;
1578 } else if (num < 100) {
1579 snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
1580 num %= 10;
1581 if (num && say_o)
1582 playa++;
1583 } else if (num < 1000) {
1584 int hundreds = num / 100;
1585 snprintf(fn, sizeof(fn), "digits/%d", (num / 100));
1586
1587 playh++;
1588 num -= 100 * hundreds;
1589 if (num && say_o)
1590 playa++;
1591 } else if (num < 1000000) {
1592 res = ast_say_number_full_dr(chan, num / 1000, ints, language, audiofd, ctrlfd);
1593 if (res)
1594 return res;
1595 ast_copy_string(fn, "digits/thousand", sizeof(fn));
1596 num %= 1000;
1597 if (num && say_o)
1598 playa++;
1599 } else if (num < 1000000000) {
1600 int millions = num / 1000000;
1601 res = ast_say_number_full_dr(chan, millions, ints, language, audiofd, ctrlfd);
1602 if (res)
1603 return res;
1604 ast_copy_string(fn, "digits/million", sizeof(fn));
1605 num %= 1000000;
1606 if (num && num < 100 && say_o)
1607 playa++;
1608 } else {
1609 ast_debug(1, "Number '%d' is too big for me\n", num);
1610 res = -1;
1611 }
1612
1613 if (!res) {
1614 if (!ast_streamfile(chan, fn, language)) {
1615 if ((audiofd > -1) && (ctrlfd > -1))
1616 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
1617 else
1618 res = ast_waitstream(chan, ints);
1619 }
1620 ast_stopstream(chan);
1621 }
1622 }
1623 return res;
1624}
static int ast_say_number_full_dr(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_en_dr: Dari syntax New files:
Definition say.c:1551

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_dr(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by ast_say_number_full_dr(), and say_number_full().

◆ ast_say_number_full_en()

static int ast_say_number_full_en ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_en: English syntax

Note
This is the default syntax, if no other syntax defined in this file is used

Definition at line 941 of file say.c.

942{
943 struct ast_str *filenames = ast_get_number_str(num, language);
944 return say_filenames(chan, ints, language, audiofd, ctrlfd, filenames);
945}
static int say_filenames(struct ast_channel *chan, const char *ints, const char *lang, int audiofd, int ctrlfd, struct ast_str *filenames)
Definition say.c:175

References ast_get_number_str(), language, and say_filenames().

Referenced by ast_say_enumeration_full_dr(), ast_say_enumeration_full_en(), ast_say_enumeration_full_ps(), ast_say_number_full_ja(), and say_number_full().

◆ ast_say_number_full_en_GB()

static int ast_say_number_full_en_GB ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_en_GB: British syntax New files:

  • In addition to American English, the following sounds are required: "vm-and"

Definition at line 1475 of file say.c.

1476{
1477 int res = 0;
1478 int playh = 0;
1479 int playa = 0;
1480 char fn[256] = "";
1481 if (!num)
1482 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
1483
1484 while (!res && (num || playh || playa )) {
1485 if (num < 0) {
1486 ast_copy_string(fn, "digits/minus", sizeof(fn));
1487 if ( num > INT_MIN ) {
1488 num = -num;
1489 } else {
1490 num = 0;
1491 }
1492 } else if (playh) {
1493 ast_copy_string(fn, "digits/hundred", sizeof(fn));
1494 playh = 0;
1495 } else if (playa) {
1496 ast_copy_string(fn, "vm-and", sizeof(fn));
1497 playa = 0;
1498 } else if (num < 20) {
1499 snprintf(fn, sizeof(fn), "digits/%d", num);
1500 num = 0;
1501 } else if (num < 100) {
1502 snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
1503 num %= 10;
1504 } else if (num < 1000) {
1505 int hundreds = num / 100;
1506 snprintf(fn, sizeof(fn), "digits/%d", (num / 100));
1507
1508 playh++;
1509 num -= 100 * hundreds;
1510 if (num)
1511 playa++;
1512 } else if (num < 1000000) {
1513 res = ast_say_number_full_en_GB(chan, num / 1000, ints, language, audiofd, ctrlfd);
1514 if (res)
1515 return res;
1516 ast_copy_string(fn, "digits/thousand", sizeof(fn));
1517 num %= 1000;
1518 if (num && num < 100)
1519 playa++;
1520 } else if (num < 1000000000) {
1521 int millions = num / 1000000;
1522 res = ast_say_number_full_en_GB(chan, millions, ints, language, audiofd, ctrlfd);
1523 if (res)
1524 return res;
1525 ast_copy_string(fn, "digits/million", sizeof(fn));
1526 num %= 1000000;
1527 if (num && num < 100)
1528 playa++;
1529 } else {
1530 ast_debug(1, "Number '%d' is too big for me\n", num);
1531 res = -1;
1532 }
1533
1534 if (!res) {
1535 if (!ast_streamfile(chan, fn, language)) {
1536 if ((audiofd > -1) && (ctrlfd > -1))
1537 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
1538 else
1539 res = ast_waitstream(chan, ints);
1540 }
1541 ast_stopstream(chan);
1542 }
1543 }
1544 return res;
1545}
static int ast_say_number_full_en_GB(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_en_GB: British syntax New files:
Definition say.c:1475

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_en_GB(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by ast_say_number_full_en_GB(), and say_number_full().

◆ ast_say_number_full_es()

static int ast_say_number_full_es ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_es: Spanish syntax

New files: Requires a few new audios: 1F.gsm: feminine 'una' 21.gsm thru 29.gsm, cien.gsm, mil.gsm, millon.gsm, millones.gsm, 100.gsm, 200.gsm, 300.gsm, 400.gsm, 500.gsm, 600.gsm, 700.gsm, 800.gsm, 900.gsm, y.gsm

Definition at line 1633 of file say.c.

1634{
1635 int res = 0;
1636 int playa = 0;
1637 int mf = 0; /* +1 = male; -1 = female */
1638 char fn[256] = "";
1639 if (!num)
1640 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
1641
1642 if (options) {
1643 if (!strncasecmp(options, "f", 1))
1644 mf = -1;
1645 else if (!strncasecmp(options, "m", 1))
1646 mf = 1;
1647 }
1648
1649 while (!res && num) {
1650 if (num < 0) {
1651 ast_copy_string(fn, "digits/minus", sizeof(fn));
1652 if ( num > INT_MIN ) {
1653 num = -num;
1654 } else {
1655 num = 0;
1656 }
1657 } else if (playa) {
1658 ast_copy_string(fn, "digits/and", sizeof(fn));
1659 playa = 0;
1660 } else if (num == 1) {
1661 if (mf < 0)
1662 snprintf(fn, sizeof(fn), "digits/%dF", num);
1663 else if (mf > 0)
1664 snprintf(fn, sizeof(fn), "digits/%dM", num);
1665 else
1666 snprintf(fn, sizeof(fn), "digits/%d", num);
1667 num = 0;
1668 } else if (num < 31) {
1669 snprintf(fn, sizeof(fn), "digits/%d", num);
1670 num = 0;
1671 } else if (num < 100) {
1672 snprintf(fn, sizeof(fn), "digits/%d", (num/10)*10);
1673 num %= 10;
1674 if (num)
1675 playa++;
1676 } else if (num == 100) {
1677 ast_copy_string(fn, "digits/100", sizeof(fn));
1678 num = 0;
1679 } else if (num < 200) {
1680 ast_copy_string(fn, "digits/100-and", sizeof(fn));
1681 num -= 100;
1682 } else {
1683 if (num < 1000) {
1684 snprintf(fn, sizeof(fn), "digits/%d", (num/100)*100);
1685 num %= 100;
1686 } else if (num < 2000) {
1687 num %= 1000;
1688 ast_copy_string(fn, "digits/thousand", sizeof(fn));
1689 } else {
1690 if (num < 1000000) {
1691 res = ast_say_number_full_es(chan, num / 1000, ints, language, options, audiofd, ctrlfd);
1692 if (res)
1693 return res;
1694 num %= 1000;
1695 ast_copy_string(fn, "digits/thousand", sizeof(fn));
1696 } else {
1697 if (num < 2147483640) {
1698 if ((num/1000000) == 1) {
1699 res = ast_say_number_full_es(chan, num / 1000000, ints, language, "M", audiofd, ctrlfd);
1700 if (res)
1701 return res;
1702 ast_copy_string(fn, "digits/million", sizeof(fn));
1703 } else {
1704 res = ast_say_number_full_es(chan, num / 1000000, ints, language, options, audiofd, ctrlfd);
1705 if (res)
1706 return res;
1707 ast_copy_string(fn, "digits/millions", sizeof(fn));
1708 }
1709 num %= 1000000;
1710 } else {
1711 ast_debug(1, "Number '%d' is too big for me\n", num);
1712 res = -1;
1713 }
1714 }
1715 }
1716 }
1717
1718 if (!res) {
1719 if (!ast_streamfile(chan, fn, language)) {
1720 if ((audiofd > -1) && (ctrlfd > -1))
1721 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
1722 else
1723 res = ast_waitstream(chan, ints);
1724 }
1725 ast_stopstream(chan);
1726
1727 }
1728
1729 }
1730 return res;
1731}
static int ast_say_number_full_es(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_es: Spanish syntax
Definition say.c:1633

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_es(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), language, and options.

Referenced by ast_say_number_full_es(), and say_number_full().

◆ ast_say_number_full_fr()

static int ast_say_number_full_fr ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_fr: French syntax Extra sounds needed: 1F: feminin 'une' et: 'and'

Definition at line 1737 of file say.c.

1738{
1739 int res = 0;
1740 int playh = 0;
1741 int playa = 0;
1742 int mf = 1; /* +1 = male; -1 = female */
1743 char fn[256] = "";
1744 if (!num)
1745 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
1746
1747 if (options && !strncasecmp(options, "f", 1))
1748 mf = -1;
1749
1750 while (!res && (num || playh || playa)) {
1751 if (num < 0) {
1752 ast_copy_string(fn, "digits/minus", sizeof(fn));
1753 if ( num > INT_MIN ) {
1754 num = -num;
1755 } else {
1756 num = 0;
1757 }
1758 } else if (playh) {
1759 ast_copy_string(fn, "digits/hundred", sizeof(fn));
1760 playh = 0;
1761 } else if (playa) {
1762 ast_copy_string(fn, "digits/et", sizeof(fn));
1763 playa = 0;
1764 } else if (num == 1) {
1765 if (mf < 0)
1766 snprintf(fn, sizeof(fn), "digits/%dF", num);
1767 else
1768 snprintf(fn, sizeof(fn), "digits/%d", num);
1769 num = 0;
1770 } else if (num < 21) {
1771 snprintf(fn, sizeof(fn), "digits/%d", num);
1772 num = 0;
1773 } else if (num < 70) {
1774 snprintf(fn, sizeof(fn), "digits/%d", (num/10)*10);
1775 if ((num % 10) == 1) playa++;
1776 num = num % 10;
1777 } else if (num < 80) {
1778 ast_copy_string(fn, "digits/60", sizeof(fn));
1779 if ((num % 10) == 1) playa++;
1780 num -= 60;
1781 } else if (num < 100) {
1782 ast_copy_string(fn, "digits/80", sizeof(fn));
1783 num = num - 80;
1784 } else if (num < 200) {
1785 ast_copy_string(fn, "digits/hundred", sizeof(fn));
1786 num = num - 100;
1787 } else if (num < 1000) {
1788 snprintf(fn, sizeof(fn), "digits/%d", (num/100));
1789 playh++;
1790 num = num % 100;
1791 } else if (num < 2000) {
1792 ast_copy_string(fn, "digits/thousand", sizeof(fn));
1793 num = num - 1000;
1794 } else if (num < 1000000) {
1795 res = ast_say_number_full_fr(chan, num / 1000, ints, language, options, audiofd, ctrlfd);
1796 if (res)
1797 return res;
1798 ast_copy_string(fn, "digits/thousand", sizeof(fn));
1799 num = num % 1000;
1800 } else if (num < 1000000000) {
1801 res = ast_say_number_full_fr(chan, num / 1000000, ints, language, options, audiofd, ctrlfd);
1802 if (res)
1803 return res;
1804 ast_copy_string(fn, "digits/million", sizeof(fn));
1805 num = num % 1000000;
1806 } else {
1807 ast_debug(1, "Number '%d' is too big for me\n", num);
1808 res = -1;
1809 }
1810 if (!res) {
1811 if (!ast_streamfile(chan, fn, language)) {
1812 if ((audiofd > -1) && (ctrlfd > -1))
1813 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
1814 else
1815 res = ast_waitstream(chan, ints);
1816 }
1817 ast_stopstream(chan);
1818 }
1819 }
1820 return res;
1821}
static int ast_say_number_full_fr(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_fr: French syntax Extra sounds needed: 1F: feminin 'une' et: 'and'
Definition say.c:1737

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_fr(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), language, and options.

Referenced by ast_say_number_full_fr(), and say_number_full().

◆ ast_say_number_full_gr()

static int ast_say_number_full_gr ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

Greek support A list of the files that you need to create -> digits/xilia = "xilia" -> digits/myrio = "ekatomyrio" -> digits/thousands = "xiliades" -> digits/millions = "ektatomyria" -> digits/[1..12] :: A pronunciation of th digits form 1 to 12 e.g. "tria" -> digits/[10..100] :: A pronunciation of the tens from 10 to 90 e.g. 80 = "ogdonta" Here we must note that we use digits/tens/100 to utter "ekato" and digits/hundred-100 to utter "ekaton" -> digits/hundred-[100...1000] :: A pronunciation of hundreds from 100 to 1000 e.g 400 = "terakosia". Here again we use hundreds/1000 for "xilia" and digits/thousands for "xiliades".

Definition at line 8670 of file say.c.

8671{
8672 int res = 0;
8673 char fn[256] = "";
8674 int i=0;
8675
8676
8677 if (!num) {
8678 ast_copy_string(fn, "digits/0", sizeof(fn));
8679 res = ast_streamfile(chan, fn, ast_channel_language(chan));
8680 if (!res)
8681 return ast_waitstream(chan, ints);
8682 }
8683
8684 while (!res && num ) {
8685 i++;
8686 if (num < 13) {
8687 snprintf(fn, sizeof(fn), "digits/%d", num);
8688 num = 0;
8689 } else if (num <= 100) {
8690 /* 13 < num <= 100 */
8691 snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
8692 num %= 10;
8693 } else if (num < 200) {
8694 /* 100 < num < 200 */
8695 snprintf(fn, sizeof(fn), "digits/hundred-100");
8696 num %= 100;
8697 } else if (num < 1000) {
8698 /* 200 < num < 1000 */
8699 snprintf(fn, sizeof(fn), "digits/hundred-%d", (num/100)*100);
8700 num %= 100;
8701 } else if (num < 2000){
8702 snprintf(fn, sizeof(fn), "digits/xilia");
8703 num %= 1000;
8704 } else {
8705 /* num > 1000 */
8706 if (num < 1000000) {
8707 res = ast_say_number_full_gr(chan, (num / 1000), ints, ast_channel_language(chan), audiofd, ctrlfd);
8708 if (res)
8709 return res;
8710 num %= 1000;
8711 snprintf(fn, sizeof(fn), "digits/thousands");
8712 } else {
8713 if (num < 1000000000) { /* 1,000,000,000 */
8714 res = ast_say_number_full_gr(chan, (num / 1000000), ints, ast_channel_language(chan), audiofd, ctrlfd);
8715 if (res)
8716 return res;
8717 num %= 1000000;
8718 snprintf(fn, sizeof(fn), "digits/millions");
8719 } else {
8720 ast_debug(1, "Number '%d' is too big for me\n", num);
8721 res = -1;
8722 }
8723 }
8724 }
8725 if (!res) {
8726 if (!ast_streamfile(chan, fn, language)) {
8727 if ((audiofd > -1) && (ctrlfd > -1))
8728 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
8729 else
8730 res = ast_waitstream(chan, ints);
8731 }
8732 ast_stopstream(chan);
8733 }
8734 }
8735 return res;
8736}

References ast_channel_language(), ast_copy_string(), ast_debug, ast_say_number_full_gr(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by ast_say_date_with_format_gr(), ast_say_number_full_gr(), and say_number_full().

◆ ast_say_number_full_he()

static int ast_say_number_full_he ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

Definition at line 1829 of file say.c.

1830{
1831 int res = 0;
1832 int state = 0; /* no need to save anything */
1833 int mf = -1; /* +1 = Masculin; -1 = Feminin */
1834 int tmpnum = 0;
1835
1836 char fn[SAY_NUM_BUF_SIZE] = "";
1837
1838 ast_verb(3, "ast_say_digits_full: started. num: %d, options=\"%s\"\n", num, options);
1839
1840 if (!num) {
1841 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
1842 }
1843 if (options && !strncasecmp(options, "m", 1)) {
1844 mf = 1;
1845 }
1846 ast_verb(3, "ast_say_digits_full: num: %d, state=%d, options=\"%s\", mf=%d\n", num, state, options, mf);
1847
1848 /* Do we have work to do? */
1849 while (!res && (num || (state > 0))) {
1850 /* first type of work: play a second sound. In this loop
1851 * we can only play one sound file at a time. Thus playing
1852 * a second one requires repeating the loop just for the
1853 * second file. The variable 'state' remembers where we were.
1854 * state==0 is the normal mode and it means that we continue
1855 * to check if the number num has yet anything left.
1856 */
1857 ast_verb(3, "ast_say_digits_full: num: %d, state=%d, options=\"%s\", mf=%d, tmpnum=%d\n", num, state, options, mf, tmpnum);
1858
1859 if (state == 1) {
1860 state = 0;
1861 } else if (state == 2) {
1862 if ((num >= 11) && (num < 21)) {
1863 if (mf < 0) {
1864 snprintf(fn, sizeof(fn), "digits/ve");
1865 } else {
1866 snprintf(fn, sizeof(fn), "digits/uu");
1867 }
1868 } else {
1869 switch (num) {
1870 case 1:
1871 snprintf(fn, sizeof(fn), "digits/ve");
1872 break;
1873 case 2:
1874 snprintf(fn, sizeof(fn), "digits/uu");
1875 break;
1876 case 3:
1877 if (mf < 0) {
1878 snprintf(fn, sizeof(fn), "digits/ve");
1879 } else {
1880 snprintf(fn, sizeof(fn), "digits/uu");
1881 }
1882 break;
1883 case 4:
1884 snprintf(fn, sizeof(fn), "digits/ve");
1885 break;
1886 case 5:
1887 snprintf(fn, sizeof(fn), "digits/ve");
1888 break;
1889 case 6:
1890 snprintf(fn, sizeof(fn), "digits/ve");
1891 break;
1892 case 7:
1893 snprintf(fn, sizeof(fn), "digits/ve");
1894 break;
1895 case 8:
1896 snprintf(fn, sizeof(fn), "digits/uu");
1897 break;
1898 case 9:
1899 snprintf(fn, sizeof(fn), "digits/ve");
1900 break;
1901 case 10:
1902 snprintf(fn, sizeof(fn), "digits/ve");
1903 break;
1904 }
1905 }
1906 state = 0;
1907 } else if (state == 3) {
1908 snprintf(fn, sizeof(fn), "digits/1k");
1909 state = 0;
1910 } else if (num < 0) {
1911 snprintf(fn, sizeof(fn), "digits/minus");
1912 num = (-1) * num;
1913 } else if (num < 20) {
1914 if (mf < 0) {
1915 snprintf(fn, sizeof(fn), "digits/%d", num);
1916 } else {
1917 snprintf(fn, sizeof(fn), "digits/%dm", num);
1918 }
1919 num = 0;
1920 } else if ((num < 100) && (num >= 20)) {
1921 snprintf(fn, sizeof(fn), "digits/%d", (num / 10) * 10);
1922 num = num % 10;
1923 if (num > 0) {
1924 state = 2;
1925 }
1926 } else if ((num >= 100) && (num < 1000)) {
1927 tmpnum = num / 100;
1928 snprintf(fn, sizeof(fn), "digits/%d00", tmpnum);
1929 num = num - (tmpnum * 100);
1930 if ((num > 0) && (num < 11)) {
1931 state = 2;
1932 }
1933 } else if ((num >= 1000) && (num < 10000)) {
1934 tmpnum = num / 1000;
1935 snprintf(fn, sizeof(fn), "digits/%dk", tmpnum);
1936 num = num - (tmpnum * 1000);
1937 if ((num > 0) && (num < 11)) {
1938 state = 2;
1939 }
1940 } else if (num < 20000) {
1941 snprintf(fn, sizeof(fn), "digits/%dm", (num / 1000));
1942 num = num % 1000;
1943 state = 3;
1944 } else if (num < 1000000) {
1945 res = ast_say_number_full_he(chan, num / 1000, ints, language, "m", audiofd, ctrlfd);
1946 if (res) {
1947 return res;
1948 }
1949 snprintf(fn, sizeof(fn), "digits/1k");
1950 num = num % 1000;
1951 if ((num > 0) && (num < 11)) {
1952 state = 2;
1953 }
1954 } else if (num < 2000000) {
1955 snprintf(fn, sizeof(fn), "digits/million");
1956 num = num % 1000000;
1957 if ((num > 0) && (num < 11)) {
1958 state = 2;
1959 }
1960 } else if (num < 3000000) {
1961 snprintf(fn, sizeof(fn), "digits/twomillion");
1962 num = num - 2000000;
1963 if ((num > 0) && (num < 11)) {
1964 state = 2;
1965 }
1966 } else if (num < 1000000000) {
1967 res = ast_say_number_full_he(chan, num / 1000000, ints, language, "m", audiofd, ctrlfd);
1968 if (res) {
1969 return res;
1970 }
1971 snprintf(fn, sizeof(fn), "digits/million");
1972 num = num % 1000000;
1973 if ((num > 0) && (num < 11)) {
1974 state = 2;
1975 }
1976 } else {
1977 ast_debug(1, "Number '%d' is too big for me\n", num);
1978 res = -1;
1979 }
1980 tmpnum = 0;
1981 if (!res) {
1982 if (!ast_streamfile(chan, fn, language)) {
1983 if ((audiofd > -1) && (ctrlfd > -1)) {
1984 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
1985 } else {
1986 res = ast_waitstream(chan, ints);
1987 }
1988 }
1989 ast_stopstream(chan);
1990 }
1991 }
1992 return res;
1993}
#define SAY_NUM_BUF_SIZE
Definition say.c:1828

References ast_debug, ast_say_digits_full(), ast_say_number_full_he(), ast_stopstream(), ast_streamfile(), ast_verb, ast_waitstream(), ast_waitstream_full(), language, options, and SAY_NUM_BUF_SIZE.

Referenced by ast_say_date_with_format_he(), ast_say_enumeration_full_he(), ast_say_number_full_he(), ast_say_time_he(), and say_number_full().

◆ ast_say_number_full_hu()

static int ast_say_number_full_hu ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_hu: Hungarian syntax

Extra sounds needed: 10en: "tizen" 20on: "huszon"

Definition at line 2001 of file say.c.

2002{
2003 int res = 0;
2004 int playh = 0;
2005 char fn[256] = "";
2006 if (!num)
2007 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
2008
2009 /*
2010 Hungarian support
2011 like english, except numbers up to 29 are from 2 words.
2012 10 and first word of 1[1-9] and 20 and first word of 2[1-9] are different.
2013 */
2014
2015 while(!res && (num || playh)) {
2016 if (num < 0) {
2017 ast_copy_string(fn, "digits/minus", sizeof(fn));
2018 if ( num > INT_MIN ) {
2019 num = -num;
2020 } else {
2021 num = 0;
2022 }
2023 } else if (playh) {
2024 ast_copy_string(fn, "digits/hundred", sizeof(fn));
2025 playh = 0;
2026 } else if (num < 11 || num == 20) {
2027 snprintf(fn, sizeof(fn), "digits/%d", num);
2028 num = 0;
2029 } else if (num < 20) {
2030 ast_copy_string(fn, "digits/10en", sizeof(fn));
2031 num -= 10;
2032 } else if (num < 30) {
2033 ast_copy_string(fn, "digits/20on", sizeof(fn));
2034 num -= 20;
2035 } else if (num < 100) {
2036 snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
2037 num %= 10;
2038 } else {
2039 if (num < 1000){
2040 snprintf(fn, sizeof(fn), "digits/%d", (num/100));
2041 playh++;
2042 num %= 100;
2043 } else {
2044 if (num < 1000000) { /* 1,000,000 */
2045 res = ast_say_number_full_hu(chan, num / 1000, ints, language, audiofd, ctrlfd);
2046 if (res)
2047 return res;
2048 num %= 1000;
2049 ast_copy_string(fn, "digits/thousand", sizeof(fn));
2050 } else {
2051 if (num < 1000000000) { /* 1,000,000,000 */
2052 res = ast_say_number_full_hu(chan, num / 1000000, ints, language, audiofd, ctrlfd);
2053 if (res)
2054 return res;
2055 num %= 1000000;
2056 ast_copy_string(fn, "digits/million", sizeof(fn));
2057 } else {
2058 ast_debug(1, "Number '%d' is too big for me\n", num);
2059 res = -1;
2060 }
2061 }
2062 }
2063 }
2064 if (!res) {
2065 if(!ast_streamfile(chan, fn, language)) {
2066 if ((audiofd > -1) && (ctrlfd > -1))
2067 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
2068 else
2069 res = ast_waitstream(chan, ints);
2070 }
2071 ast_stopstream(chan);
2072 }
2073 }
2074 return res;
2075}
static int ast_say_number_full_hu(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_hu: Hungarian syntax
Definition say.c:2001

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_hu(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by ast_say_number_full_hu(), and say_number_full().

◆ ast_say_number_full_is()

static int ast_say_number_full_is ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_is: Icelandic syntax

Definition at line 2081 of file say.c.

2082{
2083 int res = 0;
2084 int playh = 0;
2085 int playa = 0;
2086 int cn = 1; /* 1 = masc; 2 = fem; 3 = neut */
2087 char fn[256] = "";
2088
2089 if (!num)
2090 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
2091
2092 if (options && !strncasecmp(options, "f", 1)) cn = 2;
2093 if (options && !strncasecmp(options, "c", 1)) cn = 3;
2094 /* It seems that sometimes people are using c and sometimes n. */
2095 if (options && !strncasecmp(options, "n", 1)) cn = 3;
2096
2097 while (!res && (num || playh || playa )) {
2098 if (num < 0) {
2099 ast_copy_string(fn, "digits/minus", sizeof(fn));
2100 if ( num > INT_MIN ) {
2101 num = -num;
2102 } else {
2103 num = 0;
2104 }
2105 } else if (playh) {
2106 if (playh > 1)
2107 ast_copy_string(fn, "digits/hundreds", sizeof(fn));
2108 else
2109 ast_copy_string(fn, "digits/hundred", sizeof(fn));
2110 playh = 0;
2111 } else if (playa) {
2112 ast_copy_string(fn, "digits/and", sizeof(fn));
2113 playa = 0;
2114 } else if (num < 5 && cn == 2) {
2115 snprintf(fn, sizeof(fn), "digits/%dkvk", num);
2116 num = 0;
2117 } else if (num < 5 && cn == 3) {
2118 snprintf(fn, sizeof(fn), "digits/%dhk", num);
2119 num = 0;
2120 } else if (num < 20) {
2121 snprintf(fn, sizeof(fn), "digits/%d", num);
2122 num = 0;
2123 } else if (num < 100) {
2124 snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
2125 num %= 10;
2126 if (num)
2127 playa++;
2128 } else if (num < 1000) {
2129 int hundreds = num / 100;
2130 /* The number prepending hundreds are in neutral */
2131 if (hundreds < 5)
2132 snprintf(fn, sizeof(fn), "digits/%dhk", hundreds);
2133 else
2134 snprintf(fn, sizeof(fn), "digits/%d", (num / 100));
2135
2136 playh = hundreds;
2137 num -= 100 * hundreds;
2138 if (num && num < 20)
2139 playa++;
2140 /* The 'and' moves forward on even tens. */
2141 if (num && (num % 10) == 0)
2142 playa++;
2143 } else if (num < 1000000) {
2144 res = ast_say_number_full_is(chan, num / 1000, ints, language, "n", audiofd, ctrlfd);
2145 /* Play 'and' if it's an even hundred. */
2146 if ((num % 100) == 0 && (num % 1000 != 0)) {
2147 playa++;
2148 }
2149 if (res)
2150 return res;
2151 ast_copy_string(fn, "digits/thousand", sizeof(fn));
2152 num %= 1000;
2153 if (num && (num < 20 || (num % 10 == 0)))
2154 playa++;
2155 } else if (num < 1000000000) {
2156 int millions = num / 1000000;
2157 /* The number of millions is feminine */
2158 res = ast_say_number_full_is(chan, millions, ints, language, "f", audiofd, ctrlfd);
2159 if (res)
2160 return res;
2161 if (millions > 1)
2162 ast_copy_string(fn, "digits/millions", sizeof(fn));
2163 else
2164 ast_copy_string(fn, "digits/million", sizeof(fn));
2165 num %= 1000000;
2166 if (num && num < 100)
2167 playa++;
2168 } else if (num < INT_MAX) {
2169 int milliards = num / 1000000000;
2170 /* The number of milliards is masculine */
2171 res = ast_say_number_full_is(chan, milliards, ints, language, "m", audiofd, ctrlfd);
2172 if (res)
2173 return res;
2174 if (milliards > 1)
2175 ast_copy_string(fn, "digits/milliards", sizeof(fn));
2176 else
2177 ast_copy_string(fn, "digits/milliard", sizeof(fn));
2178 num %= 1000000000;
2179 if (num && num < 100)
2180 playa++;
2181 } else {
2182 ast_debug(1, "Number '%d' is too big for me\n", num);
2183 res = -1;
2184 }
2185
2186 if (!res) {
2187 if (!ast_streamfile(chan, fn, language)) {
2188 if ((audiofd > -1) && (ctrlfd > -1))
2189 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
2190 else
2191 res = ast_waitstream(chan, ints);
2192 }
2193 ast_stopstream(chan);
2194 }
2195 }
2196 return res;
2197}

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_is(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), language, and options.

Referenced by ast_say_enumeration_full_is(), ast_say_number_full_is(), and say_number_full().

◆ ast_say_number_full_it()

static int ast_say_number_full_it ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_it: Italian

Definition at line 2201 of file say.c.

2202{
2203 int res = 0;
2204 int playh = 0;
2205 int tempnum = 0;
2206 char fn[256] = "";
2207
2208 if (!num)
2209 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
2210
2211 /*
2212 Italian support
2213
2214 Like english, numbers up to 20 are a single 'word', and others
2215 compound, but with exceptions.
2216 For example 21 is not twenty-one, but there is a single word in 'it'.
2217 Idem for 28 (ie when a the 2nd part of a compound number
2218 starts with a vowel)
2219
2220 There are exceptions also for hundred, thousand and million.
2221 In english 100 = one hundred, 200 is two hundred.
2222 In italian 100 = cento , like to say hundred (without one),
2223 200 and more are like english.
2224
2225 Same applies for thousand:
2226 1000 is one thousand in en, 2000 is two thousand.
2227 In it we have 1000 = mille , 2000 = 2 mila
2228
2229 For million(s) we use the plural, if more than one
2230 Also, one million is abbreviated in it, like on-million,
2231 or 'un milione', not 'uno milione'.
2232 So the right file is provided.
2233 */
2234
2235 while (!res && (num || playh)) {
2236 if (num < 0) {
2237 ast_copy_string(fn, "digits/minus", sizeof(fn));
2238 if ( num > INT_MIN ) {
2239 num = -num;
2240 } else {
2241 num = 0;
2242 }
2243 } else if (playh) {
2244 ast_copy_string(fn, "digits/hundred", sizeof(fn));
2245 playh = 0;
2246 } else if (num < 20) {
2247 snprintf(fn, sizeof(fn), "digits/%d", num);
2248 num = 0;
2249 } else if (num == 21) {
2250 snprintf(fn, sizeof(fn), "digits/%d", num);
2251 num = 0;
2252 } else if (num == 28) {
2253 snprintf(fn, sizeof(fn), "digits/%d", num);
2254 num = 0;
2255 } else if (num == 31) {
2256 snprintf(fn, sizeof(fn), "digits/%d", num);
2257 num = 0;
2258 } else if (num == 38) {
2259 snprintf(fn, sizeof(fn), "digits/%d", num);
2260 num = 0;
2261 } else if (num == 41) {
2262 snprintf(fn, sizeof(fn), "digits/%d", num);
2263 num = 0;
2264 } else if (num == 48) {
2265 snprintf(fn, sizeof(fn), "digits/%d", num);
2266 num = 0;
2267 } else if (num == 51) {
2268 snprintf(fn, sizeof(fn), "digits/%d", num);
2269 num = 0;
2270 } else if (num == 58) {
2271 snprintf(fn, sizeof(fn), "digits/%d", num);
2272 num = 0;
2273 } else if (num == 61) {
2274 snprintf(fn, sizeof(fn), "digits/%d", num);
2275 num = 0;
2276 } else if (num == 68) {
2277 snprintf(fn, sizeof(fn), "digits/%d", num);
2278 num = 0;
2279 } else if (num == 71) {
2280 snprintf(fn, sizeof(fn), "digits/%d", num);
2281 num = 0;
2282 } else if (num == 78) {
2283 snprintf(fn, sizeof(fn), "digits/%d", num);
2284 num = 0;
2285 } else if (num == 81) {
2286 snprintf(fn, sizeof(fn), "digits/%d", num);
2287 num = 0;
2288 } else if (num == 88) {
2289 snprintf(fn, sizeof(fn), "digits/%d", num);
2290 num = 0;
2291 } else if (num == 91) {
2292 snprintf(fn, sizeof(fn), "digits/%d", num);
2293 num = 0;
2294 } else if (num == 98) {
2295 snprintf(fn, sizeof(fn), "digits/%d", num);
2296 num = 0;
2297 } else if (num < 100) {
2298 snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
2299 num %= 10;
2300 } else {
2301 if (num < 1000) {
2302 if ((num / 100) > 1) {
2303 snprintf(fn, sizeof(fn), "digits/%d", (num/100));
2304 playh++;
2305 } else {
2306 ast_copy_string(fn, "digits/hundred", sizeof(fn));
2307 }
2308 num %= 100;
2309 } else {
2310 if (num < 1000000) { /* 1,000,000 */
2311 if ((num/1000) > 1)
2312 res = ast_say_number_full_it(chan, num / 1000, ints, language, audiofd, ctrlfd);
2313 if (res)
2314 return res;
2315 tempnum = num;
2316 num %= 1000;
2317 if ((tempnum / 1000) < 2)
2318 ast_copy_string(fn, "digits/thousand", sizeof(fn));
2319 else /* for 1000 it says mille, for >1000 (eg 2000) says mila */
2320 ast_copy_string(fn, "digits/thousands", sizeof(fn));
2321 } else {
2322 if (num < 1000000000) { /* 1,000,000,000 */
2323 if ((num / 1000000) > 1)
2324 res = ast_say_number_full_it(chan, num / 1000000, ints, language, audiofd, ctrlfd);
2325 if (res)
2326 return res;
2327 tempnum = num;
2328 num %= 1000000;
2329 if ((tempnum / 1000000) < 2)
2330 ast_copy_string(fn, "digits/million", sizeof(fn));
2331 else
2332 ast_copy_string(fn, "digits/millions", sizeof(fn));
2333 } else {
2334 ast_debug(1, "Number '%d' is too big for me\n", num);
2335 res = -1;
2336 }
2337 }
2338 }
2339 }
2340 if (!res) {
2341 if (!ast_streamfile(chan, fn, language)) {
2342 if ((audiofd > -1) && (ctrlfd > -1))
2343 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
2344 else
2345 res = ast_waitstream(chan, ints);
2346 }
2347 ast_stopstream(chan);
2348 }
2349 }
2350 return res;
2351}
static int ast_say_number_full_it(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_it: Italian
Definition say.c:2201

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_it(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by ast_say_number_full_it(), and say_number_full().

◆ ast_say_number_full_ja()

static int ast_say_number_full_ja ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

Definition at line 8739 of file say.c.

8740{
8741 int res = 0;
8742 int playh = 0;
8743 char fn[256] = "";
8744
8745 if (!num)
8746 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
8747
8748 while (!res && (num || playh)) {
8749 if (num < 0) {
8750 ast_copy_string(fn, "digits/minus", sizeof(fn));
8751 if ( num > INT_MIN ) {
8752 num = -num;
8753 } else {
8754 num = 0;
8755 }
8756 } else if (playh) {
8757 ast_copy_string(fn, "digits/hundred", sizeof(fn));
8758 playh = 0;
8759 } else if (num < 20) {
8760 snprintf(fn, sizeof(fn), "digits/%d", num);
8761 num = 0;
8762 } else if (num < 100) {
8763 snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
8764 num %= 10;
8765 } else {
8766 if (num < 1000){
8767 snprintf(fn, sizeof(fn), "digits/%d", (num/100));
8768 playh++;
8769 num %= 100;
8770 } else {
8771 if (num < 1000000) { /* 1,000,000 */
8772 res = ast_say_number_full_en(chan, num / 1000, ints, language, audiofd, ctrlfd);
8773 if (res)
8774 return res;
8775 num %= 1000;
8776 snprintf(fn, sizeof(fn), "digits/thousand");
8777 } else {
8778 if (num < 1000000000) { /* 1,000,000,000 */
8779 res = ast_say_number_full_en(chan, num / 1000000, ints, language, audiofd, ctrlfd);
8780 if (res)
8781 return res;
8782 num %= 1000000;
8783 ast_copy_string(fn, "digits/million", sizeof(fn));
8784 } else {
8785 ast_debug(1, "Number '%d' is too big for me\n", num);
8786 res = -1;
8787 }
8788 }
8789 }
8790 }
8791 if (!res) {
8792 if (!ast_streamfile(chan, fn, language)) {
8793 if ((audiofd > -1) && (ctrlfd > -1))
8794 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
8795 else
8796 res = ast_waitstream(chan, ints);
8797 }
8798 ast_stopstream(chan);
8799 }
8800 }
8801 return res;
8802}

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_en(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by say_number_full().

◆ ast_say_number_full_ka()

static int ast_say_number_full_ka ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_ka: Georgian syntax

Definition at line 9904 of file say.c.

9905{
9906 int res = 0;
9907 char fn[512] = "";
9908 char* s = 0;
9909 const char* remaining = fn;
9910
9911 if (!num) {
9912 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
9913 }
9914
9915
9916 ast_translate_number_ka(num, fn, 512);
9917
9918
9919
9920 while (res == 0 && (s = strstr(remaining, " "))) {
9921 size_t len = s - remaining;
9922 char* new_string = ast_malloc(len + 1 + strlen("digits/"));
9923
9924 sprintf(new_string, "digits/");
9925 strncat(new_string, remaining, len); /* we can't sprintf() it, it's not null-terminated. */
9926/* new_string[len + strlen("digits/")] = '\0'; */
9927
9928 if (!ast_streamfile(chan, new_string, language)) {
9929 if ((audiofd > -1) && (ctrlfd > -1)) {
9930 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
9931 } else {
9932 res = ast_waitstream(chan, ints);
9933 }
9934 }
9935 ast_stopstream(chan);
9936
9937 ast_free(new_string);
9938
9939 remaining = s + 1; /* position just after the found space char. */
9940 while (*remaining == ' ') { /* skip multiple spaces */
9941 remaining++;
9942 }
9943 }
9944
9945
9946 /* the last chunk. */
9947 if (res == 0 && *remaining) {
9948
9949 char* new_string = ast_malloc(strlen(remaining) + 1 + strlen("digits/"));
9950 sprintf(new_string, "digits/%s", remaining);
9951
9952 if (!ast_streamfile(chan, new_string, language)) {
9953 if ((audiofd > -1) && (ctrlfd > -1)) {
9954 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
9955 } else {
9956 res = ast_waitstream(chan, ints);
9957 }
9958 }
9959 ast_stopstream(chan);
9960
9961 ast_free(new_string);
9962
9963 }
9964
9965
9966 return res;
9967
9968}
#define ast_malloc(len)
A wrapper for malloc()
Definition astmm.h:191
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static char * ast_translate_number_ka(int num, char *res, int res_len)
Georgian support.
Definition say.c:9765

References ast_free, ast_malloc, ast_say_digits_full(), ast_stopstream(), ast_streamfile(), ast_translate_number_ka(), ast_waitstream(), ast_waitstream_full(), language, and len().

Referenced by say_number_full().

◆ ast_say_number_full_nl()

static int ast_say_number_full_nl ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_nl: dutch syntax New files: digits/nl-en

Definition at line 2356 of file say.c.

2357{
2358 int res = 0;
2359 int playh = 0;
2360 int units = 0;
2361 char fn[256] = "";
2362 if (!num)
2363 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
2364 while (!res && (num || playh )) {
2365 if (num < 0) {
2366 ast_copy_string(fn, "digits/minus", sizeof(fn));
2367 if ( num > INT_MIN ) {
2368 num = -num;
2369 } else {
2370 num = 0;
2371 }
2372 } else if (playh) {
2373 ast_copy_string(fn, "digits/hundred", sizeof(fn));
2374 playh = 0;
2375 } else if (num < 20) {
2376 snprintf(fn, sizeof(fn), "digits/%d", num);
2377 num = 0;
2378 } else if (num < 100) {
2379 units = num % 10;
2380 if (units > 0) {
2381 res = ast_say_number_full_nl(chan, units, ints, language, audiofd, ctrlfd);
2382 if (res)
2383 return res;
2384 num = num - units;
2385 ast_copy_string(fn, "digits/nl-en", sizeof(fn));
2386 } else {
2387 snprintf(fn, sizeof(fn), "digits/%d", num - units);
2388 num = 0;
2389 }
2390 } else if (num < 200) {
2391 /* hundred, not one-hundred */
2392 ast_copy_string(fn, "digits/hundred", sizeof(fn));
2393 num %= 100;
2394 } else if (num < 1000) {
2395 snprintf(fn, sizeof(fn), "digits/%d", num / 100);
2396 playh++;
2397 num %= 100;
2398 } else {
2399 if (num < 1100) {
2400 /* thousand, not one-thousand */
2401 num %= 1000;
2402 ast_copy_string(fn, "digits/thousand", sizeof(fn));
2403 } else if (num < 10000) { /* 1,100 to 9,9999 */
2404 res = ast_say_number_full_nl(chan, num / 100, ints, language, audiofd, ctrlfd);
2405 if (res)
2406 return res;
2407 num %= 100;
2408 ast_copy_string(fn, "digits/hundred", sizeof(fn));
2409 } else {
2410 if (num < 1000000) { /* 1,000,000 */
2411 res = ast_say_number_full_nl(chan, num / 1000, ints, language, audiofd, ctrlfd);
2412 if (res)
2413 return res;
2414 num %= 1000;
2415 ast_copy_string(fn, "digits/thousand", sizeof(fn));
2416 } else {
2417 if (num < 1000000000) { /* 1,000,000,000 */
2418 res = ast_say_number_full_nl(chan, num / 1000000, ints, language, audiofd, ctrlfd);
2419 if (res)
2420 return res;
2421 num %= 1000000;
2422 ast_copy_string(fn, "digits/million", sizeof(fn));
2423 } else {
2424 ast_debug(1, "Number '%d' is too big for me\n", num);
2425 res = -1;
2426 }
2427 }
2428 }
2429 }
2430
2431 if (!res) {
2432 if (!ast_streamfile(chan, fn, language)) {
2433 if ((audiofd > -1) && (ctrlfd > -1))
2434 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
2435 else
2436 res = ast_waitstream(chan, ints);
2437 }
2438 ast_stopstream(chan);
2439 }
2440 }
2441 return res;
2442}
static int ast_say_number_full_nl(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_nl: dutch syntax New files: digits/nl-en
Definition say.c:2356

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_nl(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by ast_say_number_full_nl(), and say_number_full().

◆ ast_say_number_full_no()

static int ast_say_number_full_no ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_no: Norwegian syntax New files: In addition to American English, the following sounds are required: "and", "1N"

The grammar for Norwegian numbers is the same as for English except for the following:

  • 1 exists in both commune ("en", file "1") and neuter ("ett", file "1N") "and" before the last two digits, i.e. 2034 is "two thousand and thirty-four" and 1000012 is "one million and twelve".

Definition at line 2454 of file say.c.

2455{
2456 int res = 0;
2457 int playh = 0;
2458 int playa = 0;
2459 int cn = 1; /* +1 = commune; -1 = neuter */
2460 char fn[256] = "";
2461
2462 if (!num)
2463 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
2464
2465 if (options && !strncasecmp(options, "n", 1)) cn = -1;
2466
2467 while (!res && (num || playh || playa )) {
2468 if (num < 0) {
2469 ast_copy_string(fn, "digits/minus", sizeof(fn));
2470 if ( num > INT_MIN ) {
2471 num = -num;
2472 } else {
2473 num = 0;
2474 }
2475 } else if (playh) {
2476 ast_copy_string(fn, "digits/hundred", sizeof(fn));
2477 playh = 0;
2478 } else if (playa) {
2479 ast_copy_string(fn, "digits/and", sizeof(fn));
2480 playa = 0;
2481 } else if (num == 1 && cn == -1) {
2482 ast_copy_string(fn, "digits/1N", sizeof(fn));
2483 num = 0;
2484 } else if (num < 20) {
2485 snprintf(fn, sizeof(fn), "digits/%d", num);
2486 num = 0;
2487 } else if (num < 100) {
2488 snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
2489 num %= 10;
2490 } else if (num < 1000) {
2491 int hundreds = num / 100;
2492 if (hundreds == 1)
2493 ast_copy_string(fn, "digits/1N", sizeof(fn));
2494 else
2495 snprintf(fn, sizeof(fn), "digits/%d", (num / 100));
2496
2497 playh++;
2498 num -= 100 * hundreds;
2499 if (num)
2500 playa++;
2501 } else if (num < 1000000) {
2502 res = ast_say_number_full_no(chan, num / 1000, ints, language, "n", audiofd, ctrlfd);
2503 if (res)
2504 return res;
2505 ast_copy_string(fn, "digits/thousand", sizeof(fn));
2506 num %= 1000;
2507 if (num && num < 100)
2508 playa++;
2509 } else if (num < 1000000000) {
2510 int millions = num / 1000000;
2511 res = ast_say_number_full_no(chan, millions, ints, language, "c", audiofd, ctrlfd);
2512 if (res)
2513 return res;
2514 ast_copy_string(fn, "digits/million", sizeof(fn));
2515 num %= 1000000;
2516 if (num && num < 100)
2517 playa++;
2518 } else {
2519 ast_debug(1, "Number '%d' is too big for me\n", num);
2520 res = -1;
2521 }
2522
2523 if (!res) {
2524 if (!ast_streamfile(chan, fn, language)) {
2525 if ((audiofd > -1) && (ctrlfd > -1))
2526 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
2527 else
2528 res = ast_waitstream(chan, ints);
2529 }
2530 ast_stopstream(chan);
2531 }
2532 }
2533 return res;
2534}
static int ast_say_number_full_no(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_no: Norwegian syntax New files: In addition to American English,...
Definition say.c:2454

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_no(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), language, and options.

Referenced by ast_say_number_full_no(), and say_number_full().

◆ ast_say_number_full_pl()

static int ast_say_number_full_pl ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

Definition at line 2741 of file say.c.

2742{
2743 char *zenski_cyfry[] = {"0", "1z", "2z", "3", "4", "5", "6", "7", "8", "9"};
2744
2745 char *zenski_cyfry2[] = {"0", "1", "2z", "3", "4", "5", "6", "7", "8", "9"};
2746
2747 char *meski_cyfry[] = {"0", "1", "2-1m", "3-1m", "4-1m", "5m", /*"2-1mdwaj"*/ "6m", "7m", "8m", "9m"};
2748
2749 char *meski_cyfry2[] = {"0", "1", "2-2m", "3-2m", "4-2m", "5m", "6m", "7m", "8m", "9m"};
2750
2751 char *meski_setki[] = {"", "100m", "200m", "300m", "400m", "500m", "600m", "700m", "800m", "900m"};
2752
2753 char *meski_dziesiatki[] = {"", "10m", "20m", "30m", "40m", "50m", "60m", "70m", "80m", "90m"};
2754
2755 char *meski_nastki[] = {"", "11m", "12m", "13m", "14m", "15m", "16m", "17m", "18m", "19m"};
2756
2757 char *nijaki_cyfry[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
2758
2759 char *nijaki_cyfry2[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
2760
2761 char *nijaki_setki[] = {"", "100", "200", "300", "400", "500", "600", "700", "800", "900"};
2762
2763 char *nijaki_dziesiatki[] = {"", "10", "20", "30", "40", "50", "60", "70", "80", "90"};
2764
2765 char *nijaki_nastki[] = {"", "11", "12", "13", "14", "15", "16", "17", "18", "19"};
2766
2767 char *rzedy[][3] = { {"1000", "1000.2", "1000.5"}, {"1000000", "1000000.2", "1000000.5"}, {"1000000000", "1000000000.2", "1000000000.5"}};
2768
2769 /* Initialise variables to allow compilation on Debian-stable, etc */
2770 odmiana *o;
2771
2772 static odmiana *odmiana_nieosobowa = NULL;
2773 static odmiana *odmiana_meska = NULL;
2774 static odmiana *odmiana_zenska = NULL;
2775
2776 if (odmiana_nieosobowa == NULL) {
2777 odmiana_nieosobowa = ast_malloc(sizeof(*odmiana_nieosobowa));
2778
2779 odmiana_nieosobowa->separator_dziesiatek = " ";
2780
2781 memcpy(odmiana_nieosobowa->cyfry, nijaki_cyfry, sizeof(odmiana_nieosobowa->cyfry));
2782 memcpy(odmiana_nieosobowa->cyfry2, nijaki_cyfry2, sizeof(odmiana_nieosobowa->cyfry));
2783 memcpy(odmiana_nieosobowa->setki, nijaki_setki, sizeof(odmiana_nieosobowa->setki));
2784 memcpy(odmiana_nieosobowa->dziesiatki, nijaki_dziesiatki, sizeof(odmiana_nieosobowa->dziesiatki));
2785 memcpy(odmiana_nieosobowa->nastki, nijaki_nastki, sizeof(odmiana_nieosobowa->nastki));
2786 memcpy(odmiana_nieosobowa->rzedy, rzedy, sizeof(odmiana_nieosobowa->rzedy));
2787 }
2788
2789 if (odmiana_zenska == NULL) {
2790 odmiana_zenska = ast_malloc(sizeof(*odmiana_zenska));
2791
2792 odmiana_zenska->separator_dziesiatek = " ";
2793
2794 memcpy(odmiana_zenska->cyfry, zenski_cyfry, sizeof(odmiana_zenska->cyfry));
2795 memcpy(odmiana_zenska->cyfry2, zenski_cyfry2, sizeof(odmiana_zenska->cyfry));
2796 memcpy(odmiana_zenska->setki, nijaki_setki, sizeof(odmiana_zenska->setki));
2797 memcpy(odmiana_zenska->dziesiatki, nijaki_dziesiatki, sizeof(odmiana_zenska->dziesiatki));
2798 memcpy(odmiana_zenska->nastki, nijaki_nastki, sizeof(odmiana_zenska->nastki));
2799 memcpy(odmiana_zenska->rzedy, rzedy, sizeof(odmiana_zenska->rzedy));
2800 }
2801
2802 if (odmiana_meska == NULL) {
2803 odmiana_meska = ast_malloc(sizeof(*odmiana_meska));
2804
2805 odmiana_meska->separator_dziesiatek = " ";
2806
2807 memcpy(odmiana_meska->cyfry, meski_cyfry, sizeof(odmiana_meska->cyfry));
2808 memcpy(odmiana_meska->cyfry2, meski_cyfry2, sizeof(odmiana_meska->cyfry));
2809 memcpy(odmiana_meska->setki, meski_setki, sizeof(odmiana_meska->setki));
2810 memcpy(odmiana_meska->dziesiatki, meski_dziesiatki, sizeof(odmiana_meska->dziesiatki));
2811 memcpy(odmiana_meska->nastki, meski_nastki, sizeof(odmiana_meska->nastki));
2812 memcpy(odmiana_meska->rzedy, rzedy, sizeof(odmiana_meska->rzedy));
2813 }
2814
2815 if (options) {
2816 if (strncasecmp(options, "f", 1) == 0)
2817 o = odmiana_zenska;
2818 else if (strncasecmp(options, "m", 1) == 0)
2819 o = odmiana_meska;
2820 else
2821 o = odmiana_nieosobowa;
2822 } else
2823 o = odmiana_nieosobowa;
2824
2825 powiedz(chan, language, audiofd, ctrlfd, ints, o, 0, num);
2826 return 0;
2827}
static void powiedz(struct ast_channel *chan, const char *language, int audiofd, int ctrlfd, const char *ints, odmiana *odm, int rzad, int i)
Definition say.c:2580
char * separator_dziesiatek
Definition say.c:2537
char * cyfry2[10]
Definition say.c:2539
char * cyfry[10]
Definition say.c:2538
char * rzedy[3][3]
Definition say.c:2543
char * nastki[10]
Definition say.c:2542
char * setki[10]
Definition say.c:2540
char * dziesiatki[10]
Definition say.c:2541

References ast_malloc, odmiana::cyfry, odmiana::cyfry2, odmiana::dziesiatki, language, odmiana::nastki, NULL, options, powiedz(), odmiana::rzedy, odmiana::separator_dziesiatek, and odmiana::setki.

Referenced by say_number_full().

◆ ast_say_number_full_ps()

static int ast_say_number_full_ps ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_ps: Pashto syntax

New files: In addition to English, the following sounds are required:

  • wesht
  • sawa
  • zara

Definition at line 1334 of file say.c.

1335{
1336 int res = 0, t = 0;
1337 char fn[256] = "";
1338 char fna[256] = "";
1339 int playWesht = 0;
1340 if (!num){
1341 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
1342 }
1343
1344 while (!res && num) {
1345 /* The grammar for Pashto numbers is the same as for English except
1346 * for the following:
1347 * - numbers 20 through 99 are said in reverse order, i.e. 21 is
1348 * "one-and twenty" and 68 is "eight-and sixty".
1349 * - 20 has unique pronounciation if there is a unit number after it
1350 * i.e. 21 is one wesht while 20 is just "twenty"
1351 * - 200 is called sawa
1352 * - 2000 is called zara
1353 */
1354 if (num < 0) {
1355 ast_copy_string(fn, "digits/minus", sizeof(fn));
1356 if ( num > INT_MIN ) {
1357 num = -num;
1358 } else {
1359 num = 0;
1360 }
1361 } else if (num < 20) {
1362 snprintf(fn, sizeof(fn), "digits/%d", num);
1363 num = 0;
1364 } else if (num < 100) {
1365 int ones = num % 10;
1366 if (ones) {
1367 snprintf(fn, sizeof(fn), "digits/%d", ones);
1368 num -= ones;
1369 if (num == 20){
1370 playWesht = 1;
1371 }
1372 } else {
1373 if (num == 20 && playWesht == 1){
1374 snprintf(fn, sizeof(fn), "digits/wesht");
1375 playWesht = 0;
1376 } else{
1377 snprintf(fn, sizeof(fn), "digits/%d", num);
1378 }
1379 num = 0;
1380 }
1381 } else if (num == 100 && t == 0) {
1382 ast_copy_string(fn, "digits/hundred", sizeof(fn));
1383 num = 0;
1384 } else if (num < 1000) {
1385 int hundreds = num / 100;
1386 num = num % 100;
1387 /* 100: hundreds = 1, num = 0
1388 * 101: hundreds = 1, num = 1
1389 * 200: hundreds = 2, num = 0
1390 * 202: hundreds = 2, num = 2
1391 */
1392 if (hundreds == 1){
1393 if (num){
1394 snprintf(fn, sizeof(fn), "digits/%d", hundreds);
1395 }
1396 ast_copy_string(fna, "digits/hundred", sizeof(fna));
1397 } else{
1398 snprintf(fn, sizeof(fn), "digits/%d", hundreds);
1399 ast_copy_string(fna, "digits/sawa", sizeof(fna));
1400 }
1401 } else if (num == 1000 && t == 0) {
1402 ast_copy_string(fn, "digits/thousand", sizeof(fn));
1403 num = 0;
1404 } else if (num < 1000000) {
1405 int thousands = num / 1000;
1406 num = num % 1000;
1407 t = 1;
1408 if (thousands == 1) {
1409 if (num){
1410 snprintf(fn, sizeof(fn), "digits/%d", thousands);
1411 }
1412 ast_copy_string(fna, "digits/thousand", sizeof(fna));
1413 } else {
1414 res = ast_say_number_full_ps(chan, thousands, ints, language, options, audiofd, ctrlfd);
1415 if (res)
1416 return res;
1417 ast_copy_string(fn, "digits/zara", sizeof(fn));
1418 }
1419 } else if (num < 1000000000) {
1420 int millions = num / 1000000;
1421 num = num % 1000000;
1422 t = 1;
1423 if (millions == 1) {
1424 ast_copy_string(fna, "digits/million", sizeof(fna));
1425 } else {
1426 res = ast_say_number_full_ps(chan, millions, ints, language, options, audiofd, ctrlfd);
1427 if (res)
1428 return res;
1429 ast_copy_string(fn, "digits/millions", sizeof(fn));
1430 }
1431 } else if (num <= INT_MAX) {
1432 int billions = num / 1000000000;
1433 num = num % 1000000000;
1434 t = 1;
1435 if (billions == 1) {
1436 ast_copy_string(fna, "digits/milliard", sizeof(fna));
1437 } else {
1438 res = ast_say_number_full_ps(chan, billions, ints, language, options, audiofd, ctrlfd);
1439 if (res) {
1440 return res;
1441 }
1442 ast_copy_string(fn, "digits/milliards", sizeof(fn));
1443 }
1444 } else {
1445 ast_debug(1, "Number '%d' is too big for me\n", num);
1446 res = -1;
1447 }
1448 if (!res) {
1449 if (!ast_streamfile(chan, fn, language)) {
1450 if ((audiofd > -1) && (ctrlfd > -1))
1451 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
1452 else
1453 res = ast_waitstream(chan, ints);
1454 }
1455 ast_stopstream(chan);
1456 if (!res) {
1457 if (strlen(fna) != 0 && !ast_streamfile(chan, fna, language)) {
1458 if ((audiofd > -1) && (ctrlfd > -1))
1459 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
1460 else
1461 res = ast_waitstream(chan, ints);
1462 }
1463 ast_stopstream(chan);
1464 strcpy(fna, "");
1465 }
1466 }
1467 }
1468 return res;
1469}
static int ast_say_number_full_ps(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_ps: Pashto syntax
Definition say.c:1334

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_ps(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), language, and options.

Referenced by ast_say_number_full_ps(), and say_number_full().

◆ ast_say_number_full_pt()

static int ast_say_number_full_pt ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

Definition at line 2837 of file say.c.

2838{
2839 int res = 0;
2840 int playh = 0;
2841 int mf = 1; /* +1 = male; -1 = female */
2842 char fn[256] = "";
2843
2844 if (!num)
2845 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
2846
2847 if (options && !strncasecmp(options, "f", 1))
2848 mf = -1;
2849
2850 while (!res && num ) {
2851 if (num < 0) {
2852 ast_copy_string(fn, "digits/minus", sizeof(fn));
2853 if ( num > INT_MIN ) {
2854 num = -num;
2855 } else {
2856 num = 0;
2857 }
2858 } else if (num < 20) {
2859 if ((num == 1 || num == 2) && (mf < 0))
2860 snprintf(fn, sizeof(fn), "digits/%dF", num);
2861 else
2862 snprintf(fn, sizeof(fn), "digits/%d", num);
2863 num = 0;
2864 } else if (num < 100) {
2865 snprintf(fn, sizeof(fn), "digits/%d", (num / 10) * 10);
2866 if (num % 10)
2867 playh = 1;
2868 num = num % 10;
2869 } else if (num < 1000) {
2870 if (num == 100)
2871 ast_copy_string(fn, "digits/100", sizeof(fn));
2872 else if (num < 200)
2873 ast_copy_string(fn, "digits/100E", sizeof(fn));
2874 else {
2875 if (mf < 0 && num > 199)
2876 snprintf(fn, sizeof(fn), "digits/%dF", (num / 100) * 100);
2877 else
2878 snprintf(fn, sizeof(fn), "digits/%d", (num / 100) * 100);
2879 if (num % 100)
2880 playh = 1;
2881 }
2882 num = num % 100;
2883 } else if (num < 1000000) {
2884 if (num > 1999) {
2885 res = ast_say_number_full_pt(chan, (num / 1000) * mf, ints, language, options, audiofd, ctrlfd);
2886 if (res)
2887 return res;
2888 }
2889 ast_copy_string(fn, "digits/1000", sizeof(fn));
2890 if ((num % 1000) && ((num % 1000) < 100 || !(num % 100)))
2891 playh = 1;
2892 num = num % 1000;
2893 } else if (num < 1000000000) {
2894 res = ast_say_number_full_pt(chan, (num / 1000000), ints, language, options, audiofd, ctrlfd );
2895 if (res)
2896 return res;
2897 if (num < 2000000)
2898 ast_copy_string(fn, "digits/1000000", sizeof(fn));
2899 else
2900 ast_copy_string(fn, "digits/1000000S", sizeof(fn));
2901
2902 if ((num % 1000000) &&
2903 /* no thousands */
2904 ((!((num / 1000) % 1000) && ((num % 1000) < 100 || !(num % 100))) ||
2905 /* no hundreds and below */
2906 (!(num % 1000) && (((num / 1000) % 1000) < 100 || !((num / 1000) % 100))) ) )
2907 playh = 1;
2908 num = num % 1000000;
2909 } else {
2910 /* number is too big */
2911 ast_log(LOG_WARNING, "Number '%d' is too big to say.", num);
2912 res = -1;
2913 }
2914 if (!res) {
2915 if (!ast_streamfile(chan, fn, language)) {
2916 if ((audiofd > -1) && (ctrlfd > -1))
2917 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
2918 else
2919 res = ast_waitstream(chan, ints);
2920 }
2921 ast_stopstream(chan);
2922 }
2923 if (!res && playh) {
2924 res = wait_file(chan, ints, "digits/pt-e", language);
2925 ast_stopstream(chan);
2926 playh = 0;
2927 }
2928 }
2929 return res;
2930}
static int ast_say_number_full_pt(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
Definition say.c:2837

References ast_copy_string(), ast_log, ast_say_digits_full(), ast_say_number_full_pt(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), language, LOG_WARNING, options, and wait_file().

Referenced by ast_say_number_full_pt(), and say_number_full().

◆ ast_say_number_full_ru()

static int ast_say_number_full_ru ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_ru: Russian syntax

additional files: n00.gsm (one hundred, two hundred, ...) thousand.gsm million.gsm thousands-i.gsm (tisyachi) million-a.gsm (milliona) thousands.gsm millions.gsm 1f.gsm (odna) 2f.gsm (dve)

where 'n' from 1 to 9

Definition at line 3216 of file say.c.

3217{
3218 int res = 0;
3219 int lastdigits = 0;
3220 char fn[256] = "";
3221 if (!num)
3222 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
3223
3224 while (!res && (num)) {
3225 if (num < 0) {
3226 ast_copy_string(fn, "digits/minus", sizeof(fn));
3227 if ( num > INT_MIN ) {
3228 num = -num;
3229 } else {
3230 num = 0;
3231 }
3232 } else if (num < 20) {
3233 if (options && strlen(options) == 1 && num < 3) {
3234 snprintf(fn, sizeof(fn), "digits/%d%s", num, options);
3235 } else {
3236 snprintf(fn, sizeof(fn), "digits/%d", num);
3237 }
3238 num = 0;
3239 } else if (num < 100) {
3240 snprintf(fn, sizeof(fn), "digits/%d", num - (num % 10));
3241 num %= 10;
3242 } else if (num < 1000){
3243 snprintf(fn, sizeof(fn), "digits/%d", num - (num % 100));
3244 num %= 100;
3245 } else if (num < 1000000) { /* 1,000,000 */
3246 lastdigits = get_lastdigits_ru(num / 1000);
3247 /* say thousands */
3248 if (lastdigits < 3) {
3249 res = ast_say_number_full_ru(chan, num / 1000, ints, language, "f", audiofd, ctrlfd);
3250 } else {
3251 res = ast_say_number_full_ru(chan, num / 1000, ints, language, NULL, audiofd, ctrlfd);
3252 }
3253 if (res)
3254 return res;
3255 if (lastdigits == 1) {
3256 ast_copy_string(fn, "digits/thousand", sizeof(fn));
3257 } else if (lastdigits > 1 && lastdigits < 5) {
3258 ast_copy_string(fn, "digits/thousands-i", sizeof(fn));
3259 } else {
3260 ast_copy_string(fn, "digits/thousands", sizeof(fn));
3261 }
3262 num %= 1000;
3263 } else if (num < 1000000000) { /* 1,000,000,000 */
3264 lastdigits = get_lastdigits_ru(num / 1000000);
3265 /* say millions */
3266 res = ast_say_number_full_ru(chan, num / 1000000, ints, language, NULL, audiofd, ctrlfd);
3267 if (res)
3268 return res;
3269 if (lastdigits == 1) {
3270 ast_copy_string(fn, "digits/million", sizeof(fn));
3271 } else if (lastdigits > 1 && lastdigits < 5) {
3272 ast_copy_string(fn, "digits/million-a", sizeof(fn));
3273 } else {
3274 ast_copy_string(fn, "digits/millions", sizeof(fn));
3275 }
3276 num %= 1000000;
3277 } else {
3278 ast_debug(1, "Number '%d' is too big for me\n", num);
3279 res = -1;
3280 }
3281 if (!res) {
3282 if (!ast_streamfile(chan, fn, language)) {
3283 if ((audiofd > -1) && (ctrlfd > -1))
3284 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
3285 else
3286 res = ast_waitstream(chan, ints);
3287 }
3288 ast_stopstream(chan);
3289 }
3290 }
3291 return res;
3292}
static int get_lastdigits_ru(int num)
determine last digits for thousands/millions (ru)
Definition say.c:3189
static int ast_say_number_full_ru(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_ru: Russian syntax
Definition say.c:3216

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_ru(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), get_lastdigits_ru(), language, NULL, and options.

Referenced by ast_say_number_full_ru(), and say_number_full().

◆ ast_say_number_full_se()

static int ast_say_number_full_se ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_se: Swedish syntax

Sound files needed

  • 1N

Definition at line 2937 of file say.c.

2938{
2939 int playh = 0;
2940 int start = 1;
2941 char fn[256] = "";
2942 int cn = 1; /* +1 = commune; -1 = neuter */
2943 int res = 0;
2944
2945 if (!num) {
2946 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
2947 }
2948 if (options && !strncasecmp(options, "n", 1)) cn = -1;
2949
2950 while (num || playh) {
2951 if (num < 0) {
2952 ast_copy_string(fn, "digits/minus", sizeof(fn));
2953 if ( num > INT_MIN ) {
2954 num = -num;
2955 } else {
2956 num = 0;
2957 }
2958 } else if (playh) {
2959 ast_copy_string(fn, "digits/hundred", sizeof(fn));
2960 playh = 0;
2961 } else if (start && num < 200 && num > 99 && cn == -1) {
2962 /* Don't say "en hundra" just say "hundra". */
2963 snprintf(fn, sizeof(fn), "digits/hundred");
2964 num -= 100;
2965 } else if (num == 1 && cn == -1) { /* En eller ett? */
2966 ast_copy_string(fn, "digits/1N", sizeof(fn));
2967 num = 0;
2968 } else if (num < 20) {
2969 snprintf(fn, sizeof(fn), "digits/%d", num);
2970 num = 0;
2971 } else if (num < 100) { /* Below hundreds - teens and tens */
2972 snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
2973 num %= 10;
2974 } else if (num < 1000) {
2975 /* Hundreds */
2976 snprintf(fn, sizeof(fn), "digits/%d", (num/100));
2977 playh++;
2978 num %= 100;
2979 } else if (num < 1000000) { /* 1,000,000 */
2980 /* Always say "ett hundra tusen", not "en hundra tusen" */
2981 res = ast_say_number_full_se(chan, num / 1000, ints, language, "c", audiofd, ctrlfd);
2982 if (res) {
2983 return res;
2984 }
2985 num %= 1000;
2986 ast_copy_string(fn, "digits/thousand", sizeof(fn));
2987 } else if (num < 1000000000) { /* 1,000,000,000 */
2988 /* Always say "en miljon", not "ett miljon" */
2989 res = ast_say_number_full_se(chan, num / 1000000, ints, language, "n", audiofd, ctrlfd);
2990 if (res) {
2991 return res;
2992 }
2993 num %= 1000000;
2994 ast_copy_string(fn, "digits/million", sizeof(fn));
2995 } else { /* Miljarder - Billions */
2996 ast_debug(1, "Number '%d' is too big for me\n", num);
2997 return -1;
2998 }
2999
3000 if (!ast_streamfile(chan, fn, language)) {
3001 if ((audiofd > -1) && (ctrlfd > -1)) {
3002 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
3003 } else {
3004 res = ast_waitstream(chan, ints);
3005 }
3006 ast_stopstream(chan);
3007 if (res) {
3008 return res;
3009 }
3010 }
3011 start = 0;
3012 }
3013 return 0;
3014}
static int ast_say_number_full_se(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_se: Swedish syntax
Definition say.c:2937

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_se(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), language, and options.

Referenced by ast_say_number_full_se(), and say_number_full().

◆ ast_say_number_full_th()

static int ast_say_number_full_th ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

Thai syntax.

Definition at line 3295 of file say.c.

3296{
3297 int res = 0;
3298 int playh = 0;
3299 char fn[256] = "";
3300 if (!num)
3301 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
3302
3303 while(!res && (num || playh)) {
3304 if (num < 0) {
3305 ast_copy_string(fn, "digits/lop", sizeof(fn));
3306 if ( num > INT_MIN ) {
3307 num = -num;
3308 } else {
3309 num = 0;
3310 }
3311 } else if (playh) {
3312 ast_copy_string(fn, "digits/roi", sizeof(fn));
3313 playh = 0;
3314 } else if (num < 100) {
3315 if ((num <= 20) || ((num % 10) == 1)) {
3316 snprintf(fn, sizeof(fn), "digits/%d", num);
3317 num = 0;
3318 } else {
3319 snprintf(fn, sizeof(fn), "digits/%d", (num / 10) * 10);
3320 num %= 10;
3321 }
3322 } else if (num < 1000) {
3323 snprintf(fn, sizeof(fn), "digits/%d", (num/100));
3324 playh++;
3325 num %= 100;
3326 } else if (num < 10000) { /* 10,000 */
3327 res = ast_say_number_full_th(chan, num / 1000, ints, language, audiofd, ctrlfd);
3328 if (res)
3329 return res;
3330 num %= 1000;
3331 ast_copy_string(fn, "digits/pan", sizeof(fn));
3332 } else if (num < 100000) { /* 100,000 */
3333 res = ast_say_number_full_th(chan, num / 10000, ints, language, audiofd, ctrlfd);
3334 if (res)
3335 return res;
3336 num %= 10000;
3337 ast_copy_string(fn, "digits/muan", sizeof(fn));
3338 } else if (num < 1000000) { /* 1,000,000 */
3339 res = ast_say_number_full_th(chan, num / 100000, ints, language, audiofd, ctrlfd);
3340 if (res)
3341 return res;
3342 num %= 100000;
3343 ast_copy_string(fn, "digits/san", sizeof(fn));
3344 } else {
3345 res = ast_say_number_full_th(chan, num / 1000000, ints, language, audiofd, ctrlfd);
3346 if (res)
3347 return res;
3348 num %= 1000000;
3349 ast_copy_string(fn, "digits/larn", sizeof(fn));
3350 }
3351 if (!res) {
3352 if(!ast_streamfile(chan, fn, language)) {
3353 if ((audiofd > -1) && (ctrlfd > -1))
3354 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
3355 else
3356 res = ast_waitstream(chan, ints);
3357 }
3358 ast_stopstream(chan);
3359 }
3360 }
3361 return res;
3362}
static int ast_say_number_full_th(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
Thai syntax.
Definition say.c:3295

References ast_copy_string(), ast_say_digits_full(), ast_say_number_full_th(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by ast_say_number_full_th(), and say_number_full().

◆ ast_say_number_full_ur()

static int ast_say_number_full_ur ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

Definition at line 3130 of file say.c.

3131{
3132 int res = 0;
3133 int playh = 0;
3134 char fn[256] = "";
3135
3136 if (!num) {
3137 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
3138 }
3139
3140 while (!res && (num || playh)) {
3141 if (playh) {
3142 snprintf(fn, sizeof(fn), "digits/hundred");
3143 playh = 0;
3144 } else if (num < 100) {
3145 snprintf(fn, sizeof(fn), "digits/%d", num);
3146 num = 0;
3147 } else if (num < 1000) {
3148 snprintf(fn, sizeof(fn), "digits/%d", (num / 100));
3149 playh++;
3150 num -= ((num / 100) * 100);
3151 } else if (num < 100000) { /* 1,00,000 */
3152 if ((res = ast_say_number_full_ur(chan, num / 1000, ints, language, options, audiofd, ctrlfd))) {
3153 return res;
3154 }
3155 num = num % 1000;
3156 snprintf(fn, sizeof(fn), "digits/thousand");
3157 } else if (num < 10000000) { /* 1,00,00,000 */
3158 if ((res = ast_say_number_full_ur(chan, num / 100000, ints, language, options, audiofd, ctrlfd))) {
3159 return res;
3160 }
3161 num = num % 100000;
3162 snprintf(fn, sizeof(fn), "digits/lac");
3163 } else if (num < 1000000000) { /* 1,00,00,00,000 */
3164 if ((res = ast_say_number_full_ur(chan, num / 10000000, ints, language, options, audiofd, ctrlfd))) {
3165 return res;
3166 }
3167 num = num % 10000000;
3168 snprintf(fn, sizeof(fn), "digits/crore");
3169 } else {
3170 ast_debug(1, "Number '%d' is too big for me\n", num);
3171 res = -1;
3172 }
3173
3174 if (!res) {
3175 if (!ast_streamfile(chan, fn, language)) {
3176 if ((audiofd > -1) && (ctrlfd > -1)) {
3177 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
3178 } else {
3179 res = ast_waitstream(chan, ints);
3180 }
3181 }
3182 ast_stopstream(chan);
3183 }
3184 }
3185 return res;
3186}
static int ast_say_number_full_ur(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
Definition say.c:3130

References ast_debug, ast_say_digits_full(), ast_say_number_full_ur(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), language, and options.

Referenced by ast_say_number_full_ur(), and say_number_full().

◆ ast_say_number_full_vi()

static int ast_say_number_full_vi ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_vi: Vietnamese syntax

Definition at line 3365 of file say.c.

3366{
3367 int res = 0;
3368 int playh = 0;
3369 int playoh = 0;
3370 int playohz = 0;
3371 int playz = 0;
3372 int playl = 0;
3373 char fn[256] = "";
3374 if (!num)
3375 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
3376 while (!res && (num || playh)) {
3377 if (num < 0) {
3378 ast_copy_string(fn, "digits/minus", sizeof(fn));
3379 if ( num > INT_MIN ) {
3380 num = -num;
3381 } else {
3382 num = 0;
3383 }
3384 } else if (playl) {
3385 snprintf(fn, sizeof(fn), "digits/%da", num);
3386 playl = 0;
3387 num = 0;
3388 } else if (playh) {
3389 ast_copy_string(fn, "digits/hundred", sizeof(fn));
3390 playh = 0;
3391 } else if (playz) {
3392 ast_copy_string(fn, "digits/odd", sizeof(fn));
3393 playz = 0;
3394 } else if (playoh) {
3395 ast_copy_string(fn, "digits/0-hundred", sizeof(fn));
3396 playoh = 0;
3397 } else if (playohz) {
3398 ast_copy_string(fn, "digits/0-hundred-odd", sizeof(fn));
3399 playohz = 0;
3400 } else if (num < 20) {
3401 snprintf(fn, sizeof(fn), "digits/%d", num);
3402 num = 0;
3403 } else if (num < 100) {
3404 snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
3405 num %= 10;
3406 if ((num == 5) || (num == 4) || (num == 1)) playl++;
3407 } else {
3408 if (num < 1000) {
3409 snprintf(fn, sizeof(fn), "digits/%d", (num/100));
3410 num %= 100;
3411 if (num && (num < 10)) {
3412 playz++;
3413 playh++;
3414 } else {
3415 playh++;
3416 }
3417 } else {
3418 if (num < 1000000) { /* 1,000,000 */
3419 res = ast_say_number_full_vi(chan, num / 1000, ints, language, audiofd, ctrlfd);
3420 if (res)
3421 return res;
3422 num %= 1000;
3423 snprintf(fn, sizeof(fn), "digits/thousand");
3424 if (num && (num < 10)) {
3425 playohz++;
3426 } else if (num && (num < 100)){
3427 playoh++;
3428 } else {
3429 playh = 0;
3430 playohz = 0;
3431 playoh = 0;
3432 }
3433 } else {
3434 if (num < 1000000000) { /* 1,000,000,000 */
3435 res = ast_say_number_full_vi(chan, num / 1000000, ints, language, audiofd, ctrlfd);
3436 if (res)
3437 return res;
3438 num %= 1000000;
3439 ast_copy_string(fn, "digits/million", sizeof(fn));
3440 } else {
3441 res = -1;
3442 }
3443 }
3444 }
3445 }
3446 if (!res) {
3447 if (!ast_streamfile(chan, fn, language)) {
3448 if ((audiofd > -1) && (ctrlfd > -1))
3449 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
3450 else
3451 res = ast_waitstream(chan, ints);
3452 }
3453 ast_stopstream(chan);
3454 }
3455 }
3456 return res;
3457}

References ast_copy_string(), ast_say_digits_full(), ast_say_number_full_vi(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by ast_say_enumeration_full_vi(), ast_say_number_full_vi(), and say_number_full().

◆ ast_say_number_full_zh()

static int ast_say_number_full_zh ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full_zh: Taiwanese / Chinese syntax

Definition at line 3017 of file say.c.

3018{
3019 int res = 0;
3020 int playh = 0;
3021 int playt = 0;
3022 int playz = 0;
3023 int last_length = 0;
3024 char buf[20] = "";
3025 char fn[256] = "";
3026 if (!num)
3027 return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
3028
3029 while (!res && (num || playh || playt || playz)) {
3030 if (num < 0) {
3031 ast_copy_string(fn, "digits/minus", sizeof(fn));
3032 if ( num > INT_MIN ) {
3033 num = -num;
3034 } else {
3035 num = 0;
3036 }
3037 } else if (playz) {
3038 snprintf(fn, sizeof(fn), "digits/0");
3039 last_length = 0;
3040 playz = 0;
3041 } else if (playh) {
3042 ast_copy_string(fn, "digits/hundred", sizeof(fn));
3043 playh = 0;
3044 } else if (playt) {
3045 snprintf(fn, sizeof(fn), "digits/thousand");
3046 playt = 0;
3047 } else if (num < 10) {
3048 snprintf(buf, 12, "%d", num);
3049 if (last_length - strlen(buf) > 1 && last_length != 0) {
3050 last_length = strlen(buf);
3051 playz++;
3052 continue;
3053 }
3054 snprintf(fn, sizeof(fn), "digits/%d", num);
3055 num = 0;
3056 } else if (num < 100) {
3057 snprintf(buf, 10, "%d", num);
3058 if (last_length - strlen(buf) > 1 && last_length != 0) {
3059 last_length = strlen(buf);
3060 playz++;
3061 continue;
3062 }
3063 last_length = strlen(buf);
3064 snprintf(fn, sizeof(fn), "digits/%d", (num / 10) * 10);
3065 num %= 10;
3066 } else {
3067 if (num < 1000){
3068 snprintf(buf, 10, "%d", num);
3069 if (last_length - strlen(buf) > 1 && last_length != 0) {
3070 last_length = strlen(buf);
3071 playz++;
3072 continue;
3073 }
3074 snprintf(fn, sizeof(fn), "digits/%d", (num / 100));
3075 playh++;
3076 snprintf(buf, 10, "%d", num);
3077 ast_debug(1, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
3078 last_length = strlen(buf);
3079 num -= ((num / 100) * 100);
3080 } else if (num < 10000){
3081 snprintf(buf, 10, "%d", num);
3082 snprintf(fn, sizeof(fn), "digits/%d", (num / 1000));
3083 playt++;
3084 snprintf(buf, 10, "%d", num);
3085 ast_debug(1, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
3086 last_length = strlen(buf);
3087 num -= ((num / 1000) * 1000);
3088 } else if (num < 100000000) { /* 100,000,000 */
3089 res = ast_say_number_full_zh(chan, num / 10000, ints, language, audiofd, ctrlfd);
3090 if (res)
3091 return res;
3092 snprintf(buf, 10, "%d", num);
3093 ast_debug(1, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
3094 num -= ((num / 10000) * 10000);
3095 last_length = strlen(buf);
3096 snprintf(fn, sizeof(fn), "digits/wan");
3097 } else {
3098 if (num < 1000000000) { /* 1,000,000,000 */
3099 res = ast_say_number_full_zh(chan, num / 100000000, ints, language, audiofd, ctrlfd);
3100 if (res)
3101 return res;
3102 snprintf(buf, 10, "%d", num);
3103 ast_debug(1, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
3104 last_length = strlen(buf);
3105 num -= ((num / 100000000) * 100000000);
3106 snprintf(fn, sizeof(fn), "digits/yi");
3107 } else {
3108 ast_debug(1, "Number '%d' is too big for me\n", num);
3109 res = -1;
3110 }
3111 }
3112 }
3113 if (!res) {
3114 if (!ast_streamfile(chan, fn, language)) {
3115 if ((audiofd > -1) && (ctrlfd > -1))
3116 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
3117 else
3118 res = ast_waitstream(chan, ints);
3119 }
3120 ast_stopstream(chan);
3121 }
3122 }
3123 return res;
3124}
char buf[BUFSIZE]
Definition eagi_proxy.c:66
static int ast_say_number_full_zh(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_zh: Taiwanese / Chinese syntax
Definition say.c:3017

References ast_copy_string(), ast_debug, ast_say_digits_full(), ast_say_number_full_zh(), ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), buf, and language.

Referenced by ast_say_number_full_zh(), and say_number_full().

◆ ast_say_time_de()

int ast_say_time_de ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

German syntax.

Definition at line 7754 of file say.c.

7755{
7756 struct timeval when = { t, 0 };
7757 struct ast_tm tm;
7758 int res = 0;
7759
7760 ast_localtime(&when, &tm, NULL);
7761 if (!res)
7762 res = ast_say_number(chan, tm.tm_hour, ints, lang, "n");
7763 if (!res)
7764 res = ast_streamfile(chan, "digits/oclock", lang);
7765 if (!res)
7766 res = ast_waitstream(chan, ints);
7767 if (!res)
7768 if (tm.tm_min > 0)
7769 res = ast_say_number(chan, tm.tm_min, ints, lang, "f");
7770 return res;
7771}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, and ast_tm::tm_min.

Referenced by say_time().

◆ ast_say_time_en()

int ast_say_time_en ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

English syntax.

Definition at line 7705 of file say.c.

7706{
7707 struct timeval when = { t, 0 };
7708 struct ast_tm tm;
7709 int res = 0;
7710 int hour, pm=0;
7711
7712 ast_localtime(&when, &tm, NULL);
7713 hour = tm.tm_hour;
7714 if (!hour)
7715 hour = 12;
7716 else if (hour == 12)
7717 pm = 1;
7718 else if (hour > 12) {
7719 hour -= 12;
7720 pm = 1;
7721 }
7722 if (!res)
7723 res = ast_say_number(chan, hour, ints, lang, (char *) NULL);
7724
7725 if (tm.tm_min > 9) {
7726 if (!res)
7727 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
7728 } else if (tm.tm_min) {
7729 if (!res)
7730 res = ast_streamfile(chan, "digits/oh", lang);
7731 if (!res)
7732 res = ast_waitstream(chan, ints);
7733 if (!res)
7734 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
7735 } else {
7736 if (!res)
7737 res = ast_streamfile(chan, "digits/oclock", lang);
7738 if (!res)
7739 res = ast_waitstream(chan, ints);
7740 }
7741 if (pm) {
7742 if (!res)
7743 res = ast_streamfile(chan, "digits/p-m", lang);
7744 } else {
7745 if (!res)
7746 res = ast_streamfile(chan, "digits/a-m", lang);
7747 }
7748 if (!res)
7749 res = ast_waitstream(chan, ints);
7750 return res;
7751}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, and ast_tm::tm_min.

Referenced by say_time().

◆ ast_say_time_fr()

int ast_say_time_fr ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

French syntax.

Definition at line 7797 of file say.c.

7798{
7799 struct timeval when = { t, 0 };
7800 struct ast_tm tm;
7801 int res = 0;
7802
7803 ast_localtime(&when, &tm, NULL);
7804
7805 res = ast_say_number(chan, tm.tm_hour, ints, lang, "f");
7806 if (!res) {
7807 res = ast_streamfile(chan, "digits/oclock", lang);
7808 }
7809 if (!res) {
7810 res = ast_waitstream(chan, ints);
7811 }
7812 if (tm.tm_min) {
7813 if (!res) {
7814 res = ast_say_number(chan, tm.tm_min, ints, lang, "f");
7815 }
7816 }
7817 return res;
7818}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, and ast_tm::tm_min.

Referenced by say_time().

◆ ast_say_time_gr()

static int ast_say_time_gr ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Greek support.

A list of the files that you need to create

  • digits/female/1..4 : "Mia, dyo , treis, tesseris "
  • digits/kai : "KAI"
  • digits : "h wra"
  • digits/p-m : "meta meshmbrias"
  • digits/a-m : "pro meshmbrias"

Definition at line 8894 of file say.c.

8895{
8896
8897 struct timeval when = { t, 0 };
8898 struct ast_tm tm;
8899 int res = 0;
8900 int hour, pm=0;
8901
8902 ast_localtime(&when, &tm, NULL);
8903 hour = tm.tm_hour;
8904
8905 if (!hour)
8906 hour = 12;
8907 else if (hour == 12)
8908 pm = 1;
8909 else if (hour > 12) {
8910 hour -= 12;
8911 pm = 1;
8912 }
8913
8914 res = gr_say_number_female(hour, chan, ints, lang);
8915 if (tm.tm_min) {
8916 if (!res)
8917 res = ast_streamfile(chan, "digits/kai", lang);
8918 if (!res)
8919 res = ast_waitstream(chan, ints);
8920 if (!res)
8921 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
8922 } else {
8923 if (!res)
8924 res = ast_streamfile(chan, "digits/hwra", lang);
8925 if (!res)
8926 res = ast_waitstream(chan, ints);
8927 }
8928 if (pm) {
8929 if (!res)
8930 res = ast_streamfile(chan, "digits/p-m", lang);
8931 } else {
8932 if (!res)
8933 res = ast_streamfile(chan, "digits/a-m", lang);
8934 }
8935 if (!res)
8936 res = ast_waitstream(chan, ints);
8937 return res;
8938}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), gr_say_number_female(), NULL, ast_tm::tm_hour, and ast_tm::tm_min.

Referenced by ast_say_datetime_gr(), and say_time().

◆ ast_say_time_he()

int ast_say_time_he ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Hebrew syntax.

Definition at line 7960 of file say.c.

7961{
7962 struct timeval when = { t, 0 };
7963 struct ast_tm tm;
7964 int res = 0;
7965 int hour;
7966
7967 ast_localtime(&when, &tm, NULL);
7968 hour = tm.tm_hour;
7969 if (!hour)
7970 hour = 12;
7971
7972 if (!res)
7973 res = ast_say_number_full_he(chan, hour, ints, lang, "f", -1, -1);
7974
7975 if (tm.tm_min > 9) {
7976 if (!res)
7977 res = ast_say_number_full_he(chan, tm.tm_min, ints, lang, "f", -1, -1);
7978 } else if (tm.tm_min) {
7979 if (!res) { /* say a leading zero if needed */
7980 res = ast_say_number_full_he(chan, 0, ints, lang, "f", -1, -1);
7981 }
7982 if (!res)
7983 res = ast_waitstream(chan, ints);
7984 if (!res)
7985 res = ast_say_number_full_he(chan, tm.tm_min, ints, lang, "f", -1, -1);
7986 } else {
7987 if (!res)
7988 res = ast_waitstream(chan, ints);
7989 }
7990 if (!res)
7991 res = ast_waitstream(chan, ints);
7992 return res;
7993}

References ast_localtime(), ast_say_number_full_he(), ast_waitstream(), NULL, ast_tm::tm_hour, and ast_tm::tm_min.

Referenced by say_time().

◆ ast_say_time_hu()

int ast_say_time_hu ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Hungarian syntax.

Definition at line 7774 of file say.c.

7775{
7776 struct timeval when = { t, 0 };
7777 struct ast_tm tm;
7778 int res = 0;
7779
7780 ast_localtime(&when, &tm, NULL);
7781 if (!res)
7782 res = ast_say_number(chan, tm.tm_hour, ints, lang, "n");
7783 if (!res)
7784 res = ast_streamfile(chan, "digits/oclock", lang);
7785 if (!res)
7786 res = ast_waitstream(chan, ints);
7787 if (!res)
7788 if (tm.tm_min > 0) {
7789 res = ast_say_number(chan, tm.tm_min, ints, lang, "f");
7790 if (!res)
7791 res = ast_streamfile(chan, "minute", lang);
7792 }
7793 return res;
7794}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, and ast_tm::tm_min.

Referenced by say_time().

◆ ast_say_time_ja()

static int ast_say_time_ja ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Definition at line 8942 of file say.c.

8943{
8944 struct timeval tv = { t, 0 };
8945 struct ast_tm tm;
8946 int res = 0;
8947 int hour, pm=0;
8948
8949 ast_localtime(&tv, &tm, NULL);
8950 hour = tm.tm_hour;
8951
8952 if (!hour)
8953 hour = 12;
8954 else if (hour == 12)
8955 pm = 1;
8956 else if (hour > 12) {
8957 hour -= 12;
8958 pm = 1;
8959 }
8960
8961 if (pm) {
8962 if (!res)
8963 res = ast_streamfile(chan, "digits/p-m", lang);
8964 } else {
8965 if (!res)
8966 res = ast_streamfile(chan, "digits/a-m", lang);
8967 }
8968 if (hour == 9 || hour == 21) {
8969 if (!res)
8970 res = ast_streamfile(chan, "digits/9_2", lang);
8971 } else {
8972 if (!res)
8973 res = ast_say_number(chan, hour, ints, lang, (char *) NULL);
8974 }
8975 if (!res)
8976 res = ast_streamfile(chan, "digits/ji", lang);
8977 if (!res)
8978 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
8979 if (!res)
8980 res = ast_streamfile(chan, "digits/fun", lang);
8981 if (!res)
8982 res = ast_waitstream(chan, ints);
8983 return res;
8984}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, and ast_tm::tm_min.

Referenced by say_time().

◆ ast_say_time_ka()

static int ast_say_time_ka ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Georgian syntax. e.g. "otxi saati da eqvsi tsuti".

Definition at line 10025 of file say.c.

10026{
10027 struct timeval when = { t, 0 };
10028 struct ast_tm tm;
10029 int res = 0;
10030
10031 ast_localtime(&when, &tm, NULL);
10032
10033 res = ast_say_number(chan, tm.tm_hour, ints, lang, (char*)NULL);
10034 if (!res) {
10035 res = ast_streamfile(chan, "digits/saati_da", lang);
10036 if (!res) {
10037 res = ast_waitstream(chan, ints);
10038 }
10039 }
10040
10041 if (tm.tm_min) {
10042 if (!res) {
10043 res = ast_say_number(chan, tm.tm_min, ints, lang, (char*)NULL);
10044
10045 if (!res) {
10046 res = ast_streamfile(chan, "digits/tsuti", lang);
10047 if (!res) {
10048 res = ast_waitstream(chan, ints);
10049 }
10050 }
10051 }
10052 }
10053 return res;
10054}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, and ast_tm::tm_min.

Referenced by say_time().

◆ ast_say_time_nl()

int ast_say_time_nl ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Dutch syntax.

Definition at line 7821 of file say.c.

7822{
7823 struct timeval when = { t, 0 };
7824 struct ast_tm tm;
7825 int res = 0;
7826
7827 ast_localtime(&when, &tm, NULL);
7828 if (!res)
7829 res = ast_say_number(chan, tm.tm_hour, ints, lang, (char *) NULL);
7830 if (!res)
7831 res = ast_streamfile(chan, "digits/nl-uur", lang);
7832 if (!res)
7833 res = ast_waitstream(chan, ints);
7834 if (!res)
7835 if (tm.tm_min > 0)
7836 res = ast_say_number(chan, tm.tm_min, ints, lang, NULL);
7837 return res;
7838}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, and ast_tm::tm_min.

Referenced by say_time().

◆ ast_say_time_pt()

int ast_say_time_pt ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Portuguese syntax.

Definition at line 7841 of file say.c.

7842{
7843 struct timeval when = { t, 0 };
7844 struct ast_tm tm;
7845 int res = 0;
7846 int hour;
7847
7848 ast_localtime(&when, &tm, NULL);
7849 hour = tm.tm_hour;
7850 if (!res)
7851 res = ast_say_number(chan, hour, ints, lang, "f");
7852 if (tm.tm_min) {
7853 if (!res)
7854 res = wait_file(chan, ints, "digits/pt-e", lang);
7855 if (!res)
7856 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
7857 } else {
7858 if (!res)
7859 res = wait_file(chan, ints, "digits/pt-hora", lang);
7860 if (tm.tm_hour != 1)
7861 if (!res)
7862 res = wait_file(chan, ints, "digits/pt-sss", lang);
7863 }
7864 if (!res)
7865 res = ast_say_number(chan, hour, ints, lang, (char *) NULL);
7866 return res;
7867}

References ast_localtime(), ast_say_number(), NULL, ast_tm::tm_hour, ast_tm::tm_min, and wait_file().

Referenced by say_time().

◆ ast_say_time_pt_BR()

int ast_say_time_pt_BR ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Brazilian Portuguese syntax.

Definition at line 7870 of file say.c.

7871{
7872 struct timeval when = { t, 0 };
7873 struct ast_tm tm;
7874 int res = 0;
7875
7876 ast_localtime(&when, &tm, NULL);
7877
7878 res = ast_say_number(chan, tm.tm_hour, ints, lang, "f");
7879 if (!res) {
7880 if (tm.tm_hour > 1)
7881 res = wait_file(chan, ints, "digits/hours", lang);
7882 else
7883 res = wait_file(chan, ints, "digits/hour", lang);
7884 }
7885 if ((!res) && (tm.tm_min)) {
7886 res = wait_file(chan, ints, "digits/pt-e", lang);
7887 if (!res)
7888 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
7889 if (!res) {
7890 if (tm.tm_min > 1)
7891 res = wait_file(chan, ints, "minutes", lang);
7892 else
7893 res = wait_file(chan, ints, "minute", lang);
7894 }
7895 }
7896 return res;
7897}

References ast_localtime(), ast_say_number(), NULL, ast_tm::tm_hour, ast_tm::tm_min, and wait_file().

Referenced by say_time().

◆ ast_say_time_th()

int ast_say_time_th ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Thai syntax.

Definition at line 7900 of file say.c.

7901{
7902 struct timeval when = { t, 0 };
7903 struct ast_tm tm;
7904 int res = 0;
7905 int hour;
7906 ast_localtime(&when, &tm, NULL);
7907 hour = tm.tm_hour;
7908 if (!hour)
7909 hour = 24;
7910 if (!res)
7911 res = ast_say_number(chan, hour, ints, lang, (char *) NULL);
7912 if (!res)
7913 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
7914 return res;
7915}

References ast_localtime(), ast_say_number(), NULL, ast_tm::tm_hour, and ast_tm::tm_min.

Referenced by say_time().

◆ ast_say_time_zh()

int ast_say_time_zh ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Taiwanese / Chinese syntax.

Definition at line 7918 of file say.c.

7919{
7920 struct timeval when = { t, 0 };
7921 struct ast_tm tm;
7922 int res = 0;
7923 int hour, pm=0;
7924
7925 ast_localtime(&when, &tm, NULL);
7926 hour = tm.tm_hour;
7927 if (!hour)
7928 hour = 12;
7929 else if (hour == 12)
7930 pm = 1;
7931 else if (hour > 12) {
7932 hour -= 12;
7933 pm = 1;
7934 }
7935 if (pm) {
7936 if (!res)
7937 res = ast_streamfile(chan, "digits/p-m", lang);
7938 } else {
7939 if (!res)
7940 res = ast_streamfile(chan, "digits/a-m", lang);
7941 }
7942 if (!res)
7943 res = ast_waitstream(chan, ints);
7944 if (!res)
7945 res = ast_say_number(chan, hour, ints, lang, (char *) NULL);
7946 if (!res)
7947 res = ast_streamfile(chan, "digits/oclock", lang);
7948 if (!res)
7949 res = ast_waitstream(chan, ints);
7950 if (!res)
7951 res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
7952 if (!res)
7953 res = ast_streamfile(chan, "minute", lang);
7954 if (!res)
7955 res = ast_waitstream(chan, ints);
7956 return res;
7957}

References ast_localtime(), ast_say_number(), ast_streamfile(), ast_waitstream(), NULL, ast_tm::tm_hour, and ast_tm::tm_min.

Referenced by say_time().

◆ ast_translate_number_ka()

static char * ast_translate_number_ka ( int  num,
char *  res,
int  res_len 
)
static

Georgian support.

Convert a number into a semi-localized string. Only for Georgian. res must be of at least 256 bytes, preallocated. The output corresponds to Georgian spoken numbers, so it may be either converted to real words by applying a direct conversion table, or played just by substituting the entities with played files.

Output may consist of the following tokens (separated by spaces): 0, minus. 1-9, 1_-9_. (erti, ori, sami, otxi, ... . erti, or, sam, otx, ...). 10-19. 20, 40, 60, 80, 20_, 40_, 60_, 80_. (oci, ormoci, ..., ocda, ormocda, ...). 100, 100_, 200, 200_, ..., 900, 900_. (asi, as, orasi, oras, ...). 1000, 1000_. (atasi, atas). 1000000, 1000000_. (milioni, milion). 1000000000, 1000000000_. (miliardi, miliard).

To be able to play the sounds, each of the above tokens needs a corresponding sound file. (e.g. 200_.gsm).

Definition at line 9765 of file say.c.

9766{
9767 char buf[256];
9768 int digit = 0;
9769 int remaining = 0;
9770
9771
9772 if (num < 0) {
9773 strncat(res, "minus ", res_len - strlen(res) - 1);
9774 if ( num > INT_MIN ) {
9775 num = -num;
9776 } else {
9777 num = 0;
9778 }
9779 }
9780
9781
9782 /* directly read the numbers */
9783 if (num <= 20 || num == 40 || num == 60 || num == 80 || num == 100) {
9784 snprintf(buf, sizeof(buf), "%d", num);
9785 strncat(res, buf, res_len - strlen(res) - 1);
9786 return res;
9787 }
9788
9789
9790 if (num < 40) { /* ocda... */
9791 strncat(res, "20_ ", res_len - strlen(res) - 1);
9792 return ast_translate_number_ka(num - 20, res, res_len);
9793 }
9794
9795 if (num < 60) { /* ormocda... */
9796 strncat(res, "40_ ", res_len - strlen(res) - 1);
9797 return ast_translate_number_ka(num - 40, res, res_len);
9798 }
9799
9800 if (num < 80) { /* samocda... */
9801 strncat(res, "60_ ", res_len - strlen(res) - 1);
9802 return ast_translate_number_ka(num - 60, res, res_len);
9803 }
9804
9805 if (num < 100) { /* otxmocda... */
9806 strncat(res, "80_ ", res_len - strlen(res) - 1);
9807 return ast_translate_number_ka(num - 80, res, res_len);
9808 }
9809
9810
9811 if (num < 1000) { /* as, oras, samas, ..., cxraas. asi, orasi, ..., cxraasi. */
9812 remaining = num % 100;
9813 digit = (num - remaining) / 100;
9814
9815 if (remaining == 0) {
9816 snprintf(buf, sizeof(buf), "%d", num);
9817 strncat(res, buf, res_len - strlen(res) - 1);
9818 return res;
9819 } else {
9820 snprintf(buf, sizeof(buf), "%d_ ", digit*100);
9821 strncat(res, buf, res_len - strlen(res) - 1);
9822 return ast_translate_number_ka(remaining, res, res_len);
9823 }
9824 }
9825
9826
9827 if (num == 1000) {
9828 strncat(res, "1000", res_len - strlen(res) - 1);
9829 return res;
9830 }
9831
9832
9833 if (num < 1000000) {
9834 remaining = num % 1000;
9835 digit = (num - remaining) / 1000;
9836
9837 if (remaining == 0) {
9838 ast_translate_number_ka(digit, res, res_len);
9839 strncat(res, " 1000", res_len - strlen(res) - 1);
9840 return res;
9841 }
9842
9843 if (digit == 1) {
9844 strncat(res, "1000_ ", res_len - strlen(res) - 1);
9845 return ast_translate_number_ka(remaining, res, res_len);
9846 }
9847
9848 ast_translate_number_ka(digit, res, res_len);
9849 strncat(res, " 1000_ ", res_len - strlen(res) - 1);
9850 return ast_translate_number_ka(remaining, res, res_len);
9851 }
9852
9853
9854 if (num == 1000000) {
9855 strncat(res, "1 1000000", res_len - strlen(res) - 1);
9856 return res;
9857 }
9858
9859
9860 if (num < 1000000000) {
9861 remaining = num % 1000000;
9862 digit = (num - remaining) / 1000000;
9863
9864 if (remaining == 0) {
9865 ast_translate_number_ka(digit, res, res_len);
9866 strncat(res, " 1000000", res_len - strlen(res) - 1);
9867 return res;
9868 }
9869
9870 ast_translate_number_ka(digit, res, res_len);
9871 strncat(res, " 1000000_ ", res_len - strlen(res) - 1);
9872 return ast_translate_number_ka(remaining, res, res_len);
9873 }
9874
9875
9876 if (num == 1000000000) {
9877 strncat(res, "1 1000000000", res_len - strlen(res) - 1);
9878 return res;
9879 }
9880
9881
9882 if (num > 1000000000) {
9883 remaining = num % 1000000000;
9884 digit = (num - remaining) / 1000000000;
9885
9886 if (remaining == 0) {
9887 ast_translate_number_ka(digit, res, res_len);
9888 strncat(res, " 1000000000", res_len - strlen(res) - 1);
9889 return res;
9890 }
9891
9892 ast_translate_number_ka(digit, res, res_len);
9893 strncat(res, " 1000000000_ ", res_len - strlen(res) - 1);
9894 return ast_translate_number_ka(remaining, res, res_len);
9895 }
9896
9897 return res;
9898
9899}
char digit

References ast_translate_number_ka(), buf, and digit.

Referenced by ast_say_number_full_ka(), and ast_translate_number_ka().

◆ counted_adjective_ending_ru()

static const char * counted_adjective_ending_ru ( int  num,
const char  gender[] 
)
static

In slavic languages such as Russian and Ukrainian the rules for declining adjectives are simpler than those for nouns. When counting we use only the singular (to which we give no suffix) and the genative plural (which we represent by adding an "x"). Oh, an in the singular gender matters so we append the supplied gender suffix ("m", "f", "n").

Definition at line 10195 of file say.c.

10196{
10197 if (num < 0) {
10198 num *= -1;
10199 }
10200 num %= 100; /* never pay attention to more than two digits */
10201 if (num >= 20) { /* at 20 and beyond only the last digit matters */
10202 num %= 10;
10203 }
10204 if (num == 1) {
10205 return gender ? gender : "";
10206 } else { /* all other numbers get the genative plural */
10207 return "x";
10208 }
10209}

Referenced by ast_say_counted_adjective().

◆ counted_noun_ending_en()

static const char * counted_noun_ending_en ( int  num)
static

In English, we use the plural for everything but one. For example:

  • 1 degree
  • 2 degrees
  • 5 degrees The filename for the plural form is generated by appending "s". Note that purpose is to generate a unique filename, not to implement irregular declensions. Thus:
  • 1 man
  • 2 mans (the "mans" soundfile will of course say "men")

Definition at line 10131 of file say.c.

10132{
10133 if (num == 1 || num == -1) {
10134 return "";
10135 } else {
10136 return "s";
10137 }
10138}

Referenced by ast_say_counted_noun().

◆ counted_noun_ending_slavic()

static const char * counted_noun_ending_slavic ( int  num)
static

Counting of objects in slavic languages such as Russian and Ukrainian the rules are more complicated. There are two plural forms used in counting. They are the genative singular which we represent with the suffix "x1" and the genative plural which we represent with the suffix "x2". The base names of the soundfiles remain in English. For example:

  • 1 degree (soundfile says "gradus")
  • 2 degreex1 (soundfile says "gradusa")
  • 5 degreex2 (soundfile says "gradusov")

Definition at line 10150 of file say.c.

10151{
10152 if (num < 0) {
10153 num *= -1;
10154 }
10155 num %= 100; /* never pay attention to more than two digits */
10156 if (num >= 20) { /* for numbers 20 and above, pay attention to only last digit */
10157 num %= 10;
10158 }
10159 if (num == 1) { /* singular */
10160 return "";
10161 }
10162 if (num > 0 && num < 5) { /* 2--4 get genative singular */
10163 return "x1";
10164 } else { /* 5--19 get genative plural */
10165 return "x2";
10166 }
10167}

Referenced by ast_say_counted_noun().

◆ exp10_int()

static int exp10_int ( int  power)
static

Definition at line 954 of file say.c.

955{
956 int x, res= 1;
957 for (x=0;x<power;x++)
958 res *= 10;
959 return res;
960}

Referenced by ast_say_number_full_cs().

◆ get_lastdigits_ru()

static int get_lastdigits_ru ( int  num)
static

determine last digits for thousands/millions (ru)

Definition at line 3189 of file say.c.

3189 {
3190 if (num < 20) {
3191 return num;
3192 } else if (num < 100) {
3193 return get_lastdigits_ru(num % 10);
3194 } else if (num < 1000) {
3195 return get_lastdigits_ru(num % 100);
3196 }
3197 return 0; /* number too big */
3198}

References get_lastdigits_ru().

Referenced by ast_say_number_full_ru(), and get_lastdigits_ru().

◆ get_number_str_en()

static struct ast_str * get_number_str_en ( int  num,
const char *  lang 
)
static

Definition at line 466 of file say.c.

467{
468 const char *fnr;
469 int loops = 0;
470
471 int res = 0;
472 int playh = 0;
473 char fn[256] = "";
474
475 struct ast_str *filenames;
476
477 if (!num) {
478 return ast_get_digit_str("0", lang);
479 }
480
481 filenames = ast_str_create(20);
482 if (!filenames) {
483 return NULL;
484 }
485 ast_str_reset(filenames);
486
487 while (!res && (num || playh)) {
488 if (num < 0) {
489 ast_copy_string(fn, "digits/minus", sizeof(fn));
490 if ( num > INT_MIN ) {
491 num = -num;
492 } else {
493 num = 0;
494 }
495 } else if (playh) {
496 ast_copy_string(fn, "digits/hundred", sizeof(fn));
497 playh = 0;
498 } else if (num < 20) {
499 snprintf(fn, sizeof(fn), "digits/%d", num);
500 num = 0;
501 } else if (num < 100) {
502 snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
503 num %= 10;
504 } else {
505 if (num < 1000){
506 snprintf(fn, sizeof(fn), "digits/%d", (num/100));
507 playh++;
508 num %= 100;
509 } else {
510 struct ast_str *fnrecurse = NULL;
511 if (num < 1000000) { /* 1,000,000 */
512 fnrecurse = get_number_str_en((num / 1000), lang);
513 if (!fnrecurse) {
514 ast_log(LOG_ERROR, "Couldn't get string for num\n");
515 } else {
516 fnr = ast_str_buffer(fnrecurse);
517 ast_str_append(&filenames, 0, (loops == 0 ? "%s" : "&%s"), fnr);
518 }
519 num %= 1000;
520 snprintf(fn, sizeof(fn), "&digits/thousand");
521 } else {
522 if (num < 1000000000) { /* 1,000,000,000 */
523 fnrecurse = get_number_str_en((num / 1000000), lang);
524 if (!fnrecurse) {
525 ast_log(LOG_ERROR, "Couldn't get string for num\n");
526 } else {
527 fnr = ast_str_buffer(fnrecurse);
528 ast_str_append(&filenames, 0, (loops == 0 ? "%s" : "&%s"), fnr);
529 }
530 num %= 1000000;
531 ast_copy_string(fn, "&digits/million", sizeof(fn));
532 } else {
533 if (num < INT_MAX) {
534 fnrecurse = get_number_str_en((num / 1000000000), lang);
535 if (!fnrecurse) {
536 ast_log(LOG_ERROR, "Couldn't get string for num\n");
537 } else {
538 fnr = ast_str_buffer(fnrecurse);
539 ast_str_append(&filenames, 0, (loops == 0 ? "%s" : "&%s"), fnr);
540 }
541 num %= 1000000000;
542 ast_copy_string(fn, "&digits/billion", sizeof(fn));
543 } else {
544 ast_log(LOG_WARNING, "Number '%d' is too big for me\n", num);
545 res = -1;
546 }
547 }
548 }
549 if (fnrecurse) {
550 ast_free(fnrecurse);
551 }
552 /* we already decided whether or not to add an &, don't add another one immediately */
553 loops = 0;
554 }
555 }
556 if (!res) {
557 ast_str_append(&filenames, 0, (loops == 0 ? "%s" : "&%s"), fn);
558 loops++;
559 }
560 }
561
562 return filenames;
563}

References ast_copy_string(), ast_free, ast_get_digit_str(), ast_log, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_reset(), get_number_str_en(), LOG_ERROR, LOG_WARNING, and NULL.

Referenced by ast_get_number_str(), get_number_str_en(), and get_ordinal_str_en().

◆ get_ordinal_str_en()

static struct ast_str * get_ordinal_str_en ( int  num,
const char *  lang 
)
static

Definition at line 577 of file say.c.

578{
579 const char *fnr;
580 int loops = 0;
581
582 int res = 0;
583 int playh = 0;
584 char fn[256] = "";
585
586 struct ast_str *filenames;
587
588 if (!num) {
589 num = 0;
590 }
591
592 filenames = ast_str_create(20);
593 if (!filenames) {
594 return NULL;
595 }
596 ast_str_reset(filenames);
597
598 while (!res && (num || playh)) {
599 if (num < 0) {
600 ast_copy_string(fn, "digits/minus", sizeof(fn));
601 if ( num > INT_MIN ) {
602 num = -num;
603 } else {
604 num = 0;
605 }
606 } else if (playh) {
607 ast_copy_string(fn, (num % 100 == 0) ? "digits/h-hundred" : "digits/hundred", sizeof(fn));
608 playh = 0;
609 } else if (num < 20) {
610 if (num > 0) {
611 snprintf(fn, sizeof(fn), "digits/h-%d", num);
612 } else {
613 ast_log(LOG_ERROR, "Unsupported ordinal number: %d\n", num);
614 }
615 num = 0;
616 } else if (num < 100) {
617 int base = (num / 10) * 10;
618 if (base != num) {
619 snprintf(fn, sizeof(fn), "digits/%d", base);
620 } else {
621 snprintf(fn, sizeof(fn), "digits/h-%d", base);
622 }
623 num %= 10;
624 } else {
625 if (num < 1000){
626 snprintf(fn, sizeof(fn), "digits/%d", (num/100));
627 playh++;
628 num %= 100;
629 } else {
630 struct ast_str *fnrecurse = NULL;
631 if (num < 1000000) { /* 1,000,000 */
632 fnrecurse = get_number_str_en((num / 1000), lang);
633 if (!fnrecurse) {
634 ast_log(LOG_ERROR, "Couldn't get string for num\n");
635 } else {
636 fnr = ast_str_buffer(fnrecurse);
637 ast_str_append(&filenames, 0, (loops == 0 ? "%s" : "&%s"), fnr);
638 }
639 num %= 1000;
640 snprintf(fn, sizeof(fn), (num % 1000 == 0) ? "&digits/h-thousand" : "&digits/thousand");
641 } else {
642 if (num < 1000000000) { /* 1,000,000,000 */
643 fnrecurse = get_number_str_en((num / 1000000), lang);
644 if (!fnrecurse) {
645 ast_log(LOG_ERROR, "Couldn't get string for num\n");
646 } else {
647 fnr = ast_str_buffer(fnrecurse);
648 ast_str_append(&filenames, 0, (loops == 0 ? "%s" : "&%s"), fnr);
649 }
650 num %= 1000000;
651 ast_copy_string(fn, (num % 1000000 == 0) ? "&digits/h-million" : "&digits/million", sizeof(fn));
652 } else {
653 if (num < INT_MAX) {
654 fnrecurse = get_number_str_en((num / 1000000000), lang);
655 if (!fnrecurse) {
656 ast_log(LOG_ERROR, "Couldn't get string for num\n");
657 } else {
658 fnr = ast_str_buffer(fnrecurse);
659 ast_str_append(&filenames, 0, (loops == 0 ? "%s" : "&%s"), fnr);
660 }
661 num %= 1000000000;
662 ast_copy_string(fn, (num % 1000000000 == 0) ? "&digits/h-billion" : "&digits/billion", sizeof(fn));
663 } else {
664 ast_log(LOG_WARNING, "Number '%d' is too big for me\n", num);
665 res = -1;
666 }
667 }
668 }
669 if (fnrecurse) {
670 ast_free(fnrecurse);
671 }
672 /* we already decided whether or not to add an &, don't add another one immediately */
673 loops = 0;
674 }
675 }
676 if (!res) {
677 ast_str_append(&filenames, 0, (loops == 0 ? "%s" : "&%s"), fn);
678 loops++;
679 }
680 }
681
682 return filenames;
683}

References ast_copy_string(), ast_free, ast_log, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_reset(), get_number_str_en(), LOG_ERROR, LOG_WARNING, and NULL.

Referenced by ast_get_ordinal_str().

◆ gr_say_number_female()

static int gr_say_number_female ( int  num,
struct ast_channel chan,
const char *  ints,
const char *  lang 
)
static

Greek digits/female-[1..4] : "Mia, dyo , treis, tessereis".

Definition at line 8625 of file say.c.

8625 {
8626 int tmp;
8627 int left;
8628 int res;
8629 char fn[256] = "";
8630
8631 /* ast_debug(1, "\n\n Saying number female %s %d \n\n", lang, num); */
8632 if (num < 5) {
8633 snprintf(fn, sizeof(fn), "digits/female-%d", num);
8634 res = wait_file(chan, ints, fn, lang);
8635 } else if (num < 13) {
8636 res = ast_say_number(chan, num, ints, lang, (char *) NULL);
8637 } else if (num <100 ) {
8638 tmp = (num/10) * 10;
8639 left = num - tmp;
8640 snprintf(fn, sizeof(fn), "digits/%d", tmp);
8641 res = ast_streamfile(chan, fn, lang);
8642 if (!res)
8643 res = ast_waitstream(chan, ints);
8644 if (left)
8645 gr_say_number_female(left, chan, ints, lang);
8646
8647 } else {
8648 return -1;
8649 }
8650 return res;
8651}

References ast_say_number(), ast_streamfile(), ast_waitstream(), gr_say_number_female(), NULL, and wait_file().

Referenced by ast_say_date_gr(), ast_say_date_with_format_gr(), ast_say_datetime_gr(), ast_say_time_gr(), and gr_say_number_female().

◆ next_item()

static char next_item ( const char *  format)
static

Definition at line 5105 of file say.c.

5106{
5107 const char *next = ast_skip_blanks(format);
5108 return *next;
5109}
char *attribute_pure ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
Definition strings.h:161

References ast_skip_blanks().

Referenced by ast_say_date_with_format_da(), ast_say_date_with_format_de(), ast_say_date_with_format_is(), pvalESwitchesWalkNames(), pvalIncludesWalk(), and pvalSwitchesWalkNames().

◆ pl_append()

static char * pl_append ( char *  buffer,
char *  str 
)
static

Definition at line 2559 of file say.c.

2560{
2561 strcpy(buffer, str);
2562 buffer += strlen(str);
2563 return buffer;
2564}

References str.

Referenced by powiedz().

◆ pl_odtworz_plik()

static void pl_odtworz_plik ( struct ast_channel chan,
const char *  language,
int  audiofd,
int  ctrlfd,
const char *  ints,
char *  fn 
)
static

Definition at line 2566 of file say.c.

2567{
2568 char file_name[255] = "digits/";
2569 strcat(file_name, fn);
2570 ast_debug(1, "Trying to play: %s\n", file_name);
2571 if (!ast_streamfile(chan, file_name, language)) {
2572 if ((audiofd > -1) && (ctrlfd > -1))
2573 ast_waitstream_full(chan, ints, audiofd, ctrlfd);
2574 else
2575 ast_waitstream(chan, ints);
2576 }
2577 ast_stopstream(chan);
2578}

References ast_debug, ast_stopstream(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and language.

Referenced by powiedz().

◆ pl_rzad_na_tekst()

static char * pl_rzad_na_tekst ( odmiana odm,
int  i,
int  rzad 
)
static

Definition at line 2546 of file say.c.

2547{
2548 if (rzad==0)
2549 return "";
2550
2551 if (i==1)
2552 return odm->rzedy[rzad - 1][0];
2553 if ((i > 21 || i < 11) && i%10 > 1 && i%10 < 5)
2554 return odm->rzedy[rzad - 1][1];
2555 else
2556 return odm->rzedy[rzad - 1][2];
2557}

References odmiana::rzedy.

Referenced by powiedz().

◆ powiedz()

static void powiedz ( struct ast_channel chan,
const char *  language,
int  audiofd,
int  ctrlfd,
const char *  ints,
odmiana odm,
int  rzad,
int  i 
)
static

Definition at line 2580 of file say.c.

2581{
2582 /* Initialise variables to allow compilation on Debian-stable, etc */
2583 int m1000E6 = 0;
2584 int i1000E6 = 0;
2585 int m1000E3 = 0;
2586 int i1000E3 = 0;
2587 int m1000 = 0;
2588 int i1000 = 0;
2589 int m100 = 0;
2590 int i100 = 0;
2591
2592 if (i == 0 && rzad > 0) {
2593 return;
2594 }
2595 if (i == 0) {
2596 pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->cyfry[0]);
2597 return;
2598 }
2599
2600 m1000E6 = i % 1000000000;
2601 i1000E6 = i / 1000000000;
2602
2603 powiedz(chan, language, audiofd, ctrlfd, ints, odm, rzad+3, i1000E6);
2604
2605 m1000E3 = m1000E6 % 1000000;
2606 i1000E3 = m1000E6 / 1000000;
2607
2608 powiedz(chan, language, audiofd, ctrlfd, ints, odm, rzad+2, i1000E3);
2609
2610 m1000 = m1000E3 % 1000;
2611 i1000 = m1000E3 / 1000;
2612
2613 powiedz(chan, language, audiofd, ctrlfd, ints, odm, rzad+1, i1000);
2614
2615 m100 = m1000 % 100;
2616 i100 = m1000 / 100;
2617
2618 if (i100>0)
2619 pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->setki[i100]);
2620
2621 if (m100 > 0 && m100 <= 9) {
2622 if (m1000 > 0)
2623 pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->cyfry2[m100]);
2624 else
2625 pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->cyfry[m100]);
2626 } else if (m100 % 10 == 0 && m100 != 0) {
2627 pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->dziesiatki[m100 / 10]);
2628 } else if (m100 > 10 && m100 <= 19) {
2629 pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->nastki[m100 % 10]);
2630 } else if (m100 > 20) {
2631 if (odm->separator_dziesiatek[0] == ' ') {
2632 pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->dziesiatki[m100 / 10]);
2633 pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->cyfry2[m100 % 10]);
2634 } else {
2635 char buf[10];
2636 char *b = buf;
2637 b = pl_append(b, odm->dziesiatki[m100 / 10]);
2639 pl_append(b, odm->cyfry2[m100 % 10]);
2640 pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, buf);
2641 }
2642 }
2643
2644 if (rzad > 0) {
2645 pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, pl_rzad_na_tekst(odm, i, rzad));
2646 }
2647}
static char * pl_append(char *buffer, char *str)
Definition say.c:2559
static char * pl_rzad_na_tekst(odmiana *odm, int i, int rzad)
Definition say.c:2546
static void pl_odtworz_plik(struct ast_channel *chan, const char *language, int audiofd, int ctrlfd, const char *ints, char *fn)
Definition say.c:2566
static struct test_val b

References b, buf, odmiana::cyfry, odmiana::cyfry2, odmiana::dziesiatki, language, odmiana::nastki, pl_append(), pl_odtworz_plik(), pl_rzad_na_tekst(), powiedz(), odmiana::separator_dziesiatek, and odmiana::setki.

Referenced by ast_say_number_full_pl(), and powiedz().

◆ say_character_str_full()

static int say_character_str_full ( struct ast_channel chan,
const char *  str,
const char *  ints,
const char *  lang,
enum ast_say_case_sensitivity  sensitivity,
int  audiofd,
int  ctrlfd 
)
static

Definition at line 210 of file say.c.

211{
212 struct ast_str *filenames = ast_get_character_str(str, lang, sensitivity);
213 return say_filenames(chan, ints, lang, audiofd, ctrlfd, filenames);
214}
struct ast_str * ast_get_character_str(const char *str, const char *lang, enum ast_say_case_sensitivity sensitivity)
Returns an ast_str of files for SayAlpha playback.
Definition say.c:64

References ast_get_character_str(), say_filenames(), and str.

Referenced by __say_init(), and say_init_mode().

◆ say_date()

static int say_date ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Definition at line 4391 of file say.c.

4392{
4393 if (!strncasecmp(lang, "en", 2)) { /* English syntax */
4394 return ast_say_date_en(chan, t, ints, lang);
4395 } else if (!strncasecmp(lang, "da", 2)) { /* Danish syntax */
4396 return ast_say_date_da(chan, t, ints, lang);
4397 } else if (!strncasecmp(lang, "de", 2)) { /* German syntax */
4398 return ast_say_date_de(chan, t, ints, lang);
4399 } else if (!strncasecmp(lang, "fr", 2)) { /* French syntax */
4400 return ast_say_date_fr(chan, t, ints, lang);
4401 } else if (!strncasecmp(lang, "gr", 2)) { /* Greek syntax */
4402 return ast_say_date_gr(chan, t, ints, lang);
4403 } else if (!strncasecmp(lang, "ja", 2)) { /* Japanese syntax */
4404 return ast_say_date_ja(chan, t, ints, lang);
4405 } else if (!strncasecmp(lang, "he", 2)) { /* Hebrew syntax */
4406 return ast_say_date_he(chan, t, ints, lang);
4407 } else if (!strncasecmp(lang, "hu", 2)) { /* Hungarian syntax */
4408 return ast_say_date_hu(chan, t, ints, lang);
4409 } else if (!strncasecmp(lang, "is", 2)) { /* Icelandic syntax */
4410 return ast_say_date_is(chan, t, ints, lang);
4411 } else if (!strncasecmp(lang, "ka", 2)) { /* Georgian syntax */
4412 return ast_say_date_ka(chan, t, ints, lang);
4413 } else if (!strncasecmp(lang, "nl", 2)) { /* Dutch syntax */
4414 return ast_say_date_nl(chan, t, ints, lang);
4415 } else if (!strncasecmp(lang, "pt", 2)) { /* Portuguese syntax */
4416 return ast_say_date_pt(chan, t, ints, lang);
4417 } else if (!strncasecmp(lang, "th", 2)) { /* Thai syntax */
4418 return ast_say_date_th(chan, t, ints, lang);
4419 } else if (!strncasecmp(lang, "ps", 2)) { /* Pashto syntax */
4420 return ast_say_date_en(chan, t, ints, lang);
4421 } else if (!strncasecmp(lang, "dr", 2)) { /* Dari syntax */
4422 return ast_say_date_en(chan, t, ints, lang);
4423 }
4424
4425 /* Default to English */
4426 return ast_say_date_en(chan, t, ints, lang);
4427}
static int ast_say_date_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
English syntax.
Definition say.c:4430
static int ast_say_date_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Greek support.
Definition say.c:8814
static int ast_say_date_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Portuguese syntax.
Definition say.c:4684
static int ast_say_date_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
French syntax.
Definition say.c:4590
static int ast_say_date_da(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Danish syntax.
Definition say.c:4459
static int ast_say_date_de(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
German syntax.
Definition say.c:4508
static int ast_say_date_nl(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Dutch syntax.
Definition say.c:4619
static int ast_say_date_is(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Definition say.c:4745
static int ast_say_date_hu(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hungarian syntax.
Definition say.c:4558
static int ast_say_date_ja(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Definition say.c:8850
static int ast_say_date_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hebrew syntax.
Definition say.c:4711
static int ast_say_date_th(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Thai syntax.
Definition say.c:4648
static int ast_say_date_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Georgian syntax. e.g. "oriatas xuti tslis 5 noemberi".
Definition say.c:9982

References ast_say_date_da(), ast_say_date_de(), ast_say_date_en(), ast_say_date_fr(), ast_say_date_gr(), ast_say_date_he(), ast_say_date_hu(), ast_say_date_is(), ast_say_date_ja(), ast_say_date_ka(), ast_say_date_nl(), ast_say_date_pt(), and ast_say_date_th().

Referenced by __say_init().

◆ say_date_with_format()

static int say_date_with_format ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang,
const char *  format,
const char *  tzone 
)
static

Definition at line 4793 of file say.c.

4794{
4795 if (!strncasecmp(lang, "en", 2)) { /* English syntax */
4796 return ast_say_date_with_format_en(chan, t, ints, lang, format, tzone);
4797 } else if (!strncasecmp(lang, "da", 2)) { /* Danish syntax */
4798 return ast_say_date_with_format_da(chan, t, ints, lang, format, tzone);
4799 } else if (!strncasecmp(lang, "de", 2)) { /* German syntax */
4800 return ast_say_date_with_format_de(chan, t, ints, lang, format, tzone);
4801 } else if (!strncasecmp(lang, "es", 2)) { /* Spanish syntax */
4802 return ast_say_date_with_format_es(chan, t, ints, lang, format, tzone);
4803 } else if (!strncasecmp(lang, "he", 2)) { /* Hebrew syntax */
4804 return ast_say_date_with_format_he(chan, t, ints, lang, format, tzone);
4805 } else if (!strncasecmp(lang, "fr", 2)) { /* French syntax */
4806 return ast_say_date_with_format_fr(chan, t, ints, lang, format, tzone);
4807 } else if (!strncasecmp(lang, "gr", 2)) { /* Greek syntax */
4808 return ast_say_date_with_format_gr(chan, t, ints, lang, format, tzone);
4809 } else if (!strncasecmp(lang, "is", 2)) { /* Icelandic syntax */
4810 return ast_say_date_with_format_is(chan, t, ints, lang, format, tzone);
4811 } else if (!strncasecmp(lang, "ja", 2)) { /* Japanese syntax */
4812 return ast_say_date_with_format_ja(chan, t, ints, lang, format, tzone);
4813 } else if (!strncasecmp(lang, "it", 2)) { /* Italian syntax */
4814 return ast_say_date_with_format_it(chan, t, ints, lang, format, tzone);
4815 } else if (!strncasecmp(lang, "nl", 2)) { /* Dutch syntax */
4816 return ast_say_date_with_format_nl(chan, t, ints, lang, format, tzone);
4817 } else if (!strncasecmp(lang, "pl", 2)) { /* Polish syntax */
4818 return ast_say_date_with_format_pl(chan, t, ints, lang, format, tzone);
4819 } else if (!strncasecmp(lang, "pt", 2)) { /* Portuguese syntax */
4820 return ast_say_date_with_format_pt(chan, t, ints, lang, format, tzone);
4821 } else if (!strncasecmp(lang, "th", 2)) { /* Thai syntax */
4822 return ast_say_date_with_format_th(chan, t, ints, lang, format, tzone);
4823 } else if (!strncasecmp(lang, "zh", 2)) { /* Taiwanese / Chinese syntax */
4824 return ast_say_date_with_format_zh(chan, t, ints, lang, format, tzone);
4825 } else if (!strncasecmp(lang, "vi", 2)) { /* Vietnamese syntax */
4826 return ast_say_date_with_format_vi(chan, t, ints, lang, format, tzone);
4827 }
4828
4829 /* Default to English */
4830 return ast_say_date_with_format_en(chan, t, ints, lang, format, tzone);
4831}
static int ast_say_date_with_format_ja(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Definition say.c:9261
static int ast_say_date_with_format_pl(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Polish syntax.
Definition say.c:6889
static int ast_say_date_with_format_th(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Thai syntax.
Definition say.c:5735

References ast_say_date_with_format_da(), ast_say_date_with_format_de(), ast_say_date_with_format_en(), ast_say_date_with_format_es(), ast_say_date_with_format_fr(), ast_say_date_with_format_gr(), ast_say_date_with_format_he(), ast_say_date_with_format_is(), ast_say_date_with_format_it(), ast_say_date_with_format_ja(), ast_say_date_with_format_nl(), ast_say_date_with_format_pl(), ast_say_date_with_format_pt(), ast_say_date_with_format_th(), ast_say_date_with_format_vi(), and ast_say_date_with_format_zh().

Referenced by __say_init().

◆ say_datetime()

static int say_datetime ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Definition at line 7996 of file say.c.

7997{
7998 if (!strncasecmp(lang, "en", 2)) { /* English syntax */
7999 return ast_say_datetime_en(chan, t, ints, lang);
8000 } else if (!strncasecmp(lang, "de", 2)) { /* German syntax */
8001 return ast_say_datetime_de(chan, t, ints, lang);
8002 } else if (!strncasecmp(lang, "fr", 2)) { /* French syntax */
8003 return ast_say_datetime_fr(chan, t, ints, lang);
8004 } else if (!strncasecmp(lang, "gr", 2)) { /* Greek syntax */
8005 return ast_say_datetime_gr(chan, t, ints, lang);
8006 } else if (!strncasecmp(lang, "ja", 2)) { /* Japanese syntax */
8007 return ast_say_datetime_ja(chan, t, ints, lang);
8008 } else if (!strncasecmp(lang, "he", 2)) { /* Hebrew syntax */
8009 return ast_say_datetime_he(chan, t, ints, lang);
8010 } else if (!strncasecmp(lang, "hu", 2)) { /* Hungarian syntax */
8011 return ast_say_datetime_hu(chan, t, ints, lang);
8012 } else if (!strncasecmp(lang, "ka", 2)) { /* Georgian syntax */
8013 return ast_say_datetime_ka(chan, t, ints, lang);
8014 } else if (!strncasecmp(lang, "nl", 2)) { /* Dutch syntax */
8015 return ast_say_datetime_nl(chan, t, ints, lang);
8016 } else if (!strncasecmp(lang, "pt_BR", 5)) { /* Brazilian Portuguese syntax */
8017 return ast_say_datetime_pt_BR(chan, t, ints, lang);
8018 } else if (!strncasecmp(lang, "pt", 2)) { /* Portuguese syntax */
8019 return ast_say_datetime_pt(chan, t, ints, lang);
8020 } else if (!strncasecmp(lang, "th", 2)) { /* Thai syntax */
8021 return ast_say_datetime_th(chan, t, ints, lang);
8022 } else if (!strncasecmp(lang, "zh", 2)) { /* Taiwanese / Chinese syntax */
8023 return ast_say_datetime_zh(chan, t, ints, lang);
8024 }
8025
8026 /* Default to English */
8027 return ast_say_datetime_en(chan, t, ints, lang);
8028}
static int ast_say_datetime_pt_BR(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Brazilian Portuguese syntax.
Definition say.c:8254
static int ast_say_datetime_nl(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Dutch syntax.
Definition say.c:8168
static int ast_say_datetime_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Portuguese syntax.
Definition say.c:8187
static int ast_say_datetime_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Georgian syntax. Say date, then say time.
Definition say.c:10059
static int ast_say_datetime_ja(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Definition say.c:9022
static int ast_say_datetime_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Greek support.
Definition say.c:8989
static int ast_say_datetime_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hebrew syntax.
Definition say.c:8371
static int ast_say_datetime_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
English syntax.
Definition say.c:8031
static int ast_say_datetime_hu(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hungarian syntax.
Definition say.c:8113
static int ast_say_datetime_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
French syntax.
Definition say.c:8127
static int ast_say_datetime_de(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
German syntax.
Definition say.c:8098
static int ast_say_datetime_zh(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Taiwanese / Chinese syntax.
Definition say.c:8311
static int ast_say_datetime_th(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Thai syntax.
Definition say.c:8268

References ast_say_datetime_de(), ast_say_datetime_en(), ast_say_datetime_fr(), ast_say_datetime_gr(), ast_say_datetime_he(), ast_say_datetime_hu(), ast_say_datetime_ja(), ast_say_datetime_ka(), ast_say_datetime_nl(), ast_say_datetime_pt(), ast_say_datetime_pt_BR(), ast_say_datetime_th(), and ast_say_datetime_zh().

Referenced by __say_init().

◆ say_datetime_from_now()

static int say_datetime_from_now ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Definition at line 8436 of file say.c.

8437{
8438 if (!strncasecmp(lang, "en", 2)) { /* English syntax */
8439 return ast_say_datetime_from_now_en(chan, t, ints, lang);
8440 } else if (!strncasecmp(lang, "fr", 2)) { /* French syntax */
8441 return ast_say_datetime_from_now_fr(chan, t, ints, lang);
8442 } else if (!strncasecmp(lang, "he", 2)) { /* Hebrew syntax */
8443 return ast_say_datetime_from_now_he(chan, t, ints, lang);
8444 } else if (!strncasecmp(lang, "ka", 2)) { /* Georgian syntax */
8445 return ast_say_datetime_from_now_ka(chan, t, ints, lang);
8446 } else if (!strncasecmp(lang, "pt", 2)) { /* Portuguese syntax */
8447 return ast_say_datetime_from_now_pt(chan, t, ints, lang);
8448 }
8449
8450 /* Default to English */
8451 return ast_say_datetime_from_now_en(chan, t, ints, lang);
8452}
static int ast_say_datetime_from_now_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Portuguese syntax.
Definition say.c:8531
static int ast_say_datetime_from_now_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Georgian syntax.
Definition say.c:10078
static int ast_say_datetime_from_now_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hebrew syntax.
Definition say.c:8581
static int ast_say_datetime_from_now_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
French syntax.
Definition say.c:8493
static int ast_say_datetime_from_now_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
English syntax.
Definition say.c:8455

References ast_say_datetime_from_now_en(), ast_say_datetime_from_now_fr(), ast_say_datetime_from_now_he(), ast_say_datetime_from_now_ka(), and ast_say_datetime_from_now_pt().

Referenced by __say_init(), and say_init_mode().

◆ say_digit_str_full()

static int say_digit_str_full ( struct ast_channel chan,
const char *  str,
const char *  ints,
const char *  lang,
int  audiofd,
int  ctrlfd 
)
static

Definition at line 348 of file say.c.

349{
350 struct ast_str *filenames = ast_get_digit_str(str, lang);
351 return say_filenames(chan, ints, lang, audiofd, ctrlfd, filenames);
352}

References ast_get_digit_str(), say_filenames(), and str.

Referenced by __say_init(), and say_init_mode().

◆ say_enumeration_full()

static int say_enumeration_full ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_enumeration_full: call language-specific functions

Note
Called from AGI

Definition at line 3461 of file say.c.

3462{
3463 if (!strncasecmp(language, "en", 2)) { /* English syntax */
3464 return ast_say_enumeration_full_en(chan, num, ints, language, audiofd, ctrlfd);
3465 } else if (!strncasecmp(language, "da", 2)) { /* Danish syntax */
3466 return ast_say_enumeration_full_da(chan, num, ints, language, options, audiofd, ctrlfd);
3467 } else if (!strncasecmp(language, "de", 2)) { /* German syntax */
3468 return ast_say_enumeration_full_de(chan, num, ints, language, options, audiofd, ctrlfd);
3469 } else if (!strncasecmp(language, "he", 2)) { /* Hebrew syntax */
3470 return ast_say_enumeration_full_he(chan, num, ints, language, options, audiofd, ctrlfd);
3471 } else if (!strncasecmp(language, "is", 2)) { /* Icelandic syntax */
3472 return ast_say_enumeration_full_is(chan, num, ints, language, options, audiofd, ctrlfd);
3473 } else if (!strncasecmp(language, "vi", 2)) { /* Vietnamese syntax */
3474 return ast_say_enumeration_full_vi(chan, num, ints, language, audiofd, ctrlfd);
3475 } else if (!strncasecmp(language, "ps", 2)) { /* Pashto syntax */
3476 return ast_say_enumeration_full_ps(chan, num, ints, language, audiofd, ctrlfd);
3477 } else if (!strncasecmp(language, "dr", 2)) { /* Dari syntax */
3478 return ast_say_enumeration_full_dr(chan, num, ints, language, audiofd, ctrlfd);
3479 }
3480
3481 /* Default to english */
3482 return ast_say_enumeration_full_en(chan, num, ints, language, audiofd, ctrlfd);
3483}
static int ast_say_enumeration_full_en(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_enumeration_full_en: English syntax
Definition say.c:3487
static int ast_say_enumeration_full_is(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_enumeration_full_is: Icelandic syntax
Definition say.c:4216
static int ast_say_enumeration_full_he(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
Definition say.c:4127
static int ast_say_enumeration_full_vi(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
Definition say.c:3782
static int ast_say_enumeration_full_da(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_enumeration_full_da: Danish syntax
Definition say.c:3802
static int ast_say_enumeration_full_ps(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_enumeration_full_ps: Pashto syntax
Definition say.c:3586
static int ast_say_enumeration_full_dr(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_enumeration_full_dr: Dari syntax
Definition say.c:3685
static int ast_say_enumeration_full_de(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_enumeration_full_de: German syntax
Definition say.c:3965

References ast_say_enumeration_full_da(), ast_say_enumeration_full_de(), ast_say_enumeration_full_dr(), ast_say_enumeration_full_en(), ast_say_enumeration_full_he(), ast_say_enumeration_full_is(), ast_say_enumeration_full_ps(), ast_say_enumeration_full_vi(), language, and options.

Referenced by __say_init().

◆ say_filenames()

static int say_filenames ( struct ast_channel chan,
const char *  ints,
const char *  lang,
int  audiofd,
int  ctrlfd,
struct ast_str filenames 
)
static

Definition at line 175 of file say.c.

176{
177 int res = 0;
178 char *files;
179 const char *fn;
180
181 if (!filenames) {
182 return -1;
183 }
184
185 /* No filenames to play? Return success so we don't hang up erroneously */
186 if (ast_str_strlen(filenames) == 0) {
187 ast_free(filenames);
188 return 0;
189 }
190
191 files = ast_str_buffer(filenames);
192
193 while (!res && (fn = strsep(&files, "&"))) {
194 res = ast_streamfile(chan, fn, lang);
195 if (!res) {
196 if ((audiofd > -1) && (ctrlfd > -1)) {
197 res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
198 } else {
199 res = ast_waitstream(chan, ints);
200 }
201 }
202 ast_stopstream(chan);
203 }
204
205 ast_free(filenames);
206
207 return res;
208}
char * strsep(char **str, const char *delims)

References ast_free, ast_stopstream(), ast_str_buffer(), ast_str_strlen(), ast_streamfile(), ast_waitstream(), ast_waitstream_full(), and strsep().

Referenced by ast_say_number_full_en(), say_character_str_full(), say_digit_str_full(), say_money_str_full(), say_ordinal_full(), and say_phonetic_str_full().

◆ say_money_str_full()

static int say_money_str_full ( struct ast_channel chan,
const char *  str,
const char *  ints,
const char *  lang,
int  audiofd,
int  ctrlfd 
)
static

Definition at line 460 of file say.c.

461{
462 struct ast_str *filenames = ast_get_money_str(str, lang);
463 return say_filenames(chan, ints, lang, audiofd, ctrlfd, filenames);
464}
struct ast_str * ast_get_money_str(const char *str, const char *lang)
ast_get_money_str: call language-specific functions
Definition say.c:449

References ast_get_money_str(), say_filenames(), and str.

Referenced by __say_init().

◆ say_number_full()

static int say_number_full ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

ast_say_number_full: call language-specific functions

Note
Called from AGI

Definition at line 878 of file say.c.

879{
880 ast_test_suite_event_notify("SAYNUM", "Message: saying number %d\r\nNumber: %d\r\nChannel: %s", num, num, ast_channel_name(chan));
881 if (!strncasecmp(language, "en_GB", 5)) { /* British syntax */
882 return ast_say_number_full_en_GB(chan, num, ints, language, audiofd, ctrlfd);
883 } else if (!strncasecmp(language, "en", 2)) { /* English syntax */
884 return ast_say_number_full_en(chan, num, ints, language, audiofd, ctrlfd);
885 } else if (!strncasecmp(language, "cs", 2)) { /* Czech syntax */
886 return ast_say_number_full_cs(chan, num, ints, language, options, audiofd, ctrlfd);
887 } else if (!strncasecmp(language, "da", 2)) { /* Danish syntax */
888 return ast_say_number_full_da(chan, num, ints, language, options, audiofd, ctrlfd);
889 } else if (!strncasecmp(language, "de", 2)) { /* German syntax */
890 return ast_say_number_full_de(chan, num, ints, language, options, audiofd, ctrlfd);
891 } else if (!strncasecmp(language, "es", 2)) { /* Spanish syntax */
892 return ast_say_number_full_es(chan, num, ints, language, options, audiofd, ctrlfd);
893 } else if (!strncasecmp(language, "fr", 2)) { /* French syntax */
894 return ast_say_number_full_fr(chan, num, ints, language, options, audiofd, ctrlfd);
895 } else if (!strncasecmp(language, "gr", 2)) { /* Greek syntax */
896 return ast_say_number_full_gr(chan, num, ints, language, audiofd, ctrlfd);
897 } else if (!strncasecmp(language, "ja", 2)) { /* Japanese syntax */
898 return ast_say_number_full_ja(chan, num, ints, language, audiofd, ctrlfd);
899 } else if (!strncasecmp(language, "he", 2)) { /* Hebrew syntax */
900 return ast_say_number_full_he(chan, num, ints, language, options, audiofd, ctrlfd);
901 } else if (!strncasecmp(language, "hu", 2)) { /* Hungarian syntax */
902 return ast_say_number_full_hu(chan, num, ints, language, audiofd, ctrlfd);
903 } else if (!strncasecmp(language, "is", 2)) { /* Icelandic syntax */
904 return ast_say_number_full_is(chan, num, ints, language, options, audiofd, ctrlfd);
905 } else if (!strncasecmp(language, "it", 2)) { /* Italian syntax */
906 return ast_say_number_full_it(chan, num, ints, language, audiofd, ctrlfd);
907 } else if (!strncasecmp(language, "ka", 2)) { /* Georgian syntax */
908 return ast_say_number_full_ka(chan, num, ints, language, options, audiofd, ctrlfd);
909 } else if (!strncasecmp(language, "nl", 2)) { /* Dutch syntax */
910 return ast_say_number_full_nl(chan, num, ints, language, audiofd, ctrlfd);
911 } else if (!strncasecmp(language, "no", 2)) { /* Norwegian syntax */
912 return ast_say_number_full_no(chan, num, ints, language, options, audiofd, ctrlfd);
913 } else if (!strncasecmp(language, "pl", 2)) { /* Polish syntax */
914 return ast_say_number_full_pl(chan, num, ints, language, options, audiofd, ctrlfd);
915 } else if (!strncasecmp(language, "pt", 2)) { /* Portuguese syntax */
916 return ast_say_number_full_pt(chan, num, ints, language, options, audiofd, ctrlfd);
917 } else if (!strncasecmp(language, "ru", 2)) { /* Russian syntax */
918 return ast_say_number_full_ru(chan, num, ints, language, options, audiofd, ctrlfd);
919 } else if (!strncasecmp(language, "se", 2)) { /* Swedish syntax */
920 return ast_say_number_full_se(chan, num, ints, language, options, audiofd, ctrlfd);
921 } else if (!strncasecmp(language, "th", 2)) { /* Thai syntax */
922 return ast_say_number_full_th(chan, num, ints, language, audiofd, ctrlfd);
923 } else if (!strncasecmp(language, "zh", 2)) { /* Taiwanese / Chinese syntax */
924 return ast_say_number_full_zh(chan, num, ints, language, audiofd, ctrlfd);
925 } else if (!strncasecmp(language, "ur", 2)) { /* Urdu syntax */
926 return ast_say_number_full_ur(chan, num, ints, language, options, audiofd, ctrlfd);
927 } else if (!strncasecmp(language, "vi", 2)) { /* Vietnamese syntax */
928 return ast_say_number_full_vi(chan, num, ints, language, audiofd, ctrlfd);
929 } else if (!strncasecmp(language, "dr", 2)) { /* Dari syntax */
930 return ast_say_number_full_dr(chan, num, ints, language, audiofd, ctrlfd);
931 } else if (!strncasecmp(language, "ps", 2)) { /* Pashto syntax */
932 return ast_say_number_full_ps(chan, num, ints, language, options, audiofd, ctrlfd);
933 }
934
935 /* Default to english */
936 return ast_say_number_full_en(chan, num, ints, language, audiofd, ctrlfd);
937}
const char * ast_channel_name(const struct ast_channel *chan)
static int ast_say_number_full_ja(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
Definition say.c:8739
static int ast_say_number_full_ka(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_ka: Georgian syntax
Definition say.c:9904
static int ast_say_number_full_pl(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
Definition say.c:2741
#define ast_test_suite_event_notify(s, f,...)
Definition test.h:189

References ast_channel_name(), ast_say_number_full_cs(), ast_say_number_full_da(), ast_say_number_full_de(), ast_say_number_full_dr(), ast_say_number_full_en(), ast_say_number_full_en_GB(), ast_say_number_full_es(), ast_say_number_full_fr(), ast_say_number_full_gr(), ast_say_number_full_he(), ast_say_number_full_hu(), ast_say_number_full_is(), ast_say_number_full_it(), ast_say_number_full_ja(), ast_say_number_full_ka(), ast_say_number_full_nl(), ast_say_number_full_no(), ast_say_number_full_pl(), ast_say_number_full_ps(), ast_say_number_full_pt(), ast_say_number_full_ru(), ast_say_number_full_se(), ast_say_number_full_th(), ast_say_number_full_ur(), ast_say_number_full_vi(), ast_say_number_full_zh(), ast_test_suite_event_notify, language, and options.

Referenced by __say_init().

◆ say_ordinal_full()

static int say_ordinal_full ( struct ast_channel chan,
int  num,
const char *  ints,
const char *  language,
const char *  options,
int  audiofd,
int  ctrlfd 
)
static

say_ordinal_full

Definition at line 948 of file say.c.

949{
950 struct ast_str *filenames = ast_get_ordinal_str(num, language);
951 return say_filenames(chan, ints, language, audiofd, ctrlfd, filenames);
952}
struct ast_str * ast_get_ordinal_str(int num, const char *lang)
ast_get_ordinal_str: call language-specific functions
Definition say.c:686

References ast_get_ordinal_str(), language, and say_filenames().

Referenced by __say_init().

◆ say_phonetic_str_full()

static int say_phonetic_str_full ( struct ast_channel chan,
const char *  str,
const char *  ints,
const char *  lang,
int  audiofd,
int  ctrlfd 
)
static

Definition at line 294 of file say.c.

295{
296 struct ast_str *filenames = ast_get_phonetic_str(str, lang);
297 return say_filenames(chan, ints, lang, audiofd, ctrlfd, filenames);
298}
struct ast_str * ast_get_phonetic_str(const char *str, const char *lang)
Returns an ast_str of files for SayPhonetic playback.
Definition say.c:216

References ast_get_phonetic_str(), say_filenames(), and str.

Referenced by __say_init(), and say_init_mode().

◆ say_time()

static int say_time ( struct ast_channel chan,
time_t  t,
const char *  ints,
const char *  lang 
)
static

Definition at line 7666 of file say.c.

7667{
7668 if (!strncasecmp(lang, "en", 2)) { /* English syntax */
7669 return ast_say_time_en(chan, t, ints, lang);
7670 } else if (!strncasecmp(lang, "de", 2)) { /* German syntax */
7671 return ast_say_time_de(chan, t, ints, lang);
7672 } else if (!strncasecmp(lang, "fr", 2)) { /* French syntax */
7673 return ast_say_time_fr(chan, t, ints, lang);
7674 } else if (!strncasecmp(lang, "gr", 2)) { /* Greek syntax */
7675 return ast_say_time_gr(chan, t, ints, lang);
7676 } else if (!strncasecmp(lang, "ja", 2)) { /* Japanese syntax */
7677 return ast_say_time_ja(chan, t, ints, lang);
7678 } else if (!strncasecmp(lang, "he", 2)) { /* Hebrew syntax */
7679 return ast_say_time_he(chan, t, ints, lang);
7680 } else if (!strncasecmp(lang, "hu", 2)) { /* Hungarian syntax */
7681 return(ast_say_time_hu(chan, t, ints, lang));
7682 } else if (!strncasecmp(lang, "ka", 2)) { /* Georgian syntax */
7683 return ast_say_time_ka(chan, t, ints, lang);
7684 } else if (!strncasecmp(lang, "nl", 2)) { /* Dutch syntax */
7685 return ast_say_time_nl(chan, t, ints, lang);
7686 } else if (!strncasecmp(lang, "pt_BR", 5)) { /* Brazilian Portuguese syntax */
7687 return ast_say_time_pt_BR(chan, t, ints, lang);
7688 } else if (!strncasecmp(lang, "pt", 2)) { /* Portuguese syntax */
7689 return ast_say_time_pt(chan, t, ints, lang);
7690 } else if (!strncasecmp(lang, "th", 2)) { /* Thai syntax */
7691 return(ast_say_time_th(chan, t, ints, lang));
7692 } else if (!strncasecmp(lang, "zh", 2)) { /* Taiwanese / Chinese syntax */
7693 return ast_say_time_zh(chan, t, ints, lang);
7694 } else if (!strncasecmp(lang, "ps", 2)) { /* Pashto syntax */
7695 return ast_say_time_en(chan, t, ints, lang);
7696 } else if (!strncasecmp(lang, "dr", 2)) { /* Dari syntax */
7697 return ast_say_time_en(chan, t, ints, lang);
7698 }
7699
7700 /* Default to English */
7701 return ast_say_time_en(chan, t, ints, lang);
7702}
static int ast_say_time_th(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Thai syntax.
Definition say.c:7900
static int ast_say_time_de(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
German syntax.
Definition say.c:7754
static int ast_say_time_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hebrew syntax.
Definition say.c:7960
static int ast_say_time_nl(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Dutch syntax.
Definition say.c:7821
static int ast_say_time_hu(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hungarian syntax.
Definition say.c:7774
static int ast_say_time_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
English syntax.
Definition say.c:7705
static int ast_say_time_ja(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Definition say.c:8942
static int ast_say_time_zh(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Taiwanese / Chinese syntax.
Definition say.c:7918
static int ast_say_time_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
French syntax.
Definition say.c:7797
static int ast_say_time_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Portuguese syntax.
Definition say.c:7841
static int ast_say_time_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Georgian syntax. e.g. "otxi saati da eqvsi tsuti".
Definition say.c:10025
static int ast_say_time_pt_BR(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Brazilian Portuguese syntax.
Definition say.c:7870

References ast_say_time_de(), ast_say_time_en(), ast_say_time_fr(), ast_say_time_gr(), ast_say_time_he(), ast_say_time_hu(), ast_say_time_ja(), ast_say_time_ka(), ast_say_time_nl(), ast_say_time_pt(), ast_say_time_pt_BR(), ast_say_time_th(), and ast_say_time_zh().

Referenced by __say_init().

◆ wait_file()

static int wait_file ( struct ast_channel chan,
const char *  ints,
const char *  file,
const char *  lang 
)
static