Hi,
Is it possible in Kamailio, or SIP in general, to detect if a 200 OK is for a ReINVITE?
Regards,
Grant
Don't know about detect, but you could set a transaction-persistent flag or AVP when processing the reinvite request. This will also be testable in the onreply_route.
-- Alex
-- Principal, Evariste Systems LLC (www.evaristesys.com)
Sent from my Google Nexus.
Hi Alex,
Here a sample config (not yet tested). Does this make sense and will this work?
route[WITHINDLG] { if (!has_totag()) { return; }
# Sequential request within a dialog should take the path determined by record-routing if (loose_route()) { if(is_method("BYE")) { route(ON_LOG_BYE); } if(is_method("INVITE")) { $avp(i:is_reinvite) = 1; } .... } .... }
onreply_route[MANAGE_REPLY] {
if(!t_check_trans()) { exit; } if($avp(i:is_reinvite)) { exit; } .... }
-----Original Message----- From: sr-users [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Alex Balashov Sent: Tuesday, July 12, 2016 3:21 PM To: Kamailio (SER) - Users Mailing List sr-users@lists.sip-router.org Subject: Re: [SR-Users] Detect 200 OK for ReINVITE
Don't know about detect, but you could set a transaction-persistent flag or AVP when processing the reinvite request. This will also be testable in the onreply_route.
-- Alex
-- Principal, Evariste Systems LLC (www.evaristesys.com)
Sent from my Google Nexus.
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On 12 Jul 2016, at 15:18, Grant Bagdasarian gb@cm.nl wrote:
Hi,
Is it possible in Kamailio, or SIP in general, to detect if a 200 OK is for a ReINVITE?
Not from the 200 OK, but the matching INVITE you can check if there’s a to-tag in Kamailio and SIP.
In Kamailio, if you are stateful, you can use the TMX module pseudovariables to check the request matching the response and check if there’s a to-tag. Check the cookbook for $T_req(pv)
http://www.kamailio.org/wiki/cookbooks/4.4.x/pseudovariables
/O
Hi Olle,
Yes, I knew that :D. I went with the method Alex suggested.
In route[WITHINDLG] inside the loose_route block: if(is_method("INVITE")) { $avp(s:is_reinvite) = "1"; }
In onreply_route
if($avp(s:is_reinvite) == "1") { xlog("L_INFO", "[R-ONREPLY-ROUTE-MANAGE-REPLY:$ci] !>" "Received $rs for ReINVITE $rr \r\n"); exit; }
I’ve tested it, and it worked.
From: sr-users [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Olle E. Johansson Sent: Tuesday, July 12, 2016 3:56 PM To: Kamailio (SER) - Users Mailing List sr-users@lists.sip-router.org Subject: Re: [SR-Users] Detect 200 OK for ReINVITE
On 12 Jul 2016, at 15:18, Grant Bagdasarian <gb@cm.nlmailto:gb@cm.nl> wrote:
Hi,
Is it possible in Kamailio, or SIP in general, to detect if a 200 OK is for a ReINVITE?
Not from the 200 OK, but the matching INVITE you can check if there’s a to-tag in Kamailio and SIP.
In Kamailio, if you are stateful, you can use the TMX module pseudovariables to check the request matching the response and check if there’s a to-tag. Check the cookbook for $T_req(pv) http://www.kamailio.org/wiki/cookbooks/4.4.x/pseudovariables
/O
To add my 2c, if the performance is a **really big** concern, the solution with transaction flags as mentioned by Alex is one of the best.
In request route test for to-tag and then setflag(x). Then in onreply_route[...] or failure_route[...] test if isflagset(x).
The other suggestions are also very fast, but not as fast as with transaction flags.
On the other hand -- some details about avp names -- i: for avp names is saying that the name has to be treated as integer id, which is not the case for your example with:
$avp(i:is_reinvite) = 1;
After i: must be a number up to 2^16. Or just remove the i: and let it be string name.
Cheers, Daniel
On 12/07/16 15:55, Olle E. Johansson wrote:
On 12 Jul 2016, at 15:18, Grant Bagdasarian <gb@cm.nl mailto:gb@cm.nl> wrote:
Hi,
Is it possible in Kamailio, or SIP in general, to detect if a 200 OK is for a ReINVITE?
Not from the 200 OK, but the matching INVITE you can check if there’s a to-tag in Kamailio and SIP.
In Kamailio, if you are stateful, you can use the TMX module pseudovariables to check the request matching the response and check if there’s a to-tag. Check the cookbook for
$T_req(pv)
http://www.kamailio.org/wiki/cookbooks/4.4.x/pseudovariables
/O
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users