Module: kamailio
Branch: master
Commit: 85d3488c3910d447f6900df166bc6b0c16a64e9c
URL:
https://github.com/kamailio/kamailio/commit/85d3488c3910d447f6900df166bc6b0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-01-30T10:30:16+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
---
Modified: modules/sl/sl.c
---
Diff:
https://github.com/kamailio/kamailio/commit/85d3488c3910d447f6900df166bc6b0…
Patch:
https://github.com/kamailio/kamailio/commit/85d3488c3910d447f6900df166bc6b0…
---
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)