GetContext

Gets the value of the context entity identified by the name in the context session of the message. "Context" entities include the following constants: account ID, account password, service name, and service method.

Syntax

ASCII Version
const char* getContext(Message* message,const char* name) 
Unicode Version
const UChar * getContext(Message* message,const UChar* name) 

Parameters

  • Message - the message to which this function applies
  • Name - the name whose associated value is to be returned

Result

Returns the value for the name in the context entity. If the name does not exist, the method returns empty string.

Example

ASCII Version
const char* value = getContext(message, "account.id"); 
Unicode Version
UChar* value; 
// construct 16-bit string 
UChar accountID[32]; 
char* account="account.id"; 
u_charsToUChars(account,	accountID,	strlen(account)); 
accountID[ strlen(account)]=0;	
value = getContext(message,	accountID);