Added option 'k' (keep bad fax) to capicommand(receivefax) to

not delete the fax file if reception was not successful.
This commit is contained in:
MelwareDE 2007-04-05 19:33:01 +00:00
parent cbd0547249
commit 26f621aa78
3 changed files with 46 additions and 11 deletions

View File

@ -8,6 +8,7 @@ HEAD
- register at CAPI with needed maxLogicalConnections only
- don't send SELECT_B_PROTOCOL more than once
- don't send more DATA_B3 messages than allowed by CAPI_MAX_B3_BLOCKS
- added 'k' option to capi receivefax command for not deleting bad faxes
QSIG:
- added support for different qsig variants
- added support for rerouting informations on incoming calls

14
README
View File

@ -71,6 +71,7 @@ This chan_capi version includes:
- Eicon DIVA Server VoIP/RTP
- CLI command "capi show channels" shows details on channel status.
- Asterisk 1.4 jitterbuffer configuration.
- some QSIG extensions (see README.qsig)
Permissions
===========
@ -127,7 +128,7 @@ Call Deflection:
Fax receive:
Receive a fax using CAPI.
Example:
exten => s,1,capicommand(receivefax|/tmp/${UNIQUEID}|+49 6137 555123|Asterisk)
exten => s,1,capicommand(receivefax|/tmp/${UNIQUEID}|+49 6137 555123|Asterisk|<options>)
(more see below)
Fax send:
@ -271,14 +272,17 @@ Short HOWTO of capicommand(receivefax...) and capicommand(sendfax...):
For those of you who have a CAPI card with an on-board DSP (like some Eicon and
DIVA Server), this allows you to receive/send faxes.
capicommand(receivefax|<filename>[|<stationid>|<headline>]):
capicommand(receivefax|<filename>[|<stationid>|<headline>|<options>]):
------------------------------------------------------------
If you want to answer a channel in fax mode, use capicommand(receivefax|...)
instead of Answer()
If you use Answer(), you will be in voice mode. If the hardware DSP detects
fax tone, you can switch from voice to fax mode by calling capicommand(receivefax|...).
The parameter <filename> is mandatory and the parameters <stationid> and
<headline> are optional.
The parameter <filename> is mandatory and the parameters <stationid>,
<headline> and <options> are optional.
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.
@ -293,7 +297,7 @@ exten => 124,1,Goto(handle_fax,s,1)
exten => fax,1,Goto(handle_fax,s,1)
[handle_fax]
exten => s,1,capicommand(receivefax|/tmp/${UNIQUEID}[|<stationid>|<headline>])
exten => s,1,capicommand(receivefax|/tmp/${UNIQUEID}[|<stationid>|<headline>|<options>])
exten => s,2,Hangup()
exten => h,1,deadagi,fax.php // Run sfftobmp and mail it.

View File

@ -631,7 +631,7 @@ static unsigned ListenOnController(unsigned long CIPmask, unsigned controller)
error = LISTEN_CONF_INFO(&CMSG);
break;
}
usleep(20000);
usleep(100000);
waitcount--;
}
if (!waitcount)
@ -2400,7 +2400,8 @@ static int pbx_capi_receive_fax(struct ast_channel *c, char *data)
{
struct capi_pvt *i = CC_CHANNEL_PVT(c);
int res = 0;
char *filename, *stationid, *headline;
int keepbadfax = 0;
char *filename, *stationid, *headline, *options;
B3_PROTO_FAXG3 b3conf;
char buffer[CAPI_MAX_STRING];
@ -2411,12 +2412,34 @@ static int pbx_capi_receive_fax(struct ast_channel *c, char *data)
filename = strsep(&data, "|");
stationid = strsep(&data, "|");
headline = data;
headline = strsep(&data, "|");
options = data;
if (!stationid)
stationid = emptyid;
if (!headline)
headline = emptyid;
if (!options)
options = emptyid;
cc_verbose(3, 1, VERBOSE_PREFIX_3 "capi receivefax: '%s' '%s' '%s' '%s'\n",
filename, stationid, headline, options);
/* parse the options */
while ((options) && (*options)) {
switch (*options) {
case 'k': /* keepbadfax */
cc_verbose(3, 1,
VERBOSE_PREFIX_3 "capi receivefax: if fax is bad, "
"file won't be deleted.\n");
keepbadfax = 1;
break;
default:
cc_log(LOG_WARNING, "Unknown option '%c' for receivefax.\n",
*options);
}
options++;
}
capi_wait_for_answered(i);
@ -2476,7 +2499,11 @@ static int pbx_capi_receive_fax(struct ast_channel *c, char *data)
cc_verbose(2, 0,
VERBOSE_PREFIX_1 "capi receivefax: fax receive failed reason=0x%04x reasonB3=0x%04x\n",
i->reason, i->reasonb3);
unlink(filename);
if (!keepbadfax) {
cc_verbose(3, 1,
VERBOSE_PREFIX_3 "capi receivefax: removing fax file.\n");
unlink(filename);
}
} else {
cc_verbose(2, 0,
VERBOSE_PREFIX_1 "capi receivefax: fax receive successful.\n");
@ -2512,6 +2539,9 @@ static int pbx_capi_send_fax(struct ast_channel *c, char *data)
if (!headline)
headline = emptyid;
cc_verbose(3, 1, VERBOSE_PREFIX_3 "capi sendfax: '%s' '%s' '%s'\n",
filename, stationid, headline);
capi_wait_for_answered(i);
if ((i->fFax = fopen(filename, "rb")) == NULL) {
@ -4857,8 +4887,8 @@ static struct capicommands_s {
{ "holdtype", pbx_capi_holdtype, 1 },
{ "retrieve", pbx_capi_retrieve, 0 },
{ "ect", pbx_capi_ect, 1 },
{ "3pty_begin", pbx_capi_3pty_begin, 1 },
{ "qsig_ct", pbx_capi_qsig_ct, 1 },
{ "3pty_begin", pbx_capi_3pty_begin, 1 },
{ "qsig_ct", pbx_capi_qsig_ct, 1 },
{ NULL, NULL, 0 }
};