<HTML>
<HEAD>
<TITLE>Re: [OpenSIPS-Users] codec manipulation feature</TITLE>
</HEAD>
<BODY>
<FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>Exactly. &nbsp;This would be so incredibly useful.<BR>
<BR>
Imagine a customer with a SIP-based PRI and a T1&#8217;s worth of bandwidth behind it. &nbsp;This is a common scenario for my customers. &nbsp;We try to avoid running all G.729 wherever possible because of the obvious and ugly audio quality hit. &nbsp;At G.711 I can only let them use 17 channels on their 23 channel PRI. &nbsp;That&#8217;s fine for many customers but a fraction think they need or actually need all 23 channels. &nbsp;Some can afford second T1 to allow them access to the remaining 6 channels. &nbsp;How about &lt;drum roll please&gt; dynamic codec selection by the proxy.<BR>
<BR>
We&#8217;ve already worked out the math and routing logic in Opensips, provided we have the following items in the customer&#8217;s profile:<BR>
</SPAN></FONT><UL><LI><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>Total bandwidth available to customer (pick a circuit type, or input raw kbps)
</SPAN></FONT><LI><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>Minimum percentage bandwidth reserved for data
</SPAN></FONT><LI><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>Total number of calls required<BR>
</SPAN></FONT></UL><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'><BR>
Given this information, Opensips can compute how many calls we can leave at G.711 and after what point we have to start compressing them into G.729 (by verifying G.729 in the SDP, and removing G.711). &nbsp;Thank you dialog module. &nbsp;For example, on a 1.5 meg T1 with 15% reserved for data, the formula says I can allow 12 channels at G.711, but have to compress the remaining 11. &nbsp;With a 5% data margin I can get away with 15 uncompressed and 8 compressed. &nbsp;Everything&#8217;s just about ready except for the ability to work on the SDP to make it happen.<BR>
<BR>
<BR>
- Jeff<BR>
<BR>
<BR>
<BR>
On 6/15/09 9:23 PM, &quot;Brett Nemeroff&quot; &lt;<a href="brett@nemeroff.com">brett@nemeroff.com</a>&gt; wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>Nice.. That's about what I had in mind.. I'll be looking for more discussion regarding this. :)<BR>
-Brett<BR>
<BR>
<BR>
On Mon, Jun 15, 2009 at 8:21 PM, Bogdan-Andrei Iancu &lt;<a href="bogdan@voice-system.ro">bogdan@voice-system.ro</a>&gt; wrote:<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>Hi Brett,<BR>
<BR>
<BR>
Brett Nemeroff wrote:<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>my $0.02 here.. I'm not sure if this is what you guys had in mind.. but I've had situations where this would be handy.. It'd need to have some way of identifing the codec (by number?). I'm not sure if the core really has anything that parses the SDP by RFC spec,<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>there is an SDP parser in the core :)<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>so I'm not sure how you'd do things like &quot;removing g729 codec including the annex=b annotation&quot;.<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>but not sure if so complex :D (like relation between the SDP fields).<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>But imaging that anything is possible:<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>what we had in mind was to add functions to:<BR>
<BR>
1) test if a codec is advertised<BR>
2) remove codecs<BR>
3) change the priority between the existing codecs<BR>
<BR>
<BR>
Regards,<BR>
bogdan<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>I imagine functions:<BR>
reject_codec: reject a call if a codec matches<BR>
remove_codec: remove an offered codec<BR>
codec_present: returns true if codec specified is offered<BR>
<BR>
if (reject_codec('ulaw')) {<BR>
sl_send_reply(&quot;488&quot;,&quot;ULAW Calls not allowed&quot;);<BR>
exit;<BR>
}<BR>
<BR>
<BR>
if ((codec_present('ULAW')) &amp;&amp; codec_present('G729a')) {<BR>
remove_codec('ULAW');<BR>
xlog(&quot;L_INFO&quot;,&quot;Removing bad codec: ULAW&quot;);<BR>
}<BR>
<BR>
if (!codec_present('G729a')){<BR>
sl_send_reply(&quot;488&quot;,&quot;Please send G729a calls&quot;);<BR>
}<BR>
<BR>
<BR>
On Mon, Jun 15, 2009 at 3:02 PM, Jeff Pyle &lt;<a href="jpyle@fidelityvoice.com">jpyle@fidelityvoice.com</a> &lt;<a href="mailto:jpyle@fidelityvoice.com&gt;">mailto:jpyle@fidelityvoice.com&gt;</a>&gt; wrote:<BR>
<BR>
&nbsp;   Hi Bogdan,<BR>
<BR>
&nbsp;   It&#8217;s been a little while since we talked about this. I was<BR>
&nbsp;   wondering if there was anything in the works to detect and/or<BR>
&nbsp;   manipulate the codecs present in an SDP.<BR>
<BR>
<BR>
<BR>
&nbsp;   - Jeff<BR>
<BR>
<BR>
<BR>
<BR>
&nbsp;   On 2/1/09 4:08 AM, &quot;Steve Kurzeja&quot; &lt;<a href="steve.kurzeja@gmail.com">steve.kurzeja@gmail.com</a><BR>
&nbsp;   &lt;<a href="http://steve.kurzeja@gmail.com">http://steve.kurzeja@gmail.com</a> &lt;<a href="http://gmail.com">http://gmail.com</a>&gt; &gt;&gt; wrote:<BR>
<BR>
&nbsp;       This idea is quite standard in SBCs, typically called codec<BR>
&nbsp;       profiles, where you permit only certain codecs to be passed<BR>
&nbsp;       through the SBC in an INVITE and all the rest are stripped out.<BR>
<BR>
&nbsp;       We use it to get around interop issues with certain codecs.<BR>
&nbsp;       E.g. we have some end devices/customers that have issues using<BR>
&nbsp;       g729a so we choose to remove this codec for these specific<BR>
&nbsp;       endpoints.<BR>
<BR>
&nbsp;       The poor man's method to implementing this is just doing<BR>
&nbsp;       header manipulations in the SDP but it would be nice to be<BR>
&nbsp;       standardized.<BR>
<BR>
&nbsp;       Regards,<BR>
&nbsp;       Steve<BR>
<BR>
<BR>
&nbsp;       On Fri, Jan 30, 2009 at 2:20 AM, Jeff Pyle<BR>
&nbsp;       &lt;<a href="jpyle@fidelityvoice.com">jpyle@fidelityvoice.com</a> &lt;<a href="http://jpyle@fidelityvoice.com">http://jpyle@fidelityvoice.com</a> &lt;<a href="http://fidelityvoice.com">http://fidelityvoice.com</a>&gt; &gt;&gt; wrote:<BR>
<BR>
&nbsp;           Hi Bogdan,<BR>
<BR>
&nbsp;           I'm looking for the ability to selectively remove codec<BR>
&nbsp;           advertisements from<BR>
&nbsp;           the SDP. For example, if my customer sends a call to me<BR>
&nbsp;           for PSTN<BR>
&nbsp;           termination he may advertise G711 and G729, with G711<BR>
&nbsp;           preferred. By looking<BR>
&nbsp;           at the number of existing dialogs I may know that he's<BR>
&nbsp;           running low on<BR>
&nbsp;           bandwidth, so I would like to suppress the G711<BR>
&nbsp;           advertisement ultimately<BR>
&nbsp;           causing a 200 OK from the carrier with G729.<BR>
<BR>
&nbsp;           Generically, in this application we're looking only to<BR>
&nbsp;           suppress G711 at<BR>
&nbsp;           certain times.<BR>
<BR>
&nbsp;           I understand normally codec selection is done completely<BR>
&nbsp;           by the gateway<BR>
&nbsp;           device. However, my gateway devices aren't smart enough to<BR>
&nbsp;           take bandwidth<BR>
&nbsp;           utilization into consideration when choosing which codecs<BR>
&nbsp;           to advertise. I'm<BR>
&nbsp;           hoping my proxy might be. :)<BR>
<BR>
&nbsp;           Does that make sense?<BR>
<BR>
<BR>
<BR>
&nbsp;           - Jeff<BR>
<BR>
<BR>
<BR>
&nbsp;           On 1/29/09 5:04 AM, &quot;Bogdan-Andrei Iancu&quot;<BR>
&nbsp;           &lt;<a href="bogdan@voice-system.ro">bogdan@voice-system.ro</a> &lt;<a href="http://bogdan@voice-system.ro">http://bogdan@voice-system.ro</a> &lt;<a href="http://voice-system.ro">http://voice-system.ro</a>&gt; &gt;&gt;<BR>
<BR>
&nbsp;           wrote:<BR>
<BR>
&nbsp;           &gt; Hi Jeff,<BR>
&nbsp;           &gt;<BR>
&nbsp;           &gt; right now there is only available some functionality to<BR>
&nbsp;           check the codecs<BR>
&nbsp;           &gt; (to see what codecs are advertised in the SDP)... What<BR>
&nbsp;           exactly are you<BR>
&nbsp;           &gt; looking for (like codec ops) ?<BR>
&nbsp;           &gt;<BR>
&nbsp;           &gt; Regards,<BR>
&nbsp;           &gt; Bogdan<BR>
&nbsp;           &gt;<BR>
&nbsp;           &gt; Jeff Pyle wrote:<BR>
&nbsp;           &gt;&gt; Bogdan,<BR>
&nbsp;           &gt;&gt;<BR>
&nbsp;           &gt;&gt; Some months back you mentioned an upcoming feature that<BR>
&nbsp;           would allow<BR>
&nbsp;           &gt;&gt; Opensips to manipulate the codecs present in the SDP.<BR>
&nbsp;           Just wondering<BR>
&nbsp;           &gt;&gt; if there is anything available to test yet. This feature, in<BR>
&nbsp;           &gt;&gt; combination with dialog contexts, will be of great use<BR>
&nbsp;           to us to allow<BR>
&nbsp;           &gt;&gt; us to take a guess at the bandwidth consumption for a<BR>
&nbsp;           particular<BR>
&nbsp;           &gt;&gt; customer and force the use of a compressed codec if<BR>
&nbsp;           necessary.<BR>
&nbsp;           &gt;&gt;<BR>
&nbsp;           &gt;&gt;<BR>
&nbsp;           &gt;&gt; Thanks,<BR>
&nbsp;           &gt;&gt; Jeff<BR>
&nbsp;           &gt;<BR>
<BR>
<BR>
&nbsp;           _______________________________________________<BR>
&nbsp;           Users mailing list<BR>
&nbsp;           <a href="Users@lists.opensips.org">Users@lists.opensips.org</a> &lt;<a href="http://Users@lists.opensips.org">http://Users@lists.opensips.org</a> &lt;<a href="http://lists.opensips.org">http://lists.opensips.org</a>&gt; &gt;<BR>
<BR>
&nbsp;           <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><BR>
<BR>
<BR>
<BR>
<BR>
&nbsp;   _______________________________________________<BR>
&nbsp;   Users mailing list<BR>
&nbsp;   <a href="Users@lists.opensips.org">Users@lists.opensips.org</a> &lt;<a href="mailto:Users@lists.opensips.org">mailto:Users@lists.opensips.org</a>&gt;<BR>
<BR>
&nbsp;   <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><BR>
<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'><BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Tahoma, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'><BR>
<BR>
</SPAN></FONT></BLOCKQUOTE>
</BODY>
</HTML>