API Reference

Library types

typedef uint32_t AccountId

Contains unique Id of the account assigned by library Account_Add(). Initial value starts from 1.

typedef uint32_t CallId

Contains unique Id of the call assigned by library in the method Call_Invite(). Initial value starts from 200.

typedef uint32_t PlayerId

Contains unique Id of the player assigned by library in the method Call_PlayFile().

typedef uint32_t MessageId

Contains unique Id of the message assigned by library in the method Message_Send().

typedef uint32_t SubscriptionId

Contains unique Id of the subscription assigned by library in the method Subscription_Create().

struct AccData

Internal struct used by library for storing account’s attributes. It’s created by invoking Acc_GetDefault() and used as argument of methods: Account_Add(), Account_Update(). List of available attributes see: Account attributes functions.

struct IniData

Internal struct used by library for storing initialization attributes. It’s created by invoking Ini_GetDefault() and used as argument of method: Module_Initialize(). List of available attributes see: Module init attributes functions.

struct DestData

Internal struct used by library for storing call destination attributes. It’s created by invoking Dest_GetDefault() and used as argument of method: Call_Invite(). List of available attributes see: Call destination attributes functions.

struct SubscrData

Internal struct used by library for storing subscription attributes. It’s created by invoking Subscr_GetDefault() and used as argument of method: Subscription_Create(). List of available attributes see: Subscription attributes functions.

struct MsgData

Internal struct used by library for storing message attributes. It’s created by invoking Msg_GetDefault() and used as argument of method: Message_Send(). List of available attributes see: Messages attributes functions.

struct VideoData

Internal struct used by library for storing video device attributes. It’s created by invoking Vdo_GetDefault() and used as argument of method: Dvc_SetVideoParams(). List of available attributes see: Video device attributes functions.

Module management functions

ISiprixModule *Module_Create();

Allocates internal singleton structures. Returned value is using as argument of almost all management methods. See also Create.

ErrorCode Module_Initialize(ISiprixModule *module, IniData *ini);

Initializes created module. See also Initialize and Example of module lifecycle implementation in C++ application..

ErrorCode Module_UnInitialize(ISiprixModule *module);

Uninitializes created module. See also UnInitialize.

bool Module_IsInitialized(ISiprixModule *module);

Returns true if module has already been initialized and false otherwise.

const char *Module_HomeFolder(ISiprixModule *module);

Returns string with path to the folder, which was created on initialziation stage and where library stores log files. App should invoke this method when module already initialized. See also Ini_SetHomeFolder()

const char *Module_Version(ISiprixModule *module);

Returns string with library version.

Example: Siprix: 1.0.0 from 20240721_2033. Series of digits in the end of version string means timestamp, generated automatically on build stage in format ‘%Y%m%d_%H%M%S’.

uint32_t Module_VersionCode(ISiprixModule *module);

Returns integer number which means library API version. Incremented in case of API changes.

void Module_WriteLog(ISiprixModule *module, const char *text);

Writes the text argument to SDKs log file.

Account functions

ErrorCode Account_Add(ISiprixModule *module, AccData *acc, AccountId *accId);

Adds new account. Account has to have unique extension@domain. See also Example of adding account in C++ application..

ErrorCode Account_Update(ISiprixModule *module, AccData *acc, AccountId accId);

Updates attributes of the existing account specified by accId and automatically refreshes registration if required.

Important

Library doesn’t allow to modify extension, domain, transport attributes of the account. When app needs to change these attributes, it has to remove existing account and add new one.

ErrorCode Account_GetRegState(ISiprixModule *module, AccountId accId, RegState *state);

Gets registration state of the existing account, specified by accId. When account with accId doesn’t exist method returns ErrorCode::EAccountNotFound.

ErrorCode Account_Register(ISiprixModule *module, AccountId accId, uint32_t expireTime);

Refreshes registration of the existing account specified by accId.

Sends REGISTER request with header Expires: expireTime. Argument expireTime means number of seconds during which PBX will remember that account. When received response library raises ISiprixEventHandler::OnAccountRegState().

See also: Edit (update) account.

ErrorCode Account_Unregister(ISiprixModule *module, AccountId accId);

Removes registration of the existing account specified by accId. Sends REGISTER request with header Expires: 0. See also: Edit (update) account.

ErrorCode Account_Delete(ISiprixModule *module, AccountId accId);

Deletes existing account specified by accId.

Call functions

ErrorCode Call_Invite(ISiprixModule *module, DestData *destination, CallId *callId);

Initiates outgoing call.

ErrorCode Call_Reject(ISiprixModule *module, CallId callId, uint16_t statusCode);

Rejects incoming call.

Parameters:

statusCode – code which should be send in SIP request. Recommended value is 486 - “Busy now”.

ErrorCode Call_Accept(ISiprixModule *module, CallId callId, bool withVideo);

Accepts incoming call.

Parameters:

withVideo – when set to true and remote side has offered call with video - library will negotiate call with video. When set to false call will be accepted as audio only.

ErrorCode Call_Hold(ISiprixModule *module, CallId callId);

Toggles hold state of the call specified by callId.

Note

This method sends initial request. Final hold state switched when received response and raised ISiprixEventHandler::OnCallHeld().

ErrorCode Call_GetHoldState(ISiprixModule *module, CallId callId, HoldState *state);

Set actual hold state of the call specified by callId to the argument state .

ErrorCode Call_GetVideoState(ISiprixModule *module, CallId callId, bool *hasVideo);

Set true to the argument hasVideo when call specified by callId has video media.

ErrorCode Call_GetSipHeader(ISiprixModule *module, CallId callId, const char *hdrName, char *hdrVal, uint32_t *hdrValLen);

Searches SIP header hdrName in the last received SIP request/response and returns its value. When header not found - returns ErrorCode::ESipHeaderNotFound.

Parameters:
  • callId – Id of the call, whose message need to use.

  • hdrName – string with name of the header. When this argument is null or empty library returns whole SIP message.

  • hdrVal – buffer where to copy found header value. When this param is null library set value of hdrValLen with lenght required for copy found result (not includes zero terminating null character).

  • hdrValLen – in/out param. App set its value with actual lenght of the hdrVal buffer.

ErrorCode Call_GetStats(ISiprixModule *module, CallId callId, char *statsVal, uint32_t *statsValLen);

Retrieves statistics data of the call as json string. When call not found - returns ErrorCode::ECallNotFound.

Parameters:
  • callId – Id of the call, whose stats need to retrieve.

  • statsVal – buffer where to copy stats data. When this param is null library set value of statsValLen with lenght required for copy found result (not includes zero terminating null character). It’s recommended to alloc buffer with lenght 2000 bytes, which is typically enough and allows to collects statistics only once.

  • statsValLen – in/out param. App set its value with actual lenght of the statsVal buffer.

Example of returned statsVal result:

[
  {
    "type": "inbound-rtp",
    "ssrc": 891498398,
    "mediaType": "audio",
    "jitter": 0,
    "packetsLost": 0,
    "packetsReceived": 746,
    "packetsDiscarded": 0,
    "bytesReceived": 28200,
    "headerBytesReceived": 8952,
    "jitterBufferDelay": 129628.8,
    "jitterBufferMinimumDelay": 182880,
    "jitterBufferEmittedCount": 706560,
    "totalSamplesReceived": 758880,
    "totalSamplesDuration": 15.80999999999971,
    "relativePacketArrivalDelay": 9.89
  },
  {
    "type": "inbound-rtp",
    "ssrc": 5149939,
    "mediaType": "video",
    "jitter": 0.066,
    "packetsLost": 0,
    "packetsReceived": 634,
    "bytesReceived": 624555,
    "headerBytesReceived": 7608,
    "jitterBufferDelay": 7.743,
    "jitterBufferEmittedCount": 173,
    "frameWidth": 640,
    "frameHeight": 480,
    "framesPerSecond": 15,
    "framesDecoded": 174,
    "keyFramesDecoded": 1,
    "framesDropped": 0,
    "nackCount": 0
  },
  {
    "type": "outbound-rtp",
    "ssrc": 2477746153,
    "mediaType": "audio",
    "packetsSent": 792,
    "retransmittedPacketsSent": 0,
    "bytesSent": 30276,
    "headerBytesSent": 9504,
    "retransmittedBytesSent": 0,
    "targetBitrate": 32000,
    "totalPacketSendDelay": 0,
    "nackCount": 0
  },
  {
    "type": "outbound-rtp",
    "ssrc": 1819531209,
    "mediaType": "video",
    "packetsSent": 640,
    "retransmittedPacketsSent": 0,
    "bytesSent": 629731,
    "headerBytesSent": 7680,
    "retransmittedBytesSent": 0,
    "targetBitrate": 565572,
    "framesEncoded": 225,
    "keyFramesEncoded": 2,
    "totalEncodeTime": 0.298,
    "frameWidth": 640,
    "frameHeight": 480,
    "framesPerSecond": 15,
    "framesSent": 225,
    "totalPacketSendDelay": 3.229,
    "nackCount": 0
  }
]

See detailed explanation of the stats fields here: https://www.w3.org/TR/webrtc-stats/#dictionary-rtcinboundrtpstreamstats-members

ErrorCode Call_StopRingtone(ISiprixModule *module);

Stops playing ringtone. Doesn’t accept nor reject incoming call.

ErrorCode Call_MuteMic(ISiprixModule *module, CallId callId, bool mute);

Toggles microphone mute state of the call specified by callId. Method mutes microphone only for specified call on mixer level and doesn’t affect other calls.

ErrorCode Call_MuteCam(ISiprixModule *module, CallId callId, bool mute);

Toggles camera mute state of the call specified by callId. Method mutes camera only for specified call and doesn’t affect other calls.

ErrorCode Call_SendDtmf(ISiprixModule *module, CallId callId, const char *dtmfs, uint16_t durationMs, uint16_t intertoneGapMs, DtmfMethod method);

Sends sequence of DTMF tones using specified parameters.

Parameters:
  • callId – Id of the call, where to send tone(s). Call should be in the Connected state.

  • dtmfs – string with tones to send. Example: “1”, “*”, “123456#”.

  • durationMs – duration of the each tone in sequence. Recommended value 200 ms.

  • intertoneGapMs – duration of pause between tones. Recommended value 50 ms.

  • method – method of sending tones. See DtmfMethod.

Note

If application invokes this method when sending previous tone(s) hasn’t finished yet - library will put new sequence to internal queue and send later.

ErrorCode Call_PlayTone(ISiprixModule *module, CallId callId, const char *tone, uint16_t durationMs, PlayerId *playerId);

Generates sound of the tone and plays to the specified call of locally.

Parameters:
  • callId – Id of the call, where to play sound from file. Call should be in the Connected state. When this value set to 0 - SDK will play tone on the local speaker.

  • tone – tone to play. Supported tones are: “0”, “1”, “2”, …, “9”, “A”, “B”, “C”, “D”, “*”, “#”, “busy”, “fastbusy”, “failed”, “backspace”, “wait”, “held”;

  • durationMs – durating of the tone. Should be in range 250..10000.

  • playerId – unique id of the player assigned by library.

ErrorCode Call_PlayFile(ISiprixModule *module, CallId callId, const char *pathToMp3File, bool loop, PlayerId *playerId);

Plays sound from file to remote side of the call.

Note

Library allows to invoke this method few times which will cause playing few files simultaneously.

Parameters:
  • callId – Id of the call, where to play sound from file. Call should be in the Connected state.

  • pathToMp3File – path to mp3 file. Library decodes it by demand without intermediate wav files.

  • loop – when set to true library will play this file until app stops it by Call_StopPlayFile().

  • playerId – unique id of the player assigned by library.

Note

If application invokes this method when previous file(s) are still playing - library will play few files simultaneously and mix them along with the sound from microphone.

Note

If application set parameter callId = 0 AND library has at least one call it will play sound from file to local speaker.

ErrorCode Call_StopPlayFile(ISiprixModule *module, PlayerId playerId);

Stops playing file started by Call_PlayFile().

Parameters:

playerId – application has to use value returned by Call_PlayFile().

ErrorCode Call_RecordFile(ISiprixModule *module, CallId callId, const char *pathToMp3File);

Starts recording sent/received sound of the call to the specified file. Depending on the option Ini_SetRecordStereo() library mixes sent and received sound to single track or writes as separate channels.

ErrorCode Call_StopRecordFile(ISiprixModule *module, CallId callId);

Stops recording file started by Call_RecordFile().

ErrorCode Call_TransferBlind(ISiprixModule *module, CallId callId, const char *toExt);

Transfers call to the specified extension.

This method sends initial REFER request. After invoke this method application has to set call’s state as Transferring

When received response library raises ISiprixEventHandler::OnCallTransferred().

ErrorCode Call_TransferAttended(ISiprixModule *module, CallId fromCallId, CallId toCallId);

Transfers one call to the specified second call. This method is usable in case when host has to speak with two different peoples and after that join them together.

This method sends initial REFER request. After invoke this method application has to set call’s state as Transferring

When received response library raises ISiprixEventHandler::OnCallTransferred().

ErrorCode Call_SetVideoWindow(ISiprixModule *module, CallId callId, void *wnd);

Set video window where call will render received video.

Parameters:

wnd – this parameter depends on the platform. For Windows it’s HWND, for iOS - UIView, for MacOS - NSView.

Note

Library doesn’t allow to set same window for different calls. If application created single window for displaying received video, established few calls and needs to display video of the switched call - it has to set null as renderer of the previous call and handle as renderer of switched call.

Example how to set video window when call switched
void onCalls_PropertyChanged(...)
{
    if(e.PropertyName == nameof(CallsListModel.SwitchedCall))
    {
        //Unset window for previous call
        if (callModel_ != null)  callModel_.SetVideoWindow(IntPtr.Zero);

        //Get newly switched calls
        callModel_  = Siprix.ObjModel.Instance.Calls.SwitchedCall;

        //Set the same window for new call
        if (callModel_ != null)  callModel_.SetVideoWindow(receivedVideoHost_.Hwnd);
    }
}
ErrorCode Call_SetVideoRenderer(ISiprixModule *module, CallId callId, IVideoRenderer *r);

Set own handler which will received decoded video frames and render them.

ErrorCode Call_Renegotiate(ISiprixModule *module, CallId callId);

Renegotiates media transport. Added for testing cases when device/computer loses network connection and library established call(s).

Application should not invoke this method and library detects restoring network connection and automatically renegotiates calls if possible.

ErrorCode Call_Bye(ISiprixModule *module, CallId callId);

Ends existing call.

This method sends BYE or CANCEL request. After invoke this method application has to set call’s state as Disconnecting. See also: Call lifecycle

When received response library raises ISiprixEventHandler::OnCallTerminated().

ErrorCode Call_UpgradeToVideo(ISiprixModule *module, CallId callId);

Upgrade audio call to audio+video.

This method sends INVITE request with updated SDP containing video media.

When received response library raises ISiprixEventHandler::OnCallVideoUpgraded().

ErrorCode Call_AcceptVideoUpgrade(ISiprixModule *module, CallId callId, bool withVideo);

Accept or reject request to upgrade call to audio+video.

App should invoke this method only in the ISiprixEventHandler::OnCallVideoUpgradeRequested() event handler. This event triggered only when configured manual mode of the video upgrade, see more: Acc_SetUpgradeToVideoMode().

Parameters:
  • callId – Id of the call, where requested upgrade.

  • withVideo – set it to true for accept upgrade or false to reject upgrade and continue audio only mode.

Mixer functions

Library has internal mixer which routes sound between multiple calls, file players, recorders and audio devices. Current version of library provides following methods of manipulating mixer state:

ErrorCode Mixer_SwitchToCall(ISiprixModule *module, CallId callId);

Set as switched call, specified by callId. Application can invoke this method in the any state of the call as actual implementation just modifies mixer gains. As result of invoking this method library raises event ISiprixEventHandler::OnCallSwitched().

Note

Library allows to establish multiple calls, but only one of them has audio focus - ability to send sound from microphone to the remote side and play received sound to speaker. It’s called switched call. For all other (normal) calls library can send/play sound from file and record received sound to file.

When one of calls ends and other call(s) exist library automatically switches to the last established call.

Differences between normal call and call on hold:

  • Call on hold means call with stopped media streams (it doesn’t send/receive RTP packets).

  • Normal call doesn’t have access to microphone/speaker, but its media streams are flowing (it sends/receives RTP packets).

Important

As stated above, media streams of the normal calls are flowing, which produces following effect: when library established few calls with video, user(s) on remote side will be able to see video from local camera same as local user can see remote video (when set renderer for it).

If this effect is undesirable - put call on hold (see Call_Hold()) or mute camera for normal calls (see Call_MuteCam()).

ErrorCode Mixer_MakeConference(ISiprixModule *module);

Switches mixer gains in way when all calls can hear each other.

In this mode application hosts conference (receives multiple audio streams, mixes them and sends back).

Example how it works: when application has 3 connected calls CallA, CallB, CallC and invokes this method, library switches mixer’s gains and starts mixing sound in the following way:

  • CallA - will receive sound from local microphone + CallB + CallC;

  • CallB - will receive sound from local microphone + CallA + CallB;

  • CallC - will receive sound from local microphone + CallB + CallC;

  • Local speaker - will play sound received from CallA + CallB + CallC;

Note

This method doesn’t have any impact on the video streams of established calls.

ErrorCode Mixer_MuteInput(ISiprixModule *module, CallId fromInput, CallId toOutput, bool mute);

Mutes/unmutes input specified by fromInput in direction to output, specified by toOutput.

As example of using this method can be use-case “Whisper”.

It reproduced when application is running on agent’s computer, he is speaking with Client (CallId_C), receives call from Manager (CallId_M) and needs to accepts this call, joins both calls into conference and configure:

  • Agent can hear both: Manager and Client;

  • Manager can hear both: Agent and ClientC;

  • Client can hear only Agent;

As conference is hosting by Agent, he can configure library’s mixer by invoking: Mixer_MuteInput(_, CallId_M, CallId_C);

Attention

This method will be added in future library builds.

Messages functions

Library has ability to send/receive text messages using SIP MESSAGE request. For sending use method:

ErrorCode Message_Send(ISiprixModule *module, MsgData *msg, MessageId *messageId);

Generates request, posts it to the send queue and returns assigned unique id. Values of messageId started from 701. When received response on the sent request library raises ISiprixEventHandler::OnMessageSentState(), it allows to check has message sent successfully or got error.

Subscriptions functions

Library has ability to create subscriptions via sending SIP SUBSCRIBE request and receive updates with NOTIFY response. Current version of library provides following methods of manipulating subscriptions:

ErrorCode Subscription_Create(ISiprixModule *module, SubscrData *subscr, SubscriptionId *subscriptionId);

Creates new subscription and returns assigned unique id. Values of subscriptionId started from 101. Method sends SUBSCRIBE request and when received response raises ISiprixEventHandler::OnSubscriptionState().

ErrorCode Subscription_Destroy(ISiprixModule *module, SubscriptionId subscriptionId);

Destroys existing subscription (sends request SUBSCRIBE with expire time equal 0 and when received response raises ISiprixEventHandler::OnSubscriptionState()).

Device functions

Work with audio/video devices

Set of methods below is valid for desktop versions of library (Windows/MacOS/Linux)

Attention

Current version of library can’t work on computer without microphone device.

Fix of this limitation will be available soon.

Note

Library is able to detect changes in audio devices (plug new device or unplug existing). Each time when it happens library raises ISiprixEventHandler::OnDevicesAudioChanged().

ErrorCode Dvc_GetPlayoutDevices(ISiprixModule *module, uint32_t *numberOfDevices);

Retrieves number of available audio playout devices.

ErrorCode Dvc_GetRecordingDevices(ISiprixModule *module, uint32_t *numberOfDevices);

Retrieves number available audio recording devices.

ErrorCode Dvc_GetVideoDevices(ISiprixModule *module, uint32_t *numberOfDevices);

Retrieves number available video devices.

ErrorCode Dvc_GetPlayoutDevice(ISiprixModule *module, uint16_t index, char *name, uint32_t nameLength, char *guid, uint32_t guidLength);

Retrieves name and guid attributes of audio playout device specified by index.

ErrorCode Dvc_GetRecordingDevice(ISiprixModule *module, uint16_t index, char *name, uint32_t nameLength, char *guid, uint32_t guidLength);

Retrieves name and guid attributes of audio recording device specified by index.

ErrorCode Dvc_GetVideoDevice(ISiprixModule *module, uint16_t index, char *name, uint32_t nameLength, char *guid, uint32_t guidLength);

Retrieves name and guid attributes of video device specified by index.

ErrorCode Dvc_SetPlayoutDevice(ISiprixModule *module, uint16_t index);

Sets current playout device. Method has effect even when there is connected call(s) - it starts playing sound through newly selected device.

ErrorCode Dvc_SetRecordingDevice(ISiprixModule *module, uint16_t index);

Sets current recording (microphone) device. Method has effect even when there is connected call(s) - it starts capturing sound from newly selected device.

ErrorCode Dvc_SetVideoDevice(ISiprixModule *module, uint16_t index);

Sets current video (camera) device. Method doesn’t have effect when there is started call(s) with video. Library will use newly selected device after starting next call with video.

Android and iOS versions of library have method switchCamera which is able to switch front/back camera during a call.

Note

Library allows to set bad index of the device. In this mode it will send image from the file set by Vdo_SetNoCameraImgPath().

Configure video parameters

ErrorCode Dvc_SetVideoParams(ISiprixModule *module, VideoData *params);

Sets video capturer parameters: bitrate/framerate/resolution.

These parameters are common for all calls.

Method doesn’t have effect when there is started call(s) as capturer has already created. Library will use specified parameters after starting next call with video.

Callback functions

Library provides two possible ways of handling events/callbacks:

  • Create own class inherited from ISiprixEventHandler and set it as single handler for all events using Callback_SetEventHandler()

  • Set function for each event/callback separately; This approach is using by C# which can create managed delegates, but can’t inherit from native class.

    Attention

    When application set single event handler, library will not invoke separate functions;

Single event handler

ErrorCode Callback_SetEventHandler(ISiprixModule *module, ISiprixEventHandler *handler);

Set/reset single handler for all events.

Separate callbacks

ErrorCode Callback_SetTrialModeNotified(ISiprixModule *module, OnTrialModeNotified callback);

Set event handler for OnTrialModeNotified. See more details: ISiprixEventHandler::OnTrialModeNotified()

ErrorCode Callback_SetDevicesAudioChanged(ISiprixModule *module, OnDevicesAudioChanged callback);

Set event handler for OnDevicesAudioChanged. See more details: ISiprixEventHandler::OnDevicesAudioChanged()

ErrorCode Callback_SetAccountRegState(ISiprixModule *module, OnAccountRegState callback);

Set event handler for OnAccountRegState. See more details: ISiprixEventHandler::OnAccountRegState()

ErrorCode Callback_SetSubscriptionState(ISiprixModule *module, OnSubscriptionState callback);

Set event handler for OnSubscriptionState. See more details: ISiprixEventHandler::OnSubscriptionState()

ErrorCode Callback_SetNetworkState(ISiprixModule *module, OnNetworkState callback);

Set event handler for OnNetworkState. See more details: ISiprixEventHandler::OnNetworkState()

ErrorCode Callback_SetPlayerState(ISiprixModule *module, OnPlayerState callback);

Set event handler for OnPlayerState. See more details: ISiprixEventHandler::OnPlayerState()

ErrorCode Callback_SetRingerState(ISiprixModule *module, OnRingerState callback);

Set event handler for OnRingerState. See more details: ISiprixEventHandler::OnRingerState()

ErrorCode Callback_SetCallProceeding(ISiprixModule *module, OnCallProceeding callback);

Set event handler for OnCallProceeding. See more details: ISiprixEventHandler::OnCallProceeding()

ErrorCode Callback_SetCallTerminated(ISiprixModule *module, OnCallTerminated callback);

Set event handler for OnCallTerminated. See more details: ISiprixEventHandler::OnCallTerminated()

ErrorCode Callback_SetCallConnected(ISiprixModule *module, OnCallConnected callback);

Set event handler for OnCallConnected. See more details: ISiprixEventHandler::OnCallConnected()

ErrorCode Callback_SetCallIncoming(ISiprixModule *module, OnCallIncoming callback);

Set event handler for OnCallIncoming. See more details: ISiprixEventHandler::OnCallIncoming()

ErrorCode Callback_SetCallDtmfReceived(ISiprixModule *module, OnCallDtmfReceived callback);

Set event handler for OnCallDtmfReceived. See more details: ISiprixEventHandler::OnCallDtmfReceived()

ErrorCode Callback_SetCallTransferred(ISiprixModule *module, OnCallTransferred callback);

Set event handler for OnCallTransferred. See more details: ISiprixEventHandler::OnCallTransferred()

ErrorCode Callback_SetCallRedirected(ISiprixModule *module, OnCallRedirected callback);

Set event handler for OnCallRedirected. See more details: ISiprixEventHandler::OnCallRedirected()

ErrorCode Callback_SetCallVideoUpgraded(ISiprixModule *module, OnCallVideoUpgraded callback);

Set event handler for OnCallVideoUpgraded. See more details: ISiprixEventHandler::OnCallVideoUpgraded()

ErrorCode Callback_SetCallVideoUpgradeRequested(ISiprixModule *module, OnCallVideoUpgradeRequested callback);

Set event handler for OnCallVideoUpgradeRequested. See more details: ISiprixEventHandler::OnCallVideoUpgradeRequested()

ErrorCode Callback_SetCallSwitched(ISiprixModule *module, OnCallSwitched callback);

Set event handler for OnCallSwitched. See more details: ISiprixEventHandler::OnCallSwitched()

ErrorCode Callback_SetCallHeld(ISiprixModule *module, OnCallHeld callback);

Set event handler for OnCallHeld. See more details: ISiprixEventHandler::OnCallHeld()

ErrorCode Callback_SetMessageSentState(ISiprixModule *module, OnMessageSentState callback);

Set event handler for OnMessageSentState. See more details: ISiprixEventHandler::OnMessageSentState()

ErrorCode Callback_SetMessageIncoming(ISiprixModule *module, OnMessageIncoming callback);

Set event handler for OnMessageIncoming. See more details: ISiprixEventHandler::OnMessageIncoming()

ErrorCode Callback_SetSipNotify(ISiprixModule *module, OnSipNotify callback);

Set event handler for OnSipNotify. See more details: ISiprixEventHandler::OnSipNotify()

ErrorCode allback_SetVuMeterLevel(ISiprixModule *module, OnVuMeterLevel callback);

Set event handler for OnVuMeterLevel. See more details: ISiprixEventHandler::OnVuMeterLevel()

Signatures of callback functions

using OnTrialModeNotified = void (*)();

Signature of callback function using as argument of Callback_SetTrialModeNotified()

using OnDevicesAudioChanged = void (*)();

Signature of callback function using as argument of Callback_SetDevicesAudioChanged()

using OnAccountRegState = void (*)(AccountId accId, RegState state, const char *response);

Signature of callback function using as argument of Callback_SetAccountRegState()

using OnNetworkState = void (*)(const char *name, NetworkState state);

Signature of callback function using as argument of Callback_SetNetworkState()

using OnPlayerState = void (*)(PlayerId playerId, PlayerState state);

Signature of callback function using as argument of Callback_SetPlayerState()

using OnRingerState = void (*)(bool start);

Signature of callback function using as argument of Callback_SetRingerState()

using OnCallProceeding = void (*)(CallId callId, const char *response);

Signature of callback function using as argument of Callback_SetCallProceeding()

using OnCallTerminated = void (*)(CallId callId, uint32_t statusCode);

Signature of callback function using as argument of Callback_SetCallTerminated()

using OnCallConnected = void (*)(CallId callId, const char *hdrFrom, const char *hdrTo, bool withVideo);

Signature of callback function using as argument of Callback_SetCallConnected()

using OnCallIncoming = void (*)(CallId callId, AccountId accId, bool withVideo, const char *hdrFrom, const char *hdrTo);

Signature of callback function using as argument of Callback_SetCallIncoming()

using OnCallDtmfReceived = void (*)(CallId callId, uint16_t tone);

Signature of callback function using as argument of Callback_SetCallDtmfReceived()

using OnCallTransferred = void (*)(CallId callId, uint32_t statusCode);

Signature of callback function using as argument of Callback_SetCallTransferred()

using OnCallRedirected = void (*)(CallId origCallId, CallId relatedCallId, const char *referTo);

Signature of callback function using as argument of Callback_SetCallRedirected()

using OnCallSwitched = void (*)(CallId callId);

Signature of callback function using as argument of Callback_SetCallSwitched()

using OnCallHeld = void (*)(CallId callId, HoldState state);

Signature of callback function using as argument of Callback_SetCallHeld()

using OnCallVideoUpgraded = void (*)(CallId callId, bool withVideo);

Signature of callback function using as argument of Callback_SetCallVideoUpgraded()

using OnCallVideoUpgradeRequested = void (*)(CallId callId);

Signature of callback function using as argument of Callback_SetCallVideoUpgradeRequested()

using OnMessageSentState = void (*)(MessageId messageId, bool success, const char *response);

Signature of callback function using as argument of Callback_SetMessageSentState()

using OnMessageIncoming = void (*)(AccountId accId, const char *hdrFrom, const char *body);

Signature of callback function using as argument of Callback_SetMessageIncoming()

using OnSipNotify = void (*)(AccountId accId, const char *hdrEvent, const char *body);

Signature of callback function using as argument of Callback_SetSipNotify()

using OnVuMeterLevel = void (*)(int micLevel, int spkLevel);

Signature of callback function using as argument of Callback_SetVuMeterLevel()

Account attributes functions

AccData *Acc_GetDefault();

Returns new instance of AccData.

Application has to use returned value as argument of Account_Add(), Account_Update().

void Acc_SetSipServer(AccData *acc, const char *sipServer);

Sets domain name or IP address of the SIP server(PBX).

Note

When remote server(PBX) configured to use some custom port number instead of default 5060 or 5061 append to the name/address colon and this port number.

Example:

Required to use some coolserver.com, which is listening SIP requests on the port 5555.

=> Configure account by invoking Acc_SetSipServer(acc, "coolserver.com:5555");

void Acc_SetSipExtension(AccData *acc, const char *sipExtension);

Sets extension (user name) of the account.

void Acc_SetSipAuthId(AccData *acc, const char *sipAuthId);

Sets AuthId - user name for authentication. Typically not required, library uses extension as user name.

void Acc_SetSipPassword(AccData *acc, const char *sipPassword);

Sets password for authentication.

void Acc_SetExpireTime(AccData *acc, uint32_t expireTime);

Sets expire time for registration in seconds. Means how long SIP server(PBX) has to remember this client (account).

When this value set to 0 library will not send REGISTER request after adding account.

See also Edit (update) account.

void Acc_SetSipProxyServer(AccData *acc, const char *sipProxyServer);

Sets domain name or IP address of SIP proxy server. Required in case when library has to send SIP requests to this proxy and/or IP address of SIP PBX can’t be resolved by DNS.

void Acc_SetStunServer(AccData *acc, const char *stunServer);

Sets domain name or IP address of the STUN server.

void Acc_SetTurnServer(AccData *acc, const char *turnServer);

Sets domain name or IP address of the TURN server.

Attention

When specified both STUN and TURN servers SDK will use only TURN.

void Acc_SetTurnUser(AccData *acc, const char *turnUser);

Sets user name using for sending requests to TURN server.

void Acc_SetTurnPassword(AccData *acc, const char *turnPassword);

Sets password using for sending requests to TURN server.

void Acc_SetUserAgent(AccData *acc, const char *userAgent);

Sets string which library will send in the User-Agent header of SIP requests. Default value siprix.

void Acc_SetDisplayName(AccData *acc, const char *displayName);

Sets display name (caller Id) string which library will send in the To, From headers of SIP requests. Example: "displayName"<sip:extension@server>

void Acc_SetInstanceId(AccData *acc, const char *instanceId);

Sets unique instance Id which library will send as part of Contact header.

Library has method for generating this id: Acc_GenerateInstanceId().

See more: RFC5626.

void Acc_SetRingToneFile(AccData *acc, const char *ringTonePath);

Sets path to mp3 file which library will play when received incoming call.

void Acc_SetSecureMediaMode(AccData *acc, SecureMedia mode);

Sets secure media mode (enable/disable SRTP).

Attention

When enabled SRTP media encryption library will be able to make/accept calls only when encryption is also enabled on remote side and drop calls with error 488 Not acceptable here when encryption enabled only on one of sides.

void Acc_SetUseSipSchemeForTls(AccData *acc, bool useSipSchemeForTls);

Enables/disables using sip scheme with TLS transport for SIP. By default library uses sips scheme.

void Acc_SetRtcpMuxEnabled(AccData *acc, bool rtcpMuxEnabled);

Enables/disables using RtcpMux (sending RTP and RTCP packets trough the same port).

void Acc_SetIceEnabled(AccData *acc, bool iceEnabled);

Enables/disables using ICE protocol.

void Acc_SetKeepAliveTime(AccData *acc, uint32_t keepAliveTimeSec);

Sets keep alive interval for sending short packet trough the established SIP connection. Default value 30.

void Acc_SetTranspProtocol(AccData *acc, SipTransport transp);

Sets SIP transport for this account.

void Acc_SetTranspPort(AccData *acc, uint16_t transpPort);

Sets local port number which library has to use for this accoount. Default value 0 which means random port.

Attention

It’s not recommended to use well known port 5060 on the client side.

void Acc_SetTranspTlsCaCert(AccData *acc, const char *pathToCaCertPem);

Sets path to pem file with CA certificate.

Note

It’s required when set Ini_SetTlsVerifyServer().

In this mode library can establish TLS connection only when:

  • certificate, received from server, signed by specified CA cert

  • CN name in the received certificate is equal to domain name set in the Acc_SetSipServer().

Note

Current version of the library can’t read file from memory/resources. Application has to write it to some temporary location and set actual path as argument of this method.

void Acc_SetTranspBindAddr(AccData *acc, const char *ipAddr);

Sets local IP address which library has to use for binding. By default empty.

void Acc_SetTranspPreferIPv6(AccData *acc, bool prefer);

Enables/disables prefering IPv6. By default false, preffered is IPv4.

It can be required in case when computer has both IPv4 and IPv6 addresses.

void Acc_AddXHeader(AccData *acc, const char *header, const char *value);

Adds header and its value which library has to send in the SIP REGISTER request.

void Acc_AddXContactUriParam(AccData *acc, const char *param, const char *value);

Adds param and its value which library has to send in the Contact header of SIP REGISTER request.

void Acc_SetRewriteContactIp(AccData *acc, bool enabled);

Enables/disables ability to send one more REGISTER request containing Contact header with IP address, which has been received in the previous SIP response as received and rport params of the header Via. Default value - false (disabled).

Example how it works:

  1. App/lib sends REGISTER request

    REGISTER sip:192.168.0.122;transport=udp SIP/2.0
    Contact: <sip:1017@10.10.0.5:4413;rinstance=adb0c5f259cb4761>
    
  2. Received response from SIP server:

    SIP/2.0 200 OK
    Via: SIP/2.0/UCP 10.10.0.5:4413;branch=z...;rport=23237;received=192.168.0.118
    
  3. Library puts received IP and rport port in the Contact header and sends REGISTER again.

    REGISTER sip:192.168.0.122;transport=udp SIP/2.0
    Contact: <sip:1017@192.168.0.118:23237;rinstance=adb0c5f259cb4761>
    

    Now server can reach that client and forward incoming calls to it.

void Acc_SetVerifyIncomingCall(AccData *acc, bool enabled);

Enables/disables verify SDP of the incoming call. When enabled and received SDP with audio codecs which doesn’t match codecs set on local side or secure media settings doesn’t match local side - SDK will silently reject this call without raise any events. Default value - false (disabled).

void Acc_SetUpgradeToVideoMode(AccData *acc, UpgradeToVideoMode mode);

Configures mode how to handle request, received from remote side, which upgrades call to video. Default value - RecvOnly (automatically accept upgrade, but don’t start sending local video - mute camera). To start sending local video use method Call_MuteCam().

void Acc_AddAudioCodec(AccData *acc, AudioCodec codec);

Adds audio codec. Allows to configure list of required audio codecs and their order.

Library will put codecs to SDP in the same order as they were added by application.

Example how to set audio codecs order: PCMU, PCMA, DTMF
Siprix::AccData* acc = Siprix::Acc_GetDefault();
...
Siprix::Acc_ResetAudioCodecs(acc);
Siprix::Acc_AddAudioCodec(acc, Siprix::AudioCodec::PCMU);
Siprix::Acc_AddAudioCodec(acc, Siprix::AudioCodec::PCMA);
Siprix::Acc_AddAudioCodec(acc, Siprix::AudioCodec::DTMF);

Attention

In case of issues with audio/video don’t add all existing codecs. With the high probability it will not help to solve this issue, but increases size of the SDP and INVITE request. When requests size exceeds UDP MTU (1500 bytes) and application configured using SIP over UDP remote side may be not able to receive that request at all.

void Acc_AddVideoCodec(AccData *acc, VideoCodec codec);

Adds video codec. Uses the same approach as Acc_AddAudioCodec().

void Acc_ResetAudioCodecs(AccData *acc);

Removes default audio codecs. See usage example: Acc_AddAudioCodec().

void Acc_ResetVideoCodecs(AccData *acc);

Removes default video codecs. See usage example: Acc_AddAudioCodec().

const char *Acc_GenerateInstanceId();

Generates unique instance-id using as argument of Acc_SetInstanceId().

Application has to use this method when adds account first time. When application restores its state and account has been added in the previous session, this value should be also restored.

See more: https://www.rfc-editor.org/rfc/rfc5626.html#section-3.1

Module init attributes functions

IniData *Ini_GetDefault();

Returns new instance of IniData.

Application has to use returned value as argument of Module_Initialize().

void Ini_SetLicense(IniData *ini, const char *license);

Set license credential string.

When missed or expired library will raise event ISiprixEventHandler::OnTrialModeNotified() and start working in trial mode (limit duration of the call(s)).

void Ini_SetBrandName(IniData *ini, const char *brandName);

Set own brand name, which library will use for displaying in logs traces, as name of the log file and also as UserAgent header (when app didn’t set own value). Default value: “Siprix”.

void Ini_SetLogLevelFile(IniData *ini, LogLevel level);

Sets level of log output, sent to the file.

void Ini_SetLogLevelIde(IniData *ini, LogLevel level);

Sets level of log output, sent to the IDE.

void Ini_SetShareUdpTransport(IniData *ini, bool shareUdpTransport);

Enables/disables sharing UDP transport by multiple accounts. When enabled, all accounts with configured UDP transport will use the same local port. By default enabled.

void Ini_SetUnregOnDestroy(IniData *ini, bool unregOnDestroyEnabled);

Enables/disables ability to unregister accounts on destroy library instance. This option can be set by applications which using push notifications and should be able to receive calls even when app closed. By default enabled (library unregisters accounts on destroy).

void Ini_SetUseExternalRinger(IniData *ini, bool useExternalRinger);

Enables/disables using external ringer. By default disabled.

void Ini_SetDmpOnUnhandledExc(IniData *ini, bool writeDmpUnhandledExc);

Enables/disables set unhandled exception filter and generating dmp file when exception intercepted. By default enabled.

Note

Available only for Windows.

void Ini_SetTlsVerifyServer(IniData *ini, bool tlsVerifyServer);

Enables/disables verify certificate, received from server, when account configured to use TLS transport. By default disabled. See also: Acc_SetTranspTlsCaCert().

void Ini_SetSingleCallMode(IniData *ini, bool singleCallMode);

Enables/disables single call mode. In this mode library can make only one call. By default disabled.

void Ini_SetRtpStartPort(IniData *ini, uint16_t rtpStartPort);

Sets start RTP port number.

Note

Not implemented yet.

void Ini_SetHomeFolder(IniData *ini, const char *homeFolder);

Set name or path to the home folder, where library will store logs/dmp files. When input string contains folder separators (like ‘\’ or ‘/’) library uses it as fully specified path, otherwise as folder name.

Attention

If input string contains forbidden characters like ‘*’, ‘:’, ‘|’ and similar, library may be not able to create home folder.

See also: Diagnostics and home folder.

void Ini_AddDnsServer(IniData *ini, const char *dns);

Adds additional DNS server(s) which library should use for resolving IP address of account’s domain/proxy name.

void Ini_SetUseDnsSrv(IniData *ini, bool enabled);

Enables/disables using DNS SRV for resolving IP address of account’s domain/proxy name. App can use this option when DSN SRV is not available or has wrong configuration. By default enabled.

void Ini_SetRecordStereo(IniData *ini, bool enabled);

Enables/disables recorder to write sent and received sound of the specified call as separate channels. By default disabled (library mixes sent and received sound to single channel).

void Ini_SetVideoCallEnabled(IniData *ini, bool enabled);

Enables/disables video call functionality. It’s recommended to disable it when app makes audio only calls. When disabled properties withVideo set by Dest_SetVideoCall() and Call_Accept() have no effect. By default enabled (library allows to make/accept video call).

void Ini_SetTranspForceIPv4(IniData *ini, bool enabled);

Enables/disables ability to use IPv4 for all cases. It’s experimental feature added for testing cases when library’s NetMonitor reports available only IPv6, but device has available interface with address 192.0.0.2. By default disabled.

void Ini_SetVUmeterEnabled(IniData *ini, bool enabled);

Enables/disables ability to generate event ISiprixEventHandler::OnVuMeterLevel(). By default disabled.

void Ini_SetAes128Sha32Enabled(IniData *ini, bool enabled);

Enables/disables ability to use Aes128Sha32 SRTP encryption. By default disabled.

void setUseTelState(boolean enable);

Enables monitoring device’s call state changes using PhoneStateListener or TelephonyCallback.CallStateListener depending on the Build.VERSION.SDK_INT.

When detected state TelephonyManager.CALL_STATE_OFFHOOK (GSM call started) - holds all SIP calls. When detected TelephonyManager.CALL_STATE_IDLE - unholds SIP calls which were held on previous stage. Default value - false (disabled).

Note

Available only for Android.

On devices with API level 31 and higher requires permission READ_PHONE_STATE which app has declare in manifest and request in runtime.

Call destination attributes functions

DestData *Dest_GetDefault();

Returns new instance of DestData.

Application has to use returned value as argument of Call_Invite().

void Dest_SetExtension(DestData *dest, const char *extension);

Sets phone number/extension to invite (dial).

void Dest_SetAccountId(DestData *dest, AccountId accId);

Sets id of the account which will send INVITE request.

void Dest_SetVideoCall(DestData *dest, bool video);

Sets true if it should be call with video or false for audio only calls. By default false.

void Dest_SetDisplayName(DestData *dest, const char *displayName);

Sets display name (caller Id) string which library will send in the From header of SIP INVITE request. Example: "displayName"<sip:extension@server> This value overrides display name specified for account by: Acc_SetDisplayName().

void Dest_SetInviteTimeout(DestData *dest, int inviteTimeoutSec);

Sets timeout how long wait response from remote side. By default 40.

void Dest_AddXHeader(DestData *dest, const char *header, const char *value);

Adds header and its value which library has to send int the INVITE request.

Messages attributes functions

MsgData *Msg_GetDefault();

Returns new instance of MsgData.

Application has to use returned value as argument of Message_Send().

void Msg_SetExtension(MsgData *msg, const char *extension);

Sets destination phone number/extension where to send message.

void Msg_SetAccountId(MsgData *msg, AccountId accId);

Sets id of the account which will send MESSAGE request.

void Msg_SetBody(MsgData *msg, const char *body);

Sets body which library will put into the SIP MESSAGE.

void Msg_SetContentType(MsgData *msg, const char *contentType);

Sets value of the header ContentType. By default: “text/plain”.

Subscription attributes functions

SubscrData *Subscr_GetDefault();

Returns new instance of SubscrData.

Application has to use returned value as argument of Subscription_Create().

void Subscr_SetExtension(SubscrData *sub, const char *extension);

Sets phone number/extension to subscribe.

void Subscr_SetAccountId(SubscrData *sub, AccountId accId);

Sets id of the account which will send SUBSCRIBE request.

void Subscr_SetMimeSubtype(SubscrData *sub, const char *mimeSubType);

Sets mime subtype which library will put into the SIP header Accept.

Example: When app invokes: Subscr_SetMimeSubtype(sub, “dialog-info+xml”); Library will send request with header: Accept: application/dialog-info+xml

void Subscr_SetEventType(SubscrData *sub, const char *type);

Sets event type which library will put into the SIP header Event.

Example: When app invokes: Subscr_SetEventType(sub, “dialog”); Library will send request with header: Event: dialog

void Subscr_SetExpireTime(SubscrData *sub, uint32_t expireTime);

Sets expire time for this subscription in seconds. Library will automatically update it. Default value 3000.

void Subscr_SetBody(SubscrData *sub, const char *body);

Sets body which library will put into the SIP SUBSCRIBE request. By default empty.

Video device attributes functions

VideoData *Vdo_GetDefault();

Returns new instance of VideoData.

Application has to use returned value as argument of Dvc_SetVideoParams().

void Vdo_SetNoCameraImgPath(VideoData *vdo, const char *pathToJpg);

Sets path to the jpg file with image, which library will send when video device not available.

Note

Library will send video frames with same resolution as has specified jpg file.

Note

When video device not available and image didn’t set, library will generate video frames with small own logo and specified resolution.

void Vdo_SetFramerate(VideoData *vdo, int fps);

Sets framerate (fps). Default value 15.

void Vdo_SetBitrate(VideoData *vdo, int bitrateKbps);

Sets bitrate (kbps). Default value 600.

Note

This value is trade off between video quality and bandwidth, required to send it. High value means lower compression, better quality and more bandwith required.

This value also depends on the specified resolution. It’s recommended to change resolution and bitrate together.

Note

Library estimates avilable bandwith of the channel and may automaticaly reduce/increase bitrate depending on the network conditions.

void Vdo_SetRotation(VideoData *vdo, int degrees);

Sets rotation of the video frame on capturing stage. Default value 0. Allowed values: 0, 90, 180, 270. Valid only for desktop versions.

void Vdo_SetHeight(VideoData *vdo, int height);

Sets video frame height. Default value 480.

void Vdo_SetWidth(VideoData *vdo, int width);

Sets video frame width. Default value 600.

Attention

Specified Height and Width should match one of the available resolutions provided by the selected video device.

Get error text function

const char *GetErrorText(ErrorCode code);

Returns text description of the error code.

Interfaces

class ISiprixModule;

Internal interface used as argument of almost all management methods.


class ISiprixEventHandler
virtual void OnTrialModeNotified() = 0;

This event is raised by library on initialization stage when license not specified or expired and means, that trial limitations will be using.

virtual void OnDevicesAudioChanged() = 0;

This event is raised by library when detected changes in the audio devices.

virtual void OnAccountRegState(AccountId accId, RegState state, const char *response) = 0;

This event is raised by library when received response on the SIP REGISTER request or response not received during timeout.

param state:

contains registration state of the account.

param response:

string got from the StatusLine of the received SIP response.

Note

When registration failed library will retry register after 120 seconds.

virtual void OnSubscriptionState(SubscriptionId subId, SubscriptionState state, const char *response) = 0;

This event is raised by library when received response on the SIP SUBSCRIBE request or response not received during timeout.

Parameters:
  • state – contains state of the subscription.

  • response – got from the StatusLine of the received SIP response (when subscription failed) or body of the received NOTIFY response.

virtual void OnNetworkState(const char *name, NetworkState state) = 0;

This event is raised by library when detected internet connection changes (losing connection, restoring connection, switching between networks).

Library automatically handles it and refreshes accounts registration/restores calls when connection restored.

virtual void OnPlayerState(PlayerId playerId, PlayerState state) = 0;

This event is raised by library when changed state of the player, started by Call_PlayFile().

virtual void OnRingerState(bool started) = 0;

This event is raised by library as signal to start/stop playing ringtone.

Parameters:

started – When it’s true application has to start playing ringtone, when it’s false - stop.

Moment when to start/stop playing ringtone is not as trivial as it seems because handling multiple calls produces complicated cases like:

  • receiving incoming call when there is another incoming/connected call (don’t start ringer in this case)

  • incoming call wasn’t answered and previously connected call just ended (need to start ringer again), etc.

Library raises this event when application set Ini_SetUseExternalRinger(), when it’s not set library plays ringtone internally using file specified by Acc_SetRingToneFile()

virtual void OnCallIncoming(CallId callId, AccountId accId, bool withVideo, const char *hdrFrom, const char *hdrTo) = 0;

This event is raised by library when received SIP INVITE request.

Parameters:
  • CallId – Unique id assigned for this call;

  • AccountId – Id of the account which received this call;

  • withVideo – Set to true when received request contains video media in SDP;

  • hdrFrom – Contains data of SIP header From.

  • hdrTo – Contains data of SIP header To.

Note

Example of strings set by library as hdrFrom/HdrTo: sip:extension@domain:port or "displayName" <sip:extension@domain:port>. When displayName present it may contain unicode characters, which SIP sends as $url.encode.

Note

When application has connected some call and new incoming call received library starts playing call waiting tones.

virtual void OnCallConnected(CallId callId, const char *hdrFrom, const char *hdrTo, bool withVideo) = 0;

This event is raised by library when received/sent 200 OK response on the SIP INVITE request/response.

Parameters:
  • CallId – Unique id assigned for this call;

  • withVideo – Set to true when received request contains video media in SDP;

  • hdrFrom – Contains data of SIP header From.

  • hdrTo – Contains data of SIP header To.

virtual void OnCallTerminated(CallId callId, uint32_t statusCode) = 0;

This event is raised by library when call terminated.

virtual void OnCallProceeding(CallId callId, const char *response) = 0;

This event is raised by library when it makes outgoing call and received 1xx response.

Also library starts playing ring-back tones (long beeps). Library stops playing these tones when received first RTP packet.

virtual void OnCallTransferred(CallId callId, uint32_t statusCode) = 0;

This event is raised by library when received response on the previously sent REFER request (or expired timeout).

Parameters:

statusCode – status received from remote side. Typically it’s 0 when transfer success.

When call transferred successfully library will end it soon. When transfer failed call state switches to Connected. See also Call_TransferBlind()

virtual void OnCallRedirected(CallId origCallId, CallId relatedCallId, const char *referTo) = 0;

This event is raised by library when received redirect request from remote side (remote side transfers call to new destination).

From library point of view it’s equal to creating new outgoing call.

Parameters:
  • origCallId – id of the original call, which is being redirecting

  • relatedCallId – id of the related call, which created by library

  • referTo – remote destination

virtual void OnCallDtmfReceived(CallId callId, uint16_t tone) = 0;

This event is raised by library when received DTMF tone from remote side.

Parameters:

tone – received digit: 0 = ‘0’, 1 = ‘1’, 2 = ‘2’, … 10 = ‘*’, 11 = ‘#’.

virtual void OnCallHeld(CallId callId, HoldState state) = 0;

This event is raised by library when local or remote side has put call on hold. See also Call_Hold()

Note

Hold state means stop send/receive audio/video RTP streams. When remote side put call on hold - local side can’t unhold it.

virtual void OnCallSwitched(CallId callId) = 0;

This event is raised by library each time when call gives audio focus. Only switched call can send sound from microphone to the remote side and play received sound to speaker.

Call can be switched by:

  • library (when call started and there are no other calls, or when call terminated and there are other calls)

  • application (when it switches between different calls) see Mixer_SwitchToCall().

Parameters:

callId – Id of the call which become switched. When this value is 0 - all calls has been terminated.

virtual void OnCallVideoUpgraded(CallId callId, bool withVideo) = 0;

This event is raised by library when received response on the video upgrade request, initiated by the method Call_UpgradeToVideo().

Parameters:
  • callId – id of the call

  • withVideotrue - means video upgrade accepted by remote side, false - video not started;

virtual void OnCallVideoUpgradeRequested(CallId callId) = 0;

This event is raised by library when received request to start video and configured manual upgrade mode using Acc_SetUpgradeToVideoMode(). In the event handler app has invoke Call_AcceptVideoUpgrade() as soon as possible.

Parameters:

callId – id of the call

virtual void OnMessageSentState(MessageId messageId, bool success, const char *response) = 0;

This event is raised by library when received response on sent SIP MESSAGE request or response not received after timeout expired.

Parameters:
  • messageId – Id of the message, returned by method Message_send().

  • success – true if message successfully sent.

  • response – response received from remote side. For example: 202 Accepted.

virtual void OnMessageIncoming(MessageId messageId, AccountId accId, const char *hdrFrom, const char *body) = 0;

This event is raised by library when received SIP MESSAGE request from remote side.

Parameters:
  • messageId – Id of the message, assigned by library.

  • accId – Id of the account, which received this request.

  • hdrFrom – Contains data got from the SIP header From of the received request.

  • body – Contains body of received request.

virtual void OnSipNotify(AccountId accId, const char *hdrEvent, const char *body) = 0;

This event is raised by library when received SIP NOTIFY request from remote side. Typically it’s caused by MWI (Message Waiting Indicator).

Parameters:
  • accId – Id of the account, which received this request.

  • hdrEvent – Contains data got from the SIP header Event of the received request.

  • body – body of the received request.

virtual void OnVuMeterLevel(int micLevel, int spkLevel) = 0;

This event is raised by library once per 100ms when enabled VU meter using Ini_SetVUmeterEnabled(). In the event handler app can render volume level of the microphone/speaker.

Parameters:
  • micLevel – microphone signal level. Value in range [0..9]:

  • spkLevel – speaker signal level. Value in range [0..9]:


class IVideoFrame

Pointer to instance of this class is using as argument of method IVideoRenderer::OnFrame(). Application has to use it only in the current stack frame and can’t copy/free/store.

enum Rotation
enumerator kRotation_0 = 0
enumerator kRotation_90 = 90
enumerator kRotation_180 = 180
enumerator kRotation_270 = 270
enum RGBType
enumerator kARGB
enumerator kBGRA
enumerator kABGR
enumerator kRGBA
virtual int width() const = 0;

Return width of the video frame in pixels.

virtual int height() const = 0;

Return height of the video frame in pixels.

virtual Rotation rotation() const = 0;

Returns rotation attribute of the video frame.

virtual void ConvertToARGB(RGBType type, uint8_t *dstBuffer, int dstWidth, int dstHeight) const = 0;

Converts frame to RGB format.

Parameters:
  • type – output RGB format requested by the application.

  • dstBuffer – destination buffer, where library will copy converted bytes. Application has allocate buffer with size at least dstWidth*dstHeight*4 bytes.

  • dstWidth – destination width. When this value differs from original frame width library will scale frame.

  • dstHeight – destination height. When this value differs from original frame heigh library will scale frame.

class IVideoRenderer

Base class for implementation application’s video renderer. Pointer to instance of inherited class is using as argument of method Call_SetVideoRenderer().

virtual void OnFrame(IVideoFrame *videoFrame) = 0;

Library invokes this method each time when decoded new video frame of the requested call. Implementation should be lightweight and shouldn’t take more than 1000/sample_rate ms.

Param videoFrame:

pointer to video frame. Application has to use it only in the current stack frame and can’t copy/free/store.

Enums

enum ErrorCode

Siprix error codes. Used as return result of the all management functions.

Use GetErrorText() to get readable string.

Values:

enumerator EOK = 0
enumerator EAlreadyInitialized = -1000
enumerator ENotInitialized = -1001
enumerator EInitializeFailure = -1002
enumerator EObjectNull = -1003
enumerator EArgumentNull = -1004
enumerator ENotImplemented = -1005
enumerator EBadSipServer = -1010
enumerator EBadSipExtension = -1011
enumerator EBadSecureMediaMode = -1012
enumerator EBadTranspProtocol = -1013
enumerator EBadTranspPort = -1014
enumerator EDuplicateAccount = -1021
enumerator EAccountHasCalls = -1023
enumerator EAccountDoenstMatch = -1024
enumerator ESingleAccountMode = -1025
enumerator EAccountHasSubscr = -1026
enumerator EDestNumberEmpty = -1030
enumerator EDestNumberSpaces = -1031
enumerator EDestNumberScheme = -1032
enumerator EDestBadFormat = -1033
enumerator EDestSchemeMismatch = -1034
enumerator EOnlyOneCallAllowed = -1035
enumerator ECallNotFound = -1040
enumerator ECallNotIncoming = -1041
enumerator ECallAlreadyAnswered = -1042
enumerator ECallNotConnected = -1043
enumerator EBadDtmfStr = -1044
enumerator EFileDoesntExists = -1045
enumerator EFileExtMp3Expected = -1046
enumerator ECallAlreadySwitched = -1047
enumerator ECallAlredyMuted = -1048
enumerator ECallRecAlredyStarted = -1049
enumerator ECallRecNotStarted = -1050
enumerator ECallCantReferBlind = -1051
enumerator ECallReferInProgress = -1052
enumerator ECallCantReferAtt = -1053
enumerator ECallReferAttSameId = -1054
enumerator EConfRequires2Calls = -1055
enumerator ECallIsHolding = -1056
enumerator ERndrAlreadyAssigned = -1057
enumerator ESipHeaderNotFound = -1058
enumerator EBadDeviceIndex = -1070
enumerator EEventTypeCantBeEmpty = -1080
enumerator ESubTypeCantBeEmpty = -1081
enumerator ESubscrDoesntExist = -1082
enumerator ESubscrAlreadyExist = -1083
enumerator EMicPermRequired = -1111
enum LogLevel

Use as argument of Ini_SetLogLevelFile(), Ini_SetLogLevelIde().

Values:

enumerator Stack = 0

Most detailed log level.

enumerator Debug = 1
enumerator Info = 1

Using as default log level.

enumerator Warning = 3
enumerator Error = 4
enumerator NoLog = 5

Disable log level.

enum RegState

Using as argument of ISiprixEventHandler::OnAccountRegState(), OnAccountRegState.

Values:

enumerator Success = 0

Registration success. Account can receive incoming and make outgoing calls.

enumerator Failed

Registration failed. Account can’t receive incoming neither make outgoing calls.

enumerator Removed

Registration removed. Account is not able to receive incoming calls in this mode, but can make outgoing.

enumerator Undefined

Registration state undefined.

enum SubscriptionState

Using as argument of ISiprixEventHandler::OnSubscriptionState(), OnSubscriptionState.

Values:

enumerator Created = 0

Subscription just created and is waiting on the response of the initial request.

enumerator Updated

Subscription accepted by remote side and received NOTIFY response.

enumerator Destroyed

Subscription rejected by remote side or removed by the app.

enum SecureMedia

Use as argument of Acc_SetSecureMediaMode().

Values:

enumerator Disabled = 0

Encryption disabled

enumerator SdesSrtp = 1

SRTP with SDP key negotiation, SAVP profile

enumerator DtlsSrtp = 2

SRTP with DTLS key negotiation, SAVP profile

enum SipTransport

Use as argument of Acc_SetTranspProtocol().

Values:

enumerator UDP = 0

SIP signalling uses UDP transport

enumerator TCP = 1

SIP signalling uses TCP transport

enumerator TLS = 2

SIP signalling uses TLS transport

See also: Acc_SetTranspTlsCaCert(), Ini_SetTlsVerifyServer()

enum DtmfMethod

Use as argument of Call_SendDtmf().

Values:

enumerator DTMF_RTP = 0

Send DTMF as RTP signaling packets.

enumerator DTMF_INFO = 1

Send DTMF as SIP INFO requests.

enum AudioCodec

Use as argument of Acc_AddAudioCodec().

Values:

enumerator Opus
enumerator ISAC16
enumerator ISAC32
enumerator G722
enumerator G729
enumerator ILBC
enumerator PCMU
enumerator DTMF
enumerator CN
enum VideoCodec

Use as argument of Acc_AddVideoCodec().

Values:

enumerator H264
enumerator VP8
enumerator VP9
enumerator AV1
enum HoldState

Using as argument of ISiprixEventHandler::OnCallHeld(), OnCallHeld.

Values:

enumerator None = 0

RTP streams flows in both directions.

enumerator Local = 1

Call has put on hold by local side.

enumerator Remote = 2

Call has put on hold by remote side.

enumerator LocalAndRemote = 3

Call has put on hold by local and remote sides.

enum PlayerState

Using as argument of ISiprixEventHandler::OnPlayerState(), OnPlayerState.

Values:

enumerator PlayerStarted = 0
enumerator PlayerStopped = 1
enumerator PlayerFailed = 2
enum NetworkState

Using as argument of ISiprixEventHandler::OnNetworkState(), OnNetworkState.

Values:

enumerator NetworkLost = 0
enumerator NetworkRestored = 1
enumerator NetworkSwitched = 2
enum UpgradeToVideoMode

Using as argument of Acc_SetUpgradeToVideoMode().

Values:

enumerator SendRecv = 0

Automatically accept video upgrade and start sending local video.

enumerator RecvOnly = 1

Automatically accept video upgrade, but don’t start sending local video. Default mode.

enumerator Inactive = 2

Automatically reject video upgrade.

enumerator Manual = 3

Manual mode. Will cause trigering event ISiprixEventHandler::OnCallVideoUpgradeRequested(), which app should handle and invoke Call_AcceptVideoUpgrade().