Group PJSUA2_Call_Data_Structure

group PJSUA2_Call_Data_Structure

Typedefs

typedef void *MediaStream

Media stream, corresponds to pjmedia_stream

typedef void *MediaTransport

Media transport, corresponds to pjmedia_transport

typedef IntVector MediaDirVector

Array of media direction

typedef std::vector<CallMediaInfo> CallMediaInfoVector

Array of call media info

struct MathStat
#include <call.hpp>

This structure describes statistics state.

Public Functions

MathStat()

Default constructor

void fromPj(const pj_math_stat &prm)

Convert from pjsip

Public Members

int n

number of samples

int max

maximum value

int min

minimum value

int last

last value

int mean

mean

struct LossType
#include <call.hpp>

Types of loss detected.

Public Members

unsigned burst

Burst/sequential packet lost detected

unsigned random

Random packet lost detected.

struct RtcpStreamStat
#include <call.hpp>

Unidirectional RTP stream statistics.

Public Functions

void fromPj(const pjmedia_rtcp_stream_stat &prm)

Convert from pjsip

Public Members

TimeVal update

Time of last update.

unsigned updateCount

Number of updates (to calculate avg)

unsigned pkt

Total number of packets

unsigned bytes

Total number of payload/bytes

unsigned discard

Total number of discarded packets.

unsigned loss

Total number of packets lost

unsigned reorder

Total number of out of order packets

unsigned dup

Total number of duplicates packets

MathStat lossPeriodUsec

Loss period statistics

LossType lossType

Types of loss detected.

MathStat jitterUsec

Jitter statistics

struct RtcpSdes
#include <call.hpp>

RTCP SDES structure.

Public Functions

void fromPj(const pjmedia_rtcp_sdes &prm)

Convert from pjsip

Public Members

string cname

RTCP SDES type CNAME.

string name

RTCP SDES type NAME.

string email

RTCP SDES type EMAIL.

string phone

RTCP SDES type PHONE.

string loc

RTCP SDES type LOC.

string tool

RTCP SDES type TOOL.

string note

RTCP SDES type NOTE.

struct RtcpStat
#include <call.hpp>

Bidirectional RTP stream statistics.

Public Functions

void fromPj(const pjmedia_rtcp_stat &prm)

Convert from pjsip

Public Members

TimeVal start

Time when session was created

RtcpStreamStat txStat

Encoder stream statistics.

RtcpStreamStat rxStat

Decoder stream statistics.

MathStat rttUsec

Round trip delay statistic.

pj_uint32_t rtpTxLastTs

Last TX RTP timestamp.

pj_uint16_t rtpTxLastSeq

Last TX RTP sequence.

MathStat rxIpdvUsec

Statistics of IP packet delay variation in receiving direction. It is only used when PJMEDIA_RTCP_STAT_HAS_IPDV is set to non-zero.

MathStat rxRawJitterUsec

Statistic of raw jitter in receiving direction. It is only used when PJMEDIA_RTCP_STAT_HAS_RAW_JITTER is set to non-zero.

RtcpSdes peerSdes

Peer SDES.

struct JbufState
#include <call.hpp>

This structure describes jitter buffer state.

Public Functions

void fromPj(const pjmedia_jb_state &prm)

Convert from pjsip

Public Members

unsigned frameSize

Individual frame size, in bytes.

unsigned minPrefetch

Minimum allowed prefetch, in frms.

unsigned maxPrefetch

Maximum allowed prefetch, in frms.

unsigned burst

Current burst level, in frames

unsigned prefetch

Current prefetch value, in frames

unsigned size

Current buffer size, in frames.

unsigned avgDelayMsec

Average delay, in ms.

unsigned minDelayMsec

Minimum delay, in ms.

unsigned maxDelayMsec

Maximum delay, in ms.

unsigned devDelayMsec

Standard deviation of delay, in ms.

unsigned avgBurst

Average burst, in frames.

unsigned lost

Number of lost frames.

unsigned discard

Number of discarded frames.

unsigned empty

Number of empty on GET events.

struct SdpSession
#include <call.hpp>

This structure describes SDP session description. It corresponds to the pjmedia_sdp_session structure.

Public Functions

void fromPj(const pjmedia_sdp_session &sdp)

Convert from pjsip

Public Members

string wholeSdp

The whole SDP as a string.

void *pjSdpSession

Pointer to its original pjmedia_sdp_session. Only valid when the struct is converted from PJSIP’s pjmedia_sdp_session.

struct MediaTransportInfo
#include <call.hpp>

This structure describes media transport informations. It corresponds to the pjmedia_transport_info structure. The address name field can be empty string if the address in the pjmedia_transport_info is invalid.

Public Functions

void fromPj(const pjmedia_transport_info &info)

Convert from pjsip

Public Members

SocketAddress localRtpName

Address to be advertised as the local address for the RTP socket, which does not need to be equal as the bound address (for example, this address can be the address resolved with STUN).

SocketAddress localRtcpName

Address to be advertised as the local address for the RTCP socket, which does not need to be equal as the bound address (for example, this address can be the address resolved with STUN).

SocketAddress srcRtpName

Remote address where RTP originated from. This can be empty string if no data is received from the remote.

SocketAddress srcRtcpName

Remote address where RTCP originated from. This can be empty string if no data is recevied from the remote.

struct CallSetting
#include <call.hpp>

Call settings.

Public Functions

CallSetting(bool useDefaultValues = false)

Default constructor initializes with empty or default values.

bool isEmpty() const

Check if the settings are set with empty values.

Returns:

True if the settings are empty.

void fromPj(const pjsua_call_setting &prm)

Convert from pjsip

pjsua_call_setting toPj() const

Convert to pjsip

Public Members

unsigned flag

Bitmask of pjsua_call_flag constants.

Default: PJSUA_CALL_INCLUDE_DISABLED_MEDIA

unsigned reqKeyframeMethod

This flag controls what methods to request keyframe are allowed on the call. Value is bitmask of pjsua_vid_req_keyframe_method.

Default: PJSUA_VID_REQ_KEYFRAME_SIP_INFO | PJSUA_VID_REQ_KEYFRAME_RTCP_PLI

unsigned audioCount

Number of simultaneous active audio streams for this call. Setting this to zero will disable audio in this call.

Default: 1

unsigned videoCount

Number of simultaneous active video streams for this call. Setting this to zero will disable video in this call.

Default: 1 (if video feature is enabled, otherwise it is zero)

MediaDirVector mediaDir

Media direction. This setting will only be used if the flag PJSUA_CALL_SET_MEDIA_DIR is set, and it will persist for subsequent offers or answers. For example, a media that is set as PJMEDIA_DIR_ENCODING can only mark the stream in the SDP as sendonly or inactive, but will not become sendrecv in subsequent offers and answers. Application can update the media direction in any API or callback that accepts CallSetting as a parameter, such as via Call::reinvite/update() or in onCallRxOffer/Reinvite() callback.

The index of the media dir will correspond to the provisional media in CallInfo.provMedia. For offers that involve adding new medias (such as initial offer), the index will correspond to all new audio media first, then video. For example, for a new call with 2 audios and 1 video, mediaDir[0] and mediaDir[1] will be for the audios, and mediaDir[2] video.

Default: empty vector

string customCallId

User defined Call-ID to be sent out with outgoing INVITE.

Note: It is up to the developer to verify uniqueness of the Call-ID as there will be no verification. The developer must change the Call-ID between calls creating a unique id for each outgoing call.

This setting will only be used when creating a new outgoing call via Call::makeCall().

struct CallMediaInfo
#include <call.hpp>

Call media information.

Application can query conference bridge port of this media using Call::getAudioMedia() if the media type is audio, or Call::getEncodingVideoMedia() / Call::getDecodingVideoMedia() if the media type is video.

Public Functions

CallMediaInfo()

Default constructor

void fromPj(const pjsua_call_media_info &prm)

Convert from pjsip

Public Members

unsigned index

Media index in SDP.

pjmedia_type type

Media type.

pjmedia_dir dir

Media direction.

pjsua_call_media_status status

Call media status.

int audioConfSlot

Warning: this is deprecated, application can query conference bridge port of this media using Call::getAudioMedia().

The conference port number for the call. Only valid if the media type is audio.

pjsua_vid_win_id videoIncomingWindowId

The window id for incoming video, if any, or PJSUA_INVALID_ID. Only valid if the media type is video.

VideoWindow videoWindow

The video window instance for incoming video. Only valid if videoIncomingWindowId is not PJSUA_INVALID_ID and the media type is video.

pjmedia_vid_dev_index videoCapDev

The video capture device for outgoing transmission, if any, or PJMEDIA_VID_INVALID_DEV. Only valid if the media type is video.

struct CallInfo
#include <call.hpp>

Call information. Application can query the call information by calling Call::getInfo().

Public Functions

inline CallInfo()

Default constructor

void fromPj(const pjsua_call_info &pci)

Convert from pjsip

Public Members

pjsua_call_id id

Call identification.

pjsip_role_e role

Initial call role (UAC == caller)

pjsua_acc_id accId

The account ID where this call belongs.

string localUri

Local URI

string localContact

Local Contact

string remoteUri

Remote URI

string remoteContact

Remote contact

string callIdString

Dialog Call-ID string.

CallSetting setting

Call setting

pjsip_inv_state state

Call state

string stateText

Text describing the state

pjsip_status_code lastStatusCode

Last status code heard, which can be used as cause code

string lastReason

The reason phrase describing the last status.

CallMediaInfoVector media

Array of active media information.

CallMediaInfoVector provMedia

Array of provisional media information. This contains the media info in the provisioning state, that is when the media session is being created/updated (SDP offer/answer is on progress).

TimeVal connectDuration

Up-to-date call connected duration (zero when call is not established)

TimeVal totalDuration

Total call duration, including set-up time

bool remOfferer

Flag if remote was SDP offerer

unsigned remAudioCount

Number of audio streams offered by remote

unsigned remVideoCount

Number of video streams offered by remote

struct StreamInfo
#include <call.hpp>

Media stream info.

Public Functions

inline StreamInfo()

Default constructor

void fromPj(const pjsua_stream_info &info)

Convert from pjsip

Public Members

pjmedia_type type

Media type of this stream.

pjmedia_tp_proto proto

Transport protocol (RTP/AVP, etc.)

pjmedia_dir dir

Media direction.

SocketAddress remoteRtpAddress

Remote RTP address

SocketAddress remoteRtcpAddress

Optional remote RTCP address

unsigned txPt

Outgoing codec payload type.

unsigned rxPt

Incoming codec payload type.

int audTxEventPt

Outgoing pt for audio telephone-events.

int audRxEventPt

Incoming pt for audio telephone-events.

string codecName

Codec name.

unsigned codecClockRate

Codec clock rate.

CodecParam audCodecParam

Optional audio codec param.

VidCodecParam vidCodecParam

Optional video codec param.

int jbInit

Jitter buffer init delay in msec.

int jbMinPre

Jitter buffer minimum prefetch delay in msec.

int jbMaxPre

Jitter buffer maximum prefetch delay in msec.

int jbMax

Jitter buffer max delay in msec.

pjmedia_jb_discard_algo jbDiscardAlgo

Jitter buffer discard algorithm.

bool rtcpSdesByeDisabled

Disable automatic sending of RTCP SDES and BYE.

struct StreamStat
#include <call.hpp>

Media stream statistic.

Public Functions

void fromPj(const pjsua_stream_stat &prm)

Convert from pjsip

Public Members

RtcpStat rtcp

RTCP statistic.

JbufState jbuf

Jitter buffer statistic.

struct OnCallStateParam
#include <call.hpp>

This structure contains parameters for Call::onCallState() callback.

Public Members

SipEvent e

Event which causes the call state to change.

struct OnCallTsxStateParam
#include <call.hpp>

This structure contains parameters for Call::onCallTsxState() callback.

Public Members

SipEvent e

Transaction event that caused the state change.

struct OnCallMediaStateParam
#include <call.hpp>

This structure contains parameters for Call::onCallMediaState() callback.

struct OnCallSdpCreatedParam
#include <call.hpp>

This structure contains parameters for Call::onCallSdpCreated() callback.

Public Members

SdpSession sdp

The SDP has just been created.

SdpSession remSdp

The remote SDP, will be empty if local is SDP offerer.

struct OnStreamPreCreateParam
#include <call.hpp>

This structure contains parameters for Call::onStreamPreCreate() callback.

Public Members

unsigned streamIdx

Stream index in the media session, read-only.

StreamInfo streamInfo

Parameters that the stream will be created from.

struct OnStreamCreatedParam
#include <call.hpp>

This structure contains parameters for Call::onStreamCreated() callback.

Public Members

MediaStream stream

Audio media stream, read-only.

unsigned streamIdx

Stream index in the audio media session, read-only.

bool destroyPort

Specify if PJSUA2 should take ownership of the port returned in the pPort parameter below. If set to true, pjmedia_port_destroy() will be called on the port when it is no longer needed.

Default: false

MediaPort pPort

On input, it specifies the audio media port of the stream. Application may modify this pointer to point to different media port to be registered to the conference bridge.

struct OnStreamDestroyedParam
#include <call.hpp>

This structure contains parameters for Call::onStreamDestroyed() callback.

Public Members

MediaStream stream

Audio media stream.

unsigned streamIdx

Stream index in the audio media session.

struct OnDtmfDigitParam
#include <call.hpp>

This structure contains parameters for Call::onDtmfDigit() callback.

Public Members

pjsua_dtmf_method method

DTMF sending method.

string digit

DTMF ASCII digit.

unsigned duration

DTMF signal duration. If the duration is unknown, this value is set to PJSUA_UNKNOWN_DTMF_DURATION.

struct OnDtmfEventParam
#include <call.hpp>

This structure contains parameters for Call::onDtmfEvent() callback.

Public Members

pjsua_dtmf_method method

DTMF sending method.

unsigned timestamp

The timestamp identifying the begin of the event. Timestamp units are expressed in milliseconds. Note that this value should only be used to compare multiple events received via the same method relatively to each other, as the time-base is randomized.

string digit

DTMF ASCII digit.

unsigned duration

DTMF signal duration in milliseconds. Interpretation of the duration depends on the flag PJMEDIA_STREAM_DTMF_IS_END. depends on the method. If the method is PJSUA_DTMF_METHOD_SIP_INFO, this contains the total duration of the DTMF signal or PJSUA_UNKNOWN_DTMF_DURATION if no signal duration was indicated. If the method is PJSUA_DTMF_METHOD_RFC2833, this contains the total duration of the DTMF signal received up to this point in time.

unsigned flags

Flags indicating additional information about the DTMF event. If PJMEDIA_STREAM_DTMF_IS_UPDATE is set, the event was already indicated earlier. The new indication contains an updated event duration. If PJMEDIA_STREAM_DTMF_IS_END is set, the event has ended and this indication contains the final event duration. Note that end indications might get lost. Hence it is not guaranteed to receive an event with PJMEDIA_STREAM_DTMF_IS_END for every event.

struct OnCallTransferRequestParam
#include <call.hpp>

This structure contains parameters for Call::onCallTransferRequest() callback.

Public Members

string dstUri

The destination where the call will be transferred to.

pjsip_status_code statusCode

Status code to be returned for the call transfer request. On input, it contains status code 202.

CallSetting opt

The current call setting, application can update this setting for the call being transferred.

Call *newCall

New Call derived object instantiated by application when the call transfer is about to be accepted.

struct OnCallTransferStatusParam
#include <call.hpp>

This structure contains parameters for Call::onCallTransferStatus() callback.

Public Members

pjsip_status_code statusCode

Status progress of the transfer request.

string reason

Status progress reason.

bool finalNotify

If true, no further notification will be reported. The statusCode specified in this callback is the final status.

bool cont

Initially will be set to true, application can set this to false if it no longer wants to receive further notification (for example, after it hangs up the call).

struct OnCallReplaceRequestParam
#include <call.hpp>

This structure contains parameters for Call::onCallReplaceRequest() callback.

Public Members

SipRxData rdata

The incoming INVITE request to replace the call.

pjsip_status_code statusCode

Status code to be set by application. Application should only return a final status (>= PJSIP_SC_OK (200))

string reason

Optional status text to be set by application.

CallSetting opt

The current call setting, application can update this setting for the call being replaced.

Call *newCall

New Call derived object instantiated by application.

struct OnCallReplacedParam
#include <call.hpp>

This structure contains parameters for Call::onCallReplaced() callback.

Public Members

pjsua_call_id newCallId

The new call id.

Call *newCall

New Call derived object instantiated by application.

struct OnCallRxOfferParam
#include <call.hpp>

This structure contains parameters for Call::onCallRxOffer() callback.

Public Members

SdpSession offer

The new offer received.

pjsip_status_code statusCode

Status code to be returned for answering the offer. On input, it contains status code PJSIP_SC_OK (200). Currently, valid values are only PJSIP_SC_OK (200) and PJSIP_SC_NOT_ACCEPTABLE_HERE (488).

CallSetting opt

The current call setting, application can update this setting for answering the offer.

struct OnCallRxReinviteParam
#include <call.hpp>

This structure contains parameters for Call::onCallRxReinvite() callback.

Public Members

SdpSession offer

The new offer received.

SipRxData rdata

The incoming re-INVITE.

bool isAsync

On input, it is false. Set to true if app wants to manually answer the re-INVITE.

pjsip_status_code statusCode

Status code to be returned for answering the offer. On input, it contains status code PJSIP_SC_OK (200). Currently, valid values are only PJSIP_SC_OK (200) and PJSIP_SC_NOT_ACCEPTABLE_HERE (488).

CallSetting opt

The current call setting, application can update this setting for answering the offer.

struct OnCallTxOfferParam
#include <call.hpp>

This structure contains parameters for Call::onCallTxOffer() callback.

Public Members

CallSetting opt

The current call setting, application can update this setting for generating the offer. Note that application should maintain any active media to avoid the need for the peer to reject the offer.

struct OnCallRedirectedParam
#include <call.hpp>

This structure contains parameters for Call::onCallRedirected() callback.

Public Members

string targetUri

The current target to be tried.

SipEvent e

The event that caused this callback to be called. This could be the receipt of 3xx response, or 4xx/5xx response received for the INVITE sent to subsequent targets, or empty (e.type == PJSIP_EVENT_UNKNOWN) if this callback is called from within Call::processRedirect() context.

struct OnCallMediaEventParam
#include <call.hpp>

This structure contains parameters for Call::onCallMediaEvent() callback.

Public Members

unsigned medIdx

The media stream index.

MediaEvent ev

The media event.

struct OnCallMediaTransportStateParam
#include <call.hpp>

This structure contains parameters for Call::onCallMediaTransportState() callback.

Public Members

unsigned medIdx

The media index.

pjsua_med_tp_st state

The media transport state

pj_status_t status

The last error code related to the media transport state.

int sipErrorCode

Optional SIP error code.

struct OnCreateMediaTransportParam
#include <call.hpp>

This structure contains parameters for Call::onCreateMediaTransport() callback.

Public Members

unsigned mediaIdx

The media index in the SDP for which this media transport will be used.

MediaTransport mediaTp

The media transport which otherwise will be used by the call has this callback not been implemented. Application can change this to its own instance of media transport to be used by the call.

unsigned flags

Bitmask from pjsua_create_media_transport_flag.

struct OnCreateMediaTransportSrtpParam
#include <call.hpp>

This structure contains parameters for Call::onCreateMediaTransportSrtp() callback.

Public Members

unsigned mediaIdx

The media index in the SDP for which the SRTP media transport will be used.

pjmedia_srtp_use srtpUse

Specify whether secure media transport should be used. Application can modify this only for initial INVITE. Valid values are PJMEDIA_SRTP_DISABLED, PJMEDIA_SRTP_OPTIONAL, and PJMEDIA_SRTP_MANDATORY.

SrtpCryptoVector cryptos

Application can modify this to specify the cryptos and keys which are going to be used.