Merge in VLDTMF support with Zaptel/Core done by the ever great Darumkilla Russell Bryant and the RTP portion done by myself, Muffinlicious Joshua Colp. This has gone through so many discussions/revisions it's not funny but we finally have it!

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41507 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Joshua Colp
2006-08-31 01:59:02 +00:00
parent 5418a7a1a8
commit c6977b9983
29 changed files with 744 additions and 365 deletions

View File

@@ -200,13 +200,11 @@ struct ast_channel_tech {
int (* const devicestate)(void *data); /*!< Devicestate call back */
int (* const send_digit)(struct ast_channel *chan, char digit); /*!< Send a literal DTMF digit */
/*! \brief Start sending a literal DTMF digit */
int (* const send_digit_begin)(struct ast_channel *chan, char digit);
/*! \brief Stop sending the last literal DTMF digit */
int (* const send_digit_end)(struct ast_channel *chan);
/*! \brief Stop sending a literal DTMF digit */
int (* const send_digit_end)(struct ast_channel *chan, char digit);
/*! \brief Call a given phone number (address, etc), but don't
take longer than timeout seconds to do so. */
@@ -424,8 +422,12 @@ struct ast_channel {
struct ast_channel_spy_list *spies; /*!< Chan Spy stuff */
struct ast_channel_whisper_buffer *whisper; /*!< Whisper Paging buffer */
AST_LIST_ENTRY(ast_channel) chan_list; /*!< For easy linking */
struct ast_jb jb; /*!< The jitterbuffer state */
char emulate_dtmf_digit; /*!< Digit being emulated */
unsigned int emulate_dtmf_samples; /*!< Number of samples left to emulate DTMF for */
/*! \brief Data stores on the channel */
AST_LIST_HEAD_NOLOCK(datastores, ast_datastore) datastores;
};
@@ -443,29 +445,34 @@ enum {
/*! \brief ast_channel flags */
enum {
/*! Queue incoming dtmf, to be released when this flag is turned off */
AST_FLAG_DEFER_DTMF = (1 << 1),
AST_FLAG_DEFER_DTMF = (1 << 1),
/*! write should be interrupt generator */
AST_FLAG_WRITE_INT = (1 << 2),
AST_FLAG_WRITE_INT = (1 << 2),
/*! a thread is blocking on this channel */
AST_FLAG_BLOCKING = (1 << 3),
AST_FLAG_BLOCKING = (1 << 3),
/*! This is a zombie channel */
AST_FLAG_ZOMBIE = (1 << 4),
AST_FLAG_ZOMBIE = (1 << 4),
/*! There is an exception pending */
AST_FLAG_EXCEPTION = (1 << 5),
AST_FLAG_EXCEPTION = (1 << 5),
/*! Listening to moh XXX anthm promises me this will disappear XXX */
AST_FLAG_MOH = (1 << 6),
AST_FLAG_MOH = (1 << 6),
/*! This channel is spying on another channel */
AST_FLAG_SPYING = (1 << 7),
AST_FLAG_SPYING = (1 << 7),
/*! This channel is in a native bridge */
AST_FLAG_NBRIDGE = (1 << 8),
AST_FLAG_NBRIDGE = (1 << 8),
/*! the channel is in an auto-incrementing dialplan processor,
* so when ->priority is set, it will get incremented before
* finding the next priority to run */
AST_FLAG_IN_AUTOLOOP = (1 << 9),
AST_FLAG_IN_AUTOLOOP = (1 << 9),
/*! This is an outgoing call */
AST_FLAG_OUTGOING = (1 << 10),
AST_FLAG_OUTGOING = (1 << 10),
/*! This channel is being whispered on */
AST_FLAG_WHISPER = (1 << 11),
AST_FLAG_WHISPER = (1 << 11),
/*! A DTMF_BEGIN frame has been read from this channel, but not yet an END */
AST_FLAG_IN_DTMF = (1 << 12),
/*! A DTMF_END was received when not IN_DTMF, so the length of the digit is
* currently being emulated */
AST_FLAG_EMULATE_DTMF = (1 << 13),
};
/*! \brief ast_bridge_config flags */
@@ -876,6 +883,9 @@ int ast_recvchar(struct ast_channel *chan, int timeout);
*/
int ast_senddigit(struct ast_channel *chan, char digit);
int ast_senddigit_begin(struct ast_channel *chan, char digit);
int ast_senddigit_end(struct ast_channel *chan, char digit);
/*! \brief Receives a text string from a channel
* Read a string of text from a channel
* \param chan channel to act upon

View File

@@ -85,11 +85,46 @@ struct ast_codec_pref {
*/
/*!
* \brief Frame types
*
* \note It is important that the values of each frame type are never changed,
* because it will break backwards compatability with older versions.
*/
enum ast_frame_type {
/*! DTMF end event, subclass is the digit */
AST_FRAME_DTMF_END = 1,
/*! Voice data, subclass is AST_FORMAT_* */
AST_FRAME_VOICE,
/*! Video frame, maybe?? :) */
AST_FRAME_VIDEO,
/*! A control frame, subclass is AST_CONTROL_* */
AST_FRAME_CONTROL,
/*! An empty, useless frame */
AST_FRAME_NULL,
/*! Inter Asterisk Exchange private frame type */
AST_FRAME_IAX,
/*! Text messages */
AST_FRAME_TEXT,
/*! Image Frames */
AST_FRAME_IMAGE,
/*! HTML Frame */
AST_FRAME_HTML,
/*! Comfort Noise frame (subclass is level of CNG in -dBov),
body may include zero or more 8-bit quantization coefficients */
AST_FRAME_CNG,
/*! Modem-over-IP data streams */
AST_FRAME_MODEM,
/*! DTMF begin event, subclass is the digit */
AST_FRAME_DTMF_BEGIN,
};
#define AST_FRAME_DTMF AST_FRAME_DTMF_END
/*! \brief Data structure associated with a single frame of data
*/
struct ast_frame {
/*! Kind of frame */
int frametype;
enum ast_frame_type frametype;
/*! Subclass, frame dependent */
int subclass;
/*! Length of data */
@@ -151,35 +186,6 @@ extern struct ast_frame ast_null_frame;
/*! Need the source be free'd? (haha!) */
#define AST_MALLOCD_SRC (1 << 2)
/* Frame types */
/*! A DTMF digit, subclass is the digit */
#define AST_FRAME_DTMF 1
/*! Voice data, subclass is AST_FORMAT_* */
#define AST_FRAME_VOICE 2
/*! Video frame, maybe?? :) */
#define AST_FRAME_VIDEO 3
/*! A control frame, subclass is AST_CONTROL_* */
#define AST_FRAME_CONTROL 4
/*! An empty, useless frame */
#define AST_FRAME_NULL 5
/*! Inter Asterisk Exchange private frame type */
#define AST_FRAME_IAX 6
/*! Text messages */
#define AST_FRAME_TEXT 7
/*! Image Frames */
#define AST_FRAME_IMAGE 8
/*! HTML Frame */
#define AST_FRAME_HTML 9
/*! Comfort Noise frame (subclass is level of CNG in -dBov),
body may include zero or more 8-bit quantization coefficients */
#define AST_FRAME_CNG 10
/*! Modem-over-IP data streams */
#define AST_FRAME_MODEM 11
/*! DTMF begin event, subclass is the digit */
#define AST_FRAME_DTMF_BEGIN 12
/*! DTMF end event, subclass is the digit */
#define AST_FRAME_DTMF_END 13
/* MODEM subclasses */
/*! T.38 Fax-over-IP */
#define AST_MODEM_T38 1

View File

@@ -142,7 +142,9 @@ int ast_rtp_fd(struct ast_rtp *rtp);
int ast_rtcp_fd(struct ast_rtp *rtp);
int ast_rtp_senddigit(struct ast_rtp *rtp, char digit);
int ast_rtp_senddigit_begin(struct ast_rtp *rtp, char digit);
int ast_rtp_senddigit_end(struct ast_rtp *rtp, char digit);
int ast_rtp_sendcng(struct ast_rtp *rtp, int level);
@@ -181,6 +183,9 @@ void ast_rtp_setnat(struct ast_rtp *rtp, int nat);
/*! \brief Indicate whether this RTP session is carrying DTMF or not */
void ast_rtp_setdtmf(struct ast_rtp *rtp, int dtmf);
/*! \brief Compensate for devices that send RFC2833 packets all at once */
void ast_rtp_setdtmfcompensate(struct ast_rtp *rtp, int compensate);
int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
int ast_rtp_proto_register(struct ast_rtp_protocol *proto);