Module: sip-router
Branch: master
Commit: 5a620b105b62e48631e9248906e00b4b2c7b4081
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5a620b1…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Feb 22 19:41:33 2010 +0100
tmx(k): core & tm onreply route support
- support for core onreply route (like for tm onreply route, but
with extra t_unref).
- use get_route_type() instead of directly accessing route_type.
---
modules_k/tmx/t_var.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/modules_k/tmx/t_var.c b/modules_k/tmx/t_var.c
index 6441763..7f537ff 100644
--- a/modules_k/tmx/t_var.c
+++ b/modules_k/tmx/t_var.c
@@ -404,12 +404,18 @@ int pv_get_tm_reply_code(struct sip_msg *msg, pv_param_t *param,
/* no T */
code = 0;
} else {
- switch (route_type) {
+ switch (get_route_type()) {
case REQUEST_ROUTE:
/* use the status of the last sent reply */
code = t->uas.status;
break;
- case ONREPLY_ROUTE:
+ case CORE_ONREPLY_ROUTE:
+ /* t_check() above has the side effect of setting T and
+ REFerencing T => we must unref and unset it for the
+ main/core onreply_route. */
+ _tmx_tmb.t_unref(msg);
+ /* no break */
+ case TM_ONREPLY_ROUTE:
/* use the status of the current reply */
code = msg->first_line.u.reply.statuscode;
break;
@@ -424,7 +430,7 @@ int pv_get_tm_reply_code(struct sip_msg *msg, pv_param_t *param,
}
break;
default:
- LM_ERR("unsupported route_type %d\n", route_type);
+ LM_ERR("unsupported route_type %d\n", get_route_type());
code = 0;
}
}
Module: sip-router
Branch: master
Commit: ba15378ef66a11d3cbd6862aa2bfb060d099ca03
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ba15378…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Feb 22 18:01:26 2010 +0100
tm: onreply_route: fix cleanup after DROP
After a DROP in the onreply_route the avp lists where not restored
to their original values and the possible msg flags changes in the
script were dropped.
---
modules/tm/t_reply.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index f37903a..9fbe6c3 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -2053,13 +2053,6 @@ int reply_received( struct sip_msg *p_msg )
LOCK_REPLIES( t );
replies_locked=1;
run_top_route(onreply_rt.rlist[t->on_reply], p_msg, &ctx);
- if ((ctx.run_flags&DROP_R_F) && (msg_status<200)) {
- if (unlikely(replies_locked)) {
- replies_locked = 0;
- UNLOCK_REPLIES( t );
- }
- goto done;
- }
/* transfer current message context back to t */
if (t->uas.request) t->uas.request->flags=p_msg->flags;
getbflagsval(0, &uac->branch_flags);
@@ -2074,6 +2067,16 @@ int reply_received( struct sip_msg *p_msg )
#ifdef WITH_XAVP
xavp_set_list(backup_xavps);
#endif
+ /* handle a possible DROP in the script, but only if this
+ is not a final reply (final replies already stop the timers
+ and droping them might leave a transaction living forever) */
+ if ((ctx.run_flags&DROP_R_F) && (msg_status<200)) {
+ if (unlikely(replies_locked)) {
+ replies_locked = 0;
+ UNLOCK_REPLIES( t );
+ }
+ goto done;
+ }
}
#ifdef USE_DST_BLACKLIST
/* add temporary to the blacklist the source of a 503 reply */
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;
Module: sip-router
Branch: master
Commit: 099a29532ed7c9c8ce736eb1f989a5af8bba4b4f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=099a295…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Feb 22 18:00:30 2010 +0100
NEWS: note about onreply_route changes & tm
---
NEWS | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/NEWS b/NEWS
index b52d505..5f193c4 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ $Id$
sip-router 3.1 chages
core:
+ - onreply_route {...} is now equivalent with onreply_route[0] {...}
- global, per protocol blacklist ignore masks (via extended send_flags).
See dst_blacklist_udp_imask a.s.o (dst_blacklist_*_imask).
- per message blacklist ignore masks
@@ -36,6 +37,9 @@ modules:
the mask for possible local replies to the current message.
blst_rpl_clear_ignore(mask): like blst_rpl_ignore(mask), but
clears instead of setting.
+tm:
+ - t_reply() can be used both from the main/core onreply_route{} and tm
+ onreply_route[...]{}s.
Module: sip-router
Branch: master
Commit: 04f55d6c20fbb7628b3c672a5df5a0a1e2c67114
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=04f55d6…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Feb 19 16:37:51 2010 +0100
Merge remote branch 'origin/andrei/blst_send_flags'
Support for blacklist ignore flags, both global and on a per
message basis.
E.g.:
per message:
if (method=~"MESSAGE")
blst_set_ignore(6);
global:
sercmd cfg.set_now_int core dst_blacklist_tcp_imask 16
* origin/andrei/blst_send_flags:
NEWS: minor blacklist flag number correction
tm: blacklist on 503 reply fixed for send flags
NEWS: mentioned blacklist ignore masks
core: cfg script support for blacklist ignore masks
blst: global config variables for ignoring blacklist events
blst: docs for blst_{set,clear}_ignore script functions
blst: functions for ignoring blacklist events
blst: use dst_blacklist_force_add
tm: simplified blacklist add code
blacklist: ignore mask support
tm: updated to the new snd_flags_t structure
core: send_flags preliminary blacklist support
Conflicts:
NEWS
cfg.lex
cfg.y
dst_blacklist.h
---
Module: sip-router
Branch: andrei/blst_send_flags
Commit: 0f2375f9216fd7f431e91d02f4ccc5dc9e4e5730
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0f2375f…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Feb 19 15:35:57 2010 +0100
tm: blacklist on 503 reply fixed for send flags
Blacklisting the source of a 503 reply now obeys also the
blacklist ignore masks (both global and per message).
The ignore 503 blacklist flag can be set (and it will be obeyed)
in any route (be it main route, on branch, on send or the on_reply
route). E.g.: using blst_set_ignore(32) in the onsend_route for a
specific destination would cause the ignore 503 flag to be
inherited by the 503 reply (this is the only blacklist flag that
it's inherited this way).
---
modules/tm/t_reply.c | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index 0b16fae..4e53584 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -1844,7 +1844,6 @@ int reply_received( struct sip_msg *p_msg )
#endif
#ifdef USE_DST_BLACKLIST
int blst_503_timeout;
- struct dest_info src;
struct hdr_field* hf;
#endif
#ifdef TMCB_ONSEND
@@ -1972,6 +1971,10 @@ int reply_received( struct sip_msg *p_msg )
switch_rb_retr_to_t2(&uac->request);
}
}
+ /* pre-set the ignore BLST_503 flag in the message, if the
+ corresponding branch had it set on send */
+ p_msg->fwd_send_flags.blst_imask|=
+ uac->request.dst.send_flags.blst_imask & BLST_503;
/* processing of on_reply block */
if (t->on_reply) {
set_route_type(ONREPLY_ROUTE);
@@ -2008,10 +2011,13 @@ int reply_received( struct sip_msg *p_msg )
}
#ifdef USE_DST_BLACKLIST
/* add temporary to the blacklist the source of a 503 reply */
- if (cfg_get(tm, tm_cfg, tm_blst_503)
- && cfg_get(core, core_cfg, use_dst_blacklist)
- && (msg_status==503)
- ){
+ if ( (msg_status==503) &&
+ cfg_get(tm, tm_cfg, tm_blst_503) &&
+ /* check if the request sent on the branch had the the
+ blst 503 ignore flags set or it was set in the onreply_r*/
+ should_blacklist_su(BLST_503, &p_msg->fwd_send_flags,
+ p_msg->rcv.proto, &p_msg->rcv.src_su)
+ ){
blst_503_timeout=cfg_get(tm, tm_cfg, tm_blst_503_default);
if ((parse_headers(p_msg, HDR_RETRY_AFTER_F, 0)==0) &&
(p_msg->parsed_flag & HDR_RETRY_AFTER_F)){
@@ -2027,12 +2033,9 @@ int reply_received( struct sip_msg *p_msg )
}
}
if (blst_503_timeout){
- src.send_sock=0;
- src.to=p_msg->rcv.src_su;
- src.id=p_msg->rcv.proto_reserved1;
- src.proto=p_msg->rcv.proto;
- dst_blacklist_add_to(BLST_503, &src, p_msg,
- S_TO_TICKS(blst_503_timeout));
+ dst_blacklist_force_su_to(BLST_503, p_msg->rcv.proto,
+ &p_msg->rcv.src_su, p_msg,
+ S_TO_TICKS(blst_503_timeout));
}
}
#endif /* USE_DST_BLACKLIST */