Group PJSUA2_SIP_Types

group PJSUA2_SIP_Types

Typedefs

typedef std::vector<SockOpt> SockOptVector

Array of socket options

typedef std::vector<SipHeader> SipHeaderVector

Array of strings

typedef std::vector<SipMultipartPart> SipMultipartPartVector

Array of multipart parts

struct AuthCredInfo : public pj::PersistentObject
#include <siptypes.hpp>

Credential information. Credential contains information to authenticate against a service.

Public Functions

AuthCredInfo()

Default constructor

AuthCredInfo(const string &scheme, const string &realm, const string &user_name, const int data_type, const string data)

Construct a credential with the specified parameters

void fromPj(const pjsip_cred_info &prm)

Convert from pjsip

pjsip_cred_info toPj() const

Convert to pjsip

virtual void readObject(const ContainerNode &node)

Read this object from a container node.

Parameters:

node – Container to read values from.

virtual void writeObject(ContainerNode &node) const

Write this object to a container node.

Parameters:

node – Container to write values to.

Public Members

string scheme

The authentication scheme (e.g. “digest”).

string realm

Realm on which this credential is to be used. Use “*” to make a credential that can be used to authenticate against any challenges.

string username

Authentication user name.

int dataType

Type of data that is contained in the “data” field. Use 0 if the data contains plain text password.

string data

The data, which can be a plain text password or a hashed digest.

pjsip_auth_algorithm_type algoType

Digest algorithm type.

string akaK

Permanent subscriber key.

string akaOp

Operator variant key.

string akaAmf

Authentication Management Field

struct SockOpt
#include <siptypes.hpp>

Socket option type.

Public Functions

SockOpt()

Default constructor.

SockOpt(int level, int optName, int optVal)

Construct a socket option with the specified parameters.

void setOptValInt(int opt_val)

Set option value of type integer.

Parameters:

opt_val – Option value.

Public Members

int level

The level at which the option is defined.

int optName

Option name.

struct SockOptParams : public pj::PersistentObject
#include <siptypes.hpp>

Socket option parameters, to be specified in TransportConfig.

Public Functions

SockOptParams()

Default constructor initialises with default values

pj_sockopt_params toPj() const

Convert to pjsip

void fromPj(const pj_sockopt_params &prm)

Convert from pjsip

virtual void readObject(const ContainerNode &node)

Read this object from a container node.

Parameters:

node – Container to read values from.

virtual void writeObject(ContainerNode &node) const

Write this object to a container node.

Parameters:

node – Container to write values to.

Public Members

SockOptVector sockOpts

Array of socket options.

struct TlsConfig : public pj::PersistentObject
#include <siptypes.hpp>

TLS transport settings, to be specified in TransportConfig.

Public Functions

TlsConfig()

Default constructor initialises with default values

pjsip_tls_setting toPj() const

Convert to pjsip

void fromPj(const pjsip_tls_setting &prm)

Convert from pjsip

virtual void readObject(const ContainerNode &node)

Read this object from a container node.

Parameters:

node – Container to read values from.

virtual void writeObject(ContainerNode &node) const

Write this object to a container node.

Parameters:

node – Container to write values to.

Public Members

string CaListFile

Certificate of Authority (CA) list file.

string certFile

Public endpoint certificate file, which will be used as client- side certificate for outgoing TLS connection, and server-side certificate for incoming TLS connection.

string privKeyFile

Optional private key of the endpoint certificate to be used.

string password

Password to open private key.

string CaBuf

Certificate of Authority (CA) buffer. If CaListFile, certFile or privKeyFile are set, this setting will be ignored.

string certBuf

Public endpoint certificate buffer, which will be used as client- side certificate for outgoing TLS connection, and server-side certificate for incoming TLS connection. If CaListFile, certFile or privKeyFile are set, this setting will be ignored.

string privKeyBuf

Optional private key buffer of the endpoint certificate to be used. If CaListFile, certFile or privKeyFile are set, this setting will be ignored.

pj_ssl_cert_lookup_type certLookupType

Lookup certificate from OS certificate store, this setting will specify the field type to lookup.

Currently only used by Windows Schannel backend, see also pj_ssl_cert_load_from_store() for more info.

string certLookupKeyword

Lookup certificate from OS certificate store, this setting will specify the keyword to match on the field specified in certLookupType above.

Currently only used by Windows Schannel backend, see also pj_ssl_cert_load_from_store() for more info.

pjsip_ssl_method method

TLS protocol method from pjsip_ssl_method. In the future, this field might be deprecated in favor of proto field. For now, this field is only applicable only when proto field is set to zero.

Default is PJSIP_SSL_UNSPECIFIED_METHOD (0), which in turn will use PJSIP_SSL_DEFAULT_METHOD, which default value is PJSIP_TLSV1_METHOD.

unsigned proto

TLS protocol type from pj_ssl_sock_proto. Use this field to enable specific protocol type. Use bitwise OR operation to combine the protocol type.

Default is PJSIP_SSL_DEFAULT_PROTO.

IntVector ciphers

Ciphers and order preference. The Endpoint::utilSslGetAvailableCiphers() can be used to check the available ciphers supported by backend. If the array is empty, then default cipher list of the backend will be used.

bool verifyServer

Specifies TLS transport behavior on the server TLS certificate verification result:

  • If verifyServer is disabled, TLS transport will just notify the application via pjsip_tp_state_callback with state PJSIP_TP_STATE_CONNECTED regardless TLS verification result.

  • If verifyServer is enabled, TLS transport will be shutdown and application will be notified with state PJSIP_TP_STATE_DISCONNECTED whenever there is any TLS verification error, otherwise PJSIP_TP_STATE_CONNECTED will be notified.

In any cases, application can inspect pjsip_tls_state_info in the callback to see the verification detail.

Default value is false.

bool verifyClient

Specifies TLS transport behavior on the client TLS certificate verification result:

  • If verifyClient is disabled, TLS transport will just notify the application via pjsip_tp_state_callback with state PJSIP_TP_STATE_CONNECTED regardless TLS verification result.

  • If verifyClient is enabled, TLS transport will be shutdown and application will be notified with state PJSIP_TP_STATE_DISCONNECTED whenever there is any TLS verification error, otherwise PJSIP_TP_STATE_CONNECTED will be notified.

In any cases, application can inspect pjsip_tls_state_info in the callback to see the verification detail.

Default value is PJ_FALSE.

bool requireClientCert

When acting as server (incoming TLS connections), reject incoming connection if client doesn’t supply a TLS certificate.

This setting corresponds to SSL_VERIFY_FAIL_IF_NO_PEER_CERT flag. Default value is PJ_FALSE.

unsigned msecTimeout

TLS negotiation timeout to be applied for both outgoing and incoming connection, in milliseconds. If zero, the SSL negotiation doesn’t have a timeout.

Default: zero

pj_qos_type qosType

QoS traffic type to be set on this transport. When application wants to apply QoS tagging to the transport, it’s preferable to set this field rather than qosParam fields since this is more portable.

Default value is PJ_QOS_TYPE_BEST_EFFORT.

pj_qos_params qosParams

Set the low level QoS parameters to the transport. This is a lower level operation than setting the qosType field and may not be supported on all platforms.

By default all settings in this structure are disabled.

bool qosIgnoreError

Specify if the transport should ignore any errors when setting the QoS traffic type/parameters.

Default: PJ_TRUE

SockOptParams sockOptParams

Specify options to be set on the transport.

By default, this is unset, which means that the underlying sockopt params as returned by pj_ssl_sock_param_default() will be used.

bool sockOptIgnoreError

Specify if the transport should ignore any errors when setting the sockopt parameters.

Default: true

bool enableRenegotiation

Specify if renegotiation is enabled for TLSv1.2 or earlier.

Default: PJ_TRUE

struct TransportConfig : public pj::PersistentObject
#include <siptypes.hpp>

Parameters to create a transport instance.

Public Functions

TransportConfig()

Default constructor initialises with default values

void fromPj(const pjsua_transport_config &prm)

Convert from pjsip

pjsua_transport_config toPj() const

Convert to pjsip

virtual void readObject(const ContainerNode &node)

Read this object from a container node.

Parameters:

node – Container to read values from.

virtual void writeObject(ContainerNode &node) const

Write this object to a container node.

Parameters:

node – Container to write values to.

Public Members

unsigned port

UDP port number to bind locally. This setting MUST be specified even when default port is desired. If the value is zero, the transport will be bound to any available port, and application can query the port by querying the transport info.

unsigned portRange

Specify the port range for socket binding, relative to the start port number specified in port. Note that this setting is only applicable for media transport when the start port number is non zero. Media transport is configurable via account setting, i.e: AccountMediaConfig::transportConfig, please check the media transport config docs for more info.

Available ports are in the range of [port, port + portRange].

Default value is zero.

bool randomizePort

Specify whether to randomly pick the starting port number from the range of [port, port + port_range]. This setting is used only if both port and port_range are non-zero, and only applicable for the port selection of UDP and loop media transport.

Default is PJ_FALSE.

string publicAddress

Optional address to advertise as the address of this transport. Application can specify any address or hostname for this field, for example it can point to one of the interface address in the system, or it can point to the public address of a NAT router where port mappings have been configured for the application.

Note: this option can be used for both UDP and TCP as well!

string boundAddress

Optional address where the socket should be bound to. This option SHOULD only be used to selectively bind the socket to particular interface (instead of 0.0.0.0), and SHOULD NOT be used to set the published address of a transport (the public_addr field should be used for that purpose).

Note that unlike public_addr field, the address (or hostname) here MUST correspond to the actual interface address in the host, since this address will be specified as bind() argument.

TlsConfig tlsConfig

This specifies TLS settings for TLS transport. It’s only used when creating a SIP TLS transport.

pj_qos_type qosType

QoS traffic type to be set on this transport. When application wants to apply QoS tagging to the transport, it’s preferable to set this field rather than qosParam fields since this is more portable.

For TLS transport, this field will be ignored, the QoS traffic type can be set via tlsConfig.

Default is QoS not set.

pj_qos_params qosParams

Set the low level QoS parameters to the transport. This is a lower level operation than setting the qosType field and may not be supported on all platforms.

For TLS transport, this field will be ignored, the low level QoS parameters can be set via tlsConfig.

Default is QoS not set.

SockOptParams sockOptParams

Set the low level socket options to the transport.

For TLS transport, this field will be ignored, the socket options can be set via tlsConfig.

Default is no socket option set.

struct TransportInfo
#include <siptypes.hpp>

This structure describes transport information returned by Endpoint::transportGetInfo() function.

Public Functions

TransportInfo()

Default constructor.

void fromPj(const pjsua_transport_info &info)

Construct from pjsua_transport_info

Public Members

TransportId id

PJSUA transport identification.

pjsip_transport_type_e type

Transport type.

string typeName

Transport type name.

string info

Transport string info/description.

unsigned flags

Transport flags (see pjsip_transport_flags_e).

SocketAddress localAddress

Local/bound address.

SocketAddress localName

Published address (or transport address name).

unsigned usageCount

Current number of objects currently referencing this transport.

struct SipRxData
#include <siptypes.hpp>

This structure describes an incoming SIP message. It corresponds to the pjsip_rx_data structure in PJSIP library.

Public Functions

SipRxData()

Default constructor.

void fromPj(pjsip_rx_data &rdata)

Construct from PJSIP’s pjsip_rx_data

Public Members

string info

A short info string describing the request, which normally contains the request method and its CSeq.

string wholeMsg

The whole message data as a string, containing both the header section and message body section.

SocketAddress srcAddress

Source address of the message.

void *pjRxData

Pointer to original pjsip_rx_data. Only valid when the struct is constructed from PJSIP’s pjsip_rx_data.

struct SipTxData
#include <siptypes.hpp>

This structure describes an outgoing SIP message. It corresponds to the pjsip_tx_data structure in PJSIP library.

Public Functions

SipTxData()

Default constructor.

void fromPj(pjsip_tx_data &tdata)

Construct from PJSIP’s pjsip_tx_data

Public Members

string info

A short info string describing the request, which normally contains the request method and its CSeq.

string wholeMsg

The whole message data as a string, containing both the header section and message body section.

SocketAddress dstAddress

Destination address of the message.

void *pjTxData

Pointer to original pjsip_tx_data. Only valid when the struct is constructed from PJSIP’s pjsip_tx_data.

struct SipTransaction
#include <siptypes.hpp>

This structure describes SIP transaction object. It corresponds to the pjsip_transaction structure in PJSIP library.

Public Functions

SipTransaction()

Default constructor.

void fromPj(pjsip_transaction &tsx)

Construct from PJSIP’s pjsip_transaction

Public Members

pjsip_role_e role

Role (UAS or UAC)

string method

The method.

int statusCode

Last status code seen.

string statusText

Last reason phrase.

pjsip_tsx_state_e state

State.

SipTxData lastTx

Msg kept for retrans.

void *pjTransaction

pjsip_transaction.

struct TimerEvent
#include <siptypes.hpp>

This structure describes timer event.

Public Members

TimerEntry entry

The timer entry.

struct TsxStateEventSrc
#include <siptypes.hpp>

This structure describes transaction state event source.

Public Members

SipRxData rdata

The incoming message.

SipTxData tdata

The outgoing message.

TimerEntry timer

The timer.

pj_status_t status

Transport error status.

GenericData data

Generic data.

struct TsxStateEvent
#include <siptypes.hpp>

This structure describes transaction state changed event.

Public Members

TsxStateEventSrc src

Event source.

SipTransaction tsx

The transaction.

pjsip_tsx_state_e prevState

Previous state.

pjsip_event_id_e type

Type of event source:

  • PJSIP_EVENT_TX_MSG

  • PJSIP_EVENT_RX_MSG,

  • PJSIP_EVENT_TRANSPORT_ERROR

  • PJSIP_EVENT_TIMER

  • PJSIP_EVENT_USER

struct TxMsgEvent
#include <siptypes.hpp>

This structure describes message transmission event.

Public Members

SipTxData tdata

The transmit data buffer.

struct TxErrorEvent
#include <siptypes.hpp>

This structure describes transmission error event.

Public Members

SipTxData tdata

The transmit data.

SipTransaction tsx

The transaction.

struct RxMsgEvent
#include <siptypes.hpp>

This structure describes message arrival event.

Public Members

SipRxData rdata

The receive data buffer.

struct UserEvent
#include <siptypes.hpp>

This structure describes user event.

Public Members

GenericData user1

User data 1.

GenericData user2

User data 2.

GenericData user3

User data 3.

GenericData user4

User data 4.

struct SipEventBody
#include <siptypes.hpp>

The event body.

Public Members

TimerEvent timer

Timer event.

TsxStateEvent tsxState

Transaction state has changed event.

TxMsgEvent txMsg

Message transmission event.

TxErrorEvent txError

Transmission error event.

RxMsgEvent rxMsg

Message arrival event.

UserEvent user

User event.

struct SipEvent
#include <siptypes.hpp>

This structure describe event descriptor to fully identify a SIP event. It corresponds to the pjsip_event structure in PJSIP library.

Public Functions

SipEvent()

Default constructor.

void fromPj(const pjsip_event &ev)

Construct from PJSIP’s pjsip_event

Public Members

pjsip_event_id_e type

The event type, can be any value of pjsip_event_id_e.

SipEventBody body

The event body, which fields depends on the event type.

void *pjEvent

Pointer to its original pjsip_event. Only valid when the struct is constructed from PJSIP’s pjsip_event.

struct SipMediaType
#include <siptypes.hpp>

SIP media type containing type and subtype. For example, for “application/sdp”, the type is “application” and the subtype is “sdp”.

Public Functions

void fromPj(const pjsip_media_type &prm)

Construct from PJSIP’s pjsip_media_type

pjsip_media_type toPj() const

Convert to PJSIP’s pjsip_media_type.

Public Members

string type

Media type.

string subType

Media subtype.

struct SipHeader
#include <siptypes.hpp>

Simple SIP header.

Public Functions

SipHeader()

Default constructor.

void fromPj(const pjsip_hdr*)

Initiaize from PJSIP header.

pjsip_generic_string_hdr &toPj() const

Convert to PJSIP header.

Public Members

string hName

Header name.

string hValue

Header value.

struct SipMultipartPart
#include <siptypes.hpp>

This describes each multipart part.

Public Functions

void fromPj(const pjsip_multipart_part &prm)

Initiaize from PJSIP’s pjsip_multipart_part.

pjsip_multipart_part &toPj() const

Convert to PJSIP’s pjsip_multipart_part.

Public Members

SipHeaderVector headers

Optional headers to be put in this multipart part.

SipMediaType contentType

The MIME type of the body part of this multipart part.

string body

The body part of tthis multipart part.

struct SipTxOption
#include <siptypes.hpp>

Additional options when sending outgoing SIP message. This corresponds to pjsua_msg_data structure in PJSIP library.

Public Functions

bool isEmpty() const

Check if the options are empty. If the options are set with empty values, there will be no additional information sent with outgoing SIP message.

Returns:

True if the options are empty.

void fromPj(const pjsua_msg_data &prm)

Initiaize from PJSUA’s pjsua_msg_data.

void toPj(pjsua_msg_data &msg_data) const

Convert to PJSUA’s pjsua_msg_data.

Public Members

string targetUri

Optional remote target URI (i.e. Target header). If empty (“”), the target will be set to the remote URI (To header). At the moment this field is only used when sending initial INVITE and MESSAGE requests.

string localUri

Optional local URI (i.e. From header). If empty (“”), the AccountConfig::idUri is used for the From header. At the moment this field is only used when sending initial INVITE and MESSAGE requests.

SipHeaderVector headers

Additional message headers to be included in the outgoing message.

string contentType

MIME type of the message body, if application specifies the messageBody in this structure.

string msgBody

Optional message body to be added to the message, only when the message doesn’t have a body.

SipMediaType multipartContentType

Content type of the multipart body. If application wants to send multipart message bodies, it puts the parts in multipartParts and set the content type in multipartContentType. If the message already contains a body, the body will be added to the multipart bodies.

SipMultipartPartVector multipartParts

Array of multipart parts. If application wants to send multipart message bodies, it puts the parts in parts and set the content type in multipart_ctype. If the message already contains a body, the body will be added to the multipart bodies.

struct SendInstantMessageParam
#include <siptypes.hpp>

This structure contains parameters for sending instance message methods, e.g: Buddy::sendInstantMessage(), Call:sendInstantMessage().

Public Functions

SendInstantMessageParam()

Default constructor initializes with zero/empty values.

Public Members

string contentType

MIME type. Default is “text/plain”.

string content

The message content.

SipTxOption txOption

List of headers etc to be included in outgoing request.

Token userData

User data, which will be given back when the IM callback is called.

struct SendTypingIndicationParam
#include <siptypes.hpp>

This structure contains parameters for sending typing indication methods, e.g: Buddy::sendTypingIndication(), Call:sendTypingIndication().

Public Functions

SendTypingIndicationParam()

Default constructor initializes with zero/empty values.

Public Members

bool isTyping

True to indicate to remote that local person is currently typing an IM.

SipTxOption txOption

List of headers etc to be included in outgoing request.