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