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

📄 resgwdevice.hxx

📁 Vovida 社区开源的 SIP 协议源码
💻 HXX
字号:
#ifndef ResGwDevice_HXX#define ResGwDevice_HXX/* ==================================================================== * The Vovida Software License, Version 1.0  *  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved. *  * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: *  * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. *  * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in *    the documentation and/or other materials provided with the *    distribution. *  * 3. The names "VOCAL", "Vovida Open Communication Application Library", *    and "Vovida Open Communication Application Library (VOCAL)" must *    not be used to endorse or promote products derived from this *    software without prior written permission. For written *    permission, please contact vocal@vovida.org. * * 4. Products derived from this software may not be called "VOCAL", nor *    may "VOCAL" appear in their name, without prior written *    permission of Vovida Networks, Inc. *  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. *  * ==================================================================== *  * This software consists of voluntary contributions made by Vovida * Networks, Inc. and many individuals on behalf of Vovida Networks, * Inc.  For more information on Vovida Networks, Inc., please see * <http://www.vovida.org/>. * */static const char* const ResGwDeviceVersion =    "$Id: ResGwDevice.hxx,v 1.26 2002/07/12 00:24:23 veer Exp $";#include <termios.h>#include "Sptr.hxx"#include "Fifo.h"#include "SipProxyEvent.hxx"#include "UaHardwareEvent.hxx"#include "UaDeviceEvent.hxx"#include "DigitCollector.hxx"#ifdef HAS_RSVPLIB#include "SuaRsvp.hxx"#endifnamespace Vocal{
class InviteMsg;
typedef enum {    HARDWARE_AVAILABLE = 0,    HARDWARE_UNAVAILABLE,    HARDWARE_CALLWAITING_ALLOWED} HardwareStatusType;typedef enum {    DialToneEmulation,    RingbackToneEmulation} ToneEmulation;///typedef list < Sptr<SipCallId> > CallWaitingIdList;///enum EntryState{    EntryStateTelephoneUI,    EntryStateEnterUrl};/**  * Abstract base class for all hardware.  Specifies the SIP gateway * hardware API.  Defines a basic level of service provided by all * supported hardware interfaces. */class ResGwDevice{    public:        ///        ResGwDevice() {};        /// Creates a hardware object to control a single port gateway.        ResGwDevice( const char* deviceName,                     Sptr < Fifo < Sptr < SipProxyEvent > > > inputQ,                     Sptr < Fifo < Sptr < SipProxyEvent > > > outputQ );        /// Creates a hardware object to control a multi port gateway.        /** Right now, this feature is not used, and simply asserts.	 *  Later, we may need to implement this functionality.	 */        ResGwDevice( const char* deviceName,                     int numEndpoints,                     Sptr < Fifo < Sptr < SipProxyEvent > > > inputQ,                     Sptr < Fifo < Sptr < SipProxyEvent > > > outputQ[] )        { assert( 0 ); };        /// Destructor        virtual ~ResGwDevice();        /// Starts the main processing loop of the hardware        virtual void* hardwareMain( void* parms ) = 0;        /** Add device's socket to the fd; returns 0 if successful,         ** errorcode otherwise          */        virtual int addToFdSet( fd_set* fd ) = 0;        /** Process all pending hardware events; returns 0 if successful,         ** otherwise returns an errorcode.           */        virtual int process( fd_set* fd ) = 0;        /** Start audio channel on device; returns 0 if successful,         ** errorcode otherwise          */        virtual int audioStart( const HardwareAudioRequest& request ) = 0;        /** Stops audio channel on device; returns 0 if successful,         ** errorcode otherwise.         */        virtual int audioStop() = 0;        /** suspend audio channel on device; returns 0 if successful,         ** errorcode otherwise          */        virtual int audioSuspend() = 0;        /** resume audio channel on device; returns 0 if successful,         ** errorcode otherwise          */        virtual int audioResume( const HardwareAudioRequest& request ) = 0;        /**         */        virtual void processRTP() = 0;        ///        virtual void setCallId( const Sptr<SipCallId> newCallId );        ///        virtual Sptr<SipCallId> getCallId() const;        ///        virtual void addCallWaitingId( const Sptr<SipCallId> newCallId );        ///        virtual Sptr<SipCallId> getCallWaitingId() const;        ///        virtual void removeCallWaitingId( const SipCallId& newCallId );        ///        virtual Sptr<DigitCollector> getDigitCollector();        ///        virtual HardwareStatusType getHardwareStatus();        ///        virtual bool isMyHardware(const SipCallId& callid);        ///        virtual bool isOnCallWaiting(const SipCallId& callid);        ///        virtual int getRtpPort() = 0;        ///        virtual void releaseRtpPort() = 0;        /// access functions to private data        inline Sptr < Fifo < Sptr<SipProxyEvent> > > getQ ()         { return myQ; };        inline bool isOffhook () { return hookStateOffhook; };        /// returns the file descriptor for the device        inline int getFD() { return myFD; };#ifdef HAS_RSVPLIB        /// RSVP stuff ported from Session.hxx        void setUseRsvp( bool flag ) { useRsvp = flag; };        bool getUseRsvp() { return useRsvp; };#endif        void setUsePolicy( bool flag ) { usePolicy = flag; };        bool getUsePolicy() { return usePolicy; };        InviteMsg* ringInvite;        bool originator;#ifdef HAS_RSVPLIB        SuaRsvp& getSuaRsvpSender() { return suaRsvpSender; };        SuaRsvp& getSuaRsvpReserv() { return suaRsvpReserv; };#endif    protected:#ifdef HAS_RSVPLIB        /// RSVP stuff ported from Session.hxx        bool useRsvp;        SuaRsvp suaRsvpSender;        SuaRsvp suaRsvpReserv;#endif        bool usePolicy;        // ****************        // for signal control        // ****************        virtual void provideDialToneStart() = 0;        virtual void provideDialToneStop() = 0;        virtual void provideRingStart() = 0;        virtual void provideRingStop() = 0;        virtual void provideLocalRingbackStart() = 0;        virtual void provideLocalRingbackStop() = 0;        virtual void provideBusyToneStart() = 0;        virtual void provideBusyToneStop() = 0;        virtual void provideFastBusyToneStart() = 0;        virtual void provideFastBusyToneStop() = 0;        virtual void provideCallWaitingBeepStart() = 0;        virtual void provideCallWaitingBeepStop() = 0;        ///        virtual void provideDtmf( DeviceSignalType signal ) = 0;        ///        virtual void provideCallInfo( string CallerId,                                      string CalleeId,                                      string ForwardReason ) = 0;        /** Trigger the device to send the specified signal; returns 0 if         ** successful, errorcode otherwise.         */        int provideSignal( DeviceSignalType signal );        /// Process a msg received from an session        void processSessionMsg( Sptr < SipProxyEvent > event );        /// Report hardware event by adding it to specified queue        void reportEvent( Sptr < Fifo < Sptr< SipProxyEvent > > > outputQ,                          DeviceEventType eventType );        /// file descriptor for hardware device        int myFD;        /// input queue to allow the session to control hardware signals        Sptr < Fifo < Sptr< SipProxyEvent > > > myQ;        /// true if last reported hook state was offhook        bool hookStateOffhook;        /// Current call id        Sptr<SipCallId> callId;        /// Call Id on call waiting list        Sptr<CallWaitingIdList> callWaitingIdList;        bool audioActive;      // true if two way speech is enabled        bool audioHalfActive;  // true if one way speech is enabled#ifndef WIN32        /// needed for proper terminal control        int stdinFD;        struct termios initialTerm;#endif        /// this bool is set to true if the user is entering text        EntryState myEntryState;        /** this Data contains a partial URL entered by a user if they            have entered 'u'          */        Data myTextEntry;        ///        Sptr<DigitCollector> digitCollector;}; }#endif

⌨️ 快捷键说明

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