You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(5) |
Feb
(6) |
Mar
(1) |
Apr
(8) |
May
(5) |
Jun
(12) |
Jul
(38) |
Aug
|
Sep
|
Oct
(11) |
Nov
(21) |
Dec
(6) |
| 2010 |
Jan
(16) |
Feb
(15) |
Mar
(11) |
Apr
(1) |
May
|
Jun
(3) |
Jul
(13) |
Aug
|
Sep
(17) |
Oct
(16) |
Nov
|
Dec
(3) |
| 2011 |
Jan
(8) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Vyacheslav F. <vf...@us...> - 2011-04-13 07:10:13
|
Update of /cvsroot/t38modem/t38modem
In directory vz-cvs-2.sog:/tmp/cvs-serv7446
Modified Files:
Changes.txt version.h
Log Message:
Pre-tagging version change
Index: Changes.txt
===================================================================
RCS file: /cvsroot/t38modem/t38modem/Changes.txt,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Changes.txt 8 Oct 2009 14:11:44 -0000 1.9
--- Changes.txt 13 Apr 2011 07:10:10 -0000 1.10
***************
*** 8,11 ****
--- 8,43 ----
*/
+ Changelog for t38modem 2.0.0 (Apr 13 2011)
+
+ * (OPAL) Implemented G.711 fallback to fax pass-through mode.
+ * (OPAL) Added ability to disable T.38 fax mode.
+ * (OPAL) Implemented multiple per-route options to override command line
+ options (NOTE: the route comma delimiter in command line was deprecated
+ for this reason).
+ * Added ability to set Q.931 bearer capability information element for
+ H.323 connections.
+ * Enabled dialing characters # and * in extension number.
+ * Replaced hardcoded timeouts by S7 value (V.250).
+ * (OPAL) Implemented fake audio codecs G.722, G.722.1, G.722.2,
+ G.723.1, G.723.1(5.3k), G.723.1A(5.3k), G.723.1A(6.3k), G.726-16K,
+ G.726-24K, G.726-32K, G.726-40K, G.728, G.729, G.729A, G.729A/B,
+ G.729B, GSM-06.10, GSM-AMR, iLBC.
+ * (OPAL) Restored and improved ability to set error recovery redundancy for
+ IFP packets.
+ * (OPAL) Restored and improved ability to continuously re-send last UDPTL
+ packet.
+ * (OPAL) Implemented fallback to alternate route option.
+ * (OPAL) Added ability to build with OPAL configured to disable H.323 or
+ SIP protocol support.
+ * Allowed "+ A B C D" dialing digits in called number.
+ * Added ignoring unrecognized dialing digits (V.250).
+ * Implemented dial string terminated by a semicolon ("ATD<dialstring>;[...]").
+ * Implemented fake Ring Tone and Busy Tone generation for voice-modem mode.
+ * Replaced hardcoded workaround for mgetty-voice by conditional-compiling one
+ (ALAW_132_BIT_REVERSE).
+ * Added ability to put called number to Caller ID info with NAME or NMBR tags.
+ * Fixed some other bugs and incompatibilities. Made some other improvements.
+ Added some other options.
+
Changelog for t38modem 1.2.0 (Oct 8 2009)
***************
*** 19,23 ****
* Fixed incompatibilities with some OS.
* (OPAL) Added ability to use route pattern "modem:.*@tty".
! * (OPAL) Added ability to enable/ audio formats.
* (OPAL) Removed --h323-old-asn and --sip-old-asn options.
* Fixed some other bugs.
--- 51,55 ----
* Fixed incompatibilities with some OS.
* (OPAL) Added ability to use route pattern "modem:.*@tty".
! * (OPAL) Added ability to enable/disadle/reorder audio formats.
* (OPAL) Removed --h323-old-asn and --sip-old-asn options.
* Fixed some other bugs.
Index: version.h
===================================================================
RCS file: /cvsroot/t38modem/t38modem/version.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** version.h 8 Oct 2009 16:19:45 -0000 1.30
--- version.h 13 Apr 2011 07:10:10 -0000 1.31
***************
*** 27,34 ****
#define _T38M_VERSION_H
! #define MAJOR_VERSION 1
! #define MINOR_VERSION 2
#define BUILD_TYPE ReleaseCode
! #define BUILD_NUMBER 1
#endif // _T38M_VERSION_H
--- 27,34 ----
#define _T38M_VERSION_H
! #define MAJOR_VERSION 2
! #define MINOR_VERSION 0
#define BUILD_TYPE ReleaseCode
! #define BUILD_NUMBER 0
#endif // _T38M_VERSION_H
|
|
From: Vyacheslav F. <vf...@us...> - 2011-01-19 17:18:02
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv4256 Modified Files: ReadMe.txt pmodeme.cxx Log Message: Extended AT#CIDFMT command for setting value format for NMBR tag Index: pmodeme.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/pmodeme.cxx,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** pmodeme.cxx 14 Jan 2011 20:32:11 -0000 1.106 --- pmodeme.cxx 19 Jan 2011 17:17:54 -0000 1.107 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.107 2011/01/19 17:17:54 vfrolov + * Extended AT#CIDFMT command for setting value format for NMBR tag + * * Revision 1.106 2011/01/14 20:32:11 vfrolov * Added DATE, TIME and NAME tags to Caller ID report *************** *** 415,424 **** class Profile { ! enum { ! MaxReg = 59, ! MaxRegVoice = MaxReg - 10, ! MinRegVoice = MaxRegVoice - 9, ! MaxBit = 7 ! }; public: --- 418,437 ---- class Profile { ! protected: ! #define PROFILE_SIZE_STD 40 ! #define PROFILE_SIZE_EXT 10 ! #define PROFILE_SIZE_VOICE 10 ! #define PROFILE_SIZE (PROFILE_SIZE_STD + PROFILE_SIZE_EXT + PROFILE_SIZE_VOICE) ! ! enum { ! MinRegStd = 0, ! MaxRegStd = MinRegStd + PROFILE_SIZE_STD - 1, ! MinRegExt = MaxRegStd + 1, ! MaxRegExt = MinRegExt + PROFILE_SIZE_EXT - 1, ! MinRegVoice = MaxRegExt + 1, ! MaxRegVoice = MinRegVoice + PROFILE_SIZE_VOICE - 1, ! ! MaxBit = 7, ! }; public: *************** *** 443,462 **** DeclareRegisterByte(DialTimeDTMF, 11); ! DeclareRegisterByte(CidNameFmt, MaxRegVoice - 8); ! DeclareRegisterByte(Vtd, MaxRegVoice - 7); ! DeclareRegisterByte(Vcml, MaxRegVoice - 6); ! DeclareRegisterByte(Vsds, MaxRegVoice - 5); ! DeclareRegisterByte(Vsdi, MaxRegVoice - 4); ! DeclareRegisterByte(VgrInterval, MaxRegVoice - 3); ! DeclareRegisterByte(VgtInterval, MaxRegVoice - 2); ! DeclareRegisterByte(VraInterval, MaxRegVoice - 1); ! DeclareRegisterByte(VrnInterval, MaxRegVoice - 0); ! DeclareRegisterByte(IfcByDCE, MaxReg - 5); ! DeclareRegisterByte(IfcByDTE, MaxReg - 4); ! DeclareRegisterByte(ClearMode, MaxReg - 3); ! DeclareRegisterByte(DelayFrmConnect, MaxReg - 2); ! DeclareRegisterByte(DidMode, MaxReg - 1); ! DeclareRegisterByte(CidMode, MaxReg - 0); void Flo(BYTE val) { IfcByDTE(val); IfcByDCE(val); } --- 456,484 ---- DeclareRegisterByte(DialTimeDTMF, 11); ! DeclareRegisterByte(IfcByDCE, MinRegExt + 0); ! DeclareRegisterByte(IfcByDTE, MinRegExt + 1); ! DeclareRegisterByte(ClearMode, MinRegExt + 2); ! DeclareRegisterByte(DelayFrmConnect, MinRegExt + 3); ! DeclareRegisterByte(DidMode, MinRegExt + 4); ! DeclareRegisterByte(CidMode, MinRegExt + 5); ! #if 5 >= PROFILE_SIZE_EXT ! #error *** The PROFILE_SIZE_EXT is too small to declare register *** ! #endif ! ! DeclareRegisterByte(Vtd, MinRegVoice + 0); ! DeclareRegisterByte(Vcml, MinRegVoice + 1); ! DeclareRegisterByte(Vsds, MinRegVoice + 2); ! DeclareRegisterByte(Vsdi, MinRegVoice + 3); ! DeclareRegisterByte(VgrInterval, MinRegVoice + 4); ! DeclareRegisterByte(VgtInterval, MinRegVoice + 5); ! DeclareRegisterByte(VraInterval, MinRegVoice + 6); ! DeclareRegisterByte(VrnInterval, MinRegVoice + 7); ! DeclareRegisterByte(CidNameFmt, MinRegVoice + 8); ! DeclareRegisterByte(CidNmbrFmt, MinRegVoice + 9); ! ! #if 9 >= PROFILE_SIZE_VOICE ! #error *** The PROFILE_SIZE_VOICE is too small to declare register *** ! #endif void Flo(BYTE val) { IfcByDTE(val); IfcByDCE(val); } *************** *** 536,540 **** protected: static PBoolean ChkR(PINDEX r) { ! return r <= MaxReg; } static PBoolean ChkB(PINDEX b) { --- 558,562 ---- protected: static PBoolean ChkR(PINDEX r) { ! return r < PROFILE_SIZE; } static PBoolean ChkB(PINDEX b) { *************** *** 554,560 **** } ! BYTE S[MaxReg + 1]; // S-registers PString modemClass; EngineBase::ModemClass modemClassId; }; --- 576,587 ---- } ! BYTE S[PROFILE_SIZE]; // S-registers PString modemClass; EngineBase::ModemClass modemClassId; + + #undef PROFILE_SIZE + #undef PROFILE_SIZE_VOICE + #undef PROFILE_SIZE_EXT + #undef PROFILE_SIZE_STD }; *************** *** 1185,1191 **** /////////////////////////////////////////////////////////////// Profile::Profile() { ! for( PINDEX r = 0 ; r <= MaxReg ; r++ ) { S[r] = 0; - } S7(60); --- 1212,1217 ---- /////////////////////////////////////////////////////////////// Profile::Profile() { ! for (PINDEX r = 0 ; r < PINDEX(sizeof(S)/sizeof(S[0])) ; r++) S[r] = 0; S7(60); *************** *** 1205,1211 **** Profile &Profile::operator=(const Profile &p) { ! for( PINDEX r = 0 ; r <= MaxReg ; r++ ) { S[r] = p.S[r]; ! } ModemClass(p.ModemClass()); return *this; --- 1231,1237 ---- Profile &Profile::operator=(const Profile &p) { ! for (PINDEX r = 0 ; r <= PINDEX(sizeof(S)/sizeof(S[0])) ; r++) S[r] = p.S[r]; ! ModemClass(p.ModemClass()); return *this; *************** *** 3509,3513 **** } ! resp.sprintf("\r\n%u", P.CidMode()); crlf = TRUE; break; --- 3535,3539 ---- } ! resp.sprintf("\r\n%u", cid); crlf = TRUE; break; *************** *** 3518,3535 **** switch (*pCmd++) { case '=': { ! int val = ParseNum(&pCmd, 1, 1, 3); ! if (val < 0) { err = TRUE; break; } PWaitAndSignal mutexWait(Mutex); ! P.CidNameFmt((BYTE)val); break; } case '?': ! resp.sprintf("\r\n%u", (unsigned)P.CidNameFmt()); crlf = TRUE; break; --- 3544,3576 ---- switch (*pCmd++) { case '=': { ! int name_format = P.CidNameFmt(); ! int nmbr_format = P.CidNmbrFmt(); ! name_format = ParseNum(&pCmd, 0, 1, 3, name_format); ! ! if (name_format < 0) { err = TRUE; break; } + if (*pCmd == ',') { + pCmd++; + + nmbr_format = ParseNum(&pCmd, 0, 1, 3, nmbr_format); + + if (nmbr_format < 0) { + err = TRUE; + break; + } + } + PWaitAndSignal mutexWait(Mutex); ! P.CidNameFmt((BYTE)name_format); ! P.CidNmbrFmt((BYTE)nmbr_format); break; } case '?': ! resp.sprintf("\r\n%u,%u", (unsigned)P.CidNameFmt(), (unsigned)P.CidNmbrFmt()); crlf = TRUE; break; *************** *** 3847,3851 **** resp += "DATE = " + callTime.AsString("MMdd") + "\r\n"; resp += "TIME = " + callTime.AsString("hhmm") + "\r\n"; ! resp += "NMBR = " + SrcNum() + "\r\n"; switch (P.CidNameFmt()) { --- 3888,3907 ---- resp += "DATE = " + callTime.AsString("MMdd") + "\r\n"; resp += "TIME = " + callTime.AsString("hhmm") + "\r\n"; ! ! switch (P.CidNmbrFmt()) { ! case 0: ! default: ! resp += "NMBR = " + SrcNum() + "\r\n"; ! break; ! case 1: ! resp += "NMBR = \r\n"; ! break; ! case 2: ! resp += "NMBR = " + DstNum() + "\r\n"; ! break; ! case 3: ! resp += "NMBR = " + DstNum() + "#" + SrcNum() + "\r\n"; ! break; ! } switch (P.CidNameFmt()) { Index: ReadMe.txt =================================================================== RCS file: /cvsroot/t38modem/t38modem/ReadMe.txt,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ReadMe.txt 14 Jan 2011 20:32:11 -0000 1.29 --- ReadMe.txt 19 Jan 2011 17:17:54 -0000 1.30 *************** *** 360,369 **** ---------------------- ! 4.6.1 Set value format for NAME tag of Caller ID ! ------------------------------------------------ ! #CIDFMT=0 - report "NAME = <calling name>" (default). ! #CIDFMT=1 - report "NAME = ". ! #CIDFMT=2 - report "NAME = <called number>". ! #CIDFMT=3 - report "NAME = <called number> <- <calling name>". --- 360,383 ---- ---------------------- ! AT#CIDFMT command allows to set value format for NAME and NMBR tags of Caller ID. ! Syntax: ! ! #CIDFMT=[<name format>][,[<nmbr format>]] ! ! If a format element is empty then its value will be untouched. ! ! Subparameter <name format>: ! ! 0 - report "NAME = <calling name>" (default) ! 1 - report "NAME = " ! 2 - report "NAME = <called number>" ! 3 - report "NAME = <called number> <- <calling name>" ! ! Subparameter <nmbr format>: ! ! 0 - report "NMBR = <calling number>" (default) ! 1 - report "NMBR = " ! 2 - report "NMBR = <called number>" ! 3 - report "NMBR = <called number>#<calling number>" |
|
From: Vyacheslav F. <vf...@us...> - 2011-01-19 11:41:27
|
Update of /cvsroot/t38modem/t38modem/opal In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv21742 Modified Files: h323ep.cxx sipep.cxx Log Message: Replaced deprecated ApplyStringOptions() by OnApplyStringOptions() Index: sipep.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/opal/sipep.cxx,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** sipep.cxx 13 Jan 2011 06:39:08 -0000 1.27 --- sipep.cxx 19 Jan 2011 11:41:17 -0000 1.28 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.28 2011/01/19 11:41:17 vfrolov + * Replaced deprecated ApplyStringOptions() by OnApplyStringOptions() + * * Revision 1.27 2011/01/13 06:39:08 vfrolov * Disabled OPAL version < 3.9.0 *************** *** 159,163 **** virtual PBoolean SetUpConnection(); ! virtual void ApplyStringOptions(OpalConnection::StringOptions & stringOptions); virtual bool SwitchFaxMediaStreams( --- 162,166 ---- virtual PBoolean SetUpConnection(); ! virtual void OnApplyStringOptions(); virtual bool SwitchFaxMediaStreams( *************** *** 423,428 **** } ! void MySIPConnection::ApplyStringOptions(OpalConnection::StringOptions & stringOptions) { if (LockReadWrite()) { mediaFormatList = OpalMediaFormatList(); --- 426,433 ---- } ! void MySIPConnection::OnApplyStringOptions() { + SIPConnection::OnApplyStringOptions(); + if (LockReadWrite()) { mediaFormatList = OpalMediaFormatList(); *************** *** 449,453 **** if (GetStringOptions().GetBoolean("Disable-T38-Mode")) { ! PTRACE(3, "MySIPConnection::ApplyStringOptions: Disable-T38-Mode=true"); } else { mediaFormatList += OpalT38; --- 454,458 ---- if (GetStringOptions().GetBoolean("Disable-T38-Mode")) { ! PTRACE(3, "MySIPConnection::OnApplyStringOptions: Disable-T38-Mode=true"); } else { mediaFormatList += OpalT38; *************** *** 456,466 **** mediaFormatList += OpalRFC2833; ! PTRACE(4, "MySIPConnection::ApplyStringOptions Enabled formats (in preference order):\n" << setfill('\n') << mediaFormatList << setfill(' ')); UnlockReadWrite(); } - - SIPConnection::ApplyStringOptions(stringOptions); } --- 461,469 ---- mediaFormatList += OpalRFC2833; ! PTRACE(4, "MySIPConnection::OnApplyStringOptions Enabled formats (in preference order):\n" << setfill('\n') << mediaFormatList << setfill(' ')); UnlockReadWrite(); } } Index: h323ep.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/opal/h323ep.cxx,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** h323ep.cxx 13 Jan 2011 06:39:08 -0000 1.24 --- h323ep.cxx 19 Jan 2011 11:41:17 -0000 1.25 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.25 2011/01/19 11:41:17 vfrolov + * Replaced deprecated ApplyStringOptions() by OnApplyStringOptions() + * * Revision 1.24 2011/01/13 06:39:08 vfrolov * Disabled OPAL version < 3.9.0 *************** *** 157,161 **** virtual PBoolean SetUpConnection(); ! virtual void ApplyStringOptions(OpalConnection::StringOptions & stringOptions); virtual PBoolean OnSendSignalSetup( --- 160,164 ---- virtual PBoolean SetUpConnection(); ! virtual void OnApplyStringOptions(); virtual PBoolean OnSendSignalSetup( *************** *** 429,434 **** } ! void MyH323Connection::ApplyStringOptions(OpalConnection::StringOptions & stringOptions) { if (LockReadWrite()) { mediaFormatList = OpalMediaFormatList(); --- 432,439 ---- } ! void MyH323Connection::OnApplyStringOptions() { + H323Connection::OnApplyStringOptions(); + if (LockReadWrite()) { mediaFormatList = OpalMediaFormatList(); *************** *** 455,459 **** if (GetStringOptions().GetBoolean("Disable-T38-Mode")) { ! PTRACE(3, "MyH323Connection::ApplyStringOptions: Disable-T38-Mode=true"); } else { mediaFormatList += OpalT38; --- 460,464 ---- if (GetStringOptions().GetBoolean("Disable-T38-Mode")) { ! PTRACE(3, "MyH323Connection::OnApplyStringOptions: Disable-T38-Mode=true"); } else { mediaFormatList += OpalT38; *************** *** 462,466 **** mediaFormatList += OpalRFC2833; ! PTRACE(4, "MyH323Connection::ApplyStringOptions Enabled formats (in preference order):\n" << setfill('\n') << mediaFormatList << setfill(' ')); --- 467,471 ---- mediaFormatList += OpalRFC2833; ! PTRACE(4, "MyH323Connection::OnApplyStringOptions Enabled formats (in preference order):\n" << setfill('\n') << mediaFormatList << setfill(' ')); *************** *** 479,483 **** iBC[3] >= 2 && iBC[3] <= 5) { ! PTRACE(3, "MyH323Connection::ApplyStringOptions: Bearer-Capability=" << bc); bearerCapability = iBC; } else { --- 484,488 ---- iBC[3] >= 2 && iBC[3] <= 5) { ! PTRACE(3, "MyH323Connection::OnApplyStringOptions: Bearer-Capability=" << bc); bearerCapability = iBC; } else { *************** *** 489,493 **** if (iBC[0] < 0) { ! PTRACE(3, "MyH323Connection::ApplyStringOptions: Wrong Bearer-Capability=" << bc << " (ignored)"); } } --- 494,498 ---- if (iBC[0] < 0) { ! PTRACE(3, "MyH323Connection::OnApplyStringOptions: Wrong Bearer-Capability=" << bc << " (ignored)"); } } *************** *** 495,500 **** UnlockReadWrite(); } - - H323Connection::ApplyStringOptions(stringOptions); } --- 500,503 ---- |
|
From: Vyacheslav F. <vf...@us...> - 2011-01-17 17:17:46
|
Update of /cvsroot/t38modem/t38modem/opal In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv26497 Modified Files: modemep.cxx Log Message: Disabled compiling with OPAL version != 3.9.0 (use SVN TRUNK 24174) Index: modemep.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/opal/modemep.cxx,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** modemep.cxx 14 Jan 2011 20:42:36 -0000 1.30 --- modemep.cxx 17 Jan 2011 17:17:38 -0000 1.31 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.31 2011/01/17 17:17:38 vfrolov + * Disabled compiling with OPAL version != 3.9.0 (use SVN TRUNK 24174) + * * Revision 1.30 2011/01/14 20:42:36 vfrolov * Added "srcname" to incoming call request *************** *** 125,128 **** --- 128,141 ---- #include <opal/buildopts.h> + ///////////////////////////////////////////////////////////////////////////// + #define PACK_VERSION(major, minor, build) (((((major) << 8) + (minor)) << 8) + (build)) + + #if !(PACK_VERSION(OPAL_MAJOR, OPAL_MINOR, OPAL_BUILD) == PACK_VERSION(3, 9, 0)) + #error *** Uncompatible OPAL version (required == 3.9.0, use SVN TRUNK 24174) *** + #endif + + #undef PACK_VERSION + ///////////////////////////////////////////////////////////////////////////// + #include <opal/patch.h> |
|
From: Vyacheslav F. <vf...@us...> - 2011-01-17 08:33:26
|
Update of /cvsroot/t38modem/t38modem/opal In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv27713 Modified Files: manager.cxx Log Message: Added --displayname option Index: manager.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/opal/manager.cxx,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** manager.cxx 9 Jul 2010 13:18:13 -0000 1.15 --- manager.cxx 17 Jan 2011 08:33:17 -0000 1.16 *************** *** 4,8 **** * T38FAX Pseudo Modem * ! * Copyright (c) 2007-2010 Vyacheslav Frolov * * Open H323 Project --- 4,8 ---- * T38FAX Pseudo Modem * ! * Copyright (c) 2007-2011 Vyacheslav Frolov * * Open H323 Project *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.16 2011/01/17 08:33:17 vfrolov + * Added --displayname option + * * Revision 1.15 2010/07/09 13:18:13 vfrolov * Fixed help message *************** *** 114,117 **** --- 117,121 ---- "-route:" "u-username:" + "-displayname:" "-stun:" "-fake-audio:" *************** *** 138,141 **** --- 142,148 ---- " of a pat=dst[;...] route specification.\n" " -u --username str : Set the default username to str.\n" + " --displayname str : Set the default display name to str.\n" + " Can be overriden by route option\n" + " OPAL-" OPAL_OPT_CALLING_DISPLAY_NAME "=str\n" " --stun server : Set STUN server.\n" " --fake-audio [!]wildcard[,[!]...]\n" *************** *** 238,241 **** --- 245,251 ---- ); + if (args.HasOption("displayname")) + SetDefaultDisplayName(args.GetOptionString("displayname")); + if (args.HasOption("stun")) SetSTUNServer(args.GetOptionString("stun")); |
|
From: Vyacheslav F. <vf...@us...> - 2011-01-14 20:42:44
|
Update of /cvsroot/t38modem/t38modem/opal In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv30298 Modified Files: modemep.cxx Log Message: Added "srcname" to incoming call request Thanks Dmitry (gorod225) Index: modemep.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/opal/modemep.cxx,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** modemep.cxx 6 Oct 2010 16:54:19 -0000 1.29 --- modemep.cxx 14 Jan 2011 20:42:36 -0000 1.30 *************** *** 4,8 **** * T38FAX Pseudo Modem * ! * Copyright (c) 2007-2010 Vyacheslav Frolov * * Open H323 Project --- 4,8 ---- * T38FAX Pseudo Modem * ! * Copyright (c) 2007-2011 Vyacheslav Frolov * * Open H323 Project *************** *** 25,28 **** --- 25,32 ---- * * $Log$ + * Revision 1.30 2011/01/14 20:42:36 vfrolov + * Added "srcname" to incoming call request + * Thanks Dmitry (gorod225) + * * Revision 1.29 2010/10/06 16:54:19 vfrolov * Redesigned engine opening/closing *************** *** 681,684 **** --- 685,689 ---- PString srcNum; + PString srcName; { *************** *** 689,692 **** --- 694,698 ---- srcNum = other->GetRemotePartyNumber(); + srcName = other->GetRemotePartyName(); } *************** *** 696,699 **** --- 702,706 ---- << " dstNum=" << dstNum << " srcNum=" << srcNum + << " srcName=" << srcName << " ..."); *************** *** 720,723 **** --- 727,731 ---- request.SetAt("calltoken", GetToken()); request.SetAt("srcnum", srcNum); + request.SetAt("srcname", srcName); request.SetAt("dstnum", dstNum); |
|
From: Vyacheslav F. <vf...@us...> - 2011-01-14 20:32:19
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28079 Modified Files: ReadMe.txt pmodeme.cxx Log Message: Added DATE, TIME and NAME tags to Caller ID report Added AT#CIDFMT command Index: pmodeme.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/pmodeme.cxx,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** pmodeme.cxx 12 Jan 2011 12:23:43 -0000 1.105 --- pmodeme.cxx 14 Jan 2011 20:32:11 -0000 1.106 *************** *** 25,28 **** --- 25,32 ---- * * $Log$ + * Revision 1.106 2011/01/14 20:32:11 vfrolov + * Added DATE, TIME and NAME tags to Caller ID report + * Added AT#CIDFMT command + * * Revision 1.105 2011/01/12 12:23:43 vfrolov * Replaced hardcoded workaround for mgetty-voice by conditional one *************** *** 439,442 **** --- 443,447 ---- DeclareRegisterByte(DialTimeDTMF, 11); + DeclareRegisterByte(CidNameFmt, MaxRegVoice - 8); DeclareRegisterByte(Vtd, MaxRegVoice - 7); DeclareRegisterByte(Vcml, MaxRegVoice - 6); *************** *** 1041,1046 **** --- 1046,1054 ---- PMutex Mutex; + PTime callTime; + DeclareStringParam(CallToken) DeclareStringParam(SrcNum) + DeclareStringParam(SrcName) DeclareStringParam(DstNum) *************** *** 1362,1368 **** CallToken(request("calltoken")); SrcNum(request("srcnum")); DstNum(request("dstnum")); ! timerRing.Start(5000); P.RingCount(0); request.SetAt("response", "confirm"); } --- 1370,1378 ---- CallToken(request("calltoken")); SrcNum(request("srcnum")); + SrcName(request("srcname")); DstNum(request("dstnum")); ! callTime = PTime(); P.RingCount(0); + timerRing.Start(5000); request.SetAt("response", "confirm"); } *************** *** 2658,2662 **** break; default: { - PWaitAndSignal mutexWait(Mutex); const char *modemClass; --- 2668,2671 ---- *************** *** 2677,2680 **** --- 2686,2690 ---- if (modemClass) { + PWaitAndSignal mutexWait(Mutex); P.ModemClass(modemClass); OnChangeModemClass(); *************** *** 3503,3506 **** --- 3513,3544 ---- break; } + case 'F': + if (strncmp(pCmd, "MT", 2) == 0) { // #CIDFMT + pCmd += 2; + switch (*pCmd++) { + case '=': { + int val = ParseNum(&pCmd, 1, 1, 3); + + if (val < 0) { + err = TRUE; + break; + } + + PWaitAndSignal mutexWait(Mutex); + P.CidNameFmt((BYTE)val); + + break; + } + case '?': + resp.sprintf("\r\n%u", (unsigned)P.CidNameFmt()); + crlf = TRUE; + break; + default: + err = TRUE; + } + } else { + err = TRUE; + } + break; default: err = TRUE; *************** *** 3805,3815 **** BYTE ringCount = P.RingCount(); if (!ringCount) { ! if(P.CidMode()) ! resp += "NMBR = " + SrcNum() + "\r\n"; ! if(P.DidMode()) ! resp += "NDID = " + DstNum() + "\r\n"; ! if(P.CidMode() || P.DidMode()) resp += RC_RING(); } P.RingCount(++ringCount); --- 3843,3876 ---- BYTE ringCount = P.RingCount(); if (!ringCount) { ! if (P.CidMode() || P.DidMode()) { ! if (P.CidMode()) { ! resp += "DATE = " + callTime.AsString("MMdd") + "\r\n"; ! resp += "TIME = " + callTime.AsString("hhmm") + "\r\n"; ! resp += "NMBR = " + SrcNum() + "\r\n"; ! ! switch (P.CidNameFmt()) { ! case 0: ! default: ! resp += "NAME = " + SrcName() + "\r\n"; ! break; ! case 1: ! resp += "NAME = \r\n"; ! break; ! case 2: ! resp += "NAME = " + DstNum() + "\r\n"; ! break; ! case 3: ! resp += "NAME = " + DstNum() + " <- " + SrcName() + "\r\n"; ! break; ! } ! } ! ! if (P.DidMode()) ! resp += "NDID = " + DstNum() + "\r\n"; ! resp += RC_RING(); + } } + P.RingCount(++ringCount); Index: ReadMe.txt =================================================================== RCS file: /cvsroot/t38modem/t38modem/ReadMe.txt,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ReadMe.txt 7 Oct 2010 05:33:18 -0000 1.28 --- ReadMe.txt 14 Jan 2011 20:32:11 -0000 1.29 *************** *** 215,225 **** ------------------- ! 4.1.1 calling/called number reporting ! ------------------------------------- ! #CID=0 - disables calling/called number reporting (default). ! #CID=1 - Enables only calling number reporting after the first RING. ! #CID=10 - Enables calling/called number reporting after the first RING. ! #CID=11 - Enables only called number reporting after the first RING. Example: --- 215,225 ---- ------------------- ! 4.1.1 Reporting Caller ID and DID after the first RING ! ------------------------------------------------------ ! #CID=0 - disable Caller ID and DID reporting (default). ! #CID=1 - enable only Caller ID reporting. ! #CID=10 - enable Caller ID and DID reporting. ! #CID=11 - enable only DID reporting. Example: *************** *** 228,233 **** --> OK --> RING ! --> NMBR = <calling number> ! --> NDID = <called number> --> RING --> RING --- 228,236 ---- --> OK --> RING ! --> DATE = <MMDD> ; Caller ID ! --> TIME = <HHMM> ; Caller ID ! --> NMBR = <calling number> ; Caller ID ! --> NAME = <calling name> ; Caller ID ! --> NDID = <called number> ; DID --> RING --> RING *************** *** 353,354 **** --- 356,369 ---- #HCLR=0 - ATH command will not clear not answered incoming call (default). #HCLR=1 - ATH command will clear not answered incoming call. + + 4.6. AT#CIDFMT command + ---------------------- + + 4.6.1 Set value format for NAME tag of Caller ID + ------------------------------------------------ + + #CIDFMT=0 - report "NAME = <calling name>" (default). + #CIDFMT=1 - report "NAME = ". + #CIDFMT=2 - report "NAME = <called number>". + #CIDFMT=3 - report "NAME = <called number> <- <calling name>". + |
|
From: Vyacheslav F. <vf...@us...> - 2011-01-13 06:39:16
|
Update of /cvsroot/t38modem/t38modem/opal In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28210 Modified Files: h323ep.cxx sipep.cxx Log Message: Disabled OPAL version < 3.9.0 Added route options help topic Index: sipep.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/opal/sipep.cxx,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** sipep.cxx 15 Mar 2010 14:32:02 -0000 1.26 --- sipep.cxx 13 Jan 2011 06:39:08 -0000 1.27 *************** *** 4,8 **** * T38FAX Pseudo Modem * ! * Copyright (c) 2007-2010 Vyacheslav Frolov * * Open H323 Project --- 4,8 ---- * T38FAX Pseudo Modem * ! * Copyright (c) 2007-2011 Vyacheslav Frolov * * Open H323 Project *************** *** 25,28 **** --- 25,32 ---- * * $Log$ + * Revision 1.27 2011/01/13 06:39:08 vfrolov + * Disabled OPAL version < 3.9.0 + * Added route options help topic + * * Revision 1.26 2010/03/15 14:32:02 vfrolov * Added options *************** *** 118,127 **** #define PACK_VERSION(major, minor, build) (((((major) << 8) + (minor)) << 8) + (build)) ! #if !(PACK_VERSION(OPAL_MAJOR, OPAL_MINOR, OPAL_BUILD) >= PACK_VERSION(3, 8, 1)) ! #error *** Uncompatible OPAL version (required >= 3.8.1) *** ! #endif ! ! #if PACK_VERSION(OPAL_MAJOR, OPAL_MINOR, OPAL_BUILD) >= PACK_VERSION(3, 9, 0) ! #define HAS_T38_UDPTL_IDLE_TIMER 1 #endif --- 122,127 ---- #define PACK_VERSION(major, minor, build) (((((major) << 8) + (minor)) << 8) + (build)) ! #if !(PACK_VERSION(OPAL_MAJOR, OPAL_MINOR, OPAL_BUILD) >= PACK_VERSION(3, 9, 0)) ! #error *** Uncompatible OPAL version (required >= 3.9.0) *** #endif *************** *** 212,243 **** "SIP options:\n" " --no-sip : Disable SIP protocol.\n" ! " --sip-audio [!]wildcard[,[!]...]\n" ! " : Enable the audio format(s) matching the\n" ! " wildcard(s). The '*' character match any\n" ! " substring. The leading '!' character indicates\n" ! " a negative test.\n" ! " Default: " OPAL_G711_ULAW_64K "," OPAL_G711_ALAW_64K ".\n" ! " May be used multiple times.\n" ! " Can be overriden by route option\n" ! " OPAL-Enable-Audio=[!]wildcard[,[!]...]\n" " --sip-audio-list : Display available audio formats.\n" ! " --sip-disable-t38-mode : Disable T.38 fax mode.\n" ! " Can be overriden by route option\n" ! " OPAL-Disable-T38-Mode=false\n" ! " --sip-t38-udptl-redundancy maxsize:redundancy[,maxsize:redundancy...]\n" ! " : Set error recovery redundancy for IFP packets\n" ! " dependent from their size. For example:\n" ! " '2:I,9:L,32767:H' (where I, L and H are numbers)\n" ! " sets redundancy for (I)ndication, (L)ow speed and\n" ! " (H)igh speed IFP packets.\n" ! " Can be overriden by route option\n" ! " T38-UDPTL-Redundancy=[maxsize:redundancy...]\n" ! #if HAS_T38_UDPTL_IDLE_TIMER " --sip-t38-udptl-keep-alive-interval ms\n" ! " : Continuously resend last UDPTL packet each ms\n" ! " milliseconds.\n" ! " Can be overriden by route option\n" ! " T38-UDPTL-Keep-Alive-Interval=ms\n" ! #endif " --sip-proxy [user:[pwd]@]host\n" " : Proxy information.\n" --- 212,226 ---- "SIP options:\n" " --no-sip : Disable SIP protocol.\n" ! " --sip-audio str : Use OPAL-Enable-Audio=str route option by\n" ! " default. May be used multiple times.\n" " --sip-audio-list : Display available audio formats.\n" ! " --sip-disable-t38-mode : Use OPAL-Disable-T38-Mode=true route option by\n" ! " default.\n" ! " --sip-t38-udptl-redundancy str\n" ! " : Use OPAL-T38-UDPTL-Redundancy=str route option by\n" ! " default.\n" " --sip-t38-udptl-keep-alive-interval ms\n" ! " : Use OPAL-T38-UDPTL-Keep-Alive-Interval=ms route\n" ! " option by default.\n" " --sip-proxy [user:[pwd]@]host\n" " : Proxy information.\n" *************** *** 249,252 **** --- 232,260 ---- " : udp$*:5060).\n" " --sip-no-listen : Disable listen for incoming calls.\n" + "\n" + "SIP route options:\n" + " OPAL-Enable-Audio=[!]wildcard[,[!]...]\n" + " Enable the audio format(s) matching the wildcard(s). The '*' character\n" + " match any substring. The leading '!' character indicates a negative test.\n" + " Default: " OPAL_G711_ULAW_64K "," OPAL_G711_ALAW_64K ".\n" + " OPAL-Disable-T38-Mode={true|false}\n" + " Enable or disable T.38 fax mode.\n" + " Default: false (enable T.38 fax mode).\n" + " OPAL-T38-UDPTL-Redundancy=[maxsize:redundancy[,maxsize:redundancy...]]\n" + " Set error recovery redundancy for IFP packets dependent from their size.\n" + " For example the string '2:I,9:L,32767:H' (where I, L and H are numbers)\n" + " sets redundancy for (I)ndication, (L)ow speed and (H)igh speed IFP packets.\n" + " Default: empty string (no redundancy).\n" + " OPAL-T38-UDPTL-Redundancy-Interval=ms\n" + " Continuously resend last UDPTL packet each ms milliseconds on idle till it\n" + " contains IFP packets not sent redundancy times.\n" + " Default: 50.\n" + " OPAL-T38-UDPTL-Keep-Alive-Interval=ms\n" + " Continuously resend last UDPTL packet each ms milliseconds on idle.\n" + " Default: 0 (no resend).\n" + " OPAL-T38-UDPTL-Optimise-On-Retransmit={true|false}\n" + " Optimize UDPTL packets on resending in accordance with required redundancy\n" + " (exclude redundancy IFP packets sent redundancy times).\n" + " Default: true (optimize).\n" ).Lines(); Index: h323ep.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/opal/h323ep.cxx,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** h323ep.cxx 15 Mar 2010 14:31:30 -0000 1.23 --- h323ep.cxx 13 Jan 2011 06:39:08 -0000 1.24 *************** *** 4,8 **** * T38FAX Pseudo Modem * ! * Copyright (c) 2007-2010 Vyacheslav Frolov * * Open H323 Project --- 4,8 ---- * T38FAX Pseudo Modem * ! * Copyright (c) 2007-2011 Vyacheslav Frolov * * Open H323 Project *************** *** 25,28 **** --- 25,32 ---- * * $Log$ + * Revision 1.24 2011/01/13 06:39:08 vfrolov + * Disabled OPAL version < 3.9.0 + * Added route options help topic + * * Revision 1.23 2010/03/15 14:31:30 vfrolov * Added options *************** *** 110,119 **** #define PACK_VERSION(major, minor, build) (((((major) << 8) + (minor)) << 8) + (build)) ! #if !(PACK_VERSION(OPAL_MAJOR, OPAL_MINOR, OPAL_BUILD) >= PACK_VERSION(3, 8, 1)) ! #error *** Uncompatible OPAL version (required >= 3.8.1) *** ! #endif ! ! #if PACK_VERSION(OPAL_MAJOR, OPAL_MINOR, OPAL_BUILD) >= PACK_VERSION(3, 9, 0) ! #define HAS_T38_UDPTL_IDLE_TIMER 1 #endif --- 114,119 ---- #define PACK_VERSION(major, minor, build) (((((major) << 8) + (minor)) << 8) + (build)) ! #if !(PACK_VERSION(OPAL_MAJOR, OPAL_MINOR, OPAL_BUILD) >= PACK_VERSION(3, 9, 0)) ! #error *** Uncompatible OPAL version (required >= 3.9.0) *** #endif *************** *** 226,257 **** "H.323 options:\n" " --no-h323 : Disable H.323 protocol.\n" ! " --h323-audio [!]wildcard[,[!]...]\n" ! " : Enable the audio format(s) matching the\n" ! " wildcard(s). The '*' character match any\n" ! " substring. The leading '!' character indicates\n" ! " a negative test.\n" ! " Default: " OPAL_G711_ULAW_64K "," OPAL_G711_ALAW_64K ".\n" ! " May be used multiple times.\n" ! " Can be overriden by route option\n" ! " OPAL-Enable-Audio=[!]wildcard[,[!]...]\n" " --h323-audio-list : Display available audio formats.\n" ! " --h323-disable-t38-mode : Disable T.38 fax mode.\n" ! " Can be overriden by route option\n" ! " OPAL-Disable-T38-Mode=false\n" ! " --h323-t38-udptl-redundancy maxsize:redundancy[,maxsize:redundancy...]\n" ! " : Set error recovery redundancy for IFP packets\n" ! " dependent from their size. For example:\n" ! " '2:I,9:L,32767:H' (where I, L and H are numbers)\n" ! " sets redundancy for (I)ndication, (L)ow speed and\n" ! " (H)igh speed IFP packets.\n" ! " Can be overriden by route option\n" ! " T38-UDPTL-Redundancy=[maxsize:redundancy...]\n" ! #if HAS_T38_UDPTL_IDLE_TIMER " --h323-t38-udptl-keep-alive-interval ms\n" ! " : Continuously resend last UDPTL packet each ms\n" ! " milliseconds.\n" ! " Can be overriden by route option\n" ! " T38-UDPTL-Keep-Alive-Interval=ms\n" ! #endif " -F --fastenable : Enable fast start.\n" " -T --h245tunneldisable : Disable H245 tunnelling.\n" --- 226,240 ---- "H.323 options:\n" " --no-h323 : Disable H.323 protocol.\n" ! " --h323-audio str : Use OPAL-Enable-Audio=str route option by\n" ! " default. May be used multiple times.\n" " --h323-audio-list : Display available audio formats.\n" ! " --h323-disable-t38-mode : Use OPAL-Disable-T38-Mode=true route option by\n" ! " default.\n" ! " --h323-t38-udptl-redundancy str\n" ! " : Use OPAL-T38-UDPTL-Redundancy=str route option by\n" ! " default.\n" " --h323-t38-udptl-keep-alive-interval ms\n" ! " : Use OPAL-T38-UDPTL-Keep-Alive-Interval=ms route\n" ! " option by default.\n" " -F --fastenable : Enable fast start.\n" " -T --h245tunneldisable : Disable H245 tunnelling.\n" *************** *** 262,273 **** " -n --no-gatekeeper : Disable gatekeeper discovery.\n" " --require-gatekeeper : Exit if gatekeeper discovery fails.\n" ! " --h323-bearer-capability S:C:R:P\n" ! " : Bearer capability information element (Q.931)\n" ! " S - coding standard (0-3)\n" ! " C - information transfer capability (0-31)\n" ! " R - information transfer rate (1-127)\n" ! " P - user information layer 1 protocol (2-5).\n" ! " Can be overriden by route option\n" ! " OPAL-Bearer-Capability=S:C:R:P\n" ).Lines(); --- 245,282 ---- " -n --no-gatekeeper : Disable gatekeeper discovery.\n" " --require-gatekeeper : Exit if gatekeeper discovery fails.\n" ! " --h323-bearer-capability str\n" ! " : Use OPAL-Bearer-Capability=str route option by\n" ! " default.\n" ! "\n" ! "H.323 route options:\n" ! " OPAL-Enable-Audio=[!]wildcard[,[!]...]\n" ! " Enable the audio format(s) matching the wildcard(s). The '*' character\n" ! " match any substring. The leading '!' character indicates a negative test.\n" ! " Default: " OPAL_G711_ULAW_64K "," OPAL_G711_ALAW_64K ".\n" ! " OPAL-Disable-T38-Mode={true|false}\n" ! " Enable or disable T.38 fax mode.\n" ! " Default: false (enable T.38 fax mode).\n" ! " OPAL-T38-UDPTL-Redundancy=[maxsize:redundancy[,maxsize:redundancy...]]\n" ! " Set error recovery redundancy for IFP packets dependent from their size.\n" ! " For example the string '2:I,9:L,32767:H' (where I, L and H are numbers)\n" ! " sets redundancy for (I)ndication, (L)ow speed and (H)igh speed IFP packets.\n" ! " Default: empty string (no redundancy).\n" ! " OPAL-T38-UDPTL-Redundancy-Interval=ms\n" ! " Continuously resend last UDPTL packet each ms milliseconds on idle till it\n" ! " contains IFP packets not sent redundancy times.\n" ! " Default: 50.\n" ! " OPAL-T38-UDPTL-Keep-Alive-Interval=ms\n" ! " Continuously resend last UDPTL packet each ms milliseconds on idle.\n" ! " Default: 0 (no resend).\n" ! " OPAL-T38-UDPTL-Optimise-On-Retransmit={true|false}\n" ! " Optimize UDPTL packets on resending in accordance with required redundancy\n" ! " (exclude redundancy IFP packets sent redundancy times).\n" ! " Default: true (optimize).\n" ! " OPAL-Bearer-Capability=S:C:R:P\n" ! " Set bearer capability information element (Q.931) with\n" ! " S - coding standard (0-3)\n" ! " C - information transfer capability (0-31)\n" ! " R - information transfer rate (1-127)\n" ! " P - user information layer 1 protocol (2-5).\n" ).Lines(); |
|
From: Vyacheslav F. <vf...@us...> - 2011-01-12 12:23:51
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv3933 Modified Files: pmodeme.cxx Makefile Log Message: Replaced hardcoded workaround for mgetty-voice by conditional one Index: pmodeme.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/pmodeme.cxx,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** pmodeme.cxx 28 Dec 2010 12:29:07 -0000 1.104 --- pmodeme.cxx 12 Jan 2011 12:23:43 -0000 1.105 *************** *** 4,8 **** * T38FAX Pseudo Modem * ! * Copyright (c) 2001-2010 Vyacheslav Frolov * * Open H323 Project --- 4,8 ---- * T38FAX Pseudo Modem * ! * Copyright (c) 2001-2011 Vyacheslav Frolov * * Open H323 Project *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.105 2011/01/12 12:23:43 vfrolov + * Replaced hardcoded workaround for mgetty-voice by conditional one + * * Revision 1.104 2010/12/28 12:29:07 vfrolov * Disabled echo in non-command state *************** *** 820,830 **** switch (P.ModemClassId()) { case EngineBase::mcAudio: ! switch (P.Vcml()) { ! case 132: ! dleData.BitRev(TRUE); ! break; ! default: ! dleData.BitRev(FALSE); ! } break; case EngineBase::mcFax: --- 823,831 ---- switch (P.ModemClassId()) { case EngineBase::mcAudio: ! dleData.BitRev( ! #ifdef ALAW_132_BIT_REVERSE ! P.Vcml() == 132 ? TRUE : ! #endif ! FALSE); break; case EngineBase::mcFax: Index: Makefile =================================================================== RCS file: /cvsroot/t38modem/t38modem/Makefile,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Makefile 12 Oct 2010 16:46:25 -0000 1.28 --- Makefile 12 Jan 2011 12:23:43 -0000 1.29 *************** *** 4,8 **** # T38FAX Pseudo Modem # ! # Copyright (c) 2001-2010 Vyacheslav Frolov # # t38modem Project --- 4,8 ---- # T38FAX Pseudo Modem # ! # Copyright (c) 2001-2011 Vyacheslav Frolov # # t38modem Project *************** *** 25,28 **** --- 25,31 ---- # # $Log$ + # Revision 1.29 2011/01/12 12:23:43 vfrolov + # Replaced hardcoded workaround for mgetty-voice by conditional one + # # Revision 1.28 2010/10/12 16:46:25 vfrolov # Implemented fake streams *************** *** 225,226 **** --- 228,238 ---- endif + # + # If defined ALAW_132_BIT_REVERSE then t38modem + # will use reversed bit order for +VSM=132 + # (workaround for mgetty-voice) + # + ifdef ALAW_132_BIT_REVERSE + STDCCFLAGS += -DALAW_132_BIT_REVERSE + endif + |
|
From: Vyacheslav F. <vf...@us...> - 2010-12-29 12:35:49
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv711 Modified Files: audio.cxx Log Message: Fixed mutex locking Index: audio.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/audio.cxx,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** audio.cxx 12 Oct 2010 16:46:25 -0000 1.17 --- audio.cxx 29 Dec 2010 12:35:41 -0000 1.18 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.18 2010/12/29 12:35:41 vfrolov + * Fixed mutex locking + * * Revision 1.17 2010/10/12 16:46:25 vfrolov * Implemented fake streams *************** *** 318,322 **** if (hOwnerOut != hOwner || !IsModemOpen()) ! return 0; if (firstOut) { --- 321,325 ---- if (hOwnerOut != hOwner || !IsModemOpen()) ! return FALSE; if (firstOut) { *************** *** 495,499 **** if (hOwnerIn != hOwner || !IsModemOpen()) ! return 0; if (firstIn) { --- 498,502 ---- if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; if (firstIn) { *************** *** 506,558 **** writeDelay.Restart(); } - } ! Mutex.Wait(); ! if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; ! if (buffer) { ! if (recvAudio && !recvAudio->isFull()) { ! recvAudio->PutData(buffer, len); ! ModemCallbackWithUnlock(callbackParam); ! if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; ! } ! if (t30ToneDetect && t30ToneDetect->Write(buffer, len)) { ! OnUserInput('c'); ! if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; ! } ! } else { ! if (recvAudio && !recvAudio->isFull()) { ! for (PINDEX rest = len ; rest > 0 ;) { ! BYTE buf[64*BYTES_PER_SIMPLE]; ! PINDEX lenChank = rest; ! if (lenChank > (PINDEX)sizeof(buf)) ! lenChank = (PINDEX)sizeof(buf); ! if (pToneIn) ! pToneIn->Read(buf, lenChank); ! else ! memset(buf, 0, lenChank); ! recvAudio->PutData(buf, lenChank); ! rest -= lenChank; } - - ModemCallbackWithUnlock(callbackParam); - - if (hOwnerIn != hOwner || !IsModemOpen()) - return FALSE; } } - Mutex.Signal(); - writeDelay.Delay(len/BYTES_PER_MSEC); --- 509,554 ---- writeDelay.Restart(); } ! if (buffer) { ! if (recvAudio && !recvAudio->isFull()) { ! recvAudio->PutData(buffer, len); ! ModemCallbackWithUnlock(callbackParam); ! if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; ! } ! if (t30ToneDetect && t30ToneDetect->Write(buffer, len)) { ! OnUserInput('c'); ! if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; ! } ! } else { ! if (recvAudio && !recvAudio->isFull()) { ! for (PINDEX rest = len ; rest > 0 ;) { ! BYTE buf[64*BYTES_PER_SIMPLE]; ! PINDEX lenChank = rest; ! if (lenChank > (PINDEX)sizeof(buf)) ! lenChank = (PINDEX)sizeof(buf); ! if (pToneIn) ! pToneIn->Read(buf, lenChank); ! else ! memset(buf, 0, lenChank); ! recvAudio->PutData(buf, lenChank); ! rest -= lenChank; ! } ! ModemCallbackWithUnlock(callbackParam); ! if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; } } } writeDelay.Delay(len/BYTES_PER_MSEC); |
|
From: Vyacheslav F. <vf...@us...> - 2010-12-28 12:29:15
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv31663 Modified Files: pmodeme.cxx Log Message: Disabled echo in non-command state Index: pmodeme.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/pmodeme.cxx,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** pmodeme.cxx 12 Oct 2010 16:46:25 -0000 1.103 --- pmodeme.cxx 28 Dec 2010 12:29:07 -0000 1.104 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.104 2010/12/28 12:29:07 vfrolov + * Disabled echo in non-command state + * * Revision 1.103 2010/10/12 16:46:25 vfrolov * Implemented fake streams *************** *** 3648,3653 **** PTRACE(4, "--> DLE " << lendone << " bytes"); - if (Echo()) - bresp.Concatenate(PBYTEArray(pBuf, lendone)); len -= lendone; pBuf += lendone; --- 3651,3654 ---- *************** *** 3740,3745 **** default: myPTRACE(1, "Reset state " << state); ! if( Echo() ) ! bresp.Concatenate(PBYTEArray(pBuf, 1)); len--; pBuf++; --- 3741,3745 ---- default: myPTRACE(1, "Reset state " << state); ! len--; pBuf++; |
|
From: Vyacheslav F. <vf...@us...> - 2010-12-28 12:27:30
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv31228 Modified Files: drv_c0c.cxx Log Message: Added fTXContinueOnXoff to prevent deadlock Index: drv_c0c.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/drv_c0c.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** drv_c0c.cxx 8 Jul 2009 18:43:44 -0000 1.12 --- drv_c0c.cxx 28 Dec 2010 12:27:22 -0000 1.13 *************** *** 4,8 **** * T38FAX Pseudo Modem * ! * Copyright (c) 2004-2009 Vyacheslav Frolov * * Open H323 Project --- 4,8 ---- * T38FAX Pseudo Modem * ! * Copyright (c) 2004-2010 Vyacheslav Frolov * * Open H323 Project *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.13 2010/12/28 12:27:22 vfrolov + * Added fTXContinueOnXoff to prevent deadlock + * * Revision 1.12 2009/07/08 18:43:44 vfrolov * Added PseudoModem::ttyName() *************** *** 400,403 **** --- 403,428 ---- case WAIT_TIMEOUT: myPTRACE(6, "TIMEOUT"); + + //#if PTRACING + // if (PTrace::CanTrace(6)) { + // DWORD errors; + // COMSTAT comstat; + // + // if (ClearCommError(hC0C, &errors, &comstat)) { + // PTRACE(1, + // "errors=" << hex << errors << dec << " " + // "fCtsHold=" << comstat.fCtsHold << " " + // "fDsrHold=" << comstat.fDsrHold << " " + // "fRlsdHold=" << comstat.fRlsdHold << " " + // "fXoffHold=" << comstat.fXoffHold << " " + // "fXoffSent=" << comstat.fXoffSent << " " + // "fEof=" << comstat.fEof << " " + // "fTxim=" << comstat.fTxim << " " + // "cbInQue=" << comstat.cbInQue << " " + // "cbOutQue=" << comstat.cbOutQue); + // } + // } + //#endif + break; default: *************** *** 511,514 **** --- 536,541 ---- reset = TRUE; + PTRACE(3, "PseudoModemC0C::StartAll"); + if (IsOpenC0C() && (inC0C = new InC0C(*this, hC0C)) != NULL *************** *** 529,532 **** --- 556,561 ---- ready = FALSE; + PTRACE(3, "PseudoModemC0C::StopAll reset=" << reset << " stop=" << stop << " childstop=" << childstop); + if (inC0C) { inC0C->SignalStop(); *************** *** 594,597 **** --- 623,627 ---- dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; dcb.fDtrControl = DTR_CONTROL_ENABLE; + dcb.fTXContinueOnXoff = TRUE; dcb.fOutX = FALSE; dcb.fInX = TRUE; |
|
From: Vyacheslav F. <vf...@us...> - 2010-10-12 16:46:34
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv31675 Modified Files: Makefile audio.cxx audio.h enginebase.cxx enginebase.h pmodeme.cxx t30tone.cxx t30tone.h t38engine.cxx t38engine.h Log Message: Implemented fake streams Index: pmodeme.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/pmodeme.cxx,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** pmodeme.cxx 8 Oct 2010 12:31:03 -0000 1.102 --- pmodeme.cxx 12 Oct 2010 16:46:25 -0000 1.103 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.103 2010/10/12 16:46:25 vfrolov + * Implemented fake streams + * * Revision 1.102 2010/10/08 12:31:03 vfrolov * Optimized Mutex usage *************** *** 780,783 **** --- 783,787 ---- void HandleData(const PBYTEArray &buf, PBYTEArray &bresp); void CheckState(PBYTEArray &bresp); + void CheckStatePost(); PBoolean IsReady() const { *************** *** 902,905 **** --- 906,912 ---- EngineBase *currentClassEngine; + PBoolean enableFakeIn[mceNumberOfItems]; + PBoolean enableFakeOut[mceNumberOfItems]; + const PNotifier callbackEndPoint; *************** *** 982,986 **** void OnChangeModemClass() { ! for (int i = 0 ; i < (int)(sizeof(activeEngines)/sizeof(activeEngines[0])) ; i++) { if (activeEngines[i]) activeEngines[i]->ChangeModemClass(P.ModemClassId()); --- 989,993 ---- void OnChangeModemClass() { ! for (int i = 0 ; i < mceNumberOfItems ; i++) { if (activeEngines[i]) activeEngines[i]->ChangeModemClass(P.ModemClassId()); *************** *** 1005,1009 **** PTRACE(4, "ModemEngineBody::SendOnIdle " << sendOnIdle); ! for (int i = 0 ; i < (int)(sizeof(activeEngines)/sizeof(activeEngines[0])) ; i++) { if (activeEngines[i]) activeEngines[i]->SendOnIdle(sendOnIdle); --- 1012,1016 ---- PTRACE(4, "ModemEngineBody::SendOnIdle " << sendOnIdle); ! for (int i = 0 ; i < mceNumberOfItems ; i++) { if (activeEngines[i]) activeEngines[i]->SendOnIdle(sendOnIdle); *************** *** 1151,1154 **** --- 1158,1166 ---- break; + body->CheckStatePost(); + + if (stop) + break; + WaitDataReady(); } *************** *** 1221,1226 **** pPlayTone(NULL) { ! for (int i = 0 ; i < (int)(sizeof(activeEngines)/sizeof(activeEngines[0])) ; i++) activeEngines[i] = NULL; } --- 1233,1241 ---- pPlayTone(NULL) { ! for (int i = 0 ; i < mceNumberOfItems ; i++) { activeEngines[i] = NULL; + enableFakeIn[i] = FALSE; + enableFakeOut[i] = FALSE; + } } *************** *** 1248,1251 **** --- 1263,1271 ---- if (off_hook) { + for (int i = 0 ; i < mceNumberOfItems ; i++) { + enableFakeIn[i] = FALSE; + enableFakeOut[i] = FALSE; + } + timerBusy.Stop(); timeout.Stop(); *************** *** 1255,1260 **** state = stCommand; subState = 0; ! //_DetachEngine(mceT38); ! //_DetachEngine(mceAudio); TRACE_STATE(4, "ModemEngineBody::OnHook:"); } --- 1275,1280 ---- state = stCommand; subState = 0; ! _DetachEngine(mceT38); ! _DetachEngine(mceAudio); TRACE_STATE(4, "ModemEngineBody::OnHook:"); } *************** *** 1280,1287 **** pPlayTone = NULL; } - } ! _DetachEngine(mceT38); ! _DetachEngine(mceAudio); if (!CallToken().IsEmpty()) { --- 1300,1319 ---- pPlayTone = NULL; } ! if (off_hook) { ! timerBusy.Start(1000); ! ! if (!activeEngines[mceAudio]) ! _AttachEngine(mceAudio); ! ! for (int i = 0 ; i < mceNumberOfItems ; i++) { ! enableFakeIn[i] = TRUE; ! enableFakeOut[i] = TRUE; ! } ! ! if (activeEngines[mceAudio]) ! activeEngines[mceAudio]->RecvOnIdle(EngineBase::dtBusy); ! } ! } if (!CallToken().IsEmpty()) { *************** *** 1348,1354 **** if (state == stConnectWait && !pPlayTone && P.ModemClassId() == EngineBase::mcAudio) { - _AttachEngine(mceAudio); SetState(stConnectHandle, chConnected); timerRing.Start(5000); parent.SignalDataReady(); request.SetAt("response", "confirm"); --- 1380,1395 ---- if (state == stConnectWait && !pPlayTone && P.ModemClassId() == EngineBase::mcAudio) { SetState(stConnectHandle, chConnected); timerRing.Start(5000); + + if (!activeEngines[mceAudio]) + _AttachEngine(mceAudio); + + enableFakeIn[mceAudio] = TRUE; + enableFakeOut[mceAudio] = TRUE; + + if (activeEngines[mceAudio]) + activeEngines[mceAudio]->RecvOnIdle(EngineBase::dtRing); + parent.SignalDataReady(); request.SetAt("response", "confirm"); *************** *** 1373,1376 **** --- 1414,1421 ---- if (CallToken().IsEmpty() || CallToken() == request("calltoken")) { timerRing.Stop(); + + if (activeEngines[mceAudio]) + activeEngines[mceAudio]->RecvOnIdle(EngineBase::dtNone); + SetCallState(cstEstablished); *************** *** 1397,1401 **** if (callState == cstDialing && state == stConnectWait && request("trynextcommand") == "dial") { - timerRing.Stop(); SetCallState(cstCleared); SetState(stDial); --- 1442,1445 ---- *************** *** 3689,3692 **** --- 3733,3737 ---- SetState(stCommand); timeout.Stop(); + if (currentClassEngine) currentClassEngine->ResetModemState(); *************** *** 3731,3737 **** } } - - if (state == stCommand) - SendOnIdle(EngineBase::dtNone); } --- 3776,3779 ---- *************** *** 3804,3808 **** } ! for (int i = 0 ; i < (int)(sizeof(activeEngines)/sizeof(activeEngines[0])) ; i++) { EngineBase *engine = activeEngines[i]; --- 3846,3850 ---- } ! for (int i = 0 ; i < mceNumberOfItems ; i++) { EngineBase *engine = activeEngines[i]; *************** *** 3858,3863 **** SetCallSubState(1); - timerBusy.Start(1000); - switch (state) { case stCommand: --- 3900,3903 ---- *************** *** 3878,3903 **** case stSend: case stSendBufEmptyHandle: - break; case stSendAckWait: - SetState(stSendAckHandle); - timeout.Stop(); - break; case stSendAckHandle: - break; case stRecvBegWait: - resp = RC_NO_CARRIER(); - SetState(stCommand); - break; case stRecvBegHandle: - break; case stRecv: - if (dataCount || P.ModemClassId() == EngineBase::mcAudio) { - PBYTEArray _bresp((const BYTE *)"\x10\x03", 2); // <DLE><ETX> - bresp.Concatenate(_bresp); - PTRACE(2, "<-- DLE " << PRTHEX(_bresp)); - } - - resp = (P.ModemClassId() == EngineBase::mcAudio ? RC_OK() : RC_ERROR()); - SetState(stCommand); break; default: --- 3918,3926 ---- *************** *** 4008,4011 **** --- 4031,4036 ---- connectionEstablished = TRUE; + enableFakeIn[mceAudio] = TRUE; + enableFakeOut[mceAudio] = TRUE; if (P.ModemClassId() == EngineBase::mcAudio || callDirection == cdUndefined) { *************** *** 4329,4332 **** --- 4354,4398 ---- bresp.Concatenate(_bresp); } + } + + void ModemEngineBody::CheckStatePost() + { + PWaitAndSignal mutexWait(Mutex); + + if (off_hook) { + for (int i = 0 ; i < (int)(sizeof(activeEngines)/sizeof(activeEngines[0])) ; i++) { + EngineBase *engine = activeEngines[i]; + + if (!engine) + continue; + + PBoolean enableIn = FALSE; + PBoolean enableOut = FALSE; + + if (engine == currentClassEngine) { + switch (state) { + case stSend: + case stSendBufEmptyHandle: + case stSendAckWait: + enableOut = enableFakeOut[i]; + break; + case stRecvBegWait: + case stRecvBegHandle: + case stRecv: + enableIn = enableFakeIn[i]; + break; + default: + break; + } + } + + engine->AddReference(); + Mutex.Signal(); + engine->EnableFakeIn(enableIn); + engine->EnableFakeOut(enableOut); + Mutex.Wait(); + ReferenceObject::DelPointer(engine); + } + } if (state == stCommand) Index: t38engine.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/t38engine.cxx,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** t38engine.cxx 8 Oct 2010 06:09:53 -0000 1.72 --- t38engine.cxx 12 Oct 2010 16:46:25 -0000 1.73 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.73 2010/10/12 16:46:25 vfrolov + * Implemented fake streams + * * Revision 1.72 2010/10/08 06:09:53 vfrolov * Added parameter assert to SetPreparePacketTimeout() *************** *** 545,548 **** --- 548,608 ---- } /////////////////////////////////////////////////////////////// + class FakePreparePacketThread : public PThread + { + PCLASSINFO(FakePreparePacketThread, PThread); + public: + FakePreparePacketThread(T38Engine &engine) + : PThread(30000) + , t38engine(engine) + { + PTRACE(3, t38engine.Name() << " FakePreparePacketThread"); + t38engine.AddReference(); + } + + ~FakePreparePacketThread() + { + PTRACE(3, t38engine.Name() << " ~FakePreparePacketThread"); + ReferenceObject::DelPointer(&t38engine); + } + + protected: + virtual void Main(); + + T38Engine &t38engine; + }; + + void FakePreparePacketThread::Main() + { + PTRACE(3, t38engine.Name() << " FakePreparePacketThread::Main started"); + + t38engine.OpenOut(EngineBase::HOWNEROUT(this), TRUE); + t38engine.SetPreparePacketTimeout(EngineBase::HOWNEROUT(this), -1); + + #if PTRACING + unsigned long count = 0; + #endif + + for (;;) { + T38_IFP ifp; + int res; + + res = t38engine.PreparePacket(EngineBase::HOWNEROUT(this), ifp); + + if (res == 0) + break; + + #if PTRACING + if (res > 0) { + count++; + PTRACE(4, t38engine.Name() << " FakePreparePacketThread::Main ifp = " << setprecision(2) << ifp); + } + #endif + } + + t38engine.CloseOut(EngineBase::HOWNEROUT(this)); + + PTRACE(3, t38engine.Name() << " FakePreparePacketThread::Main stopped, faked out " << count << " IFP packets"); + } + /////////////////////////////////////////////////////////////// T38Engine::T38Engine(const PString &_name) : EngineBase(_name + " T38Engine") *************** *** 610,613 **** --- 670,723 ---- } + void T38Engine::OnChangeEnableFakeIn() + { + EngineBase::OnChangeEnableFakeIn(); + + if (IsOpenIn() || !isEnableFakeIn) + return; + + isCarrierIn = 0; + + if (modStreamInSaved != NULL) { + myPTRACE(1, name << " OnChangeEnableFakeIn modStreamInSaved != NULL, clean"); + delete modStreamInSaved; + modStreamInSaved = NULL; + } + + if (modStreamIn != NULL && modStreamIn->lastBuf != NULL) { + myPTRACE(1, name << " OnChangeEnableFakeIn modStreamIn->lastBuf != NULL"); + modStreamIn->PutEof((countIn == 0 ? 0 : diagOutOfOrder) | diagNoCarrier); + + if (stateModem == stmInRecvData) { + ModemCallbackWithUnlock(callbackParamIn); + + if (IsOpenIn() || !isEnableFakeIn) + return; + } + } + + if (stateModem == stmInWaitSilence) { + stateModem = stmIdle; + ModemCallbackWithUnlock(callbackParamIn); + + //if (IsOpenIn() || !isEnableFakeIn) + // return; + } + } + + void T38Engine::OnChangeEnableFakeOut() + { + EngineBase::OnChangeEnableFakeOut(); + SignalOutDataReady(); + + if (IsOpenOut() || !isEnableFakeOut) + return; + + if (stateModem != stmOutMoreData && stateModem != stmOutNoMoreData) + return; + + (new FakePreparePacketThread(*this))->Resume(); + } + void T38Engine::OnAttach() { *************** *** 1547,1550 **** --- 1657,1667 ---- modStreamIn->PutEof(diagOutOfOrder | diagNoCarrier); myPTRACE(1, name << " HandlePacket out of order " << type_of_msg); + + if (stateModem == stmInRecvData) { + ModemCallbackWithUnlock(callbackParamIn); + + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; + } } } Index: enginebase.h =================================================================== RCS file: /cvsroot/t38modem/t38modem/enginebase.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** enginebase.h 8 Oct 2010 06:04:59 -0000 1.13 --- enginebase.h 12 Oct 2010 16:46:25 -0000 1.14 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.14 2010/10/12 16:46:25 vfrolov + * Implemented fake streams + * * Revision 1.13 2010/10/08 06:04:59 vfrolov * Added diagErrorMask *************** *** 132,135 **** --- 135,140 ---- enum DataType { dtNone, + dtRing, + dtBusy, dtCed, dtCng, *************** *** 162,169 **** void ResetModemState(); ! void OpenIn(HOWNERIN hOwner); ! void OpenOut(HOWNEROUT hOwner); void CloseIn(HOWNERIN hOwner); void CloseOut(HOWNEROUT hOwner); PBoolean IsOpenIn() const { return hOwnerIn != NULL; } --- 167,176 ---- void ResetModemState(); ! void OpenIn(HOWNERIN hOwner, PBoolean fake = FALSE); ! void OpenOut(HOWNEROUT hOwner, PBoolean fake = FALSE); void CloseIn(HOWNERIN hOwner); void CloseOut(HOWNEROUT hOwner); + void EnableFakeIn(PBoolean enable = TRUE); + void EnableFakeOut(PBoolean enable = TRUE); PBoolean IsOpenIn() const { return hOwnerIn != NULL; } *************** *** 178,182 **** int RecvUserInput(void * pBuf, PINDEX count); ! virtual void SendOnIdle(DataType _dataType) = 0; virtual PBoolean SendStart(DataType _dataType, int param) = 0; virtual int Send(const void *pBuf, PINDEX count) = 0; --- 185,189 ---- int RecvUserInput(void * pBuf, PINDEX count); ! virtual void SendOnIdle(DataType /*_dataType*/) {} virtual PBoolean SendStart(DataType _dataType, int param) = 0; virtual int Send(const void *pBuf, PINDEX count) = 0; *************** *** 185,188 **** --- 192,196 ---- virtual PBoolean SendingNotCompleted() const { return FALSE; } + virtual void RecvOnIdle(DataType /*_dataType*/) {} virtual PBoolean RecvWait(DataType _dataType, int param, int _callbackParam, PBoolean &done) = 0; virtual PBoolean RecvStart(int _callbackParam) = 0; *************** *** 205,208 **** --- 213,218 ---- virtual void OnCloseIn(); virtual void OnCloseOut(); + virtual void OnChangeEnableFakeIn(); + virtual void OnChangeEnableFakeOut(); const PString name; *************** *** 213,216 **** --- 223,230 ---- PBoolean firstIn; PBoolean firstOut; + PBoolean isFakeOwnerIn; + PBoolean isFakeOwnerOut; + PBoolean isEnableFakeIn; + PBoolean isEnableFakeOut; void ModemCallbackWithUnlock(INT extra); Index: Makefile =================================================================== RCS file: /cvsroot/t38modem/t38modem/Makefile,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Makefile 6 Oct 2010 16:54:19 -0000 1.27 --- Makefile 12 Oct 2010 16:46:25 -0000 1.28 *************** *** 25,28 **** --- 25,31 ---- # # $Log$ + # Revision 1.28 2010/10/12 16:46:25 vfrolov + # Implemented fake streams + # # Revision 1.27 2010/10/06 16:54:19 vfrolov # Redesigned engine opening/closing *************** *** 106,110 **** PROG = t38modem SOURCES := pmutils.cxx dle.cxx pmodem.cxx pmodemi.cxx drivers.cxx \ ! t30tone.cxx hdlc.cxx t30.cxx fcs.cxx \ pmodeme.cxx enginebase.cxx t38engine.cxx audio.cxx \ drv_pty.cxx \ --- 109,113 ---- PROG = t38modem SOURCES := pmutils.cxx dle.cxx pmodem.cxx pmodemi.cxx drivers.cxx \ ! t30tone.cxx tone_gen.cxx hdlc.cxx t30.cxx fcs.cxx \ pmodeme.cxx enginebase.cxx t38engine.cxx audio.cxx \ drv_pty.cxx \ Index: t38engine.h =================================================================== RCS file: /cvsroot/t38modem/t38modem/t38engine.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** t38engine.h 6 Oct 2010 16:54:19 -0000 1.41 --- t38engine.h 12 Oct 2010 16:46:25 -0000 1.42 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.42 2010/10/12 16:46:25 vfrolov + * Implemented fake streams + * * Revision 1.41 2010/10/06 16:54:19 vfrolov * Redesigned engine opening/closing *************** *** 270,274 **** protected: - virtual void OnAttach(); virtual void OnDetach(); --- 273,276 ---- *************** *** 279,282 **** --- 281,286 ---- virtual void OnCloseIn(); virtual void OnCloseOut(); + virtual void OnChangeEnableFakeIn(); + virtual void OnChangeEnableFakeOut(); private: Index: audio.h =================================================================== RCS file: /cvsroot/t38modem/t38modem/audio.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** audio.h 6 Oct 2010 16:54:19 -0000 1.8 --- audio.h 12 Oct 2010 16:46:25 -0000 1.9 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.9 2010/10/12 16:46:25 vfrolov + * Implemented fake streams + * * Revision 1.8 2010/10/06 16:54:19 vfrolov * Redesigned engine opening/closing *************** *** 59,63 **** /////////////////////////////////////////////////////////////// class DataStream; ! class T30Tone; class T30ToneDetect; /////////////////////////////////////////////////////////////// --- 62,66 ---- /////////////////////////////////////////////////////////////// class DataStream; ! class ToneGenerator; class T30ToneDetect; /////////////////////////////////////////////////////////////// *************** *** 84,92 **** PBoolean Write(HOWNERIN hOwner, const void * buffer, PINDEX len); virtual PBoolean RecvWait(DataType _dataType, int param, int _callbackParam, PBoolean &done); virtual PBoolean RecvStart(int _callbackParam); virtual int Recv(void *pBuf, PINDEX count); virtual void RecvStop(); - //@} --- 87,95 ---- PBoolean Write(HOWNERIN hOwner, const void * buffer, PINDEX len); + virtual void RecvOnIdle(DataType _dataType); virtual PBoolean RecvWait(DataType _dataType, int param, int _callbackParam, PBoolean &done); virtual PBoolean RecvStart(int _callbackParam); virtual int Recv(void *pBuf, PINDEX count); virtual void RecvStop(); //@} *************** *** 101,113 **** virtual void OnCloseIn(); virtual void OnCloseOut(); PAdaptiveDelay readDelay; PAdaptiveDelay writeDelay; - PTime targetTimeFakeOut; - mutable PTimer timerFakeOut; - PDECLARE_NOTIFIER(PTimer, AudioEngine, OnTimerFakeOutCallback); - const PNotifier timerFakeOutCallback; - int callbackParam; --- 104,113 ---- virtual void OnCloseIn(); virtual void OnCloseOut(); + virtual void OnChangeEnableFakeIn(); + virtual void OnChangeEnableFakeOut(); PAdaptiveDelay readDelay; PAdaptiveDelay writeDelay; int callbackParam; *************** *** 115,119 **** DataStream *volatile recvAudio; ! T30Tone *volatile t30Tone; T30ToneDetect *volatile t30ToneDetect; }; --- 115,120 ---- DataStream *volatile recvAudio; ! ToneGenerator *volatile pToneIn; ! ToneGenerator *volatile pToneOut; T30ToneDetect *volatile t30ToneDetect; }; Index: audio.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/audio.cxx,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** audio.cxx 6 Oct 2010 16:54:19 -0000 1.16 --- audio.cxx 12 Oct 2010 16:46:25 -0000 1.17 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.17 2010/10/12 16:46:25 vfrolov + * Implemented fake streams + * * Revision 1.16 2010/10/06 16:54:19 vfrolov * Redesigned engine opening/closing *************** *** 79,82 **** --- 82,86 ---- #include "pmutils.h" #include "t30tone.h" + #include "tone_gen.h" #include "audio.h" *************** *** 89,109 **** #define BYTES_PER_MSEC ((SIMPLES_PER_SEC*BYTES_PER_SIMPLE)/1000) /////////////////////////////////////////////////////////////// ! AudioEngine::AudioEngine(const PString &_name) ! : EngineBase(_name + " AudioEngine") ! #ifdef _MSC_VER ! #pragma warning(disable:4355) // warning C4355: 'this' : used in base member initializer list #endif ! , timerFakeOutCallback(PCREATE_NOTIFIER(OnTimerFakeOutCallback)) ! #ifdef _MSC_VER ! #pragma warning(default:4355) #endif , callbackParam(cbpReset) , sendAudio(NULL) , recvAudio(NULL) ! , t30Tone(NULL) , t30ToneDetect(NULL) { - timerFakeOut.SetNotifier(timerFakeOutCallback); - PTRACE(2, name << " AudioEngine"); } --- 93,216 ---- #define BYTES_PER_MSEC ((SIMPLES_PER_SEC*BYTES_PER_SIMPLE)/1000) /////////////////////////////////////////////////////////////// ! class FakeReadThread : public PThread ! { ! PCLASSINFO(FakeReadThread, PThread); ! public: ! FakeReadThread(AudioEngine &engine) ! : PThread(30000) ! , audioEngine(engine) ! { ! PTRACE(3, audioEngine.Name() << " FakeReadThread"); ! audioEngine.AddReference(); ! } ! ! ~FakeReadThread() ! { ! PTRACE(3, audioEngine.Name() << " ~FakeReadThread"); ! ReferenceObject::DelPointer(&audioEngine); ! } ! ! protected: ! virtual void Main(); ! ! AudioEngine &audioEngine; ! }; ! ! void FakeReadThread::Main() ! { ! PTRACE(3, audioEngine.Name() << " FakeReadThread::Main started"); ! ! audioEngine.OpenOut(EngineBase::HOWNEROUT(this), TRUE); ! ! static BYTE buf[BYTES_PER_MSEC*20]; ! ! #if PTRACING ! unsigned long count = 0; #endif ! ! for (;;) { ! if (!audioEngine.Read(EngineBase::HOWNEROUT(this), buf, sizeof(buf))) ! break; ! ! #if PTRACING ! count++; #endif + } + + audioEngine.CloseOut(EngineBase::HOWNEROUT(this)); + + PTRACE(3, audioEngine.Name() << " FakeReadThread::Main stopped, faked out " << count*(sizeof(buf)/BYTES_PER_MSEC) << " ms"); + } + /////////////////////////////////////////////////////////////// + class FakeWriteThread : public PThread + { + PCLASSINFO(FakeWriteThread, PThread); + public: + FakeWriteThread(AudioEngine &engine) + : PThread(30000) + , audioEngine(engine) + { + PTRACE(3, audioEngine.Name() << " FakeWriteThread"); + audioEngine.AddReference(); + } + + ~FakeWriteThread() + { + PTRACE(3, audioEngine.Name() << " ~FakeWriteThread"); + ReferenceObject::DelPointer(&audioEngine); + } + + protected: + virtual void Main(); + + AudioEngine &audioEngine; + }; + + void FakeWriteThread::Main() + { + PTRACE(3, audioEngine.Name() << " FakeWriteThread::Main started"); + + audioEngine.OpenIn(EngineBase::HOWNERIN(this), TRUE); + + #if PTRACING + unsigned long count = 0; + #endif + + for (;;) { + if (!audioEngine.Write(EngineBase::HOWNERIN(this), NULL, BYTES_PER_MSEC*20)) + break; + + #if PTRACING + count++; + #endif + } + + audioEngine.CloseIn(EngineBase::HOWNERIN(this)); + + PTRACE(3, audioEngine.Name() << " FakeWriteThread::Main stopped, faked out " << count*20 << " ms"); + } + /////////////////////////////////////////////////////////////// + static ToneGenerator::ToneType dt2tt(EngineBase::DataType dataType) + { + switch (dataType) { + case EngineBase::dtCng: return ToneGenerator::ttCng; + case EngineBase::dtCed: return ToneGenerator::ttCed; + case EngineBase::dtRing: return ToneGenerator::ttRing; + case EngineBase::dtBusy: return ToneGenerator::ttBusy; + default: break; + } + + return ToneGenerator::ttSilence; + } + /////////////////////////////////////////////////////////////// + AudioEngine::AudioEngine(const PString &_name) + : EngineBase(_name + " AudioEngine") , callbackParam(cbpReset) , sendAudio(NULL) , recvAudio(NULL) ! , pToneIn(NULL) ! , pToneOut(NULL) , t30ToneDetect(NULL) { PTRACE(2, name << " AudioEngine"); } *************** *** 113,129 **** PTRACE(2, name << " ~AudioEngine"); ! timerFakeOut = 0; ! ! if (sendAudio) ! delete sendAudio; ! ! if (recvAudio) ! delete recvAudio; ! ! if (t30Tone) ! delete t30Tone; ! ! if (t30ToneDetect) ! delete t30ToneDetect; } --- 220,228 ---- PTRACE(2, name << " ~AudioEngine"); ! delete sendAudio; ! delete recvAudio; ! delete pToneIn; ! delete pToneOut; ! delete t30ToneDetect; } *************** *** 156,162 **** } ! if (t30Tone) { ! delete t30Tone; ! t30Tone = NULL; } } --- 255,266 ---- } ! if (pToneIn) { ! delete pToneIn; ! pToneIn = NULL; ! } ! ! if (pToneOut) { ! delete pToneOut; ! pToneOut = NULL; } } *************** *** 180,187 **** { EngineBase::OnOpenOut(); - timerFakeOut = 0; - - if (sendAudio && !sendAudio->isFull()) - ModemCallbackWithUnlock(cbpOutBufNoFull); } --- 284,287 ---- *************** *** 189,223 **** { EngineBase::OnCloseOut(); ! if (sendAudio) { ! int countTotal = 0; ! ! for (;;) { ! static BYTE buffer[64]; ! ! PBoolean wasFull = sendAudio->isFull(); ! ! int count = sendAudio->GetData(buffer, sizeof(buffer)); ! ! if (count < 0) { ! delete sendAudio; ! sendAudio = NULL; ! ModemCallbackWithUnlock(callbackParam); ! break; ! } ! else { ! if (wasFull && !sendAudio->isFull()) ! ModemCallbackWithUnlock(cbpOutBufNoFull); ! if (count == 0) ! break; ! countTotal += count; ! } ! } ! if (sendAudio) ! targetTimeFakeOut = PTime() + countTotal/BYTES_PER_MSEC; ! } } --- 289,305 ---- { EngineBase::OnCloseOut(); + } ! void AudioEngine::OnChangeEnableFakeOut() ! { ! EngineBase::OnChangeEnableFakeOut(); ! if (IsOpenOut() || !isEnableFakeOut) ! return; ! if (!sendAudio) ! return; ! (new FakeReadThread(*this))->Resume(); } *************** *** 284,289 **** memset((BYTE *)buffer + count, 0, amount - count); } else { ! if (t30Tone) ! t30Tone->Read(buffer, amount); else memset(buffer, 0, amount); --- 366,371 ---- memset((BYTE *)buffer + count, 0, amount - count); } else { ! if (pToneOut) ! pToneOut->Read(buffer, amount); else memset(buffer, 0, amount); *************** *** 300,317 **** PWaitAndSignal mutexWait(Mutex); ! if (t30Tone) { ! delete t30Tone; ! t30Tone = NULL; ! } ! switch (_dataType) { ! case dtCng: ! t30Tone = new T30Tone(T30Tone::cng); ! break; ! case dtNone: ! break; ! default: ! PTRACE(1, name << " SendOnIdle dataType(" << _dataType << ") is not supported"); } } --- 382,394 ---- PWaitAndSignal mutexWait(Mutex); ! ToneGenerator::ToneType toneType = dt2tt(_dataType); ! if (pToneOut && pToneOut->Type() != toneType) { ! delete pToneOut; ! pToneOut = NULL; } + + if (pToneOut == NULL && toneType != ToneGenerator::ttSilence) + pToneOut = new ToneGenerator(toneType); } *************** *** 319,322 **** --- 396,403 ---- { PWaitAndSignal mutexWaitModem(MutexModem); + + if (!IsModemOpen()) + return FALSE; + PWaitAndSignal mutexWait(Mutex); *************** *** 324,335 **** delete sendAudio; ! sendAudio = new DataStream(1024*2); PTRACE(3, name << " SendStart _dataType=" << _dataType << " param=" << param); - if (hOwnerOut == NULL) - targetTimeFakeOut = PTime(); - return TRUE; } --- 405,413 ---- delete sendAudio; ! sendAudio = new DataStream(1024 * BYTES_PER_SIMPLE); PTRACE(3, name << " SendStart _dataType=" << _dataType << " param=" << param); return TRUE; } *************** *** 338,349 **** { PWaitAndSignal mutexWaitModem(MutexModem); PWaitAndSignal mutexWait(Mutex); ! if (sendAudio) { ! if (hOwnerOut != NULL) ! sendAudio->PutData(pBuf, count); ! else ! targetTimeFakeOut += count/BYTES_PER_MSEC; ! } return count; --- 416,427 ---- { PWaitAndSignal mutexWaitModem(MutexModem); + + if (!IsModemOpen()) + return -1; + PWaitAndSignal mutexWait(Mutex); ! if (sendAudio) ! sendAudio->PutData(pBuf, count); return count; *************** *** 353,373 **** { PWaitAndSignal mutexWaitModem(MutexModem); - PWaitAndSignal mutexWait(Mutex); ! callbackParam = _callbackParam; ! if (sendAudio) { ! if (hOwnerOut != NULL) { ! sendAudio->PutEof(); ! } else { ! delete sendAudio; ! sendAudio = NULL; ! PTimeInterval delay = targetTimeFakeOut - PTime(); ! int sleep_time = (int)delay.GetMilliSeconds(); ! timerFakeOut = (sleep_time > 0 ? sleep_time : 1); ! } ! } PTRACE(3, name << " SendStop moreFrames=" << moreFrames --- 431,444 ---- { PWaitAndSignal mutexWaitModem(MutexModem); ! if (!IsModemOpen()) ! return FALSE; ! PWaitAndSignal mutexWait(Mutex); ! callbackParam = _callbackParam; ! if (sendAudio) ! sendAudio->PutEof(); PTRACE(3, name << " SendStop moreFrames=" << moreFrames *************** *** 384,414 **** return FALSE; - if (hOwnerOut == NULL) { - PTimeInterval delay = targetTimeFakeOut - PTime(); - int sleep_time = (int)delay.GetMilliSeconds(); - - if (sleep_time <= 0) - return FALSE; - - PTRACE(5, "AudioEngine::isOutBufFull targetTimeFakeOut=" << targetTimeFakeOut.AsString("yyyy/MM/dd hh:mm:ss.uuu", PTime::Local)); - - timerFakeOut = sleep_time; - - return TRUE; - } - return sendAudio->isFull(); } - - void AudioEngine::OnTimerFakeOutCallback(PTimer & PTRACE_PARAM(from), INT PTRACE_PARAM(extra)) - { - PTRACE(4, "AudioEngine::OnTimerFakeOutCallback" - " " << ModemCallbackParam(sendAudio ? cbpOutBufNoFull : callbackParam) << - " " <<from.GetClass() << " " << extra); - - PWaitAndSignal mutexWait(Mutex); - - ModemCallbackWithUnlock(sendAudio ? cbpOutBufNoFull : callbackParam); - } /////////////////////////////////////////////////////////////// void AudioEngine::OnOpenIn() --- 455,460 ---- *************** *** 422,425 **** --- 468,484 ---- } + void AudioEngine::OnChangeEnableFakeIn() + { + EngineBase::OnChangeEnableFakeIn(); + + if (IsOpenIn() || !isEnableFakeIn) + return; + + if (!recvAudio) + return; + + (new FakeWriteThread(*this))->Resume(); + } + PBoolean AudioEngine::Write(HOWNERIN hOwner, const void * buffer, PINDEX len) { *************** *** 454,472 **** return FALSE; ! if (recvAudio && !recvAudio->isFull()) { ! recvAudio->PutData(buffer, len); ! ModemCallbackWithUnlock(callbackParam); ! if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; ! } ! PBoolean cng = t30ToneDetect && t30ToneDetect->Write(buffer, len); ! if (cng) { ! OnUserInput('c'); ! if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; } --- 513,554 ---- return FALSE; ! if (buffer) { ! if (recvAudio && !recvAudio->isFull()) { ! recvAudio->PutData(buffer, len); ! ModemCallbackWithUnlock(callbackParam); ! if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; ! } ! if (t30ToneDetect && t30ToneDetect->Write(buffer, len)) { ! OnUserInput('c'); ! if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; ! } ! } else { ! if (recvAudio && !recvAudio->isFull()) { ! for (PINDEX rest = len ; rest > 0 ;) { ! BYTE buf[64*BYTES_PER_SIMPLE]; ! PINDEX lenChank = rest; ! if (lenChank > (PINDEX)sizeof(buf)) ! lenChank = (PINDEX)sizeof(buf); ! ! if (pToneIn) ! pToneIn->Read(buf, lenChank); ! else ! memset(buf, 0, lenChank); ! ! recvAudio->PutData(buf, lenChank); ! rest -= lenChank; ! } ! ! ModemCallbackWithUnlock(callbackParam); ! ! if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; ! } } *************** *** 481,487 **** --- 563,600 ---- } + void AudioEngine::RecvOnIdle(DataType _dataType) + { + PTRACE(2, name << " RecvOnIdle " << _dataType); + + PWaitAndSignal mutexWaitModem(MutexModem); + PWaitAndSignal mutexWait(Mutex); + + ToneGenerator::ToneType toneType = dt2tt(_dataType); + + if (pToneIn && pToneIn->Type() != toneType) { + delete pToneIn; + pToneIn = NULL; + } + + if (pToneIn == NULL && toneType != ToneGenerator::ttSilence) + pToneIn = new ToneGenerator(toneType); + } + PBoolean AudioEngine::RecvWait(DataType /*_dataType*/, int /*param*/, int /*_callbackParam*/, PBoolean &done) { + PWaitAndSignal mutexWaitModem(MutexModem); + + if (!IsModemOpen()) + return FALSE; + + PWaitAndSignal mutexWait(Mutex); + + if (recvAudio) + delete recvAudio; + + recvAudio = new DataStream(1024 * BYTES_PER_SIMPLE); + done = TRUE; + return TRUE; } *************** *** 490,499 **** { PWaitAndSignal mutexWaitModem(MutexModem); - PWaitAndSignal mutexWait(Mutex); ! if (recvAudio) ! delete recvAudio; ! recvAudio = new DataStream(1024*2); callbackParam = _callbackParam; --- 603,614 ---- { PWaitAndSignal mutexWaitModem(MutexModem); ! if (!IsModemOpen()) ! return FALSE; ! PWaitAndSignal mutexWait(Mutex); ! ! if (!recvAudio) ! return FALSE; callbackParam = _callbackParam; *************** *** 505,513 **** { PWaitAndSignal mutexWaitModem(MutexModem); - PWaitAndSignal mutexWait(Mutex); if (!recvAudio) return -1; return recvAudio->GetData(pBuf, count); } --- 620,629 ---- { PWaitAndSignal mutexWaitModem(MutexModem); if (!recvAudio) return -1; + PWaitAndSignal mutexWait(Mutex); + return recvAudio->GetData(pBuf, count); } *************** *** 516,519 **** --- 632,639 ---- { PWaitAndSignal mutexWaitModem(MutexModem); + + if(!IsModemOpen()) + return; + PWaitAndSignal mutexWait(Mutex); Index: t30tone.h =================================================================== RCS file: /cvsroot/t38modem/t38modem/t30tone.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** t30tone.h 10 Sep 2010 18:00:44 -0000 1.5 --- t30tone.h 12 Oct 2010 16:46:25 -0000 1.6 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.6 2010/10/12 16:46:25 vfrolov + * Implemented fake streams + * * Revision 1.5 2010/09/10 18:00:44 vfrolov * Cleaned up code *************** *** 46,69 **** /////////////////////////////////////////////////////////////// - class T30Tone : public PObject - { - PCLASSINFO(T30Tone, PObject); - - public: - - enum Type { - silence, - cng - }; - - T30Tone(Type _type); - void Read(void * buffer, PINDEX amount); - - protected: - - Type type; - PINDEX index; - }; - /////////////////////////////////////////////////////////////// class T30ToneDetect : public PObject { --- 49,52 ---- Index: enginebase.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/enginebase.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** enginebase.cxx 6 Oct 2010 16:54:19 -0000 1.12 --- enginebase.cxx 12 Oct 2010 16:46:25 -0000 1.13 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.13 2010/10/12 16:46:25 vfrolov + * Implemented fake streams + * * Revision 1.12 2010/10/06 16:54:19 vfrolov * Redesigned engine opening/closing *************** *** 75,78 **** --- 78,83 ---- switch (dataType) { case EngineBase::dtNone: return out << "dtNone"; + case EngineBase::dtRing: return out << "dtRing"; + case EngineBase::dtBusy: return out << "dtBusy"; case EngineBase::dtCed: return out << "dtCed"; case EngineBase::dtCng: return out << "dtCng"; *************** *** 119,122 **** --- 124,131 ---- , firstIn(TRUE) , firstOut(TRUE) + , isFakeOwnerIn(FALSE) + , isFakeOwnerOut(FALSE) + , isEnableFakeIn(FALSE) + , isEnableFakeOut(FALSE) { } *************** *** 207,211 **** } ! void EngineBase::OpenIn(HOWNERIN hOwner) { PWaitAndSignal mutexWait(Mutex); --- 216,220 ---- } ! void EngineBase::OpenIn(HOWNERIN hOwner, PBoolean fake) { PWaitAndSignal mutexWait(Mutex); *************** *** 217,221 **** } ! myPTRACE(1, name << " OpenIn WARNING: close " << hOwnerIn << " by " << hOwner); hOwnerIn = NULL; --- 226,235 ---- } ! if (fake) { ! myPTRACE(1, name << " OpenIn: disabled close " << hOwnerIn << " by fake " << hOwner); ! return; ! } ! ! myPTRACE(1, name << " OpenIn " << (isFakeOwnerIn ? ": close fake " : "WARNING: close ") << hOwnerIn << " by " << hOwner); hOwnerIn = NULL; *************** *** 226,233 **** hOwnerIn = hOwner; OnOpenIn(); } ! void EngineBase::OpenOut(HOWNEROUT hOwner) { PWaitAndSignal mutexWait(Mutex); --- 240,248 ---- hOwnerIn = hOwner; + isFakeOwnerIn = fake; OnOpenIn(); } ! void EngineBase::OpenOut(HOWNEROUT hOwner, PBoolean fake) { PWaitAndSignal mutexWait(Mutex); *************** *** 239,243 **** } ! myPTRACE(1, name << " OpenOut WARNING: close " << hOwnerOut << " by " << hOwner); hOwnerOut = NULL; --- 254,263 ---- } ! if (fake) { ! myPTRACE(1, name << " OpenOut: disabled close " << hOwnerOut << " by fake " << hOwner); ! return; ! } ! ! myPTRACE(1, name << " OpenOut " << (isFakeOwnerOut ? ": close fake " : "WARNING: close ") << hOwnerOut << " by " << hOwner); hOwnerOut = NULL; *************** *** 248,251 **** --- 268,272 ---- hOwnerOut = hOwner; + isFakeOwnerOut = fake; OnOpenOut(); } *************** *** 268,272 **** if (hOwnerIn == hOwner) { ! myPTRACE(1, name << " CloseIn: close " << hOwner); hOwnerIn = NULL; --- 289,296 ---- if (hOwnerIn == hOwner) { ! myPTRACE(1, name << " CloseIn: close " << (isFakeOwnerIn ? "fake " : "") << hOwner); ! ! if (!isFakeOwnerIn) ! isEnableFakeIn = FALSE; // allow re-enable fake stream hOwnerIn = NULL; *************** *** 282,286 **** if (hOwnerOut == hOwner) { ! myPTRACE(1, name << " CloseOut: close " << hOwner); hOwnerOut = NULL; --- 306,313 ---- if (hOwnerOut == hOwner) { ! myPTRACE(1, name << " CloseOut: close " << (isFakeOwnerOut ? "fake " : "") << hOwner); ! ! if (!isFakeOwnerOut) ! isEnableFakeOut = FALSE; // allow re-enable fake stream hOwnerOut = NULL; *************** *** 301,304 **** --- 328,377 ---- } + void EngineBase::EnableFakeIn(PBoolean enable) + { + PWaitAndSignal mutexWait(Mutex); + + if (isEnableFakeIn == enable) + return; + + myPTRACE(3, name << " EnableFakeIn: " << (enable ? "enable" : "disable")); + + isEnableFakeIn = enable; + OnChangeEnableFakeIn(); + } + + void EngineBase::OnChangeEnableFakeIn() + { + if (!isEnableFakeIn && hOwnerIn != NULL && isFakeOwnerIn) { + myPTRACE(1, name << " OnChangeEnableFakeIn: close fake " << hOwnerIn); + + hOwnerIn = NULL; + OnCloseIn(); + } + } + + void EngineBase::EnableFakeOut(PBoolean enable) + { + PWaitAndSignal mutexWait(Mutex); + + if (isEnableFakeOut == enable) + return; + + myPTRACE(3, name << " EnableFakeOut: " << (enable ? "enable" : "disable")); + + isEnableFakeOut = enable; + OnChangeEnableFakeOut(); + } + + void EngineBase::OnChangeEnableFakeOut() + { + if (!isEnableFakeOut && hOwnerOut != NULL && isFakeOwnerOut) { + myPTRACE(1, name << " OnChangeEnableFakeOut: close fake " << hOwnerOut); + + hOwnerOut = NULL; + OnCloseOut(); + } + } + void EngineBase::ChangeModemClass(ModemClass newModemClass) { Index: t30tone.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/t30tone.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** t30tone.cxx 10 Sep 2010 18:00:44 -0000 1.7 --- t30tone.cxx 12 Oct 2010 16:46:25 -0000 1.8 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.8 2010/10/12 16:46:25 vfrolov + * Implemented fake streams + * * Revision 1.7 2010/09/10 18:00:44 vfrolov * Cleaned up code *************** *** 52,57 **** #include "pmutils.h" #include "t30tone.h" - #include <math.h> - /////////////////////////////////////////////////////////////// --- 55,58 ---- *************** *** 61,138 **** /////////////////////////////////////////////////////////////// typedef PInt16 SIMPLE_TYPE; - #define TWO_PI (3.1415926535897932384626433832795029L*2) #define BYTES_PER_SIMPLE sizeof(SIMPLE_TYPE) #define SIMPLES_PER_SEC 8000 /////////////////////////////////////////////////////////////// #define CNG_HZ 1100 - #define CNG_MAX_DIV 100 - #define CNG_AMPLITUDE 5000 #define CNG_ON_MSEC 500 - #define CNG_ON_BYTES (((SIMPLES_PER_SEC*CNG_ON_MSEC)/1000)*BYTES_PER_SIMPLE) #define CNG_OFF_MSEC 3000 - #define CNG_OFF_BYTES (((SIMPLES_PER_SEC*CNG_OFF_MSEC)/1000)*BYTES_PER_SIMPLE) - #define CNG_SIMPLES_PER_REPEATE (SIMPLES_PER_SEC/CNG_MAX_DIV) - - static BYTE CngTone[CNG_SIMPLES_PER_REPEATE*BYTES_PER_SIMPLE]; - - static PBoolean initCngTone() - { - for( size_t i = 0 ; i < sizeof(CngTone)/BYTES_PER_SIMPLE ; i++ ) { - double Sin = sin(double((CNG_HZ*TWO_PI*i)/SIMPLES_PER_SEC)); - ((SIMPLE_TYPE *)CngTone)[i] = (SIMPLE_TYPE)(Sin * CNG_AMPLITUDE); - } - return TRUE; - } - - static const PBoolean ___InitCngTone = initCngTone(); - /////////////////////////////////////////////////////////////// - T30Tone::T30Tone(T30Tone::Type _type) - { - type = _type; - - switch(type) { - case cng: - // begin with 1 sec silence - index = ((SIMPLES_PER_SEC*(CNG_ON_MSEC+CNG_OFF_MSEC-1000))/1000)*BYTES_PER_SIMPLE; - break; - default: - index = 0; - } - } - - void T30Tone::Read(void * buffer, PINDEX amount) - { - BYTE *pBuf = (BYTE *)buffer; - - switch(type) { - case cng: - while(amount) { - if (index >= (PINDEX)(CNG_ON_BYTES + CNG_OFF_BYTES)) - index = 0; - - PINDEX len; - - if ((PINDEX)CNG_ON_BYTES > index) { - PINDEX i = index % sizeof(CngTone); - len = sizeof(CngTone) - i; - if (len > amount) - len = amount; - memcpy(pBuf, CngTone + i, len); - } else { - len = CNG_ON_BYTES + CNG_OFF_BYTES - index; - if (len > amount) - len = amount; - memset(pBuf, 0, len); - } - pBuf += len; - amount -= len; - index += len; - } - break; - default: - memset(pBuf, 0, amount); - index = (index + amount) % BYTES_PER_SIMPLE; - } - } /////////////////////////////////////////////////////////////// #define CNG_FILTER_BUF_LEN ((((SIMPLES_PER_SEC + CNG_HZ - 1)/CNG_HZ + 1)/2)*2) --- 62,71 ---- |
|
From: Vyacheslav F. <vf...@us...> - 2010-10-12 16:46:33
|
Update of /cvsroot/t38modem/t38modem/h323lib In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv31675/h323lib Modified Files: t38modem_2005.vcproj t38modem_openh323_2005.vcproj Log Message: Implemented fake streams Index: t38modem_openh323_2005.vcproj =================================================================== RCS file: /cvsroot/t38modem/t38modem/h323lib/t38modem_openh323_2005.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** t38modem_openh323_2005.vcproj 7 Oct 2010 05:31:59 -0000 1.1 --- t38modem_openh323_2005.vcproj 12 Oct 2010 16:46:25 -0000 1.2 *************** *** 774,777 **** --- 774,781 ---- </FileConfiguration> </File> + <File + RelativePath="..\tone_gen.cxx" + > + </File> <Filter Name="h323lib" *************** *** 908,911 **** --- 912,919 ---- </File> <File + RelativePath="..\tone_gen.h" + > + </File> + <File RelativePath="..\version.h" > Index: t38modem_2005.vcproj =================================================================== RCS file: /cvsroot/t38modem/t38modem/h323lib/t38modem_2005.vcproj,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** t38modem_2005.vcproj 6 Oct 2010 16:54:19 -0000 1.7 --- t38modem_2005.vcproj 12 Oct 2010 16:46:25 -0000 1.8 *************** *** 774,777 **** --- 774,781 ---- </FileConfiguration> </File> + <File + RelativePath="..\tone_gen.cxx" + > + </File> <Filter Name="h323lib" *************** *** 908,911 **** --- 912,919 ---- </File> <File + RelativePath="..\tone_gen.h" + > + </File> + <File RelativePath="..\version.h" > |
|
From: Vyacheslav F. <vf...@us...> - 2010-10-12 16:46:33
|
Update of /cvsroot/t38modem/t38modem/opal In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv31675/opal Modified Files: t38modem_2005.vcproj Log Message: Implemented fake streams Index: t38modem_2005.vcproj =================================================================== RCS file: /cvsroot/t38modem/t38modem/opal/t38modem_2005.vcproj,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** t38modem_2005.vcproj 12 Feb 2010 08:50:19 -0000 1.5 --- t38modem_2005.vcproj 12 Oct 2010 16:46:26 -0000 1.6 *************** *** 408,411 **** --- 408,415 ---- > </File> + <File + RelativePath="..\tone_gen.cxx" + > + </File> <Filter Name="opal" *************** *** 502,505 **** --- 506,513 ---- </File> <File + RelativePath="..\tone_gen.h" + > + </File> + <File RelativePath="..\version.h" > |
|
From: Vyacheslav F. <vf...@us...> - 2010-10-12 16:43:08
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv30787 Added Files: tone_gen.cxx tone_gen.h Log Message: Initial revision --- NEW FILE: tone_gen.h --- /* * tone_gen.h * * T38FAX Pseudo Modem * * Copyright (c) 2010 Vyacheslav Frolov * * t38modem Project * * The contents of this file are subject to the Mozilla Public License * Version 1.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is t38modem. * * The Initial Developer of the Original Code is Vyacheslav Frolov * * Contributor(s): * * $Log: tone_gen.h,v $ * Revision 1.1 2010/10/12 16:43:00 vfrolov * Initial revision * */ #ifndef _TONE_GEN_H #define _TONE_GEN_H /////////////////////////////////////////////////////////////// class ToneGenerator : public PObject { PCLASSINFO(ToneGenerator, PObject); public: enum ToneType { ttSilence, ttCng, ttCed, ttRing, ttBusy, }; ToneGenerator(ToneType tt = ttSilence); void Read(void * buffer, PINDEX amount); ToneType Type() const { return type; } protected: ToneType type; PINDEX bytesOn; PINDEX bytesOff; const BYTE *pToneOn; PINDEX bytesToneOn; PINDEX index; }; /////////////////////////////////////////////////////////////// #endif // _TONE_GEN_H --- NEW FILE: tone_gen.cxx --- /* * tone_gen.cxx * * T38FAX Pseudo Modem * * Copyright (c) 2010 Vyacheslav Frolov * * t38modem Project * * The contents of this file are subject to the Mozilla Public License * Version 1.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is t38modem. * * The Initial Developer of the Original Code is Vyacheslav Frolov * * Contributor(s): * * $Log: tone_gen.cxx,v $ * Revision 1.1 2010/10/12 16:43:00 vfrolov * Initial revision * */ #include <ptlib.h> #include <math.h> #include "pmutils.h" #include "tone_gen.h" /////////////////////////////////////////////////////////////// #define new PNEW /////////////////////////////////////////////////////////////// #define CNG_HZ 1100 #define CNG_MAX_DIV 100 #define CNG_AMPLITUDE 5000 #define CNG_ON_MSEC 500 #define CNG_OFF_MSEC 3000 /////////////////////////////////////////////////////////////// #define CED_HZ 2100 #define CED_MAX_DIV 100 #define CED_AMPLITUDE 5000 #define CED_ON_MSEC 3500 /////////////////////////////////////////////////////////////// #define RING_RU_HZ 425 #define RING_RU_MAX_DIV 25 #define RING_RU_AMPLITUDE 5000 #define RING_RU_ON_MSEC 1000 #define RING_RU_OFF_MSEC 4000 /////////////////////////////////////////////////////////////// #define BUSY_RU_HZ 425 #define BUSY_RU_MAX_DIV 25 #define BUSY_RU_AMPLITUDE 5000 #define BUSY_RU_ON_MSEC 350 #define BUSY_RU_OFF_MSEC 350 /////////////////////////////////////////////////////////////// typedef PInt16 SIMPLE_TYPE; #define BYTES_PER_SIMPLE sizeof(SIMPLE_TYPE) #define SIMPLES_PER_SEC 8000 /////////////////////////////////////////////////////////////// #define TWO_PI (3.1415926535897932384626433832795029L*2) static PBoolean InitTone(const void *, BYTE *pTone, size_t amount, unsigned hz, SIMPLE_TYPE ampl) { for( size_t i = 0 ; i < amount/BYTES_PER_SIMPLE ; i++ ) { double Sin = sin(double((hz*TWO_PI*i)/SIMPLES_PER_SEC)); ((SIMPLE_TYPE *)pTone)[i] = (SIMPLE_TYPE)(Sin * ampl); } return TRUE; } /////////////////////////////////////////////////////////////// #define MSEC2BYTES(ms) (((SIMPLES_PER_SEC*(ms))/1000)*BYTES_PER_SIMPLE) #define MAX_DIV2BYTES(maxdiv) ((SIMPLES_PER_SEC/(maxdiv))*BYTES_PER_SIMPLE) /////////////////////////////////////////////////////////////// ToneGenerator::ToneGenerator(ToneGenerator::ToneType tt) : type(tt) , index(0) { switch(tt) { case ttCng: { static BYTE toneOn[MAX_DIV2BYTES(CNG_MAX_DIV)]; static const PBoolean initTone = InitTone(&initTone, toneOn, sizeof(toneOn), CNG_HZ, CNG_AMPLITUDE); bytesOn = MSEC2BYTES(CNG_ON_MSEC); bytesOff = MSEC2BYTES(CNG_OFF_MSEC); pToneOn = toneOn; bytesToneOn = sizeof(toneOn); // begin with 1 sec silence #if CNG_OFF_MSEC < 1000 #error CNG_OFF_MSEC < 1000 #endif index = bytesOn + bytesOff - MSEC2BYTES(1000); break; } case ttCed: { static BYTE toneOn[MAX_DIV2BYTES(CED_MAX_DIV)]; static const PBoolean initTone = InitTone(&initTone, toneOn, sizeof(toneOn), CED_HZ, CED_AMPLITUDE); bytesOn = MSEC2BYTES(CED_ON_MSEC); bytesOff = (P_MAX_INDEX/BYTES_PER_SIMPLE)*BYTES_PER_SIMPLE - bytesOn; pToneOn = toneOn; bytesToneOn = sizeof(toneOn); // begin with 200 ms silence index = bytesOn + bytesOff - MSEC2BYTES(200); break; } case ttRing: { static BYTE toneOn[MAX_DIV2BYTES(RING_RU_MAX_DIV)]; static const PBoolean initTone = InitTone(&initTone, toneOn, sizeof(toneOn), RING_RU_HZ, RING_RU_AMPLITUDE); bytesOn = MSEC2BYTES(RING_RU_ON_MSEC); bytesOff = MSEC2BYTES(RING_RU_OFF_MSEC); pToneOn = toneOn; bytesToneOn = sizeof(toneOn); break; } case ttBusy: { static BYTE toneOn[MAX_DIV2BYTES(BUSY_RU_MAX_DIV)]; static const PBoolean initTone = InitTone(&initTone, toneOn, sizeof(toneOn), BUSY_RU_HZ, BUSY_RU_AMPLITUDE); bytesOn = MSEC2BYTES(BUSY_RU_ON_MSEC); bytesOff = MSEC2BYTES(BUSY_RU_OFF_MSEC); pToneOn = toneOn; bytesToneOn = sizeof(toneOn); break; } default: bytesOn = 0; bytesOff = (P_MAX_INDEX/BYTES_PER_SIMPLE)*BYTES_PER_SIMPLE - bytesOn; pToneOn = NULL; bytesToneOn = 0; } } void ToneGenerator::Read(void * buffer, PINDEX amount) { BYTE *pBuf = (BYTE *)buffer; PINDEX bytesOnOff = bytesOn + bytesOff; while(amount) { if (index >= bytesOnOff) index = 0; PINDEX len; if (bytesOn > index) { PINDEX i = index % bytesToneOn; len = bytesToneOn - i; if (len > amount) len = amount; memcpy(pBuf, pToneOn + i, len); } else { len = bytesOnOff - index; if (len > amount) len = amount; memset(pBuf, 0, len); } pBuf += len; amount -= len; index += len; } } /////////////////////////////////////////////////////////////// |
|
From: Vyacheslav F. <vf...@us...> - 2010-10-08 12:31:12
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv8210 Modified Files: pmodeme.cxx Log Message: Optimized Mutex usage Index: pmodeme.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/pmodeme.cxx,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** pmodeme.cxx 8 Oct 2010 06:06:39 -0000 1.101 --- pmodeme.cxx 8 Oct 2010 12:31:03 -0000 1.102 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.102 2010/10/08 12:31:03 vfrolov + * Optimized Mutex usage + * * Revision 1.101 2010/10/08 06:06:39 vfrolov * Added diagErrorMask *************** *** 1485,1491 **** break; case mceAudio: ! if (P.ModemClassId() == EngineBase::mcAudio) { currentClassEngine = activeEngines[mce]; - } if (state == stConnectHandle && subState == chWaitAudioEngine) { --- 1488,1493 ---- break; case mceAudio: ! if (P.ModemClassId() == EngineBase::mcAudio) currentClassEngine = activeEngines[mce]; if (state == stConnectHandle && subState == chWaitAudioEngine) { *************** *** 1562,1590 **** << " (" << seq << ", " << state << ")"); - PWaitAndSignal mutexWait(Mutex); - - if (extra == seq) { - switch (state) { - case stSendAckWait: - SetState(stSendAckHandle); - timeout.Stop(); - break; - case stRecvBegWait: - SetState(stRecvBegHandle); - timeout.Stop(); - break; - case stConnectHandle: - if (subState == chWaitPlayTone) { - SetSubState(chTonePlayed); - timeout.Stop(); - } - break; - default: - break; - } - } - else switch (extra) { ! case EngineBase::cbpOutBufEmpty: switch (state) { case stSend: --- 1564,1571 ---- << " (" << seq << ", " << state << ")"); switch (extra) { ! case EngineBase::cbpOutBufEmpty: { ! PWaitAndSignal mutexWait(Mutex); ! switch (state) { case stSend: *************** *** 1595,1598 **** --- 1576,1580 ---- } break; + } case EngineBase::cbpReset: case EngineBase::cbpOutBufNoFull: *************** *** 1600,1605 **** case EngineBase::cbpUserInput: break; ! default: ! myPTRACE(1, "ModemEngineBody::OnEngineCallback extra(" << extra << ") != seq(" << seq << ")"); } --- 1582,1611 ---- case EngineBase::cbpUserInput: break; ! default: { ! PWaitAndSignal mutexWait(Mutex); ! ! if (extra == seq) { ! switch (state) { ! case stSendAckWait: ! SetState(stSendAckHandle); ! timeout.Stop(); ! break; ! case stRecvBegWait: ! SetState(stRecvBegHandle); ! timeout.Stop(); ! break; ! case stConnectHandle: ! if (subState == chWaitPlayTone) { ! SetSubState(chTonePlayed); ! timeout.Stop(); ! } ! break; ! default: ! break; ! } ! } else { ! myPTRACE(1, "ModemEngineBody::OnEngineCallback extra(" << extra << ") != seq(" << seq << ")"); ! } ! } } |
|
From: Vyacheslav F. <vf...@us...> - 2010-10-08 06:10:01
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28168 Modified Files: t38engine.cxx Log Message: Added parameter assert to SetPreparePacketTimeout() Index: t38engine.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/t38engine.cxx,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** t38engine.cxx 6 Oct 2010 16:54:19 -0000 1.71 --- t38engine.cxx 8 Oct 2010 06:09:53 -0000 1.72 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.72 2010/10/08 06:09:53 vfrolov + * Added parameter assert to SetPreparePacketTimeout() + * * Revision 1.71 2010/10/06 16:54:19 vfrolov * Redesigned engine opening/closing *************** *** 293,297 **** enum StateModem { stmIdle, - stmError, stmOutMoreData, --- 296,299 ---- *************** *** 579,586 **** PTRACE(1, name << " ~T38Engine"); ! if( modStreamIn != NULL ) delete modStreamIn; ! if( modStreamInSaved != NULL ) delete modStreamInSaved; } --- 581,588 ---- PTRACE(1, name << " ~T38Engine"); ! if (modStreamIn != NULL) delete modStreamIn; ! if (modStreamInSaved != NULL) delete modStreamInSaved; } *************** *** 977,980 **** --- 979,984 ---- void T38Engine::SetPreparePacketTimeout(HOWNEROUT hOwner, int timeout, int period) { + PAssert((timeout == 0 && period > 0) || (timeout != 0 && period < 0), "Invalid timeout/period"); + if (hOwnerOut != hOwner) return; *************** *** 985,991 **** return; - if (timeout == 0 && period == -1) - period = 20; - preparePacketTimeout = timeout; preparePacketPeriod = period; --- 989,992 ---- *************** *** 1544,1548 **** break; } else { ! modStreamIn->PutEof(diagOutOfOrder); myPTRACE(1, name << " HandlePacket out of order " << type_of_msg); } --- 1545,1549 ---- break; } else { ! modStreamIn->PutEof(diagOutOfOrder | diagNoCarrier); myPTRACE(1, name << " HandlePacket out of order " << type_of_msg); } *************** *** 1662,1666 **** myPTRACE(1, name << " HandlePacket modStream->ModPars.msgType(" << modStream->ModPars.msgType << ") != type_of_msg(" << type_of_msg << ")"); ! modStream->PutEof(diagOutOfOrder); modStream = NULL; } --- 1663,1667 ---- myPTRACE(1, name << " HandlePacket modStream->ModPars.msgType(" << modStream->ModPars.msgType << ") != type_of_msg(" << type_of_msg << ")"); ! modStream->PutEof(diagOutOfOrder | diagNoCarrier); modStream = NULL; } |
|
From: Vyacheslav F. <vf...@us...> - 2010-10-08 06:06:47
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv27673 Modified Files: hdlc.cxx pmodeme.cxx Log Message: Added diagErrorMask Index: pmodeme.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/pmodeme.cxx,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** pmodeme.cxx 6 Oct 2010 16:54:19 -0000 1.100 --- pmodeme.cxx 8 Oct 2010 06:06:39 -0000 1.101 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.101 2010/10/08 06:06:39 vfrolov + * Added diagErrorMask + * * Revision 1.100 2010/10/06 16:54:19 vfrolov * Redesigned engine opening/closing *************** *** 3608,3612 **** PWaitAndSignal mutexWait(Mutex); ! switch( count ) { case -1: SetState(stSendAckWait); --- 3611,3616 ---- PWaitAndSignal mutexWait(Mutex); ! ! switch (count) { case -1: SetState(stSendAckWait); *************** *** 3925,3929 **** { SetState(stSendAckWait); ! if( !activeEngines[mceT38] || !activeEngines[mceT38]->SendStop(moreFrames, NextSeq()) ) { SetState(stSendAckHandle); timeout.Stop(); --- 3929,3933 ---- { SetState(stSendAckWait); ! if (!currentClassEngine || !currentClassEngine->SendStop(moreFrames, NextSeq())) { SetState(stSendAckHandle); timeout.Stop(); *************** *** 4167,4171 **** Buf[0] = BYTE(fcs >> 8); Buf[1] = BYTE(fcs); ! if (diag & EngineBase::diagBadFcs) Buf[0]++; dleData.PutData(Buf, 2); --- 4171,4175 ---- Buf[0] = BYTE(fcs >> 8); Buf[1] = BYTE(fcs); ! if (diag & EngineBase::diagErrorMask) Buf[0]++; dleData.PutData(Buf, 2); *************** *** 4278,4282 **** resp = RC_OK(); else ! if (dataCount == 0 && (diag & ~EngineBase::diagNoCarrier) == 0) resp = RC_NO_CARRIER(); else --- 4282,4286 ---- resp = RC_OK(); else ! if (dataCount == 0 && (diag & EngineBase::diagErrorMask) == 0) resp = RC_NO_CARRIER(); else Index: hdlc.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/hdlc.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** hdlc.cxx 9 Nov 2009 19:12:57 -0000 1.7 --- hdlc.cxx 8 Oct 2010 06:06:39 -0000 1.8 *************** *** 4,8 **** * T38FAX Pseudo Modem * ! * Copyright (c) 2003-2009 Vyacheslav Frolov * * Open H323 Project --- 4,8 ---- * T38FAX Pseudo Modem * ! * Copyright (c) 2003-2010 Vyacheslav Frolov * * Open H323 Project *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.8 2010/10/08 06:06:39 vfrolov + * Added diagErrorMask + * * Revision 1.7 2009/11/09 19:12:57 vfrolov * Changed T38Engine to EngineBase *************** *** 221,225 **** Buf[0] = BYTE(fcs >> 8); Buf[1] = BYTE(fcs & 0xFF); ! if (inData->GetDiag() & EngineBase::diagBadFcs) Buf[0]++; pack(Buf, 2); --- 224,228 ---- Buf[0] = BYTE(fcs >> 8); Buf[1] = BYTE(fcs & 0xFF); ! if (inData->GetDiag() & EngineBase::diagErrorMask) Buf[0]++; pack(Buf, 2); |
|
From: Vyacheslav F. <vf...@us...> - 2010-10-08 06:05:08
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv27023 Modified Files: enginebase.h Log Message: Added diagErrorMask Index: enginebase.h =================================================================== RCS file: /cvsroot/t38modem/t38modem/enginebase.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** enginebase.h 6 Oct 2010 16:54:19 -0000 1.12 --- enginebase.h 8 Oct 2010 06:04:59 -0000 1.13 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.13 2010/10/08 06:04:59 vfrolov + * Added diagErrorMask + * * Revision 1.12 2010/10/06 16:54:19 vfrolov * Redesigned engine opening/closing *************** *** 118,126 **** enum { ! diagOutOfOrder = 0x01, ! diagDiffSig = 0x04, // a different signal is detected ! diagBadFcs = 0x08, ! diagNoCarrier = 0x10, ! diagError = 0x80, // bad usage }; --- 121,131 ---- enum { ! diagNoCarrier = 0x0001, ! diagOutOfOrder = 0x0100, ! diagDiffSig = 0x0400, // a different signal is detected ! diagBadFcs = 0x0800, ! diagError = 0x8000, // bad usage ! ! diagErrorMask = 0xFF00, }; |
|
From: Vyacheslav F. <vf...@us...> - 2010-10-07 05:33:29
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28908 Modified Files: ReadMe.txt Log Message: Added h323lib 38modem_openh323_2005.vcproj Index: ReadMe.txt =================================================================== RCS file: /cvsroot/t38modem/t38modem/ReadMe.txt,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ReadMe.txt 10 Sep 2010 05:36:23 -0000 1.27 --- ReadMe.txt 7 Oct 2010 05:33:18 -0000 1.28 *************** *** 48,59 **** Building with Open H323 Library: ! Start Microsoft Visual C++ 2005 with h323lib\t38modem_2005.vcproj file. Set Active Configuration to "t38modem - Win32 Release". - Add "PBoolean=BOOL" to - [Project]->[t38modem Properties]->[Configuration Properties]-> - [C/C++]->[Preprocessor]->[Preprocessor Definitions]. - Change "h323plus.lib" to "openh323.lib" in - [Project]->[t38modem Properties]->[Configuration Properties]-> - [Linker]->[Input]->[Additional Dependensies]. Build t38modem.exe. --- 48,53 ---- Building with Open H323 Library: ! Start Microsoft Visual C++ 2005 with h323lib\t38modem_openh323_2005.vcproj file. Set Active Configuration to "t38modem - Win32 Release". Build t38modem.exe. |
|
From: Vyacheslav F. <vf...@us...> - 2010-10-07 05:32:08
|
Update of /cvsroot/t38modem/t38modem/h323lib In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28742 Added Files: t38modem_openh323_2005.sln t38modem_openh323_2005.vcproj Log Message: Initial revision --- NEW FILE: t38modem_openh323_2005.vcproj --- <?xml version="1.0" encoding="windows-1251"?> <VisualStudioProject ProjectType="Visual C++" Version="8,00" Name="t38modem" ProjectGUID="{5684EA1E-9DEC-4701-A81E-FBF8133A77B5}" > <Platforms> <Platform Name="Win32" /> </Platforms> <ToolFiles> </ToolFiles> <Configurations> <Configuration Name="No Trace|Win32" OutputDirectory=".\NoTrace" IntermediateDirectory=".\NoTrace" ConfigurationType="1" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" PreprocessorDefinitions="NDEBUG" MkTypLibCompatible="true" SuppressStartupBanner="true" TargetEnvironment="1" TypeLibraryName=".\NoTrace/t38modem.tlb" HeaderFileName="" /> <Tool Name="VCCLCompilerTool" Optimization="3" InlineFunctionExpansion="2" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" PreprocessorDefinitions="NDEBUG;PTRACING=0;PASN_NOPRINTON;PASN_LEANANDMEAN;PBoolean=BOOL" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" RuntimeTypeInfo="true" UsePrecompiledHeader="2" PrecompiledHeaderThrough="ptlib.h" PrecompiledHeaderFile=".\NoTrace/t38modem.pch" AssemblerListingLocation=".\NoTrace/" ObjectFile=".\NoTrace/" ProgramDataBaseFileName=".\NoTrace/" WarningLevel="4" SuppressStartupBanner="true" Detect64BitPortabilityProblems="true" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG,_AFXDLL" Culture="3081" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" AdditionalDependencies="openh323n.lib ptlibn.lib wsock32.lib" OutputFile=".\NoTrace/t38modem.exe" LinkIncremental="1" SuppressStartupBanner="true" ProgramDatabaseFile=".\NoTrace/t38modem.pdb" SubSystem="1" TargetMachine="1" /> <Tool Name="VCALinkTool" /> <Tool Name="VCManifestTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" SuppressStartupBanner="true" OutputFile=".\NoTrace/t38modem.bsc" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCWebDeploymentTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> <Configuration Name="Debug|Win32" OutputDirectory=".\Debug" IntermediateDirectory=".\Debug" ConfigurationType="1" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" PreprocessorDefinitions="_DEBUG" MkTypLibCompatible="true" SuppressStartupBanner="true" TargetEnvironment="1" TypeLibraryName=".\Debug/t38modem.tlb" HeaderFileName="" /> <Tool Name="VCCLCompilerTool" Optimization="0" FavorSizeOrSpeed="1" PreprocessorDefinitions="_DEBUG;PTRACING;PBoolean=BOOL" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" RuntimeTypeInfo="true" UsePrecompiledHeader="2" PrecompiledHeaderThrough="ptlib.h" PrecompiledHeaderFile=".\Debug/t38modem.pch" AssemblerListingLocation=".\Debug/" ObjectFile=".\Debug/" ProgramDataBaseFileName=".\Debug/" WarningLevel="4" SuppressStartupBanner="true" Detect64BitPortabilityProblems="true" DebugInformationFormat="4" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG,_AFXDLL" Culture="3081" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" AdditionalDependencies="openh323d.lib ptlibd.lib wsock32.lib" OutputFile=".\Debug/t38modem.exe" LinkIncremental="2" SuppressStartupBanner="true" GenerateDebugInformation="true" ProgramDatabaseFile=".\Debug/t38modem.pdb" SubSystem="1" TargetMachine="1" /> <Tool Name="VCALinkTool" /> <Tool Name="VCManifestTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" SuppressStartupBanner="true" OutputFile=".\Debug/t38modem.bsc" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCWebDeploymentTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory=".\Release" IntermediateDirectory=".\Release" ConfigurationType="1" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" PreprocessorDefinitions="NDEBUG" MkTypLibCompatible="true" SuppressStartupBanner="true" TargetEnvironment="1" TypeLibraryName=".\Release/t38modem.tlb" HeaderFileName="" /> <Tool Name="VCCLCompilerTool" Optimization="3" InlineFunctionExpansion="2" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" PreprocessorDefinitions="NDEBUG;PTRACING;PBoolean=BOOL" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" RuntimeTypeInfo="true" UsePrecompiledHeader="2" PrecompiledHeaderThrough="ptlib.h" PrecompiledHeaderFile=".\Release/t38modem.pch" AssemblerListingLocation=".\Release/" ObjectFile=".\Release/" ProgramDataBaseFileName=".\Release/" WarningLevel="4" SuppressStartupBanner="true" Detect64BitPortabilityProblems="true" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG,_AFXDLL" Culture="3081" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" AdditionalDependencies="openh323.lib ptlib.lib wsock32.lib" OutputFile=".\Release/t38modem.exe" LinkIncremental="1" SuppressStartupBanner="true" ProgramDatabaseFile=".\Release/t38modem.pdb" SubSystem="1" TargetMachine="1" /> <Tool Name="VCALinkTool" /> <Tool Name="VCManifestTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" SuppressStartupBanner="true" OutputFile=".\Release/t38modem.bsc" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCWebDeploymentTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="Source Files" Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" > <File RelativePath="..\audio.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\dle.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\drivers.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\drv_c0c.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\drv_pty.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\enginebase.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\fcs.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\hdlc.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\main_process.cxx" > </File> <File RelativePath="..\pmodem.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\pmodeme.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\pmodemi.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\pmutils.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\precompile.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" UsePrecompiledHeader="1" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" UsePrecompiledHeader="1" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" UsePrecompiledHeader="1" /> </FileConfiguration> </File> <File RelativePath="..\t30.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\t30tone.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath="..\t38engine.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <Filter Name="h323lib" > <File RelativePath=".\audio_chan.cxx" > </File> <File RelativePath=".\g7231_fake.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath=".\h323ep.cxx" > <FileConfiguration Name="No Trace|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="" /> </FileConfiguration> </File> <File RelativePath=".\t38protocol.cxx" > </File> </Filter> </Filter> <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl" > <File RelativePath="..\audio.h" > </File> <File RelativePath="..\dle.h" > </File> <File RelativePath="..\drivers.h" > </File> <File RelativePath="..\drv_c0c.h" > </File> <File RelativePath="..\drv_pty.h" > </File> <File RelativePath="..\enginebase.h" > </File> <File RelativePath="..\fcs.h" > </File> <File RelativePath="..\hdlc.h" > </File> <File RelativePath="..\pmodem.h" > </File> <File RelativePath="..\pmodeme.h" > </File> <File RelativePath="..\pmodemi.h" > </File> <File RelativePath="..\pmutils.h" > </File> <File RelativePath="..\t30.h" > </File> <File RelativePath="..\t30tone.h" > </File> <File RelativePath="..\t38engine.h" > </File> <File RelativePath="..\version.h" > </File> <Filter Name="h323lib" > <File RelativePath=".\audio_chan.h" > </File> <File RelativePath=".\g7231_fake.h" > </File> <File RelativePath=".\h323ep.h" > </File> <File RelativePath=".\t38protocol.h" > </File> </Filter> </Filter> <Filter Name="Resource Files" Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" > </Filter> <Filter Name="Other Files" > <File RelativePath="..\Changes.txt" > </File> <File RelativePath="..\ReadMe.txt" > </File> </Filter> </Files> <Globals> </Globals> </VisualStudioProject> --- NEW FILE: t38modem_openh323_2005.sln --- Microsoft Visual Studio Solution File, Format Version 9.00 # Visual C++ Express 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "t38modem", "t38modem_openh323_2005.vcproj", "{5684EA1E-9DEC-4701-A81E-FBF8133A77B5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 No Trace|Win32 = No Trace|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {5684EA1E-9DEC-4701-A81E-FBF8133A77B5}.Debug|Win32.ActiveCfg = Debug|Win32 {5684EA1E-9DEC-4701-A81E-FBF8133A77B5}.Debug|Win32.Build.0 = Debug|Win32 {5684EA1E-9DEC-4701-A81E-FBF8133A77B5}.No Trace|Win32.ActiveCfg = No Trace|Win32 {5684EA1E-9DEC-4701-A81E-FBF8133A77B5}.No Trace|Win32.Build.0 = No Trace|Win32 {5684EA1E-9DEC-4701-A81E-FBF8133A77B5}.Release|Win32.ActiveCfg = Release|Win32 {5684EA1E-9DEC-4701-A81E-FBF8133A77B5}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal |
|
From: Vyacheslav F. <vf...@us...> - 2010-10-06 16:54:29
|
Update of /cvsroot/t38modem/t38modem/h323lib In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv13786/h323lib Modified Files: h323ep.cxx t38modem_2005.vcproj t38protocol.cxx Log Message: Redesigned engine opening/closing Index: t38protocol.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/h323lib/t38protocol.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** t38protocol.cxx 29 Sep 2010 11:52:59 -0000 1.2 --- t38protocol.cxx 6 Oct 2010 16:54:19 -0000 1.3 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.3 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.2 2010/09/29 11:52:59 vfrolov * Redesigned engine attaching/detaching *************** *** 55,59 **** T38Protocol::~T38Protocol() { ! if (t38engine) ReferenceObject::DelPointer(t38engine); } --- 58,62 ---- T38Protocol::~T38Protocol() { ! if (t38engine != NULL) ReferenceObject::DelPointer(t38engine); } *************** *** 110,114 **** if (IS_NATIVE_ASN) { if (pdu.DecodeSubType(ifp)) ! return t38engine->HandlePacket(ifp); PTRACE(2, "T38\t" T38_IFP_NAME " decode failure:\n " << setprecision(2) << ifp); --- 113,117 ---- if (IS_NATIVE_ASN) { if (pdu.DecodeSubType(ifp)) ! return t38engine->HandlePacket(EngineBase::HOWNERIN(this), ifp); PTRACE(2, "T38\t" T38_IFP_NAME " decode failure:\n " << setprecision(2) << ifp); *************** *** 137,141 **** } ! return t38engine->HandlePacket(ifp); } --- 140,144 ---- } ! return t38engine->HandlePacket(EngineBase::HOWNERIN(this), ifp); } *************** *** 158,161 **** --- 161,166 ---- #endif + t38engine->OpenOut(EngineBase::HOWNEROUT(this)); + for (;;) { T38_IFP ifp; *************** *** 163,167 **** if (seq < 0) { ! t38engine->SetPreparePacketTimeout(-1); } else { int timeout = ( --- 168,172 ---- if (seq < 0) { ! t38engine->SetPreparePacketTimeout(EngineBase::HOWNEROUT(this), -1); } else { int timeout = ( *************** *** 174,181 **** timeout = re_interval; ! t38engine->SetPreparePacketTimeout(timeout); } ! res = t38engine->PreparePacket(ifp); #ifdef REPEAT_INDICATOR_SENDING --- 179,186 ---- timeout = re_interval; ! t38engine->SetPreparePacketTimeout(EngineBase::HOWNEROUT(this), timeout); } ! res = t38engine->PreparePacket(EngineBase::HOWNEROUT(this), ifp); #ifdef REPEAT_INDICATOR_SENDING *************** *** 327,330 **** --- 332,337 ---- #endif + t38engine->OpenIn(EngineBase::HOWNERIN(this)); + for (;;) { PPER_Stream rawData; *************** *** 386,390 **** int nRedundancy = secondary.GetSize(); if (lost > nRedundancy) { ! if (!t38engine->HandlePacketLost(lost - nRedundancy)) break; #if PTRACING --- 393,397 ---- int nRedundancy = secondary.GetSize(); if (lost > nRedundancy) { ! if (!t38engine->HandlePacketLost(EngineBase::HOWNERIN(this), lost - nRedundancy)) break; #if PTRACING *************** *** 417,421 **** if (lost) { ! if (!t38engine->HandlePacketLost(lost)) break; #if PTRACING --- 424,428 ---- if (lost) { ! if (!t38engine->HandlePacketLost(EngineBase::HOWNERIN(this), lost)) break; #if PTRACING *************** *** 454,458 **** OpalT38Protocol::CleanUpOnTermination(); ! t38engine->Close(); } /////////////////////////////////////////////////////////////// --- 461,466 ---- OpalT38Protocol::CleanUpOnTermination(); ! t38engine->CloseIn(EngineBase::HOWNERIN(this)); ! t38engine->CloseOut(EngineBase::HOWNEROUT(this)); } /////////////////////////////////////////////////////////////// Index: t38modem_2005.vcproj =================================================================== RCS file: /cvsroot/t38modem/t38modem/h323lib/t38modem_2005.vcproj,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** t38modem_2005.vcproj 29 Jul 2009 10:39:04 -0000 1.6 --- t38modem_2005.vcproj 6 Oct 2010 16:54:19 -0000 1.7 *************** *** 778,781 **** --- 778,785 ---- > <File + RelativePath=".\audio_chan.cxx" + > + </File> + <File RelativePath=".\g7231_fake.cxx" > *************** *** 911,914 **** --- 915,922 ---- > <File + RelativePath=".\audio_chan.h" + > + </File> + <File RelativePath=".\g7231_fake.h" > Index: h323ep.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/h323lib/h323ep.cxx,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** h323ep.cxx 29 Sep 2010 11:52:59 -0000 1.55 --- h323ep.cxx 6 Oct 2010 16:54:19 -0000 1.56 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.56 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.55 2010/09/29 11:52:59 vfrolov * Redesigned engine attaching/detaching *************** *** 187,191 **** #include "g7231_fake.h" #include "t38protocol.h" ! #include "../audio.h" #include "../pmodem.h" #include "../drivers.h" --- 190,195 ---- #include "g7231_fake.h" #include "t38protocol.h" ! #include "audio_chan.h" ! #include "../enginebase.h" #include "../pmodem.h" #include "../drivers.h" *************** *** 220,224 **** PMutex connMutex; PseudoModem * pmodem; ! AudioEngine * audioEngine; }; /////////////////////////////////////////////////////////////// --- 224,228 ---- PMutex connMutex; PseudoModem * pmodem; ! EngineBase * userInputEngine; }; /////////////////////////////////////////////////////////////// *************** *** 688,693 **** MyH323Connection::MyH323Connection(MyH323EndPoint & _ep, unsigned callReference) ! : H323Connection(_ep, callReference), ep(_ep), ! pmodem(NULL), audioEngine(NULL) { } --- 692,698 ---- MyH323Connection::MyH323Connection(MyH323EndPoint & _ep, unsigned callReference) ! : H323Connection(_ep, callReference), ep(_ep) ! , pmodem(NULL) ! , userInputEngine(NULL) { } *************** *** 708,713 **** } ! if (audioEngine) ! ReferenceObject::DelPointer(audioEngine); } --- 713,718 ---- } ! if (userInputEngine != NULL) ! ReferenceObject::DelPointer(userInputEngine); } *************** *** 732,739 **** pmodem = _pmodem; ! if (audioEngine == NULL) ! audioEngine = pmodem->NewPtrAudioEngine(); ! ! return audioEngine != NULL; } --- 737,741 ---- pmodem = _pmodem; ! return TRUE; } *************** *** 879,889 **** } ! PBoolean MyH323Connection::OpenAudioChannel(PBoolean isEncoding, unsigned /* bufferSize */, H323AudioCodec & codec) { ! PTRACE(2, "MyH323Connection::OpenAudioChannel " << codec); ! PAssert(audioEngine != NULL, "audioEngine is NULL"); ! codec.AttachChannel(audioEngine, FALSE); return TRUE; --- 881,899 ---- } ! PBoolean MyH323Connection::OpenAudioChannel(PBoolean isEncoding, unsigned /*bufferSize*/, H323AudioCodec & codec) { ! PTRACE(2, "MyH323Connection::OpenAudioChannel " << codec << (isEncoding ? " encoding" : " decoding")); ! if (pmodem == NULL) ! return FALSE; ! ModemAudioChannel *audioChannel = new ModemAudioChannel(isEncoding, pmodem); ! ! if (!audioChannel || !audioChannel->IsOK()) { ! delete audioChannel; ! PTRACE(1, "MyH323Connection::OpenAudioChannel can't create ModemAudioChannel"); ! } ! ! codec.AttachChannel(audioChannel, TRUE); return TRUE; *************** *** 892,900 **** void MyH323Connection::OnUserInputString(const PString & value) { ! PAssert(audioEngine != NULL, "audioEngine is NULL"); ! audioEngine->WriteUserInput(value); ! } ! // End of File /////////////////////////////////////////////////////////////// --- 902,917 ---- void MyH323Connection::OnUserInputString(const PString & value) { ! if (userInputEngine == NULL) { ! if (pmodem == NULL) ! return; ! userInputEngine = pmodem->NewPtrUserInputEngine(); ! if (userInputEngine == NULL) ! return; ! } ! ! userInputEngine->WriteUserInput(value); ! } ! /////////////////////////////////////////////////////////////// |
|
From: Vyacheslav F. <vf...@us...> - 2010-10-06 16:54:28
|
Update of /cvsroot/t38modem/t38modem In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv13786 Modified Files: Makefile audio.cxx audio.h enginebase.cxx enginebase.h pmodem.h pmodeme.cxx pmodeme.h pmodemi.cxx pmodemi.h t38engine.cxx t38engine.h Log Message: Redesigned engine opening/closing Index: pmodeme.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/pmodeme.cxx,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** pmodeme.cxx 6 Oct 2010 10:13:23 -0000 1.99 --- pmodeme.cxx 6 Oct 2010 16:54:19 -0000 1.100 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.100 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.99 2010/10/06 10:13:23 vfrolov * Fixed previous fix *************** *** 1085,1088 **** --- 1088,1099 ---- } + EngineBase *ModemEngine::NewPtrUserInputEngine() const + { + if (!body) + return NULL; + + return body->NewPtrEngine(mceAudio); + } + PBoolean ModemEngine::Request(PStringToString &request) const { *************** *** 1327,1331 **** } else ! if (CallToken() == request("calltoken")) { SetCallState(cstAlerted); --- 1338,1342 ---- } else ! if (CallToken().IsEmpty() || CallToken() == request("calltoken")) { SetCallState(cstAlerted); *************** *** 1354,1358 **** } else ! if (CallToken() == request("calltoken")) { timerRing.Stop(); SetCallState(cstEstablished); --- 1365,1369 ---- } else ! if (CallToken().IsEmpty() || CallToken() == request("calltoken")) { timerRing.Stop(); SetCallState(cstEstablished); *************** *** 1376,1380 **** } else ! if (CallToken() == request("calltoken")) { CallToken(""); --- 1387,1391 ---- } else ! if (CallToken().IsEmpty() || CallToken() == request("calltoken")) { CallToken(""); Index: t38engine.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/t38engine.cxx,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** t38engine.cxx 22 Sep 2010 15:39:19 -0000 1.70 --- t38engine.cxx 6 Oct 2010 16:54:19 -0000 1.71 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.71 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.70 2010/09/22 15:39:19 vfrolov * Moved ResetModemState() to EngineBase *************** *** 564,568 **** #endif , countIn(0) - , firstIn(TRUE) , t30() , modStreamIn(NULL) --- 567,570 ---- *************** *** 575,579 **** T38Engine::~T38Engine() { ! PTRACE(1, name << " ~T38Engine "); if( modStreamIn != NULL ) --- 577,581 ---- T38Engine::~T38Engine() { ! PTRACE(1, name << " ~T38Engine"); if( modStreamIn != NULL ) *************** *** 582,594 **** if( modStreamInSaved != NULL ) delete modStreamInSaved; - - if (isOpenIn) - myPTRACE(1, name << " ~T38Engine isOpenIn"); - - if (isOpenOut) - myPTRACE(1, name << " ~T38Engine isOpenOut"); - - if( !modemCallback.IsNULL() ) - myPTRACE(1, name << " ~T38Engine !modemCallback.IsNULL()"); } --- 584,587 ---- *************** *** 596,600 **** { EngineBase::OnOpenIn(); - firstIn = TRUE; } --- 589,592 ---- *************** *** 602,606 **** { EngineBase::OnOpenOut(); - preparePacketDelay.Restart(); } --- 594,597 ---- *************** *** 972,976 **** PWaitAndSignal mutexWait(Mutex); ! if (!IsOpenOut()) return FALSE; --- 963,967 ---- PWaitAndSignal mutexWait(Mutex); ! if (hOwnerOut == NULL) return FALSE; *************** *** 984,992 **** } /////////////////////////////////////////////////////////////// ! int T38Engine::PreparePacket(T38_IFP & ifp) { ! if (!IsOpenOut()) return 0; //myPTRACE(1, name << " PreparePacket begin stM=" << stateModem << " stO=" << stateOut); --- 975,1025 ---- } /////////////////////////////////////////////////////////////// ! void T38Engine::SetPreparePacketTimeout(HOWNEROUT hOwner, int timeout, int period) { ! if (hOwnerOut != hOwner) ! return; ! ! PWaitAndSignal mutexWait(Mutex); ! ! if (hOwnerOut != hOwner) ! return; ! ! if (timeout == 0 && period == -1) ! period = 20; ! ! preparePacketTimeout = timeout; ! preparePacketPeriod = period; ! ! if (preparePacketPeriod > 0) ! preparePacketDelay.Restart(); ! } ! /////////////////////////////////////////////////////////////// ! int T38Engine::PreparePacket(HOWNEROUT hOwner, T38_IFP & ifp) ! { ! if (hOwnerOut != hOwner || !IsModemOpen()) return 0; + PWaitAndSignal mutexWait(MutexOut); + + if (hOwnerOut != hOwner || !IsModemOpen()) + return 0; + + { + PWaitAndSignal mutexWait(Mutex); + + if (hOwnerOut != hOwner || !IsModemOpen()) + return 0; + + if (firstOut) { + firstOut = FALSE; + ModemCallbackWithUnlock(cbpUpdateState); + + if (hOwnerOut != hOwner || !IsModemOpen()) + return FALSE; + + preparePacketDelay.Restart(); + } + } + //myPTRACE(1, name << " PreparePacket begin stM=" << stateModem << " stO=" << stateOut); *************** *** 998,1002 **** preparePacketDelay.Delay(preparePacketPeriod); ! if (!IsOpenOut()) return 0; } --- 1031,1035 ---- preparePacketDelay.Delay(preparePacketPeriod); ! if (hOwnerOut != hOwner || !IsModemOpen()) return 0; } *************** *** 1033,1037 **** mySleep(delay.GetMilliSeconds()); ! if (!IsOpenOut()) return 0; } --- 1066,1070 ---- mySleep(delay.GetMilliSeconds()); ! if (hOwnerOut != hOwner || !IsModemOpen()) return 0; } *************** *** 1040,1044 **** } ! if (!IsOpenOut()) return 0; --- 1073,1077 ---- } ! if (hOwnerOut != hOwner || !IsModemOpen()) return 0; *************** *** 1047,1050 **** --- 1080,1087 ---- { PWaitAndSignal mutexWait(Mutex); + + if (hOwnerOut != hOwner || !IsModemOpen()) + return 0; + if (isStateModemOut() || stateOut != stOutIdle) { switch (stateOut) { *************** *** 1120,1123 **** --- 1157,1164 ---- stateModem = stmIdle; ModemCallbackWithUnlock(callbackParamOut); + + if (hOwnerOut != hOwner || !IsModemOpen()) + return 0; + redo = TRUE; break; *************** *** 1127,1130 **** --- 1168,1175 ---- stateModem = stmIdle; ModemCallbackWithUnlock(callbackParamOut); + + if (hOwnerOut != hOwner || !IsModemOpen()) + return 0; + doDalay = FALSE; redo = TRUE; *************** *** 1179,1185 **** PBoolean wasFull = bufOut.isFull(); int count = hdlcOut.GetData(b, len); ! if (wasFull && !bufOut.isFull()) ModemCallbackWithUnlock(cbpOutBufNoFull); switch( count ) { case -1: --- 1224,1234 ---- PBoolean wasFull = bufOut.isFull(); int count = hdlcOut.GetData(b, len); ! if (wasFull && !bufOut.isFull()) { ModemCallbackWithUnlock(cbpOutBufNoFull); + if (hOwnerOut != hOwner || !IsModemOpen()) + return 0; + } + switch( count ) { case -1: *************** *** 1205,1208 **** --- 1254,1260 ---- { ModemCallbackWithUnlock(cbpOutBufEmpty); + + if (hOwnerOut != hOwner || !IsModemOpen()) + return 0; } else *************** *** 1214,1217 **** --- 1266,1272 ---- if (timeOutBufEmpty <= PTime()) { ModemCallbackWithUnlock(cbpOutBufEmpty); + + if (hOwnerOut != hOwner || !IsModemOpen()) + return 0; } waitData = TRUE; *************** *** 1262,1267 **** stateOut = stOutDataNoSig; ! if (wasFull && !bufOut.isFull()) ModemCallbackWithUnlock(cbpOutBufNoFull); } else { if( stateModem != stmOutNoMoreData ) { --- 1317,1326 ---- stateOut = stOutDataNoSig; ! if (wasFull && !bufOut.isFull()) { ModemCallbackWithUnlock(cbpOutBufNoFull); + + if (hOwnerOut != hOwner || !IsModemOpen()) + return 0; + } } else { if( stateModem != stmOutNoMoreData ) { *************** *** 1284,1287 **** --- 1343,1349 ---- stateModem = stmOutMoreData; ModemCallbackWithUnlock(callbackParamOut); + + if (hOwnerOut != hOwner || !IsModemOpen()) + return 0; } else { stateOut = stOutDataNoSig; *************** *** 1318,1321 **** --- 1380,1387 ---- stateModem = stmIdle; ModemCallbackWithUnlock(callbackParamOut); + + if (hOwnerOut != hOwner || !IsModemOpen()) + return 0; + break; //////////////////////////////////////////////////// *************** *** 1366,1374 **** } ! if (!IsOpenOut()) return 0; { PWaitAndSignal mutexWait(Mutex); if (stateOut == stOutData) { #if PTRACING --- 1432,1444 ---- } ! if (hOwnerOut != hOwner || !IsModemOpen()) return 0; { PWaitAndSignal mutexWait(Mutex); + + if (hOwnerOut != hOwner || !IsModemOpen()) + return 0; + if (stateOut == stOutData) { #if PTRACING *************** *** 1408,1417 **** } /////////////////////////////////////////////////////////////// ! PBoolean T38Engine::HandlePacketLost(unsigned myPTRACE_PARAM(nLost)) { myPTRACE(1, name << " HandlePacketLost " << nLost); PWaitAndSignal mutexWait(Mutex); ! if (!IsOpenIn()) return FALSE; --- 1478,1491 ---- } /////////////////////////////////////////////////////////////// ! PBoolean T38Engine::HandlePacketLost(HOWNERIN hOwner, unsigned myPTRACE_PARAM(nLost)) { myPTRACE(1, name << " HandlePacketLost " << nLost); + + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; + PWaitAndSignal mutexWait(Mutex); ! if (hOwnerIn != hOwner || !IsModemOpen()) return FALSE; *************** *** 1421,1424 **** --- 1495,1499 ---- modStream = modStreamInSaved; } + if( !(modStream == NULL || modStream->lastBuf == NULL) ) { if( modStream->ModPars.msgType == T38D(e_v21) ) { *************** *** 1429,1433 **** } /////////////////////////////////////////////////////////////// ! PBoolean T38Engine::HandlePacket(const T38_IFP & ifp) { #if PTRACING --- 1504,1508 ---- } /////////////////////////////////////////////////////////////// ! PBoolean T38Engine::HandlePacket(HOWNERIN hOwner, const T38_IFP & ifp) { #if PTRACING *************** *** 1441,1447 **** #endif PWaitAndSignal mutexWait(Mutex); ! if (!IsOpenIn()) return FALSE; --- 1516,1525 ---- #endif + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; + PWaitAndSignal mutexWait(Mutex); ! if (hOwnerIn != hOwner || !IsModemOpen()) return FALSE; *************** *** 1484,1487 **** --- 1562,1568 ---- stateModem = stmIdle; ModemCallbackWithUnlock(callbackParamIn); + + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; } break; *************** *** 1493,1496 **** --- 1574,1580 ---- stateModem = stmIdle; ModemCallbackWithUnlock(callbackParamIn); + + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; } break; *************** *** 1502,1505 **** --- 1586,1592 ---- stateModem = stmIdle; ModemCallbackWithUnlock(callbackParamIn); + + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; } break; *************** *** 1525,1528 **** --- 1612,1618 ---- stateModem = stmIdle; ModemCallbackWithUnlock(callbackParamIn); + + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; } else *************** *** 1547,1550 **** --- 1637,1643 ---- stateModem = stmInReadyData; ModemCallbackWithUnlock(callbackParamIn); + + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; } break; *************** *** 1640,1643 **** --- 1733,1739 ---- stateModem = stmIdle; ModemCallbackWithUnlock(callbackParamIn); + + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; } break; *************** *** 1646,1651 **** } ! if (stateModem == stmInRecvData) ModemCallbackWithUnlock(callbackParamIn); break; } --- 1742,1752 ---- } ! if (stateModem == stmInRecvData) { ModemCallbackWithUnlock(callbackParamIn); + + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; + } + break; } *************** *** 1654,1658 **** } ! firstIn = FALSE; return TRUE; --- 1755,1765 ---- } ! if (!firstIn) { ! firstIn = FALSE; ! ModemCallbackWithUnlock(cbpUpdateState); ! ! if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; ! } return TRUE; Index: enginebase.h =================================================================== RCS file: /cvsroot/t38modem/t38modem/enginebase.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** enginebase.h 29 Sep 2010 11:52:59 -0000 1.11 --- enginebase.h 6 Oct 2010 16:54:19 -0000 1.12 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.12 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.11 2010/09/29 11:52:59 vfrolov * Redesigned engine attaching/detaching *************** *** 98,101 **** --- 101,112 ---- PCLASSINFO(EngineBase, ReferenceObject); + private: + class OWNERIN { int unused; }; + class OWNEROUT { int unused; }; + + public: + typedef const OWNERIN *HOWNERIN; + typedef const OWNEROUT *HOWNEROUT; + public: *************** *** 146,156 **** void ResetModemState(); ! void OpenIn(); ! void OpenOut(); ! void CloseIn(); ! void CloseOut(); ! PBoolean IsOpenIn() const { return isOpenIn && IsModemOpen(); } ! PBoolean IsOpenOut() const { return isOpenOut && IsModemOpen(); } PBoolean TryLockModemCallback(); --- 157,167 ---- void ResetModemState(); ! void OpenIn(HOWNERIN hOwner); ! void OpenOut(HOWNEROUT hOwner); ! void CloseIn(HOWNERIN hOwner); ! void CloseOut(HOWNEROUT hOwner); ! PBoolean IsOpenIn() const { return hOwnerIn != NULL; } ! PBoolean IsOpenOut() const { return hOwnerOut != NULL; } PBoolean TryLockModemCallback(); *************** *** 185,198 **** virtual void OnUserInput(const PString & value); ! virtual void OnOpenIn() {} ! virtual void OnOpenOut() {} ! virtual void OnCloseIn() {} ! virtual void OnCloseOut() {} const PString name; DataStream *volatile recvUserInput; ModemClass modemClass; ! volatile PBoolean isOpenIn; ! volatile PBoolean isOpenOut; void ModemCallbackWithUnlock(INT extra); --- 196,211 ---- virtual void OnUserInput(const PString & value); ! virtual void OnOpenIn(); ! virtual void OnOpenOut(); ! virtual void OnCloseIn(); ! virtual void OnCloseOut(); const PString name; DataStream *volatile recvUserInput; ModemClass modemClass; ! volatile HOWNERIN hOwnerIn; ! volatile HOWNEROUT hOwnerOut; ! PBoolean firstIn; ! PBoolean firstOut; void ModemCallbackWithUnlock(INT extra); *************** *** 202,205 **** --- 215,220 ---- PMutex MutexModem; + PMutex MutexIn; + PMutex MutexOut; PMutex Mutex; }; Index: pmodeme.h =================================================================== RCS file: /cvsroot/t38modem/t38modem/pmodeme.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pmodeme.h 29 Sep 2010 11:52:59 -0000 1.7 --- pmodeme.h 6 Oct 2010 16:54:19 -0000 1.8 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.8 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.7 2010/09/29 11:52:59 vfrolov * Redesigned engine attaching/detaching *************** *** 56,61 **** class ModemEngineBody; class PseudoModemBody; - class T38Engine; - class AudioEngine; class ModemEngine : public ModemThreadChild --- 59,62 ---- *************** *** 76,79 **** --- 77,81 ---- virtual T38Engine *NewPtrT38Engine() const; virtual AudioEngine *NewPtrAudioEngine() const; + virtual EngineBase *NewPtrUserInputEngine() const; const PString &ptyName() const { return Parent().ptyName(); } const PString &modemToken() const { return Parent().modemToken(); } Index: Makefile =================================================================== RCS file: /cvsroot/t38modem/t38modem/Makefile,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Makefile 12 Feb 2010 08:35:51 -0000 1.26 --- Makefile 6 Oct 2010 16:54:19 -0000 1.27 *************** *** 25,28 **** --- 25,31 ---- # # $Log$ + # Revision 1.27 2010/10/06 16:54:19 vfrolov + # Redesigned engine opening/closing + # # Revision 1.26 2010/02/12 08:35:51 vfrolov # Added fake_codecs.cxx *************** *** 136,140 **** VPATH_CXX := h323lib ! SOURCES += t38protocol.cxx g7231_fake.cxx h323ep.cxx ifndef OPENH323DIR --- 139,143 ---- VPATH_CXX := h323lib ! SOURCES += t38protocol.cxx audio_chan.cxx g7231_fake.cxx h323ep.cxx ifndef OPENH323DIR Index: pmodem.h =================================================================== RCS file: /cvsroot/t38modem/t38modem/pmodem.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pmodem.h 29 Sep 2010 11:52:59 -0000 1.10 --- pmodem.h 6 Oct 2010 16:54:19 -0000 1.11 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.11 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.10 2010/09/29 11:52:59 vfrolov * Redesigned engine attaching/detaching *************** *** 69,72 **** --- 72,76 ---- class T38Engine; class AudioEngine; + class EngineBase; class PseudoModem : public ModemThread *************** *** 86,89 **** --- 90,94 ---- virtual T38Engine *NewPtrT38Engine() const = 0; virtual AudioEngine *NewPtrAudioEngine() const = 0; + virtual EngineBase *NewPtrUserInputEngine() const = 0; const PString &ttyName() const { return ttyname; } Index: t38engine.h =================================================================== RCS file: /cvsroot/t38modem/t38modem/t38engine.h,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** t38engine.h 29 Sep 2010 11:52:59 -0000 1.40 --- t38engine.h 6 Oct 2010 16:54:19 -0000 1.41 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.41 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.40 2010/09/29 11:52:59 vfrolov * Redesigned engine attaching/detaching *************** *** 228,233 **** virtual int RecvDiag() const; - void Close() { CloseIn(); CloseOut(); } - /**Prepare outgoing T.38 packet. --- 231,234 ---- *************** *** 236,251 **** If returns <0, then the ifp packet is not correct (timeout). */ ! int PreparePacket(T38_IFP & ifp); ! ! void SetPreparePacketTimeout(int timeout, int period = -1) { ! if (timeout == 0 && period == -1) ! period = 20; ! ! preparePacketTimeout = timeout; ! preparePacketPeriod = period; ! if (preparePacketPeriod > 0) ! preparePacketDelay.Restart(); ! } /**Handle incoming T.38 packet. --- 237,252 ---- If returns <0, then the ifp packet is not correct (timeout). */ ! int PreparePacket( ! HOWNEROUT hOwner, ! T38_IFP & ifp ! ); ! /**Set outgoing T.38 packet prepare timeout. ! */ ! void SetPreparePacketTimeout( ! HOWNEROUT hOwner, ! int timeout, ! int period = -1 ! ); /**Handle incoming T.38 packet. *************** *** 254,257 **** --- 255,259 ---- */ PBoolean HandlePacket( + HOWNERIN hOwner, const T38_IFP & ifp ); *************** *** 262,265 **** --- 264,268 ---- */ PBoolean HandlePacketLost( + HOWNERIN hOwner, unsigned nLost ); *************** *** 311,315 **** #endif PINDEX countIn; - PBoolean firstIn; T30 t30; --- 314,317 ---- Index: audio.h =================================================================== RCS file: /cvsroot/t38modem/t38modem/audio.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** audio.h 22 Sep 2010 15:23:48 -0000 1.7 --- audio.h 6 Oct 2010 16:54:19 -0000 1.8 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.8 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.7 2010/09/22 15:23:48 vfrolov * Added OnResetModemState() *************** *** 59,65 **** class T30ToneDetect; /////////////////////////////////////////////////////////////// ! class AudioEngine : public PChannel, public EngineBase { ! PCLASSINFO(AudioEngine, PChannel); public: --- 62,68 ---- class T30ToneDetect; /////////////////////////////////////////////////////////////// ! class AudioEngine : public EngineBase { ! PCLASSINFO(AudioEngine, EngineBase); public: *************** *** 67,71 **** /**@name Construction */ //@{ ! AudioEngine(const PString &_name = ""); ~AudioEngine(); //@} --- 70,74 ---- /**@name Construction */ //@{ ! AudioEngine(const PString &_name); ~AudioEngine(); //@} *************** *** 73,77 **** /**@name Modem API */ //@{ ! PBoolean Read(void * buffer, PINDEX amount); virtual void SendOnIdle(DataType _dataType); virtual PBoolean SendStart(DataType _dataType, int param); --- 76,80 ---- /**@name Modem API */ //@{ ! PBoolean Read(HOWNEROUT hOwner, void * buffer, PINDEX amount); virtual void SendOnIdle(DataType _dataType); virtual PBoolean SendStart(DataType _dataType, int param); *************** *** 80,84 **** virtual PBoolean isOutBufFull() const; ! PBoolean Write(const void * buffer, PINDEX len); virtual PBoolean RecvWait(DataType _dataType, int param, int _callbackParam, PBoolean &done); virtual PBoolean RecvStart(int _callbackParam); --- 83,87 ---- virtual PBoolean isOutBufFull() const; ! PBoolean Write(HOWNERIN hOwner, const void * buffer, PINDEX len); virtual PBoolean RecvWait(DataType _dataType, int param, int _callbackParam, PBoolean &done); virtual PBoolean RecvStart(int _callbackParam); Index: pmodemi.h =================================================================== RCS file: /cvsroot/t38modem/t38modem/pmodemi.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pmodemi.h 29 Sep 2010 11:52:59 -0000 1.9 --- pmodemi.h 6 Oct 2010 16:54:19 -0000 1.10 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.10 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.9 2010/09/29 11:52:59 vfrolov * Redesigned engine attaching/detaching *************** *** 88,91 **** --- 91,95 ---- virtual T38Engine *NewPtrT38Engine() const; virtual AudioEngine *NewPtrAudioEngine() const; + virtual EngineBase *NewPtrUserInputEngine() const; const PNotifier &GetCallbackEndPoint() const { return callbackEndPoint; } Index: audio.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/audio.cxx,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** audio.cxx 22 Sep 2010 15:23:48 -0000 1.15 --- audio.cxx 6 Oct 2010 16:54:19 -0000 1.16 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.16 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.15 2010/09/22 15:23:48 vfrolov * Added OnResetModemState() *************** *** 102,109 **** --- 105,116 ---- { timerFakeOut.SetNotifier(timerFakeOutCallback); + + PTRACE(2, name << " AudioEngine"); } AudioEngine::~AudioEngine() { + PTRACE(2, name << " ~AudioEngine"); + timerFakeOut = 0; *************** *** 124,130 **** { EngineBase::OnAttach(); - - readDelay.Restart(); - writeDelay.Restart(); } --- 131,134 ---- *************** *** 139,143 **** if (sendAudio) { ! if (isOpenOut) { sendAudio->PutEof(); } else { --- 143,147 ---- if (sendAudio) { ! if (hOwnerOut != NULL) { sendAudio->PutEof(); } else { *************** *** 176,180 **** { EngineBase::OnOpenOut(); - readDelay.Restart(); timerFakeOut = 0; --- 180,183 ---- *************** *** 219,225 **** } ! PBoolean AudioEngine::Read(void * buffer, PINDEX amount) { ! Mutex.Wait(); if (sendAudio) { --- 222,261 ---- } ! PBoolean AudioEngine::Read(HOWNEROUT hOwner, void * buffer, PINDEX amount) { ! if (hOwnerOut != hOwner || !IsModemOpen()) ! return FALSE; ! ! PWaitAndSignal mutexOutWait(MutexOut); ! ! if (hOwnerOut != hOwner || !IsModemOpen()) ! return FALSE; ! ! { ! PWaitAndSignal mutexWait(Mutex); ! ! if (hOwnerOut != hOwner || !IsModemOpen()) ! return 0; ! ! if (firstOut) { ! firstOut = FALSE; ! ModemCallbackWithUnlock(cbpUpdateState); ! ! if (hOwnerOut != hOwner || !IsModemOpen()) ! return FALSE; ! ! readDelay.Restart(); ! } ! } ! ! readDelay.Delay(amount/BYTES_PER_MSEC); ! ! if (hOwnerOut != hOwner || !IsModemOpen()) ! return FALSE; ! ! PWaitAndSignal mutexWait(Mutex); ! ! if (hOwnerOut != hOwner || !IsModemOpen()) ! return FALSE; if (sendAudio) { *************** *** 229,239 **** if (count < 0) { delete sendAudio; sendAudio = NULL; ModemCallbackWithUnlock(callbackParam); ! count = 0; } else { ! if (wasFull && !sendAudio->isFull()) ModemCallbackWithUnlock(cbpOutBufNoFull); } --- 265,282 ---- if (count < 0) { + count = 0; delete sendAudio; sendAudio = NULL; ModemCallbackWithUnlock(callbackParam); ! ! if (hOwnerOut != hOwner || !IsModemOpen()) ! return FALSE; } else { ! if (wasFull && !sendAudio->isFull()) { ModemCallbackWithUnlock(cbpOutBufNoFull); + + if (hOwnerOut != hOwner || !IsModemOpen()) + return FALSE; + } } *************** *** 247,256 **** } - Mutex.Signal(); - - lastReadCount = amount; - - readDelay.Delay(amount/BYTES_PER_MSEC); - return TRUE; } --- 290,293 ---- *************** *** 292,296 **** << " param=" << param); ! if (!isOpenOut) targetTimeFakeOut = PTime(); --- 329,333 ---- << " param=" << param); ! if (hOwnerOut == NULL) targetTimeFakeOut = PTime(); *************** *** 304,308 **** if (sendAudio) { ! if (isOpenOut) sendAudio->PutData(pBuf, count); else --- 341,345 ---- if (sendAudio) { ! if (hOwnerOut != NULL) sendAudio->PutData(pBuf, count); else *************** *** 321,325 **** if (sendAudio) { ! if (isOpenOut) { sendAudio->PutEof(); } else { --- 358,362 ---- if (sendAudio) { ! if (hOwnerOut != NULL) { sendAudio->PutEof(); } else { *************** *** 347,351 **** return FALSE; ! if (!isOpenOut) { PTimeInterval delay = targetTimeFakeOut - PTime(); int sleep_time = (int)delay.GetMilliSeconds(); --- 384,388 ---- return FALSE; ! if (hOwnerOut == NULL) { PTimeInterval delay = targetTimeFakeOut - PTime(); int sleep_time = (int)delay.GetMilliSeconds(); *************** *** 378,382 **** { EngineBase::OnOpenIn(); - writeDelay.Restart(); } --- 415,418 ---- *************** *** 386,409 **** } ! PBoolean AudioEngine::Write(const void * buffer, PINDEX len) { Mutex.Wait(); if (recvAudio && !recvAudio->isFull()) { recvAudio->PutData(buffer, len); ModemCallbackWithUnlock(callbackParam); } PBoolean cng = t30ToneDetect && t30ToneDetect->Write(buffer, len); ! if (cng) OnUserInput('c'); ! Mutex.Signal(); ! lastWriteCount = len; writeDelay.Delay(len/BYTES_PER_MSEC); return TRUE; } --- 422,481 ---- } ! PBoolean AudioEngine::Write(HOWNERIN hOwner, const void * buffer, PINDEX len) { + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; + + PWaitAndSignal mutexInWait(MutexIn); + + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; + + { + PWaitAndSignal mutexWait(Mutex); + + if (hOwnerIn != hOwner || !IsModemOpen()) + return 0; + + if (firstIn) { + firstIn = FALSE; + ModemCallbackWithUnlock(cbpUpdateState); + + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; + + writeDelay.Restart(); + } + } + Mutex.Wait(); + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; + if (recvAudio && !recvAudio->isFull()) { recvAudio->PutData(buffer, len); ModemCallbackWithUnlock(callbackParam); + + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; } PBoolean cng = t30ToneDetect && t30ToneDetect->Write(buffer, len); ! if (cng) { OnUserInput('c'); ! if (hOwnerIn != hOwner || !IsModemOpen()) ! return FALSE; ! } ! Mutex.Signal(); writeDelay.Delay(len/BYTES_PER_MSEC); + if (hOwnerIn != hOwner || !IsModemOpen()) + return FALSE; + return TRUE; } Index: pmodemi.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/pmodemi.cxx,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pmodemi.cxx 29 Sep 2010 11:52:59 -0000 1.16 --- pmodemi.cxx 6 Oct 2010 16:54:19 -0000 1.17 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.17 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.16 2010/09/29 11:52:59 vfrolov * Redesigned engine attaching/detaching *************** *** 138,141 **** --- 141,153 ---- } + EngineBase *PseudoModemBody::NewPtrUserInputEngine() const + { + PWaitAndSignal mutexWait(Mutex); + if (engine == NULL) + return NULL; + + return engine->NewPtrUserInputEngine(); + } + void PseudoModemBody::ToPtyQ(const void *buf, PINDEX count, PBoolean OutQ) { Index: enginebase.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/enginebase.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** enginebase.cxx 29 Sep 2010 11:52:59 -0000 1.11 --- enginebase.cxx 6 Oct 2010 16:54:19 -0000 1.12 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.12 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.11 2010/09/29 11:52:59 vfrolov * Redesigned engine attaching/detaching *************** *** 112,122 **** , recvUserInput(NULL) , modemClass(mcUndefined) ! #ifdef USE_OPAL ! , isOpenIn(FALSE) ! , isOpenOut(FALSE) ! #else ! , isOpenIn(TRUE) ! , isOpenOut(TRUE) ! #endif { } --- 115,122 ---- , recvUserInput(NULL) , modemClass(mcUndefined) ! , hOwnerIn(NULL) ! , hOwnerOut(NULL) ! , firstIn(TRUE) ! , firstOut(TRUE) { } *************** *** 126,129 **** --- 126,138 ---- if (recvUserInput) delete recvUserInput; + + if (hOwnerIn != NULL) + myPTRACE(1, name << " ~EngineBase WARNING: (In) still open by " << hOwnerIn); + + if (hOwnerOut != NULL) + myPTRACE(1, name << " ~EngineBase WARNING: (Out) still open by " << hOwnerOut); + + if (!modemCallback.IsNULL()) + myPTRACE(1, name << " ~EngineBase WARNING: !modemCallback.IsNULL()"); } *************** *** 198,262 **** } ! void EngineBase::OpenIn() { - myPTRACE(1, name << " OpenIn: " << (isOpenIn ? "re-open" : "open")); - PWaitAndSignal mutexWait(Mutex); ! if (isOpenIn) ! return; ! isOpenIn = TRUE; ! OnOpenIn(); ! ModemCallbackWithUnlock(cbpUpdateState); } ! void EngineBase::OpenOut() { - myPTRACE(1, name << " OpenOut: " << (isOpenOut ? "re-open" : "open")); - PWaitAndSignal mutexWait(Mutex); ! if (isOpenOut) ! return; ! isOpenOut = TRUE; OnOpenOut(); ModemCallbackWithUnlock(cbpUpdateState); } ! void EngineBase::CloseIn() { ! myPTRACE(1, name << " CloseIn: " << (isOpenIn ? "close" : "re-close")); PWaitAndSignal mutexWait(Mutex); ! if (!isOpenIn) ! return; ! ! isOpenIn = FALSE; ! ! OnCloseIn(); ! ModemCallbackWithUnlock(cbpUpdateState); } ! void EngineBase::CloseOut() { - myPTRACE(1, name << " CloseOut: " << (isOpenOut ? "close" : "re-close")); - PWaitAndSignal mutexWait(Mutex); ! if (!isOpenOut) ! return; ! isOpenOut = FALSE; ! OnCloseOut(); ModemCallbackWithUnlock(cbpUpdateState); } --- 207,301 ---- } ! void EngineBase::OpenIn(HOWNERIN hOwner) { PWaitAndSignal mutexWait(Mutex); ! while (hOwnerIn != NULL) { ! if (hOwnerIn == hOwner) { ! myPTRACE(1, name << " OpenIn: re-open " << hOwner); ! return; ! } ! myPTRACE(1, name << " OpenIn WARNING: close " << hOwnerIn << " by " << hOwner); ! hOwnerIn = NULL; ! OnCloseIn(); ! } ! myPTRACE(1, name << " OpenIn: open " << hOwner); ! ! hOwnerIn = hOwner; ! OnOpenIn(); } ! void EngineBase::OpenOut(HOWNEROUT hOwner) { PWaitAndSignal mutexWait(Mutex); ! while (hOwnerOut != NULL) { ! if (hOwnerOut == hOwner) { ! myPTRACE(1, name << " OpenOut: re-open " << hOwner); ! return; ! } ! myPTRACE(1, name << " OpenOut WARNING: close " << hOwnerOut << " by " << hOwner); ! ! hOwnerOut = NULL; ! OnCloseOut(); ! } ! ! myPTRACE(1, name << " OpenOut: open " << hOwner); + hOwnerOut = hOwner; OnOpenOut(); + } + void EngineBase::OnOpenIn() + { + firstIn = TRUE; ModemCallbackWithUnlock(cbpUpdateState); } ! void EngineBase::OnOpenOut() { ! firstOut = TRUE; ! ModemCallbackWithUnlock(cbpUpdateState); ! } + void EngineBase::CloseIn(HOWNERIN hOwner) + { PWaitAndSignal mutexWait(Mutex); ! if (hOwnerIn == hOwner) { ! myPTRACE(1, name << " CloseIn: close " << hOwner); ! hOwnerIn = NULL; ! OnCloseIn(); ! } else { ! myPTRACE(1, name << " CloseIn: re-close " << hOwner); ! } } ! void EngineBase::CloseOut(HOWNEROUT hOwner) { PWaitAndSignal mutexWait(Mutex); ! if (hOwnerOut == hOwner) { ! myPTRACE(1, name << " CloseOut: close " << hOwner); ! hOwnerOut = NULL; ! OnCloseOut(); ! } else { ! myPTRACE(1, name << " CloseOut: re-close " << hOwner); ! } ! } ! void EngineBase::OnCloseIn() ! { ! ModemCallbackWithUnlock(cbpUpdateState); ! } + void EngineBase::OnCloseOut() + { ModemCallbackWithUnlock(cbpUpdateState); } |
|
From: Vyacheslav F. <vf...@us...> - 2010-10-06 16:54:28
|
Update of /cvsroot/t38modem/t38modem/opal In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv13786/opal Modified Files: modemep.cxx modemstrm.cxx modemstrm.h Log Message: Redesigned engine opening/closing Index: modemstrm.h =================================================================== RCS file: /cvsroot/t38modem/t38modem/opal/modemstrm.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** modemstrm.h 8 Dec 2009 15:06:22 -0000 1.5 --- modemstrm.h 6 Oct 2010 16:54:19 -0000 1.6 *************** *** 4,8 **** * T38FAX Pseudo Modem * ! * Copyright (c) 2007-2009 Vyacheslav Frolov * * Open H323 Project --- 4,8 ---- * T38FAX Pseudo Modem * ! * Copyright (c) 2007-2010 Vyacheslav Frolov * * Open H323 Project *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.6 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.5 2009/12/08 15:06:22 vfrolov * Fixed incompatibility with OPAL trunk *************** *** 51,66 **** class AudioEngine; ! class AudioModemMediaStream : public OpalRawMediaStream { ! PCLASSINFO(AudioModemMediaStream, OpalRawMediaStream); public: AudioModemMediaStream( OpalConnection & conn, - const OpalMediaFormat & mediaFormat, ///< Media format for stream unsigned sessionID, ///< Session number for stream PBoolean isSource, ///< Is a source stream ! AudioEngine *_audioEngine ///< I/O channel to stream to/from ); /**@name Overrides of OpalRawMediaStream class */ //@{ --- 54,75 ---- class AudioEngine; ! class AudioModemMediaStream : public OpalMediaStream { ! PCLASSINFO(AudioModemMediaStream, OpalMediaStream); public: + /**@name Construction */ + //@{ + /**Construct a new media stream. + */ AudioModemMediaStream( OpalConnection & conn, unsigned sessionID, ///< Session number for stream PBoolean isSource, ///< Is a source stream ! AudioEngine *engine ); + ~AudioModemMediaStream(); + //@} + /**@name Overrides of OpalRawMediaStream class */ //@{ *************** *** 68,71 **** --- 77,92 ---- virtual PBoolean Close(); + virtual PBoolean ReadData( + BYTE * data, ///< Data buffer to read to + PINDEX size, ///< Size of buffer + PINDEX & length ///< Length of data actually read + ); + + virtual PBoolean WriteData( + const BYTE * data, ///< Data to write + PINDEX length, ///< Length of data to read. + PINDEX & written ///< Length of data actually written + ); + virtual PBoolean IsSynchronous() const { return FALSE; } //@} *************** *** 89,94 **** unsigned sessionID, ///< Session number for stream PBoolean isSource, ///< Is a source stream ! T38Engine *_t38engine ); //@} --- 110,117 ---- unsigned sessionID, ///< Session number for stream PBoolean isSource, ///< Is a source stream ! T38Engine *engine ); + + ~T38ModemMediaStream(); //@} Index: modemep.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/opal/modemep.cxx,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** modemep.cxx 29 Sep 2010 11:52:59 -0000 1.28 --- modemep.cxx 6 Oct 2010 16:54:19 -0000 1.29 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.29 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.28 2010/09/29 11:52:59 vfrolov * Redesigned engine attaching/detaching *************** *** 120,125 **** #include <opal/patch.h> ! #include "../t38engine.h" ! #include "../audio.h" #include "../pmodem.h" #include "../drivers.h" --- 123,127 ---- #include <opal/patch.h> ! #include "../enginebase.h" #include "../pmodem.h" #include "../drivers.h" *************** *** 194,199 **** PseudoModem *pmodem; ! AudioEngine * audioEngine; ! T38Engine * t38engine; PseudoModemMode requestedMode; bool isPartyA; --- 196,200 ---- PseudoModem *pmodem; ! EngineBase *userInputEngine; PseudoModemMode requestedMode; bool isPartyA; *************** *** 525,530 **** #endif , pmodem((PseudoModem *)userData) ! , audioEngine(NULL) ! , t38engine(NULL) , requestedMode(pmmAny) , isPartyA(userData != NULL) --- 526,530 ---- #endif , pmodem((PseudoModem *)userData) ! , userInputEngine(NULL) , requestedMode(pmmAny) , isPartyA(userData != NULL) *************** *** 589,597 **** } ! if (t38engine != NULL) ! ReferenceObject::DelPointer(t38engine); ! ! if (audioEngine != NULL) ! ReferenceObject::DelPointer(audioEngine); phaseTimer.Stop(); --- 589,594 ---- } ! if (userInputEngine != NULL) ! ReferenceObject::DelPointer(userInputEngine); phaseTimer.Stop(); *************** *** 618,634 **** if (mediaFormat == OpalT38) { ! if (t38engine == NULL) ! t38engine = pmodem->NewPtrT38Engine(); ! if (t38engine != NULL) ! return new T38ModemMediaStream(*this, sessionID, isSource, t38engine); } else if (mediaFormat == OpalPCM16) { ! if (audioEngine == NULL) ! audioEngine = pmodem->NewPtrAudioEngine(); ! if (audioEngine != NULL) ! return new AudioModemMediaStream(*this, mediaFormat, sessionID, isSource, audioEngine); } --- 615,633 ---- if (mediaFormat == OpalT38) { ! if (pmodem != NULL) { ! T38Engine *t38engine = pmodem->NewPtrT38Engine(); ! if (t38engine != NULL) ! return new T38ModemMediaStream(*this, sessionID, isSource, t38engine); ! } } else if (mediaFormat == OpalPCM16) { ! if (pmodem != NULL) { ! AudioEngine *audioEngine = pmodem->NewPtrAudioEngine(); ! if (audioEngine != NULL) ! return new AudioModemMediaStream(*this, sessionID, isSource, audioEngine); ! } } *************** *** 828,835 **** PTRACE(4, "ModemConnection::SendUserInputTone " << tone << " " << duration); ! if (audioEngine == NULL || tone == ' ') return false; ! audioEngine->WriteUserInput(tone); return true; --- 827,842 ---- PTRACE(4, "ModemConnection::SendUserInputTone " << tone << " " << duration); ! if (tone == ' ') return false; ! if (userInputEngine == NULL) { ! if (pmodem != NULL) ! userInputEngine = pmodem->NewPtrUserInputEngine(); ! ! if (userInputEngine == NULL) ! return false; ! } ! ! userInputEngine->WriteUserInput(tone); return true; Index: modemstrm.cxx =================================================================== RCS file: /cvsroot/t38modem/t38modem/opal/modemstrm.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** modemstrm.cxx 15 Mar 2010 13:46:46 -0000 1.11 --- modemstrm.cxx 6 Oct 2010 16:54:19 -0000 1.12 *************** *** 25,28 **** --- 25,31 ---- * * $Log$ + * Revision 1.12 2010/10/06 16:54:19 vfrolov + * Redesigned engine opening/closing + * * Revision 1.11 2010/03/15 13:46:46 vfrolov * Added resetting prepare packet timeout on start media patch for fax sink *************** *** 77,88 **** AudioModemMediaStream::AudioModemMediaStream( OpalConnection & conn, - const OpalMediaFormat & mediaFormat, unsigned sessionID, PBoolean isSource, ! AudioEngine *_audioEngine) ! : OpalRawMediaStream(conn, mediaFormat, sessionID, isSource, _audioEngine, FALSE), ! audioEngine(_audioEngine) { PTRACE(4, "AudioModemMediaStream::AudioModemMediaStream " << *this); } --- 80,97 ---- AudioModemMediaStream::AudioModemMediaStream( OpalConnection & conn, unsigned sessionID, PBoolean isSource, ! AudioEngine *engine) ! : OpalMediaStream(conn, OpalPCM16, sessionID, isSource) ! , audioEngine(engine) { PTRACE(4, "AudioModemMediaStream::AudioModemMediaStream " << *this); + + PAssert(audioEngine != NULL, "audioEngine is NULL"); + } + + AudioModemMediaStream::~AudioModemMediaStream() + { + ReferenceObject::DelPointer(audioEngine); } *************** *** 92,106 **** return TRUE; - if (!audioEngine) { - PTRACE(1, "AudioModemMediaStream::Open No audioEngine."); - return FALSE; - } - PTRACE(3, "AudioModemMediaStream::Open " << *this); if (IsSink()) ! audioEngine->OpenIn(); else ! audioEngine->OpenOut(); return OpalMediaStream::Open(); --- 101,110 ---- return TRUE; PTRACE(3, "AudioModemMediaStream::Open " << *this); if (IsSink()) ! audioEngine->OpenIn(EngineBase::HOWNERIN(this)); else ! audioEngine->OpenOut(EngineBase::HOWNEROUT(this)); return OpalMediaStream::Open(); *************** *** 113,123 **** if (IsSink()) ! audioEngine->CloseIn(); else ! audioEngine->CloseOut(); } return OpalMediaStream::Close(); } ///////////////////////////////////////////////////////////////////////////// T38ModemMediaStream::T38ModemMediaStream( --- 117,151 ---- if (IsSink()) ! audioEngine->CloseIn(EngineBase::HOWNERIN(this)); else ! audioEngine->CloseOut(EngineBase::HOWNEROUT(this)); } return OpalMediaStream::Close(); } + + PBoolean AudioModemMediaStream::ReadData(BYTE * data, PINDEX size, PINDEX & length) + { + if (!isOpen || !audioEngine->Read(EngineBase::HOWNEROUT(this), data, size)) { + length = 0; + return false; + } + + length = size; + + return true; + } + + PBoolean AudioModemMediaStream::WriteData(const BYTE * data, PINDEX length, PINDEX & written) + { + if (!isOpen || !audioEngine->Write(EngineBase::HOWNERIN(this), data, length)) { + written = 0; + return false; + } + + written = length; + + return true; + } ///////////////////////////////////////////////////////////////////////////// T38ModemMediaStream::T38ModemMediaStream( *************** *** 125,137 **** unsigned sessionID, PBoolean isSource, ! T38Engine *_t38engine) ! : OpalMediaStream(conn, OpalT38, sessionID, isSource), ! t38engine(_t38engine) { PTRACE(4, "T38ModemMediaStream::T38ModemMediaStream " << *this); PTRACE(4, "T38ModemMediaStream::T38ModemMediaStream DataSize=" << GetDataSize()); } PBoolean T38ModemMediaStream::Open() { --- 153,172 ---- unsigned sessionID, PBoolean isSource, ! T38Engine *engine) ! : OpalMediaStream(conn, OpalT38, sessionID, isSource) ! , t38engine(engine) { PTRACE(4, "T38ModemMediaStream::T38ModemMediaStream " << *this); + PAssert(t38engine != NULL, "t38engine is NULL"); + PTRACE(4, "T38ModemMediaStream::T38ModemMediaStream DataSize=" << GetDataSize()); } + T38ModemMediaStream::~T38ModemMediaStream() + { + ReferenceObject::DelPointer(t38engine); + } + PBoolean T38ModemMediaStream::Open() { *************** *** 139,147 **** return TRUE; - if (!t38engine) { - PTRACE(1, "T38ModemMediaStream::Open No t38engine."); - return FALSE; - } - PTRACE(3, "T38ModemMediaStream::Open " << *this); --- 174,177 ---- *************** *** 152,158 **** if (IsSink()) ! t38engine->OpenIn(); else ! t38engine->OpenOut(); return OpalMediaStream::Open(); --- 182,188 ---- if (IsSink()) ! t38engine->OpenIn(EngineBase::HOWNERIN(this)); else ! t38engine->OpenOut(EngineBase::HOWNEROUT(this)); return OpalMediaStream::Open(); *************** *** 169,178 **** " lost=" << totallost); ! t38engine->CloseIn(); } else { PTRACE(2, "T38ModemMediaStream::Close Receive statistics:" " sequence=" << currentSequenceNumber); ! t38engine->CloseOut(); } } --- 199,208 ---- " lost=" << totallost); ! t38engine->CloseIn(EngineBase::HOWNERIN(this)); } else { PTRACE(2, "T38ModemMediaStream::Close Receive statistics:" " sequence=" << currentSequenceNumber); ! t38engine->CloseOut(EngineBase::HOWNEROUT(this)); } } *************** *** 194,202 **** myPTRACE(3, "T38ModemMediaStream::OnStartMediaPatch: use timeout=0, period=20 for sink " << *sink); ! t38engine->SetPreparePacketTimeout(0, 20); } else { myPTRACE(3, "T38ModemMediaStream::OnStartMediaPatch: use timeout=-1 for sink " << *sink); ! t38engine->SetPreparePacketTimeout(-1); } } else { --- 224,232 ---- myPTRACE(3, "T38ModemMediaStream::OnStartMediaPatch: use timeout=0, period=20 for sink " << *sink); ! t38engine->SetPreparePacketTimeout(EngineBase::HOWNEROUT(this), 0, 20); } else { myPTRACE(3, "T38ModemMediaStream::OnStartMediaPatch: use timeout=-1 for sink " << *sink); ! t38engine->SetPreparePacketTimeout(EngineBase::HOWNEROUT(this), -1); } } else { *************** *** 214,217 **** --- 244,250 ---- PBoolean T38ModemMediaStream::ReadPacket(RTP_DataFrame & packet) { + if (!isOpen) + return FALSE; + T38_IFP ifp; int res; *************** *** 222,226 **** do { //PTRACE(4, "T38ModemMediaStream::ReadPacket ..."); ! res = t38engine->PreparePacket(ifp); } while (currentSequenceNumber == 0 && res < 0); --- 255,259 ---- do { //PTRACE(4, "T38ModemMediaStream::ReadPacket ..."); ! res = t38engine->PreparePacket(EngineBase::HOWNEROUT(this), ifp); } while (currentSequenceNumber == 0 && res < 0); *************** *** 263,266 **** --- 296,302 ---- PBoolean T38ModemMediaStream::WritePacket(RTP_DataFrame & packet) { + if (!isOpen) + return FALSE; + PTRACE(5, "T38ModemMediaStream::WritePacket " " packet " << packet.GetSequenceNumber() << *************** *** 319,323 **** #endif ! if (!t38engine->HandlePacketLost(lost)) return FALSE; --- 355,359 ---- #endif ! if (!t38engine->HandlePacketLost(EngineBase::HOWNERIN(this), lost)) return FALSE; *************** *** 327,331 **** currentSequenceNumber = packedSequenceNumber + 1; ! return t38engine->HandlePacket(ifp); } ///////////////////////////////////////////////////////////////////////////// --- 363,367 ---- currentSequenceNumber = packedSequenceNumber + 1; ! return t38engine->HandlePacket(EngineBase::HOWNERIN(this), ifp); } ///////////////////////////////////////////////////////////////////////////// |