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