To help combat problems where people build external modules (asterisk-addons or other...
[asterisk-bristuff.git] / include / asterisk / say.h
blob17070c2c427d1c546d0d7f4dbdde3f8d072f3e0d
1 /*
2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2005, Digium, Inc.
6 * Mark Spencer <markster@digium.com>
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
19 /*! \file
20 * \brief Say numbers and dates (maybe words one day too)
23 #ifndef _ASTERISK_SAY_H
24 #define _ASTERISK_SAY_H
26 #include "asterisk/channel.h"
27 #include "asterisk/file.h"
29 #include <time.h>
31 #if defined(__cplusplus) || defined(c_plusplus)
32 extern "C" {
33 #endif
35 /*! \brief
36 * The basic ast_say_* functions are implemented as function pointers,
37 * initialized to the function say_stub() which simply returns an error.
38 * Other interfaces, declared here as regular functions, are simply
39 * wrappers around the basic functions.
41 * An implementation of the basic ast_say functions (e.g. from say.c or from
42 * a dynamically loaded module) will just have to reassign the pointers
43 * to the relevant functions to override the previous implementation.
45 * \todo XXX
46 * As the conversion from the old implementation of say.c to the new
47 * implementation will be completed, and the API suitably reworked by
48 * removing redundant functions and/or arguments, this mechanism may be
49 * reverted back to pure static functions, if needed.
51 #if defined(SAY_STUBS)
52 /* provide declarations for the *say*() functions
53 * and initialize them to the stub function
55 static int say_stub(struct ast_channel *chan, ...)
57 ast_log(LOG_WARNING, "no implementation for the say() functions\n");
58 return -1;
61 #undef SAY_STUBS
62 #define SAY_INIT(x) = (typeof (x))say_stub
63 #define SAY_EXTERN
64 #else
65 #define SAY_INIT(x)
66 #define SAY_EXTERN extern
67 #endif
69 /* says a number
70 * \param chan channel to say them number on
71 * \param num number to say on the channel
72 * \param ints which dtmf to interrupt on
73 * \param lang language to speak the number
74 * \param options set to 'f' for female, 'm' for male, 'c' for commune, 'n' for neuter, 'p' for plural
75 * Vocally says a number on a given channel
76 * Returns 0 on success, DTMF digit on interrupt, -1 on failure
78 int ast_say_number(struct ast_channel *chan, int num,
79 const char *ints, const char *lang, const char *options);
81 /* Same as above with audiofd for received audio and returns 1 on ctrlfd being readable */
82 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);
84 /* says an enumeration
85 * \param chan channel to say them enumeration on
86 * \param num number to say on the channel
87 * \param ints which dtmf to interrupt on
88 * \param lang language to speak the enumeration
89 * \param options set to 'f' for female, 'm' for male, 'c' for commune, 'n' for neuter, 'p' for plural
90 * Vocally says a enumeration on a given channel (first, sencond, third, forth, thirtyfirst, hundredth, ....)
91 * especially useful for dates and messages. says 'last' if num equals to INT_MAX
92 * Returns 0 on success, DTMF digit on interrupt, -1 on failure
94 int ast_say_enumeration(struct ast_channel *chan, int num,
95 const char *ints, const char *lang, const char *options);
97 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);
99 /* says digits
100 * \param chan channel to act upon
101 * \param num number to speak
102 * \param ints which dtmf to interrupt on
103 * \param lang language to speak
104 * Vocally says digits of a given number
105 * Returns 0 on success, dtmf if interrupted, -1 on failure
107 int ast_say_digits(struct ast_channel *chan, int num,
108 const char *ints, const char *lang);
110 int ast_say_digits_full(struct ast_channel *chan, int num,
111 const char *ints, const char *lang, int audiofd, int ctrlfd);
113 /* says digits of a string
114 * \param chan channel to act upon
115 * \param num string to speak
116 * \param ints which dtmf to interrupt on
117 * \param lang language to speak in
118 * Vocally says the digits of a given string
119 * Returns 0 on success, dtmf if interrupted, -1 on failure
121 int ast_say_digit_str(struct ast_channel *chan, const char *num,
122 const char *ints, const char *lang);
124 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);
127 * the generic 'say' routine, with the first chars in the string
128 * defining the format to use
130 SAY_EXTERN int (* ast_say_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) SAY_INIT(ast_say_full);
133 * other function to pronounce character and phonetic strings
135 int ast_say_character_str(struct ast_channel *chan, const char *num,
136 const char *ints, const char *lang);
138 SAY_EXTERN int (* ast_say_character_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_character_str_full);
140 int ast_say_phonetic_str(struct ast_channel *chan, const char *num,
141 const char *ints, const char *lang);
143 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);
145 SAY_EXTERN int (* ast_say_datetime)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_datetime);
146 SAY_EXTERN int (* ast_say_time)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_time);
148 SAY_EXTERN int (* ast_say_date)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_date);
150 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);
152 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);
154 #if defined(__cplusplus) || defined(c_plusplus)
156 #endif
158 #endif /* _ASTERISK_SAY_H */