Module: sip-router Branch: pd/outbound Commit: 7c79ef5875787a1c05d263a83c803299489308fd URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7c79ef58...
Author: Peter Dunkley peter.dunkley@crocodile-rcs.com Committer: Peter Dunkley peter.dunkley@crocodile-rcs.com Date: Sun Dec 30 17:20:52 2012 +0000
modules_k/rr: bind rr to outbound module
---
modules_k/rr/rr_mod.c | 24 +++++++++++++++++++++++- modules_k/rr/rr_mod.h | 4 +++- 2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/modules_k/rr/rr_mod.c b/modules_k/rr/rr_mod.c index cf0ca09..764e541 100644 --- a/modules_k/rr/rr_mod.c +++ b/modules_k/rr/rr_mod.c @@ -40,6 +40,7 @@ #include "../../mem/mem.h" #include "../../mod_fix.h" #include "../../parser/parse_rr.h" +#include "../outbound/api.h" #include "loose.h" #include "record.h" #include "rr_cb.h" @@ -56,9 +57,10 @@ int append_fromtag = 1; /*!< append from tag by default */ int enable_double_rr = 1; /*!< enable using of 2 RR by default */ int enable_full_lr = 0; /*!< compatibilty mode disabled by default */ int add_username = 0; /*!< do not add username by default */ - int enable_socket_mismatch_warning = 1; /*!< enable socket mismatch warning */ +int enable_socket_mismatch_warning = 1; /*!< enable socket mismatch warning */
static unsigned int last_rr_msg; +ob_api_t rr_obb;
MODULE_VERSION
@@ -147,9 +149,22 @@ struct module_exports exports = {
static int mod_init(void) { + if (ob_load_api(&rr_obb) == 0) + LM_INFO("Bound rr module to outbound module\n"); + else + { + LM_INFO("oubound module not available\n"); + memset(&rr_obb, 0, sizeof(ob_api_t)); + } + #ifdef ENABLE_USER_CHECK if(ignore_user) { + if (rr_obb.use_outbound) + { + LM_ERR("cannot use "ignore_user" with outbound\n"); + return -1; + } i_user.s = ignore_user; i_user.len = strlen(ignore_user); } @@ -159,6 +174,13 @@ static int mod_init(void) i_user.len = 0; } #endif + + if (add_username != 0 && rr_obb.use_outbound) + { + LM_ERR("cannot use "add_username" with outbound\n"); + return -1; + } + return 0; }
diff --git a/modules_k/rr/rr_mod.h b/modules_k/rr/rr_mod.h index 7dc0a65..6b07ccb 100644 --- a/modules_k/rr/rr_mod.h +++ b/modules_k/rr/rr_mod.h @@ -29,6 +29,8 @@ #ifndef RR_MOD_H #define RR_MOD_H
+#include "../outbound/api.h" + #ifdef ENABLE_USER_CHECK #include "../../str.h" extern str i_user; @@ -43,6 +45,6 @@ extern int enable_full_lr; /*! add username to record-route URI */ extern int add_username; extern int enable_socket_mismatch_warning; - +extern ob_api_t rr_obb;
#endif /* RR_MOD_H */