<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    use msg_apply_changes() from textops modules in between the changes
    done to sdp.<br>
    <br>
    No time to check the code, so I am not sure at this moment if can be
    done inside the onreply_route[x], which is executed by tm, but
    should be possible in core reply_route - -there you can make a
    filter and detect it is sdp, do the subst, apply the changes, then
    let the rtpproxy in onreply_route[x] like now.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 15/01/15 13:38, Matthias van der
      Vlies wrote:<br>
    </div>
    <blockquote cite="mid:54B7B4A8.5060104@gmail.com" type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=windows-1252">
      Dear all,<br>
      <br>
      I have an on-reply route that needs to change the SDP version for
      the reply coming in. The use case is that I have a mobile
      originated call and there is some Ericsson switch that doesn't
      like it when the SDP version is updated (in this case by asterisk)
      although nothing has changed to the actual SDP (183 session
      progress and then OK.)  Funny thing is that Asterisk will actually
      drop a call if it receives a re-INVITE with same version... That's
      why they invented ignoresdpversion, but now it's the other way
      around.... :)<br>
      <br>
      Mobile phone -> Ericsson MSC -> ACME packet ->
      (18X.4X.XXX.XX) Kamailio (10.41.0.21) -> Asterisk<br>
      <br>
      The issue is that the asterisk sends a reply 200 OK, with an
      updated version because it already sent SDP for 183 session
      progress. This can be patched in asterisk, but in my scenario I
      can unfortunately not do that. Thus trying to fix this on
      Kamailio.<br>
      <br>
      I am able to 'fix' this currently by performing a subst on the sdp
      owner variable:<br>
      <br>
      onreply_route[WITHSDP] {<br>
              if (has_body("application/sdp")) {<br>
                      if(ds_is_from_list()) {<br>
                              rtpproxy_answer("wrei"); <br>
                            <b> if(subst("/^o=someowner ([0-9]+)
        ([0-9]+) IN IP4 (.*)$/o=someowner \1 \1 IN IP4 \3/")) {</b><br>
                                     xlog("L_INFO", "Fixed Asterisk
      incorrect version number in SDP");<br>
                             }<br>
                             # tried the answer here as well, but that
      corrupts it even more<br>
                      }<br>
                      else {<br>
                              rtpproxy_answer("wrie");<br>
                      }<br>
              }<br>
              exit; <br>
      }<br>
      <br>
      However this corrupts the SDP:<br>
      <br>
      v=0<br>
      o=tismi 652858233 652858233 IN IP4 10.41.0.21<b>18X.4X.XXX.XX</b><br>
      s=Some server<br>
      c=IN IP4 18X.4X.XXX.XX<br>
      t=0 0<br>
      m=audio 57644 RTP/AVP 8 0 18 3 101<br>
      a=rtpmap:8 PCMA/8000<br>
      a=rtpmap:0 PCMU/8000<br>
      a=rtpmap:18 G729/8000<br>
      a=fmtp:18 annexb=no<br>
      a=rtpmap:3 GSM/8000<br>
      a=rtpmap:101 telephone-event/8000<br>
      a=fmtp:101 0-16<br>
      a=silenceSupp:off - - - -<br>
      a=ptime:20<br>
      a=sendrecv<br>
      a=nortpproxy:yes<br>
      <br>
      When I do not substitute the SDP looks perfectly fine and the
      external address shows as the IN IP4. But of course the version is
      incremented:<br>
      <br>
      v=0<br>
      o=tismi 1606876535 <b>1606876536</b> IN IP4 <b>18X.4X.XXX.XX</b><br>
      s=Some server<br>
      c=IN IP4 18X.4X.XXX.XX<br>
      t=0 0<br>
      m=audio 55410 RTP/AVP 8 0 18 101<br>
      a=rtpmap:8 PCMA/8000<br>
      a=rtpmap:0 PCMU/8000<br>
      a=rtpmap:18 G729/8000<br>
      a=fmtp:18 annexb=no<br>
      a=rtpmap:101 telephone-event/8000<br>
      a=fmtp:101 0-16<br>
      a=silenceSupp:off - - - -<br>
      a=ptime:20<br>
      a=sendrecv<br>
      a=sdpmangled:yes<br>
      <br>
      <br>
      The ericsson is now accepting this (although it's corrupt, I
      know.... probably the ACME doing something funky with it), but it
      causes issues with another unknown piece of equipment that fails
      on parsing the session owner. I hope there is something wrong with
      my subst, but I'm afraid I can not do this from the on_reply route
      because SDP is only updated once it finishes?<br>
      <br>
      I know it's dangerous to alter the session version like this, so I
      made sure the Asterisk will never send a re-INVITE. Now I need a
      way to not corrupt the o=<br>
      <br>
      Kind regards,<br>
      <br>
      Matthias van der Vlies<br>
      <br>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
  </body>
</html>