|
|
|
|
@ -71,6 +71,8 @@ static int redis_db = -1;
|
|
|
|
|
static int redis_write_db = -1;
|
|
|
|
|
static int redis_num_threads;
|
|
|
|
|
static int no_redis_required;
|
|
|
|
|
static int redis_allowed_errors = -1;
|
|
|
|
|
static int redis_disable_time = 10;
|
|
|
|
|
static char *redis_auth;
|
|
|
|
|
static char *redis_write_auth;
|
|
|
|
|
static char *b2b_url;
|
|
|
|
|
@ -278,6 +280,8 @@ static void options(int *argc, char ***argv) {
|
|
|
|
|
{ "redis-num-threads", 0, 0, G_OPTION_ARG_INT, &redis_num_threads, "Number of Redis restore threads", "INT" },
|
|
|
|
|
{ "redis-expires", 0, 0, G_OPTION_ARG_INT, &redis_expires, "Expire time in seconds for redis keys", "INT" },
|
|
|
|
|
{ "no-redis-required", 'q', 0, G_OPTION_ARG_NONE, &no_redis_required, "Start no matter of redis connection state", NULL },
|
|
|
|
|
{ "redis-allowed-errors", 0, 0, G_OPTION_ARG_INT, &redis_allowed_errors, "Number of allowed errors before redis is temporarily disabled", "INT" },
|
|
|
|
|
{ "redis-disable-time", 0, 0, G_OPTION_ARG_INT, &redis_disable_time, "Number of seconds redis communication is disabled because of errors", "INT" },
|
|
|
|
|
{ "b2b-url", 'b', 0, G_OPTION_ARG_STRING, &b2b_url, "XMLRPC URL of B2B UA" , "STRING" },
|
|
|
|
|
{ "log-facility-cdr",0, 0, G_OPTION_ARG_STRING, &log_facility_cdr_s, "Syslog facility to use for logging CDRs", "daemon|local0|...|local7"},
|
|
|
|
|
{ "log-facility-rtcp",0, 0, G_OPTION_ARG_STRING, &log_facility_rtcp_s, "Syslog facility to use for logging RTCP", "daemon|local0|...|local7"},
|
|
|
|
|
@ -576,15 +580,21 @@ no_kernel:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!is_addr_unspecified(&redis_write_ep.address)) {
|
|
|
|
|
mc.redis_write = redis_new(&redis_write_ep, redis_write_db, redis_write_auth, ANY_REDIS_ROLE, no_redis_required);
|
|
|
|
|
mc.redis_write = redis_new(&redis_write_ep, redis_write_db,
|
|
|
|
|
redis_write_auth, ANY_REDIS_ROLE, no_redis_required,
|
|
|
|
|
redis_allowed_errors, redis_disable_time);
|
|
|
|
|
if (!mc.redis_write)
|
|
|
|
|
die("Cannot start up without running Redis %s write database! See also NO_REDIS_REQUIRED parameter.",
|
|
|
|
|
endpoint_print_buf(&redis_write_ep));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!is_addr_unspecified(&redis_ep.address)) {
|
|
|
|
|
mc.redis = redis_new(&redis_ep, redis_db, redis_auth, mc.redis_write ? ANY_REDIS_ROLE : MASTER_REDIS_ROLE, no_redis_required);
|
|
|
|
|
mc.redis_notify = redis_new(&redis_ep, redis_db, redis_auth, mc.redis_write ? ANY_REDIS_ROLE : MASTER_REDIS_ROLE, no_redis_required);
|
|
|
|
|
mc.redis = redis_new(&redis_ep, redis_db, redis_auth,
|
|
|
|
|
mc.redis_write ? ANY_REDIS_ROLE : MASTER_REDIS_ROLE,
|
|
|
|
|
no_redis_required, redis_allowed_errors, redis_disable_time);
|
|
|
|
|
mc.redis_notify = redis_new(&redis_ep, redis_db, redis_auth,
|
|
|
|
|
mc.redis_write ? ANY_REDIS_ROLE : MASTER_REDIS_ROLE,
|
|
|
|
|
no_redis_required, redis_allowed_errors, redis_disable_time);
|
|
|
|
|
if (!mc.redis || !mc.redis_notify)
|
|
|
|
|
die("Cannot start up without running Redis %s database! See also NO_REDIS_REQUIRED parameter.",
|
|
|
|
|
endpoint_print_buf(&redis_ep));
|
|
|
|
|
|