- fixed unhold deadloop

- added language support
- prepared devicestate(hint) support
This commit is contained in:
MelwareDE 2005-12-28 14:24:42 +00:00
parent 04919b3a26
commit f5dcac0958
4 changed files with 48 additions and 3 deletions

View File

@ -10,6 +10,7 @@ nationalprefix=0
internationalprefix=00 internationalprefix=00
rxgain=0.8 rxgain=0.8
txgain=0.8 txgain=0.8
language=de ;set default language
;ulaw=yes ;set this, if you live in u-law world instead of a-law ;ulaw=yes ;set this, if you live in u-law world instead of a-law
; interface sections ... ; interface sections ...
@ -46,6 +47,7 @@ echocancelold=yes;use facility selector 6 instead of correct 8 (necessary for ol
;echotail=64 ;echo cancel tail setting ;echotail=64 ;echo cancel tail setting
;bridge=yes ;native bridging (CAPI line interconnect) if available ;bridge=yes ;native bridging (CAPI line interconnect) if available
;callgroup=1 ;Asterisk call group ;callgroup=1 ;Asterisk call group
;language=de ;set language for this device (overwrites default language)
devices=2 ;number of concurrent calls on this controller devices=2 ;number of concurrent calls on this controller
;(2 makes sense for single BRI, 30 for PRI) ;(2 makes sense for single BRI, 30 for PRI)

View File

@ -33,6 +33,9 @@
#include <asterisk/utils.h> #include <asterisk/utils.h>
#include <asterisk/cli.h> #include <asterisk/cli.h>
#include <asterisk/causes.h> #include <asterisk/causes.h>
#ifndef CC_AST_NO_DEVICESTATE
#include <asterisk/devicestate.h>
#endif
#include <sys/time.h> #include <sys/time.h>
#include <sys/signal.h> #include <sys/signal.h>
#include <stdlib.h> #include <stdlib.h>
@ -98,6 +101,8 @@ static struct ast_channel *chan_to_softhangup = NULL;
static char capi_national_prefix[AST_MAX_EXTENSION]; static char capi_national_prefix[AST_MAX_EXTENSION];
static char capi_international_prefix[AST_MAX_EXTENSION]; static char capi_international_prefix[AST_MAX_EXTENSION];
static char default_language[MAX_LANGUAGE] = "";
static int capidebug = 0; static int capidebug = 0;
/* local prototypes */ /* local prototypes */
@ -1557,6 +1562,7 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
strncpy(tmp->exten, i->dnid, sizeof(tmp->exten) - 1); strncpy(tmp->exten, i->dnid, sizeof(tmp->exten) - 1);
strncpy(tmp->accountcode, i->accountcode, sizeof(tmp->accountcode) - 1); strncpy(tmp->accountcode, i->accountcode, sizeof(tmp->accountcode) - 1);
strncpy(tmp->language, i->language, sizeof(tmp->language) - 1);
i->owner = tmp; i->owner = tmp;
cc_mutex_lock(&usecnt_lock); cc_mutex_lock(&usecnt_lock);
usecnt++; usecnt++;
@ -3561,9 +3567,10 @@ static int capi_retrieve(struct ast_channel *c, char *param)
if ((i->state != CAPI_STATE_ONHOLD) && if ((i->state != CAPI_STATE_ONHOLD) &&
(i->isdnstate & CAPI_ISDN_STATE_HOLD)) { (i->isdnstate & CAPI_ISDN_STATE_HOLD)) {
int waitcount = 200; int waitcount = 20;
while ((waitcount > 0) && (i->state != CAPI_STATE_ONHOLD)) { while ((waitcount > 0) && (i->state != CAPI_STATE_ONHOLD)) {
usleep(10000); usleep(10000);
waitcount--;
} }
} }
@ -3738,7 +3745,7 @@ static int capi_hold(struct ast_channel *c, char *param)
cc_verbose(2, 1, VERBOSE_PREFIX_4 "%s: sent HOLD for PLCI=%#x\n", cc_verbose(2, 1, VERBOSE_PREFIX_4 "%s: sent HOLD for PLCI=%#x\n",
i->name, i->PLCI); i->name, i->PLCI);
i->onholdPLCI= i->PLCI; i->onholdPLCI = i->PLCI;
i->isdnstate |= CAPI_ISDN_STATE_HOLD; i->isdnstate |= CAPI_ISDN_STATE_HOLD;
snprintf(buffer, sizeof(buffer) - 1, "%d", i->PLCI); snprintf(buffer, sizeof(buffer) - 1, "%d", i->PLCI);
@ -4046,6 +4053,26 @@ static int capi_indicate(struct ast_channel *c, int condition)
return(ret); return(ret);
} }
#ifndef CC_AST_NO_DEVICESTATE
/*
* PBX wants to know the state for a specific device
*/
static int capi_devicestate(void *data)
{
int res = AST_DEVICE_UNKNOWN;
if (!data) {
cc_verbose(3, 1, VERBOSE_PREFIX_2 "No data for capi_devicestate\n");
return res;
}
cc_verbose(3, 1, VERBOSE_PREFIX_4 "CAPI devicestate requested for %s\n",
(char *)data);
return res;
}
#endif
/* /*
* module stuff, monitor... * module stuff, monitor...
*/ */
@ -4423,6 +4450,9 @@ static const struct ast_channel_tech capi_tech = {
.indicate = capi_indicate, .indicate = capi_indicate,
.fixup = capi_fixup, .fixup = capi_fixup,
.setoption = NULL, .setoption = NULL,
#ifndef CC_AST_NO_DEVICESTATE
.devicestate = capi_devicestate,
#endif
}; };
#endif #endif
@ -4595,6 +4625,7 @@ static int conf_interface(struct cc_capi_conf *conf, struct ast_variable *v)
CONF_STRING(conf->controllerstr, "controller"); CONF_STRING(conf->controllerstr, "controller");
CONF_STRING(conf->prefix, "prefix"); CONF_STRING(conf->prefix, "prefix");
CONF_STRING(conf->accountcode, "accountcode"); CONF_STRING(conf->accountcode, "accountcode");
CONF_STRING(conf->language, "language");
if (!strcasecmp(v->name, "softdtmf")) { if (!strcasecmp(v->name, "softdtmf")) {
if ((!conf->softdtmf) && (ast_true(v->value))) { if ((!conf->softdtmf) && (ast_true(v->value))) {
@ -4716,6 +4747,8 @@ static int capi_eval_config(struct ast_config *cfg)
strncpy(capi_national_prefix, v->value, sizeof(capi_national_prefix) - 1); strncpy(capi_national_prefix, v->value, sizeof(capi_national_prefix) - 1);
} else if (!strcasecmp(v->name, "internationalprefix")) { } else if (!strcasecmp(v->name, "internationalprefix")) {
strncpy(capi_international_prefix, v->value, sizeof(capi_international_prefix) - 1); strncpy(capi_international_prefix, v->value, sizeof(capi_international_prefix) - 1);
} else if (!strcasecmp(v->name, "language")) {
strncpy(default_language, v->value, sizeof(default_language) - 1);
} else if (!strcasecmp(v->name, "rxgain")) { } else if (!strcasecmp(v->name, "rxgain")) {
if (sscanf(v->value,"%f",&rxgain) != 1) { if (sscanf(v->value,"%f",&rxgain) != 1) {
cc_log(LOG_ERROR,"invalid rxgain\n"); cc_log(LOG_ERROR,"invalid rxgain\n");
@ -4751,6 +4784,7 @@ static int capi_eval_config(struct ast_config *cfg)
conf.ectail = EC_DEFAULT_TAIL; conf.ectail = EC_DEFAULT_TAIL;
conf.ecSelector = FACILITYSELECTOR_ECHO_CANCEL; conf.ecSelector = FACILITYSELECTOR_ECHO_CANCEL;
strncpy(conf.name, cat, sizeof(conf.name) - 1); strncpy(conf.name, cat, sizeof(conf.name) - 1);
strncpy(conf.language, default_language, sizeof(conf.language) - 1);
if (conf_interface(&conf, ast_variable_browse(cfg, cat))) { if (conf_interface(&conf, ast_variable_browse(cfg, cat))) {
cc_log(LOG_ERROR, "Error interface config.\n"); cc_log(LOG_ERROR, "Error interface config.\n");

View File

@ -258,7 +258,7 @@ struct capi_pvt {
unsigned int callgroup; unsigned int callgroup;
unsigned int group; unsigned int group;
/*! default language */ /* language */
char language[MAX_LANGUAGE]; char language[MAX_LANGUAGE];
/* additional numbers to dial */ /* additional numbers to dial */
@ -347,6 +347,7 @@ struct cc_capi_profile {
struct cc_capi_conf { struct cc_capi_conf {
char name[CAPI_MAX_STRING]; char name[CAPI_MAX_STRING];
char language[MAX_LANGUAGE];
char incomingmsn[CAPI_MAX_STRING]; char incomingmsn[CAPI_MAX_STRING];
char defaultcid[CAPI_MAX_STRING]; char defaultcid[CAPI_MAX_STRING];
char context[AST_MAX_EXTENSION]; char context[AST_MAX_EXTENSION];

View File

@ -122,6 +122,14 @@ else
echo " * no 'struct ast_custom_function'" echo " * no 'struct ast_custom_function'"
fi fi
if [ -f "$INCLUDEDIR/devicestate.h" ]; then
echo "#undef CC_AST_NO_DEVICESTATE" >>$CONFIGFILE
echo " * found 'devicestate.h'"
else
echo "#define CC_AST_NO_DEVICESTATE" >>$CONFIGFILE
echo " * no 'devicestate.h'"
fi
echo "" >>$CONFIGFILE echo "" >>$CONFIGFILE
echo "#endif /* CHAN_CAPI_CONFIG_H */" >>$CONFIGFILE echo "#endif /* CHAN_CAPI_CONFIG_H */" >>$CONFIGFILE
echo "" >>$CONFIGFILE echo "" >>$CONFIGFILE