Support more node type values and spam the console if an invalid one is used

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@675 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Mathieu Rene 2009-03-01 23:10:17 +00:00
parent d7bb5450ae
commit c7c8742e15

View File

@ -733,11 +733,11 @@ static zap_status_t zap_libpri_start(zap_span_t *span)
static int str2node(char *node)
{
if (!strcasecmp(node, "cpe"))
if (!strcasecmp(node, "cpe") || !strcasecmp(node, "user"))
return PRI_CPE;
if (!strcasecmp(node, "network"))
if (!strcasecmp(node, "network") || !strcasecmp(node, "net"))
return PRI_NETWORK;
return PRI_CPE;
return -1;
}
static int str2switch(char *swtype)
@ -826,10 +826,16 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_libpri_configure_span)
while((var = va_arg(ap, char *))) {
if (!strcasecmp(var, "node")) {
int node;
if (!(val = va_arg(ap, char *))) {
break;
}
isdn_data->node = str2node(val);
node = str2node(val);
if (-1 == node) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unknown node type %s, defaulting to CPE mode\n", val);
node = PRI_CPE;
}
isdn_data->node = node;
} else if (!strcasecmp(var, "switch")) {
if (!(val = va_arg(ap, char *))) {
break;