aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--channel.c55
-rw-r--r--include/asterisk/say.h40
-rw-r--r--say.c47
3 files changed, 86 insertions, 56 deletions
diff --git a/channel.c b/channel.c
index 248005138..dbf7b0f5e 100644
--- a/channel.c
+++ b/channel.c
@@ -4219,3 +4219,58 @@ int ast_channel_trylock(struct ast_channel *chan)
}
#endif
+
+/*
+ * Wrappers for various ast_say_*() functions that call the full version
+ * of the same functions.
+ * The proper place would be say.c, but that file is optional and one
+ * must be able to build asterisk even without it (using a loadable 'say'
+ * implementation that only supplies the 'full' version of the functions.
+ */
+
+int ast_say_number(struct ast_channel *chan, int num,
+ const char *ints, const char *language, const char *options)
+{
+ return ast_say_number_full(chan, num, ints, language, options, -1, -1);
+}
+
+int ast_say_enumeration(struct ast_channel *chan, int num,
+ const char *ints, const char *language, const char *options)
+{
+ return ast_say_enumeration_full(chan, num, ints, language, options, -1, -1);
+}
+
+int ast_say_digits(struct ast_channel *chan, int num,
+ const char *ints, const char *lang)
+{
+ return ast_say_digits_full(chan, num, ints, lang, -1, -1);
+}
+
+int ast_say_digit_str(struct ast_channel *chan, const char *str,
+ const char *ints, const char *lang)
+{
+ return ast_say_digit_str_full(chan, str, ints, lang, -1, -1);
+}
+
+int ast_say_character_str(struct ast_channel *chan, const char *str,
+ const char *ints, const char *lang)
+{
+ return ast_say_character_str_full(chan, str, ints, lang, -1, -1);
+}
+
+int ast_say_phonetic_str(struct ast_channel *chan, const char *str,
+ const char *ints, const char *lang)
+{
+ return ast_say_phonetic_str_full(chan, str, ints, lang, -1, -1);
+}
+
+int ast_say_digits_full(struct ast_channel *chan, int num,
+ const char *ints, const char *lang, int audiofd, int ctrlfd)
+{
+ char buf[256];
+
+ snprintf(buf, sizeof(buf), "%d", num);
+ return ast_say_digit_str_full(chan, buf, ints, lang, audiofd, ctrlfd);
+}
+
+/* end of file */
diff --git a/include/asterisk/say.h b/include/asterisk/say.h
index 6c2396fc9..17070c2c4 100644
--- a/include/asterisk/say.h
+++ b/include/asterisk/say.h
@@ -33,11 +33,16 @@ extern "C" {
#endif
/*! \brief
- * All ast_say_* functions are implemented as function pointers,
+ * The basic ast_say_* functions are implemented as function pointers,
* initialized to the function say_stub() which simply returns an error.
- * An implementation of these functions (e.g. say.c, if available, or
+ * Other interfaces, declared here as regular functions, are simply
+ * wrappers around the basic functions.
+ *
+ * An implementation of the basic ast_say functions (e.g. from say.c or from
* a dynamically loaded module) will just have to reassign the pointers
* to the relevant functions to override the previous implementation.
+ *
+ * \todo XXX
* As the conversion from the old implementation of say.c to the new
* implementation will be completed, and the API suitably reworked by
* removing redundant functions and/or arguments, this mechanism may be
@@ -70,7 +75,8 @@ static int say_stub(struct ast_channel *chan, ...)
* Vocally says a number on a given channel
* Returns 0 on success, DTMF digit on interrupt, -1 on failure
*/
-SAY_EXTERN int (*ast_say_number)(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options) SAY_INIT(ast_say_number);
+int ast_say_number(struct ast_channel *chan, int num,
+ const char *ints, const char *lang, const char *options);
/* Same as above with audiofd for received audio and returns 1 on ctrlfd being readable */
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);
@@ -85,7 +91,9 @@ SAY_EXTERN int (* ast_say_number_full)(struct ast_channel *chan, int num, const
* especially useful for dates and messages. says 'last' if num equals to INT_MAX
* Returns 0 on success, DTMF digit on interrupt, -1 on failure
*/
-SAY_EXTERN int (* ast_say_enumeration)(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options) SAY_INIT(ast_say_enumeration);
+int ast_say_enumeration(struct ast_channel *chan, int num,
+ const char *ints, const char *lang, const char *options);
+
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);
/* says digits
@@ -96,8 +104,11 @@ SAY_EXTERN int (* ast_say_enumeration_full)(struct ast_channel *chan, int num, c
* Vocally says digits of a given number
* Returns 0 on success, dtmf if interrupted, -1 on failure
*/
-SAY_EXTERN int (*ast_say_digits)(struct ast_channel *chan, int num, const char *ints, const char *lang) SAY_INIT(ast_say_digits);
-SAY_EXTERN int (*ast_say_digits_full)(struct ast_channel *chan, int num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_digits_full);
+int ast_say_digits(struct ast_channel *chan, int num,
+ const char *ints, const char *lang);
+
+int ast_say_digits_full(struct ast_channel *chan, int num,
+ const char *ints, const char *lang, int audiofd, int ctrlfd);
/* says digits of a string
* \param chan channel to act upon
@@ -107,7 +118,9 @@ SAY_EXTERN int (*ast_say_digits_full)(struct ast_channel *chan, int num, const c
* Vocally says the digits of a given string
* Returns 0 on success, dtmf if interrupted, -1 on failure
*/
-SAY_EXTERN int (* ast_say_digit_str)(struct ast_channel *chan, const char *num, const char *ints, const char *lang) SAY_INIT(ast_say_digit_str);
+int ast_say_digit_str(struct ast_channel *chan, const char *num,
+ const char *ints, const char *lang);
+
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);
/*
@@ -115,9 +128,18 @@ SAY_EXTERN int (* ast_say_digit_str_full)(struct ast_channel *chan, const char *
* defining the format to use
*/
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);
-SAY_EXTERN int (* ast_say_character_str)(struct ast_channel *chan, const char *num, const char *ints, const char *lang) SAY_INIT(ast_say_character_str);
+
+/*
+ * other function to pronounce character and phonetic strings
+ */
+int ast_say_character_str(struct ast_channel *chan, const char *num,
+ const char *ints, const char *lang);
+
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);
-SAY_EXTERN int (* ast_say_phonetic_str)(struct ast_channel *chan, const char *num, const char *ints, const char *lang) SAY_INIT(ast_say_phonetic_str);
+
+int ast_say_phonetic_str(struct ast_channel *chan, const char *num,
+ const char *ints, const char *lang);
+
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);
SAY_EXTERN int (* ast_say_datetime)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_datetime);
diff --git a/say.c b/say.c
index 908660efa..d89643a69 100644
--- a/say.c
+++ b/say.c
@@ -132,11 +132,6 @@ static int say_character_str_full(struct ast_channel *chan, const char *str, con
return res;
}
-static int say_character_str(struct ast_channel *chan, const char *str, const char *ints, const char *lang)
-{
- return ast_say_character_str_full(chan, str, ints, lang, -1, -1);
-}
-
static int say_phonetic_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
{
const char *fn;
@@ -211,11 +206,6 @@ static int say_phonetic_str_full(struct ast_channel *chan, const char *str, cons
return res;
}
-static int say_phonetic_str(struct ast_channel *chan, const char *str, const char *ints, const char *lang)
-{
- return ast_say_phonetic_str_full(chan, str, ints, lang, -1, -1);
-}
-
static int say_digit_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
{
const char *fn;
@@ -262,24 +252,6 @@ static int say_digit_str_full(struct ast_channel *chan, const char *str, const c
return res;
}
-static int say_digit_str(struct ast_channel *chan, const char *str, const char *ints, const char *lang)
-{
- return ast_say_digit_str_full(chan, str, ints, lang, -1, -1);
-}
-
-static int say_digits_full(struct ast_channel *chan, int num, const char *ints, const char *lang, int audiofd, int ctrlfd)
-{
- char fn2[256];
-
- snprintf(fn2, sizeof(fn2), "%d", num);
- return ast_say_digit_str_full(chan, fn2, ints, lang, audiofd, ctrlfd);
-}
-
-static int say_digits(struct ast_channel *chan, int num, const char *ints, const char *lang)
-{
- return ast_say_digits_full(chan, num, ints, lang, -1, -1);
-}
-
/* Forward declarations */
/*! \page Def_syntaxlang Asterisk Language Syntaxes supported
\note Not really language codes.
@@ -456,12 +428,6 @@ static int say_number_full(struct ast_channel *chan, int num, const char *ints,
return(ast_say_number_full_en(chan, num, ints, language, audiofd, ctrlfd));
}
-/*! \brief ast_say_number: call language-specific functions without file descriptors */
-static int say_number(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options)
-{
- return(ast_say_number_full(chan, num, ints, language, options, -1, -1));
-}
-
/*! \brief ast_say_number_full_en: English syntax */
/* This is the default syntax, if no other syntax defined in this file is used */
static int ast_say_number_full_en(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
@@ -2288,12 +2254,6 @@ static int say_enumeration_full(struct ast_channel *chan, int num, const char *i
return(ast_say_enumeration_full_en(chan, num, ints, language, audiofd, ctrlfd));
}
-/*! \brief ast_say_enumeration: call language-specific functions without file descriptors */
-static int say_enumeration(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options)
-{
- return(ast_say_enumeration_full(chan, num, ints, language, options, -1, -1));
-}
-
/*! \brief ast_say_enumeration_full_en: English syntax */
/* This is the default syntax, if no other syntax defined in this file is used */
static int ast_say_enumeration_full_en(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
@@ -6201,17 +6161,10 @@ static int ast_say_date_with_format_gr(struct ast_channel *chan, time_t time, co
*/
static void __attribute__((constructor)) __say_init(void)
{
- ast_say_number = say_number;
ast_say_number_full = say_number_full;
- ast_say_enumeration = say_enumeration;
ast_say_enumeration_full = say_enumeration_full;
- ast_say_digits = say_digits;
- ast_say_digits_full = say_digits_full;
- ast_say_digit_str = say_digit_str;
ast_say_digit_str_full = say_digit_str_full;
- ast_say_character_str = say_character_str;
ast_say_character_str_full = say_character_str_full;
- ast_say_phonetic_str = say_phonetic_str;
ast_say_phonetic_str_full = say_phonetic_str_full;
ast_say_datetime = say_datetime;
ast_say_time = say_time;