<div dir="auto">Hi Richard,<div dir="auto"><br></div><div dir="auto">Thanks for your reply, understood.</div><div dir="auto"><br></div><div dir="auto">The issue is following (not really an issue, more an optimization):</div><div dir="auto">At the moment of the offer, I simply don't know, what will be supported by the callee. G711 is however always supported, that's why I don't want to strip it. I send the call to our upstream provider; if he sends it to Telefonica, we get an answer with G722 and G711. If he sends it to Deutsche Telekom, the answer is only G711. However, we don't know, if it's gonna be Telefonica or Deutsche Telekom...</div><div dir="auto"><br></div><div dir="auto">I was thinking about avoiding uneccessary RTP traffic (in HD) between RTPEngine and the device in case of an outbound call. From a signalling perspective, I get the right result, if I use sdp_remove_codecs() in my reply. However, that won't work, since the RTP stream sent from RTPEngine to the device is in HD, regardless of the signalling.</div><div dir="auto"><br></div><div dir="auto">I can live with the status quo.</div><div dir="auto"><br></div><div dir="auto">Thanks again,</div><div dir="auto">Carsten</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Richard Fuchs <<a href="mailto:rfuchs@sipwise.com" target="_blank" rel="noreferrer">rfuchs@sipwise.com</a>> schrieb am Di., 21. Mai 2019, 23:38:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 21/05/2019 11.48, Carsten Bock wrote:<br>
> Hi,<br>
><br>
> I want to implement selective transcoding, e.g. avoiding Transcoding <br>
> between a HD codec (G722) and a non HD Codec (G711).<br>
><br>
> In case the caller does offer HD codecs, this is fine, e.g.<br>
><br>
> if(sdp_with_codecs_by_name("G722,OPUS")) {<br>
>   rtpengine_offer("codec-transcode=OPUS codec-transcode=G722 <br>
> codec-transcode=PCMA");<br>
> } else {<br>
>   rtpengine_manage("codec-transcode=PCMA");<br>
> }<br>
><br>
> Now I have the issue, if the callee only sends me G711, I don't want <br>
> to offer G722 or Opus to the caller. However, rtpengine_answer() does <br>
> not seem to accept "codec-strip=G722 codec-strip=OPUS", e.g.:<br>
><br>
> onreply_route() {<br>
>   if(!sdp_with_codecs_by_name("G722,OPUS")) {<br>
>     rtpengine_ manage("codec-strip=OPUS codec-strip=G722");<br>
>   }<br>
> }<br>
><br>
> As a result, the SDP always contains the transcoding options, e.g. <br>
> G722 and OPUS. I always end up in transcoding G722 to G711, which is <br>
> meaningless in that case.<br>
><br>
> Any ideas on how to solve that?<br>
> (above examples very simplified)<br>
<br>
All transcoding options must be present in the `offer` - they're ignored <br>
in the `answer`. (At least in newer versions - older versions did accept <br>
them in an `answer`, but they didn't do what was expected, which is why <br>
they were removed in later versions.)<br>
<br>
The reason for this is that the callee may send media before the SDP <br>
from the callee (the answer) is seen. Therefore all transcoding <br>
decisions must be made at the time of the offer (otherwise you may end <br>
up switching codecs whenever the answer is seen, which is undesirable). <br>
So you'll have to figure out a way to decide what you want to do based <br>
on what you know at the time of the offer.<br>
<br>
I'm a bit confused by your example. If you want to avoid transcoding <br>
between G.722 or Opus, and G.711, why do you want to offer PCMA when the <br>
caller supports G.722 or Opus? Shouldn't you rather only offer other <br>
"HD" codecs and strip all non-HD codecs in that case?<br>
<br>
Cheers<br>
<br>
<br>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" rel="noreferrer noreferrer" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer noreferrer noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div>