Hi,

Did you try to lookup the dialog[1] before calling dlg_req_within()?

[1] https://kamailio.org/docs/modules/devel/modules/dialog.html#dialog.f.dlg_get

Thanks,
Carsten 

--
Schöne Grüße aus Hamburg, dem Tor zur Welt,
Carsten Bock

Baron-Voght-Str. 128a I 22607 Hamburg I Germany
T +49 179 2021244 I carsten@bock.info
LinkedIn: https://www.linkedin.com/in/carstenbock/

Alex Balashov via sr-users <sr-users@lists.kamailio.org> schrieb am Do., 14. Nov. 2024, 21:44:
Hi,

I am trying to use dlg_req_within() for a 3pcc-style call setup, to set up media via a reinvite:

1. Store original SDP offer from caller in $dlg_var()s;

2. Later, after e2e ACK is processed for initial INVITE transaction, send reinvite to callee using dlg_req_within(). I call rtpengine_offer() and feed it the original SDP offer (via read_sdp_pv modparam), and take the RTPEngine-transformed SDP and feed that to dlg_req_within():

   dlg_req_within("callee", "INVITE", "application/sdp", "$var(sdp_from_rtpengine)");

3. I have found that event_route[tm:local-response] does not allow me to capture the 200 OK / SDP answer to this reinvite; it is internally absorbed.

However, it is possible to arm an onreply_route in event_route[tm:local-request], to receive the 200 OK:

   event_route[tm:local-request] {
      if(method == "INVITE" && has_body("application/sdp"))
         t_on_reply("REINVITE_REPLY");
   }

4. My intent is for this reinvite reply handler to set off a reinvite to the caller side:

   onreply_route[REINVITE_REPLY] {
      if(method == "INVITE" && has_body("application/sdp") && t_check_status("200")) {
         ...
         $var(rtpengine_use_this_sdp) = $rb;
         rtpengine_answer("...");
         dlg_req_within("caller", "INVITE", "application/sdp", "$var(sdp_from_rtpengine)");
   }

This ensures proper relay symmetry. Otherwise, the caller will continue to send RTP to the previous upstream endpoint of the call, prior to any reinvite.

However, dlg_req_within() doesn't work in this later context, even though the documentation says it can be used from ANY_ROUTE. Kamailio doesn't complain, there is no error. It just doesn't initiate a reinvite to the caller.

I considered the possibility that this may be because the calling scope is that of a pending reinvite transaction to the callee, but there is no obvious way to defer that into the future. If I send it to an async task worker, the transaction scope required for dlg_req_within() to know which dialog it's operating on will be lost.

Any ideas appreciated, and thank you in advance!

-- Alex

--
Alex Balashov
Principal Consultant
Evariste Systems LLC
Web: https://evaristesys.com
Tel: +1-706-510-6800

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!