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: 21748 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-12-10 02:13:21 +0000 (Wed, 10 Dec 2008) $
00032  */
00033 
00034 #ifndef OPAL_OPAL_H
00035 #define OPAL_OPAL_H
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00058 #ifdef _WIN32
00059   #define OPAL_EXPORT __stdcall
00060 #else
00061   #define OPAL_EXPORT
00062 #endif
00063 
00064 typedef struct OpalHandleStruct * OpalHandle;
00065 
00066 typedef struct OpalMessage OpalMessage;
00067 
00068 
00069 #define OPAL_C_API_VERSION 14
00070 
00071 
00073 
00122 OpalHandle OPAL_EXPORT OpalInitialise(unsigned * version, const char * options);
00123 
00127 #define OPAL_INITIALISE_FUNCTION   "OpalInitialise"
00128 
00132 typedef OpalHandle (OPAL_EXPORT *OpalInitialiseFunction)(unsigned * version, const char * options);
00133 
00134 
00136 
00143 void OPAL_EXPORT OpalShutDown(OpalHandle opal);
00144 
00148 #define OPAL_SHUTDOWN_FUNCTION     "OpalShutDown"
00149 
00153 typedef void (OPAL_EXPORT *OpalShutDownFunction)(OpalHandle opal);
00154 
00155 
00157 
00192 OpalMessage * OPAL_EXPORT OpalGetMessage(OpalHandle opal, unsigned timeout);
00193 
00197 #define OPAL_GET_MESSAGE_FUNCTION  "OpalGetMessage"
00198 
00202 typedef OpalMessage * (OPAL_EXPORT *OpalGetMessageFunction)(OpalHandle opal, unsigned timeout);
00203 
00204 
00206 
00245 OpalMessage * OPAL_EXPORT OpalSendMessage(OpalHandle opal, const OpalMessage * message);
00246 
00250 typedef OpalMessage * (OPAL_EXPORT *OpalSendMessageFunction)(OpalHandle opal, const OpalMessage * message);
00251 
00255 #define OPAL_SEND_MESSAGE_FUNCTION "OpalSendMessage"
00256 
00257 
00259 
00263 void OPAL_EXPORT OpalFreeMessage(OpalMessage * message);
00264 
00268 #define OPAL_FREE_MESSAGE_FUNCTION "OpalFreeMessage"
00269 
00273 typedef void (OPAL_EXPORT *OpalFreeMessageFunction)(OpalMessage * message);
00274 
00275 
00277 
00278 #define OPAL_PREFIX_H323  "h323"
00279 #define OPAL_PREFIX_SIP   "sip"
00280 #define OPAL_PREFIX_IAX2  "iax2"
00281 #define OPAL_PREFIX_PCSS  "pc"
00282 #define OPAL_PREFIX_LOCAL "local"
00283 #define OPAL_PREFIX_POTS  "pots"
00284 #define OPAL_PREFIX_PSTN  "pstn"
00285 #define OPAL_PREFIX_IVR   "ivr"
00286 
00287 #define OPAL_PREFIX_ALL OPAL_PREFIX_H323  " " \
00288                         OPAL_PREFIX_SIP   " " \
00289                         OPAL_PREFIX_IAX2  " " \
00290                         OPAL_PREFIX_PCSS  " " \
00291                         OPAL_PREFIX_LOCAL " " \
00292                         OPAL_PREFIX_POTS  " " \
00293                         OPAL_PREFIX_PSTN  " " \
00294                         OPAL_PREFIX_IVR
00295 
00296 
00299 typedef enum OpalMessageType {
00300   OpalIndCommandError,          
00303   OpalCmdSetGeneralParameters,  
00305   OpalCmdSetProtocolParameters, 
00308   OpalCmdRegistration,          
00312   OpalIndRegistration,          
00317   OpalCmdSetUpCall,             
00321   OpalIndIncomingCall,          
00324   OpalCmdAnswerCall,            
00328   OpalCmdClearCall,             
00333   OpalIndAlerting,              
00337   OpalIndEstablished,           
00341   OpalIndUserInput,             
00344   OpalIndCallCleared,           
00347   OpalCmdHoldCall,              
00349   OpalCmdRetrieveCall,          
00351   OpalCmdTransferCall,          
00354   OpalCmdUserInput,             
00356   OpalIndMessageWaiting,        
00360   OpalIndMediaStream,           
00363   OpalCmdMediaStream,           
00365   OpalCmdSetUserData,           
00366   OpalIndLineAppearance,        
00370   OpalMessageTypeCount
00371 } OpalMessageType;
00372 
00373 
00377 typedef enum OpalSilenceDetectMode {
00378   OpalSilenceDetectNoChange,  
00379   OpalSilenceDetectDisabled,  
00380   OpalSilenceDetectFixed,     
00381   OpalSilenceDetectAdaptive   
00382 } OpalSilenceDetectMode;
00383 
00384 
00388 typedef enum OpalEchoCancelMode {
00389   OpalEchoCancelNoChange,   
00390   OpalEchoCancelDisabled,   
00391   OpalEchoCancelEnabled     
00392 } OpalEchoCancelMode;
00393 
00394 
00402 typedef int (*OpalMediaDataFunction)(
00403   const char * token,   
00405   const char * stream,  
00409   const char * format,  
00410   void * userData,      
00411   void * data,          
00412   int size              
00413 );
00414 
00415 
00432 typedef int (*OpalMessageAvailableFunction)(
00433   const OpalMessage * message  
00434 );
00435 
00436 
00440 typedef enum OpalMediaDataType {
00441   OpalMediaDataNoChange,      
00442   OpalMediaDataPayloadOnly,   
00444   OpalMediaDataWithHeader     
00446 } OpalMediaDataType;
00447 
00448 
00462 typedef struct OpalParamGeneral {
00463   const char * m_audioRecordDevice;   
00464   const char * m_audioPlayerDevice;   
00465   const char * m_videoInputDevice;    
00466   const char * m_videoOutputDevice;   
00467   const char * m_videoPreviewDevice;  
00468   const char * m_mediaOrder;          
00471   const char * m_mediaMask;           
00474   const char * m_autoRxMedia;         
00476   const char * m_autoTxMedia;         
00478   const char * m_natRouter;           
00480   const char * m_stunServer;          
00482   unsigned     m_tcpPortBase;         
00484   unsigned     m_tcpPortMax;          
00486   unsigned     m_udpPortBase;         
00488   unsigned     m_udpPortMax;          
00490   unsigned     m_rtpPortBase;         
00492   unsigned     m_rtpPortMax;          
00494   unsigned     m_rtpTypeOfService;    
00496   unsigned     m_rtpMaxPayloadSize;   
00498   unsigned     m_minAudioJitter;      
00502   unsigned     m_maxAudioJitter;      
00506   OpalSilenceDetectMode m_silenceDetectMode; 
00509   unsigned     m_silenceThreshold;    
00511   unsigned     m_signalDeadband;      
00513   unsigned     m_silenceDeadband;     
00515   unsigned     m_silenceAdaptPeriod;  
00518   OpalEchoCancelMode m_echoCancellation; 
00520   unsigned     m_audioBuffers;        
00521   OpalMediaDataFunction m_mediaReadData;   
00523   OpalMediaDataFunction m_mediaWriteData;  
00525   OpalMediaDataType     m_mediaDataHeader; 
00528   OpalMessageAvailableFunction m_messageAvailable; 
00532   const char * m_mediaOptions;        
00539 } OpalParamGeneral;
00540 
00541 
00544 typedef struct OpalProductDescription {
00545   const char * m_vendor;              
00548   const char * m_name;                
00551   const char * m_version;             
00554   unsigned     m_t35CountryCode;      
00559   unsigned     m_t35Extension;        
00564   unsigned     m_manufacturerCode;    
00570 } OpalProductDescription;
00571 
00572 
00587 typedef struct OpalParamProtocol {
00588   const char * m_prefix;              
00591   const char * m_userName;            
00594   const char * m_displayName;         
00596   OpalProductDescription m_product;   
00597   const char * m_interfaceAddresses;  
00602 } OpalParamProtocol;
00603 
00604 
00605 #define OPAL_MWI_EVENT_PACKAGE             "message-summary"
00606 #define OPAL_LINE_APPEARANCE_EVENT_PACKAGE "dialog;sla;ma"
00607 
00641 typedef struct OpalParamRegistration {
00642   const char * m_protocol;      
00644   const char * m_identifier;    
00650   const char * m_hostName;      
00654   const char * m_authUserName;  
00655   const char * m_password;      
00656   const char * m_adminEntity;   
00659   unsigned     m_timeToLive;    
00661   unsigned     m_restoreTime;   
00664   const char * m_eventPackage;  
00672 } OpalParamRegistration;
00673 
00674 
00678 typedef enum OpalRegistrationStates {
00679   OpalRegisterSuccessful,   
00680   OpalRegisterRemoved,      
00684   OpalRegisterFailed,       
00686   OpalRegisterRetrying,     
00688   OpalRegisterRestored,     
00689 } OpalRegistrationStates;
00690 
00691 
00695 typedef struct OpalStatusRegistration {
00696   const char * m_protocol;    
00698   const char * m_serverName;  
00701   const char * m_error;       
00705   OpalRegistrationStates m_status; 
00706   OpalProductDescription m_product; 
00707 } OpalStatusRegistration;
00708 
00709 
00744 typedef struct OpalParamSetUpCall {
00745   const char * m_partyA;      
00759   const char * m_partyB;      
00771   const char * m_callToken;   
00776 } OpalParamSetUpCall;
00777 
00778 
00782 typedef struct OpalStatusIncomingCall {
00783   const char * m_callToken;         
00784   const char * m_localAddress;      
00785   const char * m_remoteAddress;     
00786   const char * m_remotePartyNumber; 
00787   const char * m_remoteDisplayName; 
00788   const char * m_calledAddress;     
00789   const char * m_calledPartyNumber; 
00790   OpalProductDescription m_product; 
00791 } OpalStatusIncomingCall;
00792 
00793 
00798 typedef enum OpalMediaStates {
00799   OpalMediaStateNoChange,   
00800   OpalMediaStateOpen,       
00802   OpalMediaStateClose,      
00804   OpalMediaStatePause,      
00806   OpalMediaStateResume      
00808 } OpalMediaStates;
00809 
00810 
00817 typedef struct OpalStatusMediaStream {
00818   const char    * m_callToken;   
00819   const char    * m_identifier;  
00822   const char    * m_type;        
00827   const char    * m_format;      
00831   OpalMediaStates m_state;       
00834 } OpalStatusMediaStream;
00835 
00836 
00839 typedef struct OpalParamSetUserData {
00840   const char    * m_callToken;   
00841   void *        m_userData;      
00842 } OpalParamSetUserData;
00843 
00844 
00850 typedef struct OpalStatusUserInput {
00851   const char * m_callToken;   
00852   const char * m_userInput;   
00853   unsigned     m_duration;    
00858 } OpalStatusUserInput;
00859 
00860 
00864 typedef struct OpalStatusMessageWaiting {
00865   const char * m_party;     
00866   const char * m_type;      
00867   const char * m_extraInfo; 
00870 } OpalStatusMessageWaiting;
00871 
00872 
00877 typedef enum OpalLineAppearanceStates {
00878   OpalLineIdle,       
00879   OpalLineTrying,     
00880   OpalLineProceeding, 
00881   OpalLineRinging,    
00882   OpalLineConnected,  
00883   OpalLineSubcribed,  
00884   OpalLineUnsubcribed 
00885 } OpalLineAppearanceStates;
00886 
00887 
00891 typedef struct OpalStatusLineAppearance {
00892   const char *             m_line;       
00893   OpalLineAppearanceStates m_state;      
00894   int                      m_appearance; 
00897   const char *             m_callId;     
00901   const char *             m_partyA;     
00902   const char *             m_partyB;     
00903 } OpalStatusLineAppearance;
00904 
00905 
00909 typedef struct OpalStatusCallCleared {
00910   const char * m_callToken;   
00911   const char * m_reason;      
00916 } OpalStatusCallCleared;
00917 
00918 
00923 typedef enum OpalCallEndReason {
00924   OpalCallEndedByLocalUser,         
00925   OpalCallEndedByNoAccept,          
00926   OpalCallEndedByAnswerDenied,      
00927   OpalCallEndedByRemoteUser,        
00928   OpalCallEndedByRefusal,           
00929   OpalCallEndedByNoAnswer,          
00930   OpalCallEndedByCallerAbort,       
00931   OpalCallEndedByTransportFail,     
00932   OpalCallEndedByConnectFail,       
00933   OpalCallEndedByGatekeeper,        
00934   OpalCallEndedByNoUser,            
00935   OpalCallEndedByNoBandwidth,       
00936   OpalCallEndedByCapabilityExchange,
00937   OpalCallEndedByCallForwarded,     
00938   OpalCallEndedBySecurityDenial,    
00939   OpalCallEndedByLocalBusy,         
00940   OpalCallEndedByLocalCongestion,   
00941   OpalCallEndedByRemoteBusy,        
00942   OpalCallEndedByRemoteCongestion,  
00943   OpalCallEndedByUnreachable,       
00944   OpalCallEndedByNoEndPoint,        
00945   OpalCallEndedByHostOffline,       
00946   OpalCallEndedByTemporaryFailure,  
00947   OpalCallEndedByQ931Cause,         
00948   OpalCallEndedByDurationLimit,     
00949   OpalCallEndedByInvalidConferenceID, 
00950   OpalCallEndedByNoDialTone,        
00951   OpalCallEndedByNoRingBackTone,    
00952   OpalCallEndedByOutOfService,      
00953   OpalCallEndedByAcceptingCallWaiting, 
00954   OpalCallEndedWithQ931Code = 0x100  
00955 } OpalCallEndReason;
00956 
00957 
00960 typedef struct OpalParamCallCleared {
00961   const char      * m_callToken;  
00962   OpalCallEndReason m_reason;     
00964 } OpalParamCallCleared;
00965 
00966 
00970 struct OpalMessage {
00971   OpalMessageType m_type;   
00972   union {
00973     const char *             m_commandError;       
00974     OpalParamGeneral         m_general;            
00975     OpalParamProtocol        m_protocol;           
00976     OpalParamRegistration    m_registrationInfo;   
00977     OpalStatusRegistration   m_registrationStatus; 
00978     OpalParamSetUpCall       m_callSetUp;          
00979     const char *             m_callToken;          
00980     OpalStatusIncomingCall   m_incomingCall;       
00981     OpalStatusUserInput      m_userInput;          
00982     OpalStatusMessageWaiting m_messageWaiting;     
00983     OpalStatusLineAppearance m_lineAppearance;     
00984     OpalStatusCallCleared    m_callCleared;        
00985     OpalParamCallCleared     m_clearCall;          
00986     OpalStatusMediaStream    m_mediaStream;        
00987     OpalParamSetUserData     m_setUserData;        
00988   } m_param;
00989 };
00990 
00991 
00992 #ifdef __cplusplus
00993 };
00994 #endif
00995 
00996 #endif // OPAL_OPAL_H
00997 
00998 

Generated on Mon Feb 23 02:01:38 2009 for OPAL by  doxygen 1.5.1