[sr-dev] git:4.2:aa87917a: sl: re-attempt to bind to tm after all mods init
Daniel-Constantin Mierla
miconda at gmail.com
Wed Feb 4 18:11:00 CET 2015
Module: kamailio
Branch: 4.2
Commit: aa87917aa27bcc9f3f71da4cead1b51d17e75da7
URL: https://github.com/kamailio/kamailio/commit/aa87917aa27bcc9f3f71da4cead1b51d17e75da7
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-02-04T18:08:01+01:00
sl: re-attempt to bind to tm after all mods init
- handle the situation when tm is initialized after the sl module
- re-binding is done on child callback with rank PROC_INIT
(cherry picked from commit 85d3488c3910d447f6900df166bc6b0c16a64e9c)
---
Modified: modules/sl/sl.c
---
Diff: https://github.com/kamailio/kamailio/commit/aa87917aa27bcc9f3f71da4cead1b51d17e75da7.diff
Patch: https://github.com/kamailio/kamailio/commit/aa87917aa27bcc9f3f71da4cead1b51d17e75da7.patch
---
diff --git a/modules/sl/sl.c b/modules/sl/sl.c
index 5f3febb..27c30e8 100644
--- a/modules/sl/sl.c
+++ b/modules/sl/sl.c
@@ -164,13 +164,13 @@ static int mod_init(void)
return -1;
}
+ memset(&tmb, 0, sizeof(struct tm_binds));
if(sl_bind_tm!=0)
{
if(load_tm_api(&tmb)==-1)
{
LM_INFO("could not bind tm module - only stateless mode"
- " available\n");
- sl_bind_tm=0;
+ " available during modules initialization\n");
}
}
@@ -186,6 +186,14 @@ static int child_init(int rank)
ERR("init_sl_stats_child failed\n");
return -1;
}
+ if(sl_bind_tm!=0 && tmb.register_tmcb==0) {
+ if(load_tm_api(&tmb)==-1) {
+ LM_INFO("could not bind tm module - only stateless mode"
+ " available during runtime\n");
+ sl_bind_tm=0;
+ }
+ }
+
}
return 0;
}
@@ -267,7 +275,7 @@ int send_reply(struct sip_msg *msg, int code, str *reason)
}
}
- if(sl_bind_tm!=0)
+ if(sl_bind_tm!=0 && tmb.t_gett!=0)
{
t = tmb.t_gett();
if(t!= NULL && t!=T_UNDEFINED)
@@ -324,7 +332,7 @@ int get_reply_totag(struct sip_msg *msg, str *totag)
struct cell * t;
if(msg==NULL || totag==NULL)
return -1;
- if(sl_bind_tm!=0)
+ if(sl_bind_tm!=0 && tmb.t_gett!=0)
{
t = tmb.t_gett();
if(t!= NULL && t!=T_UNDEFINED)
More information about the sr-dev
mailing list