Add color fax for rx direction
This commit is contained in:
parent
0566d6fc7a
commit
7cdfac46a8
1
CHANGES
1
CHANGES
|
@ -9,6 +9,7 @@ HEAD
|
||||||
- added variable CAPI_CIP for full access to all bearer capabilities.
|
- added variable CAPI_CIP for full access to all bearer capabilities.
|
||||||
- fixed CAPI 'chat' for using more than 8 controllers.
|
- fixed CAPI 'chat' for using more than 8 controllers.
|
||||||
- fixed CAPI 'chat' for not exceeding maximal size of CAPI message
|
- fixed CAPI 'chat' for not exceeding maximal size of CAPI message
|
||||||
|
- add color fax for rx direction
|
||||||
|
|
||||||
|
|
||||||
chan_capi-1.1.2
|
chan_capi-1.1.2
|
||||||
|
|
|
@ -141,7 +141,9 @@ You cann use Diva hardware and softIP in virtual environment if access by softwa
|
||||||
+-------------------------------------------------------------------+
|
+-------------------------------------------------------------------+
|
||||||
|
|
||||||
Dialogic (R) Diva(R) hardware and softIP supports color fax and allows to send/receive
|
Dialogic (R) Diva(R) hardware and softIP supports color fax and allows to send/receive
|
||||||
fax document in JPEG format.
|
fax document using
|
||||||
|
Continuous tone color and gray-scale mode according to T.4 Annex E using JPEG coding
|
||||||
|
Lossless color and gray-scale mode according to T.43 using JBIG coding
|
||||||
|
|
||||||
+-------------------------------------------------------------------+
|
+-------------------------------------------------------------------+
|
||||||
| High resolution fax, non standard paper size |
|
| High resolution fax, non standard paper size |
|
||||||
|
@ -172,6 +174,12 @@ The reception of the fax message is started using 'receivefax' capi command:
|
||||||
'options' - fax options, optional
|
'options' - fax options, optional
|
||||||
'k' - keep fax document in case of errors (by default document is removed
|
'k' - keep fax document in case of errors (by default document is removed
|
||||||
if fax transmission was not completed with success).
|
if fax transmission was not completed with success).
|
||||||
|
'j' - enable JPEG coding
|
||||||
|
'b' - enable T.43 coding
|
||||||
|
't' - do not use T.85
|
||||||
|
'e' - do not use ECM
|
||||||
|
'm' - do not use MMR (T.6) coding
|
||||||
|
'd' - do not use MR (2D) coding
|
||||||
|
|
||||||
This is possible to answer the incomming call using 'receivefax' command and start reception of
|
This is possible to answer the incomming call using 'receivefax' command and start reception of
|
||||||
the fax document directly.
|
the fax document directly.
|
||||||
|
@ -208,7 +216,7 @@ The transmission of fax message is started using 'sendfax' capi command:
|
||||||
Supported formats:
|
Supported formats:
|
||||||
.sff - SFF file
|
.sff - SFF file
|
||||||
.txt - text file
|
.txt - text file
|
||||||
.jpg - JPEG file
|
.cff - JPEG/T.43 (color/gray tone) coded file
|
||||||
'stationid' - station ID, optional
|
'stationid' - station ID, optional
|
||||||
'headline' - head line, optional
|
'headline' - head line, optional
|
||||||
|
|
||||||
|
@ -239,7 +247,20 @@ After chan_capi completed the processing of 'receivefax' or 'sendfax' command fo
|
||||||
0 - standard
|
0 - standard
|
||||||
1 - high
|
1 - high
|
||||||
FAXFORMAT - Format of received fax document
|
FAXFORMAT - Format of received fax document
|
||||||
0 - SFF
|
0 - SFF (default, description in Annex B)
|
||||||
|
1 - Plain fax format (modified Huffman coding)
|
||||||
|
2 - PCX
|
||||||
|
3 - DCX
|
||||||
|
4 - TIFF
|
||||||
|
5 - ASCII
|
||||||
|
6 - Extended ANSI
|
||||||
|
7 - Binary-File transfer
|
||||||
|
8 - Native (CFF
|
||||||
|
continuous-tone color and gray-scale T.4 Annex E using JPEG coding
|
||||||
|
lossless color and gray-scale mode according to T.43)
|
||||||
|
FAXCFFFORMAT - Valid if FAXFORMAT is set to 8 (native)
|
||||||
|
1 - continuous tone color and gray-scale mode according to T.4 Annex E using JPEG coding
|
||||||
|
2 - lossless color and gray-scale mode according to T.43 [7] using JBIG coding
|
||||||
FAXPAGES - Number of pages received
|
FAXPAGES - Number of pages received
|
||||||
FAXID - The ID of the remote fax maschine
|
FAXID - The ID of the remote fax maschine
|
||||||
|
|
||||||
|
|
72
chan_capi.c
72
chan_capi.c
|
@ -89,7 +89,7 @@ static char *commandtdesc = CC_MESSAGE_BIGNAME " command interface.\n"
|
||||||
"\"retrieve|${MYHOLDVAR}\" gets back the held call\n"
|
"\"retrieve|${MYHOLDVAR}\" gets back the held call\n"
|
||||||
"\"ect|${MYHOLDVAR})\" explicit call transfer of call on hold\n"
|
"\"ect|${MYHOLDVAR})\" explicit call transfer of call on hold\n"
|
||||||
"\"3pty_begin|${MYHOLDVAR})\" Three-Party-Conference (3PTY) with active and held call\n"
|
"\"3pty_begin|${MYHOLDVAR})\" Three-Party-Conference (3PTY) with active and held call\n"
|
||||||
"\"receivefax|filename|stationID|headline\" receive a " CC_MESSAGE_BIGNAME " fax\n"
|
"\"receivefax|filename|stationID|headline|options\" receive a " CC_MESSAGE_BIGNAME " fax\n"
|
||||||
"\"sendfax|filename.sff|stationID|headline\" send a " CC_MESSAGE_BIGNAME " fax\n"
|
"\"sendfax|filename.sff|stationID|headline\" send a " CC_MESSAGE_BIGNAME " fax\n"
|
||||||
"\"qsig_ssct|cidsrc|ciddst\" QSIG single step call transfer\n"
|
"\"qsig_ssct|cidsrc|ciddst\" QSIG single step call transfer\n"
|
||||||
"\"qsig_ct|cidsrc|ciddst|marker|waitconnect\" QSIG call transfer\n"
|
"\"qsig_ct|cidsrc|ciddst|marker|waitconnect\" QSIG call transfer\n"
|
||||||
|
@ -218,7 +218,7 @@ static struct {
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{ 0x04, 0x04, 0x04, /* 1 */
|
{ 0x04, 0x04, 0x05, /* 1 */
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
|
@ -2303,15 +2303,26 @@ pbx_capi_request(const char *type, int format, void *data, int *cause)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fill out fax conf struct
|
* fill out fax conf struct
|
||||||
|
*
|
||||||
|
* b3_protocol_options:
|
||||||
|
* [Bit 0] : Enable high resolution
|
||||||
|
* [Bit 1] : Accept incoming fax-polling requests
|
||||||
|
* [Bit 10]: Enable JPEG negotiation (continuous-tone colour mode according to T.4 Annex E) (see note 1)
|
||||||
|
* [Bit 11]: Enable JBIG colour and gray-scale negotiation according to T.43 (see note 1)
|
||||||
|
* [Bit 12]: Do not use JBIG progressive bi-level image compression
|
||||||
|
* [Bit 13]: Do not use MR compression
|
||||||
|
* [Bit 14]: Do not use MMR compression
|
||||||
|
* [Bit 15]: Do not use ECM
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
static void setup_b3_fax_config(B3_PROTO_FAXG3 *b3conf, int fax_format, char *stationid, char *headline)
|
static void setup_b3_fax_config(B3_PROTO_FAXG3 *b3conf, int fax_format, char *stationid, char *headline, unsigned short b3_protocol_options)
|
||||||
{
|
{
|
||||||
int len1;
|
int len1;
|
||||||
int len2;
|
int len2;
|
||||||
|
|
||||||
cc_verbose(3, 1, VERBOSE_PREFIX_3 "Setup fax b3conf fmt=%d, stationid='%s' headline='%s'\n",
|
cc_verbose(3, 1, VERBOSE_PREFIX_3 "Setup fax b3conf fmt=%d, stationid='%s' headline='%s' options=%04x\n",
|
||||||
fax_format, stationid, headline);
|
fax_format, stationid, headline, b3_protocol_options);
|
||||||
b3conf->resolution = 0;
|
b3conf->resolution = b3_protocol_options;
|
||||||
b3conf->format = (unsigned short)fax_format;
|
b3conf->format = (unsigned short)fax_format;
|
||||||
len1 = strlen(stationid);
|
len1 = strlen(stationid);
|
||||||
b3conf->Infos[0] = (unsigned char)len1;
|
b3conf->Infos[0] = (unsigned char)len1;
|
||||||
|
@ -2347,6 +2358,7 @@ static int pbx_capi_receive_fax(struct ast_channel *c, char *data)
|
||||||
char *filename, *stationid, *headline, *options;
|
char *filename, *stationid, *headline, *options;
|
||||||
B3_PROTO_FAXG3 b3conf;
|
B3_PROTO_FAXG3 b3conf;
|
||||||
char buffer[CAPI_MAX_STRING];
|
char buffer[CAPI_MAX_STRING];
|
||||||
|
unsigned short b3_protocol_options = 0;
|
||||||
|
|
||||||
if (!data) { /* no data implies no filename or anything is present */
|
if (!data) { /* no data implies no filename or anything is present */
|
||||||
cc_log(LOG_WARNING, CC_MESSAGE_NAME " receivefax requires a filename\n");
|
cc_log(LOG_WARNING, CC_MESSAGE_NAME " receivefax requires a filename\n");
|
||||||
|
@ -2377,6 +2389,37 @@ static int pbx_capi_receive_fax(struct ast_channel *c, char *data)
|
||||||
"file won't be deleted.\n");
|
"file won't be deleted.\n");
|
||||||
keepbadfax = 1;
|
keepbadfax = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'j': /* enable JPEG encoding */
|
||||||
|
cc_verbose(3, 1,
|
||||||
|
VERBOSE_PREFIX_3 CC_MESSAGE_NAME " receivefax: enable JPEG coding");
|
||||||
|
b3_protocol_options |= 0x0400;
|
||||||
|
break;
|
||||||
|
case 'b': /* enable T.43 encoding */
|
||||||
|
cc_verbose(3, 1,
|
||||||
|
VERBOSE_PREFIX_3 CC_MESSAGE_NAME " receivefax: enable T.43 coding");
|
||||||
|
b3_protocol_options |= 0x0800;
|
||||||
|
break;
|
||||||
|
case 't': /* diasble T.85 encoding */
|
||||||
|
cc_verbose(3, 1,
|
||||||
|
VERBOSE_PREFIX_3 CC_MESSAGE_NAME " receivefax: Do not use T.85 coding");
|
||||||
|
b3_protocol_options |= 0x1000;
|
||||||
|
break;
|
||||||
|
case 'e': /* disable ECM encoding */
|
||||||
|
cc_verbose(3, 1,
|
||||||
|
VERBOSE_PREFIX_3 CC_MESSAGE_NAME " receivefax: Do not use ECM");
|
||||||
|
b3_protocol_options |= 0x8000;
|
||||||
|
break;
|
||||||
|
case 'm': /* disable MMR encoding */
|
||||||
|
cc_verbose(3, 1,
|
||||||
|
VERBOSE_PREFIX_3 CC_MESSAGE_NAME " receivefax: do not use MMR (T.6) coding");
|
||||||
|
b3_protocol_options |= 0x4000;
|
||||||
|
break;
|
||||||
|
case 'd': /* disable MR encoding */
|
||||||
|
cc_verbose(3, 1,
|
||||||
|
VERBOSE_PREFIX_3 CC_MESSAGE_NAME " receivefax: do not use MR (2D) coding");
|
||||||
|
b3_protocol_options |= 0x2000;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
cc_log(LOG_WARNING, "Unknown option '%c' for receivefax.\n",
|
cc_log(LOG_WARNING, "Unknown option '%c' for receivefax.\n",
|
||||||
*options);
|
*options);
|
||||||
|
@ -2393,7 +2436,7 @@ static int pbx_capi_receive_fax(struct ast_channel *c, char *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
i->FaxState |= CAPI_FAX_STATE_ACTIVE;
|
i->FaxState |= CAPI_FAX_STATE_ACTIVE;
|
||||||
setup_b3_fax_config(&b3conf, FAX_SFF_FORMAT, stationid, headline);
|
setup_b3_fax_config(&b3conf, FAX_SFF_FORMAT, stationid, headline, b3_protocol_options);
|
||||||
|
|
||||||
i->bproto = CC_BPROTO_FAXG3;
|
i->bproto = CC_BPROTO_FAXG3;
|
||||||
|
|
||||||
|
@ -2494,7 +2537,7 @@ static int pbx_capi_send_fax(struct ast_channel *c, char *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
i->FaxState |= (CAPI_FAX_STATE_ACTIVE | CAPI_FAX_STATE_SENDMODE);
|
i->FaxState |= (CAPI_FAX_STATE_ACTIVE | CAPI_FAX_STATE_SENDMODE);
|
||||||
setup_b3_fax_config(&b3conf, FAX_SFF_FORMAT, stationid, headline);
|
setup_b3_fax_config(&b3conf, FAX_SFF_FORMAT, stationid, headline, 0);
|
||||||
|
|
||||||
i->bproto = CC_BPROTO_FAXG3;
|
i->bproto = CC_BPROTO_FAXG3;
|
||||||
|
|
||||||
|
@ -3775,10 +3818,21 @@ static void capidev_handle_disconnect_b3_indication(_cmsg *CMSG, unsigned int PL
|
||||||
if (ncpi) {
|
if (ncpi) {
|
||||||
snprintf(buffer, CAPI_MAX_STRING-1, "%d", read_capi_word(&ncpi[1]));
|
snprintf(buffer, CAPI_MAX_STRING-1, "%d", read_capi_word(&ncpi[1]));
|
||||||
pbx_builtin_setvar_helper(i->owner, "FAXRATE", buffer);
|
pbx_builtin_setvar_helper(i->owner, "FAXRATE", buffer);
|
||||||
snprintf(buffer, CAPI_MAX_STRING-1, "%d", read_capi_word(&ncpi[3]));
|
snprintf(buffer, CAPI_MAX_STRING-1, "%d", read_capi_word(&ncpi[3]) & 1);
|
||||||
pbx_builtin_setvar_helper(i->owner, "FAXRESOLUTION", buffer);
|
pbx_builtin_setvar_helper(i->owner, "FAXRESOLUTION", buffer);
|
||||||
snprintf(buffer, CAPI_MAX_STRING-1, "%d", read_capi_word(&ncpi[5]));
|
snprintf(buffer, CAPI_MAX_STRING-1, "%d", read_capi_word(&ncpi[5]));
|
||||||
pbx_builtin_setvar_helper(i->owner, "FAXFORMAT", buffer);
|
pbx_builtin_setvar_helper(i->owner, "FAXFORMAT", buffer);
|
||||||
|
strcpy (buffer, "0");
|
||||||
|
if (read_capi_word(&ncpi[5]) == 8) {
|
||||||
|
unsigned short options = read_capi_word(&ncpi[3]);
|
||||||
|
|
||||||
|
if (options & 0x0400) {
|
||||||
|
strcpy (buffer, "1");
|
||||||
|
} else if (options & 0x0800) {
|
||||||
|
strcpy (buffer, "2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pbx_builtin_setvar_helper(i->owner, "FAXCFFFORMAT", buffer);
|
||||||
snprintf(buffer, CAPI_MAX_STRING-1, "%d", read_capi_word(&ncpi[7]));
|
snprintf(buffer, CAPI_MAX_STRING-1, "%d", read_capi_word(&ncpi[7]));
|
||||||
pbx_builtin_setvar_helper(i->owner, "FAXPAGES", buffer);
|
pbx_builtin_setvar_helper(i->owner, "FAXPAGES", buffer);
|
||||||
memcpy(buffer, &ncpi[10], ncpi[9]);
|
memcpy(buffer, &ncpi[10], ncpi[9]);
|
||||||
|
|
|
@ -153,6 +153,7 @@ static inline unsigned int read_capi_dword(void *m)
|
||||||
#define FAX_ASCII_FORMAT 5
|
#define FAX_ASCII_FORMAT 5
|
||||||
#define FAX_EXTENDED_ASCII_FORMAT 6
|
#define FAX_EXTENDED_ASCII_FORMAT 6
|
||||||
#define FAX_BINARY_FILE_TRANSFER_FORMAT 7
|
#define FAX_BINARY_FILE_TRANSFER_FORMAT 7
|
||||||
|
#define FAX_NATIVE_FILE_TRANSFER_FORMAT 8
|
||||||
|
|
||||||
/* Fax struct */
|
/* Fax struct */
|
||||||
struct fax3proto3 {
|
struct fax3proto3 {
|
||||||
|
|
Loading…
Reference in New Issue