2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2009, Digium, Inc.
6 * Mark Spencer <markster@digium.com>
7 * Joshua Colp <jcolp@digium.com>
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.
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.
21 * \brief Pluggable RTP Architecture
22 * \author Joshua Colp <jcolp@digium.com>
27 * \page AstRTPEngine Asterisk RTP Engine API
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.
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.
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.
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
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.
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.
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.
65 #ifndef _ASTERISK_RTP_ENGINE_H
66 #define _ASTERISK_RTP_ENGINE_H
68 #if defined(__cplusplus) || defined(c_plusplus)
72 #include "asterisk/astobj2.h"
73 #include "asterisk/frame.h"
74 #include "asterisk/netsock2.h"
75 #include "asterisk/sched.h"
76 #include "asterisk/res_srtp.h"
78 /* Maximum number of payloads supported */
79 #define AST_RTP_MAX_PT 256
81 /* Maximum number of generations */
82 #define AST_RED_MAX_GENERATION 5
84 struct ast_rtp_instance;
87 /*! RTP Properties that can be set on an RTP instance */
88 enum ast_rtp_property {
89 /*! Enable symmetric RTP support */
90 AST_RTP_PROPERTY_NAT = 0,
91 /*! RTP instance will be carrying DTMF (using RFC2833) */
92 AST_RTP_PROPERTY_DTMF,
93 /*! Expect unreliable DTMF from remote party */
94 AST_RTP_PROPERTY_DTMF_COMPENSATE,
95 /*! Enable STUN support */
96 AST_RTP_PROPERTY_STUN,
97 /*! Enable RTCP support */
98 AST_RTP_PROPERTY_RTCP,
101 * \brief Maximum number of RTP properties supported
103 * \note THIS MUST BE THE LAST ENTRY IN THIS ENUM.
105 AST_RTP_PROPERTY_MAX,
108 /*! Additional RTP options */
109 enum ast_rtp_options {
110 /*! Remote side is using non-standard G.726 */
111 AST_RTP_OPT_G726_NONSTANDARD = (1 << 0),
114 /*! RTP DTMF Modes */
115 enum ast_rtp_dtmf_mode {
116 /*! No DTMF is being carried over the RTP stream */
117 AST_RTP_DTMF_MODE_NONE = 0,
118 /*! DTMF is being carried out of band using RFC2833 */
119 AST_RTP_DTMF_MODE_RFC2833,
120 /*! DTMF is being carried inband over the RTP stream */
121 AST_RTP_DTMF_MODE_INBAND,
124 /*! Result codes when RTP glue is queried for information */
125 enum ast_rtp_glue_result {
126 /*! No remote or local bridging is permitted */
127 AST_RTP_GLUE_RESULT_FORBID = 0,
128 /*! Move RTP stream to be remote between devices directly */
129 AST_RTP_GLUE_RESULT_REMOTE,
130 /*! Perform RTP engine level bridging if possible */
131 AST_RTP_GLUE_RESULT_LOCAL,
134 /*! Field statistics that can be retrieved from an RTP instance */
135 enum ast_rtp_instance_stat_field {
136 /*! Retrieve quality information */
137 AST_RTP_INSTANCE_STAT_FIELD_QUALITY = 0,
138 /*! Retrieve quality information about jitter */
139 AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER,
140 /*! Retrieve quality information about packet loss */
141 AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS,
142 /*! Retrieve quality information about round trip time */
143 AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT,
146 /*! Statistics that can be retrieved from an RTP instance */
147 enum ast_rtp_instance_stat {
148 /*! Retrieve all statistics */
149 AST_RTP_INSTANCE_STAT_ALL = 0,
150 /*! Retrieve number of packets transmitted */
151 AST_RTP_INSTANCE_STAT_TXCOUNT,
152 /*! Retrieve number of packets received */
153 AST_RTP_INSTANCE_STAT_RXCOUNT,
154 /*! Retrieve ALL statistics relating to packet loss */
155 AST_RTP_INSTANCE_STAT_COMBINED_LOSS,
156 /*! Retrieve number of packets lost for transmitting */
157 AST_RTP_INSTANCE_STAT_TXPLOSS,
158 /*! Retrieve number of packets lost for receiving */
159 AST_RTP_INSTANCE_STAT_RXPLOSS,
160 /*! Retrieve maximum number of packets lost on remote side */
161 AST_RTP_INSTANCE_STAT_REMOTE_MAXRXPLOSS,
162 /*! Retrieve minimum number of packets lost on remote side */
163 AST_RTP_INSTANCE_STAT_REMOTE_MINRXPLOSS,
164 /*! Retrieve average number of packets lost on remote side */
165 AST_RTP_INSTANCE_STAT_REMOTE_NORMDEVRXPLOSS,
166 /*! Retrieve standard deviation of packets lost on remote side */
167 AST_RTP_INSTANCE_STAT_REMOTE_STDEVRXPLOSS,
168 /*! Retrieve maximum number of packets lost on local side */
169 AST_RTP_INSTANCE_STAT_LOCAL_MAXRXPLOSS,
170 /*! Retrieve minimum number of packets lost on local side */
171 AST_RTP_INSTANCE_STAT_LOCAL_MINRXPLOSS,
172 /*! Retrieve average number of packets lost on local side */
173 AST_RTP_INSTANCE_STAT_LOCAL_NORMDEVRXPLOSS,
174 /*! Retrieve standard deviation of packets lost on local side */
175 AST_RTP_INSTANCE_STAT_LOCAL_STDEVRXPLOSS,
176 /*! Retrieve ALL statistics relating to jitter */
177 AST_RTP_INSTANCE_STAT_COMBINED_JITTER,
178 /*! Retrieve jitter on transmitted packets */
179 AST_RTP_INSTANCE_STAT_TXJITTER,
180 /*! Retrieve jitter on received packets */
181 AST_RTP_INSTANCE_STAT_RXJITTER,
182 /*! Retrieve maximum jitter on remote side */
183 AST_RTP_INSTANCE_STAT_REMOTE_MAXJITTER,
184 /*! Retrieve minimum jitter on remote side */
185 AST_RTP_INSTANCE_STAT_REMOTE_MINJITTER,
186 /*! Retrieve average jitter on remote side */
187 AST_RTP_INSTANCE_STAT_REMOTE_NORMDEVJITTER,
188 /*! Retrieve standard deviation jitter on remote side */
189 AST_RTP_INSTANCE_STAT_REMOTE_STDEVJITTER,
190 /*! Retrieve maximum jitter on local side */
191 AST_RTP_INSTANCE_STAT_LOCAL_MAXJITTER,
192 /*! Retrieve minimum jitter on local side */
193 AST_RTP_INSTANCE_STAT_LOCAL_MINJITTER,
194 /*! Retrieve average jitter on local side */
195 AST_RTP_INSTANCE_STAT_LOCAL_NORMDEVJITTER,
196 /*! Retrieve standard deviation jitter on local side */
197 AST_RTP_INSTANCE_STAT_LOCAL_STDEVJITTER,
198 /*! Retrieve ALL statistics relating to round trip time */
199 AST_RTP_INSTANCE_STAT_COMBINED_RTT,
200 /*! Retrieve round trip time */
201 AST_RTP_INSTANCE_STAT_RTT,
202 /*! Retrieve maximum round trip time */
203 AST_RTP_INSTANCE_STAT_MAX_RTT,
204 /*! Retrieve minimum round trip time */
205 AST_RTP_INSTANCE_STAT_MIN_RTT,
206 /*! Retrieve average round trip time */
207 AST_RTP_INSTANCE_STAT_NORMDEVRTT,
208 /*! Retrieve standard deviation round trip time */
209 AST_RTP_INSTANCE_STAT_STDEVRTT,
210 /*! Retrieve local SSRC */
211 AST_RTP_INSTANCE_STAT_LOCAL_SSRC,
212 /*! Retrieve remote SSRC */
213 AST_RTP_INSTANCE_STAT_REMOTE_SSRC,
216 /* Codes for RTP-specific data - not defined by our AST_FORMAT codes */
217 /*! DTMF (RFC2833) */
218 #define AST_RTP_DTMF (1 << 0)
219 /*! 'Comfort Noise' (RFC3389) */
220 #define AST_RTP_CN (1 << 1)
221 /*! DTMF (Cisco Proprietary) */
222 #define AST_RTP_CISCO_DTMF (1 << 2)
223 /*! Maximum RTP-specific code */
224 #define AST_RTP_MAX AST_RTP_CISCO_DTMF
226 /*! Structure that represents a payload */
227 struct ast_rtp_payload_type {
228 /*! Is this an Asterisk value */
230 /*! Actual internal value of the payload */
234 /*! Structure that represents statistics from an RTP instance */
235 struct ast_rtp_instance_stats {
236 /*! Number of packets transmitted */
237 unsigned int txcount;
238 /*! Number of packets received */
239 unsigned int rxcount;
240 /*! Jitter on transmitted packets */
242 /*! Jitter on received packets */
244 /*! Maximum jitter on remote side */
245 double remote_maxjitter;
246 /*! Minimum jitter on remote side */
247 double remote_minjitter;
248 /*! Average jitter on remote side */
249 double remote_normdevjitter;
250 /*! Standard deviation jitter on remote side */
251 double remote_stdevjitter;
252 /*! Maximum jitter on local side */
253 double local_maxjitter;
254 /*! Minimum jitter on local side */
255 double local_minjitter;
256 /*! Average jitter on local side */
257 double local_normdevjitter;
258 /*! Standard deviation jitter on local side */
259 double local_stdevjitter;
260 /*! Number of transmitted packets lost */
261 unsigned int txploss;
262 /*! Number of received packets lost */
263 unsigned int rxploss;
264 /*! Maximum number of packets lost on remote side */
265 double remote_maxrxploss;
266 /*! Minimum number of packets lost on remote side */
267 double remote_minrxploss;
268 /*! Average number of packets lost on remote side */
269 double remote_normdevrxploss;
270 /*! Standard deviation packets lost on remote side */
271 double remote_stdevrxploss;
272 /*! Maximum number of packets lost on local side */
273 double local_maxrxploss;
274 /*! Minimum number of packets lost on local side */
275 double local_minrxploss;
276 /*! Average number of packets lost on local side */
277 double local_normdevrxploss;
278 /*! Standard deviation packets lost on local side */
279 double local_stdevrxploss;
280 /*! Total round trip time */
282 /*! Maximum round trip time */
284 /*! Minimum round trip time */
286 /*! Average round trip time */
288 /*! Standard deviation round trip time */
291 unsigned int local_ssrc;
293 unsigned int remote_ssrc;
296 #define AST_RTP_STAT_SET(current_stat, combined, placement, value) \
297 if (stat == current_stat || stat == AST_RTP_INSTANCE_STAT_ALL || (combined >= 0 && combined == current_stat)) { \
299 if (stat == current_stat) { \
304 #define AST_RTP_STAT_TERMINATOR(combined) \
305 if (stat == combined) { \
309 /*! Structure that represents an RTP stack (engine) */
310 struct ast_rtp_engine {
311 /*! Name of the RTP engine, used when explicitly requested */
313 /*! Module this RTP engine came from, used for reference counting */
314 struct ast_module *mod;
315 /*! Callback for setting up a new RTP instance */
316 int (*new)(struct ast_rtp_instance *instance, struct sched_context *sched, struct ast_sockaddr *sa, void *data);
317 /*! Callback for destroying an RTP instance */
318 int (*destroy)(struct ast_rtp_instance *instance);
319 /*! Callback for writing out a frame */
320 int (*write)(struct ast_rtp_instance *instance, struct ast_frame *frame);
321 /*! Callback for stopping the RTP instance */
322 void (*stop)(struct ast_rtp_instance *instance);
323 /*! Callback for starting RFC2833 DTMF transmission */
324 int (*dtmf_begin)(struct ast_rtp_instance *instance, char digit);
325 /*! Callback for stopping RFC2833 DTMF transmission */
326 int (*dtmf_end)(struct ast_rtp_instance *instance, char digit);
327 /*! Callback to indicate that we should update the marker bit */
328 void (*update_source)(struct ast_rtp_instance *instance);
329 /*! Callback to indicate that we should update the marker bit and ssrc */
330 void (*change_source)(struct ast_rtp_instance *instance);
331 /*! Callback for setting an extended RTP property */
332 int (*extended_prop_set)(struct ast_rtp_instance *instance, int property, void *value);
333 /*! Callback for getting an extended RTP property */
334 void *(*extended_prop_get)(struct ast_rtp_instance *instance, int property);
335 /*! Callback for setting an RTP property */
336 void (*prop_set)(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
337 /*! Callback for setting a payload */
338 void (*payload_set)(struct ast_rtp_instance *instance, int payload, int astformat, format_t format);
339 /*! Callback for setting packetization preferences */
340 void (*packetization_set)(struct ast_rtp_instance *instance, struct ast_codec_pref *pref);
341 /*! Callback for setting the remote address that RTP is to be sent to */
342 void (*remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa);
343 /*! Callback for setting an alternate remote address */
344 void (*alt_remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa);
345 /*! Callback for changing DTMF mode */
346 int (*dtmf_mode_set)(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode);
347 /*! Callback for retrieving statistics */
348 int (*get_stat)(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat);
349 /*! Callback for setting QoS values */
350 int (*qos)(struct ast_rtp_instance *instance, int tos, int cos, const char *desc);
351 /*! Callback for retrieving a file descriptor to poll on, not always required */
352 int (*fd)(struct ast_rtp_instance *instance, int rtcp);
353 /*! Callback for initializing RED support */
354 int (*red_init)(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations);
355 /*! Callback for buffering a frame using RED */
356 int (*red_buffer)(struct ast_rtp_instance *instance, struct ast_frame *frame);
357 /*! Callback for reading a frame from the RTP engine */
358 struct ast_frame *(*read)(struct ast_rtp_instance *instance, int rtcp);
359 /*! Callback to locally bridge two RTP instances */
360 int (*local_bridge)(struct ast_rtp_instance *instance0, struct ast_rtp_instance *instance1);
361 /*! Callback to set the read format */
362 int (*set_read_format)(struct ast_rtp_instance *instance, format_t format);
363 /*! Callback to set the write format */
364 int (*set_write_format)(struct ast_rtp_instance *instance, format_t format);
365 /*! Callback to make two instances compatible */
366 int (*make_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1);
367 /*! Callback to see if two instances are compatible with DTMF */
368 int (*dtmf_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1);
369 /*! Callback to indicate that packets will now flow */
370 int (*activate)(struct ast_rtp_instance *instance);
371 /*! Callback to request that the RTP engine send a STUN BIND request */
372 void (*stun_request)(struct ast_rtp_instance *instance, struct ast_sockaddr *suggestion, const char *username);
373 /*! Callback to get the transcodeable formats supported */
374 int (*available_formats)(struct ast_rtp_instance *instance, format_t to_endpoint, format_t to_asterisk);
375 /*! Linked list information */
376 AST_RWLIST_ENTRY(ast_rtp_engine) entry;
379 /*! Structure that represents codec and packetization information */
380 struct ast_rtp_codecs {
381 /*! Codec packetization preferences */
382 struct ast_codec_pref pref;
383 /*! Payloads present */
384 struct ast_rtp_payload_type payloads[AST_RTP_MAX_PT];
387 /*! Structure that represents the glue that binds an RTP instance to a channel */
388 struct ast_rtp_glue {
389 /*! Name of the channel driver that this glue is responsible for */
391 /*! Module that the RTP glue came from */
392 struct ast_module *mod;
394 * \brief Callback for retrieving the RTP instance carrying audio
395 * \note This function increases the reference count on the returned RTP instance.
397 enum ast_rtp_glue_result (*get_rtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
399 * \brief Callback for retrieving the RTP instance carrying video
400 * \note This function increases the reference count on the returned RTP instance.
402 enum ast_rtp_glue_result (*get_vrtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
404 * \brief Callback for retrieving the RTP instance carrying text
405 * \note This function increases the reference count on the returned RTP instance.
407 enum ast_rtp_glue_result (*get_trtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
408 /*! Callback for updating the destination that the remote side should send RTP to */
409 int (*update_peer)(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, format_t codecs, int nat_active);
410 /*! Callback for retrieving codecs that the channel can do */
411 format_t (*get_codec)(struct ast_channel *chan);
412 /*! Linked list information */
413 AST_RWLIST_ENTRY(ast_rtp_glue) entry;
416 #define ast_rtp_engine_register(engine) ast_rtp_engine_register2(engine, ast_module_info->self)
419 * \brief Register an RTP engine
421 * \param engine Structure of the RTP engine to register
422 * \param module Module that the RTP engine is part of
430 * ast_rtp_engine_register2(&example_rtp_engine, NULL);
433 * This registers the RTP engine declared as example_rtp_engine with the RTP engine core, but does not
434 * associate a module with it.
436 * \note It is recommended that you use the ast_rtp_engine_register macro so that the module is
437 * associated with the RTP engine and use counting is performed.
441 int ast_rtp_engine_register2(struct ast_rtp_engine *engine, struct ast_module *module);
444 * \brief Unregister an RTP engine
446 * \param engine Structure of the RTP engine to unregister
454 * ast_rtp_engine_unregister(&example_rtp_engine);
457 * This unregisters the RTP engine declared as example_rtp_engine from the RTP engine core. If a module
458 * reference was provided when it was registered then this will only be called once the RTP engine is no longer in use.
462 int ast_rtp_engine_unregister(struct ast_rtp_engine *engine);
464 int ast_rtp_engine_register_srtp(struct ast_srtp_res *srtp_res, struct ast_srtp_policy_res *policy_res);
466 void ast_rtp_engine_unregister_srtp(void);
467 int ast_rtp_engine_srtp_is_registered(void);
469 #define ast_rtp_glue_register(glue) ast_rtp_glue_register2(glue, ast_module_info->self)
472 * \brief Register RTP glue
474 * \param glue The glue to register
475 * \param module Module that the RTP glue is part of
483 * ast_rtp_glue_register2(&example_rtp_glue, NULL);
486 * This registers the RTP glue declared as example_rtp_glue with the RTP engine core, but does not
487 * associate a module with it.
489 * \note It is recommended that you use the ast_rtp_glue_register macro so that the module is
490 * associated with the RTP glue and use counting is performed.
494 int ast_rtp_glue_register2(struct ast_rtp_glue *glue, struct ast_module *module);
497 * \brief Unregister RTP glue
499 * \param glue The glue to unregister
507 * ast_rtp_glue_unregister(&example_rtp_glue);
510 * This unregisters the RTP glue declared as example_rtp_gkue from the RTP engine core. If a module
511 * reference was provided when it was registered then this will only be called once the RTP engine is no longer in use.
515 int ast_rtp_glue_unregister(struct ast_rtp_glue *glue);
518 * \brief Create a new RTP instance
520 * \param engine_name Name of the engine to use for the RTP instance
521 * \param sched Scheduler context that the RTP engine may want to use
522 * \param sa Address we want to bind to
523 * \param data Unique data for the engine
525 * \retval non-NULL success
526 * \retval NULL failure
531 * struct ast_rtp_instance *instance = NULL;
532 * instance = ast_rtp_instance_new(NULL, sched, &sin, NULL);
535 * This creates a new RTP instance using the default engine and asks the RTP engine to bind to the address given
536 * in the address structure.
538 * \note The RTP engine does not have to use the address provided when creating an RTP instance. It may choose to use
539 * another depending on it's own configuration.
543 struct ast_rtp_instance *ast_rtp_instance_new(const char *engine_name,
544 struct sched_context *sched, const struct ast_sockaddr *sa,
548 * \brief Destroy an RTP instance
550 * \param instance The RTP instance to destroy
558 * ast_rtp_instance_destroy(instance);
561 * This destroys the RTP instance pointed to by instance. Once this function returns instance no longer points to valid
562 * memory and may not be used again.
566 int ast_rtp_instance_destroy(struct ast_rtp_instance *instance);
569 * \brief Set the data portion of an RTP instance
571 * \param instance The RTP instance to manipulate
572 * \param data Pointer to data
577 * ast_rtp_instance_set_data(instance, blob);
580 * This sets the data pointer on the RTP instance pointed to by 'instance' to
585 void ast_rtp_instance_set_data(struct ast_rtp_instance *instance, void *data);
588 * \brief Get the data portion of an RTP instance
590 * \param instance The RTP instance we want the data portion from
595 * struct *blob = ast_rtp_instance_get_data(instance);
598 * This gets the data pointer on the RTP instance pointed to by 'instance'.
602 void *ast_rtp_instance_get_data(struct ast_rtp_instance *instance);
605 * \brief Send a frame out over RTP
607 * \param instance The RTP instance to send frame out on
608 * \param frame the frame to send out
616 * ast_rtp_instance_write(instance, frame);
619 * This gives the frame pointed to by frame to the RTP engine being used for the instance
620 * and asks that it be transmitted to the current remote address set on the RTP instance.
624 int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame);
627 * \brief Receive a frame over RTP
629 * \param instance The RTP instance to receive frame on
630 * \param rtcp Whether to read in RTCP or not
632 * \retval non-NULL success
633 * \retval NULL failure
638 * struct ast_frame *frame;
639 * frame = ast_rtp_instance_read(instance, 0);
642 * This asks the RTP engine to read in RTP from the instance and return it as an Asterisk frame.
646 struct ast_frame *ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp);
649 * \brief Set the address of the remote endpoint that we are sending RTP to
651 * \param instance The RTP instance to change the address on
652 * \param address Address to set it to
660 * ast_rtp_instance_set_remote_address(instance, &sin);
663 * This changes the remote address that RTP will be sent to on instance to the address given in the sin
668 int ast_rtp_instance_set_remote_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address);
672 * \brief Set the address of an an alternate RTP address to receive from
674 * \param instance The RTP instance to change the address on
675 * \param address Address to set it to
683 * ast_rtp_instance_set_alt_remote_address(instance, &address);
686 * This changes the alternate remote address that RTP will be sent to on instance to the address given in the sin
691 int ast_rtp_instance_set_alt_remote_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address);
694 * \brief Set the address that we are expecting to receive RTP on
696 * \param instance The RTP instance to change the address on
697 * \param address Address to set it to
705 * ast_rtp_instance_set_local_address(instance, &sin);
708 * This changes the local address that RTP is expected on to the address given in the sin
713 int ast_rtp_instance_set_local_address(struct ast_rtp_instance *instance,
714 const struct ast_sockaddr *address);
717 * \brief Get the local address that we are expecting RTP on
719 * \param instance The RTP instance to get the address from
720 * \param address The variable to store the address in
728 * struct ast_sockaddr address;
729 * ast_rtp_instance_get_local_address(instance, &address);
732 * This gets the local address that we are expecting RTP on and stores it in the 'address' structure.
736 int ast_rtp_instance_get_local_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address);
739 * \brief Get the address of the remote endpoint that we are sending RTP to
741 * \param instance The instance that we want to get the remote address for
742 * \param address A structure to put the address into
750 * struct ast_sockaddr address;
751 * ast_rtp_instance_get_remote_address(instance, &address);
754 * This retrieves the current remote address set on the instance pointed to by instance and puts the value
755 * into the address structure.
759 int ast_rtp_instance_get_remote_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address);
762 * \brief Set the value of an RTP instance extended property
764 * \param instance The RTP instance to set the extended property on
765 * \param property The extended property to set
766 * \param value The value to set the extended property to
770 void ast_rtp_instance_set_extended_prop(struct ast_rtp_instance *instance, int property, void *value);
773 * \brief Get the value of an RTP instance extended property
775 * \param instance The RTP instance to get the extended property on
776 * \param property The extended property to get
780 void *ast_rtp_instance_get_extended_prop(struct ast_rtp_instance *instance, int property);
783 * \brief Set the value of an RTP instance property
785 * \param instance The RTP instance to set the property on
786 * \param property The property to modify
787 * \param value The value to set the property to
792 * ast_rtp_instance_set_prop(instance, AST_RTP_PROPERTY_NAT, 1);
795 * This enables the AST_RTP_PROPERTY_NAT property on the instance pointed to by instance.
799 void ast_rtp_instance_set_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
802 * \brief Get the value of an RTP instance property
804 * \param instance The RTP instance to get the property from
805 * \param property The property to get
807 * \retval Current value of the property
812 * ast_rtp_instance_get_prop(instance, AST_RTP_PROPERTY_NAT);
815 * This returns the current value of the NAT property on the instance pointed to by instance.
819 int ast_rtp_instance_get_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property);
822 * \brief Get the codecs structure of an RTP instance
824 * \param instance The RTP instance to get the codecs structure from
829 * struct ast_rtp_codecs *codecs = ast_rtp_instance_get_codecs(instance);
832 * This gets the codecs structure on the RTP instance pointed to by 'instance'.
836 struct ast_rtp_codecs *ast_rtp_instance_get_codecs(struct ast_rtp_instance *instance);
839 * \brief Clear payload information from an RTP instance
841 * \param codecs The codecs structure that payloads will be cleared from
842 * \param instance Optionally the instance that the codecs structure belongs to
847 * struct ast_rtp_codecs codecs;
848 * ast_rtp_codecs_payloads_clear(&codecs, NULL);
851 * This clears the codecs structure and puts it into a pristine state.
855 void ast_rtp_codecs_payloads_clear(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance);
858 * \brief Set payload information on an RTP instance to the default
860 * \param codecs The codecs structure to set defaults on
861 * \param instance Optionally the instance that the codecs structure belongs to
866 * struct ast_rtp_codecs codecs;
867 * ast_rtp_codecs_payloads_default(&codecs, NULL);
870 * This sets the default payloads on the codecs structure.
874 void ast_rtp_codecs_payloads_default(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance);
877 * \brief Copy payload information from one RTP instance to another
879 * \param src The source codecs structure
880 * \param dest The destination codecs structure that the values from src will be copied to
881 * \param instance Optionally the instance that the dst codecs structure belongs to
886 * ast_rtp_codecs_payloads_copy(&codecs0, &codecs1, NULL);
889 * This copies the payloads from the codecs0 structure to the codecs1 structure, overwriting any current values.
893 void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance);
896 * \brief Record payload information that was seen in an m= SDP line
898 * \param codecs The codecs structure to muck with
899 * \param instance Optionally the instance that the codecs structure belongs to
900 * \param payload Numerical payload that was seen in the m= SDP line
905 * ast_rtp_codecs_payloads_set_m_type(&codecs, NULL, 0);
908 * This records that the numerical payload '0' was seen in the codecs structure.
912 void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload);
915 * \brief Record payload information that was seen in an a=rtpmap: SDP line
917 * \param codecs The codecs structure to muck with
918 * \param instance Optionally the instance that the codecs structure belongs to
919 * \param payload Numerical payload that was seen in the a=rtpmap: SDP line
920 * \param mimetype The string mime type that was seen
921 * \param mimesubtype The strin mime sub type that was seen
922 * \param options Optional options that may change the behavior of this specific payload
930 * ast_rtp_codecs_payloads_set_rtpmap_type(&codecs, NULL, 0, "audio", "PCMU", 0);
933 * This records that the numerical payload '0' was seen with mime type 'audio' and sub mime type 'PCMU' in the codecs structure.
937 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);
940 * \brief Set payload type to a known MIME media type for a codec with a specific sample rate
942 * \param codecs RTP structure to modify
943 * \param instance Optionally the instance that the codecs structure belongs to
944 * \param pt Payload type entry to modify
945 * \param mimetype top-level MIME type of media stream (typically "audio", "video", "text", etc.)
946 * \param mimesubtype MIME subtype of media stream (typically a codec name)
947 * \param options Zero or more flags from the ast_rtp_options enum
948 * \param sample_rate The sample rate of the media stream
950 * This function 'fills in' an entry in the list of possible formats for
951 * a media stream associated with an RTP structure.
953 * \retval 0 on success
954 * \retval -1 if the payload type is out of range
955 * \retval -2 if the mimeType/mimeSubtype combination was not found
959 int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int pt,
960 char *mimetype, char *mimesubtype,
961 enum ast_rtp_options options,
962 unsigned int sample_rate);
965 * \brief Remove payload information
967 * \param codecs The codecs structure to muck with
968 * \param instance Optionally the instance that the codecs structure belongs to
969 * \param payload Numerical payload to unset
974 * ast_rtp_codecs_payloads_unset(&codecs, NULL, 0);
977 * This clears the payload '0' from the codecs structure. It will be as if it was never set.
981 void ast_rtp_codecs_payloads_unset(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload);
984 * \brief Retrieve payload information by payload
986 * \param codecs Codecs structure to look in
987 * \param payload Numerical payload to look up
989 * \retval Payload information
994 * struct ast_rtp_payload_type payload_type;
995 * payload_type = ast_rtp_codecs_payload_lookup(&codecs, 0);
998 * This looks up the information for payload '0' from the codecs structure.
1002 struct ast_rtp_payload_type ast_rtp_codecs_payload_lookup(struct ast_rtp_codecs *codecs, int payload);
1005 * \brief Get the sample rate associated with known RTP payload types
1007 * \param asterisk_format True if the value in the 'code' parameter is an AST_FORMAT value
1008 * \param code Format code, either from AST_FORMAT list or from AST_RTP list
1010 * \return the sample rate if the format was found, zero if it was not found
1014 unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, format_t code);
1017 * \brief Retrieve all formats that were found
1019 * \param codecs Codecs structure to look in
1020 * \param astformats An integer to put the Asterisk formats in
1021 * \param nonastformats An integer to put the non-Asterisk formats in
1026 * int astformats, nonastformats;
1027 * ast_rtp_codecs_payload_Formats(&codecs, &astformats, &nonastformats);
1030 * This retrieves all the formats known about in the codecs structure and puts the Asterisk ones in the integer
1031 * pointed to by astformats and the non-Asterisk ones in the integer pointed to by nonastformats.
1035 void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, format_t *astformats, int *nonastformats);
1038 * \brief Retrieve a payload based on whether it is an Asterisk format and the code
1040 * \param codecs Codecs structure to look in
1041 * \param asterisk_format Non-zero if the given code is an Asterisk format value
1042 * \param code The format to look for
1044 * \retval Numerical payload
1049 * int payload = ast_rtp_codecs_payload_code(&codecs, 1, AST_FORMAT_ULAW);
1052 * This looks for the numerical payload for ULAW in the codecs structure.
1056 int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asterisk_format, const format_t code);
1059 * \brief Retrieve mime subtype information on a payload
1061 * \param asterisk_format Non-zero if the given code is an Asterisk format value
1062 * \param code Format to look up
1063 * \param options Additional options that may change the result
1065 * \retval Mime subtype success
1066 * \retval NULL failure
1071 * const char *subtype = ast_rtp_lookup_mime_subtype2(1, AST_FORMAT_ULAW, 0);
1074 * This looks up the mime subtype for the ULAW format.
1078 const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, const format_t code, enum ast_rtp_options options);
1081 * \brief Convert formats into a string and put them into a buffer
1083 * \param buf Buffer to put the mime output into
1084 * \param capability Formats that we are looking up
1085 * \param asterisk_format Non-zero if the given capability are Asterisk format capabilities
1086 * \param options Additional options that may change the result
1088 * \retval non-NULL success
1089 * \retval NULL failure
1094 * char buf[256] = "";
1095 * char *mime = ast_rtp_lookup_mime_multiple2(&buf, sizeof(buf), AST_FORMAT_ULAW | AST_FORMAT_ALAW, 1, 0);
1098 * This returns the mime values for ULAW and ALAW in the buffer pointed to by buf.
1102 char *ast_rtp_lookup_mime_multiple2(struct ast_str *buf, const format_t capability, const int asterisk_format, enum ast_rtp_options options);
1105 * \brief Set codec packetization preferences
1107 * \param codecs Codecs structure to muck with
1108 * \param instance Optionally the instance that the codecs structure belongs to
1109 * \param prefs Codec packetization preferences
1114 * ast_rtp_codecs_packetization_set(&codecs, NULL, &prefs);
1117 * This sets the packetization preferences pointed to by prefs on the codecs structure pointed to by codecs.
1121 void ast_rtp_codecs_packetization_set(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, struct ast_codec_pref *prefs);
1124 * \brief Begin sending a DTMF digit
1126 * \param instance The RTP instance to send the DTMF on
1127 * \param digit What DTMF digit to send
1130 * \retval -1 failure
1135 * ast_rtp_instance_dtmf_begin(instance, '1');
1138 * This starts sending the DTMF '1' on the RTP instance pointed to by instance. It will
1139 * continue being sent until it is ended.
1143 int ast_rtp_instance_dtmf_begin(struct ast_rtp_instance *instance, char digit);
1146 * \brief Stop sending a DTMF digit
1148 * \param instance The RTP instance to stop the DTMF on
1149 * \param digit What DTMF digit to stop
1152 * \retval -1 failure
1157 * ast_rtp_instance_dtmf_end(instance, '1');
1160 * This stops sending the DTMF '1' on the RTP instance pointed to by instance.
1164 int ast_rtp_instance_dtmf_end(struct ast_rtp_instance *instance, char digit);
1167 * \brief Set the DTMF mode that should be used
1169 * \param instance the RTP instance to set DTMF mode on
1170 * \param dtmf_mode The DTMF mode that is in use
1173 * \retval -1 failure
1178 * ast_rtp_instance_dtmf_mode_set(instance, AST_RTP_DTMF_MODE_RFC2833);
1181 * This sets the RTP instance to use RFC2833 for DTMF transmission and receiving.
1185 int ast_rtp_instance_dtmf_mode_set(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode);
1188 * \brief Get the DTMF mode of an RTP instance
1190 * \param instance The RTP instance to get the DTMF mode of
1197 * enum ast_rtp_dtmf_mode dtmf_mode = ast_rtp_instance_dtmf_mode_get(instance);
1200 * This gets the DTMF mode set on the RTP instance pointed to by 'instance'.
1204 enum ast_rtp_dtmf_mode ast_rtp_instance_dtmf_mode_get(struct ast_rtp_instance *instance);
1207 * \brief Indicate that the RTP marker bit should be set on an RTP stream
1209 * \param instance Instance that the new media source is feeding into
1214 * ast_rtp_instance_update_source(instance);
1217 * This indicates that the source of media that is feeding the instance pointed to by
1218 * instance has been updated and that the marker bit should be set.
1222 void ast_rtp_instance_update_source(struct ast_rtp_instance *instance);
1225 * \brief Indicate a new source of audio has dropped in and the ssrc should change
1227 * \param instance Instance that the new media source is feeding into
1232 * ast_rtp_instance_change_source(instance);
1235 * This indicates that the source of media that is feeding the instance pointed to by
1236 * instance has changed and that the marker bit should be set and the SSRC updated.
1240 void ast_rtp_instance_change_source(struct ast_rtp_instance *instance);
1243 * \brief Set QoS parameters on an RTP session
1245 * \param instance Instance to set the QoS parameters on
1246 * \param tos Terms of service value
1247 * \param cos Class of service value
1248 * \param desc What is setting the QoS values
1251 * \retval -1 failure
1256 * ast_rtp_instance_set_qos(instance, 0, 0, "Example");
1259 * This sets the TOS and COS values to 0 on the instance pointed to by instance.
1263 int ast_rtp_instance_set_qos(struct ast_rtp_instance *instance, int tos, int cos, const char *desc);
1266 * \brief Stop an RTP instance
1268 * \param instance Instance that media is no longer going to at this time
1273 * ast_rtp_instance_stop(instance);
1276 * This tells the RTP engine being used for the instance pointed to by instance
1277 * that media is no longer going to it at this time, but may in the future.
1281 void ast_rtp_instance_stop(struct ast_rtp_instance *instance);
1284 * \brief Get the file descriptor for an RTP session (or RTCP)
1286 * \param instance Instance to get the file descriptor for
1287 * \param rtcp Whether to retrieve the file descriptor for RTCP or not
1289 * \retval fd success
1290 * \retval -1 failure
1295 * int rtp_fd = ast_rtp_instance_fd(instance, 0);
1298 * This retrieves the file descriptor for the socket carrying media on the instance
1299 * pointed to by instance.
1303 int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp);
1306 * \brief Get the RTP glue that binds a channel to the RTP engine
1308 * \param type Name of the glue we want
1310 * \retval non-NULL success
1311 * \retval NULL failure
1316 * struct ast_rtp_glue *glue = ast_rtp_instance_get_glue("Example");
1319 * This retrieves the RTP glue that has the name 'Example'.
1323 struct ast_rtp_glue *ast_rtp_instance_get_glue(const char *type);
1326 * \brief Bridge two channels that use RTP instances
1328 * \param c0 First channel part of the bridge
1329 * \param c1 Second channel part of the bridge
1330 * \param flags Bridging flags
1331 * \param fo If a frame needs to be passed up it is stored here
1332 * \param rc Channel that passed the above frame up
1333 * \param timeoutms How long the channels should be bridged for
1335 * \retval Bridge result
1337 * \note This should only be used by channel drivers in their technology declaration.
1341 enum ast_bridge_result ast_rtp_instance_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
1344 * \brief Get the other RTP instance that an instance is bridged to
1346 * \param instance The RTP instance that we want
1348 * \retval non-NULL success
1349 * \retval NULL failure
1354 * struct ast_rtp_instance *bridged = ast_rtp_instance_get_bridged(instance0);
1357 * This gets the RTP instance that instance0 is bridged to.
1361 struct ast_rtp_instance *ast_rtp_instance_get_bridged(struct ast_rtp_instance *instance);
1364 * \brief Make two channels compatible for early bridging
1366 * \param c0 First channel part of the bridge
1367 * \param c1 Second channel part of the bridge
1371 void ast_rtp_instance_early_bridge_make_compatible(struct ast_channel *c0, struct ast_channel *c1);
1374 * \brief Early bridge two channels that use RTP instances
1376 * \param c0 First channel part of the bridge
1377 * \param c1 Second channel part of the bridge
1380 * \retval -1 failure
1382 * \note This should only be used by channel drivers in their technology declaration.
1386 int ast_rtp_instance_early_bridge(struct ast_channel *c0, struct ast_channel *c1);
1389 * \brief Initialize RED support on an RTP instance
1391 * \param instance The instance to initialize RED support on
1392 * \param buffer_time How long to buffer before sending
1393 * \param payloads Payload values
1394 * \param generations Number of generations
1397 * \retval -1 failure
1401 int ast_rtp_red_init(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations);
1404 * \brief Buffer a frame in an RTP instance for RED
1406 * \param instance The instance to buffer the frame on
1407 * \param frame Frame that we want to buffer
1410 * \retval -1 failure
1414 int ast_rtp_red_buffer(struct ast_rtp_instance *instance, struct ast_frame *frame);
1417 * \brief Retrieve statistics about an RTP instance
1419 * \param instance Instance to get statistics on
1420 * \param stats Structure to put results into
1421 * \param stat What statistic(s) to retrieve
1424 * \retval -1 failure
1429 * struct ast_rtp_instance_stats stats;
1430 * ast_rtp_instance_get_stats(instance, &stats, AST_RTP_INSTANCE_STAT_ALL);
1433 * This retrieves all statistics the underlying RTP engine supports and puts the values into the
1438 int ast_rtp_instance_get_stats(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat);
1441 * \brief Set standard statistics from an RTP instance on a channel
1443 * \param chan Channel to set the statistics on
1444 * \param instance The RTP instance that statistics will be retrieved from
1449 * ast_rtp_instance_set_stats_vars(chan, rtp);
1452 * This retrieves standard statistics from the RTP instance rtp and sets it on the channel pointed to
1457 void ast_rtp_instance_set_stats_vars(struct ast_channel *chan, struct ast_rtp_instance *instance);
1460 * \brief Retrieve quality statistics about an RTP instance
1462 * \param instance Instance to get statistics on
1463 * \param field What quality statistic to retrieve
1464 * \param buf What buffer to put the result into
1465 * \param size Size of the above buffer
1467 * \retval non-NULL success
1468 * \retval NULL failure
1473 * char quality[AST_MAX_USER_FIELD];
1474 * ast_rtp_instance_get_quality(instance, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, &buf, sizeof(buf));
1477 * This retrieves general quality statistics and places a text representation into the buf pointed to by buf.
1481 char *ast_rtp_instance_get_quality(struct ast_rtp_instance *instance, enum ast_rtp_instance_stat_field field, char *buf, size_t size);
1484 * \brief Request that the underlying RTP engine provide audio frames in a specific format
1486 * \param instance The RTP instance to change read format on
1487 * \param format Format that frames are wanted in
1490 * \retval -1 failure
1495 * ast_rtp_instance_set_read_format(instance, AST_FORMAT_ULAW);
1498 * This requests that the RTP engine provide audio frames in the ULAW format.
1502 int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, format_t format);
1505 * \brief Tell underlying RTP engine that audio frames will be provided in a specific format
1507 * \param instance The RTP instance to change write format on
1508 * \param format Format that frames will be provided in
1511 * \retval -1 failure
1516 * ast_rtp_instance_set_write_format(instance, AST_FORMAT_ULAW);
1519 * This tells the underlying RTP engine that audio frames will be provided to it in ULAW format.
1523 int ast_rtp_instance_set_write_format(struct ast_rtp_instance *instance, format_t format);
1526 * \brief Request that the underlying RTP engine make two RTP instances compatible with eachother
1528 * \param chan Our own Asterisk channel
1529 * \param instance The first RTP instance
1530 * \param peer The peer Asterisk channel
1533 * \retval -1 failure
1538 * ast_rtp_instance_make_compatible(instance, peer);
1541 * This makes the RTP instance for 'peer' compatible with 'instance' and vice versa.
1545 int ast_rtp_instance_make_compatible(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_channel *peer);
1547 /*! \brief Request the formats that can be transcoded
1549 * \param instance The RTP instance
1550 * \param to_endpoint Formats being sent/received towards the endpoint
1551 * \param to_asterisk Formats being sent/received towards Asterisk
1553 * \retval supported formats
1558 * ast_rtp_instance_available_formats(instance, AST_FORMAT_ULAW, AST_FORMAT_SLINEAR);
1561 * This sees if it is possible to have ulaw communicated to the endpoint but signed linear received into Asterisk.
1565 format_t ast_rtp_instance_available_formats(struct ast_rtp_instance *instance, format_t to_endpoint, format_t to_asterisk);
1568 * \brief Indicate to the RTP engine that packets are now expected to be sent/received on the RTP instance
1570 * \param instance The RTP instance
1573 * \retval -1 failure
1578 * ast_rtp_instance_activate(instance);
1581 * This tells the underlying RTP engine of instance that packets will now flow.
1585 int ast_rtp_instance_activate(struct ast_rtp_instance *instance);
1588 * \brief Request that the underlying RTP engine send a STUN BIND request
1590 * \param instance The RTP instance
1591 * \param suggestion The suggested destination
1592 * \param username Optionally a username for the request
1597 * ast_rtp_instance_stun_request(instance, NULL, NULL);
1600 * This requests that the RTP engine send a STUN BIND request on the session pointed to by
1605 void ast_rtp_instance_stun_request(struct ast_rtp_instance *instance, struct ast_sockaddr *suggestion, const char *username);
1608 * \brief Set the RTP timeout value
1610 * \param instance The RTP instance
1611 * \param timeout Value to set the timeout to
1616 * ast_rtp_instance_set_timeout(instance, 5000);
1619 * This sets the RTP timeout value on 'instance' to be 5000.
1623 void ast_rtp_instance_set_timeout(struct ast_rtp_instance *instance, int timeout);
1626 * \brief Set the RTP timeout value for when the instance is on hold
1628 * \param instance The RTP instance
1629 * \param timeout Value to set the timeout to
1634 * ast_rtp_instance_set_hold_timeout(instance, 5000);
1637 * This sets the RTP hold timeout value on 'instance' to be 5000.
1641 void ast_rtp_instance_set_hold_timeout(struct ast_rtp_instance *instance, int timeout);
1644 * \brief Get the RTP timeout value
1646 * \param instance The RTP instance
1648 * \retval timeout value
1653 * int timeout = ast_rtp_instance_get_timeout(instance);
1656 * This gets the RTP timeout value for the RTP instance pointed to by 'instance'.
1660 int ast_rtp_instance_get_timeout(struct ast_rtp_instance *instance);
1663 * \brief Get the RTP timeout value for when an RTP instance is on hold
1665 * \param instance The RTP instance
1667 * \retval timeout value
1672 * int timeout = ast_rtp_instance_get_hold_timeout(instance);
1675 * This gets the RTP hold timeout value for the RTP instance pointed to by 'instance'.
1679 int ast_rtp_instance_get_hold_timeout(struct ast_rtp_instance *instance);
1682 * \brief Get the RTP engine in use on an RTP instance
1684 * \param instance The RTP instance
1686 * \retval pointer to the engine
1691 * struct ast_rtp_engine *engine = ast_rtp_instance_get_engine(instance);
1694 * This gets the RTP engine currently in use on the RTP instance pointed to by 'instance'.
1698 struct ast_rtp_engine *ast_rtp_instance_get_engine(struct ast_rtp_instance *instance);
1701 * \brief Get the RTP glue in use on an RTP instance
1703 * \param instance The RTP instance
1705 * \retval pointer to the glue
1710 * struct ast_rtp_glue *glue = ast_rtp_instance_get_active_glue(instance);
1713 * This gets the RTP glue currently in use on the RTP instance pointed to by 'instance'.
1717 struct ast_rtp_glue *ast_rtp_instance_get_active_glue(struct ast_rtp_instance *instance);
1720 * \brief Get the channel that is associated with an RTP instance while in a bridge
1722 * \param instance The RTP instance
1724 * \retval pointer to the channel
1729 * struct ast_channel *chan = ast_rtp_instance_get_chan(instance);
1732 * This gets the channel associated with the RTP instance pointed to by 'instance'.
1734 * \note This will only return a channel while in a local or remote bridge.
1738 struct ast_channel *ast_rtp_instance_get_chan(struct ast_rtp_instance *instance);
1740 int ast_rtp_instance_add_srtp_policy(struct ast_rtp_instance *instance, struct ast_srtp_policy *policy);
1741 struct ast_srtp *ast_rtp_instance_get_srtp(struct ast_rtp_instance *instance);
1743 #if defined(__cplusplus) || defined(c_plusplus)
1747 #endif /* _ASTERISK_RTP_ENGINE_H */