[OpenSIPS-Users] Handling 488 on a leg B

Dmitry netaskd at gmail.com
Fri Feb 2 11:00:42 EST 2018


Hi Bogdan,

Thank you indeed for the help!

After moving the first changing body to branch (and second too), it works perfect.

 

From: Bogdan-Andrei Iancu [mailto:bogdan at opensips.org] 
Sent: Friday, February 2, 2018 5:18 PM
To: Dmitry <netaskd at gmail.com>; 'OpenSIPS users mailling list' <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] Handling 488 on a leg B

 

Hi Dmitry,

In order to push per-branch changes (changes which are specific only to a certain branch and not to all of them), you need to use the branch route - see http://www.opensips.org/Documentation/Script-Routes-2-3#toc2

So, put the code for changing the body via rtpengine into a branch route.

Regards,



Bogdan-Andrei Iancu
 
OpenSIPS Founder and Developer
  http://www.opensips-solutions.com
OpenSIPS Summit 2018
  http://www.opensips.org/events/Summit-2018Amsterdam

On 02/02/2018 12:53 PM, Dmitry wrote:

Hi Bogdan,

I change both of them. The first INVITE and the second (after 488).

The first apply successfully, but the second (that in the failure_route) does not.

 

My script looks like this:

 

route {

…

  t_on_reply("ONREPLY”);

  if (isbflagset(NAT_BFLAG) && af!=INET6) {

    force_rport(); # add rport to first line Via:

    route(RTPENGINE_OFFER); # make offer

  }

…

  t_relay();

…

}

 

route[RTPENGINE_OFFER] {

  …

      $avp(rtp_profile) = "trust-address replace-origin replace-session-connection ICE=remove DTLS=off RTP/SAVP";

      if (rtpengine_offer("$avp(rtp_profile)","$avp(rtp_socket)","$avp(rtp_body)")) {

        remove_body_part();

        add_body_part("$avp(rtp_body)", "application/sdp"); # first changing leg-B - successfully

      }

  …

}

 

onreply_route[ONREPLY] {

…

  t_on_reply("RTPENGINE_ANSWER"); # positive

  t_on_failure("RTPENGINE_488");  # negative

…

}

 

failure_route[RTPENGINE_488] {

…

  if (t_check_status("488") ) {

 

    # try to change SDP in leg-B after 488 received - unsuccessfully

    #  it returns: ERROR:rtpengine:rtpe_function_call: can't extract body from the message. 

    # from which message?

    if (rtpengine_offer("trust-address replace-origin replace-session-connection ICE=remove DTLS=off RTP/AVP","$avp(rtp_socket)","$avp(rtp_body)")) {

      remove_body_part();

      add_body_part("$avp(rtp_body)", "application/sdp");

    }

    # 

 

    #  just replace with re.subst

    $avp(rtp_body) = $(avp(rtp_body){re.subst,/SAVP/AVP/g});

    $avp(rtp_body) = $(avp(rtp_body){re.subst,/a=crypto.*//g});

     # if I use remove_body_part(), then add_body_part() is not adds content. INVITE sends without body.

    remove_body_part();

     # if I don’t use remove_body_part(), then INVITE contains TWO sdp body with RTP/SAVP and RTP/AVP

    add_body_part("$avp(rtp_body)", "application/sdp");

    #

 

    xlog("rtp_body=$avp(rtp_body)\n");

   # xlog for $avp(rtp_body) shows unchanged content (with RTP/SAVP)

 

…

     t_relay();

  }

…

}

 

From: Bogdan-Andrei Iancu [mailto:bogdan at opensips.org] 
Sent: Thursday, February 1, 2018 7:51 PM
To: Dmitry  <mailto:netaskd at gmail.com> <netaskd at gmail.com>; 'OpenSIPS users mailling list'  <mailto:users at lists.opensips.org> <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] Handling 488 on a leg B

 

Hi Dmitry,

In failure route you re-process the original request (INVITE) and not the 488 reply - the reply is just the trigger.
Do you change the INVITE SDP before the first attempt (which ends with 488) ? Or you change it for the first time in the failure route ?

Regards,




Bogdan-Andrei Iancu
 
OpenSIPS Founder and Developer
  http://www.opensips-solutions.com
OpenSIPS Summit 2018
  http://www.opensips.org/events/Summit-2018Amsterdam

On 02/01/2018 05:34 PM, Dmitry wrote:

Hello Bogdan,

Thank you for advice.

I catched 488 and can send INVITE from failure_route, but I can’t modify body inside it.

The main goal is change SAVP profile to AVP when 488 received.

I tried to do it via rtpengine_offer function. It doesn’t work. I guess, it try to read the body from response (488 in my case) but not from request.

I tried to rewrite body via remove_body_part and add_body_part functions, it also doesn’t work.

So, I don’t understand how exactly rewrite body in failure_route before do t_relay().

In addition, I tried making a new branch (via append_branch function and via branch_route). It just duplicate my re-INVITE without changing the body.

Could you please drop a hint (example on few lines of code) how to do it?

Thanks.

 

From: Bogdan-Andrei Iancu [mailto:bogdan at opensips.org] 
Sent: Wednesday, January 31, 2018 6:55 PM
To: OpenSIPS users mailling list  <mailto:users at lists.opensips.org> <users at lists.opensips.org>; Dmitry  <mailto:netaskd at gmail.com> <netaskd at gmail.com>
Subject: Re: [OpenSIPS-Users] Handling 488 on a leg B

 

Hello Dmitry,

What you want to do is called (in SIP) serial forking. Use failure_route{} to catch the 488 and to add a create a new branch (with modified body) .

See: http://www.opensips.org/Documentation/Script-Routes-2-3#toc3

Regards,





Bogdan-Andrei Iancu
 
OpenSIPS Founder and Developer
  http://www.opensips-solutions.com
OpenSIPS Summit 2018
  http://www.opensips.org/events/Summit-2018Amsterdam

On 01/30/2018 02:56 PM, Dmitry wrote:

Hello all,

Could you say how can I re-send INVITE with changed SDP to B-leg after receive 488 from it?

Call flow:

-> A-leg INVITE

<- A-leg 100

-> B-leg INVITE

<- B-leg 100

<- B-leg 488 – I catch it, and want to send INVITE again with properly SDP

-> B-leg ACK

<-A-leg 488

-> B-leg ACK

 

Thanks for any advice.

Cheers!








_______________________________________________
Users mailing list
Users at lists.opensips.org <mailto:Users at lists.opensips.org> 
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20180202/26fce151/attachment-0001.html>


More information about the Users mailing list