Hi Daniel,
This commit is causing a regression. uac->last_received is used by
$T_reply_last to access the _previous_ reply. With this commit it is returning
the _current_ reply.
On maandag 7 september 2015 16:00:00 CEST Daniel-Constantin Mierla wrote:
Module: kamailio
Branch: master
Commit: b7c588dff06030a82f305b210573be5bbc961cec
URL:
https://github.com/kamailio/kamailio/commit/b7c588dff06030a82f305b210573be5
bbc961cec
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-09-07T15:56:45+02:00
tm: store last received response code before running onreply_route
- otherwise an innapropriate cancel can happen if the current branch got
before an 1xx response, and the script writer enforces another reply
code with t_reply()
- reported by Thomas Sevestre, GH#315
---
Modified: modules/tm/t_reply.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b7c588dff06030a82f305b210573be5
bbc961cec.diff Patch:
https://github.com/kamailio/kamailio/commit/b7c588dff06030a82f305b210573be5
bbc961cec.patch
---
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index b2e6e53..8da3205 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -2286,10 +2286,21 @@ int reply_received( struct sip_msg *p_msg )
backup_xavps = xavp_set_list(&t->xavps_list);
#endif
setbflagsval(0, uac->branch_flags);
+ if(msg_status>last_uac_status) {
+ /* current response (msg) status is higher that the last received
+ * on the same branch - set it temporarily so functions in
onreply_route
+ * can access it (e.g., avoid sending CANCEL by
forcing another
t_relply() + * in onreply_route when a negative sip response was
received) */ + uac->last_received = msg_status;
+ }
+
/* Pre- and post-script callbacks have already
* been executed by the core. (Miklos)
*/
run_top_route(onreply_rt.rlist[onreply_route], p_msg, &ctx);
+
+ /* restore brach last_received as before executing onreply_route */
+ uac->last_received = last_uac_status;
/* transfer current message context back to t */
if (t->uas.request) t->uas.request->flags=p_msg->flags;
getbflagsval(0, &uac->branch_flags);
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
--
Greetings,
Alex Hermann