<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<base href="https://wiki.asterisk.org/wiki" />
<title>Message Title</title>
<style type="text/css">@media only screen and (max-device-width: 480px) {.mobile-only {
width: auto !important;
height: auto !important;
overflow: visible !important;
line-height: normal !important;
font-size: inherit !important;
mso-hide: all;
}
.desktop-only {
display: none !important;
}
/* iPhone 3GS fix for unwanted 20px right margin */
body { min-width: 100% !important; padding: 0; margin: 0; }
#center-content-table { max-width: none; !important; }
#header-pattern-container { padding: 10px 10px 10px 10px !important; line-height: 20px !important; }
#header-avatar-image-container { padding-right: 8px !important; }
#email-content-container { padding: 0 !important; }
.mobile-expand { border-radius: 0 !important; border-left: 0 !important; border-right: 0 !important; padding-left: 26px !important;}
.mobile-resize-text { font-size: 16px !important; line-height: 22px !important; }
#page-title-pattern-header { font-size: 20px !important; line-height: 28px !important; }
#page-title-pattern-icon-image-container-cell { padding-top: 7px !important; }
#inline-user-pattern { display: block !important; }
#inline-user-pattern-avatar { padding-top: 3px !important; }
.contextual-area-pattern { border-bottom: 1px solid #ccc !important; padding: 15px 10px 0 10px !important;}
.users-involved-pattern-column-table { width: 100% !important; }
.users-involved-pattern-avatar-table-cell { padding: 3px 5px 5px 0 !important; }
.users-involved-pattern-column-container { padding-right: 0 !important; }
.contextual-excerpt-pattern, #users-involved-pattern { border: 0 !important; }
/** Aui Typography upsized for mobile **/
#content-excerpt-pattern-container, #contextual-excerpt-pattern-text-container { font-size: 16px !important; line-height: 22px !important; }
#content-excerpt-pattern-container h1, #contextual-excerpt-pattern-text-container h1 { font-size: 24px !important; line-height: 28px !important; }
#content-excerpt-pattern-container h2, #contextual-excerpt-pattern-text-container h2 { font-size: 20px !important; line-height: 28px !important; }
#content-excerpt-pattern-container h3, #contextual-excerpt-pattern-text-container h3 { font-size: 18px !important; line-height: 24px !important; }
#content-excerpt-pattern-container h4, #contextual-excerpt-pattern-text-container h4 { font-size: 16px !important; line-height: 22px !important; }
#content-excerpt-pattern-container h5, #contextual-excerpt-pattern-text-container h5 { font-size: 14px !important; line-height: 20px !important; }
#content-excerpt-pattern-container h6, #contextual-excerpt-pattern-text-container h6 { font-size: 14px !important; line-height: 20px !important; }
.user-mention { line-height: 18px !important; }
/** Aui Typography end **/
/* Show appropriate footer logo on mobile, display links vertically */
#footer-pattern { padding: 15px 10px !important; }
#footer-pattern-logo-desktop-container { padding: 0 !important; }
#footer-pattern-logo-desktop { width: 0 !important; height: 0 !important; }
#footer-pattern-logo-mobile {
padding-top: 10px !important;
width: 30px !important;
height: 27px !important;
display: inline !important;
}
#footer-pattern-text {
display: block !important;
}
#footer-pattern-links-container { line-height: 0 !important;}
.footer-pattern-links.mobile-resize-text,
.footer-pattern-links.mobile-resize-text,
#footer-pattern-text.mobile-resize-text,
#footer-pattern-links-container.no-footer-links {
font-size: 14px !important;
line-height: 20px !important;
}
.footer-link { display: block !important; }
#footer-pattern-links-container table { display: inline-block !important; float: none !important; }
#footer-pattern-links-container, #footer-pattern-text { text-align: center !important; }
#footer-pattern-links { padding-bottom: 5px !important; }
/** Team Calendar overrides, these should be removed when notifications are updated in Team Calendars. For now CSS
overrides are being used because the structure of the content can't change without rereleasing the plugin */
.mail-calendar-container .day-header + table tr td:first-child {
vertical-align: top !important;
padding-top: 5px !important;
}}
@media (min-width: 900px) {#center-content-table { width: 900px; }}
@media all {#outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */
/* Prevent Webkit and Windows Mobile platforms from changing default font sizes.*/
body{-webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;}
.ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */
#background-table {margin:0; padding:0; width:100% !important; }
/* Needed to override highlighting on date and time links in iOS */
.grey a {color: #707070; text-decoration: none; }/* These styles are appended to the head element of a notification in order to prevent Apple Mail and similar
clients from underlining the due dates with a blue hyperlink */
/* a lozenge outside an inline task should always be #333, lozenges inside an inline task should be
colored according to their upcoming due dates, a completed task date lozenge or deleted task date
lozenge should always be #707070 */
.date-time-lozenge a {color: #333333; text-decoration: none; }
.inline-task-text-container .date-time-lozenge.date-upcoming a {color: #DF6F00; text-decoration: none; }
.inline-task-text-container .date-time-lozenge.date-past a {color: #D04437; text-decoration: none; }
.inline-task-text-container.content-deleted-color .date-time-lozenge a,
.inline-task-text-container.checked .date-time-lozenge a {
color: #707070; text-decoration: none;
}}
</style>
</head>
<body>
<table id="background-table" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; background-color: #f5f5f5">
<tbody>
<tr>
<td id="header-pattern-container" style="padding: 0px; border-collapse: collapse; padding: 10px 20px">
<table id="header-pattern" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td id="header-avatar-image-container" valign="top" style="padding: 0px; border-collapse: collapse; vertical-align: top; width: 32px; padding-right: 9px"><a href="https://wiki.asterisk.org/wiki/display/~mmichelson?src=email" style="color: #3b73af; text-decoration: none"><img id="header-avatar-image" class="image_fix" src="cid:avatar_99ed0aa29d6f204db4785296f8170422" height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top" /></a></td>
<td id="header-text-container" valign="middle" style="padding: 0px; border-collapse: collapse; vertical-align: middle; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px">Mark Michelson <strong>edited</strong> a page</td>
</tr>
</tbody>
</table> </td>
</tr>
<!-- End Header pattern -->
<tr>
<td id="email-content-container" style="padding: 0px; border-collapse: collapse; padding: 0 20px">
<table id="email-content-table" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; border-spacing: 0; border-collapse: separate">
<tbody>
<tr>
<td class="email-content-rounded-top mobile-expand" style="padding: 0px; border-collapse: collapse; color: #fff; padding: 0 15px 0 16px; height: 15px; background-color: #fff; border-left: 1px solid #ccc; border-top: 1px solid #ccc; border-right: 1px solid #ccc; border-bottom: 0; border-top-right-radius: 5px; border-top-left-radius: 5px"> </td>
</tr>
<tr>
<td class="email-content-main mobile-expand" style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 15px 16px; background-color: #fff">
<table id="page-title-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td id="page-title-pattern-icon-image-container" valign="top" style="padding: 0px; border-collapse: collapse; width: 16px; vertical-align: top">
<table cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td id="page-title-pattern-icon-image-container-cell" style="padding: 0px; border-collapse: collapse; width: 16px; padding: 9px 8px 0px 0px; mso-text-raise: 5px; mso-line-height-rule: exactly"><a href="https://wiki.asterisk.org/wiki/display/AST/RTP+engine+replacement?src=email" title="page icon" style="vertical-align: top;; color: #3b73af; text-decoration: none"><img style="vertical-align: top; display: block;" src="cid:page-icon" alt="page icon" title="page icon" height="16" width="16" border="0" /></a></td>
</tr>
</tbody>
</table> </td>
<td style="vertical-align: top;; padding: 0px; border-collapse: collapse; padding-right: 5px; font-size: 20px; line-height: 30px; mso-line-height-rule: exactly" id="page-title-pattern-header-container"><span id="page-title-pattern-header" style="font-family: Arial, sans-serif; padding: 0; font-size: 20px; line-height: 30px; mso-text-raise: 2px; mso-line-height-rule: exactly; vertical-align: middle"><a href="https://wiki.asterisk.org/wiki/display/AST/RTP+engine+replacement?src=email" title="RTP engine replacement" style="color: #3b73af; text-decoration: none">RTP engine replacement</a></span></td>
</tr>
</tbody>
</table> </td>
</tr>
<tr>
<td class="email-content-main mobile-expand" style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 15px 16px; background-color: #fff">
<table class="content-excerpt-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px">
<tbody>
<tr>
<td class="content-excerpt-pattern-container mobile-resize-text " style="padding: 0px; border-collapse: collapse; padding: 0 0 0 24px">
<table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<thead>
<tr>
<th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;"><span class="diff-html-added" id="added-diff-0" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB/5639/a252d7f5e75d7a8bf7047b4b2c92f71a56a8f048.48/_/images/icons/macrobrowser/dropdown/warning.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Warning</span></th>
</tr>
</thead>
<tbody>
<tr>
<td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; padding: 0px; border-collapse: collapse"> <p style="margin: 10px 0 0 0; margin-top: 0"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">This page has not received peer review and is still undergoing edits.</span> </p> </td>
</tr>
</tbody>
</table> <h1 id="RTPenginereplacement-Purposeofthisproject" class="diff-block-target diff-block-context" style="margin: 10px 0 0 0; font-size: 24px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span style="color: rgb(133,120,102);"><span class="diff-html-changed" id="changed-diff-0" style="background-color: #d6f0ff;">Purpose of this project</span></span> </h1> <p class="diff-block-context" style="margin: 10px 0 0 0">Asterisk development has shifted from pure PBX functionality in the past two years towards being a media communications server. WebRTC and other newer technology has prompted the creation and more rapid adoption of Internet RFCs. Many of these augment media handling in ways that Asterisk would have difficulty implementing. This page will delve into a few topics:</p>
<ul class="diff-block-context" style="margin: 10px 0 0 0">
<li>A list of RTP standards, some of which Asterisk already supports, others of which are not yet supported.</li>
<li>A breakdown of Asterisk's RTP implementation (res_rtp_asterisk, and maybe res_rtp_multicast) to determine what is currently supported, what is currently unsupported, and what it would take to add support for the unsupported features. In addition, this section will critique non-compliance with certain parts of supported standards.</li>
<li>A verdict on the path forward for implementing the missing features and fixing behavior of existing features.</li>
<li>A plan for testing RTP in Asterisk.</li>
</ul> <h1 id="RTPenginereplacement-Narrowingthescopeofthisproject" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 24px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-changed" id="changed-diff-2" style="background-color: #d6f0ff;">Narrowing the scope of this project</span> </h1> <p class="diff-block-context" style="margin: 10px 0 0 0">This project's aim is to change the underlying RTP implementation as much as is required in order to facilitate ease of adding known and possibly future missing features. Some specific areas that are not affected by this project are:</p>
<ul class="diff-block-context" style="margin: 10px 0 0 0">
<li>Codec negotiation</li>
<li>SDP, aside from RTP additions that also require SDP additions</li>
<li>Automatic behavior based on network conditions</li>
</ul> <h1 id="RTPenginereplacement-RTPstandards" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 24px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-changed" id="changed-diff-3" style="background-color: #d6f0ff;">RTP standards</span> </h1> <p class="diff-block-context" style="margin: 10px 0 0 0">I took some notes on a selection of RTP standards, noting what sort of considerations an RTP architecture would need in order to support those standards. These are not necessarily a list of standards that we wish to support, but such a sampling helps to give a good idea of the type of architecture required. The notes can be found <a class="confluence-link unresolved" href="#" style="color: #3b73af; text-decoration: none">here</a>.</p> <h1 id="RTPenginereplacement-ThecurrentstateofRTPinAsterisk" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 24px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-changed" id="changed-diff-4" style="background-color: #d6f0ff;">The current state of RTP in Asterisk</span> </h1> <p class="diff-block-context" style="margin: 10px 0 0 0">In addition to notes on current RTP standards, I also have some rambling notes on the current state of RTP in Asterisk. These can be found <a class="confluence-link unresolved" href="#" style="color: #3b73af; text-decoration: none">here</a>.</p> <h1 id="RTPenginereplacement-AnIdealRTPstackforAsterisk" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 24px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-changed" id="changed-diff-5" style="background-color: #d6f0ff;">An Ideal RTP stack for Asterisk</span> </h1> <p class="diff-block-context" style="margin: 10px 0 0 0">There's a difference between an "ideal RTP stack" and an "ideal RTP stack for Asterisk". An ideal RTP implementation would be one that has a minimal interface between channel driver and media. A channel driver would gather a media description into some format understood by the RTP layer, and the RTP layer would use that information to set itself up as required (in other words, "smart media layer, dumb channel driver"). Unfortunately, the model of using RTP in Asterisk is to have channel drivers each parse their media descriptions and communicate individual settings to the RTP layer, sometimes hiding the reason for specific actions being taken (in other words, "smart channel driver, dumb media layer"). Asterisk is already hugely dependent on the high-level RTP engine API provided in <code style="font-family: monospace">include/asterisk/rtp_engine.h.</code> Moving to a separate API would require major overhauls in all channel technologies that use RTP for their media. This makes a new media API not an option for the time being. So making an ideal RTP stack for Asterisk means the following:</p>
<ul class="diff-block-context" style="margin: 10px 0 0 0">
<li>A new RTP engine to replace <code style="font-family: monospace">res_rtp_asterisk</code> is fine.</li>
<li>Augmentations to the current RTP engine API are fine.</li>
<li>New helper APIs in addition to the current RTP engine API are fine</li>
<li>All effort should be made to make anything new "just work" with any legacy channel drivers that use RTP, as well as make anything new not require new configuration.</li>
</ul> <h2 id="RTPenginereplacement-Aglossaryofterms:" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 20px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-changed" id="changed-diff-6" style="background-color: #d6f0ff;">A glossary of terms:</span> </h2> <p class="diff-block-context" style="margin: 10px 0 0 0">You'll see some Asterisk-specific terminology used on this page. Here are definitions for those terms.</p>
<ul class="diff-block-context" style="margin: 10px 0 0 0">
<li>RTP API (or RTP engine API): The top-level API that channel drivers use to create RTP instances. Most of what the RTP engine API does is to call into RTP engines to perform requested duties.</li>
<li>RTP instance: An RTP instance is the structure that the RTP engine API creates and that the channel drivers act upon. An RTP instance correlates with a single media stream.</li>
<li>RTP engine: <span style="line-height: 1.4285715;">A pluggable implementation of the RTP engine API.</span> </li>
<li> <code style="font-family: monospace">res_rtp_asterisk</code>: The RTP engine that is used for the vast majority of calls in open source Asterisk.</li>
<li>Steel Zebra: Code name for the new RTP engine that will be written as part of the work being done here. Constantly referring to it as "the new RTP engine" is lame <img class="emoticon emoticon-smile" src="/wiki/s/en_GB/5639/a252d7f5e75d7a8bf7047b4b2c92f71a56a8f048.48/_/images/icons/emoticons/smile.png" data-emoticon-name="smile" alt="(smile)" style="vertical-align: middle" /></li>
<li>RTP stream: RTP instances created by Steel Zebra will be referred to as RTP streams.</li>
<li>RTP session: A structure created by Steel Zebra that contains related RTP streams and coordinates activities between streams where necessary.</li>
</ul> <h2 id="RTPenginereplacement-MediaFlow:IncomingMedia" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 20px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-changed" id="changed-diff-7" style="background-color: #d6f0ff;">Media Flow: Incoming Media</span> </h2> <p class="diff-block-context" style="margin: 10px 0 0 0">Media flow refers to the regular incoming and outgoing RTP and RTCP packets that occur after an RTP session has been set up. This is the easier of the two parts to rewrite in Asterisk because it mostly involves replacing <code style="font-family: monospace">res_rtp_asterisk</code> with Steel Zebra. For this, we'll focus on requirements for incoming and outgoing media.</p> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p>
<ul class="diff-block-context" style="margin: 10px 0 0 0">
<li>Transport reception</li>
<li>Demultiplexing</li>
<li> <span style="line-height: 1.4285715;">Decoding</span> </li>
<li>Packet reception</li>
<li>Buffering/reordering</li>
<li>Synchronization</li>
</ul> <h4 id="RTPenginereplacement-Transportreception" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-8" style="background-color: #d6f0ff;">Transport reception</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">This is the act of reading a packet from a transport, typically a socket. Transport reception will be pluggable since there presumably could be multiple transport types (UDP, TCP) for RTP/RTCP.</p> <h4 id="RTPenginereplacement-Demultiplexing" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-9" style="background-color: #d6f0ff;">Demultiplexing</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">Demultiplexing refers to distinguishing the different packet types that may be received over a transport. A demultiplexer is an entity that knows how to inspect an incoming packet and recognize it as a specific packet type. So the RTP demultiplexer will know how to recognize a packet as being RTP, and the RTCP demultiplexer will know how to recognize RTCP.</p> <p class="diff-block-context" style="margin: 10px 0 0 0">The most typical UDP transport will not have to do much demultiplexing since the only packet types being received are RTP and RTCP, and each is received on a distinct port. However, once other existing features are brought into play (such as ICE and DTLS-SRTP), there comes a need to inspect the incoming packets and make a determination of which type of packet has been received. Demultipexers will pass received RTP and RTCP packets to a decoder. Other types of packets may be passed to some third-party library that acts on the packet.</p> <h4 id="RTPenginereplacement-Decoding" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-10" style="background-color: #d6f0ff;">Decoding</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">Decoding refers to the process of taking raw bytes from the network and parsing them into easy-to-use structures.</p> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p> <p class="diff-block-context" style="margin: 10px 0 0 0">In addition to the base decoding provided by an RTP profile, RTP streams may specify additional decoding steps for certain packet types. As an example if RFC 4733 DTMF is being used, then the decoder will need to call into a special RFC 4733-specific decoding operation in order to decode the payload properly.</p> <h4 id="RTPenginereplacement-Packetreception" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span style="color: rgb(133,120,102);"><span class="diff-html-changed" id="changed-diff-11" style="background-color: #d6f0ff;">Packet reception</span></span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">Packet reception refers to processing the packet that the decoder outputs and acting on it in some way. This provides a useful way to record information that a packet contains or perform transformations on the packet if desired.</p> <p class="diff-block-context" style="margin: 10px 0 0 0">For RTCP, the compound packet will have its constituent parts sent to various stat collectors and other components that may wish to act on the reception of RTCP. For packet types other than RTP, this is the final step of media inflow.</p> <h4 id="RTPenginereplacement-Buffering/reordering" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-12" style="background-color: #d6f0ff;">Buffering/reordering</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">RTP may be received in bursts, out of order, or in other less-than-ideal ways. Asterisk will implement reception buffers to place incoming RTP traffic into, potentially reordering packets as necessary if they arrive out of order.</p> <h4 id="RTPenginereplacement-Synchronization" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-13" style="background-color: #d6f0ff;">Synchronization</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">After the RTP data has been buffered, a separate entity (such as a thread or threadpool), which operates at regular time intervals, will be responsible for asking the bufferer for media to present to the channel. The synchronizer will use the buffered RTP data from the bufferer to construct a list of frames representing a specific timeslice. The most common operation that the synchronizer will perform with these frames is to queue them onto the channel. In other cases, these frames may be written directly to a bridged RTP instance if native local bridging is allowed.</p> <p class="diff-block-context" style="margin: 10px 0 0 0">The synchronizer runs as a member of the RTP session rather than a member of an RTP stream. This allows for the synchronizer to, well, synchronize. It can ensure that, for instance, audio and video reception are presented correctly on the channel receiving the media.</p> <h2 id="RTPenginereplacement-MediaFlow:Outgoingmedia" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 20px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-changed" id="changed-diff-14" style="background-color: #d6f0ff;">Media Flow: Outgoing media</span> </h2> <p class="diff-block-context" style="margin: 10px 0 0 0">The flow for outgoing RTP is mostly the same as for incoming, just in reverse. RTP goes through the following steps:</p>
<ul class="diff-block-context" style="margin: 10px 0 0 0">
<li>Playout</li>
<li>Encoding</li>
<li>Routing</li>
<li>Transmission</li>
</ul> <h4 id="RTPenginereplacement-Playout" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-15" style="background-color: #d6f0ff;">Playout</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">Playout occurs when it is time to play media out over an RTP stream. Playout will most commonly occur when a channel has media to write out. However, it may also occur due to native local RTP bridging as well. Playout for non-RTP stream can also occur when it is time for an RTCP report to be sent. It may also create STUN packets for keepalive purposes during ICE negotiation. Once appropriate data is constructed, the packet is passed down to a corresponding encoder for that type of data.</p> <h4 id="RTPenginereplacement-Encoding" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-16" style="background-color: #d6f0ff;">Encoding</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">This takes a structure of a particular type and places the data in a format suitable to be transmitted over the wire. Like with decoding, there may be multiple necessary steps for the encode (Encode RTP packet -> Add RTP extensions -> Encrypt with SRTP, e.g.). Some encoding steps can be determined by the RTP profile in use. Others will require specific plugins to be used instead.</p> <h4 id="RTPenginereplacement-Routing" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-17" style="background-color: #d6f0ff;">Routing</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">Routing determines what the destination of the media will be. The default routing scheme is to send media to the address that was in the c= line of an SDP. However, media may be routed differently depending on if symmetric RTP or ICE is in use. The job of the router is to present the packet to the underlying transport along with a destination address.</p> <h4 id="RTPenginereplacement-Transmission" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-18" style="background-color: #d6f0ff;">Transmission</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">This involves sending the packet out over the configured transport type. For now, UDP and DTLS constitute the only transports in use, but it is possible to add support for TCP or other forms of transport later if desired.</p> <h2 id="RTPenginereplacement-MediaFlow:Threading" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 20px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-changed" id="changed-diff-19" style="background-color: #d6f0ff;">Media Flow: Threading</span> </h2> <p class="diff-block-context" style="margin: 10px 0 0 0">How does the threading model look with this media flow? There are two required threads, though they could be expanded to use threadpools instead. One thread is an RTP monitor thread. It is responsible for polling the transports, reading the data from ready transports, and passing the data to the demultiplexer. The demultiplexer passes the packet to the appropriate decoder, which passes the decoded packet to the packet handler(s) for that packet type. For RTP, processing in this thread ends once the RTP packet has been buffered.</p> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p> <p class="diff-block-context" style="margin: 10px 0 0 0">The code will be structured such that if additional threads are needed, they can be added without requiring too much effort. For instance, the single threads could be modified to use a threadpool. Or the parts of incoming packet handling could be separated into separate threads based on "actors" on the data.</p> <h2 id="RTPenginereplacement-MediaSetup" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 20px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-changed" id="changed-diff-20" style="background-color: #d6f0ff;">Media Setup</span> </h2> <p class="diff-block-context" style="margin: 10px 0 0 0">Because the goal is to alter the top-level RTP engine API as little as possible, there will not be any unified new API for media setup.</p> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p> <p class="diff-block-context" style="margin: 10px 0 0 0">In addition to RTP streams, an RTP session will be created under the hood as well. This will be done by creating the session when the first RTP stream is created and then associating subsequent RTP streams with the same created session. This is a bit of an odd way to construct an RTP session, but we're restricted to doing it this way since the high-level RTP engine API does not know about sessions. The session will be responsible for coordinating activities between streams, such as synchronizing incoming audio and video streams. When BUNDLE support is added, it is likely that the RTP session will have some responsibility in coordinating the underlying streams to use a single transport.</p> <h4 id="RTPenginereplacement-BUNDLE" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-21" style="background-color: #d6f0ff;">BUNDLE</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">BUNDLE is not currently implemented in Asterisk, and the plan is not necessarily to actually implement BUNDLE at this time. However, the RTP stack needs to be designed with BUNDLE in mind and be able to support it without too much difficulty. The addition of an RTP session structure allows for BUNDLE to be more easily integrated into the RTP engine since the RTP session will be able to coordinate the different streams. The different layers of the media inflow and outflow should allow for BUNDLE plugins to be added at appropriate places in order to facilitate BUNDLE.</p> <h4 id="RTPenginereplacement-Theactualprocess" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-22" style="background-color: #d6f0ff;">The actual process</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">A channel driver discovers the need to create an RTP instance, either because it is going to make an outgoing call or is accepting an incoming call. The channel driver calls <code style="font-family: monospace">ast_rtp_instance_new()</code> to create a new RTP instance. The final parameter for this function call will be a custom structure for Steel Zebra, which will contain at least the channel on which the RTP instance is being created. This structure may be expanded in the future if it turns out that other pieces of information would be useful during stream creation.</p> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p> <p class="diff-block-context" style="margin: 10px 0 0 0">Session creation results in a playout timer being set on the scheduler context that is passed in (see <code style="font-family: monospace">ast_rtp_instance_new()</code>).</p> <h5 id="RTPenginereplacement-StreamCreation" class="diff-block-target" style="margin: 10px 0 0 0; color: #707070; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-23" style="background-color: #d6f0ff;">Stream Creation</span> </h5> <p class="diff-block-context" style="margin: 10px 0 0 0">When an RTP stream is created, it has some defaults put in place for its media flows. Going through the flow from above:</p> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p>
<ul class="diff-block-context" style="margin: 10px 0 0 0">
<li>Setting the remote address will adjust the packet router's destination address setting.</li>
<li>Enabling symmetric RTP will result in a separate symmetric RTP packet router being used.</li>
<li>Stopping an RTP instance will result no longer sending or receiving data on the stream.</li>
<li>Destroying an RTP instance will result in de-allocation of memory and removal of the stream from the RTP session.</li>
</ul> <h2 id="RTPenginereplacement-Otherstuff" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 20px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-changed" id="changed-diff-24" style="background-color: #d6f0ff;">Other stuff</span> </h2> <p class="diff-block-context" style="margin: 10px 0 0 0">The general setup and media flow are the main points of interest for the new RTP engine, but there are some other points to bring up, to include implementation details for the new engine, as well as the inevitable changes to be made in places outside of the new engine.</p> <h4 id="RTPenginereplacement-NativelocalRTPbridges" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-25" style="background-color: #d6f0ff;">Native local RTP bridges</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">Native local RTP bridges have a few considerations when implementing a new RTP engine.</p> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p> <p class="diff-block-context" style="margin: 10px 0 0 0">Second, native local RTP bridging is performed at the main RTP API layer by having the bridged RTP instances point at each other. It is up to the individual RTP instances to detect that this has occurred and act accordingly. It might work better if the job of setting bridges on RTP instances were passed down to the engines themselves in case they want to perform other side effects besides changing a pointer.</p> <h4 id="RTPenginereplacement-ICE" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-26" style="background-color: #d6f0ff;">ICE</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">ICE deserves its own special section because it's so different from everything else that goes on, plus there is a desire for the RTP engine to be trickle ICE capable. <code style="font-family: monospace">res_rtp_asterisk</code> has a few flaws with regards to ICE. To name a few:</p> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p> <p class="diff-block-context" style="margin: 10px 0 0 0">Trickle ICE has been mentioned a few times, and the current RTP design allows for trickle ICE to be integrated without too much trouble. The main changes for trickle ICE are in the internal ICE state machine rather than for users of ICE. The other changes are at the signaling level to indicate new trickled candidates and to indicate support for trickle ICE. The biggest change required at the RTP level is to be able to call a glue callback of some sort whenever it is time to trickle a new local ICE candidate to the far end.</p> <h4 id="RTPenginereplacement-DTLS" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-changed" id="changed-diff-27" style="background-color: #d6f0ff;">DTLS</span> </h4> <p class="diff-block-context" style="margin: 10px 0 0 0">A DTLS engine is another type of engine that can be implemented by RTP engines. The DTLS engine for the new RTP engine will be mostly the same as the old DTLS engine. In fact, it may be worth deciding if DTLS functionality would be better suited as a separate API outside of RTP since it is difficult to picture many areas where DTLS will function differently in the new engine.</p> </td>
</tr>
</tbody>
</table> </td>
</tr>
<tr>
<td class="email-content-main mobile-expand action-padding last-row-padding" style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 15px 16px; background-color: #fff; padding-bottom: 10px; padding-bottom: 10px">
<table id="actions-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px">
<tbody>
<tr>
<td id="actions-pattern-container" valign="middle" style="padding: 0px; border-collapse: collapse; padding: 15px 0 0 24px; vertical-align: middle">
<table align="left" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td class="actions-pattern-action-icon-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 0px; vertical-align: middle"><a href="https://wiki.asterisk.org/wiki/display/AST/RTP+engine+replacement?src=email" title="View page Icon" style="color: #3b73af; text-decoration: none"><img class="actions-pattern-action-icon-image" height="16" width="16" border="0" title="View page Icon" src="cid:com.atlassian.confluence.plugins.confluence-email-resources%3Aview-page-email-adg-footer-item%3Aicon" alt="View page Icon" style="vertical-align: middle" /></a></td>
<td class="actions-pattern-action-text-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; padding-left: 5px; white-space: nowrap"><a href="https://wiki.asterisk.org/wiki/display/AST/RTP+engine+replacement?src=email" title="View page" style="color: #3b73af; text-decoration: none">View page</a></td>
<td class="actions-pattern-action-bull" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; color: #999; padding: 0 5px">•</td>
</tr>
</tbody>
</table>
<table align="left" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td class="actions-pattern-action-icon-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 0px; vertical-align: middle"><a href="https://wiki.asterisk.org/wiki/display/AST/RTP+engine+replacement?showComments=true&showCommentArea=true&src=email#addcomment" title="Add comment Icon" style="color: #3b73af; text-decoration: none"><img class="actions-pattern-action-icon-image" height="16" width="16" border="0" title="Add comment Icon" src="cid:com.atlassian.confluence.plugins.confluence-email-resources%3Aadd-comment-to-content-email-adg-footer-item%3Aicon" alt="Add comment Icon" style="vertical-align: middle" /></a></td>
<td class="actions-pattern-action-text-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; padding-left: 5px; white-space: nowrap"><a href="https://wiki.asterisk.org/wiki/display/AST/RTP+engine+replacement?showComments=true&showCommentArea=true&src=email#addcomment" title="Add comment" style="color: #3b73af; text-decoration: none">Add comment</a></td>
<td class="actions-pattern-action-bull" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; color: #999; padding: 0 5px">•</td>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td class="actions-pattern-action-icon-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 0px; vertical-align: middle"><a href="https://wiki.asterisk.org/wiki/plugins/likes/like.action?contentId=31752285&src=email" title="Like Icon" style="color: #3b73af; text-decoration: none"><img class="actions-pattern-action-icon-image" height="16" width="16" border="0" title="Like Icon" src="cid:com.atlassian.confluence.plugins.confluence-like%3Aview-email-adg-content-item%3Aicon" alt="Like Icon" style="vertical-align: middle" /></a></td>
<td class="actions-pattern-action-text-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; padding-left: 5px; white-space: nowrap"><a href="https://wiki.asterisk.org/wiki/plugins/likes/like.action?contentId=31752285&src=email" title="Like" style="color: #3b73af; text-decoration: none">Like</a></td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
</table> </td>
</tr>
<tr>
<td class="email-content-rounded-bottom mobile-expand" style="padding: 0px; border-collapse: collapse; color: #fff; height: 5px; line-height: 5px; padding: 0 15px 0 16px; background-color: #fff; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border-top: 0; border-left: 1px solid #ccc; border-bottom: 1px solid #ccc; border-right: 1px solid #ccc; mso-line-height-rule: exactly"> </td>
</tr>
</tbody>
</table> </td>
</tr>
<tr>
<td id="footer-pattern" style="padding: 0px; border-collapse: collapse; padding: 12px 20px">
<table id="footer-pattern-container" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td id="footer-pattern-links-container" width="100%" style="padding: 0px; border-collapse: collapse; color: #999; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px">
<table align="left" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px">
<tbody>
<tr>
<td class="footer-pattern-links mobile-resize-text" style="padding: 0px; border-collapse: collapse"><a href="https://wiki.asterisk.org/wiki/users/removespacenotification.action?spaceKey=AST&src=email" title="" style="color: #3b73af; text-decoration: none">Stop watching space</a></td>
<td class="footer-pattern-links-bull" style="padding: 0px; border-collapse: collapse; padding: 0 5px; color: #999">•</td>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px">
<tbody>
<tr>
<td class="footer-pattern-links mobile-resize-text" style="padding: 0px; border-collapse: collapse"><a href="https://wiki.asterisk.org/wiki/users/editmyemailsettings.action?src=email" title="" style="color: #3b73af; text-decoration: none">Manage notifications</a></td>
</tr>
</tbody>
</table> </td>
</tr>
<tr>
<td id="footer-pattern-text" class="mobile-resize-text" width="100%" style="padding: 0px; border-collapse: collapse; color: #999; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px; display: none">This message was sent by Atlassian Confluence 5.6.6</td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
</table>
<table id="sealed-section" border="0" cellpadding="0" cellspacing="0" width="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; display: none">
<tbody>
<tr>
<td style="padding: 0px; border-collapse: collapse; border: 0; font-size: 0px; line-height: 0; mso-line-height-rule: exactly"></td>
</tr>
</tbody>
</table>
</body>
</html>