📄 main.cxx
字号:
/*
* main.cxx
*
* PWLib application source file for OhPhone
*
* A H.323 "net telephone" application.
*
* Copyright (c) 1998-2000 Equivalence Pty. Ltd.
*
* 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 Open H323 Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions of this code were written with the assisance of funding from
* Vovida Networks, Inc. http://www.vovida.com.
*
* Contributor(s): ______________________________________.
* Derek J Smithies (derek@indranet.co.nz)
* Walter H Whitlock (twohives@nc.rr.com)
*
* $Log: main.cxx,v $
* Revision 1.348 2006/03/07 10:38:20 csoutheren
* Add ability to disable GRQ on GK registration
*
* Revision 1.347 2006/02/20 22:41:06 csoutheren
* Fixed typos and help
*
* Revision 1.346 2006/02/20 07:09:10 csoutheren
* Updated to use correct video driver/device specifications
*
* Revision 1.345 2005/08/18 02:03:36 dereksmithies
* Remove sound card test option.. This will be installed in pwlib/samples/audio
*
* Revision 1.344 2005/08/12 11:27:21 rjongbloed
* Removed SDL picture in picture, sorry. Will fix later!
*
* Revision 1.343 2005/01/11 07:56:45 csoutheren
* Added --number-prefix option
* Fixed problem with using proxies
*
* Revision 1.342 2004/12/16 00:46:52 csoutheren
* Added osptoken option
*
* Revision 1.341 2004/12/15 06:04:51 csoutheren
* Added outgoing OSP capability
*
* Revision 1.340 2004/11/25 07:40:42 csoutheren
* Allow port range to be set before STUN is set, allowing STUN to use a specific port range
*
* Revision 1.339 2004/11/22 02:57:53 csoutheren
* Rationalised sound device driver options (again)
*
* Revision 1.338 2004/11/04 22:20:28 csoutheren
* Fixed incorrect handling of sound drivers
*
* Revision 1.337 2004/11/01 22:21:53 ykiryanov
* Removed hack with inclusion of be.inc. BeOS now has gcc 2.95.3 available,
* and code built with 2.95.3 has plugins problem gone. Please use gcc 2.95.3
*
* Revision 1.336 2004/08/19 22:16:49 dereksmithies
* Set payload type for video test when using rfc2190_h263 capability.
* Thanks to Srinivas.Kandagatla for your help here.....
*
* Revision 1.335 2004/07/13 01:57:20 csoutheren
* Disabled RFC 2190 H.263 if DLL not available
*
* Revision 1.334 2004/06/16 06:32:52 ykiryanov
* Included be.inc - media registration code. Cannot be anywhere else (sigh)
*
* Revision 1.333 2004/06/02 00:40:46 csoutheren
* Changed g711frames to work in msecs
*
* Revision 1.332 2004/06/02 00:27:28 csoutheren
* Added options to set frames per packet for any codec
*
* Revision 1.331 2004/05/31 10:53:42 rjongbloed
* Fixed missing quote in list of codec names.
*
* Revision 1.330 2004/05/28 23:38:58 csoutheren
* Added --no-h263 and --no-h261 options as shorthand to remove video codecs
*
* Revision 1.329 2004/05/27 23:33:12 csoutheren
* Checked in fixes for new plugin codecs and RFC 2190 H.263
*
* Revision 1.328 2004/05/10 13:07:18 rjongbloed
* Changed G.726 and MS-ADPCM to plug in codecs.
*
* Revision 1.327 2004/05/04 12:21:15 rjongbloed
* Converted LPC-10 codec to plug in.
*
* Revision 1.326 2004/05/03 13:25:46 rjongbloed
* Converted everything to be codec plug in freindly
* Removed GSM and G.729 as now plug ins are "the way"!
*
* Revision 1.325 2004/04/22 14:45:26 csoutheren
* Added changes for RFC2190 H.263
*
* Revision 1.324 2004/04/06 11:27:48 rjongbloed
* Changes to support native C++ Run Time Type Information
* Changes for codec plug ins
*
* Revision 1.323 2004/01/18 14:19:03 dereksmithies
* Opening of video devices with plugins works now.
*
* Revision 1.322 2004/01/02 01:34:45 dereksmithies
* Attempt to get ohphone working with V4L plugins.
*
* Revision 1.321 2003/12/18 05:16:35 rjongbloed
* Fixed strange error with extra parens!
*
* Revision 1.320 2003/12/14 11:00:08 rjongbloed
* Resolved issue with name space conflict os static and virtual forms of GetDeviceNames() function.
*
* Revision 1.319 2003/11/19 04:49:48 csoutheren
* Changed to support video input and output plugins
*
* Revision 1.318 2003/11/15 03:51:55 dereksmithies
* Add --soundtest option, which records audio, plays back 3 seconds later. Tests if the card is full duplex.
*
* Revision 1.317 2003/11/09 20:56:23 shawn
* added use of stun and ilbc codec
*
* Revision 1.316 2003/10/31 23:17:29 shawn
* use IPv6 as default address family when available; this should not revent IPv4 from working properly
*
* Revision 1.315 2003/08/04 04:07:54 dereksmithies
* Put H261 Capability back in the source
*
* Revision 1.314 2003/07/24 05:14:52 dereksmithies
* Support for vich263 added
*
* Revision 1.313 2003/06/12 19:39:11 shawn
* Added shared memory video input/output devices. Video frames of these two
* devices are stored in a named shared memory region and can be accessed by
* other applications.
*
* Revision 1.312 2003/06/04 19:03:58 shawn
* realtime scheduling for OSX is replaced by fixed priority scheduling in pwlib
*
* Revision 1.311 2003/05/23 05:19:03 rjongbloed
* Added extra #define for H263 codec
*
* Revision 1.310 2003/05/15 01:00:14 rjongbloed
* Fixed use of correct autoconf variable to include H.263 codec
*
* Revision 1.309 2003/05/14 13:58:39 rjongbloed
* Removed hack of using special payload type for H.263 for a method which
* would be less prone to failure in the future.
*
* Revision 1.308 2003/05/14 02:49:52 dereksmithies
* Add videolose option, so X percentage of video packets are dropped when in --videotest mode
*
* Revision 1.307 2003/05/07 02:45:58 dereks
* Alter ohphone to use the PSDLVideoOutputDevice class, which is now part of pwlib.
*
* Revision 1.306 2003/04/16 04:31:22 dereks
* Initial release of h263 video codec, which utilises the ffmpeg library.
* Thanks to Guilhem Tardy, and to AliceStreet
*
* Revision 1.305 2003/04/15 21:16:53 dereks
* Patch for firewire video applied - thanks to Goergi Georgiev.
*
* Revision 1.304 2003/04/04 02:14:34 robertj
* Fixed IPv6 support for ports on interfaces, pointed out by Kostas Stamos
*
* Revision 1.303 2003/03/31 00:22:32 dereks
* Can now read 20 digits, instead of 10, from the IXJ card. Thanks Jorge Minassian.
*
* Revision 1.302 2003/03/28 15:10:52 rogerh
* Add 127.0.0.1 to IP addresses which are not translated in NAT mode.
*
* Revision 1.301 2003/03/24 23:15:25 robertj
* Fixed change of variable name
*
* Revision 1.300 2003/03/21 04:21:30 robertj
* Fixed missing set of colour format in video output device.
*
* history deleted
*
* Revision 1.1 1998/12/14 09:13:19 robertj
* Initial revision
*
*/
#include <ptlib.h>
#include <ptclib/random.h>
#include "main.h"
#include "h261codec.h"
#include "h263codec.h"
#if H323_AVCODEC
#include "ffh263codec.h"
#endif
#if H323_RFC2190_AVCODEC
#include "rfc2190avcodec.h"
#endif
#include "h323pdu.h"
//#include "h323t120.h"
//#include "t120proto.h"
#ifdef DEPRECATED_CU30
#include "cu30codec.h"
#endif
#ifdef P_LINUX
#include "vidlinux.h"
#include <sys/resource.h>
#endif
#ifdef P_SDL
#include <ptclib/vsdl.h>
#endif
#ifdef USE_SHM_VIDEO_DEVICES
#include "shmvideo.h"
#endif
#ifdef HAS_OSS
#define DEFAULT_MIXER "/dev/mixer"
#ifdef P_LINUX
#include <linux/soundcard.h>
#endif
#ifdef P_FREEBSD
#if P_FREEBSD >= 500000
#include <sys/soundcard.h>
#else
#include <machine/soundcard.h>
#endif
#endif
#if defined(P_OPENBSD) || defined(P_NETBSD)
#include <soundcard.h>
#endif
#endif // HAS OSS
#ifdef HAS_LIDDEVICE
static const char * AECLevelNames[] = { "Off", "Low", "Medium", "High", "Auto AEC", "Auto AEC/AGC" };
#endif
#define HAS_T38
#ifdef HAS_T38
#include <h323t38.h>
#endif
#include <ptclib/pvfiledev.h>
#include "version.h"
PCREATE_PROCESS(OhPhone);
#define DEFAULT_TIMEOUT 60000
#define LAST_CALL_COUNT 16
#define POTS_LINE 0
class RingThread : public PThread
{
PCLASSINFO(RingThread, PThread);
public:
RingThread(MyH323EndPoint & ep)
: PThread(1000, NoAutoDeleteThread),
endpoint(ep)
{ Resume(); }
void Main()
{ endpoint.HandleRinging(); }
protected:
MyH323EndPoint & endpoint;
};
#define new PNEW
///////////////////////////////////////////////////////////////
OhPhone::OhPhone()
: PProcess("Open H323 Project", "OhPhone",
MAJOR_VERSION, MINOR_VERSION, BUILD_TYPE, BUILD_NUMBER)
{
}
OhPhone::~OhPhone()
{
}
void OhPhone::Main()
{
//PArgList & args = GetArguments();
PConfigArgs args(GetArguments());
args.Parse(
"a-auto-answer." "-no-auto-answer."
"b-bandwidth:" "-no-bandwidth."
"B-forward-busy:" "-no-forward-busy."
#ifdef HAS_LIDDEVICE
"c-callerid." "-no-callerid."
"C-country:" "-no-country."
#endif
"d-autodial:" "-no-autodial."
"D-disable:"
"e-silence." "-no-silence."
"f-fast-disable." "-no-fast-disable."
"F-forward-always:" "-no-forward-always."
"g-gatekeeper:"
"G-gatekeeper-id:"
"-disable-grq."
"h-help."
"I-input-mode:"
"i-interface:" "-no-interface."
"j-jitter:" "-no-jitter."
"l-listen."
"n-no-gatekeeper."
"N-forward-no-answer:" "-no-forward-no-answer."
"-number-prefix:" "-no-number-prefix."
"-answer-timeout:" "-no-answer-timeout."
#if PTRACING
"o-output:" "-no-output."
#endif
"p-proxy:" "-no-proxy."
"-password:" "-no-password."
"-listenport:" "-no-listenport."
"-connectport:" "-no-connectport."
"-connectring:" "-no-connectring."
"-port:" "-no-port."
"P-prefer:"
#ifdef HAS_IXJ
"q-quicknet:" "-no-quicknet."
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -