2006-04-03 21:00:13 +00:00
|
|
|
/*
|
|
|
|
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
|
|
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
*
|
|
|
|
* Version: MPL 1.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
* Portions created by the Initial Developer are Copyright (C)
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* switch_channel.h -- Media Channel Interface
|
2007-04-07 03:07:43 +00:00
|
|
|
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
|
2006-04-03 21:00:13 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file switch_rtp.h
|
|
|
|
* @brief RTP
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SWITCH_RTP_H
|
|
|
|
#define SWITCH_RTP_H
|
|
|
|
|
2006-09-07 14:23:31 +00:00
|
|
|
SWITCH_BEGIN_EXTERN_C
|
2006-04-06 19:50:53 +00:00
|
|
|
#define SWITCH_RTP_MAX_BUF_LEN 16384
|
2008-01-16 06:01:53 +00:00
|
|
|
#define SWITCH_RTP_MAX_CRYPTO_LEN 64
|
|
|
|
#define SWITCH_RTP_KEY_LEN 30
|
|
|
|
#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
|
|
|
|
#define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"
|
2008-05-27 04:30:03 +00:00
|
|
|
typedef enum {
|
2008-01-16 06:01:53 +00:00
|
|
|
SWITCH_RTP_CRYPTO_SEND,
|
|
|
|
SWITCH_RTP_CRYPTO_RECV,
|
|
|
|
SWITCH_RTP_CRYPTO_MAX
|
|
|
|
} switch_rtp_crypto_direction_t;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
NO_CRYPTO,
|
2008-07-07 17:56:16 +00:00
|
|
|
AES_CM_128_HMAC_SHA1_80,
|
|
|
|
AES_CM_128_HMAC_SHA1_32,
|
|
|
|
AES_CM_128_NULL_AUTH
|
2008-01-16 06:01:53 +00:00
|
|
|
} switch_rtp_crypto_key_type_t;
|
|
|
|
|
|
|
|
struct switch_rtp_crypto_key {
|
|
|
|
uint32_t index;
|
|
|
|
switch_rtp_crypto_key_type_t type;
|
|
|
|
unsigned char key[SWITCH_RTP_MAX_CRYPTO_LEN];
|
|
|
|
switch_size_t keylen;
|
|
|
|
struct switch_rtp_crypto_key *next;
|
|
|
|
};
|
|
|
|
typedef struct switch_rtp_crypto_key switch_rtp_crypto_key_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_session,
|
|
|
|
switch_rtp_crypto_direction_t direction,
|
2008-05-27 04:30:03 +00:00
|
|
|
uint32_t index, switch_rtp_crypto_key_type_t type, unsigned char *key, switch_size_t keylen);
|
2008-01-16 06:01:53 +00:00
|
|
|
|
2006-04-06 03:15:41 +00:00
|
|
|
///\defgroup rtp RTP (RealTime Transport Protocol)
|
2006-04-06 02:47:11 +00:00
|
|
|
///\ingroup core1
|
|
|
|
///\{
|
2008-05-27 04:30:03 +00:00
|
|
|
typedef void (*switch_rtp_invalid_handler_t) (switch_rtp_t *rtp_session,
|
|
|
|
switch_socket_t *sock, void *data, switch_size_t datalen, switch_sockaddr_t *from_addr);
|
2006-04-04 02:28:11 +00:00
|
|
|
|
2008-01-16 06:01:53 +00:00
|
|
|
|
|
|
|
SWITCH_DECLARE(void) switch_rtp_get_random(void *buf, uint32_t len);
|
2006-04-06 02:47:11 +00:00
|
|
|
/*!
|
|
|
|
\brief Initilize the RTP System
|
|
|
|
\param pool the memory pool to use for long term allocations
|
|
|
|
\note Generally called by the core_init
|
|
|
|
*/
|
2007-03-30 00:15:25 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool);
|
2007-12-11 19:15:02 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_shutdown(void);
|
2006-04-06 02:47:11 +00:00
|
|
|
|
2007-04-07 03:07:43 +00:00
|
|
|
/*!
|
|
|
|
\brief Set/Get RTP start port
|
|
|
|
\param port new value (if > 0)
|
|
|
|
\return the current RTP start port
|
|
|
|
*/
|
|
|
|
SWITCH_DECLARE(switch_port_t) switch_rtp_set_start_port(switch_port_t port);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Set/Get RTP end port
|
|
|
|
\param port new value (if > 0)
|
|
|
|
\return the current RTP end port
|
|
|
|
*/
|
|
|
|
SWITCH_DECLARE(switch_port_t) switch_rtp_set_end_port(switch_port_t port);
|
|
|
|
|
2006-04-06 02:47:11 +00:00
|
|
|
/*!
|
|
|
|
\brief Request a new port to be used for media
|
2007-12-11 19:15:02 +00:00
|
|
|
\param ip the ip to request a port from
|
2006-04-06 02:47:11 +00:00
|
|
|
\return the new port to use
|
|
|
|
*/
|
2007-12-11 19:15:02 +00:00
|
|
|
SWITCH_DECLARE(switch_port_t) switch_rtp_request_port(const char *ip);
|
2007-12-20 15:41:45 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_release_port(const char *ip, switch_port_t port);
|
2008-11-10 18:26:41 +00:00
|
|
|
|
2008-11-18 23:26:25 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_change_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval);
|
2006-04-06 02:47:11 +00:00
|
|
|
/*!
|
2006-04-06 20:56:29 +00:00
|
|
|
\brief create a new RTP session handle
|
|
|
|
\param new_rtp_session a poiter to aim at the new session
|
|
|
|
\param payload the IANA payload number
|
2007-03-09 16:30:34 +00:00
|
|
|
\param samples_per_interval the default samples_per_interval
|
2006-04-07 17:32:14 +00:00
|
|
|
\param ms_per_packet time in microseconds per packet
|
2006-04-06 20:56:29 +00:00
|
|
|
\param flags flags to control behaviour
|
2006-10-18 22:57:35 +00:00
|
|
|
\param timer_name timer interface to use
|
2006-04-06 20:56:29 +00:00
|
|
|
\param err a pointer to resolve error messages
|
|
|
|
\param pool a memory pool to use for the session
|
|
|
|
\return the new RTP session or NULL on failure
|
|
|
|
*/
|
2007-03-29 22:31:56 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session,
|
|
|
|
switch_payload_t payload,
|
|
|
|
uint32_t samples_per_interval,
|
|
|
|
uint32_t ms_per_packet,
|
2008-05-27 04:30:03 +00:00
|
|
|
switch_rtp_flag_t flags, char *timer_name, const char **err, switch_memory_pool_t *pool);
|
2006-04-06 20:56:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief prepare a new RTP session handle and fully initilize it
|
|
|
|
\param rx_host the local address
|
2006-04-06 02:47:11 +00:00
|
|
|
\param rx_port the local port
|
2006-04-06 20:56:29 +00:00
|
|
|
\param tx_host the remote address
|
2006-04-06 02:47:11 +00:00
|
|
|
\param tx_port the remote port
|
2006-04-06 03:28:23 +00:00
|
|
|
\param payload the IANA payload number
|
2007-03-09 16:30:34 +00:00
|
|
|
\param samples_per_interval the default samples_per_interval
|
2006-04-07 17:32:14 +00:00
|
|
|
\param ms_per_packet time in microseconds per packet
|
2006-04-06 02:47:11 +00:00
|
|
|
\param flags flags to control behaviour
|
2006-10-18 22:57:35 +00:00
|
|
|
\param timer_name timer interface to use
|
2006-04-06 02:47:11 +00:00
|
|
|
\param err a pointer to resolve error messages
|
|
|
|
\param pool a memory pool to use for the session
|
|
|
|
\return the new RTP session or NULL on failure
|
|
|
|
*/
|
2007-05-12 14:48:14 +00:00
|
|
|
SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
|
2007-03-29 22:31:56 +00:00
|
|
|
switch_port_t rx_port,
|
2007-05-12 14:48:14 +00:00
|
|
|
const char *tx_host,
|
2007-03-29 22:31:56 +00:00
|
|
|
switch_port_t tx_port,
|
|
|
|
switch_payload_t payload,
|
|
|
|
uint32_t samples_per_interval,
|
|
|
|
uint32_t ms_per_packet,
|
2008-05-27 04:30:03 +00:00
|
|
|
switch_rtp_flag_t flags, char *timer_name, const char **err, switch_memory_pool_t *pool);
|
2006-04-06 20:56:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Assign a remote address to the RTP session
|
|
|
|
\param rtp_session an RTP session to assign the remote address to
|
|
|
|
\param host the ip or fqhn of the remote address
|
|
|
|
\param port the remote port
|
|
|
|
\param err pointer for error messages
|
|
|
|
*/
|
2008-09-29 23:03:27 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port,
|
|
|
|
switch_bool_t change_adv_addr, const char **err);
|
2006-04-06 20:56:29 +00:00
|
|
|
|
2008-09-18 21:50:18 +00:00
|
|
|
SWITCH_DECLARE(char *) switch_rtp_get_remote_host(switch_rtp_t *rtp_session);
|
|
|
|
SWITCH_DECLARE(switch_port_t) switch_rtp_get_remote_port(switch_rtp_t *rtp_session);
|
|
|
|
|
2007-10-31 02:12:30 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session, uint32_t max);
|
|
|
|
|
2006-04-06 20:56:29 +00:00
|
|
|
/*!
|
|
|
|
\brief Assign a local address to the RTP session
|
|
|
|
\param rtp_session an RTP session to assign the local address to
|
|
|
|
\param host the ip or fqhn of the local address
|
|
|
|
\param port the local port
|
2008-09-29 23:03:27 +00:00
|
|
|
\param change_adv_addr change the advertised address for doing compare
|
2006-04-06 20:56:29 +00:00
|
|
|
\param err pointer for error messages
|
|
|
|
\note this call also binds the RTP session's socket to the new address
|
|
|
|
*/
|
2008-09-29 23:03:27 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_session, const char *host,
|
|
|
|
switch_port_t port, const char **err);
|
2006-04-06 20:56:29 +00:00
|
|
|
|
2006-04-06 02:47:11 +00:00
|
|
|
/*!
|
|
|
|
\brief Kill the socket on an existing RTP session
|
|
|
|
\param rtp_session an RTP session to kill the socket of
|
|
|
|
*/
|
2006-04-29 01:00:52 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session);
|
2006-04-03 21:00:13 +00:00
|
|
|
|
2008-03-07 18:21:08 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_break(switch_rtp_t *rtp_session);
|
|
|
|
|
2006-08-28 23:05:26 +00:00
|
|
|
/*!
|
|
|
|
\brief Test if an RTP session is ready
|
|
|
|
\param rtp_session an RTP session to test
|
|
|
|
\return a true value if it's ready
|
|
|
|
*/
|
|
|
|
SWITCH_DECLARE(uint8_t) switch_rtp_ready(switch_rtp_t *rtp_session);
|
|
|
|
|
2006-04-06 02:47:11 +00:00
|
|
|
/*!
|
|
|
|
\brief Destroy an RTP session
|
|
|
|
\param rtp_session an RTP session to destroy
|
|
|
|
*/
|
2006-04-29 01:00:52 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session);
|
2006-04-06 02:47:11 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Acvite ICE on an RTP session
|
|
|
|
\return SWITCH_STATUS_SUCCESS
|
|
|
|
*/
|
2006-04-29 23:43:28 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin);
|
2006-04-06 02:47:11 +00:00
|
|
|
|
2007-05-04 23:29:35 +00:00
|
|
|
/*!
|
|
|
|
\brief Acvite a jitter buffer on an RTP session
|
|
|
|
\param rtp_session the rtp session
|
|
|
|
\param queue_frames the number of frames to delay
|
|
|
|
\return SWITCH_STATUS_SUCCESS
|
|
|
|
*/
|
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, uint32_t queue_frames);
|
|
|
|
|
2006-04-17 18:25:43 +00:00
|
|
|
/*!
|
|
|
|
\brief Set an RTP Flag
|
|
|
|
\param rtp_session the RTP session
|
|
|
|
\param flags the flags to set
|
|
|
|
*/
|
2006-04-29 01:00:52 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_set_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags);
|
2006-04-17 18:25:43 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Test an RTP Flag
|
|
|
|
\param rtp_session the RTP session
|
|
|
|
\param flags the flags to test
|
|
|
|
\return TRUE or FALSE
|
|
|
|
*/
|
2008-05-13 20:36:23 +00:00
|
|
|
SWITCH_DECLARE(uint32_t) switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags);
|
2006-04-17 18:25:43 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Clear an RTP Flag
|
|
|
|
\param rtp_session the RTP session
|
|
|
|
\param flags the flags to clear
|
|
|
|
*/
|
2006-04-29 01:00:52 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_clear_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags);
|
2006-04-17 18:25:43 +00:00
|
|
|
|
2006-04-06 02:47:11 +00:00
|
|
|
/*!
|
|
|
|
\brief Retrieve the socket from an existing RTP session
|
|
|
|
\param rtp_session the RTP session to retrieve the socket from
|
|
|
|
\return the socket from the RTP session
|
|
|
|
*/
|
2007-03-29 22:31:56 +00:00
|
|
|
SWITCH_DECLARE(switch_socket_t *) switch_rtp_get_rtp_socket(switch_rtp_t *rtp_session);
|
2006-04-06 02:47:11 +00:00
|
|
|
|
2006-04-07 17:32:14 +00:00
|
|
|
/*!
|
2007-03-09 16:30:34 +00:00
|
|
|
\brief Set the default samples per interval for a given RTP session
|
|
|
|
\param rtp_session the RTP session to set the samples per interval on
|
|
|
|
\param samples_per_interval the new default samples per interval
|
2006-04-07 17:32:14 +00:00
|
|
|
*/
|
2008-11-13 20:47:45 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_set_default_samples_per_interval(switch_rtp_t *rtp_session, uint32_t samples_per_interval);
|
2006-04-07 17:32:14 +00:00
|
|
|
|
|
|
|
/*!
|
2007-03-09 16:30:34 +00:00
|
|
|
\brief Get the default samples per interval for a given RTP session
|
|
|
|
\param rtp_session the RTP session to get the samples per interval from
|
|
|
|
\return the default samples per interval of the RTP session
|
2006-04-07 17:32:14 +00:00
|
|
|
*/
|
2007-03-09 16:30:34 +00:00
|
|
|
SWITCH_DECLARE(uint32_t) switch_rtp_get_default_samples_per_interval(switch_rtp_t *rtp_session);
|
2006-04-07 17:32:14 +00:00
|
|
|
|
2006-04-06 21:08:30 +00:00
|
|
|
/*!
|
|
|
|
\brief Set the default payload number for a given RTP session
|
|
|
|
\param rtp_session the RTP session to set the payload number on
|
|
|
|
\param payload the new default payload number
|
|
|
|
*/
|
2006-04-29 01:00:52 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp_t *rtp_session, switch_payload_t payload);
|
2006-04-06 21:08:30 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Get the default payload number for a given RTP session
|
|
|
|
\param rtp_session the RTP session to get the payload number from
|
|
|
|
\return the default payload of the RTP session
|
|
|
|
*/
|
2006-04-29 01:00:52 +00:00
|
|
|
SWITCH_DECLARE(uint32_t) switch_rtp_get_default_payload(switch_rtp_t *rtp_session);
|
2006-04-06 21:08:30 +00:00
|
|
|
|
|
|
|
|
2006-04-06 02:47:11 +00:00
|
|
|
/*!
|
|
|
|
\brief Set a callback function to execute when an invalid RTP packet is encountered
|
|
|
|
\param rtp_session the RTP session
|
|
|
|
\param on_invalid the function to set
|
|
|
|
\return
|
|
|
|
*/
|
2006-04-29 23:43:28 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_set_invald_handler(switch_rtp_t *rtp_session, switch_rtp_invalid_handler_t on_invalid);
|
2006-04-06 02:47:11 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Read data from a given RTP session
|
|
|
|
\param rtp_session the RTP session to read from
|
|
|
|
\param data the data to read
|
2006-04-10 18:28:46 +00:00
|
|
|
\param datalen a pointer to the datalen
|
2006-04-06 03:28:23 +00:00
|
|
|
\param payload_type the IANA payload of the packet
|
2006-04-06 19:50:53 +00:00
|
|
|
\param flags flags
|
2008-05-26 09:55:20 +00:00
|
|
|
\param io_flags i/o flags
|
2006-04-06 02:47:11 +00:00
|
|
|
\return the number of bytes read
|
|
|
|
*/
|
2008-05-27 04:30:03 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t *datalen,
|
2008-05-08 19:19:47 +00:00
|
|
|
switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags);
|
2006-04-06 02:47:11 +00:00
|
|
|
|
2006-05-04 17:51:53 +00:00
|
|
|
/*!
|
|
|
|
\brief Queue RFC2833 DTMF data into an RTP Session
|
|
|
|
\param rtp_session the rtp session to use
|
2008-05-26 09:55:20 +00:00
|
|
|
\param dtmf the dtmf digits to queue
|
|
|
|
\return SWITCH_STATUS_SUCCESS on success
|
2006-05-04 17:51:53 +00:00
|
|
|
*/
|
2007-12-22 00:32:20 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf);
|
2008-05-26 09:55:20 +00:00
|
|
|
|
|
|
|
/*!
|
2008-05-26 17:26:29 +00:00
|
|
|
\brief Queue RFC2833 DTMF data into an RTP Session
|
2008-05-26 09:55:20 +00:00
|
|
|
\param rtp_session the rtp session to use
|
|
|
|
\param dtmf the dtmf digits to queue
|
|
|
|
\return SWITCH_STATUS_SUCCESS on success
|
|
|
|
*/
|
2007-12-22 00:32:20 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833_in(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf);
|
2006-05-04 17:51:53 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Test for presence of DTMF on a given RTP session
|
|
|
|
\param rtp_session session to test
|
|
|
|
\return number of digits in the queue
|
|
|
|
*/
|
|
|
|
SWITCH_DECLARE(switch_size_t) switch_rtp_has_dtmf(switch_rtp_t *rtp_session);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Retrieve DTMF digits from a given RTP session
|
|
|
|
\param rtp_session RTP session to retrieve digits from
|
2007-12-22 00:32:20 +00:00
|
|
|
\param dtmf the dtmf
|
2006-05-04 17:51:53 +00:00
|
|
|
\return number of bytes read into the buffer
|
|
|
|
*/
|
2007-12-22 00:32:20 +00:00
|
|
|
SWITCH_DECLARE(switch_size_t) switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session, switch_dtmf_t *dtmf);
|
2006-05-04 17:51:53 +00:00
|
|
|
|
2006-04-06 02:47:11 +00:00
|
|
|
/*!
|
|
|
|
\brief Read data from a given RTP session without copying
|
|
|
|
\param rtp_session the RTP session to read from
|
|
|
|
\param data a pointer to point directly to the RTP read buffer
|
2006-04-10 18:28:46 +00:00
|
|
|
\param datalen a pointer to the datalen
|
2006-04-06 03:28:23 +00:00
|
|
|
\param payload_type the IANA payload of the packet
|
2006-04-06 20:59:25 +00:00
|
|
|
\param flags flags
|
2008-05-26 09:55:20 +00:00
|
|
|
\param io_flags i/o flags
|
2006-04-06 02:47:11 +00:00
|
|
|
\return the number of bytes read
|
|
|
|
*/
|
2006-05-04 17:51:53 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_session,
|
2008-05-27 04:30:03 +00:00
|
|
|
void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags,
|
|
|
|
switch_io_flag_t io_flags);
|
2006-04-06 02:47:11 +00:00
|
|
|
|
2006-04-18 00:24:52 +00:00
|
|
|
/*!
|
|
|
|
\brief Read data from a given RTP session without copying
|
|
|
|
\param rtp_session the RTP session to read from
|
|
|
|
\param frame a frame to populate with information
|
2008-05-26 09:55:20 +00:00
|
|
|
\param io_flags i/o flags
|
2006-04-18 00:24:52 +00:00
|
|
|
\return the number of bytes read
|
|
|
|
*/
|
2008-05-26 09:55:20 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp_session, switch_frame_t *frame, switch_io_flag_t io_flags);
|
2006-04-18 00:24:52 +00:00
|
|
|
|
2008-11-25 17:53:35 +00:00
|
|
|
SWITCH_DECLARE(void) rtp_flush_read_buffer(switch_rtp_t *rtp_session);
|
|
|
|
|
2006-04-21 22:31:08 +00:00
|
|
|
/*!
|
|
|
|
\brief Enable VAD on an RTP Session
|
|
|
|
\param rtp_session the RTP session
|
|
|
|
\param session the core session associated with the RTP session
|
|
|
|
\param codec the codec the channel is currenty using
|
|
|
|
\param flags flags for control
|
|
|
|
\return SWITCH_STAUTS_SUCCESS on success
|
|
|
|
*/
|
2007-03-29 22:31:56 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_enable_vad(switch_rtp_t *rtp_session, switch_core_session_t *session,
|
|
|
|
switch_codec_t *codec, switch_vad_flag_t flags);
|
2006-04-21 22:31:08 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Disable VAD on an RTP Session
|
|
|
|
\param rtp_session the RTP session
|
|
|
|
\return SWITCH_STAUTS_SUCCESS on success
|
|
|
|
*/
|
2006-04-29 23:43:28 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_disable_vad(switch_rtp_t *rtp_session);
|
2006-04-21 22:31:08 +00:00
|
|
|
|
2006-04-18 16:20:47 +00:00
|
|
|
/*!
|
|
|
|
\brief Write data to a given RTP session
|
|
|
|
\param rtp_session the RTP session to write to
|
|
|
|
\param frame the frame to write
|
|
|
|
\return the number of bytes written
|
|
|
|
*/
|
2008-01-11 04:23:09 +00:00
|
|
|
SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_frame_t *frame);
|
2006-04-18 16:20:47 +00:00
|
|
|
|
2006-04-06 02:47:11 +00:00
|
|
|
/*!
|
|
|
|
\brief Write data with a specified payload and sequence number to a given RTP session
|
|
|
|
\param rtp_session the RTP session to write to
|
|
|
|
\param data data to write
|
|
|
|
\param datalen the size of the data
|
2006-04-24 16:19:11 +00:00
|
|
|
\param m set mark bit or not
|
2006-04-06 03:28:23 +00:00
|
|
|
\param payload the IANA payload number
|
2006-04-06 02:47:11 +00:00
|
|
|
\param ts then number of bytes to increment the timestamp by
|
2006-04-18 00:24:52 +00:00
|
|
|
\param flags frame flags
|
2006-04-06 02:47:11 +00:00
|
|
|
\return the number of bytes written
|
|
|
|
*/
|
2007-02-13 17:14:39 +00:00
|
|
|
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
|
2008-05-27 04:30:03 +00:00
|
|
|
void *data, uint32_t datalen, uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags);
|
2006-04-06 02:47:11 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Retrieve the SSRC from a given RTP session
|
|
|
|
\param rtp_session the RTP session to retrieve from
|
|
|
|
\return the SSRC
|
|
|
|
*/
|
2006-04-29 01:00:52 +00:00
|
|
|
SWITCH_DECLARE(uint32_t) switch_rtp_get_ssrc(switch_rtp_t *rtp_session);
|
2006-04-06 02:47:11 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Associate an arbitrary data pointer with and RTP session
|
|
|
|
\param rtp_session the RTP session to assign the pointer to
|
|
|
|
\param private_data the private data to assign
|
|
|
|
*/
|
2006-04-29 01:00:52 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_set_private(switch_rtp_t *rtp_session, void *private_data);
|
2006-04-06 02:47:11 +00:00
|
|
|
|
2006-05-27 00:24:32 +00:00
|
|
|
/*!
|
|
|
|
\brief Set the payload type to consider RFC2833 DTMF
|
|
|
|
\param rtp_session the RTP session to modify
|
|
|
|
\param te the payload type
|
|
|
|
*/
|
|
|
|
SWITCH_DECLARE(void) switch_rtp_set_telephony_event(switch_rtp_t *rtp_session, switch_payload_t te);
|
|
|
|
|
2007-03-07 18:34:22 +00:00
|
|
|
/*!
|
|
|
|
\brief Set the payload type for comfort noise
|
|
|
|
\param rtp_session the RTP session to modify
|
|
|
|
\param pt the payload type
|
|
|
|
*/
|
|
|
|
SWITCH_DECLARE(void) switch_rtp_set_cng_pt(switch_rtp_t *rtp_session, switch_payload_t pt);
|
|
|
|
|
2006-04-06 02:47:11 +00:00
|
|
|
/*!
|
|
|
|
\brief Retrieve the private data from a given RTP session
|
|
|
|
\param rtp_session the RTP session to retrieve the data from
|
|
|
|
\return the pointer to the private data
|
|
|
|
*/
|
2007-03-29 22:31:56 +00:00
|
|
|
SWITCH_DECLARE(void *) switch_rtp_get_private(switch_rtp_t *rtp_session);
|
2006-04-03 21:00:13 +00:00
|
|
|
|
2008-07-18 20:25:39 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_stun_ping(switch_rtp_t *rtp_session, const char *stun_ip, switch_port_t stun_port,
|
|
|
|
uint32_t packet_count, switch_bool_t funny);
|
2008-07-18 16:18:31 +00:00
|
|
|
|
2008-12-29 21:23:17 +00:00
|
|
|
SWITCH_DECLARE(void) switch_rtp_intentional_bugs(switch_rtp_t *rtp_session, switch_rtp_bug_flag_t bugs);
|
|
|
|
|
2006-04-06 02:47:11 +00:00
|
|
|
/*!
|
|
|
|
\}
|
|
|
|
*/
|
|
|
|
|
2006-09-07 15:15:39 +00:00
|
|
|
SWITCH_END_EXTERN_C
|
2006-04-03 21:00:13 +00:00
|
|
|
#endif
|
2006-11-27 22:30:48 +00:00
|
|
|
/* For Emacs:
|
|
|
|
* Local Variables:
|
|
|
|
* mode:c
|
2008-02-03 22:14:57 +00:00
|
|
|
* indent-tabs-mode:t
|
2006-11-27 22:30:48 +00:00
|
|
|
* tab-width:4
|
|
|
|
* c-basic-offset:4
|
|
|
|
* End:
|
|
|
|
* For VIM:
|
2008-07-03 19:12:26 +00:00
|
|
|
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
2006-11-27 22:30:48 +00:00
|
|
|
*/
|