}
#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 */
#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
* 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);
* 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
* 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
* 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);
/*
* 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);
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;
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;
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.
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)
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)
*/
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;