Asterisk - The Open Source Telephony Project  GIT-master-a24979a
rtp_engine.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 1999 - 2009, Digium, Inc.
5  *
6  * Mark Spencer <markster@digium.com>
7  * Joshua Colp <jcolp@digium.com>
8  *
9  * See http://www.asterisk.org for more information about
10  * the Asterisk project. Please do not directly contact
11  * any of the maintainers of this project for assistance;
12  * the project provides a web site, mailing lists and IRC
13  * channels for your use.
14  *
15  * This program is free software, distributed under the terms of
16  * the GNU General Public License Version 2. See the LICENSE file
17  * at the top of the source tree.
18  */
19 
20 /*! \file
21  * \brief Pluggable RTP Architecture
22  * \author Joshua Colp <jcolp@digium.com>
23  * \ref AstRTPEngine
24  */
25 
26 /*!
27  * \page AstRTPEngine Asterisk RTP Engine API
28  *
29  * The purpose of this API is to provide a way for multiple RTP stacks to be
30  * used inside of Asterisk without any module that uses RTP knowing any
31  * different. To the module each RTP stack behaves the same.
32  *
33  * An RTP session is called an instance and is made up of a combination of codec
34  * information, RTP engine, RTP properties, and address information. An engine
35  * name may be passed in to explicitly choose an RTP stack to be used but a
36  * default one will be used if none is provided. An address to use for RTP may
37  * also be provided but the underlying RTP engine may choose a different address
38  * depending on it's configuration.
39  *
40  * An RTP engine is the layer between the RTP engine core and the RTP stack
41  * itself. The RTP engine core provides a set of callbacks to do various things
42  * (such as write audio out) that the RTP engine has to have implemented.
43  *
44  * Glue is what binds an RTP instance to a channel. It is used to retrieve RTP
45  * instance information when performing remote or local bridging and is used to
46  * have the channel driver tell the remote side to change destination of the RTP
47  * stream.
48  *
49  * Statistics from an RTP instance can be retrieved using the
50  * ast_rtp_instance_get_stats API call. This essentially asks the RTP engine in
51  * use to fill in a structure with the requested values. It is not required for
52  * an RTP engine to support all statistic values.
53  *
54  * Properties allow behavior of the RTP engine and RTP engine core to be
55  * changed. For example, there is a property named AST_RTP_PROPERTY_NAT which is
56  * used to tell the RTP engine to enable symmetric RTP if it supports it. It is
57  * not required for an RTP engine to support all properties.
58  *
59  * Codec information is stored using a separate data structure which has it's
60  * own set of API calls to add/remove/retrieve information. They are used by the
61  * module after an RTP instance is created so that payload information is
62  * available for the RTP engine.
63  */
64 
65 #ifndef _ASTERISK_RTP_ENGINE_H
66 #define _ASTERISK_RTP_ENGINE_H
67 
68 #if defined(__cplusplus) || defined(c_plusplus)
69 extern "C" {
70 #endif
71 
72 #include "asterisk/astobj2.h"
73 #include "asterisk/frame.h"
74 #include "asterisk/format_cap.h"
75 #include "asterisk/netsock2.h"
76 #include "asterisk/sched.h"
77 #include "asterisk/res_srtp.h"
78 #include "asterisk/stasis.h"
79 #include "asterisk/vector.h"
81 
82 /*! Maximum number of payload types RTP can support. */
83 #define AST_RTP_MAX_PT 128
84 
85 /*!
86  * Last RTP payload type statically assigned, see
87  * http://www.iana.org/assignments/rtp-parameters
88  */
89 #define AST_RTP_PT_LAST_STATIC 34
90 
91 /*! First dynamic RTP payload type */
92 #define AST_RTP_PT_FIRST_DYNAMIC 96
93 
94 /*! Last reassignable RTP payload type */
95 #define AST_RTP_PT_LAST_REASSIGN 63
96 
97 /*! Maximum number of generations */
98 #define AST_RED_MAX_GENERATION 5
99 
100 /*!
101  * Maximum size of an internal Asterisk channel unique ID.
102  *
103  * \note Must match the AST_MAX_UNIQUEID(AST_MAX_PUBLIC_UNIQUEID) value.
104  * We don't use that defined value directly here to avoid a hard
105  * dependency on channel.h.
106  */
107 #define MAX_CHANNEL_ID 152
108 
109 struct ast_rtp_instance;
110 struct ast_rtp_glue;
111 
112 /*! RTP Properties that can be set on an RTP instance */
114  /*! Enable symmetric RTP support */
116  /*! RTP instance will be carrying DTMF (using RFC2833) */
118  /*! Expect unreliable DTMF from remote party */
120  /*! Enable STUN support */
122  /*! Enable RTCP support */
124  /*! Enable Asymmetric RTP Codecs */
126  /*! Enable packet retransmission for received packets */
128  /*! Enable packet retransmission for sent packets */
130  /*! Enable REMB sending and receiving passthrough support */
132 
133  /*!
134  * \brief Maximum number of RTP properties supported
135  *
136  * \note THIS MUST BE THE LAST ENTRY IN THIS ENUM.
137  */
139 };
140 
141 /*! Additional RTP options */
143  /*! Remote side is using non-standard G.726 */
145 };
146 
147 /*! RTP DTMF Modes */
149  /*! No DTMF is being carried over the RTP stream */
151  /*! DTMF is being carried out of band using RFC2833 */
153  /*! DTMF is being carried inband over the RTP stream */
155 };
156 
157 /*! Result codes when RTP glue is queried for information */
159  /*! No remote or local bridging is permitted */
161  /*! Move RTP stream to be remote between devices directly */
163  /*! Perform RTP engine level bridging if possible */
165 };
166 
167 /*! Field statistics that can be retrieved from an RTP instance */
169  /*! Retrieve quality information */
171  /*! Retrieve quality information about jitter */
173  /*! Retrieve quality information about packet loss */
175  /*! Retrieve quality information about round trip time */
177 };
178 
179 /*! Statistics that can be retrieved from an RTP instance */
181  /*! Retrieve all statistics */
183  /*! Retrieve number of packets transmitted */
185  /*! Retrieve number of packets received */
187  /*! Retrieve ALL statistics relating to packet loss */
189  /*! Retrieve number of packets lost for transmitting */
191  /*! Retrieve number of packets lost for receiving */
193  /*! Retrieve maximum number of packets lost on remote side */
195  /*! Retrieve minimum number of packets lost on remote side */
197  /*! Retrieve average number of packets lost on remote side */
199  /*! Retrieve standard deviation of packets lost on remote side */
201  /*! Retrieve maximum number of packets lost on local side */
203  /*! Retrieve minimum number of packets lost on local side */
205  /*! Retrieve average number of packets lost on local side */
207  /*! Retrieve standard deviation of packets lost on local side */
209  /*! Retrieve ALL statistics relating to jitter */
211  /*! Retrieve jitter on transmitted packets */
213  /*! Retrieve jitter on received packets */
215  /*! Retrieve maximum jitter on remote side */
217  /*! Retrieve minimum jitter on remote side */
219  /*! Retrieve average jitter on remote side */
221  /*! Retrieve standard deviation jitter on remote side */
223  /*! Retrieve maximum jitter on local side */
225  /*! Retrieve minimum jitter on local side */
227  /*! Retrieve average jitter on local side */
229  /*! Retrieve standard deviation jitter on local side */
231  /*! Retrieve ALL statistics relating to round trip time */
233  /*! Retrieve round trip time */
235  /*! Retrieve maximum round trip time */
237  /*! Retrieve minimum round trip time */
239  /*! Retrieve average round trip time */
241  /*! Retrieve standard deviation round trip time */
243  /*! Retrieve local SSRC */
245  /*! Retrieve remote SSRC */
247  /*! Retrieve channel unique ID */
249  /*! Retrieve number of octets transmitted */
251  /*! Retrieve number of octets received */
253 };
254 
256  /*! RTCP should not be sent/received */
258  /*! RTCP should be sent/received based on standard port rules */
260  /*! RTCP should be sent/received on the same port as RTP */
262 };
263 
264 /* Codes for RTP-specific data - not defined by our AST_FORMAT codes */
265 /*! DTMF (RFC2833) */
266 #define AST_RTP_DTMF (1 << 0)
267 /*! 'Comfort Noise' (RFC3389) */
268 #define AST_RTP_CN (1 << 1)
269 /*! DTMF (Cisco Proprietary) */
270 #define AST_RTP_CISCO_DTMF (1 << 2)
271 /*! Maximum RTP-specific code */
272 #define AST_RTP_MAX AST_RTP_CISCO_DTMF
273 
274 /*! Structure that represents a payload */
276  /*! If asterisk_format is set, this is the internal
277  * asterisk format represented by the payload */
279  /*! Is this an Asterisk value */
281  /*! Actual internal RTP specific value of the payload */
282  int rtp_code;
283  /*! Actual payload number */
284  int payload;
285  /*! TRUE if this is the primary mapping to the format. */
286  unsigned int primary_mapping:1;
287  /*! When the payload type became non-primary. */
288  struct timeval when_retired;
289 };
290 
291 /* Common RTCP report types */
292 /*! Sender Report */
293 #define AST_RTP_RTCP_SR 200
294 /*! Receiver Report */
295 #define AST_RTP_RTCP_RR 201
296 /*! Transport Layer Feed Back (From RFC4585 also RFC5104) */
297 #define AST_RTP_RTCP_RTPFB 205
298 /*! Payload Specific Feed Back (From RFC4585 also RFC5104) */
299 #define AST_RTP_RTCP_PSFB 206
300 
301 /* Common RTCP feedback message types */
302 /*! Generic NACK (From RFC4585 also RFC5104) */
303 #define AST_RTP_RTCP_FMT_NACK 1
304 /*! Picture loss indication (From RFC4585) */
305 #define AST_RTP_RTCP_FMT_PLI 1
306 /*! Full INTRA-frame Request (From RFC5104) */
307 #define AST_RTP_RTCP_FMT_FIR 4
308 /*! REMB Information (From draft-alvestrand-rmcat-remb-03) */
309 #define AST_RTP_RTCP_FMT_REMB 15
310 /*! Transport-wide congestion control feedback (From draft-holmer-rmcat-transport-wide-cc-extensions-01) */
311 #define AST_RTP_RTCP_FMT_TRANSPORT_WIDE_CC 15
312 
313 /*!
314  * \since 12
315  * \brief A report block within a SR/RR report */
317  unsigned int source_ssrc; /*< The SSRC of the source for this report block */
318  struct {
319  unsigned short fraction; /*< The fraction of packets lost since last SR/RR */
320  unsigned int packets; /*< The cumulative packets since the beginning */
321  } lost_count; /*< Statistics regarding missed packets */
322  unsigned int highest_seq_no; /*< Extended highest sequence number received */
323  unsigned int ia_jitter; /*< Calculated interarrival jitter */
324  unsigned int lsr; /*< The time the last SR report was received */
325  unsigned int dlsr; /*< Delay in sending this report */
326 };
327 
328 /*!
329  * \since 12
330  * \brief An object that represents data sent during a SR/RR RTCP report */
332  unsigned short reception_report_count; /*< The number of report blocks */
333  unsigned int ssrc; /*< Our SSRC */
334  unsigned int type; /*< The type of report. 200=SR; 201=RR */
335  struct {
336  struct timeval ntp_timestamp; /*< Our NTP timestamp */
337  unsigned int rtp_timestamp; /*< Our last RTP timestamp */
338  unsigned int packet_count; /*< Number of packets sent */
339  unsigned int octet_count; /*< Number of bytes sent */
340  } sender_information; /*< Sender information for SR */
341  /*! A dynamic array of report blocks. The number of elements is given by
342  * \c reception_report_count.
343  */
345 };
346 
347 /*!
348  * \since 15.4.0
349  * \brief A REMB feedback message (see draft-alvestrand-rmcat-remb-03 for details) */
351  unsigned int br_exp; /*!< Exponential scaling of the mantissa for the maximum total media bit rate value */
352  unsigned int br_mantissa; /*!< The mantissa of the maximum total media bit rate */
353 };
354 
355 /*!
356  * \since 15.4.0
357  * \brief An object that represents data received in a feedback report */
359  unsigned int fmt; /*!< The feedback message type */
360  union {
361  struct ast_rtp_rtcp_feedback_remb remb; /*!< REMB feedback information */
362  };
363 };
364 
365 /*! Structure that represents statistics from an RTP instance */
367  /*! Number of packets transmitted */
368  unsigned int txcount;
369  /*! Number of packets received */
370  unsigned int rxcount;
371  /*! Jitter on transmitted packets */
372  double txjitter;
373  /*! Jitter on received packets */
374  double rxjitter;
375  /*! Maximum jitter on remote side */
377  /*! Minimum jitter on remote side */
379  /*! Average jitter on remote side */
381  /*! Standard deviation jitter on remote side */
383  /*! Maximum jitter on local side */
385  /*! Minimum jitter on local side */
387  /*! Average jitter on local side */
389  /*! Standard deviation jitter on local side */
391  /*! Number of transmitted packets lost */
392  unsigned int txploss;
393  /*! Number of received packets lost */
394  unsigned int rxploss;
395  /*! Maximum number of packets lost on remote side */
397  /*! Minimum number of packets lost on remote side */
399  /*! Average number of packets lost on remote side */
401  /*! Standard deviation packets lost on remote side */
403  /*! Maximum number of packets lost on local side */
405  /*! Minimum number of packets lost on local side */
407  /*! Average number of packets lost on local side */
409  /*! Standard deviation packets lost on local side */
411  /*! Total round trip time */
412  double rtt;
413  /*! Maximum round trip time */
414  double maxrtt;
415  /*! Minimum round trip time */
416  double minrtt;
417  /*! Average round trip time */
418  double normdevrtt;
419  /*! Standard deviation round trip time */
420  double stdevrtt;
421  /*! Our SSRC */
422  unsigned int local_ssrc;
423  /*! Their SSRC */
424  unsigned int remote_ssrc;
425  /*! The Asterisk channel's unique ID that owns this instance */
427  /*! Number of octets transmitted */
428  unsigned int txoctetcount;
429  /*! Number of octets received */
430  unsigned int rxoctetcount;
431 };
432 
433 #define AST_RTP_STAT_SET(current_stat, combined, placement, value) \
434 if (stat == current_stat || stat == AST_RTP_INSTANCE_STAT_ALL || (combined >= 0 && combined == stat)) { \
435 placement = value; \
436 if (stat == current_stat) { \
437 return 0; \
438 } \
439 }
440 
441 #define AST_RTP_STAT_STRCPY(current_stat, combined, placement, value) \
442 if (stat == current_stat || stat == AST_RTP_INSTANCE_STAT_ALL || (combined >= 0 && combined == stat)) { \
443  ast_copy_string(placement, value, sizeof(placement)); \
444  if (stat == current_stat) { \
445  return 0; \
446  } \
447 }
448 
449 #define AST_RTP_STAT_TERMINATOR(combined) \
450 if (stat == combined) { \
451 return 0; \
452 }
453 
454 /*! \brief ICE candidate types */
456  AST_RTP_ICE_CANDIDATE_TYPE_HOST, /*!< ICE host candidate. A host candidate represents the actual local transport address in the host. */
457  AST_RTP_ICE_CANDIDATE_TYPE_SRFLX, /*!< ICE server reflexive candidate, which represents the public mapped address of the local address. */
458  AST_RTP_ICE_CANDIDATE_TYPE_RELAYED, /*!< ICE relayed candidate, which represents the address allocated in TURN server. */
459 };
460 
461 /*! \brief ICE component types */
465 };
466 
467 /*! \brief ICE role during negotiation */
471 };
472 
473 /*! \brief Structure for an ICE candidate */
475  char *foundation; /*!< Foundation identifier */
476  enum ast_rtp_ice_component_type id; /*!< Component identifier */
477  char *transport; /*!< Transport for the media */
478  int priority; /*!< Priority which is used if multiple candidates can be used */
479  struct ast_sockaddr address; /*!< Address of the candidate */
480  struct ast_sockaddr relay_address; /*!< Relay address for the candidate */
481  enum ast_rtp_ice_candidate_type type; /*!< Type of candidate */
482 };
483 
484 /*! \brief Structure that represents the optional ICE support within an RTP engine */
486  /*! Callback for setting received authentication information */
487  void (*set_authentication)(struct ast_rtp_instance *instance, const char *ufrag, const char *password);
488  /*! Callback for adding a remote candidate */
489  void (*add_remote_candidate)(struct ast_rtp_instance *instance, const struct ast_rtp_engine_ice_candidate *candidate);
490  /*! Callback for starting ICE negotiation */
491  void (*start)(struct ast_rtp_instance *instance);
492  /*! Callback for stopping ICE support */
493  void (*stop)(struct ast_rtp_instance *instance);
494  /*! Callback for getting local username */
495  const char *(*get_ufrag)(struct ast_rtp_instance *instance);
496  /*! Callback for getting local password */
497  const char *(*get_password)(struct ast_rtp_instance *instance);
498  /*! Callback for getting local candidates */
499  struct ao2_container *(*get_local_candidates)(struct ast_rtp_instance *instance);
500  /*! Callback for telling the ICE support that it is talking to an ice-lite implementation */
501  void (*ice_lite)(struct ast_rtp_instance *instance);
502  /*! Callback for changing our role in negotiation */
503  void (*set_role)(struct ast_rtp_instance *instance, enum ast_rtp_ice_role role);
504  /*! Callback for requesting a TURN session */
505  void (*turn_request)(struct ast_rtp_instance *instance, enum ast_rtp_ice_component_type component,
506  enum ast_transport transport, const char *server, unsigned int port,
507  const char *username, const char *password);
508  /*! Callback to alter the number of ICE components on a session */
509  void (*change_components)(struct ast_rtp_instance *instance, int num_components);
510 };
511 
512 /*! \brief DTLS setup types */
514  AST_RTP_DTLS_SETUP_ACTIVE, /*!< Endpoint is willing to inititate connections */
515  AST_RTP_DTLS_SETUP_PASSIVE, /*!< Endpoint is willing to accept connections */
516  AST_RTP_DTLS_SETUP_ACTPASS, /*!< Endpoint is willing to both accept and initiate connections */
517  AST_RTP_DTLS_SETUP_HOLDCONN, /*!< Endpoint does not want the connection to be established right now */
518 };
519 
520 /*! \brief DTLS connection states */
522  AST_RTP_DTLS_CONNECTION_NEW, /*!< Endpoint wants to use a new connection */
523  AST_RTP_DTLS_CONNECTION_EXISTING, /*!< Endpoint wishes to use existing connection */
524 };
525 
526 /*! \brief DTLS fingerprint hashes */
528  AST_RTP_DTLS_HASH_SHA256, /*!< SHA-256 fingerprint hash */
529  AST_RTP_DTLS_HASH_SHA1, /*!< SHA-1 fingerprint hash */
530 };
531 
532 /*! \brief DTLS verification settings */
534  AST_RTP_DTLS_VERIFY_NONE = 0, /*!< Don't verify anything */
535  AST_RTP_DTLS_VERIFY_FINGERPRINT = (1 << 0), /*!< Verify the fingerprint */
536  AST_RTP_DTLS_VERIFY_CERTIFICATE = (1 << 1), /*!< Verify the certificate */
537 };
538 
539 /*!
540  * \brief Known RTP extensions
541  */
543  /*! Per the RFC 0 should not be used, so we treat it as an unsupported extension placeholder */
545  /*! abs-send-time from https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03 */
547  /*! transport-cc from https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions-01 */
549  /*! The maximum number of known RTP extensions */
551 };
552 
553 /*! \brief DTLS configuration structure */
555  unsigned int enabled:1; /*!< Whether DTLS support is enabled or not */
556  unsigned int rekey; /*!< Interval at which to renegotiate and rekey - defaults to 0 (off) */
557  enum ast_rtp_dtls_setup default_setup; /*!< Default setup type to use for outgoing */
558  enum ast_srtp_suite suite; /*!< Crypto suite in use */
559  enum ast_rtp_dtls_hash hash; /*!< Hash to use for fingerprint */
560  enum ast_rtp_dtls_verify verify; /*!< What should be verified */
561  char *certfile; /*!< Certificate file */
562  char *pvtfile; /*!< Private key file */
563  char *cipher; /*!< Cipher to use */
564  char *cafile; /*!< Certificate authority file */
565  char *capath; /*!< Path to certificate authority */
566  unsigned int ephemeral_cert:1; /*!< Whether to not to generate an ephemeral certificate - defaults to 0 (off) */
567 };
568 
569 /*! \brief Structure that represents the optional DTLS SRTP support within an RTP engine */
571  /*! Set the configuration of the DTLS support on the instance */
572  int (*set_configuration)(struct ast_rtp_instance *instance, const struct ast_rtp_dtls_cfg *dtls_cfg);
573  /*! Get if the DTLS SRTP support is active or not */
574  int (*active)(struct ast_rtp_instance *instance);
575  /*! Stop and terminate DTLS SRTP support */
576  void (*stop)(struct ast_rtp_instance *instance);
577  /*! Reset the connection and start fresh */
578  void (*reset)(struct ast_rtp_instance *instance);
579  /*! Get the current connection state */
580  enum ast_rtp_dtls_connection (*get_connection)(struct ast_rtp_instance *instance);
581  /*! Get the current setup state */
582  enum ast_rtp_dtls_setup (*get_setup)(struct ast_rtp_instance *instance);
583  /*! Set the remote setup state */
584  void (*set_setup)(struct ast_rtp_instance *instance, enum ast_rtp_dtls_setup setup);
585  /*! Set the remote fingerprint */
586  void (*set_fingerprint)(struct ast_rtp_instance *instance, enum ast_rtp_dtls_hash hash, const char *fingerprint);
587  /*! Get the local fingerprint hash type */
588  enum ast_rtp_dtls_hash (*get_fingerprint_hash)(struct ast_rtp_instance *instance);
589  /*! Get the local fingerprint */
590  const char *(*get_fingerprint)(struct ast_rtp_instance *instance);
591 };
592 
593 #ifdef TEST_FRAMEWORK
594 /*! \brief Structure that represents the test functionality for res_rtp_asterisk unit tests */
595 struct ast_rtp_engine_test {
596  /*! Drops RTP packets while this has a value greater than 0 */
597  int packets_to_drop;
598  /*! Sends a SR/RR instead of RTP the next time RTP would be sent */
599  int send_report;
600  /*! Set to 1 whenever SDES is received */
601  int sdes_received;
602  /*! Get the number of packets in the receive buffer for a RTP instance */
603  size_t (*recv_buffer_count)(struct ast_rtp_instance *instance);
604  /*! Get the maximum number of packets the receive buffer can hold for a RTP instance */
605  size_t (*recv_buffer_max)(struct ast_rtp_instance *instance);
606  /*! Get the number of packets in the send buffer for a RTP instance */
607  size_t (*send_buffer_count)(struct ast_rtp_instance *instance);
608  /*! Set the schedid for RTCP */
609  void (*set_schedid)(struct ast_rtp_instance *instance, int id);
610 };
611 #endif
612 
613 /*! Structure that represents an RTP stack (engine) */
615  /*! Name of the RTP engine, used when explicitly requested */
616  const char *name;
617  /*! Module this RTP engine came from, used for reference counting */
618  struct ast_module *mod;
619  /*! Callback for setting up a new RTP instance */
620  int (*new)(struct ast_rtp_instance *instance, struct ast_sched_context *sched, struct ast_sockaddr *sa, void *data);
621  /*! Callback for destroying an RTP instance */
622  int (*destroy)(struct ast_rtp_instance *instance);
623  /*! Callback for writing out a frame */
624  int (*write)(struct ast_rtp_instance *instance, struct ast_frame *frame);
625  /*! Callback for stopping the RTP instance */
626  void (*stop)(struct ast_rtp_instance *instance);
627  /*! Callback for starting RFC2833 DTMF transmission */
628  int (*dtmf_begin)(struct ast_rtp_instance *instance, char digit);
629  /*! Callback for stopping RFC2833 DTMF transmission */
630  int (*dtmf_end)(struct ast_rtp_instance *instance, char digit);
631  int (*dtmf_end_with_duration)(struct ast_rtp_instance *instance, char digit, unsigned int duration);
632  /*! Callback to indicate that we should update the marker bit */
633  void (*update_source)(struct ast_rtp_instance *instance);
634  /*! Callback to indicate that we should update the marker bit and ssrc */
635  void (*change_source)(struct ast_rtp_instance *instance);
636  /*! Callback for setting an extended RTP property */
637  int (*extended_prop_set)(struct ast_rtp_instance *instance, int property, void *value);
638  /*! Callback for getting an extended RTP property */
639  void *(*extended_prop_get)(struct ast_rtp_instance *instance, int property);
640  /*! Callback for setting an RTP property */
641  void (*prop_set)(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
642  /*! Callback for setting a payload. If asterisk is to be used, asterisk_format will be set, otherwise value in code is used. */
643  void (*payload_set)(struct ast_rtp_instance *instance, int payload, int asterisk_format, struct ast_format *format, int code);
644  /*! Callback for setting the remote address that RTP is to be sent to */
645  void (*remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa);
646  /*! Callback for changing DTMF mode */
647  int (*dtmf_mode_set)(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode);
648  /*! Callback for getting DTMF mode */
649  enum ast_rtp_dtmf_mode (*dtmf_mode_get)(struct ast_rtp_instance *instance);
650  /*! Callback for retrieving statistics */
651  int (*get_stat)(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat);
652  /*! Callback for setting QoS values */
653  int (*qos)(struct ast_rtp_instance *instance, int tos, int cos, const char *desc);
654  /*! Callback for retrieving a file descriptor to poll on, not always required */
655  int (*fd)(struct ast_rtp_instance *instance, int rtcp);
656  /*! Callback for initializing RED support */
657  int (*red_init)(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations);
658  /*! Callback for buffering a frame using RED */
659  int (*red_buffer)(struct ast_rtp_instance *instance, struct ast_frame *frame);
660  /*! Callback for reading a frame from the RTP engine */
661  struct ast_frame *(*read)(struct ast_rtp_instance *instance, int rtcp);
662  /*! Callback to locally bridge two RTP instances */
663  int (*local_bridge)(struct ast_rtp_instance *instance0, struct ast_rtp_instance *instance1);
664  /*! Callback to set the read format */
665  int (*set_read_format)(struct ast_rtp_instance *instance, struct ast_format *format);
666  /*! Callback to set the write format */
667  int (*set_write_format)(struct ast_rtp_instance *instance, struct ast_format *format);
668  /*! Callback to make two instances compatible */
669  int (*make_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1);
670  /*! Callback to see if two instances are compatible with DTMF */
671  int (*dtmf_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1);
672  /*! Callback to indicate that packets will now flow */
673  int (*activate)(struct ast_rtp_instance *instance);
674  /*! Callback to request that the RTP engine send a STUN BIND request */
675  void (*stun_request)(struct ast_rtp_instance *instance, struct ast_sockaddr *suggestion, const char *username);
676  /*! Callback to get the transcodeable formats supported. result returned in ast_format_cap *result */
677  void (*available_formats)(struct ast_rtp_instance *instance, struct ast_format_cap *to_endpoint, struct ast_format_cap *to_asterisk, struct ast_format_cap *result);
678  /*! Callback to send CNG */
679  int (*sendcng)(struct ast_rtp_instance *instance, int level);
680  /*! Callback to retrieve local SSRC */
681  unsigned int (*ssrc_get)(struct ast_rtp_instance *instance);
682  /*! Callback to retrieve RTCP SDES CNAME */
683  const char *(*cname_get)(struct ast_rtp_instance *instance);
684  /*! Callback to bundle an RTP instance to another */
685  int (*bundle)(struct ast_rtp_instance *child, struct ast_rtp_instance *parent);
686  /*! Callback to set remote SSRC information */
687  void (*set_remote_ssrc)(struct ast_rtp_instance *instance, unsigned int ssrc);
688  /*! Callback to set the stream identifier */
689  void (*set_stream_num)(struct ast_rtp_instance *instance, int stream_num);
690  /*! Callback to pointer for optional ICE support */
692  /*! Callback to pointer for optional DTLS SRTP support */
694 #ifdef TEST_FRAMEWORK
695  /*! Callback to pointer for test callbacks for RTP/RTCP unit tests */
696  struct ast_rtp_engine_test *test;
697 #endif
698  /*! Callback to enable an RTP extension (returns non-zero if supported) */
700  /*! Linked list information */
702 };
703 
704 /*! Structure that represents codec and packetization information */
706  /*! RW lock that protects elements in this structure */
708  /*! Rx payload type mapping exceptions */
710  /*! Tx payload type mapping */
712  /*! The framing for this media session */
713  unsigned int framing;
714 };
715 
716 #define AST_RTP_CODECS_NULL_INIT \
717  { .codecs_lock = AST_RWLOCK_INIT_VALUE, .payload_mapping_rx = { 0, }, .payload_mapping_tx = { 0, }, .framing = 0, }
718 
719 /*! Structure that represents the glue that binds an RTP instance to a channel */
720 struct ast_rtp_glue {
721  /*! Name of the channel driver that this glue is responsible for */
722  const char *type;
723  /*! Module that the RTP glue came from */
724  struct ast_module *mod;
725  /*!
726  * \brief Callback for retrieving the RTP instance carrying audio
727  * \note This function increases the reference count on the returned RTP instance.
728  */
729  enum ast_rtp_glue_result (*get_rtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
730  /*!
731  * \brief Used to prevent two channels from remotely bridging audio rtp if the channel tech has a
732  * reason for prohibiting it based on qualities that need to be compared from both channels.
733  * \note This function may be NULL for a given channel driver. This should be accounted for and if that is the case, this function is not used.
734  */
735  int (*allow_rtp_remote)(struct ast_channel *chan1, struct ast_rtp_instance *instance);
736  /*!
737  * \brief Callback for retrieving the RTP instance carrying video
738  * \note This function increases the reference count on the returned RTP instance.
739  * \note This function may be NULL for a given channel driver. This should be accounted for and if that is the case, this function is not used.
740  */
741  enum ast_rtp_glue_result (*get_vrtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
742  /*!
743  * \brief Used to prevent two channels from remotely bridging video rtp if the channel tech has a
744  * reason for prohibiting it based on qualities that need to be compared from both channels.
745  * \note This function may be NULL for a given channel driver. This should be accounted for and if that is the case, this function is not used.
746  */
747  int (*allow_vrtp_remote)(struct ast_channel *chan1, struct ast_rtp_instance *instance);
748 
749  /*!
750  * \brief Callback for retrieving the RTP instance carrying text
751  * \note This function increases the reference count on the returned RTP instance.
752  * \note This function may be NULL for a given channel driver. This should be accounted for and if that is the case, this function is not used.
753  */
754  enum ast_rtp_glue_result (*get_trtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
755  /*! Callback for updating the destination that the remote side should send RTP to */
756  int (*update_peer)(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, const struct ast_format_cap *cap, int nat_active);
757  /*!
758  * \brief Callback for retrieving codecs that the channel can do. Result returned in result_cap.
759  * \note This function may be NULL for a given channel driver. This should be accounted for and if that is the case, this function is not used.
760  */
761  void (*get_codec)(struct ast_channel *chan, struct ast_format_cap *result_cap);
762  /*! Linked list information */
764 };
765 
766 /*!
767  * \brief Directions for RTP extensions
768  */
770  /*! The extension is not negotiated and is not flowing */
772  /*! Send and receive */
774  /*! Send only */
776  /*! Receive only */
778  /*! Negotiated but not sending or receiving */
780 };
781 
782 /*!
783  * \brief Allocation routine for \ref ast_rtp_payload_type
784  *
785  * \retval NULL on error
786  * \return An ao2 ref counted \c ast_rtp_payload_type on success.
787  *
788  * \note The \c ast_rtp_payload_type returned by this function is an
789  * ao2 ref counted object.
790  *
791  */
793 
794 #define ast_rtp_engine_register(engine) ast_rtp_engine_register2(engine, AST_MODULE_SELF)
795 
796 /*!
797  * \brief Register an RTP engine
798  *
799  * \param engine Structure of the RTP engine to register
800  * \param module Module that the RTP engine is part of
801  *
802  * \retval 0 success
803  * \retval -1 failure
804  *
805  * Example usage:
806  *
807  * \code
808  * ast_rtp_engine_register2(&example_rtp_engine, NULL);
809  * \endcode
810  *
811  * This registers the RTP engine declared as example_rtp_engine with the RTP engine core, but does not
812  * associate a module with it.
813  *
814  * \note It is recommended that you use the ast_rtp_engine_register macro so that the module is
815  * associated with the RTP engine and use counting is performed.
816  *
817  * \since 1.8
818  */
819 int ast_rtp_engine_register2(struct ast_rtp_engine *engine, struct ast_module *module);
820 
821 /*!
822  * \brief Unregister an RTP engine
823  *
824  * \param engine Structure of the RTP engine to unregister
825  *
826  * \retval 0 success
827  * \retval -1 failure
828  *
829  * Example usage:
830  *
831  * \code
832  * ast_rtp_engine_unregister(&example_rtp_engine);
833  * \endcode
834  *
835  * This unregisters the RTP engine declared as example_rtp_engine from the RTP engine core. If a module
836  * reference was provided when it was registered then this will only be called once the RTP engine is no longer in use.
837  *
838  * \since 1.8
839  */
840 int ast_rtp_engine_unregister(struct ast_rtp_engine *engine);
841 
843 
846 
847 #define ast_rtp_glue_register(glue) ast_rtp_glue_register2(glue, AST_MODULE_SELF)
848 
849 /*!
850  * \brief Register RTP glue
851  *
852  * \param glue The glue to register
853  * \param module Module that the RTP glue is part of
854  *
855  * \retval 0 success
856  * \retval -1 failure
857  *
858  * Example usage:
859  *
860  * \code
861  * ast_rtp_glue_register2(&example_rtp_glue, NULL);
862  * \endcode
863  *
864  * This registers the RTP glue declared as example_rtp_glue with the RTP engine core, but does not
865  * associate a module with it.
866  *
867  * \note It is recommended that you use the ast_rtp_glue_register macro so that the module is
868  * associated with the RTP glue and use counting is performed.
869  *
870  * \since 1.8
871  */
872 int ast_rtp_glue_register2(struct ast_rtp_glue *glue, struct ast_module *module);
873 
874 /*!
875  * \brief Unregister RTP glue
876  *
877  * \param glue The glue to unregister
878  *
879  * \retval 0 success
880  * \retval -1 failure
881  *
882  * Example usage:
883  *
884  * \code
885  * ast_rtp_glue_unregister(&example_rtp_glue);
886  * \endcode
887  *
888  * This unregisters the RTP glue declared as example_rtp_gkue from the RTP engine core. If a module
889  * reference was provided when it was registered then this will only be called once the RTP engine is no longer in use.
890  *
891  * \since 1.8
892  */
893 int ast_rtp_glue_unregister(struct ast_rtp_glue *glue);
894 
895 /*!
896  * \brief Create a new RTP instance
897  *
898  * \param engine_name Name of the engine to use for the RTP instance
899  * \param sched Scheduler context that the RTP engine may want to use
900  * \param sa Address we want to bind to
901  * \param data Unique data for the engine
902  *
903  * \retval non-NULL success
904  * \retval NULL failure
905  *
906  * Example usage:
907  *
908  * \code
909  * struct ast_rtp_instance *instance = NULL;
910  * instance = ast_rtp_instance_new(NULL, sched, &sin, NULL);
911  * \endcode
912  *
913  * This creates a new RTP instance using the default engine and asks the RTP engine to bind to the address given
914  * in the address structure.
915  *
916  * \note The RTP engine does not have to use the address provided when creating an RTP instance. It may choose to use
917  * another depending on it's own configuration.
918  *
919  * \since 1.8
920  */
921 struct ast_rtp_instance *ast_rtp_instance_new(const char *engine_name,
922  struct ast_sched_context *sched, const struct ast_sockaddr *sa,
923  void *data);
924 
925 /*!
926  * \brief Destroy an RTP instance
927  *
928  * \param instance The RTP instance to destroy
929  *
930  * \retval 0 success
931  * \retval -1 failure
932  *
933  * Example usage:
934  *
935  * \code
936  * ast_rtp_instance_destroy(instance);
937  * \endcode
938  *
939  * This destroys the RTP instance pointed to by instance. Once this function returns instance no longer points to valid
940  * memory and may not be used again.
941  *
942  * \since 1.8
943  */
944 int ast_rtp_instance_destroy(struct ast_rtp_instance *instance);
945 
946 /*!
947  * \brief Set the data portion of an RTP instance
948  *
949  * \param instance The RTP instance to manipulate
950  * \param data Pointer to data
951  *
952  * Example usage:
953  *
954  * \code
955  * ast_rtp_instance_set_data(instance, blob);
956  * \endcode
957  *
958  * This sets the data pointer on the RTP instance pointed to by 'instance' to
959  * blob.
960  *
961  * \since 1.8
962  */
963 void ast_rtp_instance_set_data(struct ast_rtp_instance *instance, void *data);
964 
965 /*!
966  * \brief Get the data portion of an RTP instance
967  *
968  * \param instance The RTP instance we want the data portion from
969  *
970  * Example usage:
971  *
972  * \code
973  * struct *blob = ast_rtp_instance_get_data(instance);
974  ( \endcode
975  *
976  * This gets the data pointer on the RTP instance pointed to by 'instance'.
977  *
978  * \since 1.8
979  */
980 void *ast_rtp_instance_get_data(struct ast_rtp_instance *instance);
981 
982 /*!
983  * \brief Send a frame out over RTP
984  *
985  * \param instance The RTP instance to send frame out on
986  * \param frame the frame to send out
987  *
988  * \retval 0 success
989  * \retval -1 failure
990  *
991  * Example usage:
992  *
993  * \code
994  * ast_rtp_instance_write(instance, frame);
995  * \endcode
996  *
997  * This gives the frame pointed to by frame to the RTP engine being used for the instance
998  * and asks that it be transmitted to the current remote address set on the RTP instance.
999  *
1000  * \since 1.8
1001  */
1002 int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame);
1003 
1004 /*!
1005  * \brief Receive a frame over RTP
1006  *
1007  * \param instance The RTP instance to receive frame on
1008  * \param rtcp Whether to read in RTCP or not
1009  *
1010  * \retval non-NULL success
1011  * \retval NULL failure
1012  *
1013  * Example usage:
1014  *
1015  * \code
1016  * struct ast_frame *frame;
1017  * frame = ast_rtp_instance_read(instance, 0);
1018  * \endcode
1019  *
1020  * This asks the RTP engine to read in RTP from the instance and return it as an Asterisk frame.
1021  *
1022  * \since 1.8
1023  */
1024 struct ast_frame *ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp);
1025 
1026 /*!
1027  * \brief Set the incoming source address of the remote endpoint that we are sending RTP to
1028  *
1029  * This sets the incoming source address the engine is sending RTP to. Usually this
1030  * will be the same as the requested target address, however in the case where
1031  * the engine "learns" the address (for instance, symmetric RTP enabled) this
1032  * will then contain the learned address.
1033  *
1034  * \param instance The RTP instance to change the address on
1035  * \param address Address to set it to
1036  *
1037  * \retval 0 success
1038  * \retval -1 failure
1039  */
1041  const struct ast_sockaddr *address);
1042 
1043 /*!
1044  * \brief Set the requested target address of the remote endpoint
1045  *
1046  * This should always be the address of the remote endpoint. Consequently, this can differ
1047  * from the address the engine is sending RTP to. However, usually they will be the same
1048  * except in some circumstances (for instance when the engine "learns" the address if
1049  * symmetric RTP is enabled).
1050  *
1051  * \param instance The RTP instance to change the address on
1052  * \param address Address to set it to
1053  *
1054  * \retval 0 success
1055  * \retval -1 failure
1056  */
1058  const struct ast_sockaddr *address);
1059 
1060 /*!
1061  * \brief Set the address of the remote endpoint that we are sending RTP to
1062  *
1063  * \param instance The RTP instance to change the address on
1064  * \param address Address to set it to
1065  *
1066  * \retval 0 success
1067  * \retval -1 failure
1068  *
1069  * Example usage:
1070  *
1071  * \code
1072  * ast_rtp_instance_set_remote_address(instance, &sin);
1073  * \endcode
1074  *
1075  * This changes the remote address that RTP will be sent to on instance to the address given in the sin
1076  * structure.
1077  *
1078  * \since 1.8
1079  */
1080 #define ast_rtp_instance_set_remote_address(instance, address) \
1081  ast_rtp_instance_set_requested_target_address((instance), (address))
1082 
1083 /*!
1084  * \brief Set the address that we are expecting to receive RTP on
1085  *
1086  * \param instance The RTP instance to change the address on
1087  * \param address Address to set it to
1088  *
1089  * \retval 0 success
1090  * \retval -1 failure
1091  *
1092  * Example usage:
1093  *
1094  * \code
1095  * ast_rtp_instance_set_local_address(instance, &sin);
1096  * \endcode
1097  *
1098  * This changes the local address that RTP is expected on to the address given in the sin
1099  * structure.
1100  *
1101  * \since 1.8
1102  */
1104  const struct ast_sockaddr *address);
1105 
1106 /*!
1107  * \brief Get the local address that we are expecting RTP on
1108  *
1109  * \param instance The RTP instance to get the address from
1110  * \param address The variable to store the address in
1111  *
1112  * Example usage:
1113  *
1114  * \code
1115  * struct ast_sockaddr address;
1116  * ast_rtp_instance_get_local_address(instance, &address);
1117  * \endcode
1118  *
1119  * This gets the local address that we are expecting RTP on and stores it in the 'address' structure.
1120  *
1121  * \since 1.8
1122  */
1124 
1125 /*!
1126  * \brief Get the address of the local endpoint that we are sending RTP to, comparing its address to another
1127  *
1128  * \param instance The instance that we want to get the local address for
1129  * \param address An initialized address that may be overwritten if the local address is different
1130  *
1131  * \retval 0 address was not changed
1132  * \retval 1 address was changed
1133  * Example usage:
1134  *
1135  * \code
1136  * struct ast_sockaddr address;
1137  * int ret;
1138  * ret = ast_rtp_instance_get_and_cmp_local_address(instance, &address);
1139  * \endcode
1140  *
1141  * This retrieves the current local address set on the instance pointed to by instance and puts the value
1142  * into the address structure.
1143  *
1144  * \since 1.8
1145  */
1147 
1148 /*!
1149  * \brief Get the incoming source address of the remote endpoint
1150  *
1151  * This returns the remote address the engine is sending RTP to. Usually this
1152  * will be the same as the requested target address, however in the case where
1153  * the engine "learns" the address (for instance, symmetric RTP enabled) this
1154  * will then contain the learned address.
1155  *
1156  * \param instance The instance that we want to get the incoming source address for
1157  * \param address A structure to put the address into
1158  */
1160 
1161 /*!
1162  * \brief Get the requested target address of the remote endpoint
1163  *
1164  * This returns the explicitly set address of a remote endpoint. Meaning this won't change unless
1165  * specifically told to change. In most cases this should be the same as the incoming source
1166  * address, except in cases where the engine "learns" the address in which case this and the
1167  * incoming source address might differ.
1168  *
1169  * \param instance The instance that we want to get the requested target address for
1170  * \param address A structure to put the address into
1171  */
1173 
1174 /*!
1175  * \brief Get the address of the remote endpoint that we are sending RTP to
1176  *
1177  * \param instance The instance that we want to get the remote address for
1178  * \param address A structure to put the address into
1179  *
1180  * Example usage:
1181  *
1182  * \code
1183  * struct ast_sockaddr address;
1184  * ast_rtp_instance_get_remote_address(instance, &address);
1185  * \endcode
1186  *
1187  * This retrieves the current remote address set on the instance pointed to by instance and puts the value
1188  * into the address structure.
1189  *
1190  * \since 1.8
1191  */
1192 #define ast_rtp_instance_get_remote_address(instance, address) \
1193  ast_rtp_instance_get_incoming_source_address((instance), (address))
1194 
1195 /*!
1196  * \brief Get the requested target address of the remote endpoint and
1197  * compare it to the given address
1198  *
1199  * \param instance The instance that we want to get the remote address for
1200  * \param address An initialized address that may be overwritten addresses differ
1201  *
1202  * \retval 0 address was not changed
1203  * \retval 1 address was changed
1204  */
1206 
1207 /*!
1208  * \brief Get the address of the remote endpoint that we are sending RTP to, comparing its address to another
1209  *
1210  * \param instance The instance that we want to get the remote address for
1211  * \param address An initialized address that may be overwritten if the remote address is different
1212  *
1213  * \retval 0 address was not changed
1214  * \retval 1 address was changed
1215  * Example usage:
1216  *
1217  * \code
1218  * struct ast_sockaddr address;
1219  * int ret;
1220  * ret = ast_rtp_instance_get_and_cmp_remote_address(instance, &address);
1221  * \endcode
1222  *
1223  * This retrieves the current remote address set on the instance pointed to by instance and puts the value
1224  * into the address structure.
1225  *
1226  * \since 1.8
1227  */
1228 #define ast_rtp_instance_get_and_cmp_remote_address(instance, address) \
1229  ast_rtp_instance_get_and_cmp_requested_target_address((instance), (address))
1230 
1231 /*!
1232  * \brief Set the value of an RTP instance extended property
1233  *
1234  * \param instance The RTP instance to set the extended property on
1235  * \param property The extended property to set
1236  * \param value The value to set the extended property to
1237  *
1238  * \since 1.8
1239  */
1240 void ast_rtp_instance_set_extended_prop(struct ast_rtp_instance *instance, int property, void *value);
1241 
1242 /*!
1243  * \brief Get the value of an RTP instance extended property
1244  *
1245  * \param instance The RTP instance to get the extended property on
1246  * \param property The extended property to get
1247  *
1248  * \since 1.8
1249  */
1250 void *ast_rtp_instance_get_extended_prop(struct ast_rtp_instance *instance, int property);
1251 
1252 /*!
1253  * \brief Set the value of an RTP instance property
1254  *
1255  * \param instance The RTP instance to set the property on
1256  * \param property The property to modify
1257  * \param value The value to set the property to
1258  *
1259  * Example usage:
1260  *
1261  * \code
1262  * ast_rtp_instance_set_prop(instance, AST_RTP_PROPERTY_NAT, 1);
1263  * \endcode
1264  *
1265  * This enables the AST_RTP_PROPERTY_NAT property on the instance pointed to by instance.
1266  *
1267  * \since 1.8
1268  */
1269 void ast_rtp_instance_set_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
1270 
1271 /*!
1272  * \brief Get the value of an RTP instance property
1273  *
1274  * \param instance The RTP instance to get the property from
1275  * \param property The property to get
1276  *
1277  * \return Current value of the property
1278  *
1279  * Example usage:
1280  *
1281  * \code
1282  * ast_rtp_instance_get_prop(instance, AST_RTP_PROPERTY_NAT);
1283  * \endcode
1284  *
1285  * This returns the current value of the NAT property on the instance pointed to by instance.
1286  *
1287  * \since 1.8
1288  */
1289 int ast_rtp_instance_get_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property);
1290 
1291 /*!
1292  * \brief Get the codecs structure of an RTP instance
1293  *
1294  * \param instance The RTP instance to get the codecs structure from
1295  *
1296  * Example usage:
1297  *
1298  * \code
1299  * struct ast_rtp_codecs *codecs = ast_rtp_instance_get_codecs(instance);
1300  * \endcode
1301  *
1302  * This gets the codecs structure on the RTP instance pointed to by 'instance'.
1303  *
1304  * \since 1.8
1305  */
1307 
1308 /*!
1309  * \brief Enable support for an RTP extension on an instance
1310  *
1311  * \param instance The RTP instance to enable the extension on
1312  * \param id The unique local identifier to use for this extension (-1 to have one auto selected)
1313  * \param extension The RTP extension
1314  * \param direction The initial direction that the RTP extension should be used in
1315  *
1316  * \retval 0 success
1317  * \retval -1 failure
1318  *
1319  * \since 15.5.0
1320  */
1323 
1324 /*!
1325  * \brief Negotiate received RTP extension information
1326  *
1327  * \param instance The RTP instance to set the extension on
1328  * \param id The local identifier for the extension
1329  * \param direction The direction that the extension should be used in
1330  * \param uri The unique URI for the extension
1331  * \param attributes Attributes specific to this extension (if NULL or empty then no attributes)
1332  *
1333  * \retval 0 success
1334  * \retval -1 failure
1335  *
1336  * \since 15.5.0
1337  */
1339  const char *uri, const char *attributes);
1340 
1341 /*!
1342  * \brief Clear negotiated RTP extension information
1343  *
1344  * \param instance The RTP instance to clear negotiated extension information on
1345  */
1346 void ast_rtp_instance_extmap_clear(struct ast_rtp_instance *instance);
1347 
1348 /*!
1349  * \brief Retrieve the id for an RTP extension
1350  *
1351  * \param instance The RTP instance to retrieve the id from
1352  * \param extension The RTP extension
1353  *
1354  * \retval -1 not negotiated
1355  * \retval id if negotiated
1356  *
1357  * \since 15.5.0
1358  */
1360 
1361 /*!
1362  * \brief Get the number of known unique identifiers
1363  *
1364  * \param instance The RTP instance to retrieve the count from
1365  *
1366  * \return the number of known unique identifiers
1367  *
1368  * \since 15.5.0
1369  */
1370 size_t ast_rtp_instance_extmap_count(struct ast_rtp_instance *instance);
1371 
1372 /*!
1373  * \brief Retrieve the extension for an RTP extension id
1374  *
1375  * \param instance The RTP instance to retrieve the extension from
1376  * \param id The negotiated RTP extension id
1377  *
1378  * \return extension the extension that maps to the id
1379  *
1380  * \since 15.5.0
1381  *
1382  * \note This will return AST_RTP_EXTENSION_UNSUPPORTED if an extension was proposed for this unique identifier
1383  * but it is not supported or if the unique identifier is unused.
1384  */
1386 
1387 /*!
1388  * \brief Retrieve the negotiated direction for an RTP extension id
1389  *
1390  * \param instance The RTP instance to retrieve the direction from
1391  * \param id The negotiated RTP extension id
1392  *
1393  * \return direction the direction that has been negotiated
1394  *
1395  * \since 15.5.0
1396  */
1398 
1399 /*!
1400  * \brief Retrieve the URI for an RTP extension id
1401  *
1402  * \param instance The RTP instance to retrieve the direction from
1403  * \param id The negotiated RTP extension id
1404  *
1405  * \return The URI for the RTP extension
1406  *
1407  * \since 15.5.0
1408  */
1409 const char *ast_rtp_instance_extmap_get_uri(struct ast_rtp_instance *instance, int id);
1410 
1411 /*!
1412  * \brief Initialize an RTP codecs structure
1413  *
1414  * \param codecs The codecs structure to initialize
1415  *
1416  * \retval 0 success
1417  * \retval -1 failure
1418  *
1419  * Example usage:
1420  *
1421  * \code
1422  * struct ast_rtp_codecs codecs;
1423  * ast_rtp_codecs_payloads_initialize(&codecs);
1424  * \endcode
1425  *
1426  * \since 11
1427  */
1429 
1430 /*!
1431  * \brief Destroy the contents of an RTP codecs structure (but not the structure itself)
1432  *
1433  * \param codecs The codecs structure to destroy the contents of
1434  *
1435  * Example usage:
1436  *
1437  * \code
1438  * struct ast_rtp_codecs codecs;
1439  * ast_rtp_codecs_payloads_destroy(&codecs);
1440  * \endcode
1441  *
1442  * \since 11
1443  */
1445 
1446 /*!
1447  * \brief Clear rx and tx payload mapping information from an RTP instance
1448  *
1449  * \param codecs The codecs structure that payloads will be cleared from
1450  * \param instance Optionally the instance that the codecs structure belongs to
1451  *
1452  * Example usage:
1453  *
1454  * \code
1455  * struct ast_rtp_codecs codecs;
1456  * ast_rtp_codecs_payloads_clear(&codecs, NULL);
1457  * \endcode
1458  *
1459  * This clears the codecs structure and puts it into a pristine state.
1460  *
1461  * \since 1.8
1462  */
1464 
1465 /*!
1466  * \brief Copy payload information from one RTP instance to another
1467  *
1468  * \param src The source codecs structure
1469  * \param dest The destination codecs structure that the values from src will be copied to
1470  * \param instance Optionally the instance that the dst codecs structure belongs to
1471  *
1472  * Example usage:
1473  *
1474  * \code
1475  * ast_rtp_codecs_payloads_copy(&codecs0, &codecs1, NULL);
1476  * \endcode
1477  *
1478  * This copies the payloads from the codecs0 structure to the codecs1 structure, overwriting any current values.
1479  *
1480  * \since 1.8
1481  */
1482 void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance);
1483 
1484 /*!
1485  * \brief Crossover copy the tx payload mapping of src to the rx payload mapping of dest.
1486  * \since 14.0.0
1487  *
1488  * \param src The source codecs structure
1489  * \param dest The destination codecs structure that the values from src will be copied to
1490  * \param instance Optionally the instance that the dst codecs structure belongs to
1491  */
1492 void ast_rtp_codecs_payloads_xover(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance);
1493 
1494 /*!
1495  * \brief Record tx payload type information that was seen in an m= SDP line
1496  *
1497  * \param codecs The codecs structure to muck with
1498  * \param instance Optionally the instance that the codecs structure belongs to
1499  * \param payload Numerical payload that was seen in the m= SDP line
1500  *
1501  * Example usage:
1502  *
1503  * \code
1504  * ast_rtp_codecs_payloads_set_m_type(&codecs, NULL, 0);
1505  * \endcode
1506  *
1507  * This records that the numerical payload '0' was seen in the codecs structure.
1508  *
1509  * \since 1.8
1510  */
1511 void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload);
1512 
1513 /*!
1514  * \brief Record tx payload type information that was seen in an a=rtpmap: SDP line
1515  *
1516  * \param codecs The codecs structure to muck with
1517  * \param instance Optionally the instance that the codecs structure belongs to
1518  * \param payload Numerical payload that was seen in the a=rtpmap: SDP line
1519  * \param mimetype The string mime type that was seen
1520  * \param mimesubtype The string mime sub type that was seen
1521  * \param options Optional options that may change the behavior of this specific payload
1522  *
1523  * \retval 0 success
1524  * \retval -1 failure, invalid payload numbe
1525  * \retval -2 failure, unknown mimetype
1526  *
1527  * Example usage:
1528  *
1529  * \code
1530  * ast_rtp_codecs_payloads_set_rtpmap_type(&codecs, NULL, 0, "audio", "PCMU", 0);
1531  * \endcode
1532  *
1533  * This records that the numerical payload '0' was seen with mime type 'audio' and sub mime type 'PCMU' in the codecs structure.
1534  *
1535  * \since 1.8
1536  */
1537 int ast_rtp_codecs_payloads_set_rtpmap_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload, char *mimetype, char *mimesubtype, enum ast_rtp_options options);
1538 
1539 /*!
1540  * \brief Set tx payload type to a known MIME media type for a codec with a specific sample rate
1541  *
1542  * \param codecs RTP structure to modify
1543  * \param instance Optionally the instance that the codecs structure belongs to
1544  * \param pt Payload type entry to modify
1545  * \param mimetype top-level MIME type of media stream (typically "audio", "video", "text", etc.)
1546  * \param mimesubtype MIME subtype of media stream (typically a codec name)
1547  * \param options Zero or more flags from the ast_rtp_options enum
1548  * \param sample_rate The sample rate of the media stream
1549  *
1550  * This function 'fills in' an entry in the list of possible formats for
1551  * a media stream associated with an RTP structure.
1552  *
1553  * \retval 0 on success
1554  * \retval -1 if the payload type is out of range
1555  * \retval -2 if the mimeType/mimeSubtype combination was not found
1556  *
1557  * \since 1.8
1558  */
1560  char *mimetype, char *mimesubtype,
1561  enum ast_rtp_options options,
1562  unsigned int sample_rate);
1563 
1564 /*!
1565  * \brief Remove tx payload type mapped information
1566  *
1567  * \param codecs The codecs structure to muck with
1568  * \param instance Optionally the instance that the codecs structure belongs to
1569  * \param payload Numerical payload to unset
1570  *
1571  * Example usage:
1572  *
1573  * \code
1574  * ast_rtp_codecs_payloads_unset(&codecs, NULL, 0);
1575  * \endcode
1576  *
1577  * This clears the payload '0' from the codecs structure. It will be as if it was never set.
1578  *
1579  * \since 1.8
1580  */
1581 void ast_rtp_codecs_payloads_unset(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload);
1582 
1583 /*!
1584  * \brief Determine the type of RTP stream media from the codecs mapped.
1585  * \since 13.19.0
1586  *
1587  * \param codecs Codecs structure to look in
1588  *
1589  * \return Media type or AST_MEDIA_TYPE_UNKNOWN if no codecs mapped.
1590  */
1592 
1593 /*!
1594  * \brief Retrieve rx payload mapped information by payload type
1595  *
1596  * \param codecs Codecs structure to look in
1597  * \param payload Numerical payload to look up
1598  *
1599  * \return Payload information.
1600  * \retval NULL if payload does not exist.
1601  *
1602  * \note The payload returned by this function has its reference count increased.
1603  * Callers are responsible for decrementing the reference count.
1604  *
1605  * Example usage:
1606  *
1607  * \code
1608  * struct ast_rtp_payload_type *payload_type;
1609  * payload_type = ast_rtp_codecs_get_payload(&codecs, 0);
1610  * \endcode
1611  *
1612  * This looks up the information for payload '0' from the codecs structure.
1613  */
1615 
1616 /*!
1617  * \brief Update the format associated with a tx payload type in a codecs structure
1618  *
1619  * \param codecs Codecs structure to operate on
1620  * \param payload Numerical payload type to look up
1621  * \param format The format to replace the existing one
1622  *
1623  * \retval 0 success
1624  * \retval -1 failure
1625  *
1626  * \since 13
1627  */
1629 
1630 /*!
1631  * \brief Retrieve the actual ast_format stored on the codecs structure for a specific tx payload type
1632  *
1633  * \param codecs Codecs structure to look in
1634  * \param payload Numerical payload type to look up
1635  *
1636  * \return pointer to format structure on success
1637  * \retval NULL on failure
1638  *
1639  * \note The format returned by this function has its reference count increased.
1640  * Callers are responsible for decrementing the reference count.
1641  *
1642  * \since 10.0
1643  */
1645 
1646 /*!
1647  * \brief Set the framing used for a set of codecs
1648  *
1649  * \param codecs Codecs structure to set framing on
1650  * \param framing The framing value to set on the codecs
1651  *
1652  * \since 13.0.0
1653  */
1654 void ast_rtp_codecs_set_framing(struct ast_rtp_codecs *codecs, unsigned int framing);
1655 
1656 /*!
1657  * \brief Get the framing used for a set of codecs
1658  *
1659  * \param codecs Codecs structure to get the framing from
1660  *
1661  * \return The framing to be used for the media stream associated with these codecs
1662  *
1663  * \since 13.0.0
1664  */
1665 unsigned int ast_rtp_codecs_get_framing(struct ast_rtp_codecs *codecs);
1666 
1667 /*!
1668  * \brief Get the sample rate associated with known RTP payload types
1669  *
1670  * \param asterisk_format True if the value in format is to be used.
1671  * \param format An asterisk format
1672  * \param code from AST_RTP list
1673  *
1674  * \return the sample rate if the format was found, zero if it was not found
1675  *
1676  * \since 1.8
1677  */
1678 unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format,
1679  const struct ast_format *format, int code);
1680 
1681 /*!
1682  * \brief Retrieve all formats that were found
1683  *
1684  * \param codecs Codecs structure to look in
1685  * \param astformats A capabilities structure to put the Asterisk formats in.
1686  * \param nonastformats An integer to put the non-Asterisk formats in
1687  *
1688  * Example usage:
1689  *
1690  * \code
1691  * struct ast_format_cap *astformats = ast_format_cap_alloc_nolock()
1692  * int nonastformats;
1693  * ast_rtp_codecs_payload_formats(&codecs, astformats, &nonastformats);
1694  * \endcode
1695  *
1696  * This retrieves all the formats known about in the codecs structure and puts the Asterisk ones in the integer
1697  * pointed to by astformats and the non-Asterisk ones in the integer pointed to by nonastformats.
1698  *
1699  * \since 1.8
1700  */
1701 void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, struct ast_format_cap *astformats, int *nonastformats);
1702 
1703 /*!
1704  * \brief Retrieve a rx mapped payload type based on whether it is an Asterisk format and the code
1705  *
1706  * \param codecs Codecs structure to look in
1707  * \param asterisk_format Non-zero if the given Asterisk format is present
1708  * \param format Asterisk format to look for
1709  * \param code The format to look for
1710  *
1711  * \details
1712  * Find the currently assigned rx mapped payload type based on whether it
1713  * is an Asterisk format or non-format code. If one is currently not
1714  * assigned then create a rx payload type mapping.
1715  *
1716  * \return Numerical payload type
1717  * \retval -1 if could not assign.
1718  *
1719  * Example usage:
1720  *
1721  * \code
1722  * int payload = ast_rtp_codecs_payload_code(&codecs, 1, ast_format_set(&tmp_fmt, AST_FORMAT_ULAW, 0), 0);
1723  * \endcode
1724  *
1725  * This looks for the numerical payload for ULAW in the codecs structure.
1726  *
1727  * \since 1.8
1728  */
1729 int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, int asterisk_format, struct ast_format *format, int code);
1730 
1731 /*!
1732  * \brief Set a payload code for use with a specific Asterisk format
1733  *
1734  * \param codecs Codecs structure to manipulate
1735  * \param code The payload code
1736  * \param format Asterisk format
1737  *
1738  * \retval 0 Payload was set to the given format
1739  * \retval -1 Payload was in use or could not be set
1740  *
1741  * \since 15.0.0
1742  */
1743 int ast_rtp_codecs_payload_set_rx(struct ast_rtp_codecs *codecs, int code, struct ast_format *format);
1744 
1745 /*!
1746  * \brief Retrieve a tx mapped payload type based on whether it is an Asterisk format and the code
1747  * \since 14.0.0
1748  *
1749  * \param codecs Codecs structure to look in
1750  * \param asterisk_format Non-zero if the given Asterisk format is present
1751  * \param format Asterisk format to look for
1752  * \param code The format to look for
1753  *
1754  * \return Numerical payload type
1755  * \retval -1 if not found.
1756  */
1757 int ast_rtp_codecs_payload_code_tx(struct ast_rtp_codecs *codecs, int asterisk_format, const struct ast_format *format, int code);
1758 
1759 /*!
1760  * \brief Search for the tx payload type in the ast_rtp_codecs structure
1761  *
1762  * \param codecs Codecs structure to look in
1763  * \param payload The payload type format to look for
1764  *
1765  * \return Numerical payload type or -1 if unable to find payload in codecs
1766  *
1767  * Example usage:
1768  *
1769  * \code
1770  * int payload = ast_rtp_codecs_find_payload_code(&codecs, 0);
1771  * \endcode
1772  *
1773  * This looks for the numerical payload for ULAW in the codecs structure.
1774  */
1775 int ast_rtp_codecs_find_payload_code(struct ast_rtp_codecs *codecs, int payload);
1776 
1777 /*!
1778  * \brief Retrieve mime subtype information on a payload
1779  *
1780  * \param asterisk_format Non-zero to look up using Asterisk format
1781  * \param format Asterisk format to look up
1782  * \param code RTP code to look up
1783  * \param options Additional options that may change the result
1784  *
1785  * \return Mime subtype success
1786  * \retval NULL failure
1787  *
1788  * Example usage:
1789  *
1790  * \code
1791  * const char *subtype = ast_rtp_lookup_mime_subtype2(1, ast_format_set(&tmp_fmt, AST_FORMAT_ULAW, 0), 0, 0);
1792  * \endcode
1793  *
1794  * This looks up the mime subtype for the ULAW format.
1795  *
1796  * \since 1.8
1797  */
1798 const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format,
1799  const struct ast_format *format, int code, enum ast_rtp_options options);
1800 
1801 /*!
1802  * \brief Convert formats into a string and put them into a buffer
1803  *
1804  * \param buf Buffer to put the mime output into
1805  * \param ast_format_capability Asterisk Formats we are looking up.
1806  * \param rtp_capability RTP codes that we are looking up
1807  * \param asterisk_format Non-zero if the ast_format_capability structure is to be used, 0 if rtp_capability is to be used
1808  * \param options Additional options that may change the result
1809  *
1810  * \retval non-NULL success
1811  * \retval NULL failure
1812  *
1813  * Example usage:
1814  *
1815  * \code
1816  * char buf[256] = "";
1817  * struct ast_format tmp_fmt;
1818  * struct ast_format_cap *cap = ast_format_cap_alloc_nolock();
1819  * ast_format_cap_append(cap, ast_format_set(&tmp_fmt, AST_FORMAT_ULAW, 0));
1820  * ast_format_cap_append(cap, ast_format_set(&tmp_fmt, AST_FORMAT_GSM, 0));
1821  * char *mime = ast_rtp_lookup_mime_multiple2(&buf, sizeof(buf), cap, 0, 1, 0);
1822  * ast_format_cap_destroy(cap);
1823  * \endcode
1824  *
1825  * This returns the mime values for ULAW and ALAW in the buffer pointed to by buf.
1826  *
1827  * \since 1.8
1828  */
1829 char *ast_rtp_lookup_mime_multiple2(struct ast_str *buf, struct ast_format_cap *ast_format_capability, int rtp_capability, const int asterisk_format, enum ast_rtp_options options);
1830 
1831 /*!
1832  * \brief Begin sending a DTMF digit
1833  *
1834  * \param instance The RTP instance to send the DTMF on
1835  * \param digit What DTMF digit to send
1836  *
1837  * \retval 0 success
1838  * \retval -1 failure
1839  *
1840  * Example usage:
1841  *
1842  * \code
1843  * ast_rtp_instance_dtmf_begin(instance, '1');
1844  * \endcode
1845  *
1846  * This starts sending the DTMF '1' on the RTP instance pointed to by instance. It will
1847  * continue being sent until it is ended.
1848  *
1849  * \since 1.8
1850  */
1851 int ast_rtp_instance_dtmf_begin(struct ast_rtp_instance *instance, char digit);
1852 
1853 /*!
1854  * \brief Stop sending a DTMF digit
1855  *
1856  * \param instance The RTP instance to stop the DTMF on
1857  * \param digit What DTMF digit to stop
1858  *
1859  * \retval 0 success
1860  * \retval -1 failure
1861  *
1862  * Example usage:
1863  *
1864  * \code
1865  * ast_rtp_instance_dtmf_end(instance, '1');
1866  * \endcode
1867  *
1868  * This stops sending the DTMF '1' on the RTP instance pointed to by instance.
1869  *
1870  * \since 1.8
1871  */
1872 int ast_rtp_instance_dtmf_end(struct ast_rtp_instance *instance, char digit);
1873 int ast_rtp_instance_dtmf_end_with_duration(struct ast_rtp_instance *instance, char digit, unsigned int duration);
1874 
1875 /*!
1876  * \brief Set the DTMF mode that should be used
1877  *
1878  * \param instance the RTP instance to set DTMF mode on
1879  * \param dtmf_mode The DTMF mode that is in use
1880  *
1881  * \retval 0 success
1882  * \retval -1 failure
1883  *
1884  * Example usage:
1885  *
1886  * \code
1887  * ast_rtp_instance_dtmf_mode_set(instance, AST_RTP_DTMF_MODE_RFC2833);
1888  * \endcode
1889  *
1890  * This sets the RTP instance to use RFC2833 for DTMF transmission and receiving.
1891  *
1892  * \since 1.8
1893  */
1894 int ast_rtp_instance_dtmf_mode_set(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode);
1895 
1896 /*!
1897  * \brief Get the DTMF mode of an RTP instance
1898  *
1899  * \param instance The RTP instance to get the DTMF mode of
1900  *
1901  * \return DTMF mode
1902  *
1903  * Example usage:
1904  *
1905  * \code
1906  * enum ast_rtp_dtmf_mode dtmf_mode = ast_rtp_instance_dtmf_mode_get(instance);
1907  * \endcode
1908  *
1909  * This gets the DTMF mode set on the RTP instance pointed to by 'instance'.
1910  *
1911  * \since 1.8
1912  */
1914 
1915 /*!
1916  * \brief Indicate that the RTP marker bit should be set on an RTP stream
1917  *
1918  * \param instance Instance that the new media source is feeding into
1919  *
1920  * Example usage:
1921  *
1922  * \code
1923  * ast_rtp_instance_update_source(instance);
1924  * \endcode
1925  *
1926  * This indicates that the source of media that is feeding the instance pointed to by
1927  * instance has been updated and that the marker bit should be set.
1928  *
1929  * \since 1.8
1930  */
1931 void ast_rtp_instance_update_source(struct ast_rtp_instance *instance);
1932 
1933 /*!
1934  * \brief Indicate a new source of audio has dropped in and the ssrc should change
1935  *
1936  * \param instance Instance that the new media source is feeding into
1937  *
1938  * Example usage:
1939  *
1940  * \code
1941  * ast_rtp_instance_change_source(instance);
1942  * \endcode
1943  *
1944  * This indicates that the source of media that is feeding the instance pointed to by
1945  * instance has changed and that the marker bit should be set and the SSRC updated.
1946  *
1947  * \since 1.8
1948  */
1949 void ast_rtp_instance_change_source(struct ast_rtp_instance *instance);
1950 
1951 /*!
1952  * \brief Set QoS parameters on an RTP session
1953  *
1954  * \param instance Instance to set the QoS parameters on
1955  * \param tos Terms of service value
1956  * \param cos Class of service value
1957  * \param desc What is setting the QoS values
1958  *
1959  * \retval 0 success
1960  * \retval -1 failure
1961  *
1962  * Example usage:
1963  *
1964  * \code
1965  * ast_rtp_instance_set_qos(instance, 0, 0, "Example");
1966  * \endcode
1967  *
1968  * This sets the TOS and COS values to 0 on the instance pointed to by instance.
1969  *
1970  * \since 1.8
1971  */
1972 int ast_rtp_instance_set_qos(struct ast_rtp_instance *instance, int tos, int cos, const char *desc);
1973 
1974 /*!
1975  * \brief Stop an RTP instance
1976  *
1977  * \param instance Instance that media is no longer going to at this time
1978  *
1979  * Example usage:
1980  *
1981  * \code
1982  * ast_rtp_instance_stop(instance);
1983  * \endcode
1984  *
1985  * This tells the RTP engine being used for the instance pointed to by instance
1986  * that media is no longer going to it at this time, but may in the future.
1987  *
1988  * \since 1.8
1989  */
1990 void ast_rtp_instance_stop(struct ast_rtp_instance *instance);
1991 
1992 /*!
1993  * \brief Get the file descriptor for an RTP session (or RTCP)
1994  *
1995  * \param instance Instance to get the file descriptor for
1996  * \param rtcp Whether to retrieve the file descriptor for RTCP or not
1997  *
1998  * \retval fd success
1999  * \retval -1 failure
2000  *
2001  * Example usage:
2002  *
2003  * \code
2004  * int rtp_fd = ast_rtp_instance_fd(instance, 0);
2005  * \endcode
2006  *
2007  * This retrieves the file descriptor for the socket carrying media on the instance
2008  * pointed to by instance.
2009  *
2010  * \since 1.8
2011  */
2012 int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp);
2013 
2014 /*!
2015  * \brief Get the RTP glue that binds a channel to the RTP engine
2016  *
2017  * \param type Name of the glue we want
2018  *
2019  * \retval non-NULL success
2020  * \retval NULL failure
2021  *
2022  * Example usage:
2023  *
2024  * \code
2025  * struct ast_rtp_glue *glue = ast_rtp_instance_get_glue("Example");
2026  * \endcode
2027  *
2028  * This retrieves the RTP glue that has the name 'Example'.
2029  *
2030  * \since 1.8
2031  */
2032 struct ast_rtp_glue *ast_rtp_instance_get_glue(const char *type);
2033 
2034 /*!
2035  * \brief Get the unique ID of the channel that owns this RTP instance
2036  *
2037  * Note that this should remain valid for the lifetime of the RTP instance.
2038  *
2039  * \param instance The RTP instance
2040  *
2041  * \return The unique ID of the channel
2042  * \retval Empty string if no channel owns this RTP instance
2043  *
2044  * \since 12
2045  */
2046 const char *ast_rtp_instance_get_channel_id(struct ast_rtp_instance *instance);
2047 
2048 /*!
2049  * \brief Set the channel that owns this RTP instance
2050  *
2051  * \param instance The RTP instance
2052  * \param uniqueid The uniqueid of the channel
2053  *
2054  * \since 12
2055  */
2056 void ast_rtp_instance_set_channel_id(struct ast_rtp_instance *instance, const char *uniqueid);
2057 
2058 /*!
2059  * \brief Get the other RTP instance that an instance is bridged to
2060  *
2061  * \param instance The RTP instance that we want
2062  *
2063  * \retval non-NULL success
2064  * \retval NULL failure
2065  *
2066  * Example usage:
2067  *
2068  * \code
2069  * struct ast_rtp_instance *bridged = ast_rtp_instance_get_bridged(instance0);
2070  * \endcode
2071  *
2072  * This gets the RTP instance that instance0 is bridged to.
2073  *
2074  * \since 1.8
2075  */
2077 
2078 /*!
2079  * \brief Set the other RTP instance that an instance is bridged to
2080  *
2081  * \param instance The RTP instance that we want to set the bridged value on
2082  * \param bridged The RTP instance they are bridged to
2083  *
2084  * \since 12
2085  */
2087 
2088 /*!
2089  * \brief Make two channels compatible for early bridging
2090  *
2091  * \param c_dst Destination channel to copy to
2092  * \param c_src Source channel to copy from
2093  *
2094  * \since 1.8
2095  */
2096 void ast_rtp_instance_early_bridge_make_compatible(struct ast_channel *c_dst, struct ast_channel *c_src);
2097 
2098 /*!
2099  * \brief Early bridge two channels that use RTP instances
2100  *
2101  * \param c0 First channel part of the bridge
2102  * \param c1 Second channel part of the bridge
2103  *
2104  * \retval 0 success
2105  * \retval -1 failure
2106  *
2107  * \note This should only be used by channel drivers in their technology declaration.
2108  *
2109  * \since 1.8
2110  */
2111 int ast_rtp_instance_early_bridge(struct ast_channel *c0, struct ast_channel *c1);
2112 
2113 /*!
2114  * \brief Initialize RED support on an RTP instance
2115  *
2116  * \param instance The instance to initialize RED support on
2117  * \param buffer_time How long to buffer before sending
2118  * \param payloads Payload values
2119  * \param generations Number of generations
2120  *
2121  * \retval 0 success
2122  * \retval -1 failure
2123  *
2124  * \since 1.8
2125  */
2126 int ast_rtp_red_init(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations);
2127 
2128 /*!
2129  * \brief Buffer a frame in an RTP instance for RED
2130  *
2131  * \param instance The instance to buffer the frame on
2132  * \param frame Frame that we want to buffer
2133  *
2134  * \retval 0 success
2135  * \retval -1 failure
2136  *
2137  * \since 1.8
2138  */
2139 int ast_rtp_red_buffer(struct ast_rtp_instance *instance, struct ast_frame *frame);
2140 
2141 /*!
2142  * \brief Retrieve statistics about an RTP instance
2143  *
2144  * \param instance Instance to get statistics on
2145  * \param stats Structure to put results into
2146  * \param stat What statistic(s) to retrieve
2147  *
2148  * \retval 0 success
2149  * \retval -1 failure
2150  *
2151  * Example usage:
2152  *
2153  * \code
2154  * struct ast_rtp_instance_stats stats;
2155  * ast_rtp_instance_get_stats(instance, &stats, AST_RTP_INSTANCE_STAT_ALL);
2156  * \endcode
2157  *
2158  * This retrieves all statistics the underlying RTP engine supports and puts the values into the
2159  * stats structure.
2160  *
2161  * \since 1.8
2162  */
2163 int ast_rtp_instance_get_stats(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat);
2164 
2165 /*!
2166  * \brief Set standard statistics from an RTP instance on a channel
2167  *
2168  * \param chan Channel to set the statistics on
2169  * \param instance The RTP instance that statistics will be retrieved from
2170  *
2171  * \note Absolutely _NO_ channel locks should be held before calling this function.
2172  *
2173  * Example usage:
2174  *
2175  * \code
2176  * ast_rtp_instance_set_stats_vars(chan, rtp);
2177  * \endcode
2178  *
2179  * This retrieves standard statistics from the RTP instance rtp and sets it on the channel pointed to
2180  * by chan.
2181  *
2182  * \since 1.8
2183  */
2184 void ast_rtp_instance_set_stats_vars(struct ast_channel *chan, struct ast_rtp_instance *instance);
2185 
2186 /*!
2187  * \brief Retrieve quality statistics about an RTP instance
2188  *
2189  * \param instance Instance to get statistics on
2190  * \param field What quality statistic to retrieve
2191  * \param buf What buffer to put the result into
2192  * \param size Size of the above buffer
2193  *
2194  * \retval non-NULL success
2195  * \retval NULL failure
2196  *
2197  * Example usage:
2198  *
2199  * \code
2200  * char quality[AST_MAX_USER_FIELD];
2201  * ast_rtp_instance_get_quality(instance, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, &buf, sizeof(buf));
2202  * \endcode
2203  *
2204  * This retrieves general quality statistics and places a text representation into the buf pointed to by buf.
2205  *
2206  * \since 1.8
2207  */
2208 char *ast_rtp_instance_get_quality(struct ast_rtp_instance *instance, enum ast_rtp_instance_stat_field field, char *buf, size_t size);
2209 
2210 /*!
2211  * \brief Request that the underlying RTP engine provide audio frames in a specific format
2212  *
2213  * \param instance The RTP instance to change read format on
2214  * \param format Format that frames are wanted in
2215  *
2216  * \retval 0 success
2217  * \retval -1 failure
2218  *
2219  * Example usage:
2220  *
2221  * \code
2222  * struct ast_format tmp_fmt;
2223  * ast_rtp_instance_set_read_format(instance, ast_format_set(&tmp_fmt, AST_FORMAT_ULAW, 0));
2224  * \endcode
2225  *
2226  * This requests that the RTP engine provide audio frames in the ULAW format.
2227  *
2228  * \since 1.8
2229  */
2231 
2232 /*!
2233  * \brief Tell underlying RTP engine that audio frames will be provided in a specific format
2234  *
2235  * \param instance The RTP instance to change write format on
2236  * \param format Format that frames will be provided in
2237  *
2238  * \retval 0 success
2239  * \retval -1 failure
2240  *
2241  * Example usage:
2242  *
2243  * \code
2244  * struct ast_format tmp_fmt;
2245  * ast_rtp_instance_set_write_format(instance, ast_format_set(&tmp_fmt, AST_FORMAT_ULAW, 0));
2246  * \endcode
2247  *
2248  * This tells the underlying RTP engine that audio frames will be provided to it in ULAW format.
2249  *
2250  * \since 1.8
2251  */
2253 
2254 /*!
2255  * \brief Request that the underlying RTP engine make two RTP instances compatible with eachother
2256  *
2257  * \param chan Our own Asterisk channel
2258  * \param instance The first RTP instance
2259  * \param peer The peer Asterisk channel
2260  *
2261  * \retval 0 success
2262  * \retval -1 failure
2263  *
2264  * Example usage:
2265  *
2266  * \code
2267  * ast_rtp_instance_make_compatible(instance, peer);
2268  * \endcode
2269  *
2270  * This makes the RTP instance for 'peer' compatible with 'instance' and vice versa.
2271  *
2272  * \since 1.8
2273  */
2274 int ast_rtp_instance_make_compatible(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_channel *peer);
2275 
2276 /*! \brief Request the formats that can be transcoded
2277  *
2278  * \param instance The RTP instance
2279  * \param to_endpoint Formats being sent/received towards the endpoint
2280  * \param to_asterisk Formats being sent/received towards Asterisk
2281  * \param result capabilities structure to store and return supported formats in.
2282  *
2283  * Example usage:
2284  *
2285  * \code
2286  * ast_rtp_instance_available_formats(instance, to_capabilities, from_capabilities, result_capabilities);
2287  * \endcode
2288  *
2289  * This sees if it is possible to have ulaw communicated to the endpoint but signed linear received into Asterisk.
2290  *
2291  * \since 1.8
2292  */
2293 void ast_rtp_instance_available_formats(struct ast_rtp_instance *instance, struct ast_format_cap *to_endpoint, struct ast_format_cap *to_asterisk, struct ast_format_cap *result);
2294 
2295 /*!
2296  * \brief Indicate to the RTP engine that packets are now expected to be sent/received on the RTP instance
2297  *
2298  * \param instance The RTP instance
2299  *
2300  * \retval 0 success
2301  * \retval -1 failure
2302  *
2303  * Example usage:
2304  *
2305  * \code
2306  * ast_rtp_instance_activate(instance);
2307  * \endcode
2308  *
2309  * This tells the underlying RTP engine of instance that packets will now flow.
2310  *
2311  * \since 1.8
2312  */
2313 int ast_rtp_instance_activate(struct ast_rtp_instance *instance);
2314 
2315 /*!
2316  * \brief Request that the underlying RTP engine send a STUN BIND request
2317  *
2318  * \param instance The RTP instance
2319  * \param suggestion The suggested destination
2320  * \param username Optionally a username for the request
2321  *
2322  * Example usage:
2323  *
2324  * \code
2325  * ast_rtp_instance_stun_request(instance, NULL, NULL);
2326  * \endcode
2327  *
2328  * This requests that the RTP engine send a STUN BIND request on the session pointed to by
2329  * 'instance'.
2330  *
2331  * \since 1.8
2332  */
2333 void ast_rtp_instance_stun_request(struct ast_rtp_instance *instance, struct ast_sockaddr *suggestion, const char *username);
2334 
2335 /*!
2336  * \brief Set the RTP timeout value
2337  *
2338  * \param instance The RTP instance
2339  * \param timeout Value to set the timeout to
2340  *
2341  * Example usage:
2342  *
2343  * \code
2344  * ast_rtp_instance_set_timeout(instance, 5000);
2345  * \endcode
2346  *
2347  * This sets the RTP timeout value on 'instance' to be 5000.
2348  *
2349  * \since 1.8
2350  */
2351 void ast_rtp_instance_set_timeout(struct ast_rtp_instance *instance, int timeout);
2352 
2353 /*!
2354  * \brief Set the RTP timeout value for when the instance is on hold
2355  *
2356  * \param instance The RTP instance
2357  * \param timeout Value to set the timeout to
2358  *
2359  * Example usage:
2360  *
2361  * \code
2362  * ast_rtp_instance_set_hold_timeout(instance, 5000);
2363  * \endcode
2364  *
2365  * This sets the RTP hold timeout value on 'instance' to be 5000.
2366  *
2367  * \since 1.8
2368  */
2369 void ast_rtp_instance_set_hold_timeout(struct ast_rtp_instance *instance, int timeout);
2370 
2371 /*!
2372  * \brief Set the RTP keepalive interval
2373  *
2374  * \param instance The RTP instance
2375  * \param timeout Value to set the keepalive interval to
2376  *
2377  * Example usage:
2378  *
2379  * \code
2380  * ast_rtp_instance_set_keepalive(instance, 5000);
2381  * \endcode
2382  *
2383  * This sets the RTP keepalive interval on 'instance' to be 5000.
2384  *
2385  * \since 1.8
2386  */
2387 void ast_rtp_instance_set_keepalive(struct ast_rtp_instance *instance, int timeout);
2388 
2389 /*!
2390  * \brief Get the RTP timeout value
2391  *
2392  * \param instance The RTP instance
2393  *
2394  * \return timeout value
2395  *
2396  * Example usage:
2397  *
2398  * \code
2399  * int timeout = ast_rtp_instance_get_timeout(instance);
2400  * \endcode
2401  *
2402  * This gets the RTP timeout value for the RTP instance pointed to by 'instance'.
2403  *
2404  * \since 1.8
2405  */
2406 int ast_rtp_instance_get_timeout(struct ast_rtp_instance *instance);
2407 
2408 /*!
2409  * \brief Get the RTP timeout value for when an RTP instance is on hold
2410  *
2411  * \param instance The RTP instance
2412  *
2413  * \return timeout value
2414  *
2415  * Example usage:
2416  *
2417  * \code
2418  * int timeout = ast_rtp_instance_get_hold_timeout(instance);
2419  * \endcode
2420  *
2421  * This gets the RTP hold timeout value for the RTP instance pointed to by 'instance'.
2422  *
2423  * \since 1.8
2424  */
2426 
2427 /*!
2428  * \brief Get the RTP keepalive interval
2429  *
2430  * \param instance The RTP instance
2431  *
2432  * \return period Keepalive interval value
2433  *
2434  * Example usage:
2435  *
2436  * \code
2437  * int interval = ast_rtp_instance_get_keepalive(instance);
2438  * \endcode
2439  *
2440  * This gets the RTP keepalive interval value for the RTP instance pointed to by 'instance'.
2441  *
2442  * \since 1.8
2443  */
2444 int ast_rtp_instance_get_keepalive(struct ast_rtp_instance *instance);
2445 
2446 /*!
2447  * \brief Get the RTP engine in use on an RTP instance
2448  *
2449  * \param instance The RTP instance
2450  *
2451  * \return pointer to the engine
2452  *
2453  * Example usage:
2454  *
2455  * \code
2456  * struct ast_rtp_engine *engine = ast_rtp_instance_get_engine(instance);
2457  * \endcode
2458  *
2459  * This gets the RTP engine currently in use on the RTP instance pointed to by 'instance'.
2460  *
2461  * \since 1.8
2462  */
2464 
2465 /*!
2466  * \brief Get the RTP glue in use on an RTP instance
2467  *
2468  * \param instance The RTP instance
2469  *
2470  * \return pointer to the glue
2471  *
2472  * Example:
2473  *
2474  * \code
2475  * struct ast_rtp_glue *glue = ast_rtp_instance_get_active_glue(instance);
2476  * \endcode
2477  *
2478  * This gets the RTP glue currently in use on the RTP instance pointed to by 'instance'.
2479  *
2480  * \since 1.8
2481  */
2483 
2484 /*!
2485  * \brief Send a comfort noise packet to the RTP instance
2486  *
2487  * \param instance The RTP instance
2488  * \param level Magnitude of the noise level
2489  *
2490  * \retval 0 Success
2491  * \retval non-zero Failure
2492  */
2493 int ast_rtp_instance_sendcng(struct ast_rtp_instance *instance, int level);
2494 
2495 /*!
2496  * \brief Add or replace the SRTP policies for the given RTP instance
2497  *
2498  * \param instance the RTP instance
2499  * \param remote_policy the remote endpoint's policy
2500  * \param local_policy our policy for this RTP instance's remote endpoint
2501  * \param rtcp 1 for dedicated RTCP policies
2502  *
2503  * \retval 0 Success
2504  * \retval non-zero Failure
2505  *
2506  * \note If no remote policy is provided any existing SRTP policies are left and the new local policy is added
2507  */
2508 int ast_rtp_instance_add_srtp_policy(struct ast_rtp_instance *instance, struct ast_srtp_policy* remote_policy, struct ast_srtp_policy *local_policy, int rtcp);
2509 
2510 /*!
2511  * \brief Obtain the SRTP instance associated with an RTP instance
2512  *
2513  * \param instance the RTP instance
2514  * \param rtcp 1 to request instance for RTCP
2515  * \return the SRTP instance on success
2516  * \retval NULL if no SRTP instance exists
2517  */
2518 struct ast_srtp *ast_rtp_instance_get_srtp(struct ast_rtp_instance *instance, int rtcp);
2519 
2520 /*! \brief Custom formats declared in codecs.conf at startup must be communicated to the rtp_engine
2521  * so their mime type can payload number can be initialized. */
2523 
2524 /*! \brief Formats requiring the use of a format attribute interface must have that
2525  * interface registered in order for the rtp engine to handle it correctly. If an
2526  * attribute interface is unloaded, this function must be called to notify the rtp_engine. */
2528 
2529 /*!
2530  * \brief Obtain a pointer to the ICE support present on an RTP instance
2531  *
2532  * \param instance the RTP instance
2533  *
2534  * \return ICE support if present
2535  * \retval NULL if no ICE support available
2536  */
2538 
2539 #ifdef TEST_FRAMEWORK
2540 /*!
2541  * \brief Obtain a pointer to the test callbacks on an RTP instance
2542  *
2543  * \param instance the RTP instance
2544  *
2545  * \return test callbacks if present
2546  * \retval NULL if not present
2547  */
2548 struct ast_rtp_engine_test *ast_rtp_instance_get_test(struct ast_rtp_instance *instance);
2549 #endif
2550 
2551 /*!
2552  * \brief Obtain a pointer to the DTLS support present on an RTP instance
2553  *
2554  * \param instance the RTP instance
2555  *
2556  * \return DTLS support if present
2557  * \retval NULL if no DTLS support available
2558  */
2560 
2561 /*!
2562  * \brief Parse DTLS related configuration options
2563  *
2564  * \param dtls_cfg a DTLS configuration structure
2565  * \param name name of the configuration option
2566  * \param value value of the configuration option
2567  *
2568  * \retval 0 if handled
2569  * \retval -1 if not handled
2570  */
2571 int ast_rtp_dtls_cfg_parse(struct ast_rtp_dtls_cfg *dtls_cfg, const char *name, const char *value);
2572 
2573 /*!
2574  * \brief Validates DTLS related configuration options
2575  *
2576  * \param dtls_cfg a DTLS configuration structure
2577  *
2578  * \retval 0 if valid
2579  * \retval -1 if invalid
2580  */
2581 int ast_rtp_dtls_cfg_validate(struct ast_rtp_dtls_cfg *dtls_cfg);
2582 
2583 /*!
2584  * \brief Copy contents of a DTLS configuration structure
2585  *
2586  * \param src_cfg source DTLS configuration structure
2587  * \param dst_cfg destination DTLS configuration structure
2588  */
2589 void ast_rtp_dtls_cfg_copy(const struct ast_rtp_dtls_cfg *src_cfg, struct ast_rtp_dtls_cfg *dst_cfg);
2590 
2591 /*!
2592  * \brief Free contents of a DTLS configuration structure
2593  *
2594  * \param dtls_cfg a DTLS configuration structure
2595  */
2596 void ast_rtp_dtls_cfg_free(struct ast_rtp_dtls_cfg *dtls_cfg);
2597 
2598 struct ast_json;
2599 
2600 /*!
2601  * \brief Allocate an ao2 ref counted instance of \ref ast_rtp_rtcp_report
2602  *
2603  * \param report_blocks The number of report blocks to allocate
2604  * \return An ao2 ref counted \ref ast_rtp_rtcp_report object on success
2605  * \retval NULL on error
2606  */
2607 struct ast_rtp_rtcp_report *ast_rtp_rtcp_report_alloc(unsigned int report_blocks);
2608 
2609 /*!
2610  * \since 12
2611  * \brief Publish an RTCP message to \ref stasis
2612  *
2613  * \param rtp The rtp instance object
2614  * \param message_type The RTP message type to publish
2615  * \param report The RTCP report object to publish. This should be an ao2 ref counted
2616  * object. This routine will increase the reference count of the object.
2617  * \param blob Additional JSON objects to publish along with the RTCP information
2618  */
2620  struct stasis_message_type *message_type,
2621  struct ast_rtp_rtcp_report *report,
2622  struct ast_json *blob);
2623 
2624 /*!
2625  * \brief Get the last RTP transmission time
2626  *
2627  * \param rtp The instance from which to get the last transmission time
2628  * \return The last RTP transmission time
2629  */
2630 time_t ast_rtp_instance_get_last_tx(const struct ast_rtp_instance *rtp);
2631 
2632 /*!
2633  * \brief Set the last RTP transmission time
2634  *
2635  * \param rtp The instance on which to set the last transmission time
2636  * \param time The last transmission time
2637  */
2638 void ast_rtp_instance_set_last_tx(struct ast_rtp_instance *rtp, time_t time);
2639 
2640 /*!
2641  * \brief Get the last RTP reception time
2642  *
2643  * \param rtp The instance from which to get the last reception time
2644  * \return The last RTP reception time
2645  */
2646 time_t ast_rtp_instance_get_last_rx(const struct ast_rtp_instance *rtp);
2647 
2648 /*!
2649  * \brief Set the last RTP reception time
2650  *
2651  * \param rtp The instance on which to set the last reception time
2652  * \param time The last reception time
2653  */
2654 void ast_rtp_instance_set_last_rx(struct ast_rtp_instance *rtp, time_t time);
2655 
2656 /*!
2657  * \brief Retrieve the local SSRC value that we will be using
2658  *
2659  * \param rtp The RTP instance
2660  * \return The SSRC value
2661  */
2662 unsigned int ast_rtp_instance_get_ssrc(struct ast_rtp_instance *rtp);
2663 
2664 /*!
2665  * \brief Retrieve the CNAME used in RTCP SDES items
2666  *
2667  * This is a pointer directly into the RTP struct, not a copy.
2668  *
2669  * \param rtp The RTP instance
2670  * \return the CNAME
2671  */
2672 const char *ast_rtp_instance_get_cname(struct ast_rtp_instance *rtp);
2673 
2674 /*!
2675  * \brief Request that an RTP instance be bundled with another
2676  * \since 15.0.0
2677  *
2678  * \param child The child RTP instance
2679  * \param parent The parent RTP instance the child should be bundled with
2680  *
2681  * \retval 0 success
2682  * \retval -1 failure
2683  */
2684 int ast_rtp_instance_bundle(struct ast_rtp_instance *child, struct ast_rtp_instance *parent);
2685 
2686 /*!
2687  * \brief Set the remote SSRC for an RTP instance
2688  * \since 15.0.0
2689  *
2690  * \param rtp The RTP instance
2691  * \param ssrc The remote SSRC
2692  */
2693 void ast_rtp_instance_set_remote_ssrc(struct ast_rtp_instance *rtp, unsigned int ssrc);
2694 
2695 /*!
2696  * \brief Set the stream number for an RTP instance
2697  * \since 15.0.0
2698  *
2699  * \param instance The RTP instance
2700  * \param stream_num The stream identifier number
2701  */
2702 void ast_rtp_instance_set_stream_num(struct ast_rtp_instance *instance, int stream_num);
2703 
2704 /*! \addtogroup StasisTopicsAndMessages
2705  * @{
2706  */
2707 
2708 /*!
2709  * \since 12
2710  * \brief Message type for an RTCP message sent from this Asterisk instance
2711  *
2712  * \return A stasis message type
2713  */
2715 
2716 /*!
2717  * \since 12
2718  * \brief Message type for an RTCP message received from some external source
2719  *
2720  * \return A stasis message type
2721  */
2723 
2724 /*! @} */
2725 
2726 #ifdef TEST_FRAMEWORK
2727 /*!
2728  * \brief Get the maximum size of the receive buffer
2729  *
2730  * \param instance The RTP instance
2731  * \return The recv_buffer max size if it exists, else 0
2732  */
2733 size_t ast_rtp_instance_get_recv_buffer_max(struct ast_rtp_instance *instance);
2734 
2735 /*!
2736  * \brief Get the current size of the receive buffer
2737  *
2738  * \param instance The RTP instance
2739  * \return The recv_buffer size if it exists, else 0
2740  */
2741 size_t ast_rtp_instance_get_recv_buffer_count(struct ast_rtp_instance *instance);
2742 
2743 /*!
2744  * \brief Get the current size of the send buffer
2745  *
2746  * \param instance The RTP instance
2747  * \return The send_buffer size if it exists, else 0
2748  */
2749 size_t ast_rtp_instance_get_send_buffer_count(struct ast_rtp_instance *instance);
2750 
2751 /*!
2752  * \brief Set the schedid for RTCP
2753  *
2754  * \param instance The RTP instance
2755  * \param id The number to set schedid to
2756  */
2757 void ast_rtp_instance_set_schedid(struct ast_rtp_instance *instance, int id);
2758 
2759 /*!
2760  * \brief Set the number of packets to drop on RTP read
2761  *
2762  * \param instance The RTP instance
2763  * \param num The number of packets to drop
2764  */
2765 void ast_rtp_instance_drop_packets(struct ast_rtp_instance *instance, int num);
2766 
2767 /*!
2768  * \brief Sends a SR/RR report the next time RTP would be sent
2769  *
2770  * \param instance The RTP instance
2771  */
2772 void ast_rtp_instance_queue_report(struct ast_rtp_instance *instance);
2773 
2774 /*!
2775  * \brief Get the value of sdes_received on the test engine
2776  *
2777  * \param instance The RTP instance
2778  * \retval 1 if sdes_received, else 0
2779  */
2780 int ast_rtp_instance_get_sdes_received(struct ast_rtp_instance *instance);
2781 
2782 /*!
2783  * \brief Resets all the fields to default values for the test engine
2784  *
2785  * \param instance The RTP instance
2786  */
2787 void ast_rtp_instance_reset_test_engine(struct ast_rtp_instance *instance);
2788 #endif
2789 
2790 /*!
2791  * \brief Convert given stat instance into json format
2792  * \param stats
2793  * \return A json format stat
2794  */
2795 struct ast_json *ast_rtp_convert_stats_json(const struct ast_rtp_instance_stats *stats);
2796 
2797 /*!
2798  * \brief Retrieve statistics about an RTP instance in json format
2799  * \param instance
2800  * \return json object of stats
2801  */
2803 
2804 /*!
2805  * \brief Retrieve the sample rate of a format according to RTP specifications
2806  * \since 16.7.0
2807  * \since 17.1.0
2808  *
2809  * \param format The media format
2810  *
2811  * \return The sample rate
2812  */
2813 int ast_rtp_get_rate(const struct ast_format *format);
2814 
2815 /*!
2816  * \since 12
2817  * \brief \ref stasis topic for RTP and RTCP related messages
2818  *
2819  * \return A \ref stasis topic
2820  */
2821 struct stasis_topic *ast_rtp_topic(void);
2822 
2823 /* RTP debug logging category name */
2824 #define AST_LOG_CATEGORY_RTP "rtp"
2825 /* RTP packet debug logging category name */
2826 #define AST_LOG_CATEGORY_RTP_PACKET "rtp_packet"
2827 /* RTCP debug logging category name */
2828 #define AST_LOG_CATEGORY_RTCP "rtcp"
2829 /* RTCP packet debug logging category name */
2830 #define AST_LOG_CATEGORY_RTCP_PACKET "rtcp_packet"
2831 /* DTLS debug logging category name */
2832 #define AST_LOG_CATEGORY_DTLS "dtls"
2833 /* DTLS packet debug logging category name */
2834 #define AST_LOG_CATEGORY_DTLS_PACKET "dtls_packet"
2835 /* ICE debug logging category name */
2836 #define AST_LOG_CATEGORY_ICE "ice"
2837 
2838 uintmax_t ast_debug_category_rtp_id(void);
2839 uintmax_t ast_debug_category_rtp_packet_id(void);
2840 uintmax_t ast_debug_category_rtcp_id(void);
2841 uintmax_t ast_debug_category_rtcp_packet_id(void);
2842 uintmax_t ast_debug_category_dtls_id(void);
2843 uintmax_t ast_debug_category_dtls_packet_id(void);
2844 uintmax_t ast_debug_category_ice_id(void);
2845 
2846 #define AST_DEBUG_CATEGORY_RTP ast_debug_category_rtp_id() /* RTP debug logging category id */
2847 #define AST_DEBUG_CATEGORY_RTP_PACKET ast_debug_category_rtp_packet_id() /* RTP packet debug logging category id */
2848 #define AST_DEBUG_CATEGORY_RTCP ast_debug_category_rtcp_id() /* RTCP debug logging category id */
2849 #define AST_DEBUG_CATEGORY_RTCP_PACKET ast_debug_category_rtcp_packet_id() /* RTCP packet debug logging category id */
2850 #define AST_DEBUG_CATEGORY_DTLS ast_debug_category_dtls_id() /* DTLS debug logging category id */
2851 #define AST_DEBUG_CATEGORY_DTLS_PACKET ast_debug_category_dtls_packet_id() /* DTLS packet debug logging category id */
2852 #define AST_DEBUG_CATEGORY_ICE ast_debug_category_ice_id() /* ICE debug logging category id */
2853 
2854 /*!
2855  * \brief Log debug level RTP information
2856  *
2857  * \param sublevel Debug output sublevel (>= 0)
2858  * \param ... String format and any associated arguments
2859  */
2860 #define ast_debug_rtp(sublevel, ...) \
2861  ast_debug_category(sublevel, AST_DEBUG_CATEGORY_RTP, __VA_ARGS__)
2862 
2863 /* Allow logging of RTP packets? */
2864 #define ast_debug_rtp_packet_is_allowed \
2865  ast_debug_category_is_allowed(AST_LOG_CATEGORY_ENABLED, AST_DEBUG_CATEGORY_RTP_PACKET)
2866 
2867 /*!
2868  * \brief Log debug level RTCP information
2869  *
2870  * \param sublevel Debug output sublevel (>= 0)
2871  * \param ... String format and any associated arguments
2872  */
2873 #define ast_debug_rtcp(sublevel, ...) \
2874  ast_debug_category(sublevel, AST_DEBUG_CATEGORY_RTCP, __VA_ARGS__)
2875 
2876 /* Allow logging of RTCP packets? */
2877 #define ast_debug_rtcp_packet_is_allowed \
2878  ast_debug_category_is_allowed(AST_LOG_CATEGORY_ENABLED, AST_DEBUG_CATEGORY_RTCP_PACKET)
2879 
2880 /*!
2881  * \brief Log debug level DTLS information
2882  *
2883  * \param sublevel Debug output sublevel (>= 0)
2884  * \param ... String format and any associated arguments
2885  */
2886 #define ast_debug_dtls(sublevel, ...) \
2887  ast_debug_category(sublevel, AST_DEBUG_CATEGORY_DTLS, __VA_ARGS__)
2888 
2889 /* Allow logging of DTLS packets? */
2890 #define ast_debug_dtls_packet_is_allowed \
2891  ast_debug_category_is_allowed(AST_LOG_CATEGORY_ENABLED, AST_DEBUG_CATEGORY_DTLS_PACKET)
2892 /*!
2893  * \brief Log debug level ICE information
2894  *
2895  * \param sublevel Debug output sublevel (>= 0)
2896  * \param ... String format and any associated arguments
2897  */
2898 #define ast_debug_ice(sublevel, ...) \
2899  ast_debug_category(sublevel, AST_DEBUG_CATEGORY_ICE, __VA_ARGS__)
2900 
2901 #if defined(__cplusplus) || defined(c_plusplus)
2902 }
2903 #endif
2904 
2905 #endif /* _ASTERISK_RTP_ENGINE_H */
char digit
enum queue_result id
Definition: app_queue.c:1640
static const char desc[]
Definition: cdr_radius.c:84
static PGresult * result
Definition: cel_pgsql.c:84
static snd_pcm_format_t format
Definition: chan_alsa.c:106
unsigned int tos
Definition: chan_iax2.c:348
unsigned int cos
Definition: chan_iax2.c:349
static struct ast_sched_context * sched
Definition: chan_ooh323.c:400
static const char type[]
Definition: chan_ooh323.c:109
static struct ao2_container * codecs
Registered codecs.
Definition: codec.c:48
ast_media_type
Types of media.
Definition: codec.h:30
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
char * address
Definition: f2c.h:59
Format Capabilities API.
static const char name[]
Definition: format_mp3.c:68
direction
struct stasis_message_type * ast_rtp_rtcp_received_type(void)
Message type for an RTCP message received from some external source.
struct stasis_message_type * ast_rtp_rtcp_sent_type(void)
Message type for an RTCP message sent from this Asterisk instance.
Asterisk internal frame definitions.
#define AST_RWLIST_ENTRY
Definition: linkedlists.h:415
Network socket handling.
ast_transport
Definition: netsock2.h:59
static struct ast_srtp_res srtp_res
Definition: res_srtp.c:103
static struct ast_srtp_policy_res policy_res
Definition: res_srtp.c:115
SRTP resource.
ast_srtp_suite
Definition: res_srtp.h:56
ast_rtp_dtls_setup
DTLS setup types.
Definition: rtp_engine.h:513
@ AST_RTP_DTLS_SETUP_PASSIVE
Definition: rtp_engine.h:515
@ AST_RTP_DTLS_SETUP_HOLDCONN
Definition: rtp_engine.h:517
@ AST_RTP_DTLS_SETUP_ACTPASS
Definition: rtp_engine.h:516
@ AST_RTP_DTLS_SETUP_ACTIVE
Definition: rtp_engine.h:514
struct ast_rtp_engine * ast_rtp_instance_get_engine(struct ast_rtp_instance *instance)
Get the RTP engine in use on an RTP instance.
Definition: rtp_engine.c:2692
struct ast_rtp_instance * ast_rtp_instance_new(const char *engine_name, struct ast_sched_context *sched, const struct ast_sockaddr *sa, void *data)
Create a new RTP instance.
Definition: rtp_engine.c:465
uintmax_t ast_debug_category_rtcp_packet_id(void)
Definition: rtp_engine.c:3552
void ast_rtp_instance_set_stats_vars(struct ast_channel *chan, struct ast_rtp_instance *instance)
Set standard statistics from an RTP instance on a channel.
Definition: rtp_engine.c:2492
struct ast_rtp_codecs * ast_rtp_instance_get_codecs(struct ast_rtp_instance *instance)
Get the codecs structure of an RTP instance.
Definition: rtp_engine.c:727
unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, const struct ast_format *format, int code)
Get the sample rate associated with known RTP payload types.
Definition: rtp_engine.c:2014
char * ast_rtp_lookup_mime_multiple2(struct ast_str *buf, struct ast_format_cap *ast_format_capability, int rtp_capability, const int asterisk_format, enum ast_rtp_options options)
Convert formats into a string and put them into a buffer.
Definition: rtp_engine.c:2037
ast_rtp_ice_role
ICE role during negotiation.
Definition: rtp_engine.h:468
@ AST_RTP_ICE_ROLE_CONTROLLING
Definition: rtp_engine.h:470
@ AST_RTP_ICE_ROLE_CONTROLLED
Definition: rtp_engine.h:469
void ast_rtp_instance_get_incoming_source_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the incoming source address of the remote endpoint.
Definition: rtp_engine.c:665
void ast_rtp_codecs_payloads_destroy(struct ast_rtp_codecs *codecs)
Destroy the contents of an RTP codecs structure (but not the structure itself)
Definition: rtp_engine.c:974
int ast_rtp_instance_destroy(struct ast_rtp_instance *instance)
Destroy an RTP instance.
Definition: rtp_engine.c:458
enum ast_rtp_dtmf_mode ast_rtp_instance_dtmf_mode_get(struct ast_rtp_instance *instance)
Get the DTMF mode of an RTP instance.
Definition: rtp_engine.c:2129
int ast_rtp_codecs_payload_set_rx(struct ast_rtp_codecs *codecs, int code, struct ast_format *format)
Set a payload code for use with a specific Asterisk format.
Definition: rtp_engine.c:1915
uintmax_t ast_debug_category_rtp_packet_id(void)
Definition: rtp_engine.c:3538
const char * ast_rtp_instance_get_cname(struct ast_rtp_instance *rtp)
Retrieve the CNAME used in RTCP SDES items.
Definition: rtp_engine.c:3784
ast_rtp_ice_component_type
ICE component types.
Definition: rtp_engine.h:462
@ AST_RTP_ICE_COMPONENT_RTCP
Definition: rtp_engine.h:464
@ AST_RTP_ICE_COMPONENT_RTP
Definition: rtp_engine.h:463
struct ast_rtp_rtcp_report * ast_rtp_rtcp_report_alloc(unsigned int report_blocks)
Allocate an ao2 ref counted instance of ast_rtp_rtcp_report.
Definition: rtp_engine.c:3467
int ast_rtp_instance_get_and_cmp_local_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the address of the local endpoint that we are sending RTP to, comparing its address to another.
Definition: rtp_engine.c:629
void ast_rtp_instance_early_bridge_make_compatible(struct ast_channel *c_dst, struct ast_channel *c_src)
Make two channels compatible for early bridging.
Definition: rtp_engine.c:2243
#define MAX_CHANNEL_ID
Definition: rtp_engine.h:107
const char * ast_rtp_instance_extmap_get_uri(struct ast_rtp_instance *instance, int id)
Retrieve the URI for an RTP extension id.
Definition: rtp_engine.c:946
struct ast_rtp_engine_ice * ast_rtp_instance_get_ice(struct ast_rtp_instance *instance)
Obtain a pointer to the ICE support present on an RTP instance.
Definition: rtp_engine.c:2883
void ast_rtp_instance_set_last_rx(struct ast_rtp_instance *rtp, time_t time)
Set the last RTP reception time.
Definition: rtp_engine.c:3766
int ast_rtp_instance_get_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property)
Get the value of an RTP instance property.
Definition: rtp_engine.c:716
int ast_rtp_engine_register_srtp(struct ast_srtp_res *srtp_res, struct ast_srtp_policy_res *policy_res)
Definition: rtp_engine.c:2702
int ast_rtp_instance_set_requested_target_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address)
Set the requested target address of the remote endpoint.
Definition: rtp_engine.c:616
uintmax_t ast_debug_category_ice_id(void)
Definition: rtp_engine.c:3573
ast_rtp_dtls_hash
DTLS fingerprint hashes.
Definition: rtp_engine.h:527
@ AST_RTP_DTLS_HASH_SHA1
Definition: rtp_engine.h:529
@ AST_RTP_DTLS_HASH_SHA256
Definition: rtp_engine.h:528
int ast_rtp_engine_srtp_is_registered(void)
Definition: rtp_engine.c:2723
ast_rtp_dtmf_mode
Definition: rtp_engine.h:148
@ AST_RTP_DTMF_MODE_RFC2833
Definition: rtp_engine.h:152
@ AST_RTP_DTMF_MODE_INBAND
Definition: rtp_engine.h:154
@ AST_RTP_DTMF_MODE_NONE
Definition: rtp_engine.h:150
struct ast_rtp_glue * ast_rtp_instance_get_active_glue(struct ast_rtp_instance *instance)
Get the RTP glue in use on an RTP instance.
Definition: rtp_engine.c:2697
int ast_rtp_instance_dtmf_mode_set(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode)
Set the DTMF mode that should be used.
Definition: rtp_engine.c:2115
void ast_rtp_instance_stop(struct ast_rtp_instance *instance)
Stop an RTP instance.
Definition: rtp_engine.c:2175
void ast_rtp_dtls_cfg_free(struct ast_rtp_dtls_cfg *dtls_cfg)
Free contents of a DTLS configuration structure.
Definition: rtp_engine.c:3123
int ast_rtp_instance_get_and_cmp_requested_target_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the requested target address of the remote endpoint and compare it to the given address.
Definition: rtp_engine.c:651
void ast_rtp_engine_unregister_srtp(void)
Definition: rtp_engine.c:2717
ast_rtp_instance_rtcp
Definition: rtp_engine.h:255
@ AST_RTP_INSTANCE_RTCP_MUX
Definition: rtp_engine.h:261
@ AST_RTP_INSTANCE_RTCP_STANDARD
Definition: rtp_engine.h:259
@ AST_RTP_INSTANCE_RTCP_DISABLED
Definition: rtp_engine.h:257
uintmax_t ast_debug_category_rtp_id(void)
Definition: rtp_engine.c:3531
void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance)
Copy payload information from one RTP instance to another.
Definition: rtp_engine.c:1216
void ast_rtp_publish_rtcp_message(struct ast_rtp_instance *rtp, struct stasis_message_type *message_type, struct ast_rtp_rtcp_report *report, struct ast_json *blob)
Publish an RTCP message to Stasis Message Bus API.
Definition: rtp_engine.c:3478
ast_rtp_instance_stat_field
Definition: rtp_engine.h:168
@ AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS
Definition: rtp_engine.h:174
@ AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT
Definition: rtp_engine.h:176
@ AST_RTP_INSTANCE_STAT_FIELD_QUALITY
Definition: rtp_engine.h:170
@ AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER
Definition: rtp_engine.h:172
size_t ast_rtp_instance_extmap_count(struct ast_rtp_instance *instance)
Get the number of known unique identifiers.
Definition: rtp_engine.c:899
ast_rtp_dtls_verify
DTLS verification settings.
Definition: rtp_engine.h:533
@ AST_RTP_DTLS_VERIFY_NONE
Definition: rtp_engine.h:534
@ AST_RTP_DTLS_VERIFY_FINGERPRINT
Definition: rtp_engine.h:535
@ AST_RTP_DTLS_VERIFY_CERTIFICATE
Definition: rtp_engine.h:536
ast_rtp_glue_result
Definition: rtp_engine.h:158
@ AST_RTP_GLUE_RESULT_LOCAL
Definition: rtp_engine.h:164
@ AST_RTP_GLUE_RESULT_REMOTE
Definition: rtp_engine.h:162
@ AST_RTP_GLUE_RESULT_FORBID
Definition: rtp_engine.h:160
int ast_rtp_instance_extmap_enable(struct ast_rtp_instance *instance, int id, enum ast_rtp_extension extension, enum ast_rtp_extension_direction direction)
Enable support for an RTP extension on an instance.
Definition: rtp_engine.c:732
ast_rtp_instance_stat
Definition: rtp_engine.h:180
@ AST_RTP_INSTANCE_STAT_LOCAL_MAXRXPLOSS
Definition: rtp_engine.h:202
@ AST_RTP_INSTANCE_STAT_REMOTE_NORMDEVRXPLOSS
Definition: rtp_engine.h:198
@ AST_RTP_INSTANCE_STAT_REMOTE_MAXRXPLOSS
Definition: rtp_engine.h:194
@ AST_RTP_INSTANCE_STAT_REMOTE_MINJITTER
Definition: rtp_engine.h:218
@ AST_RTP_INSTANCE_STAT_MIN_RTT
Definition: rtp_engine.h:238
@ AST_RTP_INSTANCE_STAT_CHANNEL_UNIQUEID
Definition: rtp_engine.h:248
@ AST_RTP_INSTANCE_STAT_TXPLOSS
Definition: rtp_engine.h:190
@ AST_RTP_INSTANCE_STAT_MAX_RTT
Definition: rtp_engine.h:236
@ AST_RTP_INSTANCE_STAT_RXPLOSS
Definition: rtp_engine.h:192
@ AST_RTP_INSTANCE_STAT_REMOTE_MAXJITTER
Definition: rtp_engine.h:216
@ AST_RTP_INSTANCE_STAT_LOCAL_MAXJITTER
Definition: rtp_engine.h:224
@ AST_RTP_INSTANCE_STAT_REMOTE_STDEVJITTER
Definition: rtp_engine.h:222
@ AST_RTP_INSTANCE_STAT_REMOTE_MINRXPLOSS
Definition: rtp_engine.h:196
@ AST_RTP_INSTANCE_STAT_TXOCTETCOUNT
Definition: rtp_engine.h:250
@ AST_RTP_INSTANCE_STAT_LOCAL_NORMDEVRXPLOSS
Definition: rtp_engine.h:206
@ AST_RTP_INSTANCE_STAT_REMOTE_STDEVRXPLOSS
Definition: rtp_engine.h:200
@ AST_RTP_INSTANCE_STAT_LOCAL_STDEVRXPLOSS
Definition: rtp_engine.h:208
@ AST_RTP_INSTANCE_STAT_TXCOUNT
Definition: rtp_engine.h:184
@ AST_RTP_INSTANCE_STAT_STDEVRTT
Definition: rtp_engine.h:242
@ AST_RTP_INSTANCE_STAT_RXJITTER
Definition: rtp_engine.h:214
@ AST_RTP_INSTANCE_STAT_LOCAL_MINRXPLOSS
Definition: rtp_engine.h:204
@ AST_RTP_INSTANCE_STAT_LOCAL_SSRC
Definition: rtp_engine.h:244
@ AST_RTP_INSTANCE_STAT_REMOTE_NORMDEVJITTER
Definition: rtp_engine.h:220
@ AST_RTP_INSTANCE_STAT_COMBINED_JITTER
Definition: rtp_engine.h:210
@ AST_RTP_INSTANCE_STAT_TXJITTER
Definition: rtp_engine.h:212
@ AST_RTP_INSTANCE_STAT_LOCAL_MINJITTER
Definition: rtp_engine.h:226
@ AST_RTP_INSTANCE_STAT_COMBINED_LOSS
Definition: rtp_engine.h:188
@ AST_RTP_INSTANCE_STAT_LOCAL_STDEVJITTER
Definition: rtp_engine.h:230
@ AST_RTP_INSTANCE_STAT_COMBINED_RTT
Definition: rtp_engine.h:232
@ AST_RTP_INSTANCE_STAT_NORMDEVRTT
Definition: rtp_engine.h:240
@ AST_RTP_INSTANCE_STAT_RTT
Definition: rtp_engine.h:234
@ AST_RTP_INSTANCE_STAT_RXOCTETCOUNT
Definition: rtp_engine.h:252
@ AST_RTP_INSTANCE_STAT_LOCAL_NORMDEVJITTER
Definition: rtp_engine.h:228
@ AST_RTP_INSTANCE_STAT_ALL
Definition: rtp_engine.h:182
@ AST_RTP_INSTANCE_STAT_RXCOUNT
Definition: rtp_engine.h:186
@ AST_RTP_INSTANCE_STAT_REMOTE_SSRC
Definition: rtp_engine.h:246
int ast_rtp_instance_early_bridge(struct ast_channel *c0, struct ast_channel *c1)
Early bridge two channels that use RTP instances.
Definition: rtp_engine.c:2329
void ast_rtp_instance_set_stream_num(struct ast_rtp_instance *instance, int stream_num)
Set the stream number for an RTP instance.
Definition: rtp_engine.c:3823
enum ast_media_type ast_rtp_codecs_get_stream_type(struct ast_rtp_codecs *codecs)
Determine the type of RTP stream media from the codecs mapped.
Definition: rtp_engine.c:1452
int ast_rtp_instance_get_keepalive(struct ast_rtp_instance *instance)
Get the RTP keepalive interval.
Definition: rtp_engine.c:2687
void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, struct ast_format_cap *astformats, int *nonastformats)
Retrieve all formats that were found.
Definition: rtp_engine.c:1572
int ast_rtp_instance_get_timeout(struct ast_rtp_instance *instance)
Get the RTP timeout value.
Definition: rtp_engine.c:2677
int ast_rtp_instance_dtmf_begin(struct ast_rtp_instance *instance, char digit)
Begin sending a DTMF digit.
Definition: rtp_engine.c:2073
struct ast_srtp * ast_rtp_instance_get_srtp(struct ast_rtp_instance *instance, int rtcp)
Obtain the SRTP instance associated with an RTP instance.
Definition: rtp_engine.c:2755
void ast_rtp_instance_set_last_tx(struct ast_rtp_instance *rtp, time_t time)
Set the last RTP transmission time.
Definition: rtp_engine.c:3756
void ast_rtp_instance_set_data(struct ast_rtp_instance *instance, void *data)
Set the data portion of an RTP instance.
Definition: rtp_engine.c:558
int ast_rtp_instance_set_write_format(struct ast_rtp_instance *instance, struct ast_format *format)
Tell underlying RTP engine that audio frames will be provided in a specific format.
Definition: rtp_engine.c:2566
int ast_rtp_instance_bundle(struct ast_rtp_instance *child, struct ast_rtp_instance *parent)
Request that an RTP instance be bundled with another.
Definition: rtp_engine.c:3797
void ast_rtp_instance_stun_request(struct ast_rtp_instance *instance, struct ast_sockaddr *suggestion, const char *username)
Request that the underlying RTP engine send a STUN BIND request.
Definition: rtp_engine.c:2653
struct ast_format * ast_rtp_codecs_get_payload_format(struct ast_rtp_codecs *codecs, int payload)
Retrieve the actual ast_format stored on the codecs structure for a specific tx payload type.
Definition: rtp_engine.c:1529
struct ast_rtp_payload_type * ast_rtp_engine_alloc_payload_type(void)
Allocation routine for ast_rtp_payload_type.
Definition: rtp_engine.c:325
void ast_rtp_codecs_set_framing(struct ast_rtp_codecs *codecs, unsigned int framing)
Set the framing used for a set of codecs.
Definition: rtp_engine.c:1550
struct ast_rtp_instance * ast_rtp_instance_get_bridged(struct ast_rtp_instance *instance)
Get the other RTP instance that an instance is bridged to.
Definition: rtp_engine.c:2226
time_t ast_rtp_instance_get_last_tx(const struct ast_rtp_instance *rtp)
Get the last RTP transmission time.
Definition: rtp_engine.c:3751
void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload)
Record tx payload type information that was seen in an m= SDP line.
Definition: rtp_engine.c:1293
int ast_rtp_red_init(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations)
Initialize RED support on an RTP instance.
Definition: rtp_engine.c:2410
void ast_rtp_instance_set_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value)
Set the value of an RTP instance property.
Definition: rtp_engine.c:705
void ast_rtp_instance_set_hold_timeout(struct ast_rtp_instance *instance, int timeout)
Set the RTP timeout value for when the instance is on hold.
Definition: rtp_engine.c:2667
int ast_rtp_codecs_find_payload_code(struct ast_rtp_codecs *codecs, int payload)
Search for the tx payload type in the ast_rtp_codecs structure.
Definition: rtp_engine.c:1967
int ast_rtp_instance_make_compatible(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_channel *peer)
Request that the underlying RTP engine make two RTP instances compatible with eachother.
Definition: rtp_engine.c:2581
void ast_rtp_instance_set_extended_prop(struct ast_rtp_instance *instance, int property, void *value)
Set the value of an RTP instance extended property.
Definition: rtp_engine.c:681
void * ast_rtp_instance_get_extended_prop(struct ast_rtp_instance *instance, int property)
Get the value of an RTP instance extended property.
Definition: rtp_engine.c:690
void ast_rtp_instance_get_local_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the local address that we are expecting RTP on.
Definition: rtp_engine.c:643
int ast_rtp_instance_dtmf_end_with_duration(struct ast_rtp_instance *instance, char digit, unsigned int duration)
Definition: rtp_engine.c:2101
int ast_rtp_instance_get_stats(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat)
Retrieve statistics about an RTP instance.
Definition: rtp_engine.c:2438
ast_rtp_ice_candidate_type
ICE candidate types.
Definition: rtp_engine.h:455
@ AST_RTP_ICE_CANDIDATE_TYPE_RELAYED
Definition: rtp_engine.h:458
@ AST_RTP_ICE_CANDIDATE_TYPE_SRFLX
Definition: rtp_engine.h:457
@ AST_RTP_ICE_CANDIDATE_TYPE_HOST
Definition: rtp_engine.h:456
int ast_rtp_instance_set_local_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address)
Set the address that we are expecting to receive RTP on.
Definition: rtp_engine.c:588
int ast_rtp_get_rate(const struct ast_format *format)
Retrieve the sample rate of a format according to RTP specifications.
Definition: rtp_engine.c:4023
int ast_rtp_codecs_payload_code_tx(struct ast_rtp_codecs *codecs, int asterisk_format, const struct ast_format *format, int code)
Retrieve a tx mapped payload type based on whether it is an Asterisk format and the code.
Definition: rtp_engine.c:1920
enum ast_rtp_extension ast_rtp_instance_extmap_get_extension(struct ast_rtp_instance *instance, int id)
Retrieve the extension for an RTP extension id.
Definition: rtp_engine.c:910
int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame)
Send a frame out over RTP.
Definition: rtp_engine.c:568
ast_rtp_extension
Known RTP extensions.
Definition: rtp_engine.h:542
@ AST_RTP_EXTENSION_MAX
Definition: rtp_engine.h:550
@ AST_RTP_EXTENSION_TRANSPORT_WIDE_CC
Definition: rtp_engine.h:548
@ AST_RTP_EXTENSION_ABS_SEND_TIME
Definition: rtp_engine.h:546
@ AST_RTP_EXTENSION_UNSUPPORTED
Definition: rtp_engine.h:544
int ast_rtp_glue_register2(struct ast_rtp_glue *glue, struct ast_module *module)
Register RTP glue.
Definition: rtp_engine.c:379
uintmax_t ast_debug_category_dtls_packet_id(void)
Definition: rtp_engine.c:3566
struct ast_frame * ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp)
Receive a frame over RTP.
Definition: rtp_engine.c:578
void ast_rtp_codecs_payloads_unset(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload)
Remove tx payload type mapped information.
Definition: rtp_engine.c:1425
int ast_rtp_instance_sendcng(struct ast_rtp_instance *instance, int level)
Send a comfort noise packet to the RTP instance.
Definition: rtp_engine.c:2764
void ast_rtp_codecs_payloads_clear(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance)
Clear rx and tx payload mapping information from an RTP instance.
Definition: rtp_engine.c:994
void ast_rtp_instance_set_remote_ssrc(struct ast_rtp_instance *rtp, unsigned int ssrc)
Set the remote SSRC for an RTP instance.
Definition: rtp_engine.c:3814
int ast_rtp_instance_get_hold_timeout(struct ast_rtp_instance *instance)
Get the RTP timeout value for when an RTP instance is on hold.
Definition: rtp_engine.c:2682
ast_rtp_options
Definition: rtp_engine.h:142
@ AST_RTP_OPT_G726_NONSTANDARD
Definition: rtp_engine.h:144
ast_rtp_dtls_connection
DTLS connection states.
Definition: rtp_engine.h:521
@ AST_RTP_DTLS_CONNECTION_NEW
Definition: rtp_engine.h:522
@ AST_RTP_DTLS_CONNECTION_EXISTING
Definition: rtp_engine.h:523
int ast_rtp_codecs_payloads_initialize(struct ast_rtp_codecs *codecs)
Initialize an RTP codecs structure.
Definition: rtp_engine.c:958
ast_rtp_property
Definition: rtp_engine.h:113
@ AST_RTP_PROPERTY_NAT
Definition: rtp_engine.h:115
@ AST_RTP_PROPERTY_MAX
Maximum number of RTP properties supported.
Definition: rtp_engine.h:138
@ AST_RTP_PROPERTY_RETRANS_RECV
Definition: rtp_engine.h:127
@ AST_RTP_PROPERTY_RETRANS_SEND
Definition: rtp_engine.h:129
@ AST_RTP_PROPERTY_RTCP
Definition: rtp_engine.h:123
@ AST_RTP_PROPERTY_ASYMMETRIC_CODEC
Definition: rtp_engine.h:125
@ AST_RTP_PROPERTY_STUN
Definition: rtp_engine.h:121
@ AST_RTP_PROPERTY_DTMF
Definition: rtp_engine.h:117
@ AST_RTP_PROPERTY_DTMF_COMPENSATE
Definition: rtp_engine.h:119
@ AST_RTP_PROPERTY_REMB
Definition: rtp_engine.h:131
int ast_rtp_dtls_cfg_parse(struct ast_rtp_dtls_cfg *dtls_cfg, const char *name, const char *value)
Parse DTLS related configuration options.
Definition: rtp_engine.c:3012
int ast_rtp_engine_unload_format(struct ast_format *format)
Formats requiring the use of a format attribute interface must have that interface registered in orde...
Definition: rtp_engine.c:3237
int ast_rtp_instance_activate(struct ast_rtp_instance *instance)
Indicate to the RTP engine that packets are now expected to be sent/received on the RTP instance.
Definition: rtp_engine.c:2639
void ast_rtp_instance_get_requested_target_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the requested target address of the remote endpoint.
Definition: rtp_engine.c:673
time_t ast_rtp_instance_get_last_rx(const struct ast_rtp_instance *rtp)
Get the last RTP reception time.
Definition: rtp_engine.c:3761
char * ast_rtp_instance_get_quality(struct ast_rtp_instance *instance, enum ast_rtp_instance_stat_field field, char *buf, size_t size)
Retrieve quality statistics about an RTP instance.
Definition: rtp_engine.c:2452
int ast_rtp_engine_register2(struct ast_rtp_engine *engine, struct ast_module *module)
Register an RTP engine.
Definition: rtp_engine.c:330
int ast_rtp_codecs_payloads_set_rtpmap_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload, char *mimetype, char *mimesubtype, enum ast_rtp_options options)
Record tx payload type information that was seen in an a=rtpmap: SDP line.
Definition: rtp_engine.c:1420
struct ast_json * ast_rtp_convert_stats_json(const struct ast_rtp_instance_stats *stats)
Convert given stat instance into json format.
Definition: rtp_engine.c:3949
int ast_rtp_instance_set_qos(struct ast_rtp_instance *instance, int tos, int cos, const char *desc)
Set QoS parameters on an RTP session.
Definition: rtp_engine.c:2161
void ast_rtp_instance_set_channel_id(struct ast_rtp_instance *instance, const char *uniqueid)
Set the channel that owns this RTP instance.
Definition: rtp_engine.c:553
void ast_rtp_dtls_cfg_copy(const struct ast_rtp_dtls_cfg *src_cfg, struct ast_rtp_dtls_cfg *dst_cfg)
Copy contents of a DTLS configuration structure.
Definition: rtp_engine.c:3105
ast_rtp_extension_direction
Directions for RTP extensions.
Definition: rtp_engine.h:769
@ AST_RTP_EXTENSION_DIRECTION_SENDRECV
Definition: rtp_engine.h:773
@ AST_RTP_EXTENSION_DIRECTION_NONE
Definition: rtp_engine.h:771
@ AST_RTP_EXTENSION_DIRECTION_INACTIVE
Definition: rtp_engine.h:779
@ AST_RTP_EXTENSION_DIRECTION_RECVONLY
Definition: rtp_engine.h:777
@ AST_RTP_EXTENSION_DIRECTION_SENDONLY
Definition: rtp_engine.h:775
struct ast_rtp_payload_type * ast_rtp_codecs_get_payload(struct ast_rtp_codecs *codecs, int payload)
Retrieve rx payload mapped information by payload type.
Definition: rtp_engine.c:1471
struct ast_rtp_engine_dtls * ast_rtp_instance_get_dtls(struct ast_rtp_instance *instance)
Obtain a pointer to the DTLS support present on an RTP instance.
Definition: rtp_engine.c:3003
int ast_rtp_instance_set_incoming_source_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address)
Set the incoming source address of the remote endpoint that we are sending RTP to.
Definition: rtp_engine.c:606
void ast_rtp_instance_available_formats(struct ast_rtp_instance *instance, struct ast_format_cap *to_endpoint, struct ast_format_cap *to_asterisk, struct ast_format_cap *result)
Request the formats that can be transcoded.
Definition: rtp_engine.c:2625
int ast_rtp_codecs_payload_replace_format(struct ast_rtp_codecs *codecs, int payload, struct ast_format *format)
Update the format associated with a tx payload type in a codecs structure.
Definition: rtp_engine.c:1495
uintmax_t ast_debug_category_rtcp_id(void)
Definition: rtp_engine.c:3545
struct ast_json * ast_rtp_instance_get_stats_all_json(struct ast_rtp_instance *instance)
Retrieve statistics about an RTP instance in json format.
Definition: rtp_engine.c:4012
int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int pt, char *mimetype, char *mimesubtype, enum ast_rtp_options options, unsigned int sample_rate)
Set tx payload type to a known MIME media type for a codec with a specific sample rate.
Definition: rtp_engine.c:1335
int ast_rtp_instance_dtmf_end(struct ast_rtp_instance *instance, char digit)
Stop sending a DTMF digit.
Definition: rtp_engine.c:2087
int ast_rtp_instance_extmap_get_id(struct ast_rtp_instance *instance, enum ast_rtp_extension extension)
Retrieve the id for an RTP extension.
Definition: rtp_engine.c:886
int ast_rtp_dtls_cfg_validate(struct ast_rtp_dtls_cfg *dtls_cfg)
Validates DTLS related configuration options.
Definition: rtp_engine.c:3086
const char * ast_rtp_lookup_mime_subtype2(const int asterisk_format, const struct ast_format *format, int code, enum ast_rtp_options options)
Retrieve mime subtype information on a payload.
Definition: rtp_engine.c:1984
struct ast_rtp_glue * ast_rtp_instance_get_glue(const char *type)
Get the RTP glue that binds a channel to the RTP engine.
Definition: rtp_engine.c:2198
void ast_rtp_instance_change_source(struct ast_rtp_instance *instance)
Indicate a new source of audio has dropped in and the ssrc should change.
Definition: rtp_engine.c:2152
int ast_rtp_engine_unregister(struct ast_rtp_engine *engine)
Unregister an RTP engine.
Definition: rtp_engine.c:364
uintmax_t ast_debug_category_dtls_id(void)
Definition: rtp_engine.c:3559
int ast_rtp_instance_extmap_negotiate(struct ast_rtp_instance *instance, int id, enum ast_rtp_extension_direction direction, const char *uri, const char *attributes)
Negotiate received RTP extension information.
Definition: rtp_engine.c:818
int ast_rtp_engine_load_format(struct ast_format *format)
Custom formats declared in codecs.conf at startup must be communicated to the rtp_engine so their mim...
Definition: rtp_engine.c:3221
void ast_rtp_instance_extmap_clear(struct ast_rtp_instance *instance)
Clear negotiated RTP extension information.
Definition: rtp_engine.c:862
struct stasis_topic * ast_rtp_topic(void)
Stasis Message Bus API topic for RTP and RTCP related messages
Definition: rtp_engine.c:3524
int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, struct ast_format *format)
Request that the underlying RTP engine provide audio frames in a specific format.
Definition: rtp_engine.c:2552
const char * ast_rtp_instance_get_channel_id(struct ast_rtp_instance *instance)
Get the unique ID of the channel that owns this RTP instance.
Definition: rtp_engine.c:548
int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp)
Get the file descriptor for an RTP session (or RTCP)
Definition: rtp_engine.c:2184
void ast_rtp_instance_update_source(struct ast_rtp_instance *instance)
Indicate that the RTP marker bit should be set on an RTP stream.
Definition: rtp_engine.c:2143
unsigned int ast_rtp_codecs_get_framing(struct ast_rtp_codecs *codecs)
Get the framing used for a set of codecs.
Definition: rtp_engine.c:1561
void ast_rtp_instance_set_keepalive(struct ast_rtp_instance *instance, int timeout)
Set the RTP keepalive interval.
Definition: rtp_engine.c:2672
unsigned int ast_rtp_instance_get_ssrc(struct ast_rtp_instance *rtp)
Retrieve the local SSRC value that we will be using.
Definition: rtp_engine.c:3771
int ast_rtp_red_buffer(struct ast_rtp_instance *instance, struct ast_frame *frame)
Buffer a frame in an RTP instance for RED.
Definition: rtp_engine.c:2424
void * ast_rtp_instance_get_data(struct ast_rtp_instance *instance)
Get the data portion of an RTP instance.
Definition: rtp_engine.c:563
int ast_rtp_instance_add_srtp_policy(struct ast_rtp_instance *instance, struct ast_srtp_policy *remote_policy, struct ast_srtp_policy *local_policy, int rtcp)
Add or replace the SRTP policies for the given RTP instance.
Definition: rtp_engine.c:2728
int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, int asterisk_format, struct ast_format *format, int code)
Retrieve a rx mapped payload type based on whether it is an Asterisk format and the code.
Definition: rtp_engine.c:1865
enum ast_rtp_extension_direction ast_rtp_instance_extmap_get_direction(struct ast_rtp_instance *instance, int id)
Retrieve the negotiated direction for an RTP extension id.
Definition: rtp_engine.c:930
void ast_rtp_codecs_payloads_xover(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance)
Crossover copy the tx payload mapping of src to the rx payload mapping of dest.
Definition: rtp_engine.c:1249
void ast_rtp_instance_set_bridged(struct ast_rtp_instance *instance, struct ast_rtp_instance *bridged)
Set the other RTP instance that an instance is bridged to.
Definition: rtp_engine.c:2236
void ast_rtp_instance_set_timeout(struct ast_rtp_instance *instance, int timeout)
Set the RTP timeout value.
Definition: rtp_engine.c:2662
int ast_rtp_glue_unregister(struct ast_rtp_glue *glue)
Unregister RTP glue.
Definition: rtp_engine.c:408
Scheduler Routines (derived from cheops)
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
Generic container type.
Main Channel structure associated with a channel.
Format capabilities structure, holds formats + preference order + etc.
Definition: format_cap.c:54
Definition of a media format.
Definition: format.c:43
Data structure associated with a single frame of data.
Abstract JSON element (object, array, string, int, ...).
ast_rwlock_t codecs_lock
Definition: rtp_engine.h:707
struct ast_rtp_codecs::@307 payload_mapping_tx
struct ast_rtp_codecs::@306 payload_mapping_rx
unsigned int framing
Definition: rtp_engine.h:713
DTLS configuration structure.
Definition: rtp_engine.h:554
enum ast_rtp_dtls_setup default_setup
Definition: rtp_engine.h:557
enum ast_rtp_dtls_verify verify
Definition: rtp_engine.h:560
unsigned int rekey
Definition: rtp_engine.h:556
enum ast_rtp_dtls_hash hash
Definition: rtp_engine.h:559
unsigned int enabled
Definition: rtp_engine.h:555
unsigned int ephemeral_cert
Definition: rtp_engine.h:566
enum ast_srtp_suite suite
Definition: rtp_engine.h:558
Structure that represents the optional DTLS SRTP support within an RTP engine.
Definition: rtp_engine.h:570
int(* set_configuration)(struct ast_rtp_instance *instance, const struct ast_rtp_dtls_cfg *dtls_cfg)
Definition: rtp_engine.h:572
int(* active)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:574
enum ast_rtp_dtls_setup(* get_setup)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:582
void(* stop)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:576
enum ast_rtp_dtls_hash(* get_fingerprint_hash)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:588
void(* reset)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:578
void(* set_fingerprint)(struct ast_rtp_instance *instance, enum ast_rtp_dtls_hash hash, const char *fingerprint)
Definition: rtp_engine.h:586
enum ast_rtp_dtls_connection(* get_connection)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:580
void(* set_setup)(struct ast_rtp_instance *instance, enum ast_rtp_dtls_setup setup)
Definition: rtp_engine.h:584
Structure for an ICE candidate.
Definition: rtp_engine.h:474
enum ast_rtp_ice_component_type id
Definition: rtp_engine.h:476
struct ast_sockaddr relay_address
Definition: rtp_engine.h:480
enum ast_rtp_ice_candidate_type type
Definition: rtp_engine.h:481
Structure that represents the optional ICE support within an RTP engine.
Definition: rtp_engine.h:485
void(* ice_lite)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:501
void(* stop)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:493
void(* change_components)(struct ast_rtp_instance *instance, int num_components)
Definition: rtp_engine.h:509
void(* set_authentication)(struct ast_rtp_instance *instance, const char *ufrag, const char *password)
Definition: rtp_engine.h:487
void(* start)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:491
void(* turn_request)(struct ast_rtp_instance *instance, enum ast_rtp_ice_component_type component, enum ast_transport transport, const char *server, unsigned int port, const char *username, const char *password)
Definition: rtp_engine.h:505
void(* add_remote_candidate)(struct ast_rtp_instance *instance, const struct ast_rtp_engine_ice_candidate *candidate)
Definition: rtp_engine.h:489
void(* set_role)(struct ast_rtp_instance *instance, enum ast_rtp_ice_role role)
Definition: rtp_engine.h:503
int(* get_stat)(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat)
Definition: rtp_engine.h:651
int(* write)(struct ast_rtp_instance *instance, struct ast_frame *frame)
Definition: rtp_engine.h:624
int(* qos)(struct ast_rtp_instance *instance, int tos, int cos, const char *desc)
Definition: rtp_engine.h:653
void(* stop)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:626
enum ast_rtp_dtmf_mode(* dtmf_mode_get)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:649
int(* activate)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:673
void(* change_source)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:635
int(* dtmf_end)(struct ast_rtp_instance *instance, char digit)
Definition: rtp_engine.h:630
void(* payload_set)(struct ast_rtp_instance *instance, int payload, int asterisk_format, struct ast_format *format, int code)
Definition: rtp_engine.h:643
int(* destroy)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:622
int(* fd)(struct ast_rtp_instance *instance, int rtcp)
Definition: rtp_engine.h:655
int(* dtmf_mode_set)(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode)
Definition: rtp_engine.h:647
void(* set_remote_ssrc)(struct ast_rtp_instance *instance, unsigned int ssrc)
Definition: rtp_engine.h:687
int(* dtmf_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1)
Definition: rtp_engine.h:671
int(* make_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1)
Definition: rtp_engine.h:669
struct ast_module * mod
Definition: rtp_engine.h:618
int(* red_buffer)(struct ast_rtp_instance *instance, struct ast_frame *frame)
Definition: rtp_engine.h:659
int(* set_read_format)(struct ast_rtp_instance *instance, struct ast_format *format)
Definition: rtp_engine.h:665
int(* red_init)(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations)
Definition: rtp_engine.h:657
void(* prop_set)(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value)
Definition: rtp_engine.h:641
const char * name
Definition: rtp_engine.h:616
int(* dtmf_end_with_duration)(struct ast_rtp_instance *instance, char digit, unsigned int duration)
Definition: rtp_engine.h:631
int(* set_write_format)(struct ast_rtp_instance *instance, struct ast_format *format)
Definition: rtp_engine.h:667
void(* remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa)
Definition: rtp_engine.h:645
void(* available_formats)(struct ast_rtp_instance *instance, struct ast_format_cap *to_endpoint, struct ast_format_cap *to_asterisk, struct ast_format_cap *result)
Definition: rtp_engine.h:677
int(* sendcng)(struct ast_rtp_instance *instance, int level)
Definition: rtp_engine.h:679
void(* update_source)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:633
void(* stun_request)(struct ast_rtp_instance *instance, struct ast_sockaddr *suggestion, const char *username)
Definition: rtp_engine.h:675
int(* dtmf_begin)(struct ast_rtp_instance *instance, char digit)
Definition: rtp_engine.h:628
struct ast_rtp_engine_ice * ice
Definition: rtp_engine.h:691
unsigned int(* ssrc_get)(struct ast_rtp_instance *instance)
Definition: rtp_engine.h:681
struct ast_rtp_engine_dtls * dtls
Definition: rtp_engine.h:693
void(* set_stream_num)(struct ast_rtp_instance *instance, int stream_num)
Definition: rtp_engine.h:689
int(* bundle)(struct ast_rtp_instance *child, struct ast_rtp_instance *parent)
Definition: rtp_engine.h:685
int(* extension_enable)(struct ast_rtp_instance *instance, enum ast_rtp_extension extension)
Definition: rtp_engine.h:699
int(* extended_prop_set)(struct ast_rtp_instance *instance, int property, void *value)
Definition: rtp_engine.h:637
int(* allow_vrtp_remote)(struct ast_channel *chan1, struct ast_rtp_instance *instance)
Used to prevent two channels from remotely bridging video rtp if the channel tech has a reason for pr...
Definition: rtp_engine.h:747
enum ast_rtp_glue_result(* get_rtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance)
Callback for retrieving the RTP instance carrying audio.
Definition: rtp_engine.h:729
void(* get_codec)(struct ast_channel *chan, struct ast_format_cap *result_cap)
Callback for retrieving codecs that the channel can do. Result returned in result_cap.
Definition: rtp_engine.h:761
int(* update_peer)(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, const struct ast_format_cap *cap, int nat_active)
Definition: rtp_engine.h:756
const char * type
Definition: rtp_engine.h:722
struct ast_module * mod
Definition: rtp_engine.h:724
enum ast_rtp_glue_result(* get_trtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance)
Callback for retrieving the RTP instance carrying text.
Definition: rtp_engine.h:754
int(* allow_rtp_remote)(struct ast_channel *chan1, struct ast_rtp_instance *instance)
Used to prevent two channels from remotely bridging audio rtp if the channel tech has a reason for pr...
Definition: rtp_engine.h:735
enum ast_rtp_glue_result(* get_vrtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance)
Callback for retrieving the RTP instance carrying video.
Definition: rtp_engine.h:741
unsigned int remote_ssrc
Definition: rtp_engine.h:424
unsigned int rxcount
Definition: rtp_engine.h:370
unsigned int local_ssrc
Definition: rtp_engine.h:422
unsigned int rxoctetcount
Definition: rtp_engine.h:430
unsigned int rxploss
Definition: rtp_engine.h:394
unsigned int txcount
Definition: rtp_engine.h:368
unsigned int txploss
Definition: rtp_engine.h:392
unsigned int txoctetcount
Definition: rtp_engine.h:428
char channel_uniqueid[MAX_CHANNEL_ID]
Definition: rtp_engine.h:426
struct ast_rtp_instance * bridged
Definition: rtp_engine.c:203
unsigned int primary_mapping
Definition: rtp_engine.h:286
struct ast_format * format
Definition: rtp_engine.h:278
struct timeval when_retired
Definition: rtp_engine.h:288
A REMB feedback message (see draft-alvestrand-rmcat-remb-03 for details)
Definition: rtp_engine.h:350
An object that represents data received in a feedback report.
Definition: rtp_engine.h:358
unsigned int fmt
Definition: rtp_engine.h:359
struct ast_rtp_rtcp_feedback_remb remb
Definition: rtp_engine.h:361
A report block within a SR/RR report.
Definition: rtp_engine.h:316
unsigned int highest_seq_no
Definition: rtp_engine.h:322
unsigned short fraction
Definition: rtp_engine.h:319
struct ast_rtp_rtcp_report_block::@302 lost_count
unsigned int source_ssrc
Definition: rtp_engine.h:317
An object that represents data sent during a SR/RR RTCP report.
Definition: rtp_engine.h:331
unsigned int type
Definition: rtp_engine.h:334
unsigned short reception_report_count
Definition: rtp_engine.h:332
unsigned int rtp_timestamp
Definition: rtp_engine.h:337
struct ast_rtp_rtcp_report_block * report_block[0]
Definition: rtp_engine.h:344
struct timeval ntp_timestamp
Definition: rtp_engine.h:336
unsigned int octet_count
Definition: rtp_engine.h:339
unsigned int ssrc
Definition: rtp_engine.h:333
struct ast_rtp_rtcp_report::@303 sender_information
unsigned int packet_count
Definition: rtp_engine.h:338
Structure for rwlock and tracking information.
Definition: lock.h:156
Socket address structure.
Definition: netsock2.h:97
Support for dynamic strings.
Definition: strings.h:604
Definition: search.h:40
structure to hold extensions
Definition: sched.c:76
int value
Definition: syslog.c:37
static struct test_options options
Vector container support.
#define AST_VECTOR(name, type)
Define a vector structure.
Definition: vector.h:44