From 6e4940b41a5da4eb55ed41718e8c75a9d95ac046 Mon Sep 17 00:00:00 2001 From: MelwareDE Date: Sun, 7 Aug 2005 11:40:07 +0000 Subject: [PATCH] U-Law setting is now done in capi.conf instead of Makefile define. --- Makefile | 3 --- capi.conf | 55 ++++++++++++++++++++++------------------------------- chan_capi.c | 23 ++++++---------------- 3 files changed, 29 insertions(+), 52 deletions(-) diff --git a/Makefile b/Makefile index ac172e9..1e7bdec 100644 --- a/Makefile +++ b/Makefile @@ -36,9 +36,6 @@ CFLAGS+=-O6 CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi) CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi) -# uncomment the next line if you are in the ulaw world -#CFLAGS+=-DCAPI_ULAW - CFLAGS+=-DASTERISKVERSION=\"$(ASTERISKVERSION)\" LIBS=-ldl -lpthread -lm diff --git a/capi.conf b/capi.conf index 9b2372b..e30eb2a 100644 --- a/capi.conf +++ b/capi.conf @@ -4,49 +4,40 @@ ; ; general section + [general] nationalprefix=0 internationalprefix=00 rxgain=0.8 txgain=0.8 +;ulaw=yes ;set this, if you live in u-law world instead of a-law -; interface sections +; interface sections ... -; this example interface has name ISDN1 -[ISDN1] +[ISDN1] ;this example interface gets name 'ISDN1' and may be any + ;name not starting with 'g' or 'contr'. +isdnmode=ptmp ;ptmp (point-to-multipoint) or ptp (point-to-point) + ;when using NT-mode, ptp should be set in any case +incomingmsn=* ;allow incoming calls to this list of MSNs, * == any +controller=1 ;capi controller number to use +group=1 ;dialout group +;prefix=0 ;set a prefix to calling number on incoming calls +softdtmf=1 ;enable/disable software dtmf detection, recommended for AVM cards +accountcode= ;Asterisk accountcode to use in CDRs +context=capi-in ;context for incoming calls +;echosquelch=1 ;_VERY_PRIMITIVE_ echo suppression +;echocancel=yes ;EICON DIVA SERVER (CAPI) echo cancelation +;echotail=64 ;echo cancel tail setting +;callgroup=1 ;Asterisk call group +;deflect=1234567 ;deflect incoming calls to 1234567 if all B channels are busy +devices=2 ;number of concurrent calls on this controller + ;(2 makes sense for single BRI, 30 for PRI) -; mode: ptmp (point-to-multipoint) or ptp (point-to-point) -isdnmode=ptmp -; allow incoming calls to this list of MSNs, * == any -incomingmsn=* -; capi controller number -controller=1 -; dialout group -group=1 -; set a prefix to calling number on incoming calls -; prefix=0 -; enable/disable software dtmf detection, recommended for AVM cards -softdtmf=1 -; accountcode to use in CDRs -accountcode= -; context for incoming calls -context=capi-in -; _VERY_PRIMITIVE_ echo suppression -;echosquelch=1 -; EICON DIVA SERVER echo cancelation -;echocancel=yes -;echotail=64 -; call group -;callgroup=1 -; deflect incoming calls to 12345678 if all B channels are busy -;deflect=12345678 -; number of concurrent calls on this controller (2 makes sense for single BRI) -devices => 2 ;[myName] -;PointToPoint (55512-0) +;;PointToPoint (55512-0) ;isdnmode=ptp ;incomingmsn=* ;controller=2 -;devices => 30 +;devices=30 diff --git a/chan_capi.c b/chan_capi.c index 1ebefa0..0f0b7f3 100644 --- a/chan_capi.c +++ b/chan_capi.c @@ -55,12 +55,6 @@ /* #define CC_VERSION "cm-x.y.z" */ #define CC_VERSION "$Revision$" -#ifdef CAPI_ULAW -#define LAW_STRING "uLaw" -#else -#define LAW_STRING "aLaw" -#endif - /* * personal stuff */ @@ -69,11 +63,11 @@ unsigned ast_capi_ApplID = 0; static _cword ast_capi_MessageNumber = 1; static char *desc = "Common ISDN API for Asterisk"; #ifdef CC_AST_HAVE_TECH_PVT -static const char tdesc[] = "Common ISDN API Driver (" CC_VERSION ") " LAW_STRING " " ASTERISKVERSION; +static const char tdesc[] = "Common ISDN API Driver (" CC_VERSION ") " ASTERISKVERSION; static const char type[] = "CAPI"; static const struct ast_channel_tech capi_tech; #else -static char *tdesc = "Common ISDN API Driver (" CC_VERSION ") " LAW_STRING " "ASTERISKVERSION; +static char *tdesc = "Common ISDN API Driver (" CC_VERSION ") " ASTERISKVERSION; static char *type = "CAPI"; #endif @@ -93,11 +87,7 @@ AST_MUTEX_DEFINE_STATIC(contrlock); AST_MUTEX_DEFINE_STATIC(capi_put_lock); AST_MUTEX_DEFINE_EXPORTED(verbose_lock); -#ifdef CAPI_ULAW -static int capi_capability = AST_FORMAT_ULAW; -#else static int capi_capability = AST_FORMAT_ALAW; -#endif static pthread_t monitor_thread = -1; @@ -1307,7 +1297,6 @@ static struct ast_channel *capi_new(struct ast_capi_pvt *i, int state) tmp->callgroup = i->callgroup; tmp->nativeformats = capi_capability; fmt = ast_best_codec(tmp->nativeformats); - /* fmt = capi_capability; */ tmp->readformat = fmt; tmp->writeformat = fmt; @@ -3215,11 +3204,7 @@ static struct ast_cli_entry cli_no_debug = static const struct ast_channel_tech capi_tech = { .type = type, .description = tdesc, -#ifdef CAPI_ULAW - .capabilities = AST_FORMAT_ULAW, -#else .capabilities = AST_FORMAT_ALAW, -#endif .requester = capi_request, .send_digit = capi_send_digit, .send_text = NULL, @@ -3477,6 +3462,10 @@ static int capi_eval_config(struct ast_config *cfg) if (sscanf(v->value,"%f",&txgain) != 1) { ast_log(LOG_ERROR,"invalid txgain\n"); } + } else if (!strcasecmp(v->name, "ulaw")) { + if (!strcasecmp(v->value, "yes") || !strcasecmp(v->value, "1") || !strcasecmp(v->value, "on")) { + capi_capability = AST_FORMAT_ULAW; + } } }