Module: sip-router
Branch: master
Commit: 9e2873513df7d4fc2fee192f47629b81301f5012
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9e28735…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Feb 22 17:50:40 2010 +0100
tm: t_reply can now be used from onreply_routes
t_reply can now be used both from the main onreply_route
(onreply_route{}) or from tm onreply_routes (onreply_route[x]{},
where x!=0).
In general it should be followed by a DROP. If not you might get
some log warning messages (but besides that nothing bad will
happen).
---
modules/tm/tm.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/modules/tm/tm.c b/modules/tm/tm.c
index 16275c8..513dc99 100644
--- a/modules/tm/tm.c
+++ b/modules/tm/tm.c
@@ -315,7 +315,7 @@ static cmd_export_t cmds[]={
{"t_lookup_cancel", w_t_lookup_cancel, 1, fixup_int_1,
REQUEST_ROUTE},
{T_REPLY, w_t_reply, 2, fixup_t_reply,
- REQUEST_ROUTE | FAILURE_ROUTE },
+ REQUEST_ROUTE | ONREPLY_ROUTE | FAILURE_ROUTE },
{"t_retransmit_reply", w_t_retransmit_reply, 0, 0,
REQUEST_ROUTE},
{"t_release", w_t_release, 0, 0,
@@ -1255,6 +1255,21 @@ inline static int w_t_reply(struct sip_msg* msg, char* p1, char*
p2)
ret = t_reply_unsafe(t, msg, code, r);
} else if (is_route_type(REQUEST_ROUTE)) {
ret = t_reply( t, msg, code, r);
+ } else if (is_route_type(ONREPLY_ROUTE)) {
+ if (likely(t->uas.request)){
+ if (is_route_type(CORE_ONREPLY_ROUTE))
+ ret=t_reply(t, t->uas.request, code, r);
+ else
+ ret=t_reply_unsafe(t, t->uas.request, code, r);
+ }else
+ ret=-1;
+ /* t_check() above has the side effect of setting T and
+ REFerencing T => we must unref and unset it.
+ Note: this is needed only in the CORE_ONREPLY_ROUTE and not also in
+ the TM_ONREPLY_ROUTE.
+ */
+ UNREF( t );
+ set_t(T_UNDEFINED, T_BR_UNDEFINED);
} else {
LOG(L_CRIT, "BUG: w_t_reply entered in unsupported mode\n");
ret = -1;