Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
main.h
Package: Client_win_src.rar [view]
Upload User: gnaf34
Upload Date: 2022-04-22
Package Size: 1657k
Code Size: 9k
Category:
VOIP program
Development Platform:
Visual C++
- /*
- * main.h
- *
- * Header file
- *
- * Copyright (c) ITEC-Ohio, 2002.
- *
- * 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 available at http://www.openh323.org
- * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
- *
- */
- #ifndef _BeaconClient_MAIN_H
- #define _BeaconClient_MAIN_H
- #include <h323.h>
- //#include <afxsock.h>
- //#include <afxtempl.h>
- #ifdef _WIN32
- #include <vblasterlid.h>
- #endif
- #ifdef HAS_IXJ
- #include <ixjlid.h>
- #endif
- #if defined(HAS_IXJ) || defined(HAS_VBLASTER)
- #define HAS_LIDDEVICE
- #endif
- #ifdef __BEOS__
- #ifndef _APPLICATION_H
- #include <Application.h>
- #endif
- //forward declaration
- //class MyH323EndPoint;
- class BeaconClientApplication : public BApplication
- {
- public:
- BeaconClientApplication()
- : BApplication("application/x-vnd.BeBeaconClient") { }
- };
- BeaconClientApplication BeaconClientApp;
- #endif
- /*class BeaconClient : public PProcess
- //class BeaconClient
- {
- PCLASSINFO(BeaconClient,PProcess);
- public:
- BeaconClient();
- ~BeaconClient();
- void Main();
- char* ipAddress;
- MyH323EndPoint* endpoint;
- };
- */
- class CallOptions : public PObject
- {
- PCLASSINFO(CallOptions, PObject);
- public:
- BOOL Initialise(PArgList & args);
- void PrintOn(ostream & str) const;
- BOOL noFastStart;
- BOOL noH245Tunnelling;
- BOOL noSilenceSuppression;
- int jitter;
- PINDEX connectRing;
- WORD connectPort;
- };
- class MyH323EndPoint : public H323EndPoint
- {
- PCLASSINFO(MyH323EndPoint, H323EndPoint);
- public:
- // overrides from H323EndPoint
- virtual H323Connection * CreateConnection(unsigned callReference);
- //virtual BOOL OnIncomingCall(H323Connection &, const H323SignalPDU &, H323SignalPDU &);
- //virtual BOOL OnConnectionForwarded(H323Connection &, const PString &, const H323SignalPDU &);
- virtual void OnConnectionEstablished(H323Connection &, const PString &);
- virtual void OnConnectionCleared(H323Connection &, const PString &);
- virtual BOOL OpenAudioChannel(H323Connection &, BOOL, unsigned, H323AudioCodec &);
- virtual BOOL OpenVideoChannel(H323Connection &, BOOL, H323VideoCodec &);
- //virtual H323Connection * SetupTransfer(const PString &, const PString &, const PString &, PString &);
- // new functions
- BOOL MyH323EndPoint::Initialise(PString AudioCodec);
- BOOL Initialise(PConfigArgs & args, int verbose, BOOL hasMenu);
- void MakeOutgoingCall(const PString &, const PString &);
- void MakeOutgoingCall(const PString &, const PString &, CallOptions callOptions);
- void AwaitTermination();
- void TriggerDisconnect();
- void HandleUserInterface();
- void StartRinging();
- void StopRinging();
- void HandleRinging();
- //void TestVideoGrabber();
- void TestHandleUserInterface();
- #ifdef HAS_LIDDEVICE
- void HandleStateChange(BOOL onHook);
- void HandleHandsetOffHook();
- void HandleHandsetOnHook();
- void HandleHandsetDTMF(PString & digits);
- void HandleHandsetTimeouts(const PTime & offHookTime);
- #endif
- void SendDTMF(const char * tone);
- void StartCall(const PString & str);
- //void NewSpeedDial(const PString & str);
- //void ListSpeedDials();
- PDECLARE_NOTIFIER(PTimer, MyH323EndPoint, OnAutoDisconnect);
- PString GetCurrentCallToken() const
- { return currentCallToken; }
- BOOL terminateOnHangup;
- PString currentCallToken;
- PString callTransferCallToken;
- enum {
- uiDialtone,
- uiAnsweringCall,
- uiConnectingCall,
- uiWaitingForAnswer,
- uiCallInProgress,
- uiCallHungup,
- uiStateIllegal,
- } uiState;
- protected:
- // only used internally
- //BOOL SetSoundDevice(PConfigArgs &, const char *, PSoundChannel::Directions);
- void AnswerCall(H323Connection::AnswerCallResponse response);
- CallOptions defaultCallOptions;
- CallOptions currentCallOptions;
- int verbose;
- BOOL autoAnswer;
- PString alwaysForwardParty;
- PString busyForwardParty;
- PString noAnswerForwardParty;
- unsigned noAnswerTime;
- PTimer noAnswerTimer;
- PString videoReceiveDevice;
- int videoQuality;
- int videoTxQuality;
- int videoSize; //0=small, 1=large.
- int videoInput;
- int videoQ;
- int videoFill;
- int videoFramesPS;
- int videoBitRate;
- BOOL videoIsPal;
- BOOL videoFake;
- BOOL videoLocal;
- BOOL videoPIP;
- PString videoDevice;
- PString pfdColourFormat;
- int videoCu30Stats;
- PString configDirectory;
- // used for testing the video (no connection made).
- PVideoChannel *localVideoChannel;
- PString autoDial;
- BOOL dialAfterHangup;
- BOOL callerIdEnable;
- BOOL callerIdCallWaitingEnable;
- PString setupParameter;
- PFilePath ringFile;
- int ringDelay;
- PSyncPoint ringFlag;
- PThread * ringThread;
- int autoDisconnect;
- PTimer autoDisconnectTimer;
- int recordVolume;
- int playVolume;
- #ifdef HAS_OSS
- BOOL InitialiseMixer(PConfigArgs & args, int _verbose);
- int mixerDev;
- int mixerRecChan;
- int savedMixerRecChan;
- int ossRecVol;
- int ossPlayVol;
- #endif
- PMutex uiStateMutex;
- PSyncPoint exitFlag;
- BOOL speakerphoneSwitch;
- BOOL hasMenu;
- BOOL autoHook;
- OpalLineInterfaceDevice * lidDevice;
- BOOL isXJack;
- friend class MyH323Connection;
- };
- /* New One */
- class MyH323Connection : public H323Connection
- {
- PCLASSINFO(MyH323Connection, H323Connection);
- public:
- MyH323Connection(MyH323EndPoint &, unsigned, unsigned, WORD, int);
- // overrides from H323Connection
- BOOL OnSendSignalSetup(H323SignalPDU & setupPDU);
- AnswerCallResponse OnAnswerCall(const PString &, const H323SignalPDU &, H323SignalPDU &);
- BOOL OnStartLogicalChannel(H323Channel &);
- void OnClosedLogicalChannel(H323Channel &);
- BOOL OnAlerting(const H323SignalPDU &, const PString &);
- void OnUserInputString(const PString &);
- PString GetCallerIdString() const;
- protected:
- MyH323EndPoint & myEndpoint;
- int verbose;
- int channelsOpen;
- };
- /* Old one */
- /*
- class MyH323Connection : public H323Connection
- {
- PCLASSINFO(MyH323Connection, H323Connection);
- public:
- MyH323Connection(MyH323EndPoint &, unsigned, BOOL, BOOL, WORD, int);
- // overrides from H323Connection
- BOOL OnSendSignalSetup(H323SignalPDU & setupPDU);
- AnswerCallResponse OnAnswerCall(const PString &, const H323SignalPDU &, H323SignalPDU &);
- BOOL OnStartLogicalChannel(H323Channel &);
- void OnClosedLogicalChannel(H323Channel &);
- BOOL OnAlerting(const H323SignalPDU &, const PString &);
- void OnUserInputString(const PString &);
- PString GetCallerIdString() const;
- protected:
- MyH323EndPoint & myEndpoint;
- int verbose;
- int channelsOpen;
- };
- */
- //////////////////////////////////////////////
- class UserInterfaceThread : public PThread
- {
- PCLASSINFO(UserInterfaceThread, PThread);
- public:
- UserInterfaceThread(MyH323EndPoint & end)
- : PThread(1000, NoAutoDeleteThread), endpoint(end) { Resume(); }
- void Main()
- { /*endpoint.HandleUserInterface();*/ }
- protected:
- MyH323EndPoint & endpoint;
- };
- //////////////////////////////////////////////
- class TestUserInterfaceThread : public PThread
- {
- PCLASSINFO(TestUserInterfaceThread, PThread);
- public:
- TestUserInterfaceThread(MyH323EndPoint & end)
- : PThread(1000, NoAutoDeleteThread), endpoint(end) { Resume(); }
- void Main()
- { /*endpoint.TestHandleUserInterface();*/ }
- protected:
- MyH323EndPoint & endpoint;
- };
- #endif // _BeaconClient_MAIN_H
- class BeaconClient : public PProcess
- //class BeaconClient
- {
- PCLASSINFO(BeaconClient,PProcess);
- public:
- //static const OnPhone myStaticInstance;
- BeaconClient();
- ~BeaconClient();
- void Main();
- void Quit();
- int GetStatistics();
- int CheckConnections();
- PString GetCurrentToken();
- const char* ipAddress;
- MyH323EndPoint* endpoint;
- //GNUPlot related
- void PostString(HWND hwnd, CString pc1);
- char* FindUnquotedSpace( char *pc );
- int PrepareGnuPlot();
- int PrepareGnuPlotLatency();
- void ConvertPngToBmp(CString filepath);
- };
- ///////////////////////////////////////////////////////
- // End of File ///////////////////////////////////////////////////////////////