sipxtacklib  Version 3.3
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
SipUserAgent Class Reference

Transaction and Transport manager for SIP stack. More...

#include <SipUserAgent.h>

Inheritance diagram for SipUserAgent:
Inheritance graph
[legend]
Collaboration diagram for SipUserAgent:
Collaboration graph
[legend]

Public Types

enum  EventSubTypes {
  UNSPECIFIED = 0,
  SHUTDOWN_MESSAGE = 10,
  KEEPALIVE_MESSAGE
}
 

Public Member Functions

 SipUserAgent (int sipTcpPort=SIP_PORT, int sipUdpPort=SIP_PORT, int sipTlsPort=SIP_PORT+1, const char *publicAddress=NULL, const char *defaultUser=NULL, const char *defaultSipAddress=NULL, const char *sipProxyServers=NULL, const char *sipDirectoryServers=NULL, const char *sipRegistryServers=NULL, const char *authenticationScheme=NULL, const char *authenicateRealm=NULL, OsConfigDb *authenticateDb=NULL, OsConfigDb *authorizeUserIds=NULL, OsConfigDb *authorizePasswords=NULL, SipLineMgr *lineMgr=NULL, int sipFirstResendTimeout=SIP_DEFAULT_RTT, UtlBoolean defaultToUaTransactions=TRUE, int readBufferSize=-1, int queueSize=OsServerTask::DEF_MAX_MSGS, UtlBoolean bUseNextAvailablePort=FALSE, UtlString certNickname="", UtlString certPassword="", UtlString dbLocation=".", UtlBoolean doUaMessageChecks=TRUE)
 Constructor. More...
 
virtual ~SipUserAgent ()
 Destructor. More...
 
void shutdown (UtlBoolean blockingShutdown=TRUE)
 Cleanly shuts down SipUserAgent. More...
 
virtual void enableStun (const char *szStunServer, int iStunPort, int refreshPeriodInSecs, OsNotification *pNotification=NULL, const char *szIp=NULL)
 Enable stun lookups for UDP signaling. Use a NULL szStunServer to disable. More...
 
virtual UtlBoolean handleMessage (OsMsg &eventMessage)
 For internal use only. More...
 
virtual void addMessageConsumer (OsServerTask *messageConsumer)
 Deprecated (Add a SIP message recipient) More...
 
void addMessageObserver (OsMsgQ &messageQueue, const char *sipMethod=NULL, UtlBoolean wantRequests=TRUE, UtlBoolean wantResponses=TRUE, UtlBoolean wantIncoming=TRUE, UtlBoolean wantOutGoing=FALSE, const char *eventName=NULL, SipSession *pSession=NULL, void *observerData=NULL)
 Add a SIP message observer for receiving SIP messages meeting the given filter criteria. More...
 
UtlBoolean removeMessageObserver (OsMsgQ &messageQueue, void *pObserverData=NULL)
 Removes all SIP message observers for the given message/queue observer. More...
 
virtual UtlBoolean send (SipMessage &message, OsMsgQ *responseListener=NULL, void *responseListenerData=NULL, SIPX_TRANSPORT_DATA *pTransport=NULL)
 Send a SIP message over the net. More...
 
virtual void dispatch (SipMessage *message, int messageType=SipMessageEvent::APPLICATION, SIPX_TRANSPORT_DATA *pData=NULL)
 Dispatch the SIP message to the message consumer(s) More...
 
void allowMethod (const char *methodName, const bool bAllow=true)
 
void allowExtension (const char *extension)
 
void getSupportedExtensions (UtlString &extensionsString)
 
void setProxyServers (const char *sipProxyServers)
 Set the SIP proxy servers for the user agent. More...
 
UtlBoolean addCrLfKeepAlive (const char *szLocalIp, const char *szRemoteIp, const int remotePort, const int keepAliveSecs, OsNatKeepaliveListener *pListener)
 
UtlBoolean removeCrLfKeepAlive (const char *szLocalIp, const char *szRemoteIp, const int remotePort)
 
UtlBoolean addStunKeepAlive (const char *szLocalIp, const char *szRemoteIp, const int remotePort, const int keepAliveSecs, OsNatKeepaliveListener *pListener)
 
UtlBoolean removeStunKeepAlive (const char *szLocalIp, const char *szRemoteIp, const int remotePort)
 
OsTimer * getTimer ()
 
UtlBoolean addSipKeepAlive (const char *szLocalIp, const char *szRemoteIp, const int remotePort, const char *szMethod, const int keepAliveSecs, OsNatKeepaliveListener *pListener)
 
UtlBoolean removeSipKeepAlive (const char *szLocalIp, const char *szRemoteIp, const int remotePort, const char *szMethod)
 
UtlBoolean setUseRport (UtlBoolean bEnable)
 Enable or disable the outbound use of rport (send packet to actual port – not advertised port). More...
 
UtlBoolean getUseRport () const
 Is use report set? More...
 
void setUseRportMapping (UtlBoolean bEnable)
 Enable or disable use of rport IP and port in response via for contact mapping database. More...
 
UtlBoolean getUseRportMapping () const
 Get if use of rport IP and port in response via for contact mapping database is enabled. More...
 
UtlBoolean getConfiguredPublicAddress (UtlString *pIpAddress, int *pPort)
 Get the manually configured public address. More...
 
UtlBoolean getLocalAddress (UtlString *pIpAddress, int *pPort, SIPX_TRANSPORT_TYPE protocol=TRANSPORT_UDP)
 Get the local address and port. More...
 
UtlBoolean getNatMappedAddress (UtlString *pIpAddress, int *pPort)
 Get the NAT mapped address and port. More...
 
void setIsUserAgent (UtlBoolean isUserAgent)
 
void setUserAgentHeaderProperty (const char *property)
 Provides a string to be appended to the standard User-Agent header. More...
 
void setMaxForwards (int maxForwards)
 Set the limit of allowed hops a message can make. More...
 
int getMaxForwards ()
 Get the limit of allowed hops a message can make. More...
 
void setForking (UtlBoolean enabled)
 Allow or disallow recursion and forking of 3xx class requests. More...
 
void getFromAddress (UtlString *address, int *port, UtlString *protocol)
 
void getViaInfo (int protocol, UtlString &address, int &port, const char *pszTargetAddress, const int *piTargetPort)
 
void getDirectoryServer (int index, UtlString *address, int *port, UtlString *protocol)
 
void getProxyServer (int index, UtlString *address, int *port, UtlString *protocol)
 
void printStatus ()
 Print diagnostics. More...
 
void startMessageLog (int newMaximumLogSize=0)
 
void stopMessageLog ()
 
void clearMessageLog ()
 
virtual void logMessage (const char *message, int messageLength)
 
void getMessageLog (UtlString &logData)
 
int getSipStateTransactionTimeout ()
 
int getDefaultExpiresSeconds () const
 
const int getRegisterResponseTimeout () const
 
void setRegisterResponseTimeout (const int seconds)
 
void setDefaultExpiresSeconds (int expiresSeconds)
 
int getDefaultSerialExpiresSeconds () const
 
void setLocationHeader (const char *szHeader)
 
void setIncludePlatformInUserAgentName (const bool bInclude)
 Tells the User Agent whether or not to append the platform name onto the User Agent string. More...
 
void setDefaultSerialExpiresSeconds (int expiresSeconds)
 
void setMaxTcpSocketIdleTime (int idleTimeSeconds)
 Period of time a TCP socket can remain idle before it is removed. More...
 
int getMaxSrvRecords () const
 Get the maximum number of DNS SRV records to pursue in the case of failover. More...
 
void setMaxSrvRecords (int numRecords)
 Set the maximum number of DNS SRV records to pursue in the case of failover. More...
 
int getDnsSrvTimeout ()
 Get the number of seconds to wait before trying the next DNS SRV record. More...
 
void setDnsSrvTimeout (int timeout)
 Set the number of seconds to wait before trying the next DNS SRV record. More...
 
void setHostAliases (UtlString &aliases)
 Set other DNS names or IP addresses which are considered to refer to this SipUserAgent. More...
 
void setRecurseOnlyOne300Contact (UtlBoolean recurseOnlyOne)
 Flag to recurse only one contact in a 300 response. More...
 
void setReturnViasForMaxForwards (UtlBoolean returnVias)
 Flag to return Vias in too many hops response to request with max-forwards == 0. More...
 
SipMessagegetRequest (const SipMessage &response)
 Get a copy of the original request that was sent corresponding to this incoming response. More...
 
int getUdpPort () const
 
int getTcpPort () const
 Get the local UDP port number (or PORT_NONE if disabled) More...
 
int getTlsPort () const
 Get the local TCP port number (or PORT_NONE if disabled) More...
 
void setUserAgentName (const UtlString &name)
 Get the local Tls port number (or PORT_NONE if disabled) More...
 
const UtlString & getUserAgentName () const
 Sets the User Agent name sent with outgoing sip messages. More...
 
void setHeaderOptions (const bool bAllowHeader, const bool bDateHeader, const bool bShortNames, const UtlString &acceptLanguage)
 Sets the User Agent name sent with outgoing sip messages. More...
 
bool getEnabledShortNames ()
 Sets header options - send or not send. More...
 
void setEnableLocationHeader (const bool bLocationHeader)
 
void stopTransactionTimers ()
 
void startTransactionTimers ()
 
virtual UtlBoolean isMessageLoggingEnabled ()
 
virtual UtlBoolean isReady ()
 
virtual UtlBoolean waitUntilReady ()
 
UtlBoolean isMethodAllowed (const char *method)
 
UtlBoolean isExtensionAllowed (const char *extension) const
 
UtlBoolean isForkingEnabled ()
 
UtlBoolean isMyHostAlias (Url &route) const
 
UtlBoolean recurseOnlyOne300Contact ()
 
UtlBoolean isOk (OsSocket::IpProtocolSocketType socketType)
 
UtlBoolean isShutdownDone ()
 Find out if SipUserAgent has finished shutting down. More...
 
void setUserAgentHeader (SipMessage &message)
 
void setServerHeader (SipMessage &message)
 
void setSelfHeader (SipMessage &message)
 Add either Server or User-Agent header, as appropriate based on isUserAgent. More...
 
SipContactDbgetContactDb ()
 
const bool addContactAddress (SIPX_CONTACT_ADDRESS &contactAddress)
 Adds a contact record to the contact db. More...
 
void getContactAddresses (SIPX_CONTACT_ADDRESS *pContacts[], int &numContacts)
 Gets all contact addresses for this user agent. More...
 
void prepareVia (SipMessage &message, UtlString &branchId, OsSocket::IpProtocolSocketType &toProtocol, const char *szTargetAddress, const int *piTargetPort, SIPX_TRANSPORT_DATA *pTransport=NULL)
 
void addExternalTransport (const UtlString tranportName, const SIPX_TRANSPORT_DATA *const pTransport)
 
void removeExternalTransport (const UtlString transportName, const SIPX_TRANSPORT_DATA *const pTransport)
 
const SIPX_TRANSPORT_DATA *const lookupExternalTransport (const UtlString transportName, const UtlString ipAddress) const
 
- Public Member Functions inherited from SipUserAgentBase
 SipUserAgentBase (int sipTcpPort=SIP_PORT, int sipUdpPort=SIP_PORT, int sipTlsPort=SIP_TLS_PORT, int queueSize=OsServerTask::DEF_MAX_MSGS)
 
virtual ~SipUserAgentBase ()
 
void addConfigChangeConsumer (OsMsgQ &messageQueue)
 
virtual void getContactUri (UtlString *contactUri)
 

Protected Member Functions

void prepareContact (SipMessage &message, const char *szTargetAddress, const int *piTargetPort)
 
void selfHeaderValue (UtlString &self)
 constuct the value to be used in either user-agent or server header. More...
 
void getAllowedMethods (UtlString *allowedMethods)
 
void whichExtensionsNotAllowed (const SipMessage *message, UtlString *disallowedExtensions) const
 
UtlBoolean checkMethods (SipMessage *message)
 
UtlBoolean checkExtensions (SipMessage *message)
 
UtlBoolean sendStatelessResponse (SipMessage &response)
 
UtlBoolean sendStatelessRequest (SipMessage &request, UtlString &address, int port, OsSocket::IpProtocolSocketType protocol, UtlString &branchId)
 
UtlBoolean sendTls (SipMessage *message, const char *serverAddress, int port)
 
UtlBoolean sendTcp (SipMessage *message, const char *serverAddress, int port)
 
UtlBoolean sendUdp (SipMessage *message, const char *serverAddress, int port)
 
UtlBoolean sendCustom (SIPX_TRANSPORT_DATA *pTransport, SipMessage *message, const char *sendAddress, const int sendPort)
 
UtlBoolean sendSymmetricUdp (SipMessage &message, const char *serverAddress, int port)
 
void lookupSRVSipAddress (UtlString protocol, UtlString &sipAddress, int &port, UtlString &srcIp)
 DNS SRV lookup for to address. More...
 
int getReliableTransportTimeout ()
 
int getFirstResendTimeout ()
 
int getLastResendTimeout ()
 
UtlBoolean shouldAuthenticate (SipMessage *message) const
 
UtlBoolean authorized (SipMessage *request, const char *uri=NULL) const
 
void addAuthentication (SipMessage *message) const
 
UtlBoolean resendWithAuthorization (SipMessage *response, SipMessage *request, int *messageType, int authorizationEntity)
 

Friends

class SipTransaction
 
class SipUdpServer
 
int SipUdpServer::run (void *runArg)
 

Additional Inherited Members

- Protected Attributes inherited from SipUserAgentBase
int mTcpPort
 
int mUdpPort
 
int mTlsPort
 
UtlBoolean mMessageLogEnabled
 
UtlString mContactAddress
 
OsRWMutex mObserverMutex
 
UtlHashBag mConfigChangeObservers
 
SipContactDb mContactDb
 

Detailed Description

Transaction and Transport manager for SIP stack.

Note SipUserAgent is perhaps not the best name for this class. It is really the transaction and transport layers of of a SIP stack which may be used in a User Agent or server context.

Using SipUserAgent

The SipUserAgent is the primary interface for incoming and out going SIP messages. It handles all of the reliability, resending, canceling and IP layer protocol details. Application developers that wish to send or recieve SIP messages can use SipUserAgent without having to worry about the transaction and transport details.

Applications send SIP messages via the send() method. Incoming messages are received on an OsMsgQ to be handled by the application. The message queue must be registered with the SipUserAgent via addMessageObserver() before they can receive incoming messages. Alternatively applications that are only interested in a specific transaction can pass the OsMsgQ as part of the send() method invocation. Messages which fail to be sent due to transport problems will be communicated back in one of three different ways:
  1. send() returns a failure indication synchronously (e.g. due to unresolvable DNS name)
  2. the send fails asynchronously (e.g. ICMP error) and puts a message in the OsMsgQ with a transport failure indication
  3. the send succeeds, but the transaction fails or times out due to the lack of completion or responses to a request. In this case a message is put in the OsMsgQ with a transport failure indication.

In the asynchronous cases where a message is put in the message queue to indicate the failure, the original SIP message is attached so that the application can determine which SIP message send failed.

Internal Implementation Overview

All state information will be contained in transactions and/or the messages contained by a transaction. The transaction will keep track of what protocols to use and when as well as when to schedule timers. send() will no longer be used for resending. It will only be used for the first time send.

The flow for outgoing messages is something like the following:

Timeouts are handled by handle message in the following flow:

Inbound messages are still sent via dispatch. The flow is now a little different due to the use of transaction objects

Member Enumeration Documentation

Enumerator
UNSPECIFIED 
SHUTDOWN_MESSAGE 
KEEPALIVE_MESSAGE 

Constructor & Destructor Documentation

SipUserAgent ( int  sipTcpPort = SIP_PORT,
int  sipUdpPort = SIP_PORT,
int  sipTlsPort = SIP_PORT+1,
const char *  publicAddress = NULL,
const char *  defaultUser = NULL,
const char *  defaultSipAddress = NULL,
const char *  sipProxyServers = NULL,
const char *  sipDirectoryServers = NULL,
const char *  sipRegistryServers = NULL,
const char *  authenticationScheme = NULL,
const char *  authenicateRealm = NULL,
OsConfigDb *  authenticateDb = NULL,
OsConfigDb *  authorizeUserIds = NULL,
OsConfigDb *  authorizePasswords = NULL,
SipLineMgr lineMgr = NULL,
int  sipFirstResendTimeout = SIP_DEFAULT_RTT,
UtlBoolean  defaultToUaTransactions = TRUE,
int  readBufferSize = -1,
int  queueSize = OsServerTask::DEF_MAX_MSGS,
UtlBoolean  bUseNextAvailablePort = FALSE,
UtlString  certNickname = "",
UtlString  certPassword = "",
UtlString  dbLocation = ".",
UtlBoolean  doUaMessageChecks = TRUE 
)

Constructor.

Sets up listeners on the defined ports and IP layer protocols for incoming SIP messages.

Parameters
sipTcpPort- port to listen on for SIP TCP messages. Specify PORT_DEFAULT to automatically select a port, or PORT_NONE to disable.
sipUdpPort- port to listen on for SIP UDP messages. Specify PORT_DEFAULT to automatically select a port, or PORT_NONE to disable.
sipTlsPort- port to listen on for SIP TLS messages. Specify PORT_DEFAULT to automatically select a port, or PORT_NONE to disable.
publicAddress- use this address in Via and Contact headers instead of the actual adress. This is useful for address spoofing in a UA when behind a NAT
defaultUser- default user ID to use in Contacts which get inserted when missing on a UA.
defaultSipAddress- deprecated
sipProxyServers- server to which non-routed requests should be sent for next hop before going to the final destination
sipDirectoryServers- deprecated
sipRegistryServers- deprecated
authenticationScheme- authentication scheme to use when challenging on behalf of the UA (i.e. 401). Valid values are NONE and DIGEST.
authenicateRealm- The authentication realm to use when sending 401 challenges.
authenticateDb- the authentication DB to use when authenticating incoming requests on behalf of the UA application (as a result of locally generated 401 challenges
authorizeUserIds- depricated by the SipLineMgr
authorizePasswords- depricated by the SipLineMgr
lineMgr- SipLinMgr object which is container for user definitions and their credentials. This is used to authenticate incoming requests to the UA application.
sipFirstResendTimeout- T1 in RFC 3261
defaultToUaTransactions- default transactions to be UA or PROXY. TRUE means that this is a UA and associated validation should occur. FALSE means that this is a PROXY and that minimal validation should occur.
readBufferSize- the default IP socket buffer size to use for the listener sockets.
queueSize- Size of the OsMsgQ to use for the queues internal to the SipUserAgent and subsystems.
bUseNextAvailablePort- When setting up the sip user agent using the designated sipTcp, sipUdp, and sipTls ports, select the next available port if the supplied port is busy. If enable, this will attempt at most 10 sequential ports.
doUaMessageChecks- check the acceptability of method, extensions, and encoding. The default is TRUE; it may be set to false in applications such as a redirect server that will never actually send a 2xx response, so the checks might cause errors that the application should never generate.
~SipUserAgent ( )
virtual

Destructor.

Member Function Documentation

void shutdown ( UtlBoolean  blockingShutdown = TRUE)

Cleanly shuts down SipUserAgent.

This method can block until the shutdown is complete, or it can be non-blocking. When complete, the SipUserAgent can be deleted.

See also
isShutdownDone
Parameters
blockingShutdown- TRUE if this method should block until the shutdown is complete, FALSE if this method should be non-blocking.
void enableStun ( const char *  szStunServer,
int  iStunPort,
int  refreshPeriodInSecs,
OsNotification *  pNotification = NULL,
const char *  szIp = NULL 
)
virtual

Enable stun lookups for UDP signaling. Use a NULL szStunServer to disable.

UtlBoolean handleMessage ( OsMsg &  eventMessage)
virtual

For internal use only.

Implements SipUserAgentBase.

void addMessageConsumer ( OsServerTask *  messageConsumer)
virtual

Deprecated (Add a SIP message recipient)

Implements SipUserAgentBase.

void addMessageObserver ( OsMsgQ &  messageQueue,
const char *  sipMethod = NULL,
UtlBoolean  wantRequests = TRUE,
UtlBoolean  wantResponses = TRUE,
UtlBoolean  wantIncoming = TRUE,
UtlBoolean  wantOutGoing = FALSE,
const char *  eventName = NULL,
SipSession pSession = NULL,
void *  observerData = NULL 
)

Add a SIP message observer for receiving SIP messages meeting the given filter criteria.

SIP messages will be added to the messageQueue if they meet the given filter criteria.

Parameters
messageQueue- the queue on which an SipMessageEvent is dispatched
sipMethod- the specific method type of the requests or responses to be observed. NULL or a null string indicates all methods.
wantRequests- want to observe SIP requests
wantResponses- want to observe SIP responses
wantIncoming- want to observe SIP messages originating from the network.
wantOutGoing- (not implemented) want to observe SIP messages originating from locally.
eventName- want to observer SUBSCRIBE or NOTIFY requests having the given event type
pSession- want to observe SIP message with the specified session (call-id, to url, from url)
observerData- data to be attached to SIP messages queued on the observer
UtlBoolean removeMessageObserver ( OsMsgQ &  messageQueue,
void *  pObserverData = NULL 
)

Removes all SIP message observers for the given message/queue observer.

This undoes what addMessageObserver() does.

Parameters
messageQueue- All observers dispatching to this message queue will be removed if the pObserverData is NULL or matches.
pObserverData- If null, all observers that match the message queue will be removed. Otherwise, only observers that match both the message queue and observer data will be removed.
Returns
TRUE if one or more observers are removed otherwise FALSE.
UtlBoolean send ( SipMessage message,
OsMsgQ *  responseListener = NULL,
void *  responseListenerData = NULL,
SIPX_TRANSPORT_DATA pTransport = NULL 
)
virtual

Send a SIP message over the net.

This method sends the SIP message via a SIP UDP or TCP client as dictated by policy and the address specified in the message. Most applications will register a OsMsgQ via addMessageObserver() prior to calling send and so should call send with only one argument.

Note
If the application does register the message queue via addMessageObserver() it should not pass the message queue as an argument to send or it will receive multiple copies of the incoming responses.
Parameters
message- the sip message to be sent
responseListener- the optional queue on which to place SipMessageEvents containing SIP responses from the same transaction as the request sent in message
responseListenerData- optional data to be passed back with responses

Implements SipUserAgentBase.

void dispatch ( SipMessage message,
int  messageType = SipMessageEvent::APPLICATION,
SIPX_TRANSPORT_DATA pData = NULL 
)
virtual

Dispatch the SIP message to the message consumer(s)

This is typically only used by the SipUserAgent and its sub-system. So unless you know what you are doing you should not be using this method. All incoming SIP message need to be dispatched via the user agent server so that it can provide the reliablity for UDP (i.e. resend requests when no response is received)

Parameters
messageType- is as define by SipMessageEvent::MessageStatusTypes APPLICATION type are normal incoming messages TRANSPORT_ERROR type are notification of failures to send messages

Implements SipUserAgentBase.

void allowMethod ( const char *  methodName,
const bool  bAllow = true 
)
void allowExtension ( const char *  extension)
void getSupportedExtensions ( UtlString &  extensionsString)
void setProxyServers ( const char *  sipProxyServers)

Set the SIP proxy servers for the user agent.

This method will clear any existing proxy servers before resetting this list. NOTE: As for 12/2004, only the first proxy server is used. Please consider using DNS SRV in until fully implemented.

UtlBoolean addCrLfKeepAlive ( const char *  szLocalIp,
const char *  szRemoteIp,
const int  remotePort,
const int  keepAliveSecs,
OsNatKeepaliveListener *  pListener 
)
UtlBoolean removeCrLfKeepAlive ( const char *  szLocalIp,
const char *  szRemoteIp,
const int  remotePort 
)
UtlBoolean addStunKeepAlive ( const char *  szLocalIp,
const char *  szRemoteIp,
const int  remotePort,
const int  keepAliveSecs,
OsNatKeepaliveListener *  pListener 
)
UtlBoolean removeStunKeepAlive ( const char *  szLocalIp,
const char *  szRemoteIp,
const int  remotePort 
)
OsTimer* getTimer ( )
inline
UtlBoolean addSipKeepAlive ( const char *  szLocalIp,
const char *  szRemoteIp,
const int  remotePort,
const char *  szMethod,
const int  keepAliveSecs,
OsNatKeepaliveListener *  pListener 
)
UtlBoolean removeSipKeepAlive ( const char *  szLocalIp,
const char *  szRemoteIp,
const int  remotePort,
const char *  szMethod 
)
UtlBoolean setUseRport ( UtlBoolean  bEnable)

Enable or disable the outbound use of rport (send packet to actual port – not advertised port).

UtlBoolean getUseRport ( ) const

Is use report set?

void setUseRportMapping ( UtlBoolean  bEnable)

Enable or disable use of rport IP and port in response via for contact mapping database.

UtlBoolean getUseRportMapping ( ) const

Get if use of rport IP and port in response via for contact mapping database is enabled.

UtlBoolean getConfiguredPublicAddress ( UtlString *  pIpAddress,
int *  pPort 
)

Get the manually configured public address.

UtlBoolean getLocalAddress ( UtlString *  pIpAddress,
int *  pPort,
SIPX_TRANSPORT_TYPE  protocol = TRANSPORT_UDP 
)

Get the local address and port.

UtlBoolean getNatMappedAddress ( UtlString *  pIpAddress,
int *  pPort 
)

Get the NAT mapped address and port.

void setIsUserAgent ( UtlBoolean  isUserAgent)
void setUserAgentHeaderProperty ( const char *  property)

Provides a string to be appended to the standard User-Agent header.

The property is added between "<product>/<version>" and the platform (eg "(VxWorks)") The value should be formated either as "token/token", "token", or "(string)" with no leading or trailing space.

void setMaxForwards ( int  maxForwards)

Set the limit of allowed hops a message can make.

int getMaxForwards ( )

Get the limit of allowed hops a message can make.

void setForking ( UtlBoolean  enabled)

Allow or disallow recursion and forking of 3xx class requests.

void getFromAddress ( UtlString *  address,
int *  port,
UtlString *  protocol 
)
void getViaInfo ( int  protocol,
UtlString &  address,
int &  port,
const char *  pszTargetAddress,
const int *  piTargetPort 
)
void getDirectoryServer ( int  index,
UtlString *  address,
int *  port,
UtlString *  protocol 
)
void getProxyServer ( int  index,
UtlString *  address,
int *  port,
UtlString *  protocol 
)
void printStatus ( )

Print diagnostics.

void startMessageLog ( int  newMaximumLogSize = 0)
void stopMessageLog ( )
void clearMessageLog ( )
void logMessage ( const char *  message,
int  messageLength 
)
virtual

Implements SipUserAgentBase.

void getMessageLog ( UtlString &  logData)
int getSipStateTransactionTimeout ( )
int getDefaultExpiresSeconds ( ) const
const int getRegisterResponseTimeout ( ) const
inline
void setRegisterResponseTimeout ( const int  seconds)
inline
void setDefaultExpiresSeconds ( int  expiresSeconds)
int getDefaultSerialExpiresSeconds ( ) const
void setLocationHeader ( const char *  szHeader)
void setIncludePlatformInUserAgentName ( const bool  bInclude)

Tells the User Agent whether or not to append the platform name onto the User Agent string.

void setDefaultSerialExpiresSeconds ( int  expiresSeconds)
void setMaxTcpSocketIdleTime ( int  idleTimeSeconds)

Period of time a TCP socket can remain idle before it is removed.

int getMaxSrvRecords ( ) const

Get the maximum number of DNS SRV records to pursue in the case of failover.

void setMaxSrvRecords ( int  numRecords)

Set the maximum number of DNS SRV records to pursue in the case of failover.

int getDnsSrvTimeout ( )

Get the number of seconds to wait before trying the next DNS SRV record.

void setDnsSrvTimeout ( int  timeout)

Set the number of seconds to wait before trying the next DNS SRV record.

void setHostAliases ( UtlString &  aliases)

Set other DNS names or IP addresses which are considered to refer to this SipUserAgent.

Used with routing decisions to determine whether routes are targeted to this SIP server or not.

Parameters
aliases- space or comma separated of the format: "sip:host:port" or "host:port"
void setRecurseOnlyOne300Contact ( UtlBoolean  recurseOnlyOne)

Flag to recurse only one contact in a 300 response.

void setReturnViasForMaxForwards ( UtlBoolean  returnVias)

Flag to return Vias in too many hops response to request with max-forwards == 0.

SipMessage * getRequest ( const SipMessage response)

Get a copy of the original request that was sent corresponding to this incoming response.

Returns
NULL if not found. Caller MUST free the copy of the request when done
int getUdpPort ( ) const
int getTcpPort ( ) const

Get the local UDP port number (or PORT_NONE if disabled)

int getTlsPort ( ) const

Get the local TCP port number (or PORT_NONE if disabled)

void setUserAgentName ( const UtlString &  name)

Get the local Tls port number (or PORT_NONE if disabled)

const UtlString & getUserAgentName ( ) const

Sets the User Agent name sent with outgoing sip messages.

void setHeaderOptions ( const bool  bAllowHeader,
const bool  bDateHeader,
const bool  bShortNames,
const UtlString &  acceptLanguage 
)

Sets the User Agent name sent with outgoing sip messages.

bool getEnabledShortNames ( )
inline

Sets header options - send or not send.

void setEnableLocationHeader ( const bool  bLocationHeader)
inline
void stopTransactionTimers ( )
inline
void startTransactionTimers ( )
inline
UtlBoolean isMessageLoggingEnabled ( )
virtual

Implements SipUserAgentBase.

UtlBoolean isReady ( )
virtual

Reimplemented from SipUserAgentBase.

UtlBoolean waitUntilReady ( )
virtual

Reimplemented from SipUserAgentBase.

UtlBoolean isMethodAllowed ( const char *  method)
UtlBoolean isExtensionAllowed ( const char *  extension) const
UtlBoolean isForkingEnabled ( )
UtlBoolean isMyHostAlias ( Url route) const
UtlBoolean recurseOnlyOne300Contact ( )
UtlBoolean isOk ( OsSocket::IpProtocolSocketType  socketType)
UtlBoolean isShutdownDone ( )

Find out if SipUserAgent has finished shutting down.

Useful when using the non-blocking form of shutdown.

Returns
TRUE if SipUserAgent has finished shutting down, FALSE otherwise.
void setUserAgentHeader ( SipMessage message)
void setServerHeader ( SipMessage message)
void setSelfHeader ( SipMessage message)

Add either Server or User-Agent header, as appropriate based on isUserAgent.

Add either Server or User-Agent header, as appropriate.

SipContactDb& getContactDb ( )
inline
const bool addContactAddress ( SIPX_CONTACT_ADDRESS contactAddress)

Adds a contact record to the contact db.

void getContactAddresses ( SIPX_CONTACT_ADDRESS pContacts[],
int &  numContacts 
)

Gets all contact addresses for this user agent.

void prepareVia ( SipMessage message,
UtlString &  branchId,
OsSocket::IpProtocolSocketType &  toProtocol,
const char *  szTargetAddress,
const int *  piTargetPort,
SIPX_TRANSPORT_DATA pTransport = NULL 
)
void addExternalTransport ( const UtlString  tranportName,
const SIPX_TRANSPORT_DATA *const  pTransport 
)
void removeExternalTransport ( const UtlString  transportName,
const SIPX_TRANSPORT_DATA *const  pTransport 
)
const SIPX_TRANSPORT_DATA *const lookupExternalTransport ( const UtlString  transportName,
const UtlString  ipAddress 
) const
void prepareContact ( SipMessage message,
const char *  szTargetAddress,
const int *  piTargetPort 
)
protected
void selfHeaderValue ( UtlString &  self)
protected

constuct the value to be used in either user-agent or server header.

void getAllowedMethods ( UtlString *  allowedMethods)
protected
void whichExtensionsNotAllowed ( const SipMessage message,
UtlString *  disallowedExtensions 
) const
protected
UtlBoolean checkMethods ( SipMessage message)
protected
UtlBoolean checkExtensions ( SipMessage message)
protected
UtlBoolean sendStatelessResponse ( SipMessage response)
protected
UtlBoolean sendStatelessRequest ( SipMessage request,
UtlString &  address,
int  port,
OsSocket::IpProtocolSocketType  protocol,
UtlString &  branchId 
)
protected
UtlBoolean sendTls ( SipMessage message,
const char *  serverAddress,
int  port 
)
protected
UtlBoolean sendTcp ( SipMessage message,
const char *  serverAddress,
int  port 
)
protected
UtlBoolean sendUdp ( SipMessage message,
const char *  serverAddress,
int  port 
)
protected
UtlBoolean sendCustom ( SIPX_TRANSPORT_DATA pTransport,
SipMessage message,
const char *  sendAddress,
const int  sendPort 
)
protected
UtlBoolean sendSymmetricUdp ( SipMessage message,
const char *  serverAddress,
int  port 
)
protected
void lookupSRVSipAddress ( UtlString  protocol,
UtlString &  sipAddress,
int &  port,
UtlString &  srcIp 
)
protected

DNS SRV lookup for to address.

int getReliableTransportTimeout ( )
protected
int getFirstResendTimeout ( )
protected
int getLastResendTimeout ( )
protected
UtlBoolean shouldAuthenticate ( SipMessage message) const
protected
UtlBoolean authorized ( SipMessage request,
const char *  uri = NULL 
) const
protected
void addAuthentication ( SipMessage message) const
protected
UtlBoolean resendWithAuthorization ( SipMessage response,
SipMessage request,
int *  messageType,
int  authorizationEntity 
)
protected

Friends And Related Function Documentation

friend class SipTransaction
friend
friend class SipUdpServer
friend
int SipUdpServer::run ( void *  runArg)
friend

sipXtackLib home page