Fri Aug 17 00:17:19 2018

Asterisk developer's documentation


say.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 1999 - 2005, Digium, Inc.
00005  *
00006  * Mark Spencer <markster@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 /*! \file
00020  * \brief Say numbers and dates (maybe words one day too)
00021  */
00022 
00023 #ifndef _ASTERISK_SAY_H
00024 #define _ASTERISK_SAY_H
00025 
00026 #include "asterisk/channel.h"
00027 #include "asterisk/file.h"
00028 
00029 #include <time.h>
00030 
00031 #if defined(__cplusplus) || defined(c_plusplus)
00032 extern "C" {
00033 #endif
00034 
00035 /*! \brief
00036  * The basic ast_say_* functions are implemented as function pointers,
00037  * initialized to the function say_stub() which simply returns an error.
00038  * Other interfaces, declared here as regular functions, are simply
00039  * wrappers around the basic functions.
00040  *
00041  * An implementation of the basic ast_say functions (e.g. from say.c or from
00042  * a dynamically loaded module) will just have to reassign the pointers
00043  * to the relevant functions to override the previous implementation.
00044  *
00045  * \todo XXX
00046  * As the conversion from the old implementation of say.c to the new
00047  * implementation will be completed, and the API suitably reworked by
00048  * removing redundant functions and/or arguments, this mechanism may be
00049  * reverted back to pure static functions, if needed.
00050  */
00051 #if defined(SAY_STUBS)
00052 /* provide declarations for the *say*() functions
00053  * and initialize them to the stub function
00054  */
00055 static int say_stub(struct ast_channel *chan, ...)
00056 {
00057    ast_log(LOG_WARNING, "no implementation for the say() functions\n");
00058         return -1;
00059 };
00060 
00061 #undef SAY_STUBS
00062 #define  SAY_INIT(x)  = (typeof (x))say_stub
00063 #define  SAY_EXTERN
00064 #else
00065 #define SAY_INIT(x)
00066 #define  SAY_EXTERN  extern
00067 #endif
00068 
00069 /*!
00070  * \brief says a number
00071  * \param chan channel to say them number on
00072  * \param num number to say on the channel
00073  * \param ints which dtmf to interrupt on
00074  * \param lang language to speak the number
00075  * \param options set to 'f' for female, 'm' for male, 'c' for commune, 'n' for neuter, 'p' for plural
00076  * \details
00077  * Vocally says a number on a given channel
00078  * \retval 0 on success
00079  * \retval DTMF digit on interrupt
00080  * \retval -1 on failure
00081  */
00082 int ast_say_number(struct ast_channel *chan, int num,
00083    const char *ints, const char *lang, const char *options);
00084 
00085 /* Same as above with audiofd for received audio and returns 1 on ctrlfd being readable */
00086 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);
00087 
00088 /*!
00089  * \brief says an enumeration
00090  * \param chan channel to say them enumeration on
00091  * \param num number to say on the channel
00092  * \param ints which dtmf to interrupt on
00093  * \param lang language to speak the enumeration
00094  * \param options set to 'f' for female, 'm' for male, 'c' for commune, 'n' for neuter, 'p' for plural
00095  * \details
00096  * Vocally says an enumeration on a given channel (first, sencond, third, forth, thirtyfirst, hundredth, ....)
00097  * Especially useful for dates and messages. Says 'last' if num equals to INT_MAX
00098  * \retval 0 on success
00099  * \retval DTMF digit on interrupt
00100  * \retval -1 on failure
00101  */
00102 int ast_say_enumeration(struct ast_channel *chan, int num,
00103    const char *ints, const char *lang, const char *options);
00104 
00105 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);
00106 
00107 /*!
00108  * \brief says digits
00109  * \param chan channel to act upon
00110  * \param num number to speak
00111  * \param ints which dtmf to interrupt on
00112  * \param lang language to speak
00113  * \details
00114  * Vocally says digits of a given number
00115  * \retval 0 on success
00116  * \retval DTMF if interrupted
00117  * \retval -1 on failure
00118  */
00119 int ast_say_digits(struct ast_channel *chan, int num,
00120    const char *ints, const char *lang);
00121 
00122 int ast_say_digits_full(struct ast_channel *chan, int num,
00123    const char *ints, const char *lang, int audiofd, int ctrlfd);
00124 
00125 /*!
00126  * \brief says digits of a string
00127  * \param chan channel to act upon
00128  * \param num string to speak
00129  * \param ints which dtmf to interrupt on
00130  * \param lang language to speak in
00131  * \details
00132  * Vocally says the digits of a given string
00133  * \retval 0 on succes
00134  * \retval DTMF if interrupted
00135  * \retval -1 on failure
00136  */
00137 int ast_say_digit_str(struct ast_channel *chan, const char *num,
00138    const char *ints, const char *lang);
00139 
00140 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);
00141 
00142 /*
00143  * the generic 'say' routine, with the first chars in the string
00144  * defining the format to use
00145  */
00146 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);
00147 
00148 /*
00149  * other function to pronounce character and phonetic strings
00150  */
00151 int ast_say_character_str(struct ast_channel *chan, const char *num,
00152    const char *ints, const char *lang);
00153 
00154 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);
00155 
00156 int ast_say_phonetic_str(struct ast_channel *chan, const char *num,
00157    const char *ints, const char *lang);
00158 
00159 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);
00160 
00161 SAY_EXTERN int (* ast_say_datetime)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_datetime);
00162 SAY_EXTERN int (* ast_say_time)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_time);
00163 
00164 SAY_EXTERN int (* ast_say_date)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_date);
00165 
00166 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);
00167 
00168 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);
00169 
00170 int ast_say_counted_noun(struct ast_channel *chan, int num, const char *noun);
00171 
00172 int ast_say_counted_adjective(struct ast_channel *chan, int num, const char *adjective, const char *gender);
00173 
00174 #if defined(__cplusplus) || defined(c_plusplus)
00175 }
00176 #endif
00177 
00178 #endif /* _ASTERISK_SAY_H */

Generated on 17 Aug 2018 for Asterisk - The Open Source Telephony Project by  doxygen 1.6.1