RTS API Documentation  1.10.11
switch_rtp.h
Go to the documentation of this file.
1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Anthony Minessale II <anthm@freeswitch.org>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Anthony Minessale II <anthm@freeswitch.org>
27  *
28  *
29  * switch_channel.h -- Media Channel Interface
30  * Marcel Barbulescu <marcelbarbulescu@gmail.com>
31  *
32  */
33 /**
34  * @file switch_rtp.h
35  * @brief RTP
36  *
37  */
38 
39 #ifndef SWITCH_RTP_H
40 #define SWITCH_RTP_H
41 
43 
44 #define SWITCH_RTP_HEADER_LEN sizeof(switch_rtp_hdr_t)
45 #define SWITCH_RTP_MAX_BUF_LEN 16384
46 #define SWITCH_RTCP_MAX_BUF_LEN 16384
47 #define SWITCH_RTP_MAX_BUF_LEN_WORDS 4094 /* (max / 4) - 2 */
48 #define SWITCH_RTP_MAX_PACKET_LEN (SWITCH_RTP_MAX_BUF_LEN + SWITCH_RTP_HEADER_LEN)
49 //#define SWITCH_RTP_KEY_LEN 30
50 //#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
51 #define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"
52 
53 #define SWITCH_RTP_BUNDLE_INTERNAL_PT 21
54 
55 typedef struct {
57  char body[SWITCH_RTP_MAX_BUF_LEN+4+sizeof(char *)];
59  char *ebody;
61 
62 typedef enum {
69 
71  char *name;
72  const char *alias;
75  int salt_len;
77 
79  uint32_t index;
81  unsigned char keysalt[SWITCH_RTP_MAX_CRYPTO_LEN];
84 };
86 
87 typedef enum {
90 } ice_proto_t;
91 
92 
93 
94 typedef struct icand_s {
95  char *foundation;
97  char *transport;
98  uint32_t priority;
99  char *con_addr;
101  char *cand_type;
102  char *raddr;
104  char *generation;
105  uint8_t ready;
106  uint8_t responsive;
107  uint8_t use_candidate;
108 } icand_t;
109 
110 #define MAX_CAND 50
111 #define MAX_CAND_IDX_COUNT 2
112 typedef struct ice_s {
113 
115  int cand_idx[MAX_CAND_IDX_COUNT];
116  int chosen[MAX_CAND_IDX_COUNT];
117  int is_chosen[MAX_CAND_IDX_COUNT];
118  char *ufrag;
119  char *pwd;
120  char *options;
121 
122 } ice_t;
123 
124 typedef enum { /* RTCP Control Packet types (PT) http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-4 */
125  _RTCP_PT_FIR = 192, /* [RFC 2032] RTP Payload Format for H.261 Video Streams. types 192 (FIR) section 5.2.1 */
126  _RTCP_PT_IJ = 195, /* IJ: Extended inter-arrival jitter report RFC5450*/
127  _RTCP_PT_SR = 200, /* SR: sender report RFC3550 */
128  _RTCP_PT_RR = 201, /* RR: receiver report RFC3550 */
129  _RTCP_PT_SDES = 202, /* SDES: source description RFC3550 */
130  _RTCP_PT_BYE = 203, /* BYE: goodbye RFC3550 */
131  _RTCP_PT_APP = 204, /* APP: application-defined RFC3550 */
132  _RTCP_PT_RTPFB = 205, /* RTPFB: RTCP Transport layer FB message RFC4585 */
133  _RTCP_PT_PSFB = 206, /* PSFB: RTCP Payload-specific FB message RFC4585 */
134  _RTCP_PT_XR = 207, /* XR: extended report RFC3611 */
135  _RTCP_PT_AVB = 208, /* AVB: "Standard for Layer 3 Transport Protocol for Time Sensitive Applications in Local Area Networks." Work in progress. */
136  _RTCP_PT_RSI = 209, /* RSI: Receiver Summary Information RFC5760 */
137  _RTCP_PT_TOKEN = 210, /* TOKEN: Port Mapping RFC6284 */
138  _RTCP_PT_IDMS = 211, /* IDMS: IDMS Settings RFC7272 */
139  _RTCP_PT_LAST = 255 /* RESERVED */
140 } rtcp_pt_t;
141 
142 typedef enum { /* RTP SDES item types http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-5 */
143  _RTCP_SDES_END = 0, /* END: end of sdes list RFC3550 */
144  _RTCP_SDES_CNAME = 1, /* CNAME: canonical name RFC3550 */
145  _RTCP_SDES_NAME = 2, /* NAME: user name RFC3550 */
146  _RTCP_SDES_EMAIL = 3, /* EMAIL: user's electronic mail address RFC3550 */
147  _RTCP_SDES_PHONE = 4, /* PHONE: user's phone number RFC3550 */
148  _RTCP_SDES_LOC = 5, /* LOC: geographic user location RFC3550 */
149  _RTCP_SDES_TOOL = 6, /* TOOL: name of application or tool RFC3550 */
150  _RTCP_SDES_NOTE = 7, /* NOTE: notice about the source RFC3550 */
151  _RTCP_SDES_PRIV = 8, /* PRIV: private extensions RFC3550 */
152  _RTCP_SDES_H323 = 9, /* H323-CADDR: H.323 callable address [Vineet Kumar] */
153  _RTCP_SDES_APSI = 10 /* APSI: Application specific identifer RFC6776 */
154 } rtcp_sdes_t;
155 
156 typedef enum { /* FMT Values for RTPFB Payload Types http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-8 */
157  _RTCP_RTPFB_NACK = 1, /* Generic NACK: Generic negative acknowledgement RFC4585 */
158  _RTCP_RTPFB_TMMBR = 3, /* TMMBR: Temporary Maximum Media Stream Bit Rate Request RFC5104 */
159  _RTCP_RTPFB_TMMBN = 4, /* TMMBN: Temporary Maximum Media Stream Bit Rate Notification RFC5104 */
160  _RTCP_RTPFB_SR_REQ = 5, /* RTCP-SR-REQ: TCP Rapid Resynchronisation Request RFC6051*/
161  _RTCP_RTPFB_RAMS = 6, /* RAMS: Rapid Acquisition of Multicast Sessions RFC6285 */
162  _RTCP_RTPFB_TLLEI = 7, /* TLLEI: Transport-Layer Third-Party Loss Early Indication RFC6642 */
163  _RTCP_RTPFB_ECN_FB = 8 /* RTCP-ECN-FB: RTCP ECN Feedback RFC6679*/
164 } rtcp_rtpfb_t;
165 
166 typedef enum { /* FMT Values for PSFB Payload Types http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-9 */
167  _RTCP_PSFB_PLI = 1, /* PLI: Picture Loss Indication RFC4585 */
168  _RTCP_PSFB_SLI = 2, /* SLI: Slice Loss Indication RFC4585 */
169  _RTCP_PSFB_RPSI = 3, /* RPSI: Reference Picture Selection Indication RFC4585 */
170  _RTCP_PSFB_FIR = 4, /* FIR: Full Intra Request Command RFC5104 */
171  _RTCP_PSFB_TSTR = 5, /* TSTR: Temporal-Spatial Trade-off Request RFC5104 */
172  _RTCP_PSFB_TSTN = 6, /* TSTN: Temporal-Spatial Trade-off Notification RFC5104 */
173  _RTCP_PSFB_VBCM = 7, /* VBCM: Video Back Channel Message RFC5104 */
174  _RTCP_PSFB_PSLEI = 8, /* PSLEI: Payload-Specific Third-Party Loss Early Indication RFC6642*/
175  _RTCP_PSFB_AFB = 15 /* AFB Application layer FB */
176 } rtcp_psfb_t;
177 
178 
179 
181 
182 ///\defgroup rtp RTP (RealTime Transport Protocol)
183 ///\ingroup core1
184 ///\{
185  typedef void (*switch_rtp_invalid_handler_t) (switch_rtp_t *rtp_session,
186  switch_socket_t *sock, void *data, switch_size_t datalen, switch_sockaddr_t *from_addr);
187 
188 
189 SWITCH_DECLARE(void) switch_rtp_get_random(void *buf, uint32_t len);
190 /*!
191  \brief Initilize the RTP System
192  \param pool the memory pool to use for long term allocations
193  \note Generally called by the core_init
194 */
197 
198 /*!
199  \brief Set/Get RTP start port
200  \param port new value (if > 0)
201  \return the current RTP start port
202 */
204 
207 
208 /*!
209  \brief Set/Get RTP end port
210  \param port new value (if > 0)
211  \return the current RTP end port
212 */
214 
215 /*!
216  \brief Request a new port to be used for media
217  \param ip the ip to request a port from
218  \return the new port to use
219 */
221 SWITCH_DECLARE(void) switch_rtp_release_port(const char *ip, switch_port_t port);
222 
223 SWITCH_DECLARE(switch_status_t) switch_rtp_set_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval);
224 
225 SWITCH_DECLARE(switch_status_t) switch_rtp_change_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval);
226 /*!
227  \brief create a new RTP session handle
228  \param new_rtp_session a poiter to aim at the new session
229  \param payload the IANA payload number
230  \param samples_per_interval the default samples_per_interval
231  \param ms_per_packet time in microseconds per packet
232  \param flags flags to control behaviour
233  \param timer_name timer interface to use
234  \param err a pointer to resolve error messages
235  \param pool a memory pool to use for the session
236  \return the new RTP session or NULL on failure
237 */
239  switch_payload_t payload,
240  uint32_t samples_per_interval,
241  uint32_t ms_per_packet,
242  switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID], char *timer_name, const char **err, switch_memory_pool_t *pool);
243 
244 
245 /*!
246  \brief prepare a new RTP session handle and fully initilize it
247  \param rx_host the local address
248  \param rx_port the local port
249  \param tx_host the remote address
250  \param tx_port the remote port
251  \param payload the IANA payload number
252  \param samples_per_interval the default samples_per_interval
253  \param ms_per_packet time in microseconds per packet
254  \param flags flags to control behaviour
255  \param timer_name timer interface to use
256  \param err a pointer to resolve error messages
257  \param pool a memory pool to use for the session
258  \param bundle_port port used by bundled stream locally, for video thread this is the port where it will forward audio (internal bundle port on which audio is listening), and for audio this is the port where it will send RTP (external bundle port where video is listening)
259  \return the new RTP session or NULL on failure
260 */
261 SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
262  switch_port_t rx_port,
263  const char *tx_host,
264  switch_port_t tx_port,
265  switch_payload_t payload,
266  uint32_t samples_per_interval,
267  uint32_t ms_per_packet,
268  switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID], char *timer_name, const char **err, switch_memory_pool_t *pool, switch_port_t bundle_internal_ports, switch_port_t bundle_external_port);
269 
270 
271 /*!
272  \brief Assign a remote address to the RTP session
273  \param rtp_session an RTP session to assign the remote address to
274  \param host the ip or fqhn of the remote address
275  \param port the remote port
276  \param err pointer for error messages
277 */
278 SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port, switch_port_t remote_rtcp_port,
279  switch_bool_t change_adv_addr, const char **err);
280 
285 SWITCH_DECLARE(void) switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session, uint32_t max);
286 SWITCH_DECLARE(void) switch_rtp_set_media_timeout(switch_rtp_t *rtp_session, uint32_t ms);
287 
289 SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session);
290 
291 /*!
292  \brief Assign a local address to the RTP session
293  \param rtp_session an RTP session to assign the local address to
294  \param host the ip or fqhn of the local address
295  \param port the local port
296  \param change_adv_addr change the advertised address for doing compare
297  \param err pointer for error messages
298  \note this call also binds the RTP session's socket to the new address
299 */
300 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);
301 
302 /*!
303  \brief Kill the socket on an existing RTP session
304  \param rtp_session an RTP session to kill the socket of
305 */
307 
308 SWITCH_DECLARE(void) switch_rtp_break(switch_rtp_t *rtp_session);
309 SWITCH_DECLARE(void) switch_rtp_flush(switch_rtp_t *rtp_session);
310 
311 /*!
312  \brief Test if an RTP session is ready
313  \param rtp_session an RTP session to test
314  \return a true value if it's ready
315 */
316 SWITCH_DECLARE(uint8_t) switch_rtp_ready(switch_rtp_t *rtp_session);
317 
318 /*!
319  \brief Destroy an RTP session
320  \param rtp_session an RTP session to destroy
321 */
322 SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session);
323 
325 
326 /*!
327  \brief Acvite ICE on an RTP session
328  \return SWITCH_STATUS_SUCCESS
329 */
330 SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin,
331  const char *password, const char *rpassword, ice_proto_t proto,
332  switch_core_media_ice_type_t type, ice_t *ice_params);
333 
334 /*!
335  \brief Activate sending RTCP Sender Reports (SR's)
336  \param send_rate interval in milliseconds to send at
337  \return SWITCH_STATUS_SUCCESS
338 */
340 
341 
343 
344 SWITCH_DECLARE(switch_status_t) switch_rtp_set_video_buffer_size(switch_rtp_t *rtp_session, uint32_t frames, uint32_t max_frames);
345 SWITCH_DECLARE(switch_status_t) switch_rtp_get_video_buffer_size(switch_rtp_t *rtp_session, uint32_t *min_frame_len, uint32_t *max_frame_len, uint32_t *cur_frame_len, uint32_t *highest_frame_len);
346 
347 /*!
348  \brief Acvite a jitter buffer on an RTP session
349  \param rtp_session the rtp session
350  \param queue_frames the number of frames to delay
351  \return SWITCH_STATUS_SUCCESS
352 */
354  uint32_t queue_frames,
355  uint32_t max_queue_frames,
356  uint32_t samples_per_packet, uint32_t samples_per_second);
357 
359 
363 
364 
365 
366 
367 /*!
368  \brief Set an RTP Flag
369  \param rtp_session the RTP session
370  \param flags the flags to set
371 */
375 
376 /*!
377  \brief Test an RTP Flag
378  \param rtp_session the RTP session
379  \param flags the flags to test
380  \return TRUE or FALSE
381 */
383 
384 /*!
385  \brief Clear an RTP Flag
386  \param rtp_session the RTP session
387  \param flags the flags to clear
388 */
390 
391 /*!
392  \brief Retrieve the socket from an existing RTP session
393  \param rtp_session the RTP session to retrieve the socket from
394  \return the socket from the RTP session
395 */
397 SWITCH_DECLARE(void) switch_rtp_ping(switch_rtp_t *rtp_session);
398 /*!
399  \brief Get the default samples per interval for a given RTP session
400  \param rtp_session the RTP session to get the samples per interval from
401  \return the default samples per interval of the RTP session
402 */
404 
405 /*!
406  \brief Set the default payload number for a given RTP session
407  \param rtp_session the RTP session to set the payload number on
408  \param payload the new default payload number
409 */
411 
412 /*!
413  \brief Get the default payload number for a given RTP session
414  \param rtp_session the RTP session to get the payload number from
415  \return the default payload of the RTP session
416 */
418 
419 
420 /*!
421  \brief Set a callback function to execute when an invalid RTP packet is encountered
422  \param rtp_session the RTP session
423  \param on_invalid the function to set
424  \return
425 */
427 
428 /*!
429  \brief Read data from a given RTP session
430  \param rtp_session the RTP session to read from
431  \param data the data to read
432  \param datalen a pointer to the datalen
433  \param payload_type the IANA payload of the packet
434  \param flags flags
435  \param io_flags i/o flags
436  \return the number of bytes read
437 */
438 SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t *datalen,
439  switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags);
440 
441 /*!
442  \brief Queue RFC2833 DTMF data into an RTP Session
443  \param rtp_session the rtp session to use
444  \param dtmf the dtmf digits to queue
445  \return SWITCH_STATUS_SUCCESS on success
446 */
448 
449 /*!
450  \brief Queue RFC2833 DTMF data into an RTP Session
451  \param rtp_session the rtp session to use
452  \param dtmf the dtmf digits to queue
453  \return SWITCH_STATUS_SUCCESS on success
454 */
456 
457 /*!
458  \brief Test for presence of DTMF on a given RTP session
459  \param rtp_session session to test
460  \return number of digits in the queue
461 */
463 
464 /*!
465  \brief Retrieve DTMF digits from a given RTP session
466  \param rtp_session RTP session to retrieve digits from
467  \param dtmf the dtmf
468  \return number of bytes read into the buffer
469 */
471 
472 /*!
473  \brief Read data from a given RTP session without copying
474  \param rtp_session the RTP session to read from
475  \param data a pointer to point directly to the RTP read buffer
476  \param datalen a pointer to the datalen
477  \param payload_type the IANA payload of the packet
478  \param flags flags
479  \param io_flags i/o flags
480  \return the number of bytes read
481 */
483  void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags,
484  switch_io_flag_t io_flags);
485 
486 /*!
487  \brief Read data from a given RTP session without copying
488  \param rtp_session the RTP session to read from
489  \param frame a frame to populate with information
490  \param io_flags i/o flags
491  \return the number of bytes read
492 */
494 
495 
496 /*!
497  \brief Read RTCP data from a given RTP session without copying
498  \param rtp_session the RTP session to read from
499  \param frame an RTCP frame to populate with information
500  \return the number of bytes read
501 */
503 
505 
506 /*!
507  \brief Enable VAD on an RTP Session
508  \param rtp_session the RTP session
509  \param session the core session associated with the RTP session
510  \param codec the codec the channel is currenty using
511  \param flags flags for control
512  \return SWITCH_STAUTS_SUCCESS on success
513 */
515  switch_codec_t *codec, switch_vad_flag_t flags);
516 
517 /*!
518  \brief Disable VAD on an RTP Session
519  \param rtp_session the RTP session
520  \return SWITCH_STAUTS_SUCCESS on success
521 */
523 
524 /*!
525  \brief Write data to a given RTP session
526  \param rtp_session the RTP session to write to
527  \param frame the frame to write
528  \return the number of bytes written
529 */
531 
532 /*!
533  \brief Write data with a specified payload and sequence number to a given RTP session
534  \param rtp_session the RTP session to write to
535  \param data data to write
536  \param datalen the size of the data
537  \param m set mark bit or not
538  \param payload the IANA payload number
539  \param ts then number of bytes to increment the timestamp by
540  \param flags frame flags
541  \return the number of bytes written
542 */
544  void *data, uint32_t datalen, uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags);
545 
546 SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session, void *data, switch_size_t *bytes, switch_bool_t process_encryption);
547 
548 /*!
549  \brief Retrieve the SSRC from a given RTP session
550  \param rtp_session the RTP session to retrieve from
551  \return the SSRC
552 */
553 SWITCH_DECLARE(uint32_t) switch_rtp_get_ssrc(switch_rtp_t *rtp_session);
554 
555 /*!
556  \brief Associate an arbitrary data pointer with and RTP session
557  \param rtp_session the RTP session to assign the pointer to
558  \param private_data the private data to assign
559 */
560 SWITCH_DECLARE(void) switch_rtp_set_private(switch_rtp_t *rtp_session, void *private_data);
561 
562 /*!
563  \brief Set the payload type to consider RFC2833 DTMF
564  \param rtp_session the RTP session to modify
565  \param te the payload type
566 */
569 
570 /*!
571  \brief Set the payload type for comfort noise
572  \param rtp_session the RTP session to modify
573  \param pt the payload type
574 */
576 
577 /*!
578  \brief Retrieve the private data from a given RTP session
579  \param rtp_session the RTP session to retrieve the data from
580  \return the pointer to the private data
581 */
585 
588 SWITCH_DECLARE(void) switch_rtp_set_interdigit_delay(switch_rtp_t *rtp_session, uint32_t delay);
589 
590 SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, dtls_fingerprint_t *local_fp, dtls_fingerprint_t *remote_fp, dtls_type_t type, uint8_t want_DTLSv1_2);
593 
595 
600 
602 /*!
603  \}
604 */
605 
607 #endif
608 /* For Emacs:
609  * Local Variables:
610  * mode:c
611  * indent-tabs-mode:t
612  * tab-width:4
613  * c-basic-offset:4
614  * End:
615  * For VIM:
616  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
617  */
char * generation
Definition: switch_rtp.h:104
switch_status_t switch_rtp_activate_rtcp(switch_rtp_t *rtp_session, int send_rate, switch_port_t remote_port, switch_bool_t mux)
Activate sending RTCP Sender Reports (SR&#39;s)
Definition: switch_rtp.c:4875
void switch_rtp_set_media_timeout(switch_rtp_t *rtp_session, uint32_t ms)
Definition: switch_rtp.c:2951
uint8_t switch_rtp_ready(switch_rtp_t *rtp_session)
Test if an RTP session is ready.
Definition: switch_rtp.c:5147
switch_status_t switch_rtp_del_dtls(switch_rtp_t *rtp_session, dtls_type_t type)
Definition: switch_rtp.c:3736
switch_rtp_crypto_key_type_t
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)
Definition: switch_rtp.h:185
switch_socket_t * switch_rtp_get_rtp_socket(switch_rtp_t *rtp_session)
Retrieve the socket from an existing RTP session.
Definition: switch_rtp.c:5325
switch_rtp_flush_t
Definition: switch_types.h:766
rtcp_psfb_t
Definition: switch_rtp.h:166
void switch_rtp_reset(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:3000
uint32_t switch_io_flag_t
switch_status_t switch_rtp_ack_bitrate(switch_rtp_t *rtp_session, uint32_t bps)
Definition: switch_rtp.c:5045
#define SWITCH_END_EXTERN_C
Definition: switch.h:43
switch_rtp_hdr_t header
Definition: switch_rtp.h:56
switch_rtp_t * switch_rtp_new(const char *rx_host, switch_port_t rx_port, const char *tx_host, switch_port_t tx_port, switch_payload_t payload, uint32_t samples_per_interval, uint32_t ms_per_packet, switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID], char *timer_name, const char **err, switch_memory_pool_t *pool, switch_port_t bundle_internal_ports, switch_port_t bundle_external_port)
prepare a new RTP session handle and fully initilize it
Definition: switch_rtp.c:4623
switch_core_session_t * switch_rtp_get_core_session(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:9238
switch_bool_t
Definition: switch_types.h:437
uint8_t responsive
Definition: switch_rtp.h:106
switch_size_t keylen
Definition: switch_rtp.h:82
char * foundation
Definition: switch_rtp.h:95
ice_proto_t
Definition: switch_rtp.h:87
switch_memory_pool_t * pool
char * raddr
Definition: switch_rtp.h:102
#define SWITCH_RTP_MAX_BUF_LEN
Definition: switch_rtp.h:45
switch_rtp_crypto_direction_t
Definition: switch_rtp.h:62
switch_status_t switch_rtp_pause_jitter_buffer(switch_rtp_t *rtp_session, switch_bool_t pause)
Definition: switch_rtp.c:4735
dtls_state_t switch_rtp_dtls_state(switch_rtp_t *rtp_session, dtls_type_t type)
Definition: switch_rtp.c:3705
switch_status_t switch_rtp_set_payload_map(switch_rtp_t *rtp_session, payload_map_t **pmap)
Definition: switch_rtp.c:2649
void switch_rtp_intentional_bugs(switch_rtp_t *rtp_session, switch_rtp_bug_flag_t bugs)
Definition: switch_rtp.c:2662
void switch_rtp_set_telephony_recv_event(switch_rtp_t *rtp_session, switch_payload_t te)
Definition: switch_rtp.c:4698
void switch_rtp_set_private(switch_rtp_t *rtp_session, void *private_data)
Associate an arbitrary data pointer with and RTP session.
Definition: switch_rtp.c:9228
Abstract handler to a timer module.
uint8_t use_candidate
Definition: switch_rtp.h:107
switch_port_t switch_rtp_set_start_port(switch_port_t port)
Set/Get RTP start port.
Definition: switch_rtp.c:2582
switch_status_t switch_rtp_zerocopy_read(switch_rtp_t *rtp_session, void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags)
Read data from a given RTP session without copying.
Definition: switch_rtp.c:8244
uint8_t switch_byte_t
Definition: switch_types.h:256
void switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session, uint32_t max)
Definition: switch_rtp.c:2963
switch_port_t switch_rtp_get_remote_port(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:3039
void rtp_flush_read_buffer(switch_rtp_t *rtp_session, switch_rtp_flush_t flush)
Definition: switch_rtp.c:5635
switch_status_t switch_rtp_udptl_mode(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:3055
void switch_rtp_reset_media_timer(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:3028
void switch_rtp_set_telephony_event(switch_rtp_t *rtp_session, switch_payload_t te)
Set the payload type to consider RFC2833 DTMF.
Definition: switch_rtp.c:4690
void switch_rtp_init(switch_memory_pool_t *pool)
Initilize the RTP System.
Definition: switch_rtp.c:1522
void switch_rtp_destroy(switch_rtp_t **rtp_session)
Destroy an RTP session.
Definition: switch_rtp.c:5186
uint32_t switch_vad_flag_t
Definition: switch_types.h:661
switch_status_t switch_rtp_deactivate_jitter_buffer(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:4761
switch_jb_t * switch_rtp_get_jitter_buffer(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:4726
switch_status_t switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp_session, switch_frame_t *frame, switch_io_flag_t io_flags)
Read data from a given RTP session without copying.
Definition: switch_rtp.c:8192
switch_byte_t switch_byte_t * buf
switch_status_t switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, uint32_t queue_frames, uint32_t max_queue_frames, uint32_t samples_per_packet, uint32_t samples_per_second)
Acvite a jitter buffer on an RTP session.
Definition: switch_rtp.c:4834
struct ice_s ice_t
int switch_rtp_has_dtls(void)
Definition: switch_rtp.c:3697
switch_status_t switch_rtp_get_video_buffer_size(switch_rtp_t *rtp_session, uint32_t *min_frame_len, uint32_t *max_frame_len, uint32_t *cur_frame_len, uint32_t *highest_frame_len)
Definition: switch_rtp.c:4773
switch_rtp_bug_flag_t
Definition: switch_types.h:848
rtcp_rtpfb_t
Definition: switch_rtp.h:156
switch_status_t switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin, const char *password, const char *rpassword, ice_proto_t proto, switch_core_media_ice_type_t type, ice_t *ice_params)
Acvite ICE on an RTP session.
Definition: switch_rtp.c:4930
int index
Definition: switch_cJSON.h:160
void switch_rtp_set_flags(switch_rtp_t *rtp_session, switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID])
Definition: switch_rtp.c:5350
#define SWITCH_RTP_MAX_CRYPTO_LEN
switch_port_t switch_rtp_set_end_port(switch_port_t port)
Set/Get RTP end port.
Definition: switch_rtp.c:2596
switch_status_t switch_rtp_disable_vad(switch_rtp_t *rtp_session)
Disable VAD on an RTP Session.
Definition: switch_rtp.c:8815
char * con_addr
Definition: switch_rtp.h:99
void switch_rtp_video_loss(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:5068
switch_status_t switch_rtp_set_remote_ssrc(switch_rtp_t *rtp_session, uint32_t ssrc)
Definition: switch_rtp.c:4466
switch_status_t switch_rtp_set_ssrc(switch_rtp_t *rtp_session, uint32_t ssrc)
Definition: switch_rtp.c:4458
char * cand_type
Definition: switch_rtp.h:101
switch_rtp_crypto_key_type_t type
Definition: switch_rtp.h:80
switch_byte_t switch_rtp_check_auto_adj(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:8046
An abstraction of a data frame.
Definition: switch_frame.h:54
uint32_t switch_rtp_get_default_payload(switch_rtp_t *rtp_session)
Get the default payload number for a given RTP session.
Definition: switch_rtp.c:5340
char * options
Definition: switch_rtp.h:120
uintptr_t switch_size_t
switch_status_t switch_rtp_add_dtls(switch_rtp_t *rtp_session, dtls_fingerprint_t *local_fp, dtls_fingerprint_t *remote_fp, dtls_type_t type, uint8_t want_DTLSv1_2)
Definition: switch_rtp.c:3813
uint8_t ready
Definition: switch_rtp.h:105
uint16_t switch_port_t
switch_size_t switch_rtp_has_dtmf(switch_rtp_t *rtp_session)
Test for presence of DTMF on a given RTP session.
Definition: switch_rtp.c:8051
void * switch_rtp_get_private(switch_rtp_t *rtp_session)
Retrieve the private data from a given RTP session.
Definition: switch_rtp.c:9233
switch_status_t switch_rtp_set_remote_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port, switch_port_t remote_rtcp_port, switch_bool_t change_adv_addr, const char **err)
Assign a remote address to the RTP session.
Definition: switch_rtp.c:3125
uint32_t switch_frame_flag_t
char * ufrag
Definition: switch_rtp.h:118
struct fspr_sockaddr_t switch_sockaddr_t
Definition: switch_apr.h:1029
void switch_rtp_set_cng_pt(switch_rtp_t *rtp_session, switch_payload_t pt)
Set the payload type for comfort noise.
Definition: switch_rtp.c:4706
dtls_type_t
Definition: switch_core.h:159
switch_status_t switch_rtp_write_raw(switch_rtp_t *rtp_session, void *data, switch_size_t *bytes, switch_bool_t process_encryption)
Definition: switch_rtp.c:9158
void switch_rtp_shutdown(void)
Definition: switch_rtp.c:2552
char * transport
Definition: switch_rtp.h:97
uint32_t switch_rtp_get_default_samples_per_interval(switch_rtp_t *rtp_session)
Get the default samples per interval for a given RTP session.
Definition: switch_rtp.c:5330
rtcp_sdes_t
Definition: switch_rtp.h:142
void switch_rtp_clear_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flag)
Clear an RTP Flag.
Definition: switch_rtp.c:5431
char * ip
Definition: switch_msrp.c:60
switch_port_t switch_rtp_request_port(const char *ip)
Request a new port to be used for media.
Definition: switch_rtp.c:2626
void switch_rtp_set_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flag)
Set an RTP Flag.
Definition: switch_rtp.c:5372
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, switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID], char *timer_name, const char **err, switch_memory_pool_t *pool)
create a new RTP session handle
Definition: switch_rtp.c:4473
char * switch_rtp_get_remote_host(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:3034
switch_status_t
Common return values.
switch_timer_t * switch_rtp_get_media_timer(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:4712
uint32_t switch_rtp_get_ssrc(switch_rtp_t *rtp_session)
Retrieve the SSRC from a given RTP session.
Definition: switch_rtp.c:9223
dtls_state_t
Definition: switch_core.h:166
void switch_rtp_ping(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:2537
switch_size_t switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session, switch_dtmf_t *dtmf)
Retrieve DTMF digits from a given RTP session.
Definition: switch_rtp.c:8064
void switch_rtp_flush(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:5025
#define MAX_CAND
Definition: switch_rtp.h:110
void switch_rtp_break(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:5080
rtcp_pt_t
Definition: switch_rtp.h:124
void switch_rtp_reset_jb(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:2979
An abstraction of a rtcp frame.
switch_rtp_flag_t
RTP Related Flags.
Definition: switch_types.h:793
char * pwd
Definition: switch_rtp.h:119
switch_status_t switch_rtp_set_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval)
Definition: switch_rtp.c:4401
void switch_rtp_get_random(void *buf, uint32_t len)
Definition: switch_rtp.c:2542
switch_rtp_hdr_ext_t * ext
Definition: switch_rtp.h:58
switch_status_t switch_rtp_queue_rfc2833(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf)
Queue RFC2833 DTMF data into an RTP Session.
Definition: switch_rtp.c:8091
void switch_rtp_set_default_payload(switch_rtp_t *rtp_session, switch_payload_t payload)
Set the default payload number for a given RTP session.
Definition: switch_rtp.c:5335
#define MAX_CAND_IDX_COUNT
Definition: switch_rtp.h:111
int component_id
Definition: switch_rtp.h:96
#define SWITCH_DECLARE(type)
struct switch_srtp_crypto_suite_s switch_srtp_crypto_suite_t
void switch_rtp_clear_flags(switch_rtp_t *rtp_session, switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID])
Definition: switch_rtp.c:5361
int switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_frame_t *frame)
Write data to a given RTP session.
Definition: switch_rtp.c:8887
switch_rtp_stats_t * switch_rtp_get_stats(switch_rtp_t *rtp_session, switch_memory_pool_t *pool)
Definition: switch_rtp.c:9080
switch_status_t switch_rtp_set_video_buffer_size(switch_rtp_t *rtp_session, uint32_t frames, uint32_t max_frames)
Definition: switch_rtp.c:4783
switch_status_t switch_rtp_change_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval)
Definition: switch_rtp.c:4414
switch_status_t switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp_session, const char *name)
Definition: switch_rtp.c:4814
switch_status_t switch_rtp_set_local_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port, const char **err)
Assign a local address to the RTP session.
Definition: switch_rtp.c:2780
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)
Enable VAD on an RTP Session.
Definition: switch_rtp.c:8830
void switch_rtp_release_port(const char *ip, switch_port_t port)
Definition: switch_rtp.c:2610
uint32_t switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags)
Test an RTP Flag.
Definition: switch_rtp.c:5426
void switch_rtp_set_invalid_handler(switch_rtp_t *rtp_session, switch_rtp_invalid_handler_t on_invalid)
Set a callback function to execute when an invalid RTP packet is encountered.
Definition: switch_rtp.c:5345
struct fspr_pool_t switch_memory_pool_t
uint32_t priority
Definition: switch_rtp.h:98
const char *const name
Definition: switch_cJSON.h:250
switch_status_t switch_rtp_queue_rfc2833_in(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf)
Queue RFC2833 DTMF data into an RTP Session.
Definition: switch_rtp.c:8117
struct fspr_socket_t switch_socket_t
Definition: switch_apr.h:1026
struct icand_s icand_t
void switch_rtp_kill_socket(switch_rtp_t *rtp_session)
Kill the socket on an existing RTP session.
Definition: switch_rtp.c:5120
switch_core_media_ice_type_t
void switch_rtp_video_refresh(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:5056
struct switch_rtp_crypto_key * next
Definition: switch_rtp.h:83
switch_status_t switch_rtp_req_bitrate(switch_rtp_t *rtp_session, uint32_t bps)
Definition: switch_rtp.c:5034
switch_status_t switch_rtcp_zerocopy_read_frame(switch_rtp_t *rtp_session, switch_rtcp_frame_t *frame)
Read RTCP data from a given RTP session without copying.
Definition: switch_rtp.c:8172
switch_status_t switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags)
Read data from a given RTP session.
Definition: switch_rtp.c:8142
void switch_rtp_set_interdigit_delay(switch_rtp_t *rtp_session, uint32_t delay)
Definition: switch_rtp.c:5320
switch_status_t switch_rtp_sync_stats(switch_rtp_t *rtp_session)
Definition: switch_rtp.c:5163
switch_status_t switch_rtp_add_crypto_key(switch_rtp_t *rtp_session, switch_rtp_crypto_direction_t direction, uint32_t index, switch_secure_settings_t *ssec)
Definition: switch_rtp.c:4059
uint8_t switch_payload_t
switch_port_t con_port
Definition: switch_rtp.h:100
switch_port_t rport
Definition: switch_rtp.h:103
int switch_rtp_write_manual(switch_rtp_t *rtp_session, void *data, uint32_t datalen, uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags)
Write data with a specified payload and sequence number to a given RTP session.
Definition: switch_rtp.c:9107
switch_rtp_crypto_key_type_t type
Definition: switch_rtp.h:73
#define SWITCH_BEGIN_EXTERN_C
Definition: switch.h:42