Updates from char * to const char * + german syntax + enumeration (bug #2780)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4229 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-11-13 16:13:07 +00:00
parent a1cdeb6f80
commit dd43338425
19 changed files with 2013 additions and 1624 deletions

View File

@@ -58,16 +58,21 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data)
{ {
int res=0; int res=0;
struct localuser *u; struct localuser *u;
char *s,*zone=NULL,*timec; char *s,*zone=NULL,*timec,*format;
time_t unixtime; time_t unixtime;
char *format = "ABdY 'digits/at' IMp";
struct timeval tv; struct timeval tv;
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
gettimeofday(&tv,NULL); gettimeofday(&tv,NULL);
unixtime = (time_t)tv.tv_sec; unixtime = (time_t)tv.tv_sec;
if( !strcasecmp(chan->language, "de" ) ) {
format = "A dBY HMS";
} else {
format = "ABdY 'digits/at' IMp";
}
if (data) { if (data) {
s = data; s = data;
s = ast_strdupa(s); s = ast_strdupa(s);

View File

@@ -2423,6 +2423,8 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v
#endif #endif
if (the_zone) if (the_zone)
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, the_zone->msg_format, the_zone->timezone); res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, the_zone->msg_format, the_zone->timezone);
else if(!strcasecmp(chan->language,"de")) /* GERMAN syntax */
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL);
else if (!strcasecmp(chan->language,"nl")) /* DUTCH syntax */ else if (!strcasecmp(chan->language,"nl")) /* DUTCH syntax */
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/nl-om' HM", NULL); res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/nl-om' HM", NULL);
else if (!strcasecmp(chan->language,"it")) /* ITALIAN syntax */ else if (!strcasecmp(chan->language,"it")) /* ITALIAN syntax */

View File

@@ -3511,7 +3511,7 @@ static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsig
f.samples = 0; f.samples = 0;
f.mallocd = 0; f.mallocd = 0;
f.offset = 0; f.offset = 0;
f.src = __FUNCTION__; f.src = (char *)__FUNCTION__;
f.data = data; f.data = data;
return iax2_send(i, &f, ts, seqno, now, transfer, final); return iax2_send(i, &f, ts, seqno, now, transfer, final);
} }

42
file.c
View File

@@ -46,7 +46,7 @@ struct ast_format {
/* Open an input stream, and start playback */ /* Open an input stream, and start playback */
struct ast_filestream * (*open)(int fd); struct ast_filestream * (*open)(int fd);
/* Open an output stream, of a given file descriptor and comment it appropriately if applicable */ /* Open an output stream, of a given file descriptor and comment it appropriately if applicable */
struct ast_filestream * (*rewrite)(int fd, char *comment); struct ast_filestream * (*rewrite)(int fd, const char *comment);
/* Write a frame to a channel */ /* Write a frame to a channel */
int (*write)(struct ast_filestream *, struct ast_frame *); int (*write)(struct ast_filestream *, struct ast_frame *);
/* seek num samples into file, whence(think normal seek) */ /* seek num samples into file, whence(think normal seek) */
@@ -87,9 +87,9 @@ AST_MUTEX_DEFINE_STATIC(formatlock);
static struct ast_format *formats = NULL; static struct ast_format *formats = NULL;
int ast_format_register(char *name, char *exts, int format, int ast_format_register(const char *name, const char *exts, int format,
struct ast_filestream * (*open)(int fd), struct ast_filestream * (*open)(int fd),
struct ast_filestream * (*rewrite)(int fd, char *comment), struct ast_filestream * (*rewrite)(int fd, const char *comment),
int (*write)(struct ast_filestream *, struct ast_frame *), int (*write)(struct ast_filestream *, struct ast_frame *),
int (*seek)(struct ast_filestream *, long sample_offset, int whence), int (*seek)(struct ast_filestream *, long sample_offset, int whence),
int (*trunc)(struct ast_filestream *), int (*trunc)(struct ast_filestream *),
@@ -138,7 +138,7 @@ int ast_format_register(char *name, char *exts, int format,
return 0; return 0;
} }
int ast_format_unregister(char *name) int ast_format_unregister(const char *name)
{ {
struct ast_format *tmp, *tmpl = NULL; struct ast_format *tmp, *tmpl = NULL;
if (ast_mutex_lock(&formatlock)) { if (ast_mutex_lock(&formatlock)) {
@@ -188,7 +188,7 @@ int ast_writestream(struct ast_filestream *fs, struct ast_frame *f)
/* This is the audio portion. Call the video one... */ /* This is the audio portion. Call the video one... */
if (!fs->vfs && fs->filename) { if (!fs->vfs && fs->filename) {
/* XXX Support other video formats XXX */ /* XXX Support other video formats XXX */
char *type = "h263"; const char *type = "h263";
fs->vfs = ast_writefile(fs->filename, type, NULL, fs->flags, 0, fs->mode); fs->vfs = ast_writefile(fs->filename, type, NULL, fs->flags, 0, fs->mode);
ast_log(LOG_DEBUG, "Opened video output file\n"); ast_log(LOG_DEBUG, "Opened video output file\n");
} }
@@ -238,7 +238,7 @@ int ast_writestream(struct ast_filestream *fs, struct ast_frame *f)
} }
} }
static int copy(char *infile, char *outfile) static int copy(const char *infile, const char *outfile)
{ {
int ifd; int ifd;
int ofd; int ofd;
@@ -278,7 +278,7 @@ static int copy(char *infile, char *outfile)
return 0; return 0;
} }
static char *build_filename(char *filename, char *ext) static char *build_filename(const const char *filename, const char *ext)
{ {
char *fn; char *fn;
int fnsize = 0; int fnsize = 0;
@@ -297,7 +297,7 @@ static char *build_filename(char *filename, char *ext)
} }
static int exts_compare(char *exts, char *type) static int exts_compare(const char *exts, const const char *type)
{ {
char *stringp = NULL, *ext; char *stringp = NULL, *ext;
char tmp[256]; char tmp[256];
@@ -319,7 +319,7 @@ static int exts_compare(char *exts, char *type)
#define ACTION_OPEN 4 #define ACTION_OPEN 4
#define ACTION_COPY 5 #define ACTION_COPY 5
static int ast_filehelper(char *filename, char *filename2, char *fmt, int action) static int ast_filehelper(const char *filename, const char *filename2, const char *fmt, int action)
{ {
struct stat st; struct stat st;
struct ast_format *f; struct ast_format *f;
@@ -432,7 +432,7 @@ static int ast_filehelper(char *filename, char *filename2, char *fmt, int action
return res; return res;
} }
struct ast_filestream *ast_openstream(struct ast_channel *chan, char *filename, char *preflang) struct ast_filestream *ast_openstream(struct ast_channel *chan, const char *filename, const char *preflang)
{ {
/* This is a fairly complex routine. Essentially we should do /* This is a fairly complex routine. Essentially we should do
the following: the following:
@@ -485,7 +485,7 @@ struct ast_filestream *ast_openstream(struct ast_channel *chan, char *filename,
return NULL; return NULL;
} }
struct ast_filestream *ast_openvstream(struct ast_channel *chan, char *filename, char *preflang) struct ast_filestream *ast_openvstream(struct ast_channel *chan, const char *filename, const char *preflang)
{ {
/* This is a fairly complex routine. Essentially we should do /* This is a fairly complex routine. Essentially we should do
the following: the following:
@@ -697,7 +697,7 @@ int ast_closestream(struct ast_filestream *f)
} }
int ast_fileexists(char *filename, char *fmt, char *preflang) int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
{ {
char filename2[256]; char filename2[256];
char tmp[256]; char tmp[256];
@@ -737,22 +737,22 @@ int ast_fileexists(char *filename, char *fmt, char *preflang)
return res; return res;
} }
int ast_filedelete(char *filename, char *fmt) int ast_filedelete(const char *filename, const char *fmt)
{ {
return ast_filehelper(filename, NULL, fmt, ACTION_DELETE); return ast_filehelper(filename, NULL, fmt, ACTION_DELETE);
} }
int ast_filerename(char *filename, char *filename2, char *fmt) int ast_filerename(const char *filename, const char *filename2, const char *fmt)
{ {
return ast_filehelper(filename, filename2, fmt, ACTION_RENAME); return ast_filehelper(filename, filename2, fmt, ACTION_RENAME);
} }
int ast_filecopy(char *filename, char *filename2, char *fmt) int ast_filecopy(const char *filename, const char *filename2, const char *fmt)
{ {
return ast_filehelper(filename, filename2, fmt, ACTION_COPY); return ast_filehelper(filename, filename2, fmt, ACTION_COPY);
} }
int ast_streamfile(struct ast_channel *chan, char *filename, char *preflang) int ast_streamfile(struct ast_channel *chan, const char *filename, const char *preflang)
{ {
struct ast_filestream *fs; struct ast_filestream *fs;
struct ast_filestream *vfs; struct ast_filestream *vfs;
@@ -780,7 +780,7 @@ int ast_streamfile(struct ast_channel *chan, char *filename, char *preflang)
return -1; return -1;
} }
struct ast_filestream *ast_readfile(char *filename, char *type, char *comment, int flags, int check, mode_t mode) struct ast_filestream *ast_readfile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)
{ {
int fd,myflags = 0; int fd,myflags = 0;
struct ast_format *f; struct ast_format *f;
@@ -829,7 +829,7 @@ struct ast_filestream *ast_readfile(char *filename, char *type, char *comment, i
return fs; return fs;
} }
struct ast_filestream *ast_writefile(char *filename, char *type, char *comment, int flags, int check, mode_t mode) struct ast_filestream *ast_writefile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)
{ {
int fd,myflags = 0; int fd,myflags = 0;
struct ast_format *f; struct ast_format *f;
@@ -920,7 +920,7 @@ struct ast_filestream *ast_writefile(char *filename, char *type, char *comment,
return fs; return fs;
} }
char ast_waitstream(struct ast_channel *c, char *breakon) char ast_waitstream(struct ast_channel *c, const char *breakon)
{ {
/* XXX Maybe I should just front-end ast_waitstream_full ? XXX */ /* XXX Maybe I should just front-end ast_waitstream_full ? XXX */
int res; int res;
@@ -976,7 +976,7 @@ char ast_waitstream(struct ast_channel *c, char *breakon)
return (c->_softhangup ? -1 : 0); return (c->_softhangup ? -1 : 0);
} }
char ast_waitstream_fr(struct ast_channel *c, char *breakon, char *forward, char *rewind, int ms) char ast_waitstream_fr(struct ast_channel *c, const char *breakon, const char *forward, const char *rewind, int ms)
{ {
int res; int res;
struct ast_frame *fr; struct ast_frame *fr;
@@ -1037,7 +1037,7 @@ char ast_waitstream_fr(struct ast_channel *c, char *breakon, char *forward, char
return (c->_softhangup ? -1 : 0); return (c->_softhangup ? -1 : 0);
} }
char ast_waitstream_full(struct ast_channel *c, char *breakon, int audiofd, int cmdfd) char ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int cmdfd)
{ {
int res; int res;
int ms; int ms;

View File

@@ -78,7 +78,7 @@ static struct ast_filestream *g723_open(int fd)
return tmp; return tmp;
} }
static struct ast_filestream *g723_rewrite(int fd, char *comment) static struct ast_filestream *g723_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check

View File

@@ -198,7 +198,7 @@ static struct ast_filestream *g726_16_open(int fd)
return tmp; return tmp;
} }
static struct ast_filestream *g726_40_rewrite(int fd, char *comment) static struct ast_filestream *g726_40_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check
@@ -224,7 +224,7 @@ static struct ast_filestream *g726_40_rewrite(int fd, char *comment)
return tmp; return tmp;
} }
static struct ast_filestream *g726_32_rewrite(int fd, char *comment) static struct ast_filestream *g726_32_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check
@@ -250,7 +250,7 @@ static struct ast_filestream *g726_32_rewrite(int fd, char *comment)
return tmp; return tmp;
} }
static struct ast_filestream *g726_24_rewrite(int fd, char *comment) static struct ast_filestream *g726_24_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check
@@ -276,7 +276,7 @@ static struct ast_filestream *g726_24_rewrite(int fd, char *comment)
return tmp; return tmp;
} }
static struct ast_filestream *g726_16_rewrite(int fd, char *comment) static struct ast_filestream *g726_16_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check

View File

@@ -82,7 +82,7 @@ static struct ast_filestream *g729_open(int fd)
return tmp; return tmp;
} }
static struct ast_filestream *g729_rewrite(int fd, char *comment) static struct ast_filestream *g729_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check

View File

@@ -91,7 +91,7 @@ static struct ast_filestream *gsm_open(int fd)
return tmp; return tmp;
} }
static struct ast_filestream *gsm_rewrite(int fd, char *comment) static struct ast_filestream *gsm_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check

View File

@@ -90,7 +90,7 @@ static struct ast_filestream *h263_open(int fd)
return tmp; return tmp;
} }
static struct ast_filestream *h263_rewrite(int fd, char *comment) static struct ast_filestream *h263_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check

View File

@@ -84,7 +84,7 @@ static struct ast_filestream *ilbc_open(int fd)
return tmp; return tmp;
} }
static struct ast_filestream *ilbc_rewrite(int fd, char *comment) static struct ast_filestream *ilbc_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check

View File

@@ -80,7 +80,7 @@ static struct ast_filestream *pcm_open(int fd)
return tmp; return tmp;
} }
static struct ast_filestream *pcm_rewrite(int fd, char *comment) static struct ast_filestream *pcm_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check

View File

@@ -108,7 +108,7 @@ static struct ast_filestream *pcm_open(int fd)
return tmp; return tmp;
} }
static struct ast_filestream *pcm_rewrite(int fd, char *comment) static struct ast_filestream *pcm_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check

View File

@@ -78,7 +78,7 @@ static struct ast_filestream *slinear_open(int fd)
return tmp; return tmp;
} }
static struct ast_filestream *slinear_rewrite(int fd, char *comment) static struct ast_filestream *slinear_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check

View File

@@ -85,7 +85,7 @@ static struct ast_filestream *vox_open(int fd)
return tmp; return tmp;
} }
static struct ast_filestream *vox_rewrite(int fd, char *comment) static struct ast_filestream *vox_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check

View File

@@ -350,7 +350,7 @@ static struct ast_filestream *wav_open(int fd)
return tmp; return tmp;
} }
static struct ast_filestream *wav_rewrite(int fd, char *comment) static struct ast_filestream *wav_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check

View File

@@ -361,7 +361,7 @@ static struct ast_filestream *wav_open(int fd)
return tmp; return tmp;
} }
static struct ast_filestream *wav_rewrite(int fd, char *comment) static struct ast_filestream *wav_rewrite(int fd, const char *comment)
{ {
/* We don't have any header to read or anything really, but /* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check if we did, it would go here. We also might want to check

View File

@@ -38,9 +38,9 @@ struct ast_filestream;
* Adds a format to asterisk's format abilities. Fill in the fields, and it will work. For examples, look at some of the various format code. * Adds a format to asterisk's format abilities. Fill in the fields, and it will work. For examples, look at some of the various format code.
* returns 0 on success, -1 on failure * returns 0 on success, -1 on failure
*/ */
int ast_format_register(char *name, char *exts, int format, int ast_format_register(const char *name, const char *exts, int format,
struct ast_filestream * (*open)(int fd), struct ast_filestream * (*open)(int fd),
struct ast_filestream * (*rewrite)(int fd, char *comment), struct ast_filestream * (*rewrite)(int fd, const char *comment),
int (*write)(struct ast_filestream *, struct ast_frame *), int (*write)(struct ast_filestream *, struct ast_frame *),
int (*seek)(struct ast_filestream *, long offset, int whence), int (*seek)(struct ast_filestream *, long offset, int whence),
int (*trunc)(struct ast_filestream *), int (*trunc)(struct ast_filestream *),
@@ -55,7 +55,7 @@ int ast_format_register(char *name, char *exts, int format,
* Unregisters a format based on the name of the format. * Unregisters a format based on the name of the format.
* Returns 0 on success, -1 on failure to unregister * Returns 0 on success, -1 on failure to unregister
*/ */
int ast_format_unregister(char *name); int ast_format_unregister(const char *name);
//! Streams a file //! Streams a file
/*! /*!
@@ -66,7 +66,7 @@ int ast_format_unregister(char *name);
* Also, it will stop any existing streams on the channel. * Also, it will stop any existing streams on the channel.
* Returns 0 on success, or -1 on failure. * Returns 0 on success, or -1 on failure.
*/ */
int ast_streamfile(struct ast_channel *c, char *filename, char *preflang); int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang);
//! Stops a stream //! Stops a stream
/*! /*!
@@ -84,7 +84,7 @@ int ast_stopstream(struct ast_channel *c);
* See if a given file exists in a given format. If fmt is NULL, any format is accepted. * See if a given file exists in a given format. If fmt is NULL, any format is accepted.
* Returns -1 if file does not exist, non-zero positive otherwise. * Returns -1 if file does not exist, non-zero positive otherwise.
*/ */
int ast_fileexists(char *filename, char *fmt, char *preflang); int ast_fileexists(const char *filename, const char *fmt, const char *preflang);
//! Renames a file //! Renames a file
/*! /*!
@@ -94,7 +94,7 @@ int ast_fileexists(char *filename, char *fmt, char *preflang);
* Rename a given file in a given format, or if fmt is NULL, then do so for all * Rename a given file in a given format, or if fmt is NULL, then do so for all
* Returns -1 on failure * Returns -1 on failure
*/ */
int ast_filerename(char *oldname, char *newname, char *fmt); int ast_filerename(const char *oldname, const char *newname, const char *fmt);
//! Deletes a file //! Deletes a file
/*! /*!
@@ -102,7 +102,7 @@ int ast_filerename(char *oldname, char *newname, char *fmt);
* \param format of the file * \param format of the file
* Delete a given file in a given format, or if fmt is NULL, then do so for all * Delete a given file in a given format, or if fmt is NULL, then do so for all
*/ */
int ast_filedelete(char *filename, char *fmt); int ast_filedelete(const char *filename, const char *fmt);
//! Copies a file //! Copies a file
/*! /*!
@@ -111,7 +111,7 @@ int ast_filedelete(char *filename, char *fmt);
* \param fmt the format of the file * \param fmt the format of the file
* Copy a given file in a given format, or if fmt is NULL, then do so for all * Copy a given file in a given format, or if fmt is NULL, then do so for all
*/ */
int ast_filecopy(char *oldname, char *newname, char *fmt); int ast_filecopy(const char *oldname, const char *newname, const char *fmt);
//! Waits for a stream to stop or digit to be pressed //! Waits for a stream to stop or digit to be pressed
/*! /*!
@@ -121,7 +121,7 @@ int ast_filecopy(char *oldname, char *newname, char *fmt);
* Wait for a stream to stop or for any one of a given digit to arrive, Returns 0 * Wait for a stream to stop or for any one of a given digit to arrive, Returns 0
* if the stream finishes, the character if it was interrupted, and -1 on error * if the stream finishes, the character if it was interrupted, and -1 on error
*/ */
char ast_waitstream(struct ast_channel *c, char *breakon); char ast_waitstream(struct ast_channel *c, const char *breakon);
//! Same as waitstream but allows stream to be forwarded or rewound //! Same as waitstream but allows stream to be forwarded or rewound
/*! /*!
@@ -134,11 +134,11 @@ char ast_waitstream(struct ast_channel *c, char *breakon);
* Wait for a stream to stop or for any one of a given digit to arrive, Returns 0 * Wait for a stream to stop or for any one of a given digit to arrive, Returns 0
* if the stream finishes, the character if it was interrupted, and -1 on error * if the stream finishes, the character if it was interrupted, and -1 on error
*/ */
char ast_waitstream_fr(struct ast_channel *c, char *breakon, char *forward, char *rewind, int ms); char ast_waitstream_fr(struct ast_channel *c, const char *breakon, const char *forward, const char *rewind, int ms);
/* Same as waitstream, but with audio output to fd and monitored fd checking. Returns /* Same as waitstream, but with audio output to fd and monitored fd checking. Returns
1 if monfd is ready for reading */ 1 if monfd is ready for reading */
char ast_waitstream_full(struct ast_channel *c, char *breakon, int audiofd, int monfd); char ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int monfd);
//! Starts reading from a file //! Starts reading from a file
/*! /*!
@@ -154,7 +154,7 @@ char ast_waitstream_full(struct ast_channel *c, char *breakon, int audiofd, int
* Please note, this is a blocking function. Program execution will not return until ast_waitstream completes it's execution. * Please note, this is a blocking function. Program execution will not return until ast_waitstream completes it's execution.
* Returns a struct ast_filestream on success, NULL on failure * Returns a struct ast_filestream on success, NULL on failure
*/ */
struct ast_filestream *ast_readfile(char *filename, char *type, char *comment, int flags, int check, mode_t mode); struct ast_filestream *ast_readfile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode);
//! Starts writing a file //! Starts writing a file
/*! /*!
@@ -170,7 +170,7 @@ struct ast_filestream *ast_readfile(char *filename, char *type, char *comment, i
* Please note, this is a blocking function. Program execution will not return until ast_waitstream completes it's execution. * Please note, this is a blocking function. Program execution will not return until ast_waitstream completes it's execution.
* Returns a struct ast_filestream on success, NULL on failure * Returns a struct ast_filestream on success, NULL on failure
*/ */
struct ast_filestream *ast_writefile(char *filename, char *type, char *comment, int flags, int check, mode_t mode); struct ast_filestream *ast_writefile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode);
//! Writes a frame to a stream //! Writes a frame to a stream
/*! /*!
@@ -196,7 +196,7 @@ int ast_closestream(struct ast_filestream *f);
* \param preflang prefered language to use * \param preflang prefered language to use
* Returns a ast_filestream pointer if it opens the file, NULL on error * Returns a ast_filestream pointer if it opens the file, NULL on error
*/ */
struct ast_filestream *ast_openstream(struct ast_channel *chan, char *filename, char *preflang); struct ast_filestream *ast_openstream(struct ast_channel *chan, const char *filename, const char *preflang);
//! Opens stream for use in seeking, playing //! Opens stream for use in seeking, playing
/*! /*!
@@ -205,7 +205,7 @@ struct ast_filestream *ast_openstream(struct ast_channel *chan, char *filename,
* \param preflang prefered language to use * \param preflang prefered language to use
* Returns a ast_filestream pointer if it opens the file, NULL on error * Returns a ast_filestream pointer if it opens the file, NULL on error
*/ */
struct ast_filestream *ast_openvstream(struct ast_channel *chan, char *filename, char *preflang); struct ast_filestream *ast_openvstream(struct ast_channel *chan, const char *filename, const char *preflang);
//! Applys a open stream to a channel. //! Applys a open stream to a channel.
/*! /*!

View File

@@ -23,23 +23,34 @@
extern "C" { extern "C" {
#endif #endif
//! says a number /* says a number
/*!
* \param chan channel to say them number on * \param chan channel to say them number on
* \param num number to say on the channel * \param num number to say on the channel
* \param ints which dtmf to interrupt on * \param ints which dtmf to interrupt on
* \param lang language to speak the number * \param lang language to speak the number
* \param options set to 'f' for female, 'm' for masculine (used in portuguese) * \param options set to 'f' for female, 'm' for male, 'c' for commune, 'n' for neuter, 'p' for plural
* Vocally says a number on a given channel * Vocally says a number on a given channel
* Returns 0 on success, DTMF digit on interrupt, -1 on failure * Returns 0 on success, DTMF digit on interrupt, -1 on failure
*/ */
int ast_say_number(struct ast_channel *chan, int num, char *ints, char *lang, char *options); 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 */ /* Same as above with audiofd for received audio and returns 1 on ctrlfd being readable */
int ast_say_number_full(struct ast_channel *chan, int num, char *ints, char *lang, char *options, int audiofd, int ctrlfd); int ast_say_number_full(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd);
//! says digits /* says an enumeration
/*! * \param chan channel to say them enumeration on
* \param num number to say on the channel
* \param ints which dtmf to interrupt on
* \param lang language to speak the enumeration
* \param options set to 'f' for female, 'm' for male, 'c' for commune, 'n' for neuter, 'p' for plural
* Vocally says a enumeration on a given channel (first, sencond, third, forth, thirtyfirst, hundredth, ....)
* 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
*/
int ast_say_enumeration(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options);
int ast_say_enumeration_full(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd);
/* says digits
* \param chan channel to act upon * \param chan channel to act upon
* \param num number to speak * \param num number to speak
* \param ints which dtmf to interrupt on * \param ints which dtmf to interrupt on
@@ -47,11 +58,10 @@ int ast_say_number_full(struct ast_channel *chan, int num, char *ints, char *lan
* Vocally says digits of a given number * Vocally says digits of a given number
* Returns 0 on success, dtmf if interrupted, -1 on failure * Returns 0 on success, dtmf if interrupted, -1 on failure
*/ */
int ast_say_digits(struct ast_channel *chan, int num, char *ints, char *lang); 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, char *ints, char *lang, int audiofd, int ctrlfd); 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 /* says digits of a string
/*!
* \param chan channel to act upon * \param chan channel to act upon
* \param num string to speak * \param num string to speak
* \param ints which dtmf to interrupt on * \param ints which dtmf to interrupt on
@@ -59,22 +69,22 @@ int ast_say_digits_full(struct ast_channel *chan, int num, char *ints, char *lan
* Vocally says the digits of a given string * Vocally says the digits of a given string
* Returns 0 on success, dtmf if interrupted, -1 on failure * Returns 0 on success, dtmf if interrupted, -1 on failure
*/ */
int ast_say_digit_str(struct ast_channel *chan, char *num, char *ints, char *lang); int ast_say_digit_str(struct ast_channel *chan, const char *num, const char *ints, const char *lang);
int ast_say_digit_str_full(struct ast_channel *chan, char *num, char *ints, char *lang, int audiofd, int ctrlfd); int ast_say_digit_str_full(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd);
int ast_say_character_str(struct ast_channel *chan, char *num, char *ints, char *lang); int ast_say_character_str(struct ast_channel *chan, const char *num, const char *ints, const char *lang);
int ast_say_character_str_full(struct ast_channel *chan, char *num, char *ints, char *lang, int audiofd, int ctrlfd); int ast_say_character_str_full(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd);
int ast_say_phonetic_str(struct ast_channel *chan, char *num, char *ints, char *lang); int ast_say_phonetic_str(struct ast_channel *chan, const char *num, const char *ints, const char *lang);
int ast_say_phonetic_str_full(struct ast_channel *chan, char *num, char *ints, char *lang, int audiofd, int ctrlfd); int ast_say_phonetic_str_full(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd);
int ast_say_datetime(struct ast_channel *chan, time_t t, char *ints, char *lang); int ast_say_datetime(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
int ast_say_time(struct ast_channel *chan, time_t t, char *ints, char *lang); int ast_say_time(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
int ast_say_date(struct ast_channel *chan, time_t t, char *ints, char *lang); int ast_say_date(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
int ast_say_datetime_from_now(struct ast_channel *chan, time_t t, char *ints, char *lang); int ast_say_datetime_from_now(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
int ast_say_date_with_format(struct ast_channel *chan, time_t t, char *ints, char *lang, char *format, char *timezone); 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);
#if defined(__cplusplus) || defined(c_plusplus) #if defined(__cplusplus) || defined(c_plusplus)
} }

3466
say.c

File diff suppressed because it is too large Load Diff