fix group configuration bug

git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@955 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Moises Silva 2010-01-12 18:09:55 +00:00
parent 3ee4713670
commit d6d344974d
3 changed files with 4 additions and 12 deletions

View File

@ -1103,7 +1103,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
if (zstatus == ZAP_SUCCESS && group) { if (zstatus == ZAP_SUCCESS && group) {
group_id = group->group_id; group_id = group->group_id;
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing span\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing zap span or group: %s\n", span_name);
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
} }
} }

View File

@ -2827,9 +2827,7 @@ static zap_status_t load_config(void)
} }
} else if (!strcasecmp(var, "b-channel")) { } else if (!strcasecmp(var, "b-channel")) {
configured += zio->configure_span(span, val, ZAP_CHAN_TYPE_B, name, number); configured += zio->configure_span(span, val, ZAP_CHAN_TYPE_B, name, number);
if (zap_group_add_channels(group_name, span, val) != ZAP_SUCCESS) { zap_group_add_channels(group_name, span, val);
zap_log(ZAP_LOG_ERROR, "Failed to add channels (%d:%s) to group\n", number, val);
}
} else if (!strcasecmp(var, "d-channel")) { } else if (!strcasecmp(var, "d-channel")) {
if (d) { if (d) {
zap_log(ZAP_LOG_WARNING, "ignoring extra d-channel\n"); zap_log(ZAP_LOG_WARNING, "ignoring extra d-channel\n");
@ -2855,7 +2853,7 @@ static zap_status_t load_config(void)
len = sizeof(group_name) - 1; len = sizeof(group_name) - 1;
zap_log(ZAP_LOG_WARNING, "Truncating group name %s to %zd length\n", val, len); zap_log(ZAP_LOG_WARNING, "Truncating group name %s to %zd length\n", val, len);
} }
zap_copy_string(group_name, val, len); memcpy(group_name, val, len);
group_name[len] = '\0'; group_name[len] = '\0';
} else { } else {
zap_log(ZAP_LOG_ERROR, "unknown span variable '%s'\n", var); zap_log(ZAP_LOG_ERROR, "unknown span variable '%s'\n", var);

View File

@ -300,20 +300,14 @@ OZ_DECLARE(zap_status_t) zap_condition_wait(zap_condition_t *condition, int ms)
int res = 0; int res = 0;
if (ms > 0) { if (ms > 0) {
struct timeval t; struct timeval t;
struct timespec waitms; struct timespec waitms;
gettimeofday(&t, NULL); gettimeofday(&t, NULL);
waitms.tv_sec = t.tv_sec + ( ms / 1000 ); waitms.tv_sec = t.tv_sec + ( ms / 1000 );
waitms.tv_nsec = 1000*(t.tv_usec + (1000 * ( ms % 1000 ))); waitms.tv_nsec = 1000*(t.tv_usec + (1000 * ( ms % 1000 )));
if (waitms.tv_nsec >= ONE_BILLION) { if (waitms.tv_nsec >= ONE_BILLION) {
waitms.tv_sec++; waitms.tv_sec++;
waitms.tv_nsec -= ONE_BILLION; waitms.tv_nsec -= ONE_BILLION;
} }
res = pthread_cond_timedwait(&condition->condition, &condition->mutex->mutex, &waitms); res = pthread_cond_timedwait(&condition->condition, &condition->mutex->mutex, &waitms);
} else { } else {
res = pthread_cond_wait(&condition->condition, &condition->mutex->mutex); res = pthread_cond_wait(&condition->condition, &condition->mutex->mutex);