<html>
<head>
    <base href="https://wiki.asterisk.org/wiki">
            <link rel="stylesheet" href="/wiki/s/en/2171/18/9/_/styles/combined.css?spaceKey=AST&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://wiki.asterisk.org/wiki/display/AST/RTP+Packetization">RTP Packetization</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://wiki.asterisk.org/wiki/display/~seanbright">Sean Bright</a>
    </h4>
        <div id="versionComment">
        <b>Comment:</b>
        Use a table instead of ASCII art where appropriate.  Other formatting.<br />
    </div>
        <br/>
                         <h4>Changes (6)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-unchanged" >h1. Overview <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >Asterisk currently supports configurable RTP packetization per codec for <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;"> </span> select RTP-based channels. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h5. Channels <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >Example: <br> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{code}</span> <span class="diff-added-words"style="background-color: #dfd;">{noformat}</span> <br></td></tr>
            <tr><td class="diff-unchanged" >allow=ulaw:30,alaw,g729:60 <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{code}</span> <span class="diff-added-words"style="background-color: #dfd;">{noformat}</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>No packetization is specified in the case of alaw in this example, so the default of 20ms is used. <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >In addition, chan_sip has the ability to negotiate the desired framing at call establishment. <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >In <span class="diff-changed-words"><span class="diff-added-chars"style="background-color: #dfd;">{{</span>sip.conf<span class="diff-added-chars"style="background-color: #dfd;">}}</span></span> if <span class="diff-changed-words"><span class="diff-added-chars"style="background-color: #dfd;">{{</span>autoframing=yes<span class="diff-added-chars"style="background-color: #dfd;">}}</span></span> is set in the global section, then all calls will try to set the packetization based on the remote endpoint&#39;s preferences.  This behaviour depends on the endpoints ability to present the desired packetization <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">(ptime:)</span> <span class="diff-added-words"style="background-color: #dfd;">({{ptime\:}})</span> in the SDP.  If the endpoint does not include a ptime attribute, the call will be established with 20ms packetization. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>Autoframing can be set at the global level or on a user/peer/friend basis.  If it is enabled at the global level, it applies to all users/peers/friends regardless of their prefered codec packetization. <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >The following table lists the minimum and maximum values that are valid per codec, as well as the increment value used for each.  Please note that the maximum values here are only recommended maximums, and should not exceed the RTP MTU. <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{noformat} <br>Name                Min                Max                Default                Increment <br>g723                30                300                30                30 <br>gsm                20                300                20                20 <br>ulaw                10                150                20                10 <br>alaw                10                150                20                10 <br>g726                10                300                20                10 <br>ADPCM                10                300                20                10 <br>SLIN                10                70                20                10 <br>lpc10                20                20                20                20 <br>g729                10                230                20                10 <br>speex                10                60                20                10 <br>ilbc                30                30                30                30 <br>g726_aal2        10                300                20                10 <br>{noformat} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">||Name||Minimum (ms)||Maximum (ms)||Default (ms)||Increment (ms)|| <br>||g723|30|300|30|30| <br>||gsm|20|300|20|20| <br>||ulaw|10|150|20|10| <br>||alaw|10|150|20|10| <br>||g726|10|300|20|10| <br>||ADPCM|10|300|20|10| <br>||SLIN|10|70|20|10| <br>||lpc10|20|20|20|20| <br>||g729|10|230|20|10| <br>||speex|10|60|20|10| <br>||ilbc|30|30|30|30| <br>||g726_aal2|10|300|20|10| <br></td></tr>
            <tr><td class="diff-unchanged" > <br>Invalid framing options are handled based on the following rules: <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="RTPPacketization-Overview"></a>Overview</h1>

<p>Asterisk currently supports configurable RTP packetization per codec for select RTP-based channels.</p>

<h5><a name="RTPPacketization-Channels"></a>Channels</h5>
<p>These channel drivers allow RTP packetization on a user/peer/friend or global level:</p>
<ul>
        <li>chan_sip</li>
        <li>chan_skinny</li>
        <li>chan_h323</li>
        <li>chan_ooh323 (Asterisk-Addons)</li>
        <li>chan_gtalk</li>
        <li>chan_jingle</li>
</ul>


<h5><a name="RTPPacketization-Configuration"></a>Configuration</h5>
<p>To set a desired packetization interval on a specific codec, append that inteval to the allow= statement.</p>

<p>Example:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>allow=ulaw:30,alaw,g729:60
</pre>
</div></div>

<p>No packetization is specified in the case of alaw in this example, so the default of 20ms is used.</p>

<h5><a name="RTPPacketization-Autoframing"></a>Autoframing</h5>

<p>In addition, chan_sip has the ability to negotiate the desired framing at call establishment.</p>

<p>In <tt>sip.conf</tt> if <tt>autoframing=yes</tt> is set in the global section, then all calls will try to set the packetization based on the remote endpoint's preferences.  This behaviour depends on the endpoints ability to present the desired packetization (<tt>ptime\:</tt>) in the SDP.  If the endpoint does not include a ptime attribute, the call will be established with 20ms packetization.</p>

<p>Autoframing can be set at the global level or on a user/peer/friend basis.  If it is enabled at the global level, it applies to all users/peers/friends regardless of their prefered codec packetization.</p>

<h5><a name="RTPPacketization-Codecframingoptions"></a>Codec framing options</h5>

<p>The following table lists the minimum and maximum values that are valid per codec, as well as the increment value used for each.  Please note that the maximum values here are only recommended maximums, and should not exceed the RTP MTU.</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Name</th>
<th class='confluenceTh'>Minimum (ms)</th>
<th class='confluenceTh'>Maximum (ms)</th>
<th class='confluenceTh'>Default (ms)</th>
<th class='confluenceTh'>Increment (ms)</th>
</tr>
<tr>
<th class='confluenceTh'>g723</th>
<td class='confluenceTd'>30</td>
<td class='confluenceTd'>300</td>
<td class='confluenceTd'>30</td>
<td class='confluenceTd'>30</td>
</tr>
<tr>
<th class='confluenceTh'>gsm</th>
<td class='confluenceTd'>20</td>
<td class='confluenceTd'>300</td>
<td class='confluenceTd'>20</td>
<td class='confluenceTd'>20</td>
</tr>
<tr>
<th class='confluenceTh'>ulaw</th>
<td class='confluenceTd'>10</td>
<td class='confluenceTd'>150</td>
<td class='confluenceTd'>20</td>
<td class='confluenceTd'>10</td>
</tr>
<tr>
<th class='confluenceTh'>alaw</th>
<td class='confluenceTd'>10</td>
<td class='confluenceTd'>150</td>
<td class='confluenceTd'>20</td>
<td class='confluenceTd'>10</td>
</tr>
<tr>
<th class='confluenceTh'>g726</th>
<td class='confluenceTd'>10</td>
<td class='confluenceTd'>300</td>
<td class='confluenceTd'>20</td>
<td class='confluenceTd'>10</td>
</tr>
<tr>
<th class='confluenceTh'>ADPCM</th>
<td class='confluenceTd'>10</td>
<td class='confluenceTd'>300</td>
<td class='confluenceTd'>20</td>
<td class='confluenceTd'>10</td>
</tr>
<tr>
<th class='confluenceTh'>SLIN</th>
<td class='confluenceTd'>10</td>
<td class='confluenceTd'>70</td>
<td class='confluenceTd'>20</td>
<td class='confluenceTd'>10</td>
</tr>
<tr>
<th class='confluenceTh'>lpc10</th>
<td class='confluenceTd'>20</td>
<td class='confluenceTd'>20</td>
<td class='confluenceTd'>20</td>
<td class='confluenceTd'>20</td>
</tr>
<tr>
<th class='confluenceTh'>g729</th>
<td class='confluenceTd'>10</td>
<td class='confluenceTd'>230</td>
<td class='confluenceTd'>20</td>
<td class='confluenceTd'>10</td>
</tr>
<tr>
<th class='confluenceTh'>speex</th>
<td class='confluenceTd'>10</td>
<td class='confluenceTd'>60</td>
<td class='confluenceTd'>20</td>
<td class='confluenceTd'>10</td>
</tr>
<tr>
<th class='confluenceTh'>ilbc</th>
<td class='confluenceTd'>30</td>
<td class='confluenceTd'>30</td>
<td class='confluenceTd'>30</td>
<td class='confluenceTd'>30</td>
</tr>
<tr>
<th class='confluenceTh'>g726_aal2</th>
<td class='confluenceTd'>10</td>
<td class='confluenceTd'>300</td>
<td class='confluenceTd'>20</td>
<td class='confluenceTd'>10</td>
</tr>
</tbody></table>
</div>


<p>Invalid framing options are handled based on the following rules:</p>

<ol>
        <li>If the specified framing is less than the codec's minimum, then the minimum value is used.</li>
        <li>If the specific framing is greater than the codec's maximum, then the maximum value is used</li>
        <li>If the specificed framing does not meet the increment requirement, the specified framing is rounded down to the closest valid framing options.</li>
</ol>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://wiki.asterisk.org/wiki/users/removespacenotification.action?spaceKey=AST">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://wiki.asterisk.org/wiki/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://wiki.asterisk.org/wiki/display/AST/RTP+Packetization">View Online</a>
        |
        <a href="https://wiki.asterisk.org/wiki/pages/diffpagesbyversion.action?pageId=4260038&revisedVersion=2&originalVersion=1">View Changes</a>
                |
        <a href="https://wiki.asterisk.org/wiki/display/AST/RTP+Packetization?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>