for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (mdl_profile_t *) val;
- if (!strcmp(profile->extip, old_ip4)) {
+ if (old_ip4 && !strcmp(profile->extip, old_ip4)) {
tmp = profile->extip;
profile->extip = strdup(new_ip4);
switch_safe_free(tmp);
profile->name = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "message") && !switch_strlen_zero(val)) {
profile->message = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "local-network-acl")) {
+ } else if (!strcasecmp(var, "local-network-acl") && !switch_strlen_zero(val)) {
profile->local_network = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "rtp-ip")) {
profile->ip = switch_core_strdup(module_pool, strcasecmp(switch_str_nil(val), "auto") ? switch_str_nil(val) : globals.guess_ip);
} else if (!strcasecmp(var, "ext-rtp-ip")) {
char *ip = globals.guess_ip;
- if (!strcasecmp(val, "auto-nat")) {
+ if (val && !strcasecmp(val, "auto-nat")) {
ip = globals.auto_nat ? switch_core_get_variable("nat_public_addr") : globals.guess_ip;
- } else if (!strcasecmp(val, "auto")) {
+ } else if (val && !strcasecmp(val, "auto")) {
globals.auto_nat = 0;
ip = globals.guess_ip;
} else {
struct peer_status {
switch_bool_t active;
- int lastseen;
+ time_t lastseen;
};
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_address, globals.address);
if (event->subclass_name && (!strcmp(event->subclass_name, MULTICAST_EVENT) ||
!strcmp(event->subclass_name, MULTICAST_PEERUP) ||
!strcmp(event->subclass_name, MULTICAST_PEERDOWN))) {
- char * event_name;
- if ((event_name = switch_event_get_header(event, "orig-event-name")) && !strcasecmp(event_name, "HEARTBEAT")) {
- char *sender = switch_event_get_header(event, "orig-multicast-sender");
+ char * event_name, *sender;
+ if ((event_name = switch_event_get_header(event, "orig-event-name")) &&
+ !strcasecmp(event_name, "HEARTBEAT") &&
+ (sender = switch_event_get_header(event, "orig-multicast-sender"))) {
struct peer_status *p;
- int now = switch_epoch_time_now(NULL);
+ time_t now = switch_epoch_time_now(NULL);
if (!(p = switch_core_hash_find(globals.peer_hash, sender))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Host %s not already in hash\n", sender);
char lastseen[21];
switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Peer", sender);
if (p->lastseen) {
- switch_snprintf(lastseen, sizeof(lastseen), "%d", p->lastseen);
+ switch_snprintf(lastseen, sizeof(lastseen), "%d", (int)p->lastseen);
} else {
switch_snprintf(lastseen, sizeof(lastseen), "%s", "Never");
}
switch_ssize_t keylen;
const void *key;
void *value;
- int now = switch_epoch_time_now(NULL);
+ time_t now = switch_epoch_time_now(NULL);
struct peer_status *last;
char *host;
if (switch_event_create_subclass(&local_event, SWITCH_EVENT_CUSTOM, MULTICAST_PEERDOWN) == SWITCH_STATUS_SUCCESS) {
char lastseen[21];
switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Peer", host);
- switch_snprintf(lastseen, sizeof(lastseen), "%d", last->lastseen);
+ switch_snprintf(lastseen, sizeof(lastseen), "%d", (int)last->lastseen);
switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Lastseen", lastseen);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Peer %s has gone down; last seen: %s\n", host, lastseen);
switch_ssize_t keylen;
const void *key;
void *value;
- int now = switch_epoch_time_now(NULL);
+ time_t now = switch_epoch_time_now(NULL);
struct peer_status *last;
char *host;
int i = 0;