Hi David, 

As Alex said, K is a proxy. If you strictly want to use something like K, then I would suggest yo have a look at the rtp_media_server module:

https://www.kamailio.org/docs/modules/devel/modules/rtp_media_server.html

Only available in master branch (5.3), but worth giving a try if you ask me... It might simplify and achieve what you need.

Joel.

On Mon, Apr 15, 2019 at 12:50 PM 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