opal.h

Go to the documentation of this file.
00001 /*
00002  * opal.h
00003  *
00004  * "C" language interface for OPAL
00005  *
00006  * Open Phone Abstraction Library (OPAL)
00007  *
00008  * Copyright (c) 2008 Vox Lucida
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Open Phone Abstraction Library.
00021  *
00022  * The Initial Developer of the Original Code is Vox Lucida (Robert Jongbloed)
00023  *
00024  * This code was initially written with the assisance of funding from
00025  * Stonevoice. http://www.stonevoice.com.
00026  *
00027  * Contributor(s): ______________________________________.
00028  *
00029  * $Revision: 20142 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-04-30 01:46:14 +0000 (Wed, 30 Apr 2008) $
00032  */
00033 
00034 #ifndef __OPAL_H
00035 #define __OPAL_H
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00047 #ifdef _WIN32
00048   #define OPAL_EXPORT __stdcall
00049 #else
00050   #define OPAL_EXPORT
00051 #endif
00052 
00053 typedef struct OpalHandleStruct * OpalHandle;
00054 
00055 typedef struct OpalMessage OpalMessage;
00056 
00057 
00058 #define OPAL_C_API_VERSION 2
00059 
00060 
00062 
00089 OpalHandle OPAL_EXPORT OpalInitialise(unsigned * version, const char * options);
00090 
00094 #define OPAL_INITIALISE_FUNCTION   "OpalInitialise"
00095 
00099 typedef OpalHandle (OPAL_EXPORT *OpalInitialiseFunction)(unsigned * version, const char * options);
00100 
00101 
00103 
00107 void OPAL_EXPORT OpalShutDown(OpalHandle opal);
00108 
00112 #define OPAL_SHUTDOWN_FUNCTION     "OpalShutDown"
00113 
00117 typedef void (OPAL_EXPORT *OpalShutDownFunction)(OpalHandle opal);
00118 
00119 
00121 
00132 OpalMessage * OPAL_EXPORT OpalGetMessage(OpalHandle opal, unsigned timeout);
00133 
00137 #define OPAL_GET_MESSAGE_FUNCTION  "OpalGetMessage"
00138 
00142 typedef OpalMessage * (OPAL_EXPORT *OpalGetMessageFunction)(OpalHandle opal, unsigned timeout);
00143 
00144 
00146 
00169 OpalMessage * OPAL_EXPORT OpalSendMessage(OpalHandle opal, const OpalMessage * message);
00170 
00174 typedef OpalMessage * (OPAL_EXPORT *OpalSendMessageFunction)(OpalHandle opal, const OpalMessage * message);
00175 
00179 #define OPAL_SEND_MESSAGE_FUNCTION "OpalSendMessage"
00180 
00181 
00183 
00187 void OPAL_EXPORT OpalFreeMessage(OpalMessage * message);
00188 
00192 #define OPAL_FREE_MESSAGE_FUNCTION "OpalFreeMessage"
00193 
00197 typedef void (OPAL_EXPORT *OpalFreeMessageFunction)(OpalMessage * message);
00198 
00199 
00201 
00202 #define OPAL_PREFIX_PC   "pc"
00203 #define OPAL_PREFIX_H323 "h323"
00204 #define OPAL_PREFIX_SIP  "sip"
00205 #define OPAL_PREFIX_IAX2 "iax2"
00206 #define OPAL_PREFIX_POTS "pots"
00207 #define OPAL_PREFIX_PSTN "pstn"
00208 #define OPAL_PREFIX_IVR  "ivr"
00209 
00210 #define OPAL_PREFIX_ALL OPAL_PREFIX_PCSS " " \
00211                         OPAL_PREFIX_H323 " " \
00212                         OPAL_PREFIX_SIP  " " \
00213                         OPAL_PREFIX_IAX2 " " \
00214                         OPAL_PREFIX_POTS " " \
00215                         OPAL_PREFIX_PSTN " " \
00216                         OPAL_PREFIX_IVR
00217 
00218 
00221 typedef enum OpalMessageType {
00222   OpalIndCommandError,          
00225   OpalCmdSetGeneralParameters,  
00227   OpalCmdSetProtocolParameters, 
00230   OpalCmdRegistration,          
00234   OpalIndRegistration,          
00239   OpalCmdSetUpCall,             
00243   OpalIndIncomingCall,          
00246   OpalCmdAnswerCall,            
00250   OpalCmdClearCall,             
00256   OpalIndAlerting,              
00260   OpalIndEstablished,           
00264   OpalIndUserInput,             
00267   OpalIndCallCleared,           
00270   OpalCmdHoldCall,              
00272   OpalCmdRetrieveCall,          
00274   OpalCmdTransferCall,          
00277   OpalMessageTypeCount
00278 } OpalMessageType;
00279 
00280 
00284 typedef struct OpalParamGeneral {
00285   const char * m_audioRecordDevice;   
00286   const char * m_audioPlayerDevice;   
00287   const char * m_videoInputDevice;    
00288   const char * m_videoOutputDevice;   
00289   const char * m_videoPreviewDevice;  
00290   const char * m_mediaOrder;          
00293   const char * m_mediaMask;           
00296   const char * m_autoRxMedia;         
00298   const char * m_autoTxMedia;         
00300   const char * m_natRouter;           
00302   const char * m_stunServer;          
00304   WORD         m_tcpPortBase;         
00306   WORD         m_tcpPortMax;          
00308   WORD         m_udpPortBase;         
00310   WORD         m_udpPortMax;          
00312   WORD         m_rtpPortBase;         
00314   WORD         m_rtpPortMax;          
00316   unsigned     m_rtpTypeOfService;    
00318   unsigned     m_rtpMaxPayloadSize;   
00320   unsigned     m_minAudioJitter;      
00324   unsigned     m_maxAudioJitter;      
00328   unsigned     m_silenceDetectMode;   
00331   unsigned     m_silenceThreshold;    
00333   unsigned     m_signalDeadband;      
00335   unsigned     m_silenceDeadband;     
00337   unsigned     m_silenceAdaptPeriod;  
00340   unsigned     m_echoCancellation;    
00343 } OpalParamGeneral;
00344 
00345 
00349 typedef struct OpalParamProtocol {
00350   const char * m_prefix;              
00353   const char * m_userName;            
00356   const char * m_displayName;         
00358   const char * m_vendor;              
00361   const char * m_name;                
00364   const char * m_version;             
00367   BYTE         m_t35CountryCode;      
00372   BYTE         m_t35Extension;        
00377   WORD         m_manufacturerCode;    
00383   const char * m_interfaceAddresses;  
00388 } OpalParamProtocol;
00389 
00390 
00394 typedef struct OpalParamRegistration {
00395   const char * m_protocol;      
00397   const char * m_identifier;    
00403   const char * m_hostName;      
00406   const char * m_authUserName;  
00407   const char * m_password;      
00408   const char * m_adminEntity;   
00411   unsigned     m_timeToLive;    
00412 } OpalParamRegistration;
00413 
00414 
00418 typedef struct OpalStatusRegistration {
00419   const char * m_protocol;    
00421   const char * m_serverName;  
00424   const char * m_error;       
00428 } OpalStatusRegistration;
00429 
00430 
00443 typedef struct OpalParamSetUpCall {
00444   const char * m_partyA;      
00458   const char * m_partyB;      
00465   const char * m_callToken;   
00470 } OpalParamSetUpCall;
00471 
00472 
00476 typedef struct OpalStatusIncomingCall {
00477   const char * m_callToken;     
00478   const char * m_localAddress;  
00479   const char * m_remoteAddress; 
00480 } OpalStatusIncomingCall;
00481 
00482 
00486 typedef struct OpalStatusUserInput {
00487   const char * m_callToken;   
00488   const char * m_userInput;   
00489   unsigned     m_duration;    
00492 } OpalStatusUserInput;
00493 
00494 
00498 typedef struct OpalStatusCallCleared {
00499   const char * m_callToken;   
00500   const char * m_reason;      
00501 } OpalStatusCallCleared;
00502 
00503 
00507 typedef struct OpalMessage {
00508   OpalMessageType m_type;   
00509   union {
00510     const char *           m_commandError;       
00511     OpalParamGeneral       m_general;            
00512     OpalParamProtocol      m_protocol;           
00513     OpalParamRegistration  m_registrationInfo;   
00514     OpalStatusRegistration m_registrationStatus; 
00515     OpalParamSetUpCall     m_callSetUp;          
00516     const char *           m_callToken;          
00517     OpalStatusIncomingCall m_incomingCall;       
00518     OpalStatusUserInput    m_userInput;          
00519     OpalStatusCallCleared  m_callCleared;        
00520   } m_param;
00521 } OpalMessage;
00522 
00523 
00524 #ifdef __cplusplus
00525 };
00526 #endif
00527 
00528 #endif // __OPAL_H
00529 
00530 

Generated on Wed May 7 00:56:02 2008 for OPAL by  doxygen 1.5.1