Objective Systems, Inc.  

ooCalls.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2009 by Objective Systems, Inc.
00003  *
00004  * This software is furnished under an open source license and may be
00005  * used and copied only in accordance with the terms of this license.
00006  * The text of the license may generally be found in the root
00007  * directory of this installation in the COPYING file.  It
00008  * can also be viewed online at the following URL:
00009  *
00010  *   http://www.obj-sys.com/open/license.html
00011  *
00012  * Any redistributions of this file including modified versions must
00013  * maintain this copyright notice.
00014  *
00015  *****************************************************************************/
00020 #ifndef _OOCALLS_H_
00021 #define _OOCALLS_H_
00022 
00023 #include "ooLogChan.h"
00024 #include "ooCapability.h"
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030 
00035 /* Flag mask values */
00036 /* DISABLEGK is used to selectively disable gatekeeper use. For incoming calls
00037    DISABLEGK can be set in onReceivedSetup callback by application.
00038    Very useful in pbx applications where gk is used only when call is
00039    to or from outside pbx domian. For outgoing calls, ooMakeCallNoGk
00040    disables use of gk for specific call.
00041 */
00042 
00043 #define OO_M_ENDSESSION_BUILT   ASN1UINTCNT(0x00800000)
00044 #define OO_M_RELEASE_BUILT      ASN1UINTCNT(0x00400000)
00045 #define OO_M_FASTSTARTANSWERED  ASN1UINTCNT(0x04000000)
00046 
00047 #define OO_M_ENDPOINTCREATED    ASN1UINTCNT(0x00010000)
00048 #define OO_M_GKROUTED           ASN1UINTCNT(0x00200000)
00049 #define OO_M_AUTOANSWER         ASN1UINTCNT(0x00100000)
00050 #define OO_M_TUNNELING          ASN1UINTCNT(0x08000000)
00051 #define OO_M_MEDIAWAITFORCONN   ASN1UINTCNT(0x20000000)
00052 #define OO_M_FASTSTART          ASN1UINTCNT(0x02000000)
00053 #define OO_M_DISABLEGK          ASN1UINTCNT(0x01000000)
00054 #define OO_M_MANUALRINGBACK     ASN1UINTCNT(0x10000000)
00055 
00056 
00060 typedef enum {
00061    OO_CALL_CREATED,               
00062    OO_CALL_WAITING_ADMISSION,     
00063    OO_CALL_CONNECTING,            
00064    OO_CALL_CONNECTED,             
00065    OO_CALL_PAUSED,                
00066    OO_CALL_CLEAR,                 
00067    OO_CALL_CLEAR_RELEASERECVD,    
00068    OO_CALL_CLEAR_RELEASESENT,     
00069    OO_CALL_CLEARED                
00070 } OOCallState;
00071 
00075 typedef enum {
00076    OO_H245SESSION_IDLE,
00077    OO_H245SESSION_PAUSED,
00078    OO_H245SESSION_ACTIVE,
00079    OO_H245SESSION_ENDSENT,
00080    OO_H245SESSION_ENDRECVD,
00081    OO_H245SESSION_CLOSED
00082 } OOH245SessionState;
00083 
00088 typedef struct OOMediaInfo{
00089    char   dir[15]; /* transmit/receive*/
00090    int   cap;
00091    int   lMediaPort;
00092    int   lMediaCntrlPort;
00093    char  lMediaIP[20];
00094    struct OOMediaInfo *next;
00095 } OOMediaInfo;
00096 
00097 #define ooMediaInfo OOMediaInfo
00098 
00099 struct OOAliases;
00100 
00104 typedef struct OOCallFwdData {
00105    char ip[20];
00106    int port;
00107    struct OOAliases *aliases;
00108    OOBOOL fwdedByRemote; /*Set when we are being fwded by remote*/
00109 } OOCallFwdData;
00110 
00115 typedef struct OOH323Channel {
00116    OOSOCKET sock;      
00117    int      port;      
00118    DList    outQueue;  
00119 } OOH323Channel;
00120 
00125 typedef struct EXTERN FastStartResponse {
00126    ASN1UINT n;
00127    ASN1DynOctStr *elem;
00128 } FastStartResponse;
00129 
00130 
00136 typedef struct OOH323CallData {
00137    OOCTXT               *pctxt;
00138    char                 callToken[20]; /* ex: ooh323c_call_1 */
00139    char                 callType[10]; /* incoming/outgoing */
00140    OOCallMode           callMode;
00141    ASN1USINT            callReference;
00142    char                 ourCallerId[256];
00143    H225CallIdentifier   callIdentifier;/* The call identifier for the active
00144                                           call. */
00145    char                 *callingPartyNumber;
00146    char                 *calledPartyNumber;
00147    H225ConferenceIdentifier confIdentifier;
00148    ASN1UINT             flags;
00149    OOCallState          callState;
00150    OOCallClearReason    callEndReason;
00151    unsigned             h245ConnectionAttempts;
00152    OOH245SessionState   h245SessionState;
00153    int                  dtmfmode;
00154    OOMediaInfo          *mediaInfo;
00155    OOCallFwdData        *pCallFwdData;
00156    char                 localIP[20];/* Local IP address */
00157    OOH323Channel*       pH225Channel;
00158    OOH323Channel*       pH245Channel;
00159    OOSOCKET             *h245listener;
00160    int                  *h245listenport;
00161    char                 remoteIP[20];/* Remote IP address */
00162    int                  remotePort;
00163    int                  remoteH245Port;
00164    char                 *remoteDisplayName;
00165    struct OOAliases     *remoteAliases;
00166    struct OOAliases     *ourAliases; /*aliases used in the call for us */
00167    OOMasterSlaveState   masterSlaveState;   
00168    ASN1UINT             statusDeterminationNumber;
00169    OOCapExchangeState   localTermCapState;
00170    OOCapExchangeState   remoteTermCapState;
00171    struct ooH323EpCapability* ourCaps;
00172    struct ooH323EpCapability* remoteCaps; /* TODO: once we start using jointCaps, get rid of remoteCaps*/
00173    struct ooH323EpCapability* jointCaps;
00174    int                  jointDtmfMode;
00175    DList                remoteFastStartOLCs;
00176    ASN1UINT8            remoteTermCapSeqNo;
00177    ASN1UINT8            localTermCapSeqNo;
00178    OOCapPrefs           capPrefs;
00179    OOLogicalChannel*    logicalChans;
00180    int                  noOfLogicalChannels;
00181    int                  logicalChanNoBase;
00182    int                  logicalChanNoMax;
00183    int                  logicalChanNoCur;
00184    unsigned             nextSessionID; /* Note by default 1 is audio session, 2 is video and 3 is data, from 3 onwards master decides*/
00185    DList                timerList;
00186    ASN1UINT             msdRetries;
00187    FastStartResponse    *pFastStartRes; /* fast start response */
00188    void                 *usrData; 
00189    struct OOH323CallData* next;
00190    struct OOH323CallData* prev;
00191 } OOH323CallData;
00192 
00193 #define ooCallData OOH323CallData
00194 
00202 typedef int (*cb_OnNewCallCreated)(OOH323CallData* call);
00203 
00212 typedef int (*cb_OnAlerting)(OOH323CallData * call);
00213 
00222 typedef int (*cb_OnIncomingCall)(OOH323CallData* call );
00223 
00231 typedef int (*cb_OnOutgoingCall)(OOH323CallData* call );
00232 
00243 typedef int (*cb_OnCallEstablished)(struct OOH323CallData* call);
00244 
00251 typedef int (*cb_OnCallCleared)(struct OOH323CallData* call);
00252 
00261 typedef int (*cb_OpenLogicalChannels)(struct OOH323CallData* call);
00262 
00269 typedef int (*cb_OnCallForwarded)(struct OOH323CallData* call);
00270 
00276 typedef int (*cb_OnReceivedDTMF)
00277    (struct OOH323CallData *call, const char *dtmf);
00278 
00284 typedef struct OOH323CALLBACKS {
00285    cb_OnAlerting onNewCallCreated;
00286    cb_OnAlerting onAlerting;
00287    cb_OnIncomingCall onIncomingCall;
00288    cb_OnOutgoingCall onOutgoingCall;
00289    cb_OnCallEstablished onCallEstablished;
00290    cb_OnCallForwarded onCallForwarded;
00291    cb_OnCallCleared onCallCleared;
00292    cb_OpenLogicalChannels openLogicalChannels;
00293    cb_OnReceivedDTMF onReceivedDTMF;
00294 } OOH323CALLBACKS;
00295 
00303 EXTERN OOH323CallData* ooCreateCall(char *type, char *callToken);
00304 
00310 EXTERN int ooAddCallToList (OOH323CallData *call);
00311 
00319 EXTERN int ooCallSetCallerId
00320 (OOH323CallData* call, const char* callerid);
00321 
00329 EXTERN int ooCallSetCallingPartyNumber
00330 (OOH323CallData *call, const char *number);
00331 
00340 EXTERN int ooCallGetCallingPartyNumber
00341 (OOH323CallData *call, char *buffer, int len);
00342 
00351 EXTERN int ooCallGetCalledPartyNumber
00352 (OOH323CallData *call, char *buffer, int len);
00353 
00361 EXTERN int ooCallSetCalledPartyNumber
00362 (OOH323CallData *call, const char *number);
00363 
00370 EXTERN int ooCallClearAliases(OOH323CallData *call);
00371 
00380 EXTERN int ooCallAddAliasH323ID(OOH323CallData *call, const char* h323id);
00381 
00390 EXTERN int ooCallAddAliasDialedDigits
00391                              (OOH323CallData *call, const char* dialedDigits);
00392 
00401 EXTERN int ooCallAddAliasEmailID(OOH323CallData *call, const char* email);
00402 
00403 
00412 EXTERN int ooCallAddAliasURLID(OOH323CallData *call, const char* url);
00413 
00414 
00426 int ooCallAddAlias
00427    (OOH323CallData *call, int aliasType, const char *value, OOBOOL local);
00428 
00429 
00438 EXTERN int ooCallAddRemoteAliasDialedDigits
00439    (OOH323CallData *call, const char* dialedDigits);
00440 
00449 EXTERN int ooCallAddRemoteAliasH323ID(OOH323CallData *call, const char* h323id);
00450 
00451 
00469 EXTERN int ooCallAddG7231Capability(OOH323CallData *call, int cap, int txframes,
00470                             int rxframes, OOBOOL silenceSuppression, int dir,
00471                             cb_StartReceiveChannel startReceiveChannel,
00472                             cb_StartTransmitChannel startTransmitChannel,
00473                             cb_StopReceiveChannel stopReceiveChannel,
00474                             cb_StopTransmitChannel stopTransmitChannel);
00475 
00492 EXTERN int ooCallAddG728Capability(OOH323CallData *call, int cap, int txframes,
00493                             int rxframes, int dir,
00494                             cb_StartReceiveChannel startReceiveChannel,
00495                             cb_StartTransmitChannel startTransmitChannel,
00496                             cb_StopReceiveChannel stopReceiveChannel,
00497                             cb_StopTransmitChannel stopTransmitChannel);
00498 
00515 EXTERN int ooCallAddG729Capability(OOH323CallData *call, int cap, int txframes,
00516                             int rxframes, int dir,
00517                             cb_StartReceiveChannel startReceiveChannel,
00518                             cb_StartTransmitChannel startTransmitChannel,
00519                             cb_StopReceiveChannel stopReceiveChannel,
00520                             cb_StopTransmitChannel stopTransmitChannel);
00521 
00538 EXTERN int ooCallAddG711Capability(OOH323CallData *call, int cap, int txframes,
00539                             int rxframes, int dir,
00540                             cb_StartReceiveChannel startReceiveChannel,
00541                             cb_StartTransmitChannel startTransmitChannel,
00542                             cb_StopReceiveChannel stopReceiveChannel,
00543                             cb_StopTransmitChannel stopTransmitChannel);
00544 
00545 
00563 EXTERN int ooCallAddGSMCapability(OOH323CallData* call, int cap,
00564                                   ASN1USINT framesPerPkt, OOBOOL comfortNoise,
00565                                   OOBOOL scrambled, int dir,
00566                                   cb_StartReceiveChannel startReceiveChannel,
00567                                   cb_StartTransmitChannel startTransmitChannel,
00568                                   cb_StopReceiveChannel stopReceiveChannel,
00569                                   cb_StopTransmitChannel stopTransmitChannel);
00570 
00571 
00572 
00573 
00601 EXTERN int ooCallAddH263VideoCapability(OOH323CallData *call, int cap,
00602                                  unsigned sqcifMPI, unsigned qcifMPI,
00603                                  unsigned cifMPI, unsigned cif4MPI,
00604                                  unsigned cif16MPI, unsigned maxBitRate,
00605                                  int dir,
00606                                  cb_StartReceiveChannel startReceiveChannel,
00607                                  cb_StartTransmitChannel startTransmitChannel,
00608                                  cb_StopReceiveChannel stopReceiveChannel,
00609                                  cb_StopTransmitChannel stopTransmitChannel);
00610 
00611 
00622 EXTERN int ooCallEnableDTMFRFC2833
00623           (OOH323CallData *call, int dynamicRTPPayloadType);
00624 
00625 
00635 EXTERN int ooCallDisableDTMFRFC2833(OOH323CallData *call);
00636 
00637 
00648 EXTERN int ooCallEnableDTMFH245Alphanumeric(OOH323CallData *call);
00649 
00660 EXTERN int ooCallDisableDTMFH245Alphanumeric(OOH323CallData *call);
00661 
00672 EXTERN int ooCallEnableDTMFH245Signal(OOH323CallData *call);
00673 
00674 
00685 EXTERN int ooCallDisableDTMFH245Signal(OOH323CallData *call);
00686 
00687 
00698 EXTERN int ooCallEnableDTMFQ931Keypad(OOH323CallData *call);
00699 
00710 EXTERN int ooCallDisableDTMFQ931Keypad(OOH323CallData *call);
00711 
00712 
00719 EXTERN OOH323CallData* ooFindCallByToken(char *callToken);
00720 
00728 EXTERN int ooEndCall(OOH323CallData *call);
00729 
00736 EXTERN int ooRemoveCallFromList (OOH323CallData *call);
00737 
00745 EXTERN int ooCleanCall(OOH323CallData *call);
00746 
00757 EXTERN ASN1BOOL ooIsSessionEstablished
00758 (OOH323CallData *call, int sessionID, char* dir);
00759 
00771 EXTERN int ooAddMediaInfo(OOH323CallData *call, OOMediaInfo mediaInfo);
00772 
00782 EXTERN unsigned ooCallGenerateSessionID
00783                     (OOH323CallData *call, OOCapType type, char *dir);
00784 
00793 EXTERN int ooCallH245ConnectionRetryTimerExpired(void *data);
00794 
00802 EXTERN const char* ooGetReasonCodeText (OOUINT32 code);
00803 
00811 EXTERN const char* ooGetCallStateText (OOCallState callState);
00812 
00817 #ifdef __cplusplus
00818 }
00819 #endif
00820 
00821 #endif

This file was last modified on 28 May 2010.
Objective Open H.323 Stack, 0.9.1