Added 'faxdetecttime' config setting.

This commit is contained in:
MelwareDE 2008-06-29 11:33:46 +00:00
parent b845700c4e
commit b45e940762
5 changed files with 22 additions and 1 deletions

View File

@ -3,6 +3,7 @@ CHANGES
HEAD
------------------
- added config setting 'faxdetecttime' to limit the fax detection for a given amount of seconds.
chan_capi-1.1.1

4
README
View File

@ -362,8 +362,10 @@ The parameter <filename> is mandatory and the parameters <stationid>,
By default, if fax reception was not successful, the file is deleted. If you want even
partly received or broken fax files, use 'k' for "keep bad fax" in the <options>:
capicommand(receivefax|/tmp/${UNIQUEID}|+123456789||k)
To enable fax tone detection and redirect to extension 'fax', use config variable
'faxdetect' in capi.conf.
'faxdetect' in capi.conf. This can be limited to the first 'n' seconds of a connection
using the setting 'faxdetecttime' in capi.conf.
Example of use :
line number 123, play something, if a fax tone is detected, handle it

View File

@ -38,6 +38,8 @@ softdtmf=on ;enable/disable software dtmf detection, recommended for AVM ca
relaxdtmf=on ;in addition to softdtmf, you can use relaxed dtmf detection
faxdetect=off ;enable faxdetection and redirection to EXTEN 'fax' for incoming and/or
;outgoing calls. (default='off', possible values: 'incoming','outgoing','both')
faxdetecttime=0 ;Only detect faxes during the first 'n' seconds of the call.
;(default '0' meaning for the whole duration of the call)
accountcode= ;PBX accountcode to use in CDRs
;amaflags=default;AMA flags for CDR ('default', 'omit', 'billing', or 'documentation')
context=isdn-in ;context for incoming calls

View File

@ -2419,6 +2419,17 @@ static void capi_handle_dtmf_fax(struct capi_pvt *i)
i->vname);
return;
}
if ((i->faxdetecttime > 0) && (c->cdr)) {
struct timeval now;
gettimeofday(&now, NULL);
if ((c->cdr->start.tv_sec + i->faxdetecttime) < now.tv_sec) {
cc_verbose(3, 0, VERBOSE_PREFIX_3
"%s: Fax detected after %ld seconds, limit %u - ignored\n",
i->vname, (long) (now.tv_sec - c->cdr->start.tv_sec),
i->faxdetecttime);
return;
}
}
if (!strcmp(c->exten, "fax")) {
cc_log(LOG_DEBUG, "Already in a fax extension, not redirecting\n");
@ -5261,6 +5272,7 @@ int mkif(struct cc_capi_conf *conf)
tmp->ecSelector = conf->ecSelector;
tmp->bridge = conf->bridge;
tmp->FaxState = conf->faxsetting;
tmp->faxdetecttime = conf->faxdetecttime;
tmp->smoother = ast_smoother_new(CAPI_MAX_B3_BLOCK_SIZE);
@ -6133,6 +6145,7 @@ static int conf_interface(struct cc_capi_conf *conf, struct ast_variable *v)
else
conf->faxsetting &= ~(CAPI_FAX_DETECT_OUTGOING | CAPI_FAX_DETECT_INCOMING);
} else
CONF_INTEGER(conf->faxdetecttime, "faxdetecttime")
if (!strcasecmp(v->name, "echocancel")) {
if (ast_true(v->value)) {
conf->echocancel = 1;

View File

@ -404,6 +404,8 @@ struct capi_pvt {
FILE *fFax;
/* Fax status */
unsigned int FaxState;
/* Window for fax detection */
unsigned int faxdetecttime;
/* handle for CCBS/CCNR callback */
unsigned int ccbsnrhandle;
@ -500,6 +502,7 @@ struct cc_capi_conf {
int qsigfeat;
struct cc_capi_qsig_conf qsigconf;
unsigned int faxsetting;
unsigned int faxdetecttime;
ast_group_t callgroup;
ast_group_t pickupgroup;
ast_group_t group;