diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-31 01:59:02 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-31 01:59:02 +0000 |
commit | 3f22aa53af0a7bb3efb280a1adda11f00a7f68fc (patch) | |
tree | 95a924d57b906428b26d398758facf98b92bdcb2 /include | |
parent | 0fcb352fba60344329a582f891ddd4433f48c6fa (diff) |
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: http://svn.digium.com/svn/asterisk/trunk@41507 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/channel.h | 40 | ||||
-rw-r--r-- | include/asterisk/frame.h | 66 | ||||
-rw-r--r-- | include/asterisk/rtp.h | 7 |
3 files changed, 67 insertions, 46 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 95cb3196e..d54a1bdd7 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -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 diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h index 0c9c651d2..bc7273a09 100644 --- a/include/asterisk/frame.h +++ b/include/asterisk/frame.h @@ -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 diff --git a/include/asterisk/rtp.h b/include/asterisk/rtp.h index f99d4dec6..6780c2adc 100644 --- a/include/asterisk/rtp.h +++ b/include/asterisk/rtp.h @@ -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); |