/* * Copyright (C) 2004-2005 by Objective Systems, Inc. * * This software is furnished under an open source license and may be * used and copied only in accordance with the terms of this license. * The text of the license may generally be found in the root * directory of this installation in the COPYING file. It * can also be viewed online at the following URL: * * http://www.obj-sys.com/open/license.html * * Any redistributions of this file including modified versions must * maintain this copyright notice. * *****************************************************************************/ /** * @file ooCalls.h * This file contains call management functions. */ #ifndef _OOCALLS_H_ #define _OOCALLS_H_ #include "ooLogChan.h" #include "ooCapability.h" #include #ifdef __cplusplus extern "C" { #endif /** * @defgroup callmgmt Call Management * @{ */ /* Flag mask values */ /* DISABLEGK is used to selectively disable gatekeeper use. For incoming calls DISABLEGK can be set in onReceivedSetup callback by application. Very useful in pbx applications where gk is used only when call is to or from outside pbx domian. For outgoing calls, ooMakeCallNoGk disables use of gk for specific call. */ #define OO_M_ENDSESSION_BUILT ASN1UINTCNT(0x00800000) #define OO_M_RELEASE_BUILT ASN1UINTCNT(0x00400000) #define OO_M_FASTSTARTANSWERED ASN1UINTCNT(0x04000000) #define OO_M_ENDPOINTCREATED ASN1UINTCNT(0x00010000) #define OO_M_GKROUTED ASN1UINTCNT(0x00200000) #define OO_M_AUTOANSWER ASN1UINTCNT(0x00100000) #define OO_M_TUNNELING ASN1UINTCNT(0x08000000) #define OO_M_MEDIAWAITFORCONN ASN1UINTCNT(0x20000000) #define OO_M_FASTSTART ASN1UINTCNT(0x02000000) #define OO_M_DISABLEGK ASN1UINTCNT(0x01000000) #define OO_M_MANUALRINGBACK ASN1UINTCNT(0x10000000) #define OO_M_TRYBEMASTER ASN1UINTCNT(0x00000010) #define OO_M_AUDIOSESSION ASN1UINTCNT(0x00000100) #define OO_M_DATASESSION ASN1UINTCNT(0x00000200) #define OO_M_T38SUPPORTED ASN1UINTCNT(0x00000400) /** * Call states. */ typedef enum { OO_CALL_CREATED, /*!< Call created. */ OO_CALL_WAITING_ADMISSION, /*!< Call waiting for admission by GK */ OO_CALL_CONNECTING, /*!< Call in process of connecting */ OO_CALL_CONNECTED, /*!< Call currently connected. */ OO_CALL_PAUSED, /*!< Call Paused for hold/transfer. */ OO_CALL_CLEAR, /*!< Call marked for clearing */ OO_CALL_CLEAR_RELEASERECVD, /*!< Release command received. */ OO_CALL_CLEAR_RELEASESENT, /*!< Release sent */ OO_CALL_CLEARED, /*!< Call cleared */ OO_CALL_REMOVED /* call removed */ } OOCallState; /** * H.245 session states. */ typedef enum { OO_H245SESSION_IDLE, OO_H245SESSION_PAUSED, OO_H245SESSION_ACTIVE, OO_H245SESSION_ENDSENT, OO_H245SESSION_ENDRECVD, OO_H245SESSION_CLOSED } OOH245SessionState; /** * Structure to store local and remote media endpoint info for a * given media type. */ typedef struct OOMediaInfo{ char dir[15]; /* transmit/receive*/ int cap; int lMediaPort; int lMediaCntrlPort; char lMediaIP[20]; struct OOMediaInfo *next; } OOMediaInfo; #define ooMediaInfo OOMediaInfo struct OOAliases; /** * Structure to hold information on a forwarded call. */ typedef struct OOCallFwdData { char ip[20]; int port; struct OOAliases *aliases; OOBOOL fwdedByRemote; /*Set when we are being fwded by remote*/ } OOCallFwdData; /** * Structure to store information on an H.323 channel (H.225 or H.245) for * a particular call. */ typedef struct OOH323Channel { OOSOCKET sock; /*!< Socket connection for the channel */ int port; /*!< Port assigned to the channel */ DList outQueue; /*!< Output message queue */ } OOH323Channel; /** * Structure to store information on fast start response (H.225) to * reply same answer in CALL PROCEEDING, ALERTING & CONNECT. */ typedef struct EXTERN FastStartResponse { ASN1UINT n; ASN1DynOctStr *elem; } FastStartResponse; typedef struct OOH323Regex { regex_t regex; int inuse; ast_mutex_t lock; } OOH323Regex; /** * This structure is used to maintain all information on an active call. * A list of these structures is maintained within the global endpoint * structure. */ typedef struct OOH323CallData { OOCTXT *pctxt; OOCTXT *msgctxt; pthread_t callThread; ast_cond_t gkWait; ast_mutex_t Lock; OOBOOL Monitor; OOBOOL fsSent; OOSOCKET CmdChan; OOSOCKET cmdSock; ast_mutex_t* CmdChanLock; char callToken[20]; /* ex: ooh323c_call_1 */ char callType[10]; /* incoming/outgoing */ OOCallMode callMode; int transfercap; ASN1USINT callReference; char ourCallerId[256]; H225CallIdentifier callIdentifier;/* The call identifier for the active call. */ char *callingPartyNumber; char *calledPartyNumber; H225ConferenceIdentifier confIdentifier; ASN1UINT flags; OOCallState callState; OOCallClearReason callEndReason; int q931cause; unsigned h245ConnectionAttempts; OOH245SessionState h245SessionState; int dtmfmode; int dtmfcodec; OOMediaInfo *mediaInfo; OOCallFwdData *pCallFwdData; char localIP[20];/* Local IP address */ OOH323Channel* pH225Channel; OOH323Channel* pH245Channel; OOSOCKET *h245listener; int *h245listenport; char remoteIP[20];/* Remote IP address */ int remotePort; int remoteH245Port; char *remoteDisplayName; struct OOAliases *remoteAliases; struct OOAliases *ourAliases; /*aliases used in the call for us */ OOMasterSlaveState masterSlaveState; /*!< Master-Slave state */ OOMSAckStatus msAckStatus; /* Master-Slave ack's status */ ASN1UINT statusDeterminationNumber; OOCapExchangeState localTermCapState; OOCapExchangeState remoteTermCapState; struct ooH323EpCapability* ourCaps; struct ooH323EpCapability* remoteCaps; /* TODO: once we start using jointCaps, get rid of remoteCaps*/ struct ooH323EpCapability* jointCaps; int jointDtmfMode; DList remoteFastStartOLCs; ASN1UINT8 remoteTermCapSeqNo; ASN1UINT8 localTermCapSeqNo; OOCapPrefs capPrefs; OOLogicalChannel* logicalChans; int noOfLogicalChannels; int logicalChanNoBase; int logicalChanNoMax; int logicalChanNoCur; unsigned nextSessionID; /* Note by default 1 is audio session, 2 is video and 3 is data, from 3 onwards master decides*/ DList timerList; ASN1UINT msdRetries; ASN1UINT8 requestSequence; ASN1UINT reqFlags; ASN1UINT t38sides; H235TimeStamp alertingTime, connectTime, endTime; /* time data for gatekeeper */ FastStartResponse *pFastStartRes; /* fast start response */ struct OOH323Regex* rtpMask; char rtpMaskStr[120]; char lastDTMF; ASN1UINT nextDTMFstamp; int rtdrInterval, rtdrCount; /* roundTripDelay interval and unreplied count */ ASN1UINT rtdrSend, rtdrRecv; /* last sended/replied RTD request */ void *usrData; /*!