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