As you say, the rtpengine SDP mangling is turn-key with rtpengine_answer(). It's working perfectly.

But I'm surprised to find I cannot generate a 200 OK and attach the SDP inside Kamailio.

sl_send_reply() would be perfect but it doesn't allow a body to be attached (unless I missed something in the docs?)

uac_req() allows the headers and body to be created but doesn't allow a status code to be set (as far as I know?)

So frustrating because I've been able to script everything else I need within Kamailio. The missing piece is being able to create this response then everything works.

Dave.





On Tuesday, 16 April 2019, 00:21:07 BST, Alex Balashov <abalashov@evaristesys.com> wrote:


Kamailio will substitute RTPEngine-mangled SDP upon your invocation of rtpengine_answer(). You’re working about a thousand times too hard on this issue; it’s already turn-key. :-)

Sent from mobile, with due apologies for brevity and errors.

On Apr 15, 2019, at 6:03 PM, David Dean <just_bytesize@yahoo.co.uk> wrote:

Hi Alex,

Thanks for the tip re: rtpengine routing, that's really useful.

The flow I'm trying to create is like this:

[ Test Client ] ------> INVITE ------> [ Kamailio ]
          ^                                                   |
          |-------------- 200 OK + SDP --------|

The goal is for the test client to think a remote client accepted the call, when actually it's just Kamailio faking the 200 response.

There must be some way (even if it's hacky!) to get a 200 response back to the client with the rtpengine SDP included?

I got very close with $uac_req but it doesn't seem to be able to set the "200" status so the Test Client thought it was a brand new call. If I could set the 200 status with $uac_req (or something similar) then this will be working.

Thanks.



On Monday, 15 April 2019, 20:50:18 BST, Alex Balashov <abalashov@evaristesys.com> wrote:


Hi David,

Kamailio is a proxy, so it cannot endogenously originate either requests
or most replies. A 200 OK to an INVITE transaction can only come from a
user agent (endpoint), and Kamailio's sole job is to forward it. So, the
200 OK is going to come from the auto-answering callee.

To engage RTPEngine in both directions, you need to intercept the 200 OK
that is generated from the callee and call rtpengine_answer() /
rtpengine_manage() on it:

---
route {
  ...

  if(is_method("INVITE")) {
      ...

      rtpengine_offer("...");

      t_on_reply("REPLY");

      if(!t_relay())
        sl_reply_error();

      exit;
  }

  ...
}

onreply_route[REPLY] {
  if(is_method("INVITE") && sdp_content())
      rtpengine_answer("...");
}
---

-- Alex

On Mon, Apr 15, 2019 at 07:41:22PM +0000, David Dean wrote:

> Hi all,
> I'm building an automated load testing system for an rtp media server with TURN that uses Kamailio for SIP.
> When a client sends an INVITE to Kamailio, I need Kamailio to respond with "200 OK" and the SDP generated by rtpengine.
> I've enabled auto-answer in the client, so as soon as it receives the response from Kamailio it will start sending RTP packets.
> Right now I'm using send_reply("200", "OK"); which is sending the right 200 response back to the client, but it doesn't include any body.
> How can I get Kamailio to send a "200 OK" and add the rtpengine_answer into the body?
> Appreciate any help, I've been struggling with this for three days.
> Cheers.
>
> rtpengine_offer("SIP-source-address ICE=force-relay RTP");send_reply("200", "OK");

>

> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


--
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users