📄 sipxtapi.h
字号:
parameters */} SIPX_CONTACT_TYPE ;/** * Type for storing a "window object handle" - in Windows, * the application should cast their HWND to a SIPX_WINDOW_HANDLE. */typedef void* SIPX_WINDOW_HANDLE;/** * Enum for specifying the type of display object * to be used for displaying video */typedef enum SIPX_VIDEO_DISPLAY_TYPE{ SIPX_WINDOW_HANDLE_TYPE, /**< A handle to the window for the remote video display */ DIRECT_SHOW_FILTER /**< A DirectShow render filter object for handling the remote video display */} SIPX_VIDEO_DISPLAY_TYPE;struct SIPX_VIDEO_DISPLAY{ SIPX_VIDEO_DISPLAY() { cbSize = sizeof(SIPX_VIDEO_DISPLAY); type = SIPX_WINDOW_HANDLE_TYPE; handle = NULL; } SIPX_VIDEO_DISPLAY(const SIPX_VIDEO_DISPLAY& ref) { this->cbSize = ref.cbSize; this->type = ref.type; this->handle = ref.handle; } int cbSize; SIPX_VIDEO_DISPLAY_TYPE type; union { SIPX_WINDOW_HANDLE handle; IBaseFilter* filter; };};/** Type for storing Contact Record identifiers */typedef int SIPX_CONTACT_ID; /** * The CONTACT_ADDRESS structure includes contact information (ip and port), * address source type, and interface. */struct SIPX_CONTACT_ADDRESS{ /** * Default constructor for a SIPX_CONTACT_ADDRESS. */ SIPX_CONTACT_ADDRESS() { memset((void*)cInterface, 0, sizeof(cInterface)); memset((void*)cIpAddress, 0, sizeof(cIpAddress)); eContactType = CONTACT_AUTO; id = 0; iPort = -1; } /** * Copy constructor for SIPX_CONTACT_ADDRESS (deep copy) */ SIPX_CONTACT_ADDRESS(const SIPX_CONTACT_ADDRESS& ref) { strcpy(cInterface, ref.cInterface); strcpy(cIpAddress, ref.cIpAddress); eContactType = ref.eContactType; id = ref.id; iPort = ref.iPort; } /** * Assignment operator for SIPX_CONTACT_ADDRESS (deep copy). */ SIPX_CONTACT_ADDRESS& operator=(const SIPX_CONTACT_ADDRESS& ref) { // check for assignment to self if (this == &ref) return *this; strcpy(this->cInterface, ref.cInterface); strcpy(this->cIpAddress, ref.cIpAddress); this->eContactType = ref.eContactType; this->id = ref.id; this->iPort = ref.iPort; return *this; } SIPX_CONTACT_ID id; /**< Contact record Id */ SIPX_CONTACT_TYPE eContactType ; /**< Address type/source */ char cInterface[32] ; /**< Source interface */ char cIpAddress[32] ; /**< IP Address */ int iPort ; /**< Port */};/** * The SIPX_AUDIO_CODEC structure includes codec name and bandwidth info. */typedef struct {#define SIPXTAPI_CODEC_NAMELEN 32 /**< Maximum length for codec name */ char cName[SIPXTAPI_CODEC_NAMELEN]; /**< Codec name */ SIPX_AUDIO_BANDWIDTH_ID iBandWidth; /**< Bandwidth requirement */ int iPayloadType; /**< Payload type */} SIPX_AUDIO_CODEC ;/** * The SIPX_VIDEO_CODEC structure includes codec name and bandwidth info. */typedef struct {#define SIPXTAPI_CODEC_NAMELEN 32 /**< Maximum length for codec name */ char cName[SIPXTAPI_CODEC_NAMELEN]; /**< Codec name */ SIPX_VIDEO_BANDWIDTH_ID iBandWidth; /**< Bandwidth requirement */ int iPayloadType; /**< Payload type */} SIPX_VIDEO_CODEC ;/*** In a CALLSTATE_AUDIO_EVENT the SIPX_CODEC_INFO structure is being passed up * to the event handler and contains information about the negotiated audio* and video codec.*/typedef struct{ SIPX_AUDIO_CODEC audioCodec; /**< Audio codec */ SIPX_VIDEO_CODEC videoCodec; /**< Video codec */} SIPX_CODEC_INFO;/** * The SIPX_INST handle represents an instance of a user agent. A user agent * includes a SIP stack and media processing framework. sipXtapi does support * multiple instances of user agents in the same process space, however, * certain media processing features become limited or ambiguous. For * example, only one user agent should control the local system's input and * output audio devices. */typedef void* SIPX_INST ; const SIPX_INST SIPX_INST_NULL = 0; /**< Represents a null instance handle *//** * The SIPX_LINE handle represents an inbound or outbound identity. When * placing outbound the application programmer must define the outbound * line. When receiving inbound calls, the application can query the * line. */typedef unsigned int SIPX_LINE ;const SIPX_LINE SIPX_LINE_NULL = 0; /**< Represents a null line handle *//** * The SIPX_CALL handle represents a call or connection between the user * agent and another party. All call operations require the call handle * as a parameter. */typedef unsigned int SIPX_CALL ;const SIPX_CALL SIPX_CALL_NULL = 0; /**< Represents a null call handle *//** * The SIPX_CONF handle represents a collection of CALLs that have bridge * (mixed) audio. Application developers can manipulate each leg of the * conference through various conference functions. */typedef unsigned int SIPX_CONF ;const SIPX_CONF SIPX_CONF_NULL = 0; /**< Represents a null conference handle *//** * The SIPX_INFO handle represents a handle to an INFO message sent by * a sipXtapi instance. INFO messages are useful for communicating * information between user agents within a logical call. The SIPX_INFO * handle is returned when sending an INFO message via * sipxCallSendInfo(...). The handle is references as part of the * EVENT_CATEGORY_INFO_STATUS event callback/observer. sipXtapi will * automatically deallocate this handle immediately after the status * call back. */typedef unsigned int SIPX_INFO;/** * A publisher handle. Refers to a publishing context. * SIPX_PUB handles are created by using sipxCreatePublisher. * SIPX_PUB handles should be torn down using sipxDestroyPublisher. */typedef unsigned int SIPX_PUB;const SIPX_PUB SIPX_PUB_NULL = 0; /**< Represents a null publisher handle *//** * A subscription handle which refers to a notification subscription * associated with a call. * SIPX_SUB handles are created by using the sipxCallSubscribe function. * SIPX_SUB handles should be destroyed using the sipxCallUnsubscribe function. */typedef unsigned int SIPX_SUB ;/** * A handle referring to an SIP NOTIFY message. */typedef unsigned int SIPX_NOTIFY ;/** * Typedef for audio source (microphone) hook procedure. This typedef * coupled with the sipxConfigSetMicAudioHook API allows developers to * view, modify or substitute microphone data. * * @param nSamples number of 16 bit unsigned PCM samples * @param pSamples pointer to array of samples. */typedef void (*fnMicAudioHook)(const int nSamples, short* pSamples) ;/** * Typedef for audio target(speaker) hook procedure. This typedef * coupled with the sipxConfigSetSpkrAudioHook API allows developers to * intercept and modify audio headed for the speaker. * * @param nSamples number of 16 bit unsigned samples * @param pSamples pointer to array of samples */typedef void (*fnSpkrAudioHook)(const int nSamples, short* pSamples) ;/* ============================ FUNCTIONS ================================= *//** @name Initialization *///@{/** * Initialize the sipX tapi-like API layer. This method initialized the * basic SIP stack and media process resources and must be called before * any other sipxXXX methods. Additionally, this method fills in a * SIPX_INST parameter which must be passed to a number of sipX methods. * * @param phInst A pointer to a hInst that must be various other * sipx routines. * @param udpPort The default UDP port for the SIP protocol stack. The * port cannot be changed after initialization. Right now, * the UDP port and TCP port numbers MUST be equal. Pass a value of * SIPX_PORT_DISABLE (-1) to disable disable UDP or a value of * SIPX_PORT_AUTO (-2) to automatically select an open UDP port. * @param tcpPort The default TCP port for the SIP protocol stack. The * port cannot be changed after initialization. Right now, * the UDP port and TCP port numbers MUST be equal. Pass a value of * SIPX_PORT_DISABLE (-1) to disable disable TCP or a value of * SIPX_PORT_AUTO (-2) to automatically select an open TCP port. * @param tlsPort **NOT YET SUPPORTED** * @param rtpPortStart The starting port for inbound RTP traffic. The * sipX layer will use ports starting at rtpPortStart and ending * at (rtpPortStart + 2 * maxConnections) - 1. Pass a value of * SIPX_PORT_AUTO (-2) to automatically select an open port. * @param maxConnections The maximum number of simultaneous connections * that the sipX layer will support. * @param szIdentity The default outbound identity used by the SIP stack * if no line appears are defined. * @param szBindToAddr Defines which IP/address the user agent / rtp * stack will listen on. The default "0.0.0.0" listens on all * interfaces. The address must be in dotted decimal form -- * hostnames will not work. * @param bUseSequentialPorts If unable to bind to the udpPort, tcpPort, * or tlsPort, try sequential ports until a successful port is * found. If enabled, sipXtapi will try 10 sequential port * numbers after the initial port. */SIPXTAPI_API SIPX_RESULT sipxInitialize(SIPX_INST* phInst, const int udpPort = DEFAULT_UDP_PORT, const int tcpPort = DEFAULT_TCP_PORT, const int tlsPort = DEFAULT_TLS_PORT, const int rtpPortStart = DEFAULT_RTP_START_PORT, const int maxConnections = DEFAULT_CONNECTIONS, const char* szIdentity = DEFAULT_IDENTITY, const char* szBindToAddr = DEFAULT_BIND_ADDRESS, bool bUseSequentialPorts = false) ;/** * Un-initialize the sipX tapi-like API layer. This method tears down the * basic SIP stack and media process resources and should be called before * exiting the process. Users are responsible for ending all calls and * unregistering line appearances before calling sipxUnInitialize. Failing * to end calls/conferences or remove lines will result in a * SIPX_RESULT_BUSY return code. * * @param hInst An instance handle obtained from sipxInitialize. */SIPXTAPI_API SIPX_RESULT sipxUnInitialize(SIPX_INST hInst);//@}/** @name Call Methods *///@{/** * Accepts an inbound call and proceed immediately to alerting. This method * is invoked in response to a NEWCALL event. Whenever a new call is received, * the application developer should ACCEPT (proceed to ringing), REJECT (send * back busy), or REDIRECT the call. * * @param hCall Handle to a call. Call handles are obtained either by * invoking sipxCallCreate or passed to your application through * a listener interface. * @param pDislay Pointer to an object describing the display object for * rendering remote video. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -