From 0f896928b30862a4c39253d7c82340a4aa2e7f6a Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Sun, 1 Mar 2009 23:10:17 +0000 Subject: [PATCH] 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 --- libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.c b/libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.c index 5ee468a458..169cae6146 100644 --- a/libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.c +++ b/libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.c @@ -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;