#include <stddef.h>
#include <assert.h>
#include "tapi/sipXtapiEvents.h"
#include "tapi/sipXtapiInternal.h"
#include "tapi/SipXHandleMap.h"
#include "tapi/SipXEventDispatcher.h"
#include "utl/UtlSList.h"
#include "utl/UtlSListIterator.h"
#include "utl/UtlVoidPtr.h"
#include "os/OsMutex.h"
#include "utl/UtlString.h"
#include "os/OsLock.h"
#include "net/Url.h"
#include "utl/UtlHashMap.h"
#include "net/SipSession.h"
#include "cp/CallManager.h"
Macros | |
#define | SNPRINTF snprintf |
#define | SAFE_STRDUP(X) (((X) == NULL) ? NULL : strdup((X))) |
Functions | |
const char * | convertSubscriptionStateToString (SIPX_SUBSCRIPTION_STATE state) |
const char * | convertSubscriptionCauseToString (SIPX_SUBSCRIPTION_CAUSE cause) |
SIPXTAPI_API SIPX_RESULT | sipxDuplicateEvent (SIPX_EVENT_CATEGORY category, const void *pEventSource, void **pEventCopy) |
Duplicate the event information for a sipXtapi event. More... | |
SIPXTAPI_API SIPX_RESULT | sipxFreeDuplicatedEvent (SIPX_EVENT_CATEGORY category, void *pEventCopy) |
Frees up memory allocated as part of sipxDuplicateEvent. More... | |
SIPXTAPI_API char * | sipxCallEventToString (SIPX_CALLSTATE_EVENT event, SIPX_CALLSTATE_CAUSE cause, char *szBuffer, size_t nBuffer) |
Create a printable string version of the designated call state event ids. More... | |
SIPXTAPI_API char * | sipxLineEventToString (SIPX_LINESTATE_EVENT event, SIPX_LINESTATE_CAUSE cause, char *szBuffer, size_t nBuffer) |
Create a printable string version of the designated line event ids. More... | |
SIPXTAPI_API char * | sipxEventToString (const SIPX_EVENT_CATEGORY category, const void *pEvent, char *szBuffer, size_t nBuffer) |
Create a printable string version of the designated event. More... | |
void | ReportCallback (SIPX_CALL hCall, SIPX_LINE hLine, SIPX_CALLSTATE_EVENT event, SIPX_CALLSTATE_CAUSE cause, void *pUserData) |
void | sipxFireCallEvent (const void *pSrc, const char *szCallId, SipSession *pSession, const char *szRemoteAddress, SIPX_CALLSTATE_EVENT event, SIPX_CALLSTATE_CAUSE cause, void *pEventData, const char *szRemoteAssertedIdentity) |
Fire events to interested listeners (call events only). More... | |
void | sipxFireMediaEvent (const void *pSrc, const char *szCallId, const char *szRemoteAddress, SIPX_MEDIA_EVENT event, SIPX_MEDIA_CAUSE cause, SIPX_MEDIA_TYPE type, void *pEventData) |
Fires events to interested listener (media events only) More... | |
void | sipxFireKeepaliveEvent (const void *pSrc, SIPX_KEEPALIVE_EVENT event, SIPX_KEEPALIVE_CAUSE cause, SIPX_KEEPALIVE_TYPE type, const char *szRemoteAddress, int remotePort, int keepAliveSecs, const char *szFeedbackAddress, int feedbackPort) |
Fires events to interested listener (keepalive events only) More... | |
SIPXTAPI_API SIPX_RESULT | sipxEventListenerAdd (const SIPX_INST hInst, SIPX_EVENT_CALLBACK_PROC pCallbackProc, void *pUserData) |
Add a callback/observer for the purpose of receiving sipXtapi events. More... | |
SIPXTAPI_API SIPX_RESULT | sipxEventListenerRemove (const SIPX_INST hInst, SIPX_EVENT_CALLBACK_PROC pCallbackProc, void *pUserData) |
Remove a sipXtapi event callback/observer. More... | |
SIPX_RESULT | __sipxEventListenerAdd (const SIPX_INST hInst, SIPX_EVENT_CALLBACK_PROC pCallbackProc, void *pUserData) |
SIPX_RESULT | __sipxEventListenerRemove (const SIPX_INST hInst, SIPX_EVENT_CALLBACK_PROC pCallbackProc, void *pUserData) |
void | sipxUpdateListeners (SIPX_INST hOldInst, SIPX_INST hNewInst) |
SIPXTAPI_API char * | sipxConfigEventToString (SIPX_CONFIG_EVENT event, char *szBuffer, size_t nBuffer) |
Create a printable string version of the designated config event. More... | |
SIPXTAPI_API char * | sipxMediaEventToString (SIPX_MEDIA_EVENT event, char *szBuffer, size_t nBuffer) |
Create a printable string version of the designated media event. More... | |
SIPXTAPI_API char * | sipxMediaCauseToString (SIPX_MEDIA_CAUSE cause, char *szBuffer, size_t nBuffer) |
Create a printable string version of the designated media cause. More... | |
SIPXTAPI_API char * | sipxKeepaliveEventToString (SIPX_KEEPALIVE_EVENT event, char *szBuffer, size_t nBuffer) |
Create a printable string version of the designated keepalive event. More... | |
SIPXTAPI_API char * | sipxKeepaliveCauseToString (SIPX_KEEPALIVE_CAUSE cause, char *szBuffer, size_t nBuffer) |
Create a printable string version of the designated keepalive cause. More... | |
SIPXTAPI_API char * | sipxSecurityEventToString (SIPX_SECURITY_EVENT event, char *szBuffer, size_t nBuffer) |
Create a printable string version of the designated security event. More... | |
SIPXTAPI_API char * | sipxSecurityCauseToString (SIPX_SECURITY_CAUSE cause, char *szBuffer, size_t nBuffer) |
Create a printable string version of the designated security cause. More... | |
SIPXTAPI_API char * | sipxSubStatusStateToString (const SIPX_SUBSCRIPTION_STATE state, char *szBuffer, size_t nBuffer) |
Create a printable string version of the designated subscription status state. More... | |
SIPXTAPI_API char * | sipxSubStatusCauseToString (const SIPX_SUBSCRIPTION_CAUSE cause, char *szBuffer, size_t nBuffer) |
Create a printable string version of the designated subscription status cause. More... | |
void | sipxFireLineEvent (const void *pSrc, const char *szLineIdentifier, SIPX_LINESTATE_EVENT event, SIPX_LINESTATE_CAUSE cause, const char *bodyBytes) |
Fires a Line Event to the listeners. More... | |
bool | sipxFireEvent (const void *pSrc, SIPX_EVENT_CATEGORY category, void *pInfo) |
Bubbles up all non-line and non-call events to the application layer. More... | |
Variables | |
UtlBoolean | g_bListenersEnabled = true |
UtlSList * | g_pEventListeners = new UtlSList() |
OsMutex * | g_pEventListenerLock = new OsMutex(OsMutex::Q_FIFO) |
SipXHandleMap * | gpCallHandleMap |
Global Map of call handles. More... | |
#define SAFE_STRDUP | ( | X | ) | (((X) == NULL) ? NULL : strdup((X))) |
#define SNPRINTF snprintf |
SIPX_RESULT __sipxEventListenerAdd | ( | const SIPX_INST | hInst, |
SIPX_EVENT_CALLBACK_PROC | pCallbackProc, | ||
void * | pUserData | ||
) |
SIPX_RESULT __sipxEventListenerRemove | ( | const SIPX_INST | hInst, |
SIPX_EVENT_CALLBACK_PROC | pCallbackProc, | ||
void * | pUserData | ||
) |
const char* convertSubscriptionCauseToString | ( | SIPX_SUBSCRIPTION_CAUSE | cause | ) |
const char* convertSubscriptionStateToString | ( | SIPX_SUBSCRIPTION_STATE | state | ) |
void ReportCallback | ( | SIPX_CALL | hCall, |
SIPX_LINE | hLine, | ||
SIPX_CALLSTATE_EVENT | event, | ||
SIPX_CALLSTATE_CAUSE | cause, | ||
void * | pUserData | ||
) |
SIPXTAPI_API char* sipxCallEventToString | ( | SIPX_CALLSTATE_EVENT | event, |
SIPX_CALLSTATE_CAUSE | cause, | ||
char * | szBuffer, | ||
size_t | nBuffer | ||
) |
Create a printable string version of the designated call state event ids.
This is generally used for debugging.
event | sipxtapi event code |
cause | sipxtapi cause event code |
szBuffer | buffer to store event string |
nBuffer | length of string buffer szBuffer |
SIPXTAPI_API char* sipxConfigEventToString | ( | SIPX_CONFIG_EVENT | event, |
char * | szBuffer, | ||
size_t | nBuffer | ||
) |
Create a printable string version of the designated config event.
This is generally used for debugging.
event | Configuration event id |
szBuffer | Buffer to store event string |
nBuffer | Length of string buffer szBuffer |
SIPXTAPI_API SIPX_RESULT sipxDuplicateEvent | ( | SIPX_EVENT_CATEGORY | category, |
const void * | pEventSource, | ||
void ** | pEventCopy | ||
) |
Duplicate the event information for a sipXtapi event.
This method is only needed if you wish to post the event information to another thread context. Once the event has been handled, you must call sipxFreeDuplicatedEvent on the copy to avoid memory leaks.
category | Category type supplied by the sipXtapi event callback. |
pEventSource | Source of event data supplied by the sipXtapi event callback. |
pEventCopy | New copy of the event data. This data must be freed by calling sipxFreeDuplicatedEvent. |
SIPXTAPI_API SIPX_RESULT sipxEventListenerAdd | ( | const SIPX_INST | hInst, |
SIPX_EVENT_CALLBACK_PROC | pCallbackProc, | ||
void * | pUserData | ||
) |
Add a callback/observer for the purpose of receiving sipXtapi events.
hInst | Instance pointer obtained by sipxInitialize. |
pCallbackProc | Function to receive sipx events |
pUserData | user data passed along with event data |
SIPXTAPI_API SIPX_RESULT sipxEventListenerRemove | ( | const SIPX_INST | hInst, |
SIPX_EVENT_CALLBACK_PROC | pCallbackProc, | ||
void * | pUserData | ||
) |
Remove a sipXtapi event callback/observer.
Supply the same pCallbackProc and pUserData values as sipxEventListenerAdd.
hInst | Instance pointer obtained by sipxInitialize. |
pCallbackProc | Function used to receive sipx events |
pUserData | user data specified as part of sipxListenerAdd |
SIPXTAPI_API char* sipxEventToString | ( | const SIPX_EVENT_CATEGORY | category, |
const void * | pEvent, | ||
char * | szBuffer, | ||
size_t | nBuffer | ||
) |
Create a printable string version of the designated event.
This is generally used for debugging.
category | Event category code |
pEvent | Pointer to the Event. |
szBuffer | buffer to store event string |
nBuffer | length of string buffer szBuffer |
void sipxFireCallEvent | ( | const void * | pSrc, |
const char * | szCallId, | ||
SipSession * | pSession, | ||
const char * | szRemoteAddress, | ||
SIPX_CALLSTATE_EVENT | event, | ||
SIPX_CALLSTATE_CAUSE | cause, | ||
void * | pEventData, | ||
const char * | szRemoteAssertedIdentity | ||
) |
Fire events to interested listeners (call events only).
bool sipxFireEvent | ( | const void * | pSrc, |
SIPX_EVENT_CATEGORY | category, | ||
void * | pInfo | ||
) |
Bubbles up all non-line and non-call events to the application layer.
void sipxFireKeepaliveEvent | ( | const void * | pSrc, |
SIPX_KEEPALIVE_EVENT | event, | ||
SIPX_KEEPALIVE_CAUSE | cause, | ||
SIPX_KEEPALIVE_TYPE | type, | ||
const char * | szRemoteAddress, | ||
int | remotePort, | ||
int | keepAliveSecs, | ||
const char * | szFeedbackAddress, | ||
int | feedbackPort | ||
) |
Fires events to interested listener (keepalive events only)
void sipxFireLineEvent | ( | const void * | pSrc, |
const char * | szLineIdentifier, | ||
SIPX_LINESTATE_EVENT | event, | ||
SIPX_LINESTATE_CAUSE | cause, | ||
const char * | bodyBytes | ||
) |
Fires a Line Event to the listeners.
void sipxFireMediaEvent | ( | const void * | pSrc, |
const char * | szCallId, | ||
const char * | szRemoteAddress, | ||
SIPX_MEDIA_EVENT | event, | ||
SIPX_MEDIA_CAUSE | cause, | ||
SIPX_MEDIA_TYPE | type, | ||
void * | pEventData | ||
) |
Fires events to interested listener (media events only)
SIPXTAPI_API SIPX_RESULT sipxFreeDuplicatedEvent | ( | SIPX_EVENT_CATEGORY | category, |
void * | pEventCopy | ||
) |
Frees up memory allocated as part of sipxDuplicateEvent.
Do not call this API on pointers received as part of the sipXtapi call back.
category | Category type supplied by the sipXtapi event callback. |
pEventCopy | Copy of event data supplied by sipxDuplicateEvent. |
SIPXTAPI_API char* sipxKeepaliveCauseToString | ( | SIPX_KEEPALIVE_CAUSE | cause, |
char * | szBuffer, | ||
size_t | nBuffer | ||
) |
Create a printable string version of the designated keepalive cause.
This is generally used for debugging.
cause | Keepalive cause id |
szBuffer | Buffer to store cause string |
nBuffer | Length of string buffer szBuffer |
SIPXTAPI_API char* sipxKeepaliveEventToString | ( | SIPX_KEEPALIVE_EVENT | event, |
char * | szBuffer, | ||
size_t | nBuffer | ||
) |
Create a printable string version of the designated keepalive event.
This is generally used for debugging.
event | Keepalive event id |
szBuffer | Buffer to store event string |
nBuffer | Length of string buffer szBuffer |
SIPXTAPI_API char* sipxLineEventToString | ( | SIPX_LINESTATE_EVENT | event, |
SIPX_LINESTATE_CAUSE | cause, | ||
char * | szBuffer, | ||
size_t | nBuffer | ||
) |
Create a printable string version of the designated line event ids.
This is generally used for debugging.
event | major event type id |
cause | event type id |
szBuffer | buffer to store event string |
nBuffer | length of string buffer szBuffer |
SIPXTAPI_API char* sipxMediaCauseToString | ( | SIPX_MEDIA_CAUSE | cause, |
char * | szBuffer, | ||
size_t | nBuffer | ||
) |
Create a printable string version of the designated media cause.
This is generally used for debugging.
cause | Media cause id |
szBuffer | Buffer to store cause string |
nBuffer | Length of string buffer szBuffer |
SIPXTAPI_API char* sipxMediaEventToString | ( | SIPX_MEDIA_EVENT | event, |
char * | szBuffer, | ||
size_t | nBuffer | ||
) |
Create a printable string version of the designated media event.
This is generally used for debugging.
event | Media event id |
szBuffer | Buffer to store event string |
nBuffer | Length of string buffer szBuffer |
SIPXTAPI_API char* sipxSecurityCauseToString | ( | SIPX_SECURITY_CAUSE | cause, |
char * | szBuffer, | ||
size_t | nBuffer | ||
) |
Create a printable string version of the designated security cause.
This is generally used for debugging.
cause | Security cause id |
szBuffer | Buffer to store cause string |
nBuffer | Length of string buffer szBuffer |
SIPXTAPI_API char* sipxSecurityEventToString | ( | SIPX_SECURITY_EVENT | event, |
char * | szBuffer, | ||
size_t | nBuffer | ||
) |
Create a printable string version of the designated security event.
This is generally used for debugging.
event | Security event id |
szBuffer | Buffer to store event string |
nBuffer | Length of string buffer szBuffer |
SIPXTAPI_API char* sipxSubStatusCauseToString | ( | SIPX_SUBSCRIPTION_CAUSE | cause, |
char * | szBuffer, | ||
size_t | nBuffer | ||
) |
Create a printable string version of the designated subscription status cause.
This is generally used for debugging.
cause | Subscription cause id |
szBuffer | Buffer to store event string |
nBuffer | Length of string buffer szBuffer |
SIPXTAPI_API char* sipxSubStatusStateToString | ( | SIPX_SUBSCRIPTION_STATE | state, |
char * | szBuffer, | ||
size_t | nBuffer | ||
) |
Create a printable string version of the designated subscription status state.
This is generally used for debugging.
state | Subscription state id |
szBuffer | Buffer to store event string |
nBuffer | Length of string buffer szBuffer |
UtlBoolean g_bListenersEnabled = true |
OsMutex* g_pEventListenerLock = new OsMutex(OsMutex::Q_FIFO) |
UtlSList* g_pEventListeners = new UtlSList() |
SipXHandleMap* gpCallHandleMap |
Global Map of call handles.