Module: sip-router
Branch: kamailio_3.0
Commit: 6c3356b6605f4e85f0692c6194ad8a5f5ef06fa9
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6c3356b…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Wed Dec 23 20:44:31 2009 +0100
tm: safer handling for local transactions and drop_replies!=0
- if all the replies are dropped in the failure route and the
transaction is local, return the current reply. This makes the
code more future safe (currently there is no way for the failure
route to be executed and hence for replies to be dropped for
local transactions).
- check for FAKED_REPLY in local_reply() error path.
(cherry picked from commit 0fe25e507eccac409f5094cff4240ee5d3224666)
---
modules/tm/t_reply.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index 4f25059..b1b4af9 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -1274,16 +1274,19 @@ discard:
branches_failed:
*should_store=0;
- *should_relay=-1;
- /* We have hopefully set tm_error in failure_route when
- the branches failed. If not, reply with E_UNSPEC */
- if ((kill_transaction_unsafe(Trans,
- tm_error ? tm_error : E_UNSPEC)
- ) <=0 ){
- LOG(L_ERR, "ERROR: t_should_relay_response: "
- "reply generation failed\n");
+ if (is_local(Trans)){
+ /* for local transactions use the current reply */
+ *should_relay=branch;
+ }else{
+ *should_relay=-1;
+ /* We have hopefully set tm_error in failure_route when
+ the branches failed. If not, reply with E_UNSPEC */
+ if ((kill_transaction_unsafe(Trans,
+ tm_error ? tm_error : E_UNSPEC)) <=0 ){
+ LOG(L_ERR, "ERROR: t_should_relay_response: "
+ "reply generation failed\n");
+ }
}
-
return RPS_COMPLETED;
}
@@ -1828,7 +1831,7 @@ error:
prepare_to_cancel(t, cancel_bitmap, 0);
UNLOCK_REPLIES(t);
cleanup_uac_timers(t);
- if ( get_cseq(p_msg)->method.len==INVITE_LEN
+ if (p_msg && p_msg!=FAKED_REPLY &&
get_cseq(p_msg)->method.len==INVITE_LEN
&& memcmp( get_cseq(p_msg)->method.s, INVITE, INVITE_LEN)==0)
cancel_uacs( t, *cancel_bitmap, F_CANCEL_B_KILL);
*cancel_bitmap=0; /* we've already took care of everything */