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 int (*dtmf_end_with_duration)(struct ast_rtp_instance *instance, char digit, unsigned int duration);
328 /*! Callback to indicate that we should update the marker bit */
329 void (*update_source)(struct ast_rtp_instance *instance);
330 /*! Callback to indicate that we should update the marker bit and ssrc */
331 void (*change_source)(struct ast_rtp_instance *instance);
332 /*! Callback for setting an extended RTP property */
333 int (*extended_prop_set)(struct ast_rtp_instance *instance, int property, void *value);
334 /*! Callback for getting an extended RTP property */
335 void *(*extended_prop_get)(struct ast_rtp_instance *instance, int property);
336 /*! Callback for setting an RTP property */
337 void (*prop_set)(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
338 /*! Callback for setting a payload */
339 void (*payload_set)(struct ast_rtp_instance *instance, int payload, int astformat, format_t format);
340 /*! Callback for setting packetization preferences */
341 void (*packetization_set)(struct ast_rtp_instance *instance, struct ast_codec_pref *pref);
342 /*! Callback for setting the remote address that RTP is to be sent to */
343 void (*remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa);
344 /*! Callback for setting an alternate remote address */
345 void (*alt_remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa);
346 /*! Callback for changing DTMF mode */
347 int (*dtmf_mode_set)(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode);
348 /*! Callback for retrieving statistics */
349 int (*get_stat)(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat);
350 /*! Callback for setting QoS values */
351 int (*qos)(struct ast_rtp_instance *instance, int tos, int cos, const char *desc);
352 /*! Callback for retrieving a file descriptor to poll on, not always required */
353 int (*fd)(struct ast_rtp_instance *instance, int rtcp);
354 /*! Callback for initializing RED support */
355 int (*red_init)(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations);
356 /*! Callback for buffering a frame using RED */
357 int (*red_buffer)(struct ast_rtp_instance *instance, struct ast_frame *frame);
358 /*! Callback for reading a frame from the RTP engine */
359 struct ast_frame *(*read)(struct ast_rtp_instance *instance, int rtcp);
360 /*! Callback to locally bridge two RTP instances */
361 int (*local_bridge)(struct ast_rtp_instance *instance0, struct ast_rtp_instance *instance1);
362 /*! Callback to set the read format */
363 int (*set_read_format)(struct ast_rtp_instance *instance, format_t format);
364 /*! Callback to set the write format */
365 int (*set_write_format)(struct ast_rtp_instance *instance, format_t format);
366 /*! Callback to make two instances compatible */
367 int (*make_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1);
368 /*! Callback to see if two instances are compatible with DTMF */
369 int (*dtmf_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1);
370 /*! Callback to indicate that packets will now flow */
371 int (*activate)(struct ast_rtp_instance *instance);
372 /*! Callback to request that the RTP engine send a STUN BIND request */
373 void (*stun_request)(struct ast_rtp_instance *instance, struct ast_sockaddr *suggestion, const char *username);
374 /*! Callback to get the transcodeable formats supported */
375 int (*available_formats)(struct ast_rtp_instance *instance, format_t to_endpoint, format_t to_asterisk);
376 /*! Linked list information */
377 AST_RWLIST_ENTRY(ast_rtp_engine) entry;
380 /*! Structure that represents codec and packetization information */
381 struct ast_rtp_codecs {
382 /*! Codec packetization preferences */
383 struct ast_codec_pref pref;
384 /*! Payloads present */
385 struct ast_rtp_payload_type payloads[AST_RTP_MAX_PT];
388 /*! Structure that represents the glue that binds an RTP instance to a channel */
389 struct ast_rtp_glue {
390 /*! Name of the channel driver that this glue is responsible for */
392 /*! Module that the RTP glue came from */
393 struct ast_module *mod;
395 * \brief Callback for retrieving the RTP instance carrying audio
396 * \note This function increases the reference count on the returned RTP instance.
398 enum ast_rtp_glue_result (*get_rtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
400 * \brief Callback for retrieving the RTP instance carrying video
401 * \note This function increases the reference count on the returned RTP instance.
403 enum ast_rtp_glue_result (*get_vrtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
405 * \brief Callback for retrieving the RTP instance carrying text
406 * \note This function increases the reference count on the returned RTP instance.
408 enum ast_rtp_glue_result (*get_trtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
409 /*! Callback for updating the destination that the remote side should send RTP to */
410 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);
411 /*! Callback for retrieving codecs that the channel can do */
412 format_t (*get_codec)(struct ast_channel *chan);
413 /*! Linked list information */
414 AST_RWLIST_ENTRY(ast_rtp_glue) entry;
417 #define ast_rtp_engine_register(engine) ast_rtp_engine_register2(engine, ast_module_info->self)
420 * \brief Register an RTP engine
422 * \param engine Structure of the RTP engine to register
423 * \param module Module that the RTP engine is part of
431 * ast_rtp_engine_register2(&example_rtp_engine, NULL);
434 * This registers the RTP engine declared as example_rtp_engine with the RTP engine core, but does not
435 * associate a module with it.
437 * \note It is recommended that you use the ast_rtp_engine_register macro so that the module is
438 * associated with the RTP engine and use counting is performed.
442 int ast_rtp_engine_register2(struct ast_rtp_engine *engine, struct ast_module *module);
445 * \brief Unregister an RTP engine
447 * \param engine Structure of the RTP engine to unregister
455 * ast_rtp_engine_unregister(&example_rtp_engine);
458 * This unregisters the RTP engine declared as example_rtp_engine from the RTP engine core. If a module
459 * reference was provided when it was registered then this will only be called once the RTP engine is no longer in use.
463 int ast_rtp_engine_unregister(struct ast_rtp_engine *engine);
465 int ast_rtp_engine_register_srtp(struct ast_srtp_res *srtp_res, struct ast_srtp_policy_res *policy_res);
467 void ast_rtp_engine_unregister_srtp(void);
468 int ast_rtp_engine_srtp_is_registered(void);
470 #define ast_rtp_glue_register(glue) ast_rtp_glue_register2(glue, ast_module_info->self)
473 * \brief Register RTP glue
475 * \param glue The glue to register
476 * \param module Module that the RTP glue is part of
484 * ast_rtp_glue_register2(&example_rtp_glue, NULL);
487 * This registers the RTP glue declared as example_rtp_glue with the RTP engine core, but does not
488 * associate a module with it.
490 * \note It is recommended that you use the ast_rtp_glue_register macro so that the module is
491 * associated with the RTP glue and use counting is performed.
495 int ast_rtp_glue_register2(struct ast_rtp_glue *glue, struct ast_module *module);
498 * \brief Unregister RTP glue
500 * \param glue The glue to unregister
508 * ast_rtp_glue_unregister(&example_rtp_glue);
511 * This unregisters the RTP glue declared as example_rtp_gkue from the RTP engine core. If a module
512 * reference was provided when it was registered then this will only be called once the RTP engine is no longer in use.
516 int ast_rtp_glue_unregister(struct ast_rtp_glue *glue);
519 * \brief Create a new RTP instance
521 * \param engine_name Name of the engine to use for the RTP instance
522 * \param sched Scheduler context that the RTP engine may want to use
523 * \param sa Address we want to bind to
524 * \param data Unique data for the engine
526 * \retval non-NULL success
527 * \retval NULL failure
532 * struct ast_rtp_instance *instance = NULL;
533 * instance = ast_rtp_instance_new(NULL, sched, &sin, NULL);
536 * This creates a new RTP instance using the default engine and asks the RTP engine to bind to the address given
537 * in the address structure.
539 * \note The RTP engine does not have to use the address provided when creating an RTP instance. It may choose to use
540 * another depending on it's own configuration.
544 struct ast_rtp_instance *ast_rtp_instance_new(const char *engine_name,
545 struct sched_context *sched, const struct ast_sockaddr *sa,
549 * \brief Destroy an RTP instance
551 * \param instance The RTP instance to destroy
559 * ast_rtp_instance_destroy(instance);
562 * This destroys the RTP instance pointed to by instance. Once this function returns instance no longer points to valid
563 * memory and may not be used again.
567 int ast_rtp_instance_destroy(struct ast_rtp_instance *instance);
570 * \brief Set the data portion of an RTP instance
572 * \param instance The RTP instance to manipulate
573 * \param data Pointer to data
578 * ast_rtp_instance_set_data(instance, blob);
581 * This sets the data pointer on the RTP instance pointed to by 'instance' to
586 void ast_rtp_instance_set_data(struct ast_rtp_instance *instance, void *data);
589 * \brief Get the data portion of an RTP instance
591 * \param instance The RTP instance we want the data portion from
596 * struct *blob = ast_rtp_instance_get_data(instance);
599 * This gets the data pointer on the RTP instance pointed to by 'instance'.
603 void *ast_rtp_instance_get_data(struct ast_rtp_instance *instance);
606 * \brief Send a frame out over RTP
608 * \param instance The RTP instance to send frame out on
609 * \param frame the frame to send out
617 * ast_rtp_instance_write(instance, frame);
620 * This gives the frame pointed to by frame to the RTP engine being used for the instance
621 * and asks that it be transmitted to the current remote address set on the RTP instance.
625 int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame);
628 * \brief Receive a frame over RTP
630 * \param instance The RTP instance to receive frame on
631 * \param rtcp Whether to read in RTCP or not
633 * \retval non-NULL success
634 * \retval NULL failure
639 * struct ast_frame *frame;
640 * frame = ast_rtp_instance_read(instance, 0);
643 * This asks the RTP engine to read in RTP from the instance and return it as an Asterisk frame.
647 struct ast_frame *ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp);
650 * \brief Set the address of the remote endpoint that we are sending RTP to
652 * \param instance The RTP instance to change the address on
653 * \param address Address to set it to
661 * ast_rtp_instance_set_remote_address(instance, &sin);
664 * This changes the remote address that RTP will be sent to on instance to the address given in the sin
669 int ast_rtp_instance_set_remote_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address);
673 * \brief Set the address of an an alternate RTP address to receive from
675 * \param instance The RTP instance to change the address on
676 * \param address Address to set it to
684 * ast_rtp_instance_set_alt_remote_address(instance, &address);
687 * This changes the alternate remote address that RTP will be sent to on instance to the address given in the sin
692 int ast_rtp_instance_set_alt_remote_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address);
695 * \brief Set the address that we are expecting to receive RTP on
697 * \param instance The RTP instance to change the address on
698 * \param address Address to set it to
706 * ast_rtp_instance_set_local_address(instance, &sin);
709 * This changes the local address that RTP is expected on to the address given in the sin
714 int ast_rtp_instance_set_local_address(struct ast_rtp_instance *instance,
715 const struct ast_sockaddr *address);
718 * \brief Get the local address that we are expecting RTP on
720 * \param instance The RTP instance to get the address from
721 * \param address The variable to store the address in
729 * struct ast_sockaddr address;
730 * ast_rtp_instance_get_local_address(instance, &address);
733 * This gets the local address that we are expecting RTP on and stores it in the 'address' structure.
737 int ast_rtp_instance_get_local_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address);
740 * \brief Get the address of the remote endpoint that we are sending RTP to
742 * \param instance The instance that we want to get the remote address for
743 * \param address A structure to put the address into
751 * struct ast_sockaddr address;
752 * ast_rtp_instance_get_remote_address(instance, &address);
755 * This retrieves the current remote address set on the instance pointed to by instance and puts the value
756 * into the address structure.
760 int ast_rtp_instance_get_remote_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address);
763 * \brief Set the value of an RTP instance extended property
765 * \param instance The RTP instance to set the extended property on
766 * \param property The extended property to set
767 * \param value The value to set the extended property to
771 void ast_rtp_instance_set_extended_prop(struct ast_rtp_instance *instance, int property, void *value);
774 * \brief Get the value of an RTP instance extended property
776 * \param instance The RTP instance to get the extended property on
777 * \param property The extended property to get
781 void *ast_rtp_instance_get_extended_prop(struct ast_rtp_instance *instance, int property);
784 * \brief Set the value of an RTP instance property
786 * \param instance The RTP instance to set the property on
787 * \param property The property to modify
788 * \param value The value to set the property to
793 * ast_rtp_instance_set_prop(instance, AST_RTP_PROPERTY_NAT, 1);
796 * This enables the AST_RTP_PROPERTY_NAT property on the instance pointed to by instance.
800 void ast_rtp_instance_set_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
803 * \brief Get the value of an RTP instance property
805 * \param instance The RTP instance to get the property from
806 * \param property The property to get
808 * \retval Current value of the property
813 * ast_rtp_instance_get_prop(instance, AST_RTP_PROPERTY_NAT);
816 * This returns the current value of the NAT property on the instance pointed to by instance.
820 int ast_rtp_instance_get_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property);
823 * \brief Get the codecs structure of an RTP instance
825 * \param instance The RTP instance to get the codecs structure from
830 * struct ast_rtp_codecs *codecs = ast_rtp_instance_get_codecs(instance);
833 * This gets the codecs structure on the RTP instance pointed to by 'instance'.
837 struct ast_rtp_codecs *ast_rtp_instance_get_codecs(struct ast_rtp_instance *instance);
840 * \brief Clear payload information from an RTP instance
842 * \param codecs The codecs structure that payloads will be cleared from
843 * \param instance Optionally the instance that the codecs structure belongs to
848 * struct ast_rtp_codecs codecs;
849 * ast_rtp_codecs_payloads_clear(&codecs, NULL);
852 * This clears the codecs structure and puts it into a pristine state.
856 void ast_rtp_codecs_payloads_clear(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance);
859 * \brief Set payload information on an RTP instance to the default
861 * \param codecs The codecs structure to set defaults on
862 * \param instance Optionally the instance that the codecs structure belongs to
867 * struct ast_rtp_codecs codecs;
868 * ast_rtp_codecs_payloads_default(&codecs, NULL);
871 * This sets the default payloads on the codecs structure.
875 void ast_rtp_codecs_payloads_default(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance);
878 * \brief Copy payload information from one RTP instance to another
880 * \param src The source codecs structure
881 * \param dest The destination codecs structure that the values from src will be copied to
882 * \param instance Optionally the instance that the dst codecs structure belongs to
887 * ast_rtp_codecs_payloads_copy(&codecs0, &codecs1, NULL);
890 * This copies the payloads from the codecs0 structure to the codecs1 structure, overwriting any current values.
894 void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance);
897 * \brief Record payload information that was seen in an m= SDP line
899 * \param codecs The codecs structure to muck with
900 * \param instance Optionally the instance that the codecs structure belongs to
901 * \param payload Numerical payload that was seen in the m= SDP line
906 * ast_rtp_codecs_payloads_set_m_type(&codecs, NULL, 0);
909 * This records that the numerical payload '0' was seen in the codecs structure.
913 void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload);
916 * \brief Record payload information that was seen in an a=rtpmap: SDP line
918 * \param codecs The codecs structure to muck with
919 * \param instance Optionally the instance that the codecs structure belongs to
920 * \param payload Numerical payload that was seen in the a=rtpmap: SDP line
921 * \param mimetype The string mime type that was seen
922 * \param mimesubtype The strin mime sub type that was seen
923 * \param options Optional options that may change the behavior of this specific payload
931 * ast_rtp_codecs_payloads_set_rtpmap_type(&codecs, NULL, 0, "audio", "PCMU", 0);
934 * This records that the numerical payload '0' was seen with mime type 'audio' and sub mime type 'PCMU' in the codecs structure.
938 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);
941 * \brief Set payload type to a known MIME media type for a codec with a specific sample rate
943 * \param codecs RTP structure to modify
944 * \param instance Optionally the instance that the codecs structure belongs to
945 * \param pt Payload type entry to modify
946 * \param mimetype top-level MIME type of media stream (typically "audio", "video", "text", etc.)
947 * \param mimesubtype MIME subtype of media stream (typically a codec name)
948 * \param options Zero or more flags from the ast_rtp_options enum
949 * \param sample_rate The sample rate of the media stream
951 * This function 'fills in' an entry in the list of possible formats for
952 * a media stream associated with an RTP structure.
954 * \retval 0 on success
955 * \retval -1 if the payload type is out of range
956 * \retval -2 if the mimeType/mimeSubtype combination was not found
960 int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int pt,
961 char *mimetype, char *mimesubtype,
962 enum ast_rtp_options options,
963 unsigned int sample_rate);
966 * \brief Remove payload information
968 * \param codecs The codecs structure to muck with
969 * \param instance Optionally the instance that the codecs structure belongs to
970 * \param payload Numerical payload to unset
975 * ast_rtp_codecs_payloads_unset(&codecs, NULL, 0);
978 * This clears the payload '0' from the codecs structure. It will be as if it was never set.
982 void ast_rtp_codecs_payloads_unset(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload);
985 * \brief Retrieve payload information by payload
987 * \param codecs Codecs structure to look in
988 * \param payload Numerical payload to look up
990 * \retval Payload information
995 * struct ast_rtp_payload_type payload_type;
996 * payload_type = ast_rtp_codecs_payload_lookup(&codecs, 0);
999 * This looks up the information for payload '0' from the codecs structure.
1003 struct ast_rtp_payload_type ast_rtp_codecs_payload_lookup(struct ast_rtp_codecs *codecs, int payload);
1006 * \brief Get the sample rate associated with known RTP payload types
1008 * \param asterisk_format True if the value in the 'code' parameter is an AST_FORMAT value
1009 * \param code Format code, either from AST_FORMAT list or from AST_RTP list
1011 * \return the sample rate if the format was found, zero if it was not found
1015 unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, format_t code);
1018 * \brief Retrieve all formats that were found
1020 * \param codecs Codecs structure to look in
1021 * \param astformats An integer to put the Asterisk formats in
1022 * \param nonastformats An integer to put the non-Asterisk formats in
1027 * int astformats, nonastformats;
1028 * ast_rtp_codecs_payload_Formats(&codecs, &astformats, &nonastformats);
1031 * This retrieves all the formats known about in the codecs structure and puts the Asterisk ones in the integer
1032 * pointed to by astformats and the non-Asterisk ones in the integer pointed to by nonastformats.
1036 void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, format_t *astformats, int *nonastformats);
1039 * \brief Retrieve a payload based on whether it is an Asterisk format and the code
1041 * \param codecs Codecs structure to look in
1042 * \param asterisk_format Non-zero if the given code is an Asterisk format value
1043 * \param code The format to look for
1045 * \retval Numerical payload
1050 * int payload = ast_rtp_codecs_payload_code(&codecs, 1, AST_FORMAT_ULAW);
1053 * This looks for the numerical payload for ULAW in the codecs structure.
1057 int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asterisk_format, const format_t code);
1060 * \brief Retrieve mime subtype information on a payload
1062 * \param asterisk_format Non-zero if the given code is an Asterisk format value
1063 * \param code Format to look up
1064 * \param options Additional options that may change the result
1066 * \retval Mime subtype success
1067 * \retval NULL failure
1072 * const char *subtype = ast_rtp_lookup_mime_subtype2(1, AST_FORMAT_ULAW, 0);
1075 * This looks up the mime subtype for the ULAW format.
1079 const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, const format_t code, enum ast_rtp_options options);
1082 * \brief Convert formats into a string and put them into a buffer
1084 * \param buf Buffer to put the mime output into
1085 * \param capability Formats that we are looking up
1086 * \param asterisk_format Non-zero if the given capability are Asterisk format capabilities
1087 * \param options Additional options that may change the result
1089 * \retval non-NULL success
1090 * \retval NULL failure
1095 * char buf[256] = "";
1096 * char *mime = ast_rtp_lookup_mime_multiple2(&buf, sizeof(buf), AST_FORMAT_ULAW | AST_FORMAT_ALAW, 1, 0);
1099 * This returns the mime values for ULAW and ALAW in the buffer pointed to by buf.
1103 char *ast_rtp_lookup_mime_multiple2(struct ast_str *buf, const format_t capability, const int asterisk_format, enum ast_rtp_options options);
1106 * \brief Set codec packetization preferences
1108 * \param codecs Codecs structure to muck with
1109 * \param instance Optionally the instance that the codecs structure belongs to
1110 * \param prefs Codec packetization preferences
1115 * ast_rtp_codecs_packetization_set(&codecs, NULL, &prefs);
1118 * This sets the packetization preferences pointed to by prefs on the codecs structure pointed to by codecs.
1122 void ast_rtp_codecs_packetization_set(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, struct ast_codec_pref *prefs);
1125 * \brief Begin sending a DTMF digit
1127 * \param instance The RTP instance to send the DTMF on
1128 * \param digit What DTMF digit to send
1131 * \retval -1 failure
1136 * ast_rtp_instance_dtmf_begin(instance, '1');
1139 * This starts sending the DTMF '1' on the RTP instance pointed to by instance. It will
1140 * continue being sent until it is ended.
1144 int ast_rtp_instance_dtmf_begin(struct ast_rtp_instance *instance, char digit);
1147 * \brief Stop sending a DTMF digit
1149 * \param instance The RTP instance to stop the DTMF on
1150 * \param digit What DTMF digit to stop
1153 * \retval -1 failure
1158 * ast_rtp_instance_dtmf_end(instance, '1');
1161 * This stops sending the DTMF '1' on the RTP instance pointed to by instance.
1165 int ast_rtp_instance_dtmf_end(struct ast_rtp_instance *instance, char digit);
1166 int ast_rtp_instance_dtmf_end_with_duration(struct ast_rtp_instance *instance, char digit, unsigned int duration);
1169 * \brief Set the DTMF mode that should be used
1171 * \param instance the RTP instance to set DTMF mode on
1172 * \param dtmf_mode The DTMF mode that is in use
1175 * \retval -1 failure
1180 * ast_rtp_instance_dtmf_mode_set(instance, AST_RTP_DTMF_MODE_RFC2833);
1183 * This sets the RTP instance to use RFC2833 for DTMF transmission and receiving.
1187 int ast_rtp_instance_dtmf_mode_set(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode);
1190 * \brief Get the DTMF mode of an RTP instance
1192 * \param instance The RTP instance to get the DTMF mode of
1199 * enum ast_rtp_dtmf_mode dtmf_mode = ast_rtp_instance_dtmf_mode_get(instance);
1202 * This gets the DTMF mode set on the RTP instance pointed to by 'instance'.
1206 enum ast_rtp_dtmf_mode ast_rtp_instance_dtmf_mode_get(struct ast_rtp_instance *instance);
1209 * \brief Indicate that the RTP marker bit should be set on an RTP stream
1211 * \param instance Instance that the new media source is feeding into
1216 * ast_rtp_instance_update_source(instance);
1219 * This indicates that the source of media that is feeding the instance pointed to by
1220 * instance has been updated and that the marker bit should be set.
1224 void ast_rtp_instance_update_source(struct ast_rtp_instance *instance);
1227 * \brief Indicate a new source of audio has dropped in and the ssrc should change
1229 * \param instance Instance that the new media source is feeding into
1234 * ast_rtp_instance_change_source(instance);
1237 * This indicates that the source of media that is feeding the instance pointed to by
1238 * instance has changed and that the marker bit should be set and the SSRC updated.
1242 void ast_rtp_instance_change_source(struct ast_rtp_instance *instance);
1245 * \brief Set QoS parameters on an RTP session
1247 * \param instance Instance to set the QoS parameters on
1248 * \param tos Terms of service value
1249 * \param cos Class of service value
1250 * \param desc What is setting the QoS values
1253 * \retval -1 failure
1258 * ast_rtp_instance_set_qos(instance, 0, 0, "Example");
1261 * This sets the TOS and COS values to 0 on the instance pointed to by instance.
1265 int ast_rtp_instance_set_qos(struct ast_rtp_instance *instance, int tos, int cos, const char *desc);
1268 * \brief Stop an RTP instance
1270 * \param instance Instance that media is no longer going to at this time
1275 * ast_rtp_instance_stop(instance);
1278 * This tells the RTP engine being used for the instance pointed to by instance
1279 * that media is no longer going to it at this time, but may in the future.
1283 void ast_rtp_instance_stop(struct ast_rtp_instance *instance);
1286 * \brief Get the file descriptor for an RTP session (or RTCP)
1288 * \param instance Instance to get the file descriptor for
1289 * \param rtcp Whether to retrieve the file descriptor for RTCP or not
1291 * \retval fd success
1292 * \retval -1 failure
1297 * int rtp_fd = ast_rtp_instance_fd(instance, 0);
1300 * This retrieves the file descriptor for the socket carrying media on the instance
1301 * pointed to by instance.
1305 int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp);
1308 * \brief Get the RTP glue that binds a channel to the RTP engine
1310 * \param type Name of the glue we want
1312 * \retval non-NULL success
1313 * \retval NULL failure
1318 * struct ast_rtp_glue *glue = ast_rtp_instance_get_glue("Example");
1321 * This retrieves the RTP glue that has the name 'Example'.
1325 struct ast_rtp_glue *ast_rtp_instance_get_glue(const char *type);
1328 * \brief Bridge two channels that use RTP instances
1330 * \param c0 First channel part of the bridge
1331 * \param c1 Second channel part of the bridge
1332 * \param flags Bridging flags
1333 * \param fo If a frame needs to be passed up it is stored here
1334 * \param rc Channel that passed the above frame up
1335 * \param timeoutms How long the channels should be bridged for
1337 * \retval Bridge result
1339 * \note This should only be used by channel drivers in their technology declaration.
1343 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);
1346 * \brief Get the other RTP instance that an instance is bridged to
1348 * \param instance The RTP instance that we want
1350 * \retval non-NULL success
1351 * \retval NULL failure
1356 * struct ast_rtp_instance *bridged = ast_rtp_instance_get_bridged(instance0);
1359 * This gets the RTP instance that instance0 is bridged to.
1363 struct ast_rtp_instance *ast_rtp_instance_get_bridged(struct ast_rtp_instance *instance);
1366 * \brief Make two channels compatible for early bridging
1368 * \param c0 First channel part of the bridge
1369 * \param c1 Second channel part of the bridge
1373 void ast_rtp_instance_early_bridge_make_compatible(struct ast_channel *c0, struct ast_channel *c1);
1376 * \brief Early bridge two channels that use RTP instances
1378 * \param c0 First channel part of the bridge
1379 * \param c1 Second channel part of the bridge
1382 * \retval -1 failure
1384 * \note This should only be used by channel drivers in their technology declaration.
1388 int ast_rtp_instance_early_bridge(struct ast_channel *c0, struct ast_channel *c1);
1391 * \brief Initialize RED support on an RTP instance
1393 * \param instance The instance to initialize RED support on
1394 * \param buffer_time How long to buffer before sending
1395 * \param payloads Payload values
1396 * \param generations Number of generations
1399 * \retval -1 failure
1403 int ast_rtp_red_init(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations);
1406 * \brief Buffer a frame in an RTP instance for RED
1408 * \param instance The instance to buffer the frame on
1409 * \param frame Frame that we want to buffer
1412 * \retval -1 failure
1416 int ast_rtp_red_buffer(struct ast_rtp_instance *instance, struct ast_frame *frame);
1419 * \brief Retrieve statistics about an RTP instance
1421 * \param instance Instance to get statistics on
1422 * \param stats Structure to put results into
1423 * \param stat What statistic(s) to retrieve
1426 * \retval -1 failure
1431 * struct ast_rtp_instance_stats stats;
1432 * ast_rtp_instance_get_stats(instance, &stats, AST_RTP_INSTANCE_STAT_ALL);
1435 * This retrieves all statistics the underlying RTP engine supports and puts the values into the
1440 int ast_rtp_instance_get_stats(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat);
1443 * \brief Set standard statistics from an RTP instance on a channel
1445 * \param chan Channel to set the statistics on
1446 * \param instance The RTP instance that statistics will be retrieved from
1451 * ast_rtp_instance_set_stats_vars(chan, rtp);
1454 * This retrieves standard statistics from the RTP instance rtp and sets it on the channel pointed to
1459 void ast_rtp_instance_set_stats_vars(struct ast_channel *chan, struct ast_rtp_instance *instance);
1462 * \brief Retrieve quality statistics about an RTP instance
1464 * \param instance Instance to get statistics on
1465 * \param field What quality statistic to retrieve
1466 * \param buf What buffer to put the result into
1467 * \param size Size of the above buffer
1469 * \retval non-NULL success
1470 * \retval NULL failure
1475 * char quality[AST_MAX_USER_FIELD];
1476 * ast_rtp_instance_get_quality(instance, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, &buf, sizeof(buf));
1479 * This retrieves general quality statistics and places a text representation into the buf pointed to by buf.
1483 char *ast_rtp_instance_get_quality(struct ast_rtp_instance *instance, enum ast_rtp_instance_stat_field field, char *buf, size_t size);
1486 * \brief Request that the underlying RTP engine provide audio frames in a specific format
1488 * \param instance The RTP instance to change read format on
1489 * \param format Format that frames are wanted in
1492 * \retval -1 failure
1497 * ast_rtp_instance_set_read_format(instance, AST_FORMAT_ULAW);
1500 * This requests that the RTP engine provide audio frames in the ULAW format.
1504 int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, format_t format);
1507 * \brief Tell underlying RTP engine that audio frames will be provided in a specific format
1509 * \param instance The RTP instance to change write format on
1510 * \param format Format that frames will be provided in
1513 * \retval -1 failure
1518 * ast_rtp_instance_set_write_format(instance, AST_FORMAT_ULAW);
1521 * This tells the underlying RTP engine that audio frames will be provided to it in ULAW format.
1525 int ast_rtp_instance_set_write_format(struct ast_rtp_instance *instance, format_t format);
1528 * \brief Request that the underlying RTP engine make two RTP instances compatible with eachother
1530 * \param chan Our own Asterisk channel
1531 * \param instance The first RTP instance
1532 * \param peer The peer Asterisk channel
1535 * \retval -1 failure
1540 * ast_rtp_instance_make_compatible(instance, peer);
1543 * This makes the RTP instance for 'peer' compatible with 'instance' and vice versa.
1547 int ast_rtp_instance_make_compatible(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_channel *peer);
1549 /*! \brief Request the formats that can be transcoded
1551 * \param instance The RTP instance
1552 * \param to_endpoint Formats being sent/received towards the endpoint
1553 * \param to_asterisk Formats being sent/received towards Asterisk
1555 * \retval supported formats
1560 * ast_rtp_instance_available_formats(instance, AST_FORMAT_ULAW, AST_FORMAT_SLINEAR);
1563 * This sees if it is possible to have ulaw communicated to the endpoint but signed linear received into Asterisk.
1567 format_t ast_rtp_instance_available_formats(struct ast_rtp_instance *instance, format_t to_endpoint, format_t to_asterisk);
1570 * \brief Indicate to the RTP engine that packets are now expected to be sent/received on the RTP instance
1572 * \param instance The RTP instance
1575 * \retval -1 failure
1580 * ast_rtp_instance_activate(instance);
1583 * This tells the underlying RTP engine of instance that packets will now flow.
1587 int ast_rtp_instance_activate(struct ast_rtp_instance *instance);
1590 * \brief Request that the underlying RTP engine send a STUN BIND request
1592 * \param instance The RTP instance
1593 * \param suggestion The suggested destination
1594 * \param username Optionally a username for the request
1599 * ast_rtp_instance_stun_request(instance, NULL, NULL);
1602 * This requests that the RTP engine send a STUN BIND request on the session pointed to by
1607 void ast_rtp_instance_stun_request(struct ast_rtp_instance *instance, struct ast_sockaddr *suggestion, const char *username);
1610 * \brief Set the RTP timeout value
1612 * \param instance The RTP instance
1613 * \param timeout Value to set the timeout to
1618 * ast_rtp_instance_set_timeout(instance, 5000);
1621 * This sets the RTP timeout value on 'instance' to be 5000.
1625 void ast_rtp_instance_set_timeout(struct ast_rtp_instance *instance, int timeout);
1628 * \brief Set the RTP timeout value for when the instance is on hold
1630 * \param instance The RTP instance
1631 * \param timeout Value to set the timeout to
1636 * ast_rtp_instance_set_hold_timeout(instance, 5000);
1639 * This sets the RTP hold timeout value on 'instance' to be 5000.
1643 void ast_rtp_instance_set_hold_timeout(struct ast_rtp_instance *instance, int timeout);
1646 * \brief Get the RTP timeout value
1648 * \param instance The RTP instance
1650 * \retval timeout value
1655 * int timeout = ast_rtp_instance_get_timeout(instance);
1658 * This gets the RTP timeout value for the RTP instance pointed to by 'instance'.
1662 int ast_rtp_instance_get_timeout(struct ast_rtp_instance *instance);
1665 * \brief Get the RTP timeout value for when an RTP instance is on hold
1667 * \param instance The RTP instance
1669 * \retval timeout value
1674 * int timeout = ast_rtp_instance_get_hold_timeout(instance);
1677 * This gets the RTP hold timeout value for the RTP instance pointed to by 'instance'.
1681 int ast_rtp_instance_get_hold_timeout(struct ast_rtp_instance *instance);
1684 * \brief Get the RTP engine in use on an RTP instance
1686 * \param instance The RTP instance
1688 * \retval pointer to the engine
1693 * struct ast_rtp_engine *engine = ast_rtp_instance_get_engine(instance);
1696 * This gets the RTP engine currently in use on the RTP instance pointed to by 'instance'.
1700 struct ast_rtp_engine *ast_rtp_instance_get_engine(struct ast_rtp_instance *instance);
1703 * \brief Get the RTP glue in use on an RTP instance
1705 * \param instance The RTP instance
1707 * \retval pointer to the glue
1712 * struct ast_rtp_glue *glue = ast_rtp_instance_get_active_glue(instance);
1715 * This gets the RTP glue currently in use on the RTP instance pointed to by 'instance'.
1719 struct ast_rtp_glue *ast_rtp_instance_get_active_glue(struct ast_rtp_instance *instance);
1722 * \brief Get the channel that is associated with an RTP instance while in a bridge
1724 * \param instance The RTP instance
1726 * \retval pointer to the channel
1731 * struct ast_channel *chan = ast_rtp_instance_get_chan(instance);
1734 * This gets the channel associated with the RTP instance pointed to by 'instance'.
1736 * \note This will only return a channel while in a local or remote bridge.
1740 struct ast_channel *ast_rtp_instance_get_chan(struct ast_rtp_instance *instance);
1742 int ast_rtp_instance_add_srtp_policy(struct ast_rtp_instance *instance, struct ast_srtp_policy *policy);
1743 struct ast_srtp *ast_rtp_instance_get_srtp(struct ast_rtp_instance *instance);
1745 #if defined(__cplusplus) || defined(c_plusplus)
1749 #endif /* _ASTERISK_RTP_ENGINE_H */