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

Client for SIP Presence and Instant Messaging. More...

#include <SipPimClient.h>

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

Public Types

enum  SipxRpidStates {
  invalid = -1,
  closed,
  open
}
 
typedef void(* MessageCallback) (void *userData, const UtlString &fromAddress, const char *textMessage, int textLength, const char *subject, const SipMessage &messageRequest)
 

Public Member Functions

 SipPimClient (SipUserAgent &userAgent, Url &presentityAor)
 Constructor. More...
 
virtual ~SipPimClient ()
 Destructor. More...
 
void setLocalKeyCert (const char *localPkcs12DerKeyCert, int localPkcs12DerKeyCertLength, const char *sPkcs12Password)
 Set the Private key and Certificate for the local side. More...
 
void setRemoteCertificate (const char *derFormatCertificate, int derFormatCertificateLength)
 Set the certificate containing the public key for the remote side. More...
 
UtlBoolean sendPagerMessage (Url &destinationAor, const char *messageText, const char *subject, int &responseCode, UtlString &responseCodeText)
 Send a pager style instant message to the given destination. More...
 
void setIncomingImTextHandler (MessageCallback callback, void *userData)
 Set callback function for incoming pager mode text messages. More...
 
UtlBoolean updatePresenceState (SipxRpidStates newState)
 Update the presence state of the presentity indicate. More...
 
UtlBoolean handleMessage (OsMsg &eventMessage)
 Handler for incoming SIP messages. More...
 

Protected Member Functions

void getNextCallId (UtlString &callId)
 Call Id generator for SipPimClient. More...
 

Detailed Description

Client for SIP Presence and Instant Messaging.

This client provides interfaces for publishing the current presence state of an entity or AOR. It also provides a basic client for sending pager style instant messages. That is non-session based messages using the MESSAGE request. Note that a user interface can provide a session base end user experience using a non-session based messages.

Presence State
The setPresenceState method can be sued to set the current presence state for the presence AOR. Setting the state to a different value implies that a PUBLISH request is sent to update the presence state.
Instant Message
A sessionless instant message is sent using the sendPagerMessage method.

Member Typedef Documentation

typedef void(* MessageCallback) (void *userData, const UtlString &fromAddress, const char *textMessage, int textLength, const char *subject, const SipMessage &messageRequest)

Member Enumeration Documentation

Enumerator
invalid 
closed 
open 

Constructor & Destructor Documentation

SipPimClient ( SipUserAgent userAgent,
Url presentityAor 
)

Constructor.

Construct and bind AOR and user agent for Presence and IM client.

Parameters
userAgent- user agent to send requests and receive reponses
presentityAor- the entity whose presence state is to be published. This is also the From nameAddr used for instant messages sent.
~SipPimClient ( )
virtual

Destructor.

Member Function Documentation

void setLocalKeyCert ( const char *  localPkcs12DerKeyCert,
int  localPkcs12DerKeyCertLength,
const char *  sPkcs12Password 
)

Set the Private key and Certificate for the local side.

Parameters
localPkcs12DerKeyCertDER format PKCS12 container for private key and certificate for the local side.
localPkcs12DerKeyCertLengththe length of localPkcs12DerKeyCert in bytes
sPkcs12Passwordpassword (symmetric key) to decrypt the PKCS12 container/wrapper.
void setRemoteCertificate ( const char *  derFormatCertificate,
int  derFormatCertificateLength 
)

Set the certificate containing the public key for the remote side.

Setting the remote certificate enable encryption of IM messages to the other side.

Parameters
derFormatCertificate- DER format certificate
derFormatCertificateLength- length of the certificate
UtlBoolean sendPagerMessage ( Url destinationAor,
const char *  messageText,
const char *  subject,
int &  responseCode,
UtlString &  responseCodeText 
)

Send a pager style instant message to the given destination.

Send a non-session based instant message using the MESSAGE method.

Parameters
destinationAor- destination to send the IM to.
messageText- text of the message to send in the IM
responseCode- the response code from the request to sent the text
responseCodeText- the response code text from the top header line
void setIncomingImTextHandler ( MessageCallback  callback,
void *  userData 
)

Set callback function for incoming pager mode text messages.

Set the function to be called if there are incoming MESSAGE requests with text bodies. Note: the SipPimClient task MUST be started up for the callback to get invoked.

Parameters
textHandler- callback function with the following arguments:
fromAddress- the from field from the request
textMessage- the text message from the request body
messageRequest- the MESSAGE request
UtlBoolean updatePresenceState ( SipxRpidStates  newState)

Update the presence state of the presentity indicate.

Send a PUBLISH request to update the RPID document with the given presence state. If the current state is the same the presence state document is not updated.

Parameters
newState- the new RPID presence state to be published.
UtlBoolean handleMessage ( OsMsg &  eventMessage)

Handler for incoming SIP messages.

This consumes SIP messages and dispatched them to the callbacks.

void getNextCallId ( UtlString &  callId)
protected

Call Id generator for SipPimClient.


sipXtackLib home page