2004-01-10 Gernot Hillier <gernot@hillier.de>

* .cvsignore: added stamp-files
        * docs/manual-de.docbook (creating_alaw): small stylistic improvement
        * src/capisuite.conf.in, src/application/capisuite.cpp (CapiSuite,
          readConfiguration): added new options DDI_base, DDI_length and
          DDI_stop_numbers
        * src/application/capisuite.cpp (checkOption): nicer output format
        * src/backend/capi.{cpp,h} (Capi,readMessage): new parameters for DDI,
          enable Called Party Info Element if DDI is used; accept Called
          Party Info Element; pass on DDI options to Connection object
        * src/backend/connection.{cpp,h} (Connection,info_ind_called_party_nr):
          new parameters for DDI; interpret Called Party Info Element, get
          CalledPartyNumber from there instead of CONNECT_IND when DDI is used;
          docu improvements
        * src/modules/connectmodule.h: disabled the automatic adding of CVS log
          messages


git-svn-id: https://svn.ibp.de/svn/capisuite/trunk/capisuite@203 4ebea2bb-67d4-0310-8558-a5799e421b66
master
gernot 19 years ago
parent 8861fe7d46
commit 08c5fa93fc
  1. 2
      .cvsignore
  2. 42
      ChangeLog
  3. 150
      NEWS
  4. 2
      docs/manual-de.docbook
  5. 53
      src/application/capisuite.cpp
  6. 46
      src/backend/capi.cpp
  7. 24
      src/backend/capi.h
  8. 79
      src/backend/connection.cpp
  9. 47
      src/backend/connection.h
  10. 25
      src/capisuite.conf.in
  11. 7
      src/modules/connectmodule.h

@ -17,4 +17,4 @@ install-sh
missing
mkinstalldirs
py-compile
stamp-h*

@ -1,12 +1,27 @@
2004-01-10 Gernot Hillier <gernot@hillier.de>
* .cvsignore: added stamp-files
* docs/manual-de.docbook (creating_alaw): small stylistic improvement
* src/capisuite.conf.in, src/application/capisuite.cpp (CapiSuite,
readConfiguration): added new options DDI_base, DDI_length and
DDI_stop_numbers
* src/application/capisuite.cpp (checkOption): nicer output format
* src/backend/capi.{cpp,h} (Capi,readMessage): new parameters for DDI,
enable Called Party Info Element if DDI is used; accept Called
Party Info Element; pass on DDI options to Connection object
* src/backend/connection.{cpp,h} (Connection,info_ind_called_party_nr):
new parameters for DDI; interpret Called Party Info Element, get
CalledPartyNumber from there instead of CONNECT_IND when DDI is used;
docu improvements
* src/modules/connectmodule.h: disabled the automatic adding of CVS log
messages
2003-12-31 Gernot Hillier <gernot@hillier.de>
* src/modules/connectmodule.{h,cpp} (ConnectModule): throw
CapiExternalError only when connection's already up, otherwise
use CapiWrongState
* scripts/incoming.py (voiceIncoming): include recorded msg length
and host name were file is stored in sent mail (closes bug #6,
thx to Achim Bohnet and Thomas Niesel for the feature requests)
* scripts/cs_helpers.pyin (sendMIMEMail): use 16 bit ouput when
converting sound files from la to wav. Thx to Holger Krull for
the fix (closes bug #51)!
@ -15,7 +30,6 @@
* nearly all files (history block): disabled the automatic
adding of CVS log messages to source files as we now have
this nice ChangeLog file
* src/modules/audioreceive.{h,cpp} (AudioReceive,mainLoop),
src/modules/audiosend.{h,cpp} (AudioSend,mainLoop),
src/modules/callmodule.{h,cpp} (CallModule,mainLoop),
@ -25,9 +39,9 @@
src/modules/faxreceive.{h,cpp} (FaxReceive,mainLoop),
src/modules/faxsend.{h,cpp} (FaxSend,mainLoop),
src/modules/readDTMF.{h,cpp} (ReadDTMF,mainLoop),
src/modules/switch2faxG3.{h,cpp} (Switch2FaxG3,mainLoop):
src/modules/switch2faxG3.{h,cpp} (Switch2FaxG3,mainLoop):
rework of exception handling stuff; many modules were not
declaring thrown exceptions correctly any more after the
declaring thrown exceptions correctly any more after the
re-structuring to not throw exceptions on any disconnect
2003-12-21 Gernot Hillier <gernot@hillier.de>
@ -38,8 +52,8 @@
2003-12-02 Gernot Hillier <gernot@hillier.de>
* scripts/idle.py (idle): fix a wrong call of ConfigParser::get
instead of cs_helpers::get, this means fax_numbers now really
is allowed to be empty
instead of cs_helpers::get, this means fax_numbers must not be
defined if a user
2003-12-01 Gernot Hillier <gernot@hillier.de>
@ -51,25 +65,19 @@
* docs/manual.docbook (creating_alaw): add note how to convert vbox
to inversed A-Law files (thx to Thomas Niesel)
* docs/manual-de.docbook (creating_alaw): see above
* docs/manual.docbook (require_soft): updated link to jpeg2ps (thx to
Achim Bohnet)
* docs/manual-de.docbook (require_soft): see above
* scripts/cs_helpers.pyin (sendMIMEMail): better wording for some error
messages
2003-10-05 Gernot Hillier <gernot@hillier.de>
* started ChangeLog
* docs/manual.docbook (require_soft): add note that glibc-locales are
necessary if AVM drivers are used for faxing. They're needed for
* docs/manual.docbook (require_soft): add note that glibc-locales are
necessary if AVM drivers are used for faxing. They're needed for
iconv() in Connection::convertToCP437. Thx to M. Koelbl for reporting
the problem.
* docs/manual-de.docbook (require_soft): add same note
* suse/capisuite-8.0.spec: add dependancy to glibc-locale
* suse/capisuite-8.1.spec: add dependancy to glibc-locale
* suse/capisuite-8.2.spec: add dependancy to glibc-locale
* docs/manual-de.docbook (require_soft): add same note
* suse/capisuite-8.{0,1,2}.spec: add dependancy to glibc-locale

150
NEWS

@ -7,8 +7,8 @@
for the fix; closes bug #51)
* scripts: the mails sent with received voice and fax calls will now
also contain some general information like length of calls, number
of pages, etc. (thx to Achim Bohnet and Thomas Niesel for the feature
contain some general information like length of calls, number of
pages, etc. (thx to Achim Bohnet and Thomas Niesel for the feature
requests; closes bug #6 finally)
* core: the Python functions switch_to_faxG3, fax_receive, fax_send,
@ -21,13 +21,16 @@
* core: accept incoming color faxes now
* scripts: fix a bug in faxIncoming which lead to a non-working
fax reception after automatic switch from voice to fax mode
(thx to Andreas Scholz and Harald Jansen)
* scripts/idle.py (idle): fixed a bug which under some circumstances
caused an error message when fax_numbers was not set for a user
* scripts: fixed a bug which lead to a connection abort when the
answering machine recognized an incoming fax call (thx to Andreas
Scholz and Harald Jansen)
* scripts: added new non-error ISDN cause (0x349f) to fax send routine.
It was understood as error by CapiSuite but means "normal call
clearing, unspecified" (thx to Stefan Brandner for reporting)
It was wrongly understood as an error before and therefore leading to
repeated fax sends (thx to Stefan Brandner for reporting)
* Makefiles: fixed "make" to not trying to create directories any more -
this prevented normal users to call "make" sometimes (thx to Steffen
@ -47,18 +50,18 @@
* scripts & core: support color fax reception (bug #22, thx to
Axel Schneck)
* scripts: added missing file "unbekannt.la" to install targets in
* scripts: added missing file "unbekannt.la" to install targets in
Makefiles (thx to Wolfgang Dollendorf)
* scripts: added missing "+.la" which is necessary for the remote inquiry
of recorded international calls (bug #27)
* scripts: added missing "+.la" which is necessary for the remote
inquiry of recorded international calls (bug #27)
* scripts: fax_numbers may be now left empty in fax.conf. This makes
it possible to use one MSN for receiving/sending faxes and voice
it possible to use one MSN for receiving/sending faxes and voice
calls (fax sending was refused up to now if fax_numbers was empty).
(bug #23)
* scripts: number of needed tries reported after sending a fax was
* scripts: number of needed tries reported after sending a fax was
wrong (bug #29, thx to Eckhard Rüggeberg)
* scripts: fax jobs can be given a literal addressee and a subject
@ -68,19 +71,22 @@
so that special characters like german umlauts are working now
(thx to Eckhard Rüggeberg for reporting)
* scripts: Sander Roest found a workaround for the odd Python error
"cannot unmarshal code objects in restricted execution mode" which mainly
hit Redhat users for any reason beyond my understanding and prevented
CapiSuite from sending mails sometimes/always...
* scripts: Sander Roest found a workaround for the odd Python error
"cannot unmarshal code objects in restricted execution mode" which
mainly hit Redhat users for any reason beyond my understanding and
prevented CapiSuite from sending mails sometimes/always...
* switched from BerliOS bug tracker to Mantis installed on http://www.
capisuite.de
0.4.2 (CVS tag CAPISUITE_042):
==============================
* manual now available as PDF
* manual now available as PDF
* scripts: fixed an overflow in cs_helpery.py which caused hangs for
the receive of long (more than about 40 pages) fax documents
the receive of long (more than about 40 pages) fax documents
* scripts: fixed a bug in idle.py which caused a fax send delay of one
* scripts: fixed a bug in idle.py which caused a fax send delay of one
hour when daylight saving time is in effect
* scripts: attachments to sent e-mails now get a valid filename
@ -92,20 +98,20 @@
now support the special sign "-" for "no destination number available"
(e.g. needed for the austrian "Global Call")
* scripts: capisuitefax now handles filenames and dialstrings with
* scripts: capisuitefax now handles filenames and dialstrings with
special chars (spaces etc.) correctly
* scripts: new parameter "--user" added to capisuitefax; thx to Wolfgang
Eul for the patch!
* core: use "-" instead of "??" for "no number available", e.g. important
for the call_from and call_to parameters of scripts
* core: use "-" instead of "??" for "no number available", e.g.
important for the call_from and call_to parameters of scripts
* core: small bug which lead to a wrong outgoing MSN in rare cases fixed
0.4.1a (tag CAPISUITE_041a):
============================
* fixed a bug in the rc-script of CapiSuite which made
* fixed a bug in the rc-script of CapiSuite which made
"capisuite start" unfunctional in 0.4.1 (path of executable changed)
* included tests and changes for gcc-2.95, no patch necessary
@ -127,16 +133,16 @@
* core: fixed problems when doing "make install" to an arbitrary prefix
* core: moved "capisuite" to <prefix>/sbin instead of bin
* scripts: fixed idle.py freezing which lead to CapiSuite not sending
faxes any more after some time (#527)
* scripts: fixed idle.py freezing which lead to CapiSuite not sending
faxes any more after some time (#527)
* scripts: fixed remote inquiry: mixed new and old messages sometimes
* scripts: stricter permissions of received files and dirs (#544)
* scripts: new option dial_prefix implemented (#537)
* scripts: stricter permissions of received files and dirs (#544)
* scripts: new option dial_prefix implemented (#537)
* scripts: better check for options read from config files, (#531)
many options are optional now with a resonable default
many options are optional now with a resonable default
* scripts: capisuitefax shebang corrected (#536)
Thanks goes mainly to Achim Bohnet and Dieter Pelzel for reporting bugs
Thanks goes mainly to Achim Bohnet and Dieter Pelzel for reporting bugs
0.4 (first public release, tag CAPISUITE_04):
=============================================
@ -149,25 +155,26 @@ Thanks goes mainly to Achim Bohnet and Dieter Pelzel for reporting bugs
========================
* core: finally got rid of the CommonC++ library:
- threading implemented using native pthread_* calls
- rewritten CapiSuite::parseConfigFile() to use STL string routines
- rewritten CapiSuite::parseConfigFile() to use STL strings
- changed Connection class to use pthread_mutex_*
* scripts: fixed bug which lead to hanging processes of externally started
progs like sendmail
* scripts: minor fixes
* scripts: fixed bug which lead to hanging processes of externally
started progs like sendmail
* scripts: minor fixes
0.3.1 (internal release):
=========================
* dist: included spec and init file in CVS and dist
* scripts: use different sendqueues for each user
* core: fixed some bugs:
- capisuite.error() didn't work,
- logging in outgoing connections didn't work
* scripts: use different sendqueues for each user
* core: fixed some bugs:
- capisuite.error() didn't work,
- logging in outgoing connections didn't work
- callingParty wasn't set correctly
* scripts: answering machine switches to fax when incoming service indicator says fax
* scripts: sayNumber can now handle all number from 0 to 99, so all dates and times are
now said nearly correctly for the remote inquiry
* scripts: answering machine switches to fax when incoming service
indicator says fax
* scripts: sayNumber can now handle all numbers from 0 to 99, so all
dates and times are now said nearly correctly for the remote inquiry
* scripts: fixed a typo in incoming.py
* docs: added ISDN/CAPI error codes to manual
* docs: added ISDN/CAPI error codes to manual
0.3 (internal release):
=======================
@ -180,18 +187,20 @@ Thanks goes mainly to Achim Bohnet and Dieter Pelzel for reporting bugs
0.2 (internal release):
=======================
* log improvements: log-level configurable (see capisuite.conf), appending log-file instead of re-creating
* configure allows to set docdir with --with-docdir
* CapiSuite can be finished using Ctrl-C and SIGTERM nicely
* very limited support for reload (kill -1) - only re-activates de-actived idle script yet,
no reload of configuration
* all configuration for the scripts put in own config file
* support for various new configuration options, multi-user-ready scripts (different user dirs in spool_dir/users)
* audio_receive does truncate recorded silence away
* log improvements: log-level configurable (see capisuite.conf),
appending log-file instead of re-creating
* configure allows to set docdir with --with-docdir
* CapiSuite can be finished using Ctrl-C and SIGTERM nicely
* very limited support for reload (kill -1) - only re-activates
de-actived idle script yet, no reload of configuration
* all configuration for the scripts put in own config file
* support for various new configuration options, multi-user-ready
scripts (different user dirs in spool_dir/users)
* audio_receive does truncate recorded silence away
* remote inquiry supports recording of own announcement
* commandline option "-d" runs CapiSuite as daemon
* new python commands: capisuite.log and capisuite.error let scripts write messages to the CapiSuite log
and error log
* new python commands: capisuite.log and capisuite.error let scripts
write messages to the CapiSuite log and error log
0.1 (internal release):
=======================
@ -209,27 +218,30 @@ Thanks goes mainly to Achim Bohnet and Dieter Pelzel for reporting bugs
========================
* improvement in idle script handling, own class for it (IdleScript)
* new classes for Python script handling (PythonScript) and derived classes
(IncomingScript & IdleScript)
* new python functions call_voice and call_faxG3 to initiate outgoing calls
* changed python exception handling to allow multiple calls in one script to be
handled correctly
* python functions disconnect() and reject() wait for complete disconnection and
return the disconnect cause now
* new classes for Python script handling (PythonScript) and derived
classes (IncomingScript & IdleScript)
* new python functions call_voice and call_faxG3 to initiate outgoing
calls
* changed python exception handling to allow multiple calls in one
script to be handled correctly
* python functions disconnect() and reject() wait for complete
disconnection and return the disconnect cause now
* assure nice disconnection in any error case (hopefully)
* when error occured in script, physical connection is finished immediately leading
to an error visible at the sending side (e.g. when using the fax protocol)
* cleaned up python reference counting and threads, no known memory leaks any more
* many changes to support outgoing calls (new module, many small changes)
* Connection objects will be destroyed by application level now so dangling pointers
are avoided
* when error occured in script, physical connection is finished
immediately leading to an error visible at the sending side (e.g.
when using the fax protocol)
* cleaned up python reference counting and threads, no known memory
leaks any more
* many changes to support outgoing calls (new module, small changes)
* Connection objects will be destroyed by application level now so
dangling pointers are avoided
* exception handling generally improved
0.02 (internal release):
========================
* many bug fixes as usual (SEGV, ...)
* service constants SERVICE_VOICE, SERVICE_FAXG3 and SERVICE_OTHER
* service constants SERVICE_VOICE, SERVICE_FAXG3 and SERVICE_OTHER
available in python now, no need to use CIP values any more
* audio_send and audio_receive return length in seconds now
* added support for idle script which can initiate outgoing calls
@ -237,7 +249,9 @@ Thanks goes mainly to Achim Bohnet and Dieter Pelzel for reporting bugs
0.01 (internal release):
========================
* changed name from CapiCom to CapiSuite (name conflict with MS crypto API)
* added doxygen-created documentation for classes and python exported functions
* changed name from CapiCom to CapiSuite (name conflict with MS crypto
API)
* added doxygen-created documentation for classes and python exported
functions
* get_DTMF() was renamed to read_DTMF() and can wait for DTMF now
* connect_telephony() renamed to connect_voice()

@ -1708,7 +1708,7 @@ is not present, current time as returned by localtime() is used.
Qualität. Empfehlenswert ist auch, die Aufnahme auf maximal 50% der maximalen Amplitude
zu normalisieren.</para>
<para>Sie können WAV in inverstiert A-Law konvertieren, indem Sie aufrufen (danke an Carsten Heesch für den Tipp):</para>
<para>Sie können WAV mit folgendem Kommando in invertiertes A-Law konvertieren (danke an Carsten Heesch für den Tipp):</para>
<screen><command>sox myfile.wav -r 8000 -c 1 -b outfile.la resample -ql</command></screen>

@ -2,7 +2,7 @@
@brief Contains CapiSuite - Main application class, implements ApplicationInterface
@author Gernot Hillier <gernot@hillier.de>
$Revision: 1.6 $
$Revision: 1.7 $
*/
/***************************************************************************
@ -72,8 +72,22 @@ CapiSuite::CapiSuite(int argc,char **argv)
(*debug) << prefix() << "CapiSuite " << VERSION << " started." << endl;
(*error) << prefix() << "CapiSuite " << VERSION << " started." << endl;
string DDIStopListS=config["DDI_stop_numbers"];
vector<string> DDIStopList;
DDIStopList.push_back("");
int j=0;
for (int i=0;i<DDIStopListS.length();i++) {
if (DDIStopListS[i]==',') {
DDIStopList.push_back("");
j++;
} else {
DDIStopList[j]+=DDIStopListS[i];
}
}
// backend init
capi=new Capi(*debug,debug_level,*error);
capi=new Capi(*debug,debug_level,*error,atoi(config["DDI_length"].c_str()),atoi(config["DDI_base_length"].c_str()),DDIStopList);
capi->registerApplicationInterface(this);
string info;
@ -259,7 +273,7 @@ void
CapiSuite::checkOption(string key, string value)
{
if (!config.count(key)) {
cerr << "Warning: Can't find " << key << " variable. Using default (" << value << ")." << endl;
cerr << "Warning: Can't find " << key << " variable. Using default (\"" << value << "\")." << endl;
config[key]=value;
}
}
@ -304,11 +318,14 @@ CapiSuite::readConfiguration()
checkOption("log_file",string(LOCALSTATEDIR)+"/log/capisuite.log");
checkOption("log_level","2");
checkOption("log_error",string(LOCALSTATEDIR)+"/log/capisuite.error");
checkOption("DDI_length","0");
checkOption("DDI_base_length","0");
checkOption("DDI_stop_numbers","");
string t(config["idle_script_interval"]);
for (int i=0;i<t.size();i++)
if (t[i]<'0' || t[i]>'9')
throw ApplicationError("Invalid idle_script_interval given.","main()");
throw ApplicationError("Invalid idle_script_interval given.","readConfiguration()");
if (config["log_file"]!="" && config["log_file"]!="-") {
debug = new ofstream(config["log_file"].c_str(),ios::app);
@ -334,6 +351,21 @@ CapiSuite::readConfiguration()
} else
error=&cerr;
t=config["DDI_length"];
for (int i=0;i<t.size();i++)
if (t[i]<'0' || t[i]>'9')
throw ApplicationError("Invalid DDI_length given.","readConfiguration()");
t=config["DDI_base_length"];
for (int i=0;i<t.size();i++)
if (t[i]<'0' || t[i]>'9')
throw ApplicationError("Invalid DDI_base_length given.","readConfiguration()");
t=config["DDI_stop_numbers"];
for (int i=0;i<t.size();i++)
if ((t[i]<'0' || t[i]>'9') && t[i]!=',')
throw ApplicationError("Invalid DDI_stop_numbers given.","readConfiguration()");
if (daemonmode) {
if (debug==&cout) {
cerr << "FATAL error: not allowed to write to stdout in daemon mode." << endl;
@ -398,6 +430,19 @@ CapiSuite::help()
/* History
Old Log (for new changes see ChangeLog):
Revision 1.5.2.3 2003/11/06 18:32:15 gernot
- implemented DDIStopNumbers
Revision 1.5.2.2 2003/11/02 14:58:16 gernot
- use DDI_base_length instead of DDI_base
- added DDI_stop_numbers option
- use DDI_* options in the Connection class
- call the Python script if number is complete
Revision 1.5.2.1 2003/10/26 16:51:55 gernot
- begin implementation of DDI, get DDI Info Elements
Revision 1.5 2003/04/03 21:09:46 gernot
- Capi::getInfo isn't static any longer

@ -2,7 +2,7 @@
@brief Contains Capi - Main Class for communication with CAPI
@author Gernot Hillier <gernot@hillier.de>
$Revision: 1.6 $
$Revision: 1.7 $
*/
/***************************************************************************
@ -31,8 +31,9 @@ void* capi_exec_handler(void* arg)
instance->run();
}
Capi::Capi (ostream& debug, unsigned short debug_level, ostream &error, unsigned maxLogicalConnection, unsigned maxBDataBlocks,unsigned maxBDataLen) throw (CapiError, CapiMsgError)
:debug(debug),debug_level(debug_level),error(error),messageNumber(0),usedInfoMask(0x10),usedCIPMask(0),numControllers(0)
Capi::Capi (ostream& debug, unsigned short debug_level, ostream &error, unsigned short DDILength, unsigned short DDIBaseLength, vector<string> DDIStopNumbers, unsigned maxLogicalConnection, unsigned maxBDataBlocks,unsigned maxBDataLen) throw (CapiError, CapiMsgError)
:debug(debug),debug_level(debug_level),error(error),messageNumber(0),usedInfoMask(0x10),usedCIPMask(0),numControllers(0),
DDILength(DDILength),DDIBaseLength(DDIBaseLength),DDIStopNumbers(DDIStopNumbers)
{
if (debug_level >= 2)
debug << prefix() << "Capi object created" << endl;
@ -45,6 +46,9 @@ Capi::Capi (ostream& debug, unsigned short debug_level, ostream &error, unsigned
if (applId == 0 || info!=0)
throw (CapiMsgError(info,"Error while registering application: "+describeParamInfo(info),"Capi::Capi()"));
if (DDILength)
usedInfoMask|=0x80; // enable Called Party Number Info Element for PtP configuration
for (int i=1;i<=numControllers;i++)
listen_req(i, usedInfoMask, usedCIPMask); // can throw CapiMsgError
@ -548,9 +552,10 @@ Capi::readMessage (void) throw (CapiMsgError, CapiError, CapiWrongState, CapiExt
if (connections.count(plci)>0)
throw(CapiError("PLCI used twice from CAPI in CONNECT_IND","Capi::readMessage()"));
else {
Connection *c=new Connection(nachricht,this);
Connection *c=new Connection(nachricht,this,DDILength,DDIBaseLength,DDIStopNumbers);
connections[plci]=c;
application->callWaiting(c);
if (!DDILength) // if we have PtP then wait until DDI is complete
application->callWaiting(c);
}
} break;
@ -647,6 +652,21 @@ Capi::readMessage (void) throw (CapiMsgError, CapiError, CapiWrongState, CapiExt
connections[plci]->info_ind_alerting(nachricht);
} break;
case 0x70: { // Called Party Number
_cdword plci=INFO_IND_PLCI(&nachricht);
if (debug_level >= 2)
debug << prefix() << "<INFO_IND: PLCI 0x" << hex << plci << ", InfoNumber CalledPartyNr " << endl;
bool nrComplete;
if (connections.count(plci)==0)
throw(CapiError("PLCI unknown in INFO_IND","Capi::readMessage()"));
else {
nrComplete=connections[plci]->info_ind_called_party_nr(nachricht);
if (nrComplete && DDILength)
application->callWaiting(connections[plci]);
}
} break;
default:
if (debug_level >= 2)
debug << prefix() << "<INFO_IND: Controller/PLCI 0x" << hex << INFO_IND_PLCI(&nachricht) << ", InfoNumber " << INFO_IND_INFONUMBER(&nachricht) << " (ignoring)" << endl;
@ -951,6 +971,22 @@ Capi::getInfo(bool verbose)
/* History
Old Log (for new changes see ChangeLog):
Revision 1.5.2.4 2003/11/06 18:32:15 gernot
- implemented DDIStopNumbers
Revision 1.5.2.3 2003/11/02 14:58:16 gernot
- use DDI_base_length instead of DDI_base
- added DDI_stop_numbers option
- use DDI_* options in the Connection class
- call the Python script if number is complete
Revision 1.5.2.2 2003/11/01 22:59:33 gernot
- read CalledPartyNr InfoElements
Revision 1.5.2.1 2003/10/26 16:51:55 gernot
- begin implementation of DDI, get DDI Info Elements
Revision 1.5 2003/04/17 10:39:42 gernot
- support ALERTING notification (to know when it's ringing on the other side)
- cosmetical fixes in capi.cpp

@ -2,7 +2,7 @@
@brief Contains Capi - Main Class for communication with CAPI
@author Gernot Hillier <gernot@hillier.de>
$Revision: 1.6 $
$Revision: 1.7 $
*/
/***************************************************************************
@ -67,13 +67,16 @@ class Capi {
@param debug reference to a ostream object where debug info should be written to
@param debug_level verbosity level for debug messages
@param error reference to a ostream object where errors should be written to
@param DDILength if ISDN interface is in PtP mode, the length of the DDI must be set here. 0 means disabled (PtMP)
@param DDIBaseLength the base number length w/o extension (and w/o 0) if DDI is used
@param DDIStopNumbers list of DDIs shorter than DDILength we will accept
@param maxLogicalConnection max. number of logical connections we will handle
@param maxBDataBlocks max. number of unconfirmed B3-datablocks, 7 is the maximum supported by CAPI
@param maxBDataLen max. B3-Datablocksize, 2048 is the maximum supported by CAPI
@throw CapiError Thrown if no ISDN controller is reported by CAPI
@throw CapiMsgError Thrown if registration at CAPI wasn't successful.
*/
Capi (ostream &debug, unsigned short debug_level, ostream &error, unsigned maxLogicalConnection=2, unsigned maxBDataBlocks=7,unsigned maxBDataLen=2048) throw (CapiError, CapiMsgError);
Capi (ostream &debug, unsigned short debug_level, ostream &error, unsigned short DDILength=0, unsigned short DDIBaseLength=0, vector<string> DDIStopNumbers=vector<string>(), unsigned maxLogicalConnection=2, unsigned maxBDataBlocks=7,unsigned maxBDataLen=2048) throw (CapiError, CapiMsgError);
/** @brief Destructor. Unregister App at CAPI
@ -416,6 +419,10 @@ class Capi {
string capiManufacturer, ///< manufacturer of the general CAPI driver
capiVersion; ///< version of the general CAPI driver
unsigned short DDILength; ///< length of extension number (DDI) when ISDN PtP mode is used (0=PtMP)
unsigned short DDIBaseLength; ///< base number length for the ISDN interface if PtP mode is used
vector<string> DDIStopNumbers; ///< list of DDIs shorten than DDILength we'll accept
vector <CardProfileT> profiles; ///< vector containing profiles for all found cards (ATTENTION: starts with index 0,
///< while CAPI numbers controllers starting by 1 (sigh)
@ -441,6 +448,19 @@ class Capi {
/* History
Old Log (for new changes see ChangeLog):
Revision 1.5.2.3 2003/11/06 18:32:15 gernot
- implemented DDIStopNumbers
Revision 1.5.2.2 2003/11/02 14:58:16 gernot
- use DDI_base_length instead of DDI_base
- added DDI_stop_numbers option
- use DDI_* options in the Connection class
- call the Python script if number is complete
Revision 1.5.2.1 2003/10/26 16:51:55 gernot
- begin implementation of DDI, get DDI Info Elements
Revision 1.5 2003/04/17 10:39:42 gernot
- support ALERTING notification (to know when it's ringing on the other side)
- cosmetical fixes in capi.cpp

@ -2,7 +2,7 @@
@brief Contains Connection - Encapsulates a CAPI connection with all its states and methods.
@author Gernot Hillier <gernot@hillier.de>
$Revision: 1.14 $
$Revision: 1.15 $
*/
/***************************************************************************
@ -27,18 +27,23 @@
using namespace std;
Connection::Connection (_cmsg& message, Capi* capi_in):
call_if(NULL),capi(capi_in),plci_state(P2),ncci_state(N0), buffer_start(0), buffers_used(0),
Connection::Connection (_cmsg& message, Capi *capi, unsigned short DDILength, unsigned short DDIBaseLength, std::vector<std::string> DDIStopNumbers):
call_if(NULL),capi(capi),plci_state(P2),ncci_state(N0), buffer_start(0), buffers_used(0),
file_for_reception(NULL), file_to_send(NULL), received_dtmf(""), keepPhysicalConnection(false),
disconnect_cause(0),debug(capi->debug), debug_level(capi->debug_level), error(capi->error),
our_call(false), disconnect_cause_b3(0), fax_info(NULL)
our_call(false), disconnect_cause_b3(0), fax_info(NULL), DDILength(DDILength),
DDIBaseLength(DDIBaseLength), DDIStopNumbers(DDIStopNumbers)
{
pthread_mutex_init(&send_mutex, NULL);
pthread_mutex_init(&receive_mutex, NULL);
plci=CONNECT_IND_PLCI(&message); // Physical Link Connection Identifier
call_from = getNumber(CONNECT_IND_CALLINGPARTYNUMBER(&message),true);
call_to = getNumber(CONNECT_IND_CALLEDPARTYNUMBER(&message),false);
if (DDILength)
call_to=""; // we enable the CalledParty InfoElement when using DDI and will get the number later again
else
call_to=getNumber(CONNECT_IND_CALLEDPARTYNUMBER(&message),false);
if (debug_level >= 1) {
debug << prefix() << "Connection object created for incoming call PLCI " << plci;
debug << " from " << call_from << " to " << call_to << " CIP 0x" << hex << CONNECT_IND_CIPVALUE(&message) << endl;
@ -59,11 +64,12 @@ Connection::Connection (_cmsg& message, Capi* capi_in):
connect_ind_msg_nr=message.Messagenumber; // this is needed as connect_resp is given later
}
Connection::Connection (Capi* capi, _cdword controller, string call_from_in, bool clir, string call_to_in, service_t service, string faxStationID, string faxHeadline) throw (CapiExternalError, CapiMsgError)
:call_if(NULL),capi(capi),plci_state(P01),ncci_state(N0),plci(0),service(service), buffer_start(0), buffers_used(0),
file_for_reception(NULL), file_to_send(NULL), call_from(call_from_in), call_to(call_to_in), connect_ind_msg_nr(0),
disconnect_cause(0), debug(capi->debug), debug_level(capi->debug_level), error(capi->error), keepPhysicalConnection(false),
our_call(true), disconnect_cause_b3(0), fax_info(NULL)
Connection::Connection (Capi* capi, _cdword controller, string call_from, bool clir, string call_to, service_t service, string faxStationID, string faxHeadline) throw (CapiExternalError, CapiMsgError)
:call_if(NULL),capi(capi),plci_state(P01),ncci_state(N0),plci(0),service(service),
buffer_start(0), buffers_used(0), file_for_reception(NULL), file_to_send(NULL),
call_from(call_from), call_to(call_to), connect_ind_msg_nr(0), disconnect_cause(0),
debug(capi->debug), debug_level(capi->debug_level), error(capi->error), keepPhysicalConnection(false),
our_call(true), disconnect_cause_b3(0), fax_info(NULL), DDILength(0), DDIBaseLength(0)
{
pthread_mutex_init(&send_mutex, NULL);
pthread_mutex_init(&receive_mutex, NULL);
@ -585,6 +591,41 @@ Connection::info_ind_alerting(_cmsg &message) throw (CapiWrongState)
call_if->alerting();
}
bool
Connection::info_ind_called_party_nr(_cmsg &message) throw (CapiWrongState)
{
if (plci_state!=P2)
throw CapiWrongState("INFO_IND for CalledPartyNr received in wrong state","Connection::info_ind_called_party_nr()");
if (plci!=INFO_IND_PLCI(&message))
throw CapiError("INFO_IND received with wrong PLCI","Connection::info_ind_called_party_nr()");
try {
capi->info_resp(message.Messagenumber,plci);
}
catch (CapiMsgError e) {
error << prefix() << "WARNING: Can't send info_resp. Message was: " << e << endl;
}
call_to+=getNumber(INFO_IND_INFOELEMENT(&message),false);
string currDDI=call_to.substr(DDIBaseLength);
for (int i=0;i<DDIStopNumbers.size();i++)
if (DDIStopNumbers[i]==currDDI) {
if (debug_level >= 1)
debug << prefix() << "got DDI, nr is now " << call_to << " (complete,stop_nr)" << endl;
return true;
}
if (call_to.length()>=DDIBaseLength+DDILength) {
if (debug_level >=1)
debug << prefix() << "got DDI, nr is now " << call_to << " (complete)" << endl;
return true;
} else {
if (debug_level >=1)
debug << prefix() << "got DDI, nr is now " << call_to << " (incomplete)" << endl;
return false;
}
}
void
Connection::connect_conf(_cmsg& message) throw (CapiWrongState, CapiMsgError)
@ -1089,6 +1130,24 @@ Revision 1.13 2003/12/21 21:15:10 gernot
Revision 1.12 2003/07/20 19:08:19 gernot
- added missing include of errno.h
Revision 1.11.2.5 2003/11/06 18:32:15 gernot
- implemented DDIStopNumbers
Revision 1.11.2.4 2003/11/02 14:58:16 gernot
- use DDI_base_length instead of DDI_base
- added DDI_stop_numbers option
- use DDI_* options in the Connection class
- call the Python script if number is complete
Revision 1.11.2.3 2003/11/01 22:59:33 gernot
- read CalledPartyNr InfoElements
Revision 1.11.2.2 2003/10/26 16:52:55 gernot
- begin implementation of DDI; get DDI info elements
Revision 1.11.2.1 2003/07/20 19:08:44 gernot
- added missing include of errno.h
Revision 1.11 2003/06/29 06:18:13 gernot
- don't take a wrong character too serious...

@ -2,7 +2,7 @@
@brief Contains Connection - Encapsulates a CAPI connection with all its states and methods.
@author Gernot Hillier <gernot@hillier.de>
$Revision: 1.7 $
$Revision: 1.8 $
*/
/***************************************************************************
@ -18,6 +18,7 @@
#define CONNECTION_H
#include <capi20.h>
#include <vector>
#include <string>
#include <fstream>
#include "capiexception.h"
@ -70,8 +71,8 @@ class Connection
This constructor is used when the application creates a Connection object manually to initiate an outgoing connection.
It constructs the necessary information elements (B channel protocol settings, Number elements) and calls Capi::connect_req
to initiate a call.
It constructs the necessary information elements (B channel protocol settings, Number elements) and calls
Capi::connect_req to initiate a call.
@param capi pointer to the Capi Object
@param controller number of the controller which should initiate the call
@ -355,11 +356,15 @@ class Connection
when we receive a CONNECT_IND message.
It only extracts some data (numbers, services, etc.) from the message and saves it in private attributes.
The answer to CONNECT_IND (i.e. CONNECT_RESP) is given later by the Connection object.
@param message the received CONNECT_IND message
@param capi pointer to the Capi Object
@param DDILength set the length of DDI extension numbers (0=default means disable DDI)
@param DDIBaseLength the length of the base number of the PtP interface
@param DDIStopNumbers a vector of strings listing complete DDI extension numbers which are shorter than DDILength
*/
Connection (_cmsg& message, Capi *capi);
Connection (_cmsg& message, Capi *capi, unsigned short DDILength=0, unsigned short DDIBaseLength=0, std::vector<std::string> DDIStopNumbers=std::vector<std::string>());
/********************************************************************************/
/* methods handling CAPI messages - called by the Capi class */
@ -427,6 +432,18 @@ class Connection
*/
void info_ind_alerting(_cmsg& message) throw (CapiWrongState);
/** @brief called when we get INFO_IND from CAPI with Info number saying it's ALERTING
This method will understand additional Called Party Number Info Elements to get the DDI
(necessary for getting the whole number in PtP configuration as the DDI is signalled
*after* CONNECT_IND.
@param message the received INFO_IND message
@return true if the CalledPartyNumber is complete (DDI length fulfilled or stop_number found)
@throw CapiWrongState Thrown when the message is received unexpected (i.e. in a wrong plci_state)
*/
bool info_ind_called_party_nr(_cmsg& message) throw (CapiWrongState);
/** @brief called when we get DISCONNECT_B3_IND from CAPI
This method will also send a response to Capi and stop_file_transmission and stop_file_reception().
@ -661,7 +678,11 @@ class Connection
unsigned short buffer_start, ///< holds the index for the first buffer currently used
buffers_used; ///< holds the number of currently used buffers
fax_info_t* fax_info;
fax_info_t* fax_info; ///< holds some data about fax connections
unsigned short DDILength; ///< the length of DDI extension numbers. 0 means DDI disabled
unsigned short DDIBaseLength; ///< the length of the base number for a PtP interface
vector<string> DDIStopNumbers; ///< list of complete DDI extensions shorter than DDILength
};
#endif
@ -669,6 +690,22 @@ class Connection
/* History
Old Log (for new changes see ChangeLog):
Revision 1.6.2.4 2003/11/11 21:05:41 gernot
- fix typo in comment
Revision 1.6.2.3 2003/11/02 14:58:16 gernot
- use DDI_base_length instead of DDI_base
- added DDI_stop_numbers option
- use DDI_* options in the Connection class
- call the Python script if number is complete
Revision 1.6.2.2 2003/11/01 22:59:33 gernot
- read CalledPartyNr InfoElements
Revision 1.6.2.1 2003/10/26 16:51:55 gernot
- begin implementation of DDI, get DDI Info Elements
Revision 1.6 2003/06/28 12:49:47 gernot
- convert fax headline to CP437, so that german umlauts and other special
characters will work now

@ -1,4 +1,4 @@
# $Id: capisuite.conf.in,v 1.2 2003/03/20 09:15:53 gernot Exp $
# $Id: capisuite.conf.in,v 1.3 2004/01/10 14:16:40 gernot Exp $
#
# This is the global configuration file for CapiSuite
#
@ -68,3 +68,26 @@ log_level="1"
#
log_error="@localstatedir@/log/capisuite.error"
# DDI_base, DDI_length and DDI_stop_numbers
#
# The following two options are only important if you've your ISDN card connected
# to an ISDN interface which is configured in "Point to Point"-mode (in Germany
# this is called "Anlagenanschluss"). This means you don't have several
# specific numbers (so called MSNs) but only one base number and you can define
# extensions as you like. As the length of these extensions is up to you, CapiSuite
# can't know it. Therefore you must configure it here. Sometimes, there are also
# shorter numbers you want to allow, for example the extension "0" instead of "000".
# These extension numbers can be listed (separated by commas) in DDI_stop_numbers.
#
# If you don't understand what this all means, then you most likely have no PtP
# interface and you can leave the default values.
#
# As an example, if you've numbers like 12345-123 and 12345-111, then your
# DDI_base_length would be "5" and DDI_length would be 3. If you also want to
# receive calls to 12345-0, you should set DDI_stop_numbers to "0".
#
# A value of 0 for DDI_length disables this feature and the other settings are
# ignored then (default).
DDI_length="0"
DDI_base_length="0"
DDI_stop_numbers=""

@ -2,7 +2,7 @@
@brief Contains ConnectModule - Call Module for connection establishment at incoming connection
@author Gernot Hillier <gernot@hillier.de>
$Revision: 1.4 $
$Revision: 1.5 $
*/
/***************************************************************************
@ -67,7 +67,8 @@ class ConnectModule: public CallModule
/* History
$Log: connectmodule.h,v $
Old Log (for new changes see ChangeLog):
Revision 1.4 2003/12/31 16:28:55 gernot
* src/modules/connectmodule.{h,cpp} (ConnectModule): throw
CapiExternalError only when connection's already up, otherwise
@ -76,8 +77,6 @@ Revision 1.4 2003/12/31 16:28:55 gernot
Revision 1.3 2003/12/28 21:01:04 gernot
- reworked TODO, disabled automatic log message adding to source files
Old Log (for new changes see ChangeLog):
Revision 1.1.1.1 2003/02/19 08:19:53 gernot
initial checkin of 0.4

Loading…
Cancel
Save