[SR-Users] Send 200 OK response with body to INVITE requests

Alex Balashov abalashov at evaristesys.com
Tue Apr 16 01:19:17 CEST 2019


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 at 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 at 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 at 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 at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> 
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190415/e2427ae6/attachment.html>


More information about the sr-users mailing list