diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-02-22 12:06:39 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-02-22 12:06:39 +0000 |
commit | 46d2a28800d1feec83ea52f543efb28bc653c2b3 (patch) | |
tree | 01a08c4e2a15cf7bab38a4a5234c89904e132a25 /pjmedia/include | |
parent | 58d9265e4c1b50b0e2e75467fac93f4df0170883 (diff) |
RFC 2833 support!
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@215 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/include')
-rw-r--r-- | pjmedia/include/pjmedia/errno.h | 15 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/session.h | 47 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/stream.h | 43 |
3 files changed, 96 insertions, 9 deletions
diff --git a/pjmedia/include/pjmedia/errno.h b/pjmedia/include/pjmedia/errno.h index 4fa26afd..accf3fd1 100644 --- a/pjmedia/include/pjmedia/errno.h +++ b/pjmedia/include/pjmedia/errno.h @@ -293,6 +293,16 @@ PJ_BEGIN_DECL * Invalid media type. */ #define PJMEDIA_EINVALIMEDIATYPE (PJMEDIA_ERRNO_START+104) /* 220104 */ +/** + * @hideinitializer + * Remote does not support DTMF. + */ +#define PJMEDIA_EREMOTENODTMF (PJMEDIA_ERRNO_START+105) /* 220105 */ +/** + * @hideinitializer + * Invalid DTMF digit. + */ +#define PJMEDIA_RTP_EINDTMF (PJMEDIA_ERRNO_START+106) /* 220106 */ @@ -354,11 +364,6 @@ PJ_BEGIN_DECL * RTP is not configured. */ #define PJMEDIA_RTP_ENOCONFIG (PJMEDIA_ERRNO_START+134) /* 220134 */ -/** - * @hideinitializer - * Invalid DTMF digit. - */ -#define PJMEDIA_RTP_EINDTMF (PJMEDIA_ERRNO_START+135) /* 220135 */ /************************************************************ diff --git a/pjmedia/include/pjmedia/session.h b/pjmedia/include/pjmedia/session.h index 78d699ff..1335bd5f 100644 --- a/pjmedia/include/pjmedia/session.h +++ b/pjmedia/include/pjmedia/session.h @@ -80,6 +80,7 @@ struct pjmedia_session_info * created in the session. * @param local_sdp The SDP describing local capability. * @param rem_sdp The SDP describing remote capability. + * @param user_data Arbitrary user data to be kept in the session. * @param p_session Pointer to receive the media session. * * @return PJ_SUCCESS if media session can be created @@ -91,6 +92,7 @@ pjmedia_session_create( pjmedia_endpt *endpt, const pjmedia_sock_info skinfo[], const pjmedia_sdp_session *local_sdp, const pjmedia_sdp_session *rem_sdp, + void *user_data, pjmedia_session **p_session ); @@ -197,6 +199,51 @@ PJ_DECL(pj_status_t) pjmedia_session_get_stream_stat(pjmedia_session *session, pjmedia_stream_stat *sta); /** + * Dial DTMF digit to the stream, using RFC 2833 mechanism. + * + * @param session The media session. + * @param index The stream index. + * @param ascii_digits String of ASCII digits (i.e. 0-9*#A-B). + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_session_dial_dtmf( pjmedia_session *session, + unsigned index, + const pj_str_t *ascii_digits ); + + +/** + * Check if the specified stream has received DTMF digits. + * + * @param session The media session. + * @param index The stream index. + * + * @return Non-zero (PJ_TRUE) if the stream has DTMF digits. + */ +PJ_DECL(pj_status_t) pjmedia_session_check_dtmf( pjmedia_session *session, + unsigned index); + + +/** + * Retrieve DTMF digits from the specified stream. + * + * @param session The media session. + * @param index The stream index. + * @param ascii_digits Buffer to receive the digits. The length of this + * buffer is indicated in the "size" argument. + * @param size On input, contains the maximum digits to be copied + * to the buffer. + * On output, it contains the actual digits that has + * been copied to the buffer. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_session_get_dtmf( pjmedia_session *session, + unsigned index, + char *ascii_digits, + unsigned *size ); + +/** * Destroy media session. * * @param session The media session. diff --git a/pjmedia/include/pjmedia/stream.h b/pjmedia/include/pjmedia/stream.h index 6a685e06..67975566 100644 --- a/pjmedia/include/pjmedia/stream.h +++ b/pjmedia/include/pjmedia/stream.h @@ -71,8 +71,8 @@ struct pjmedia_stream_info pjmedia_sock_info sock_info; /**< Media transport (RTP/RTCP sockets) */ pj_sockaddr_in rem_addr; /**< Remote RTP address */ pjmedia_codec_info fmt; /**< Codec format info. */ - unsigned tx_event_pt;/**< Outgoing pt for telephone-events. */ - unsigned rx_event_pt;/**< Incoming pt for telephone-events. */ + int tx_event_pt;/**< Outgoing pt for telephone-events. */ + int rx_event_pt;/**< Incoming pt for telephone-events. */ pj_uint32_t ssrc; /**< RTP SSRC. */ int jb_min; /**< Jitter buffer min delay. */ int jb_max; /**< Jitter buffer max delay. */ @@ -110,6 +110,7 @@ struct pjmedia_stream_stat * number of memory may be needed because jitter * buffer needs to preallocate some storage. * @param info Stream information. + * @param user_data Arbitrary user data (for future callback feature). * @param p_stream Pointer to receive the media stream. * * @return PJ_SUCCESS on success. @@ -117,6 +118,7 @@ struct pjmedia_stream_stat PJ_DECL(pj_status_t) pjmedia_stream_create(pjmedia_endpt *endpt, pj_pool_t *pool, const pjmedia_stream_info *info, + void *user_data, pjmedia_stream **p_stream); /** @@ -191,14 +193,47 @@ PJ_DECL(pj_status_t) pjmedia_stream_resume(pjmedia_stream *stream, * only valid for audio stream. * * @param stream The media stream. - * @param digit A single digit ('0123456789*#ABCD'). + * @param ascii_digit String containing digits to be sent to remote. + * Currently the maximum number of digits are 32. * * @return PJ_SUCCESS on success. */ PJ_DECL(pj_status_t) pjmedia_stream_dial_dtmf(pjmedia_stream *stream, - const pj_str_t *digit_char); + const pj_str_t *ascii_digit); +/** + * Check if the stream has incoming DTMF digits in the incoming DTMF + * queue. Incoming DTMF digits received via RFC 2833 mechanism are + * saved in the incoming digits queue. + * + * @param stream The media stream. + * + * @return Non-zero (PJ_TRUE) if the stream has received DTMF + * digits in the . + */ +PJ_DECL(pj_bool_t) pjmedia_stream_check_dtmf(pjmedia_stream *stream); + + +/** + * Retrieve the incoming DTMF digits from the stream. Note that the digits + * buffer will not be NULL terminated. + * + * @param stream The media stream. + * @param ascii_digits Buffer to receive the digits. The length of this + * buffer is indicated in the "size" argument. + * @param size On input, contains the maximum digits to be copied + * to the buffer. + * On output, it contains the actual digits that has + * been copied to the buffer. + * + * @return Non-zero (PJ_TRUE) if the stream has received DTMF + * digits in the . + */ +PJ_DECL(pj_status_t) pjmedia_stream_get_dtmf( pjmedia_stream *stream, + char *ascii_digits, + unsigned *size); + /** * @} |