⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 h323ep.cxx

📁 mgcp协议源代码。支持多种编码:g711
💻 CXX
📖 第 1 页 / 共 3 页
字号:
/* * h323ep.cxx * * H.323 protocol handler * * Open H323 Library * * 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): ______________________________________. * * $Log: h323ep.cxx,v $ * Revision 1.51  2000/07/13 12:34:41  robertj * Split autoStartVideo so can select receive and transmit independently * * Revision 1.50  2000/07/11 19:30:15  robertj * Fixed problem where failure to unregister from gatekeeper prevented new registration. * * Revision 1.49  2000/07/09 14:59:28  robertj * Fixed bug if using default transport (no '@') for address when gatekeeper present, used port 1719. * * Revision 1.48  2000/07/04 04:15:40  robertj * Fixed capability check of "combinations" for fast start cases. * * Revision 1.47  2000/07/04 01:16:50  robertj * Added check for capability allowed in "combinations" set, still needs more done yet. * * Revision 1.46  2000/06/29 11:00:04  robertj * Added user interface for sound buffer depth adjustment. * * Revision 1.45  2000/06/29 07:10:32  robertj * Fixed incorrect setting of default number of audio buffers on Win32 systems. * * Revision 1.44  2000/06/23 02:48:24  robertj * Added ability to adjust sound channel buffer depth, needed increasing under Win32. * * Revision 1.43  2000/06/20 02:38:28  robertj * Changed H323TransportAddress to default to IP. * * Revision 1.42  2000/06/17 09:13:06  robertj * Removed redundent line of code, thanks David Iodice. * * Revision 1.41  2000/06/07 05:48:06  robertj * Added call forwarding. * * Revision 1.40  2000/06/03 03:16:39  robertj * Fixed using the wrong capability table (should be connections) for some operations. * * Revision 1.39  2000/05/25 00:34:59  robertj * Changed default tos on Unix platforms to avoid needing to be root. * * Revision 1.38  2000/05/23 12:57:37  robertj * Added ability to change IP Type Of Service code from applications. * * Revision 1.37  2000/05/23 11:32:37  robertj * Rewrite of capability table to combine 2 structures into one and move functionality into that class *    allowing some normalisation of usage across several applications. * Changed H323Connection so gets a copy of capabilities instead of using endponts, allows adjustments *    to be done depending on the remote client application. * * Revision 1.36  2000/05/16 07:38:50  robertj * Added extra debug info indicating sound channel buffer size. * * Revision 1.35  2000/05/11 03:48:11  craigs * Moved SetBuffer command to fix audio delay * * Revision 1.34  2000/05/02 04:32:26  robertj * Fixed copyright notice comment. * * Revision 1.33  2000/05/01 13:00:28  robertj * Changed SetCapability() to append capabilities to TCS, helps with assuring no gaps in set. * * Revision 1.32  2000/04/30 03:58:37  robertj * Changed PSoundChannel to be only double bufferred, this is all that is needed with jitter bufferring. * * Revision 1.31  2000/04/11 04:02:48  robertj * Improved call initiation with gatekeeper, no longer require @address as *    will default to gk alias if no @ and registered with gk. * Added new call end reasons for gatekeeper denied calls. * * Revision 1.30  2000/04/10 20:37:33  robertj * Added support for more sophisticated DTMF and hook flash user indication. * * Revision 1.29  2000/04/06 17:50:17  robertj * Added auto-start (including fast start) of video channels, selectable via boolean on the endpoint. * * Revision 1.28  2000/04/05 03:17:31  robertj * Added more RTP statistics gathering and H.245 round trip delay calculation. * * Revision 1.27  2000/03/29 02:14:45  robertj * Changed TerminationReason to CallEndReason to use correct telephony nomenclature. * Added CallEndReason for capability exchange failure. * * Revision 1.26  2000/03/25 02:03:36  robertj * Added default transport for gatekeeper to be UDP. * * Revision 1.25  2000/03/23 02:45:29  robertj * Changed ClearAllCalls() so will wait for calls to be closed (usefull in endpoint dtors). * * Revision 1.24  2000/02/17 12:07:43  robertj * Used ne wPWLib random number generator after finding major problem in MSVC rand(). * * Revision 1.23  2000/01/07 08:22:49  robertj * Added status functions for connection and added transport independent MakeCall * * Revision 1.22  1999/12/23 23:02:36  robertj * File reorganision for separating RTP from H.323 and creation of LID for VPB support. * * Revision 1.21  1999/12/11 02:21:00  robertj * Added ability to have multiple aliases on local endpoint. * * Revision 1.20  1999/12/09 23:14:20  robertj * Fixed deadock in termination with gatekeeper removal. * * Revision 1.19  1999/11/19 08:07:27  robertj * Changed default jitter time to 50 milliseconds. * * Revision 1.18  1999/11/06 05:37:45  robertj * Complete rewrite of termination of connection to avoid numerous race conditions. * * Revision 1.17  1999/10/30 12:34:47  robertj * Added information callback for closed logical channel on H323EndPoint. * * Revision 1.16  1999/10/19 00:04:57  robertj * Changed OpenAudioChannel and OpenVideoChannel to allow a codec AttachChannel with no autodelete. * * Revision 1.15  1999/10/14 12:05:03  robertj * Fixed deadlock possibilities in clearing calls. * * Revision 1.14  1999/10/09 01:18:23  craigs * Added codecs to OpenAudioChannel and OpenVideoDevice functions * * Revision 1.13  1999/10/08 08:31:45  robertj * Fixed failure to adjust capability when startign channel * * Revision 1.12  1999/09/23 07:25:12  robertj * Added open audio and video function to connection and started multi-frame codec send functionality. * * Revision 1.11  1999/09/21 14:24:48  robertj * Changed SetCapability() so automatically calls AddCapability(). * * Revision 1.10  1999/09/21 14:12:40  robertj * Removed warnings when no tracing enabled. * * Revision 1.9  1999/09/21 08:10:03  craigs * Added support for video devices and H261 codec * * Revision 1.8  1999/09/14 06:52:54  robertj * Added better support for multi-homed client hosts. * * Revision 1.7  1999/09/13 14:23:11  robertj * Changed MakeCall() function return value to be something useful. * * Revision 1.6  1999/09/10 02:55:36  robertj * Changed t35 country code to Australia (finally found magic number). * * Revision 1.5  1999/09/08 04:05:49  robertj * Added support for video capabilities & codec, still needs the actual codec itself! * * Revision 1.4  1999/08/31 12:34:19  robertj * Added gatekeeper support. * * Revision 1.3  1999/08/27 15:42:44  craigs * Fixed problem with local call tokens using ambiguous interface names, and connect timeouts not changing connection state * * Revision 1.2  1999/08/27 09:46:05  robertj * Added sepearte function to initialise vendor information from endpoint. * * Revision 1.1  1999/08/25 05:10:36  robertj * File fission (critical mass reached). * Improved way in which remote capabilities are created, removed case statement! * Changed MakeCall, so immediately spawns thread, no black on TCP connect. * */#include <ptlib.h>#include <ptclib/random.h>#include "h323.h"#include "h323pdu.h"#ifndef IPTOS_PREC_CRITIC_ECP#define IPTOS_PREC_CRITIC_ECP (5 << 5)#endif#ifndef IPTOS_LOWDELAY#define IPTOS_LOWDELAY 0x10#endifclass H225CallThread : public PThread{  PCLASSINFO(H225CallThread, PThread)  public:    H225CallThread(H323EndPoint & endpoint,                   H323Connection & connection,                   H323Transport & transport,                   const PString & alias,                   const H323TransportAddress & address);  protected:    void Main();    H323Connection     & connection;    H323Transport      & transport;    PString              alias;    H323TransportAddress address;};class H323ConnectionsCleaner : public PThread{  PCLASSINFO(H323ConnectionsCleaner, PThread)  public:    H323ConnectionsCleaner(H323EndPoint & endpoint);    ~H323ConnectionsCleaner();    void Signal() { wakeupFlag.Signal(); }  protected:    void Main();    H323EndPoint & endpoint;    BOOL           stopFlag;    PSyncPoint     wakeupFlag;};#define new PNEW#if !PTRACING // Stuff to remove unised parameters warning#define PTRACE_caller#define PTRACE_isEncoding#endif/////////////////////////////////////////////////////////////////////////////H225CallThread::H225CallThread(H323EndPoint & endpoint,                               H323Connection & c,                               H323Transport & t,                               const PString & a,                               const H323TransportAddress & addr)  : PThread(endpoint.GetSignallingThreadStackSize(), NoAutoDeleteThread),    connection(c),    transport(t),    alias(a),    address(addr){  transport.AttachThread(this);  Resume();}void H225CallThread::Main(){  PTRACE(3, "H225\tStarted call thread");  H323Connection::CallEndReason reason = connection.SendSignalSetup(alias, address);  if (reason != H323Connection::NumCallEndReasons)    connection.ClearCall(reason);  else    connection.HandleSignallingChannel();}/////////////////////////////////////////////////////////////////////////////H323ConnectionsCleaner::H323ConnectionsCleaner(H323EndPoint & end)  : PThread(10000, NoAutoDeleteThread),    endpoint(end){  Resume();  stopFlag = FALSE;}H323ConnectionsCleaner::~H323ConnectionsCleaner(){  stopFlag = TRUE;  wakeupFlag.Signal();  WaitForTermination();}void H323ConnectionsCleaner::Main(){  for (;;) {    wakeupFlag.Wait();    if (stopFlag)      return;    endpoint.CleanUpConnections();  }}/////////////////////////////////////////////////////////////////////////////H323EndPoint::H323EndPoint()  : soundChannelPlayDevice(PSoundChannel::GetDefaultDevice(PSoundChannel::Player)),    soundChannelRecordDevice(PSoundChannel::GetDefaultDevice(PSoundChannel::Recorder)),    signallingChannelCallTimeout(0, 0, 1),  // Minutes    masterSlaveDeterminationTimeout(0, 30), // Seconds    capabilityExchangeTimeout(0, 30),       // Seconds    logicalChannelTimeout(0, 30),           // Seconds    requestModeTimeout(0, 30),              // Seconds    roundTripDelayTimeout(0, 10),           // Seconds    roundTripDelayRate(0, 0, 1),            // Minutes    gatekeeperRequestTimeout(0, 5),         // Seconds    rasRequestTimeout(0, 5)                 // Seconds{  localAliasNames.AppendString(PProcess::Current().GetUserName());  autoStartReceiveVideo = autoStartTransmitVideo = TRUE;  terminalType = e_TerminalOnly;  maxAudioDelayJitter = 50; // milliseconds  initialBandwidth = 100000; // Standard 10base LAN in 100's of bits/sec  clearCallOnRoundTripFail = FALSE;  t35CountryCode = 9; // Country code for Australia  t35Extension = 0;  manufacturerCode = 31415;   // Need to get allocated a number for here  rtpIpPortBase = 5000;#ifdef _WIN32  // Windows MultMedia stuff seems to need greater depth due to enormous  // latencies in its operation, need to use DirectSound maybe?  soundChannelBuffers = 3;  rtpIpTypeofService = IPTOS_PREC_CRITIC_ECP|IPTOS_LOWDELAY;#else  // Should only need double buffering for Unix platforms  soundChannelBuffers = 2;  // Don't use IPTOS_PREC_CRITIC_ECP on Unix platforms as then need to be root  rtpIpTypeofService = IPTOS_LOWDELAY;#endif  masterSlaveDeterminationRetries = 10;  gatekeeperRequestRetries = 2;  rasRequestRetries = 2;  signallingThreadStackSize = 30000;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -