A
download otdialgc.h
Language: C++
Copyright: (c) 1995-97 OpenComm do Brasil Ltda.
LOC: 110
Project Info
Open Telephony Server(opentel)
Server: SourceForge
Type: cvs
...el\server\drivers\dialogic\
   dialogic.dsp
   otdialap.cpp
   otdialap.h
   otdialar.cpp
   otdialar.h
   otdialdev.h
   otdialdrv.cpp
   otdialdrv.h
   otdialdti.cpp
   otdialdti.h
   otdialdxx.cpp
   otdialdxx.h
   otdialei.cpp
   otdialei.h
   otdialev.cpp
   otdialev.h
   otdialex.cpp
   otdialex.h
   otdialgc.cpp
   otdialgc.h
   otdialmsi.cpp
   otdialmsi.h
   otdialogic.cpp
   otdialogic.h
   otdialsc.cpp
   otdialsc.h
   otdialtd.cpp
   otdialtd.h
   otdialtg.cpp
   otdialtg.h

/*****************************************************************************
* OpenTel Telephony Server & Framework
* Copyright (c) 1995-97 OpenComm do Brasil Ltda.
* Todos os direitos reservados.
* Este arquivo contem material confidencial de OpenComm do Brasil, e deve
* darse tratamento como tal.
******************************************************************************/




#ifndef __OTDIALGC_H__
#define __OTDIALGC_H__

// Include Files
//#include <otresources.h>
#include <otpstnint.includes>
#include <dialogic/otdialdev.h>
#include <dialogic/otdialev.h>
#include <otexcept.includes>
#include <otcall.includes>

extern "C" long time(long *);

// Foward declarations

class OtBus;
class OtMessage;
class OtDialogicGcCall;
class OtDialogicGcEvent;
//struct LINEDEV;
class OtDialogicDti;

//
//
// OtDialogicGc
//
//

/// OtDialogicGc
class OtDialogicGc : public OtPSTNInterface , public OtDialogicDev {
public:
        OtDialogicGc(const OtString &devName, OtCCDir dir, OtBus *bus);
virtual ~OtDialogicGc(void);

        int open(void);
        int close(void);

        // Base Class OtCallChannel  Interface Members

        OtCall *makeCall(const OtString &phone);
        int waitCall(void);
        int answerCall(void);
        int releaseCall(void);


        void setCallingNumber(const OtString &phone);
        OtCall *getCall(void) const;
        //virtual long getNonIdleTime() const;

        // Implementation Members
        virtual OtCall *makeCallSelf(const OtString &phone);
        virtual void onMessage(OtMessage *msg);

//    virtual const OtString &getName() const;

        /// Used to access low level functions
        LINEDEV getGcLineDev() const { return _linedev;}

        /// Dump resource info in ascii on buff as string
        virtual void dump(OtString &context) const;

        OtBus *getBus() const { return m_bus; }

        virtual OtTimeSlotListener *getListener();
        virtual OtTimeSlotTransmitter *getTransmitter();

protected:

        virtual int isForMe(OtDialogicEvent *e);
        void dispatchEvent(OtEventType t);
        virtual inboundOnEvent(OtDialogicGcEvent *e);
        virtual outboundOnEvent(OtDialogicGcEvent *e);

        // This handle the dynamic association of the DTI and DXX devices
        void attachToDxx();
        void detachFromDxx();


private:
        LINEDEV _linedev;
    OtString _devName;
        OtDialogicGcCall *_call;
        enum { Blocked, Unblocked } _st;
        friend class OtDialogicDriverThread;
        long _connTs;           // Connected TimeStamp for computing NonIdleTime
        long _lastTs;           // Last Call connected TimeStamp
        long _blockTs;          // Last Blocked TimeStamp
        OtBus *m_bus;                           // Resource connected to bus
        OtDialogicDti *m_dti;           // The Network Device
};



//
//
// OtDialogicGcCall
//
//

class OtDialogicGcCall : public OtCall, public OtMessageTarget {
public:
        OtDialogicGcCall(OtDialogicGc *gc,OtCallDir dir, CRN c);
        virtual ~OtDialogicGcCall(void);

        int answerCall(void);
        int dropCall(void);

    OtString getAni(void);
        OtString getDnis(void);
        OtCallState getState(void) const;

        enum OtGcState1 { Avail, AnsweringCall, MakeingCall, DropingCall };


        OtGcState1 getState1(void) const;

        virtual onMessage(OtMessage *msg);

        /// Dump call info in ascii on buff as string
        virtual void dump(OtString &context) const;

protected:

        OtGcState1 setState1(OtGcState1 s);
        void dispatchEvent(OtEventType t);
        virtual inboundOnEvent(OtDialogicGcEvent *e);
        virtual outboundOnEvent(OtDialogicGcEvent *e);

private:
        OtDialogicGc *_gc;
        CRN _crn;
        OtGcState1 _gcst1;
        OtString _ani;          // ANI
        OtString _dnis;         // DNIS

        long _becoTs;           // Before Conn TimeStamp(MakeCall or Offered)
        long _connTs;           // Connected TimeStamp
        long _discTs;           // Disconnected TimeStamp

friend class OtDialogicGc;

};

//
//
// OtDialogicGcEvent
//
//

class OtDialogicGcEvent : public OtDialogicEvent {
public:
        OtDialogicGcEvent(void);
        virtual ~OtDialogicGcEvent(void);


        static const OtEventClass eventClass=0x00020001;

private:
        METAEVENT _me;          // Global Call MetaEvent
        CRN _crn;                       // Global Call Call Record Number

public:
        METAEVENT getMetaEvent(void) { return _me; }
        CRN getCRN(void) { return _crn; }

        OT_DECLARE_SERIAL(OtDialogicGcEvent);
};


//
// OtDialogicGcException
//

class OtDialogicGcException : public OtException {
public:
        OtDialogicGcException(void);
        OtDialogicGcException(const OtDialogicGc *gc);

protected:
        OtString makeErrorString(void);
private:
        int _cclibid;
        int _gc_error;
        long _cc_error;
        char *_gc_msg;
        char *_lib_msg;
        char *_lib_name;
        OtString _strbuf;
        const OtDialogicGc *_gc;
};



#endif

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us