Hello,
based on the discussion from last weeks on sr-dev related to selection
of reply code for failure route, I did some updates in kamailio_3.0
branch. Main goal was to have the option of Kamailio 1.5 compatibility
mode. Here is the patch:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3ed6685…
Description of the changes is included in the commit message.
Andrei, can you double check if there is any possible side effect considering the new TM architecture inherited from ser? Patch is not that complex.
Miklos, does it meet what we tried to cover in the discussion? Anything missing?
Very much appreciated if anyone can test and send feedback.
Cheers,
Daniel
--
Daniel-Constantin Mierla
* http://www.asipto.com/
Module: sip-router
Branch: kamailio_3.0
Commit: 3ed668500c9a0f0d2f864f5a56cf7fa886f8457c
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3ed6685…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Wed Dec 2 19:01:09 2009 +0100
tm: drop replies behaviour based on cfg compat mode
- default behaviour for #!KAMAILIO is to drop replies after failure
route to avoid selecting same reply during the next failure event
- for the rest of cases all replies are kept and used to select the
code for new failure route (SER compat mode)
- t_drop_replies() can take one parameter
- 'n[one]' - do not drop any reply (good for #!KAMAILIO mode)
- 'l[ast]' - drop replies received during last serial forking step
- 'a[ll]' - drop all replies
- if the parameter is missing, then will drop all replies
---
modules/tm/t_reply.c | 20 ++++++++++++++++----
modules/tm/t_reply.h | 2 +-
modules/tm/tm.c | 11 ++++++++++-
3 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index a250f63..1573e4d 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -138,6 +138,7 @@
#include "t_lookup.h"
#include "t_fwd.h"
#include "../../fix_lumps.h"
+#include "../../sr_compat.h"
#include "t_stats.h"
#include "uac.h"
@@ -1124,7 +1125,10 @@ static enum rps t_should_relay_response( struct cell *Trans , int new_code,
Trans->flags&=~T_6xx; /* clear the 6xx flag , we want to
allow new branches from the failure route */
- drop_replies = 0;
+ if(sr_cfg_compat==SR_COMPAT_KAMAILIO)
+ drop_replies = 1;
+ else
+ drop_replies = 0;
/* run ON_FAILURE handlers ( route and callbacks) */
if (unlikely(has_tran_tmcbs( Trans, TMCB_ON_FAILURE_RO|TMCB_ON_FAILURE)
|| Trans->on_negative )) {
@@ -1137,7 +1141,15 @@ static enum rps t_should_relay_response( struct cell *Trans , int new_code,
picked_code, extra_flags);
if (unlikely(drop_replies)) {
/* drop all the replies that we have already saved */
- for (i=0; i<branch_cnt; i++) {
+ i = 0;
+ if(drop_replies==2)
+ {
+ for(i=branch_cnt-1; i>=0; i--)
+ if(Trans->uac[i].flags&TM_UAC_FLAG_FB)
+ break;
+ if(i<0) i=0;
+ }
+ for (; i<branch_cnt; i++) {
if (Trans->uac[i].reply &&
(Trans->uac[i].reply != FAKED_REPLY) &&
(Trans->uac[i].reply->msg_flags & FL_SHM_CLONE))
@@ -2237,14 +2249,14 @@ error:
/* drops all the replies to make sure
* that none of them is picked up again
*/
-void t_drop_replies(void)
+void t_drop_replies(int v)
{
/* It is too risky to free the replies that are in shm mem
at the middle of failure_route block, because other functions might
need them as well. And it can also happen that the current reply is not yet
in shm mem, we are just going to clone it. So better to set a flag
and check it after failure_route has ended. (Miklos) */
- drop_replies = 1;
+ drop_replies = v;
}
#if 0
diff --git a/modules/tm/t_reply.h b/modules/tm/t_reply.h
index c385697..0a97e6a 100644
--- a/modules/tm/t_reply.h
+++ b/modules/tm/t_reply.h
@@ -153,7 +153,7 @@ int t_pick_branch_blind(struct cell *t, int *res_code);
/* drops all the replies to make sure
* that none of them is picked up again
*/
-void t_drop_replies(void);
+void t_drop_replies(int v);
extern const char* rpc_reply_doc[2];
void rpc_reply(rpc_t* rpc, void* c);
diff --git a/modules/tm/tm.c b/modules/tm/tm.c
index 09f08c6..51a31c0 100644
--- a/modules/tm/tm.c
+++ b/modules/tm/tm.c
@@ -381,6 +381,8 @@ static cmd_export_t cmds[]={
REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE },
{"t_drop_replies", w_t_drop_replies, 0, 0,
FAILURE_ROUTE},
+ {"t_drop_replies", w_t_drop_replies, 1, 0,
+ FAILURE_ROUTE},
{"t_save_lumps", w_t_save_lumps, 0, 0,
REQUEST_ROUTE},
{"t_check_trans", t_check_trans, 0, 0,
@@ -1725,7 +1727,14 @@ int t_grep_status(struct sip_msg* msg, char* status, char* bar)
* that none of them is picked up again */
static int w_t_drop_replies(struct sip_msg* msg, char* foo, char* bar)
{
- t_drop_replies();
+ if(foo==NULL)
+ t_drop_replies(1);
+ else if(*foo=='n')
+ t_drop_replies(0);
+ else if(*foo=='l')
+ t_drop_replies(2);
+ else
+ t_drop_replies(1);
return 1;
}
Daily snapshots of sr_3.0, kamailio_3.0 and sr master branch can be
downloaded from: http://sip-router.org/tarballs/sr/ .
Note that new tarballs are generated only if there are changes for the
corresponding branch (so if you don't see a tarball with today's date it
means there was no change from the previous one).
The tarballs are generated via make tar, which makes sure the correct
repository version will be included in the compiled binary (make tar
generates first autover.h before creating the archive).
Andrei
P.S.: we should really choose a short name
Hi All,
I'm using SER version 2.0.0-rc1 as a SIP server and in that facing
lot of memory leaks issue. I'm not able to enable the memory logs in SER.
Can anybody help me identifying memory leaks or tell me how to enable
memlogs so that I myself will try removing all the leaks...
Plz help me ASAP, its urgent...
Thanx n regards,
--Piyush
The information contained in this e-mail message is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you should return it to the sender immediately. Please note that while we scan all e-mails for viruses we cannot guarantee that any e-mail is virus-free and accept no liability for any damage caused by any virus transmitted by this email.
Hi all,
I have a problem with the DSYSLOG_ASYNC option in the Makefile.defs
If I have set this option I could not longer receive log messages in the
"normal" running mode (forking, debug level=2 stderr = no).
If I set the debug to 9 I receive logging messages, then via
$kamctl debug 2
is everything fine.
If the debug is set to 2 and I run the proxy in foreground I also
receive log messages.
Any way, I have tried to find out what is going wrong here and found
something in :
daemonize.c
At the end of the daemonize function is a for loop
int daemonize(int * own_pgid)
.
.
/* close any open file descriptors
32 is the maximum number of inherited open file descriptors */
for (r=3; r < 32; r++){
close(r);
}
.
.
The variable "r" is used for the return value of fprintf (Upon
successful return, these functions return the number of characters
printed ..).
At the moment I have no idea why this triggering this error and only for
the DSYSLOG_ASYNC option.
Furthermore why or for what is this for-loop good ?
Maybe I am totally wrong or off the track but I really want this async
logging.
best regards
Torben