aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rwxr-xr-xinclude/asterisk/acl.h1
-rwxr-xr-xinclude/asterisk/app.h9
-rwxr-xr-xinclude/asterisk/cdr.h2
-rwxr-xr-xinclude/asterisk/channel.h8
-rwxr-xr-xinclude/asterisk/file.h8
-rwxr-xr-xinclude/asterisk/frame.h60
-rwxr-xr-xinclude/asterisk/lock.h10
-rwxr-xr-xinclude/asterisk/sched.h10
-rwxr-xr-xinclude/asterisk/utils.h2
-rwxr-xr-xinclude/asterisk/vmodem.h4
10 files changed, 94 insertions, 20 deletions
diff --git a/include/asterisk/acl.h b/include/asterisk/acl.h
index bcc7543d5..f55791dfe 100755
--- a/include/asterisk/acl.h
+++ b/include/asterisk/acl.h
@@ -35,6 +35,7 @@ extern int ast_get_ip(struct sockaddr_in *sin, char *value);
extern int ast_ouraddrfor(struct in_addr *them, struct in_addr *us);
extern int ast_lookup_iface(char *iface, struct in_addr *address);
extern struct ast_ha *ast_duplicate_ha_list(struct ast_ha *original);
+extern int ast_find_ourip(struct in_addr *ourip, struct sockaddr_in bindaddr);
//! Compares the source address and port of two sockaddr_in
static inline int inaddrcmp(struct sockaddr_in *sin1, struct sockaddr_in *sin2)
diff --git a/include/asterisk/app.h b/include/asterisk/app.h
index 4b26a73ea..6330467da 100755
--- a/include/asterisk/app.h
+++ b/include/asterisk/app.h
@@ -62,12 +62,19 @@ int ast_play_and_wait(struct ast_channel *chan, char *fn);
//! Record a file for a max amount of time (in seconds), in a given list of formats separated by '|', outputting the duration of the recording, and with a maximum
// permitted silence time in milliseconds of 'maxsilence' under 'silencethreshold' or use '-1' for either or both parameters for defaults.
-int ast_play_and_record(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime_sec, char *fmt, int *duration, int silencethreshold, int maxsilence_ms);
+// calls ast_unlock_path() on 'path' if passed
+int ast_play_and_record(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime_sec, char *fmt, int *duration, int silencethreshold, int maxsilence_ms, const char *path);
//! Record a message and prepend the message to the given record file after playing the optional playfile (or a beep), storing the duration in 'duration' and with a maximum
// permitted silence time in milliseconds of 'maxsilence' under 'silencethreshold' or use '-1' for either or both parameters for defaults.
int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime_sec, char *fmt, int *duration, int beep, int silencethreshold, int maxsilence_ms);
+/* Lock a path */
+int ast_lock_path(const char *path);
+
+/* Unlock a path */
+int ast_unlock_path(const char *path);
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
diff --git a/include/asterisk/cdr.h b/include/asterisk/cdr.h
index 90d9433e3..c274d8a81 100755
--- a/include/asterisk/cdr.h
+++ b/include/asterisk/cdr.h
@@ -254,6 +254,6 @@ extern char ast_default_accountcode[20];
#define ast_cdr_add_flag(cdr, flag) ((cdr)->flags |= (flag))
#define ast_cdr_del_flag(cdr, flag) ((cdr)->flags &= ~(flag))
-extern void ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr);
+extern struct ast_cdr *ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr);
#endif /* _CDR_H */
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 75627cda7..f99831d38 100755
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -19,7 +19,11 @@
#include <asterisk/chanvars.h>
#include <unistd.h>
#include <setjmp.h>
+#if defined(__APPLE__)
+#include <asterisk/poll-compat.h>
+#else
#include <sys/poll.h>
+#endif
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
@@ -639,11 +643,11 @@ struct ast_channel *ast_get_channel_by_name_locked(char *channame);
* \param c channel to wait for a digit on
* \param ms how many milliseconds to wait
* Wait for a digit. Returns <0 on error, 0 on no entry, and the digit on success. */
-char ast_waitfordigit(struct ast_channel *c, int ms);
+int ast_waitfordigit(struct ast_channel *c, int ms);
/* Same as above with audio fd for outputing read audio and ctrlfd to monitor for
reading. Returns 1 if ctrlfd becomes available */
-char ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int ctrlfd);
+int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int ctrlfd);
//! Reads multiple digits
/*!
diff --git a/include/asterisk/file.h b/include/asterisk/file.h
index eb2c78e35..dadd59b0b 100755
--- a/include/asterisk/file.h
+++ b/include/asterisk/file.h
@@ -25,7 +25,7 @@ extern "C" {
//! Convenient for waiting
-#define AST_DIGIT_ANY "0123456789#*"
+#define AST_DIGIT_ANY "0123456789#*"
#define SEEK_FORCECUR 10
@@ -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
* if the stream finishes, the character if it was interrupted, and -1 on error
*/
-char ast_waitstream(struct ast_channel *c, char *breakon);
+int ast_waitstream(struct ast_channel *c, char *breakon);
//! 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
* 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);
+int ast_waitstream_fr(struct ast_channel *c, char *breakon, char *forward, char *rewind, int ms);
/* Same as waitstream, but with audio output to fd and monitored fd checking. Returns
1 if monfd is ready for reading */
-char ast_waitstream_full(struct ast_channel *c, char *breakon, int audiofd, int monfd);
+int ast_waitstream_full(struct ast_channel *c, char *breakon, int audiofd, int monfd);
//! Starts reading from a file
/*!
diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h
index c80ca72f5..0000f9f83 100755
--- a/include/asterisk/frame.h
+++ b/include/asterisk/frame.h
@@ -58,6 +58,11 @@ extern "C" {
#error Need to know endianess
#endif /* __BYTE_ORDER */
+struct ast_codec_pref {
+ char order[32];
+};
+
+
//! Data structure associated with a single frame of data
/* A frame of data read used to communicate between
between channels and applications */
@@ -324,6 +329,18 @@ int ast_fr_fdwrite(int fd, struct ast_frame *frame);
*/
int ast_fr_fdhangup(int fd);
+void ast_memcpy_byteswap(void *dst, void *src, int samples);
+
+/* Helpers for byteswapping native samples to/from
+ little-endian and big-endian. */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define ast_frame_byteswap_le(fr) do { ; } while(0)
+#define ast_frame_byteswap_be(fr) do { struct ast_frame *__f = (fr); ast_memcpy_byteswap(__f->data, __f->data, __f->samples); } while(0)
+#else
+#define ast_frame_byteswap_le(fr) do { struct ast_frame *__f = (fr); ast_memcpy_byteswap(__f->data, __f->data, __f->samples); } while(0)
+#define ast_frame_byteswap_be(fr) do { ; } while(0)
+#endif
+
//! Get the name of a format
/*!
* \param format id of format
@@ -337,11 +354,10 @@ extern char* ast_getformatname(int format);
* \param n size of buf (bytes)
* \param format the format (combined IDs of codecs)
* Prints a list of readable codec names corresponding to "format".
- * ex: for format=AST_FORMAT_GSM|AST_FORMAT_SPEEX|AST_FORMAT_ILBC it will return "0x602(GSM|SPEEX|ILBC)"
+ * ex: for format=AST_FORMAT_GSM|AST_FORMAT_SPEEX|AST_FORMAT_ILBC it will return "0x602 (GSM|SPEEX|ILBC)"
* \return The return value is buf.
*/
-extern char* ast_getformatname_multiple(char *buf, unsigned n, int format);
-
+extern char* ast_getformatname_multiple(char *buf, size_t size, int format);
/*!
* \param name string of format
@@ -364,16 +380,52 @@ extern int ast_best_codec(int fmts);
struct ast_smoother;
+extern struct ast_format_list *ast_get_format_list_index(int index);
+extern struct ast_format_list *ast_get_format_list(size_t *size);
extern struct ast_smoother *ast_smoother_new(int bytes);
extern void ast_smoother_set_flags(struct ast_smoother *smoother, int flags);
extern int ast_smoother_get_flags(struct ast_smoother *smoother);
extern void ast_smoother_free(struct ast_smoother *s);
extern void ast_smoother_reset(struct ast_smoother *s, int bytes);
-extern int ast_smoother_feed(struct ast_smoother *s, struct ast_frame *f);
+extern int __ast_smoother_feed(struct ast_smoother *s, struct ast_frame *f, int swap);
extern struct ast_frame *ast_smoother_read(struct ast_smoother *s);
+#define ast_smoother_feed(s,f) __ast_smoother_feed(s, f, 0)
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define ast_smoother_feed_be(s,f) __ast_smoother_feed(s, f, 1)
+#define ast_smoother_feed_le(s,f) __ast_smoother_feed(s, f, 0)
+#else
+#define ast_smoother_feed_be(s,f) __ast_smoother_feed(s, f, 0)
+#define ast_smoother_feed_le(s,f) __ast_smoother_feed(s, f, 1)
+#endif
extern void ast_frame_dump(char *name, struct ast_frame *f, char *prefix);
+/* Initialize a codec preference to "no preference" */
+extern void ast_codec_pref_init(struct ast_codec_pref *pref);
+
+/* Codec located at a particular place in the preference index */
+extern int ast_codec_pref_index(struct ast_codec_pref *pref, int index);
+
+/* Remove a codec from a preference list */
+extern void ast_codec_pref_remove(struct ast_codec_pref *pref, int format);
+
+/* Append a codec to a preference list, removing it first if it was already there */
+extern int ast_codec_pref_append(struct ast_codec_pref *pref, int format);
+
+/* Select the best format according to preference list from supplied options.
+ If "find_best" is non-zero then if nothing is found, the "Best" format of
+ the format list is selected, otherwise 0 is returned. */
+extern int ast_codec_choose(struct ast_codec_pref *pref, int formats, int find_best);
+
+/* Parse an "allow" or "deny" line and update the mask and pref if provided */
+extern void ast_parse_allow_disallow(struct ast_codec_pref *pref, int *mask, char *list, int allowing);
+
+/* Dump codec preference list into a string */
+extern int ast_codec_pref_string(struct ast_codec_pref *pref, char *buf, size_t size);
+
+/* Shift a codec preference list up or down 65 bytes so that it becomes an ASCII string */
+extern void ast_codec_pref_shift(struct ast_codec_pref *pref, char *buf, size_t size, int right);
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h
index 059bc89c6..350ea8822 100755
--- a/include/asterisk/lock.h
+++ b/include/asterisk/lock.h
@@ -188,17 +188,19 @@ static inline int __ast_pthread_mutex_lock(char *filename, int lineno, char *fun
filename, lineno, func, mutex_name);
#endif
ast_mutex_init(t);
- }
+ }
#endif /* definded(AST_MUTEX_INIT_W_CONSTRUCTORS) || defined(AST_MUTEX_INIT_ON_FIRST_USE) */
#ifdef DETECT_DEADLOCKS
{
- time_t seconds seconds = time(NULL);
+ time_t seconds = time(NULL);
+ time_t current;
do {
res = pthread_mutex_trylock(&t->mutex);
if (res == EBUSY) {
- if ((time(NULL) - seconds) % 5) {
+ current = time(NULL);
+ if ((current - seconds) && (!((current - seconds) % 5))) {
fprintf(stderr, "%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
- filename, lineno, func, (time(NULL) - seconds), mutex_name);
+ filename, lineno, func, (int)(current - seconds), mutex_name);
fprintf(stderr, "%s line %d (%s): '%s' was locked here.\n",
t->file, t->lineno, t->func, mutex_name);
}
diff --git a/include/asterisk/sched.h b/include/asterisk/sched.h
index fc8c797b1..f8f178799 100755
--- a/include/asterisk/sched.h
+++ b/include/asterisk/sched.h
@@ -62,7 +62,7 @@ typedef int (*ast_sched_cb)(void *data);
* Schedule an event to take place at some point in the future. callback
* will be called with data as the argument, when milliseconds into the
* future (approximately)
- * Returns 0 on success, -1 on failure
+ * Returns a schedule item ID on success, -1 on failure
*/
extern int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, void *data);
@@ -102,6 +102,14 @@ extern int ast_sched_runq(struct sched_context *con);
*/
extern void ast_sched_dump(struct sched_context *con);
+/*!Returns the number of seconds before an event takes place */
+/*!
+ * \param con Context to use
+ * \param id Id to dump
+ */
+extern long ast_sched_when(struct sched_context *con,int id);
+
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index bfbdd951c..8be32fe20 100755
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -48,8 +48,8 @@ extern int ast_utils_init(void);
#define PTHREAD_ATTR_STACKSIZE 2097152
#endif /* PTHREAD_ATTR_STACKSIZE */
extern int ast_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *data);
+extern char *ast_strcasestr(const char *, const char *);
#endif /* LINUX */
-extern char *ast_strcasestr(const char *, const char *);
#endif
diff --git a/include/asterisk/vmodem.h b/include/asterisk/vmodem.h
index 69886154b..cf809870c 100755
--- a/include/asterisk/vmodem.h
+++ b/include/asterisk/vmodem.h
@@ -111,9 +111,9 @@ struct ast_modem_pvt {
char context[AST_MAX_EXTENSION];
/*! Multiple Subscriber Number */
char msn[AST_MAX_EXTENSION];
- /*! Multiple Subscriber Number we listen to (; seperated list) */
+ /*! Multiple Subscriber Number we listen to (; separated list) */
char incomingmsn[AST_MAX_EXTENSION];
- /*! Multiple Subscriber Number we accept for outgoing calls (; seperated list) */
+ /*! Multiple Subscriber Number we accept for outgoing calls (; separated list) */
char outgoingmsn[AST_MAX_EXTENSION];
/*! Group(s) we belong to if available */
unsigned int group;