PJSUA2 - C++/Android/iOS/Python¶
endpoint.hpp¶
PJSUA2 Base Agent Operation.
-
namespace pj¶
PJSUA2 API is inside pj namespace
Typedefs
-
typedef std::vector<SslCertName> SslCertNameVector¶
Array of SSL certificate type and name.
-
struct DigestChallenge
- #include <endpoint.hpp>
This structure describes authentication challenge used in Proxy-Authenticate or WWW-Authenticate for digest authentication scheme.
Public Functions
-
void fromPj(const pjsip_digest_challenge &prm)¶
Convert from pjsip
-
pjsip_digest_challenge toPj() const¶
Convert to pjsip
-
void fromPj(const pjsip_digest_challenge &prm)¶
-
struct DigestCredential
- #include <endpoint.hpp>
This structure describe credential used in Authorization and Proxy-Authorization header for digest authentication scheme.
Public Functions
-
void fromPj(const pjsip_digest_credential &prm)¶
Convert from pjsip
-
pjsip_digest_credential toPj() const¶
Convert to pjsip
Public Members
-
std::string realm¶
Realm of the credential
-
StringToStringMap otherParam¶
Other parameters.
-
std::string username¶
Username parameter.
-
std::string nonce¶
Nonce parameter.
-
std::string uri¶
URI parameter.
-
std::string response¶
Response digest.
-
std::string algorithm¶
Algorithm.
-
std::string cnonce¶
Cnonce.
-
std::string opaque¶
Opaque value.
-
std::string qop¶
Quality of protection.
-
std::string nc¶
Nonce count.
-
void fromPj(const pjsip_digest_credential &prm)¶
-
class Endpoint
- #include <endpoint.hpp>
Endpoint represents an instance of pjsua library. There can only be one instance of pjsua library in an application, hence this class is a singleton.
Public Functions
-
Endpoint()¶
Default constructor
-
virtual ~Endpoint()¶
Virtual destructor
- void libCreate () PJSUA2_THROW(Error)
Instantiate pjsua application. Application must call this function before calling any other functions, to make sure that the underlying libraries are properly initialized. Once this function has returned success, application must call libDestroy() before quitting.
-
pjsua_state libGetState() const¶
Get library state.
- Returns
library state.
- void libInit (const EpConfig &prmEpConfig) PJSUA2_THROW(Error)
Initialize pjsua with the specified settings. All the settings are optional, and the default values will be used when the config is not specified.
Note that create() MUST be called before calling this function.
- Parameters
prmEpConfig – Endpoint configurations
- void libStart () PJSUA2_THROW(Error)
Call this function after all initialization is done, so that the library can do additional checking set up. Application may call this function any time after init().
- void libRegisterThread (const string &name) PJSUA2_THROW(Error)
Register a thread that was created by external or native API to the library. Note that each time this function is called, it will allocate some memory to store the thread description, which will only be freed when the library is destroyed.
- Parameters
name – The optional name to be assigned to the thread.
-
bool libIsThreadRegistered()¶
Check if this thread has been registered to the library. Note that this function is only applicable for library main & worker threads and external/native threads registered using libRegisterThread().
-
void libStopWorkerThreads()¶
Stop all worker threads.
-
int libHandleEvents(unsigned msec_timeout)¶
Poll pjsua for events, and if necessary block the caller thread for the specified maximum interval (in miliseconds).
Application doesn’t normally need to call this function if it has configured worker thread (thread_cnt field) in pjsua_config structure, because polling then will be done by these worker threads instead.
If EpConfig::UaConfig::mainThreadOnly is enabled and this function is called from the main thread (by default the main thread is thread that calls libCreate()), this function will also scan and run any pending jobs in the list.
- Parameters
msec_timeout – Maximum time to wait, in miliseconds.
- Returns
The number of events that have been handled during the poll. Negative value indicates error, and application can retrieve the error as (status = -return_value).
- void libDestroy (unsigned prmFlags=0) PJSUA2_THROW(Error)
Destroy pjsua. Application is recommended to perform graceful shutdown before calling this function (such as unregister the account from the SIP server, terminate presense subscription, and hangup active calls), however, this function will do all of these if it finds there are active sessions that need to be terminated. This function will block for few seconds to wait for replies from remote.
Application.may safely call this function more than once if it doesn’t keep track of it’s state.
- Parameters
prmFlags – Combination of pjsua_destroy_flag enumeration.
-
string utilStrError(pj_status_t prmErr)¶
Retrieve the error string for the specified status code.
- Parameters
prmErr – The error code.
-
void utilLogWrite(int prmLevel, const string &prmSender, const string &prmMsg)¶
Write a log message.
- Parameters
prmLevel – Log verbosity level (1-5)
prmSender – The log sender.
prmMsg – The log message.
-
void utilLogWrite(LogEntry &e)¶
Write a log entry. Application must implement its own custom LogWriter and this function will then call the LogWriter::write() method. Note that this function does not call PJSIP’s internal logging functionality. For that, you should use utilLogWrite(prmLevel, prmSender, prmMsg) above.
- Parameters
e – The log entry.
-
pj_status_t utilVerifySipUri(const string &prmUri)¶
This is a utility function to verify that valid SIP url is given. If the URL is a valid SIP/SIPS scheme, PJ_SUCCESS will be returned.
See also
- Parameters
prmUri – The URL string.
- Returns
PJ_SUCCESS on success, or the appropriate error code.
-
pj_status_t utilVerifyUri(const string &prmUri)¶
This is a utility function to verify that valid URI is given. Unlike utilVerifySipUri(), this function will return PJ_SUCCESS if tel: URI is given.
See also
- Parameters
prmUri – The URL string.
- Returns
PJ_SUCCESS on success, or the appropriate error code.
- Token utilTimerSchedule (unsigned prmMsecDelay, Token prmUserData) PJSUA2_THROW(Error)
Schedule a timer with the specified interval and user data. When the interval elapsed, onTimer() callback will be called. Note that the callback may be executed by different thread, depending on whether worker thread is enabled or not.
- Parameters
prmMsecDelay – The time interval in msec.
prmUserData – Arbitrary user data, to be given back to application in the callback.
- Returns
Token to identify the timer, which could be given to utilTimerCancel().
-
void utilTimerCancel(Token prmToken)¶
Cancel previously scheduled timer with the specified timer token.
- Parameters
prmToken – The timer token, which was returned from previous utilTimerSchedule() call.
-
void utilAddPendingJob(PendingJob *job)¶
Utility to register a pending job to be executed by main thread. If EpConfig::UaConfig::mainThreadOnly is false, the job will be executed immediately.
- Parameters
job – The job class.
- IntVector utilSslGetAvailableCiphers () PJSUA2_THROW(Error)
Get cipher list supported by SSL/TLS backend.
- void natDetectType (void) PJSUA2_THROW(Error)
This is a utility function to detect NAT type in front of this endpoint. Once invoked successfully, this function will complete asynchronously and report the result in onNatDetectionComplete().
After NAT has been detected and the callback is called, application can get the detected NAT type by calling natGetType(). Application can also perform NAT detection by calling natDetectType() again at later time.
Note that STUN must be enabled to run this function successfully.
- pj_stun_nat_type natGetType () PJSUA2_THROW(Error)
Get the NAT type as detected by natDetectType() function. This function will only return useful NAT type after natDetectType() has completed successfully and onNatDetectionComplete() callback has been called.
Exception: if this function is called while detection is in progress, PJ_EPENDING exception will be raised.
- void natUpdateStunServers (const StringVector &prmServers, bool prmWait) PJSUA2_THROW(Error)
Update the STUN servers list. The libInit() must have been called before calling this function.
- Parameters
prmServers – Array of STUN servers to try. The endpoint will try to resolve and contact each of the STUN server entry until it finds one that is usable. Each entry may be a domain name, host name, IP address, and it may contain an optional port number. For example:
”pjsip.org” (domain name)
”sip.pjsip.org” (host name)
”pjsip.org:33478” (domain name and a non- standard port number)
”10.0.0.1:3478” (IP address and port number)
prmWait – Specify if the function should block until it gets the result. In this case, the function will block while the resolution is being done, and the callback onNatCheckStunServersComplete() will be called before this function returns.
- void natCheckStunServers (const StringVector &prmServers, bool prmWait, Token prmUserData) PJSUA2_THROW(Error)
Auxiliary function to resolve and contact each of the STUN server entries (sequentially) to find which is usable. The libInit() must have been called before calling this function.
See also
- Parameters
prmServers – Array of STUN servers to try. The endpoint will try to resolve and contact each of the STUN server entry until it finds one that is usable. Each entry may be a domain name, host name, IP address, and it may contain an optional port number. For example:
”pjsip.org” (domain name)
”sip.pjsip.org” (host name)
”pjsip.org:33478” (domain name and a non- standard port number)
”10.0.0.1:3478” (IP address and port number)
prmWait – Specify if the function should block until it gets the result. In this case, the function will block while the resolution is being done, and the callback will be called before this function returns.
prmUserData – Arbitrary user data to be passed back to application in the callback.
- void natCancelCheckStunServers (Token token, bool notify_cb=false) PJSUA2_THROW(Error)
Cancel pending STUN resolution which match the specified token.
Exception: PJ_ENOTFOUND if there is no matching one, or other error.
- Parameters
token – The token to match. This token was given to natCheckStunServers()
notify_cb – Boolean to control whether the callback should be called for cancelled resolutions. When the callback is called, the status in the result will be set as PJ_ECANCELLED.
- TransportId transportCreate (pjsip_transport_type_e type, const TransportConfig &cfg) PJSUA2_THROW(Error)
Create and start a new SIP transport according to the specified settings.
- Parameters
type – Transport type.
cfg – Transport configuration.
- Returns
The transport ID.
- IntVector transportEnum () PJSUA2_THROW(Error)
Enumerate all transports currently created in the system. This function will return all transport IDs, and application may then call transportGetInfo() function to retrieve detailed information about the transport.
- Returns
Array of transport IDs.
- TransportInfo transportGetInfo (TransportId id) PJSUA2_THROW(Error)
Get information about transport.
- Parameters
id – Transport ID.
- Returns
Transport info.
- void transportSetEnable (TransportId id, bool enabled) PJSUA2_THROW(Error)
Disable a transport or re-enable it. By default transport is always enabled after it is created. Disabling a transport does not necessarily close the socket, it will only discard incoming messages and prevent the transport from being used to send outgoing messages.
- Parameters
id – Transport ID.
enabled – Enable or disable the transport.
- void transportClose (TransportId id) PJSUA2_THROW(Error)
Close the transport. The system will wait until all transactions are closed while preventing new users from using the transport, and will close the transport when its usage count reaches zero.
- Parameters
id – Transport ID.
- void transportShutdown (TransportHandle tp) PJSUA2_THROW(Error)
Start graceful shutdown procedure for this transport handle. After graceful shutdown has been initiated, no new reference can be obtained for the transport. However, existing objects that currently uses the transport may still use this transport to send and receive packets. After all objects release their reference to this transport, the transport will be destroyed immediately.
Note: application normally uses this API after obtaining the handle from onTransportState() callback.
- Parameters
tp – The transport.
-
void hangupAllCalls(void)¶
Terminate all calls. This will initiate call hangup for all currently active calls.
-
void mediaAdd(AudioMedia &media)¶
Add media to the media list.
- Parameters
media – media to be added.
-
void mediaRemove(AudioMedia &media)¶
Remove media from the media list.
- Parameters
media – media to be removed.
-
bool mediaExists(const AudioMedia &media) const¶
Check if media has been added to the media list.
- Parameters
media – media to be check.
- Returns
True if media has been added, false otherwise.
-
unsigned mediaMaxPorts() const¶
Get maximum number of media port.
- Returns
Maximum number of media port in the conference bridge.
-
unsigned mediaActivePorts() const¶
Get current number of active media port in the bridge.
- Returns
The number of active media port.
- const AudioMediaVector & mediaEnumPorts () const PJSUA2_THROW(Error)
Warning: deprecated, use mediaEnumPorts2() instead. This function is not safe in multithreaded environment.
Enumerate all media port.
- Returns
The list of media port.
- AudioMediaVector2 mediaEnumPorts2 () const PJSUA2_THROW(Error)
Enumerate all audio media port.
- Returns
The list of audio media port.
- VideoMediaVector mediaEnumVidPorts () const PJSUA2_THROW(Error)
Enumerate all video media port.
- Returns
The list of video media port.
-
AudDevManager &audDevManager()¶
Get the instance of Audio Device Manager.
- Returns
The Audio Device Manager.
-
VidDevManager &vidDevManager()¶
Get the instance of Video Device Manager.
- Returns
The Video Device Manager.
- const CodecInfoVector & codecEnum () PJSUA2_THROW(Error)
Warning: deprecated, use codecEnum2() instead. This function is not safe in multithreaded environment.
Enum all supported codecs in the system.
- Returns
Array of codec info.
- CodecInfoVector2 codecEnum2 () const PJSUA2_THROW(Error)
Enum all supported codecs in the system.
- Returns
Array of codec info.
- void codecSetPriority (const string &codec_id, pj_uint8_t priority) PJSUA2_THROW(Error)
Change codec priority.
- Parameters
codec_id – Codec ID, which is a string that uniquely identify the codec (such as “speex/8000”).
priority – Codec priority, 0-255, where zero means to disable the codec.
- CodecParam codecGetParam (const string &codec_id) const PJSUA2_THROW(Error)
Get codec parameters.
- Parameters
codec_id – Codec ID.
- Returns
Codec parameters. If codec is not found, Error will be thrown.
- void codecSetParam (const string &codec_id, const CodecParam param) PJSUA2_THROW(Error)
Set codec parameters.
- Parameters
codec_id – Codec ID.
param – Codec parameter to set. Set to NULL to reset codec parameter to library default settings.
- const CodecInfoVector & videoCodecEnum () PJSUA2_THROW(Error)
Warning: deprecated, use videoCodecEnum2() instead. This function is not safe in multithreaded environment.
Enum all supported video codecs in the system.
- Returns
Array of video codec info.
- CodecInfoVector2 videoCodecEnum2 () const PJSUA2_THROW(Error)
Enum all supported video codecs in the system.
- Returns
Array of video codec info.
- void videoCodecSetPriority (const string &codec_id, pj_uint8_t priority) PJSUA2_THROW(Error)
Change video codec priority.
- Parameters
codec_id – Codec ID, which is a string that uniquely identify the codec (such as “H263/90000”). Please see pjsua manual or pjmedia codec reference for details.
priority – Codec priority, 0-255, where zero means to disable the codec.
- VidCodecParam getVideoCodecParam (const string &codec_id) const PJSUA2_THROW(Error)
Get video codec parameters.
- Parameters
codec_id – Codec ID.
- Returns
Codec parameters. If codec is not found, Error will be thrown.
- void setVideoCodecParam (const string &codec_id, const VidCodecParam ¶m) PJSUA2_THROW(Error)
Set video codec parameters.
- Parameters
codec_id – Codec ID.
param – Codec parameter to set.
- void resetVideoCodecParam (const string &codec_id) PJSUA2_THROW(Error)
Reset video codec parameters to library default settings.
- Parameters
codec_id – Codec ID.
- StringVector srtpCryptoEnum () PJSUA2_THROW(Error)
Enumerate all SRTP crypto-suite names.
- Returns
The list of SRTP crypto-suite name.
- void handleIpChange (const IpChangeParam ¶m) PJSUA2_THROW(Error)
Inform the stack that IP address change event was detected. The stack will:
Restart the listener (this step is configurable via IpChangeParam.restartListener).
Shutdown the transport used by account registration (this step is configurable via AccountConfig.ipChangeConfig.shutdownTp).
Update contact URI by sending re-Registration (this step is configurable via a\ AccountConfig.natConfig.contactRewriteUse and a\ AccountConfig.natConfig.contactRewriteMethod)
Hangup active calls (this step is configurable via a\ AccountConfig.ipChangeConfig.hangupCalls) or continue the call by sending re-INVITE (configurable via AccountConfig.ipChangeConfig.reinviteFlags).
- Parameters
param – The IP change parameter, have a look at #IpChangeParam.
-
inline virtual void onNatDetectionComplete(const OnNatDetectionCompleteParam &prm)¶
Callback when the Endpoint has finished performing NAT type detection that is initiated with natDetectType().
- Parameters
prm – Callback parameters containing the detection result.
-
inline virtual void onNatCheckStunServersComplete(const OnNatCheckStunServersCompleteParam &prm)¶
Callback when the Endpoint has finished performing STUN server checking that is initiated when calling libInit(), or by calling natCheckStunServers() or natUpdateStunServers().
- Parameters
prm – Callback parameters.
-
inline virtual void onTransportState(const OnTransportStateParam &prm)¶
This callback is called when transport state has changed.
- Parameters
prm – Callback parameters.
-
inline virtual void onTimer(const OnTimerParam &prm)¶
Callback when a timer has fired. The timer was scheduled by utilTimerSchedule().
- Parameters
prm – Callback parameters.
-
inline virtual void onSelectAccount(OnSelectAccountParam &prm)¶
This callback can be used by application to override the account to be used to handle an incoming message. Initially, the account to be used will be calculated automatically by the library. This initial account will be used if application does not implement this callback, or application sets an invalid account upon returning from this callback.
Note that currently the incoming messages requiring account assignment are INVITE, MESSAGE, SUBSCRIBE, and unsolicited NOTIFY. This callback may be called before the callback of the SIP event itself, i.e: incoming call, pager, subscription, or unsolicited-event.
- Parameters
prm – Callback parameters.
-
inline virtual void onIpChangeProgress(OnIpChangeProgressParam &prm)¶
Calling handleIpChange() may involve different operation. This callback is called to report the progress of each enabled operation.
- Parameters
prm – Callback parameters.
-
inline virtual void onMediaEvent(OnMediaEventParam &prm)¶
Notification about media events such as video notifications. This callback will most likely be called from media threads, thus application must not perform heavy processing in this callback. If application needs to perform more complex tasks to handle the event, it should post the task to another thread.
- Parameters
prm – Callback parameter.
-
virtual pj_status_t onCredAuth(OnCredAuthParam &prm)¶
Callback for computation of the digest credential.
Usually, an application does not need to implement (overload) this callback. Use it, if your application needs to support Digest AKA authentication without the default digest computation back-end (i.e: using libmilenage).
To use Digest AKA authentication, add PJSIP_CRED_DATA_EXT_AKA flag in the AuthCredInfo’s dataType field of the AccountConfig, and fill up other AKA specific information in AuthCredInfo:
If PJSIP_HAS_DIGEST_AKA_AUTH is disabled, you have to overload this callback to provide your own digest computation back-end.
If PJSIP_HAS_DIGEST_AKA_AUTH is enabled, libmilenage library from third_party directory is linked, and this callback returns PJ_ENOTSUP, then the default digest computation back-end is used.
- Parameters
prm.digestChallenge – The authentication challenge sent by server in 401 or 401 response, as either Proxy-Authenticate or WWW-Authenticate header.
prm.credentialInfo – The credential to be used.
method – The request method.
prm.digestCredential – The digest credential where the digest response will be placed to. Upon calling this function, the nonce, nc, cnonce, qop, uri, and realm fields of this structure must have been set by caller. Upon return, the response field will be initialized by this function.
- Returns
PJ_ENOTSUP is the default. If you overload this callback, return PJ_SUCCESS on success.
Public Static Functions
- static Endpoint & instance () PJSUA2_THROW(Error)
Retrieve the singleton instance of the endpoint
Private Functions
-
void performPendingJobs()¶
-
void clearCodecInfoList(CodecInfoVector &codec_list)¶
-
void updateCodecInfoList(pjsua_codec_info pj_codec[], unsigned count, CodecInfoVector &codec_list)¶
Private Members
-
AudDevManager audioDevMgr¶
-
VidDevManager videoDevMgr¶
-
CodecInfoVector codecInfoList¶
-
CodecInfoVector videoCodecInfoList¶
-
std::map<pj_thread_t*, pj_thread_desc*> threadDescMap¶
-
pj_mutex_t *threadDescMutex¶
-
AudioMediaVector mediaList¶
-
pj_mutex_t *mediaListMutex¶
-
bool mainThreadOnly¶
-
void *mainThread¶
-
unsigned pendingJobSize¶
-
std::list<PendingJob*> pendingJobs¶
Private Static Functions
-
static void logFunc(int level, const char *data, int len)¶
-
static void stun_resolve_cb(const pj_stun_resolve_result *result)¶
-
static void on_timer(pj_timer_heap_t *timer_heap, struct pj_timer_entry *entry)¶
-
static void on_nat_detect(const pj_stun_nat_detect_result *res)¶
-
static void on_transport_state(pjsip_transport *tp, pjsip_transport_state state, const pjsip_transport_state_info *info)¶
-
static void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id, pjsip_rx_data *rdata)¶
-
static void on_reg_started(pjsua_acc_id acc_id, pj_bool_t renew)¶
-
static void on_reg_state2(pjsua_acc_id acc_id, pjsua_reg_info *info)¶
-
static void on_incoming_subscribe(pjsua_acc_id acc_id, pjsua_srv_pres *srv_pres, pjsua_buddy_id buddy_id, const pj_str_t *from, pjsip_rx_data *rdata, pjsip_status_code *code, pj_str_t *reason, pjsua_msg_data *msg_data)¶
-
static void on_pager2(pjsua_call_id call_id, const pj_str_t *from, const pj_str_t *to, const pj_str_t *contact, const pj_str_t *mime_type, const pj_str_t *body, pjsip_rx_data *rdata, pjsua_acc_id acc_id)¶
-
static void on_pager_status2(pjsua_call_id call_id, const pj_str_t *to, const pj_str_t *body, void *user_data, pjsip_status_code status, const pj_str_t *reason, pjsip_tx_data *tdata, pjsip_rx_data *rdata, pjsua_acc_id acc_id)¶
-
static void on_typing2(pjsua_call_id call_id, const pj_str_t *from, const pj_str_t *to, const pj_str_t *contact, pj_bool_t is_typing, pjsip_rx_data *rdata, pjsua_acc_id acc_id)¶
-
static void on_mwi_info(pjsua_acc_id acc_id, pjsua_mwi_info *mwi_info)¶
-
static void on_acc_find_for_incoming(const pjsip_rx_data *rdata, pjsua_acc_id *acc_id)¶
-
static void on_buddy_state(pjsua_buddy_id buddy_id)¶
-
static void on_buddy_evsub_state(pjsua_buddy_id buddy_id, pjsip_evsub *sub, pjsip_event *event)¶
-
static void on_call_state(pjsua_call_id call_id, pjsip_event *e)¶
-
static void on_call_tsx_state(pjsua_call_id call_id, pjsip_transaction *tsx, pjsip_event *e)¶
-
static void on_call_media_state(pjsua_call_id call_id)¶
-
static void on_call_sdp_created(pjsua_call_id call_id, pjmedia_sdp_session *sdp, pj_pool_t *pool, const pjmedia_sdp_session *rem_sdp)¶
-
static void on_stream_precreate(pjsua_call_id call_id, pjsua_on_stream_precreate_param *param)¶
-
static void on_stream_created2(pjsua_call_id call_id, pjsua_on_stream_created_param *param)¶
-
static void on_stream_destroyed(pjsua_call_id call_id, pjmedia_stream *strm, unsigned stream_idx)¶
-
static void on_dtmf_digit(pjsua_call_id call_id, int digit)¶
-
static void on_dtmf_digit2(pjsua_call_id call_id, const pjsua_dtmf_info *info)¶
-
static void on_dtmf_event(pjsua_call_id call_id, const pjsua_dtmf_event *event)¶
-
static void on_call_transfer_request(pjsua_call_id call_id, const pj_str_t *dst, pjsip_status_code *code)¶
-
static void on_call_transfer_request2(pjsua_call_id call_id, const pj_str_t *dst, pjsip_status_code *code, pjsua_call_setting *opt)¶
-
static void on_call_transfer_status(pjsua_call_id call_id, int st_code, const pj_str_t *st_text, pj_bool_t final, pj_bool_t *p_cont)¶
-
static void on_call_replace_request(pjsua_call_id call_id, pjsip_rx_data *rdata, int *st_code, pj_str_t *st_text)¶
-
static void on_call_replace_request2(pjsua_call_id call_id, pjsip_rx_data *rdata, int *st_code, pj_str_t *st_text, pjsua_call_setting *opt)¶
-
static void on_call_replaced(pjsua_call_id old_call_id, pjsua_call_id new_call_id)¶
-
static void on_call_rx_offer(pjsua_call_id call_id, const pjmedia_sdp_session *offer, void *reserved, pjsip_status_code *code, pjsua_call_setting *opt)¶
-
static void on_call_rx_reinvite(pjsua_call_id call_id, const pjmedia_sdp_session *offer, pjsip_rx_data *rdata, void *reserved, pj_bool_t *async, pjsip_status_code *code, pjsua_call_setting *opt)¶
-
static void on_call_tx_offer(pjsua_call_id call_id, void *reserved, pjsua_call_setting *opt)¶
-
static pjsip_redirect_op on_call_redirected(pjsua_call_id call_id, const pjsip_uri *target, const pjsip_event *e)¶
-
static pj_status_t on_call_media_transport_state(pjsua_call_id call_id, const pjsua_med_tp_state_info *info)¶
-
static void on_media_event(pjmedia_event *event)¶
-
static void on_call_media_event(pjsua_call_id call_id, unsigned med_idx, pjmedia_event *event)¶
-
static pjmedia_transport *on_create_media_transport(pjsua_call_id call_id, unsigned media_idx, pjmedia_transport *base_tp, unsigned flags)¶
-
static void on_create_media_transport_srtp(pjsua_call_id call_id, unsigned media_idx, pjmedia_srtp_setting *srtp_opt)¶
-
static void on_ip_change_progress(pjsua_ip_change_op op, pj_status_t status, const pjsua_ip_change_op_info *info)¶
-
static pj_status_t on_auth_create_aka_response_callback(pj_pool_t *pool, const pjsip_digest_challenge *chal, const pjsip_cred_info *cred, const pj_str_t *method, pjsip_digest_credential *auth)¶
Friends
- friend class Account
-
Endpoint()¶
-
struct EpConfig : public pj::PersistentObject
- #include <endpoint.hpp>
Endpoint configuration
Public Functions
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container.
- Parameters
node – Container to write values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container.
- Parameters
node – Container to write values to.
-
struct IpChangeParam
- #include <endpoint.hpp>
Parameter of Endpoint::handleIpChange().
Public Functions
-
IpChangeParam()¶
Constructor.
-
pjsua_ip_change_param toPj() const¶
Export to pjsua_ip_change_param.
-
void fromPj(const pjsua_ip_change_param ¶m)¶
Convert from pjsip
Public Members
-
bool restartListener¶
If set to PJ_TRUE, this will restart the transport listener.
Default : PJ_TRUE
-
unsigned restartLisDelay¶
If restartListener is set to PJ_TRUE, some delay might be needed for the listener to be restarted. Use this to set the delay.
Default : PJSUA_TRANSPORT_RESTART_DELAY_TIME
-
IpChangeParam()¶
-
struct LogConfig : public pj::PersistentObject
- #include <endpoint.hpp>
Logging configuration, which can be (optionally) specified when calling Lib::init().
Public Functions
-
LogConfig()¶
Default constructor initialises with default values
-
void fromPj(const pjsua_logging_config &lc)¶
Construct from pjsua_logging_config
-
pjsua_logging_config toPj() const¶
Generate pjsua_logging_config.
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container.
- Parameters
node – Container to write values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container.
- Parameters
node – Container to write values to.
Public Members
-
unsigned msgLogging¶
Log incoming and outgoing SIP message? Yes!
-
unsigned level¶
Input verbosity level. Value 5 is reasonable.
-
unsigned consoleLevel¶
Verbosity level for console. Value 4 is reasonable.
-
unsigned decor¶
Log decoration.
-
string filename¶
Optional log filename if app wishes the library to write to log file.
-
unsigned fileFlags¶
Additional flags to be given to pj_file_open() when opening the log file. By default, the flag is PJ_O_WRONLY. Application may set PJ_O_APPEND here so that logs are appended to existing file instead of overwriting it.
Default is 0.
-
LogConfig()¶
-
struct LogEntry
- #include <endpoint.hpp>
Data containing log entry to be written by the LogWriter.
-
class LogWriter
- #include <endpoint.hpp>
Interface for writing log messages. Applications can inherit this class and supply it in the LogConfig structure to implement custom log writing facility.
-
struct MediaConfig : public pj::PersistentObject
- #include <endpoint.hpp>
This structure describes media configuration, which will be specified when calling Lib::init().
Public Functions
-
MediaConfig()¶
Default constructor initialises with default values
-
void fromPj(const pjsua_media_config &mc)¶
Construct from pjsua_media_config.
-
pjsua_media_config toPj() const¶
Export
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container.
- Parameters
node – Container to write values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container.
- Parameters
node – Container to write values to.
Public Members
-
unsigned clockRate¶
Clock rate to be applied to the conference bridge. If value is zero, default clock rate will be used (PJSUA_DEFAULT_CLOCK_RATE, which by default is 16KHz).
-
unsigned sndClockRate¶
Clock rate to be applied when opening the sound device. If value is zero, conference bridge clock rate will be used.
-
unsigned channelCount¶
Channel count be applied when opening the sound device and conference bridge.
-
unsigned audioFramePtime¶
Specify audio frame ptime. The value here will affect the samples per frame of both the sound device and the conference bridge. Specifying lower ptime will normally reduce the latency.
Default value: PJSUA_DEFAULT_AUDIO_FRAME_PTIME
-
unsigned maxMediaPorts¶
Specify maximum number of media ports to be created in the conference bridge. Since all media terminate in the bridge (calls, file player, file recorder, etc), the value must be large enough to support all of them. However, the larger the value, the more computations are performed.
Default value: PJSUA_MAX_CONF_PORTS
-
bool hasIoqueue¶
Specify whether the media manager should manage its own ioqueue for the RTP/RTCP sockets. If yes, ioqueue will be created and at least one worker thread will be created too. If no, the RTP/RTCP sockets will share the same ioqueue as SIP sockets, and no worker thread is needed.
Normally application would say yes here, unless it wants to run everything from a single thread.
-
unsigned threadCnt¶
Specify the number of worker threads to handle incoming RTP packets. A value of one is recommended for most applications.
-
unsigned quality¶
Media quality, 0-10, according to this table: 5-10: resampling use large filter, 3-4: resampling use small filter, 1-2: resampling use linear. The media quality also sets speex codec quality/complexity to the number.
Default: 5 (PJSUA_DEFAULT_CODEC_QUALITY).
-
unsigned ptime¶
Specify default codec ptime.
Default: 0 (codec specific)
-
bool noVad¶
Disable VAD?
Default: 0 (no (meaning VAD is enabled))
-
unsigned ilbcMode¶
iLBC mode (20 or 30).
Default: 30 (PJSUA_DEFAULT_ILBC_MODE)
-
unsigned txDropPct¶
Percentage of RTP packet to drop in TX direction (to simulate packet lost).
Default: 0
-
unsigned rxDropPct¶
Percentage of RTP packet to drop in RX direction (to simulate packet lost).
Default: 0
-
unsigned ecOptions¶
Echo canceller options (see pjmedia_echo_create()). Specify PJMEDIA_ECHO_USE_SW_ECHO here if application wishes to use software echo canceller instead of device EC.
Default: 0.
-
unsigned ecTailLen¶
Echo canceller tail length, in miliseconds. Setting this to zero will disable echo cancellation.
Default: PJSUA_DEFAULT_EC_TAIL_LEN
-
unsigned sndRecLatency¶
Audio capture buffer length, in milliseconds.
Default: PJMEDIA_SND_DEFAULT_REC_LATENCY
-
unsigned sndPlayLatency¶
Audio playback buffer length, in milliseconds.
Default: PJMEDIA_SND_DEFAULT_PLAY_LATENCY
-
int jbInit¶
Jitter buffer initial prefetch delay in msec. The value must be between jb_min_pre and jb_max_pre below.
Default: -1 (to use default stream settings, currently 150 msec)
-
int jbMinPre¶
Jitter buffer minimum prefetch delay in msec.
Default: -1 (to use default stream settings, currently 60 msec)
-
int jbMaxPre¶
Jitter buffer maximum prefetch delay in msec.
Default: -1 (to use default stream settings, currently 240 msec)
-
int jbMax¶
Set maximum delay that can be accomodated by the jitter buffer msec.
Default: -1 (to use default stream settings, currently 360 msec)
-
pjmedia_jb_discard_algo jbDiscardAlgo¶
Set the algorithm the jitter buffer uses to discard frames in order to adjust the latency.
Default: PJMEDIA_JB_DISCARD_PROGRESSIVE
-
int sndAutoCloseTime¶
Specify idle time of sound device before it is automatically closed, in seconds. Use value -1 to disable the auto-close feature of sound device
Default : 1
-
bool vidPreviewEnableNative¶
Specify whether built-in/native preview should be used if available. In some systems, video input devices have built-in capability to show preview window of the device. Using this built-in preview is preferable as it consumes less CPU power. If built-in preview is not available, the library will perform software rendering of the input. If this field is set to PJ_FALSE, software preview will always be used.
Default: PJ_TRUE
-
MediaConfig()¶
-
struct OnCredAuthParam
- #include <endpoint.hpp>
Parameters for onCredAuth account method.
Public Members
-
DigestChallenge digestChallenge¶
-
AuthCredInfo credentialInfo¶
-
std::string method¶
-
DigestCredential digestCredential¶
-
DigestChallenge digestChallenge¶
-
struct OnIpChangeProgressParam
- #include <endpoint.hpp>
Parameter of Endpoint::onIpChangeProgress().
Public Members
-
pjsua_ip_change_op op¶
The IP change progress operation.
-
pj_status_t status¶
The operation progress status.
-
TransportId transportId¶
Information of the transport id. This is only available when the operation is PJSUA_IP_CHANGE_OP_RESTART_LIS.
-
int accId¶
Information of the account id. This is only available when the operation is:
PJSUA_IP_CHANGE_OP_ACC_SHUTDOWN_TP
PJSUA_IP_CHANGE_OP_ACC_UPDATE_CONTACT
PJSUA_IP_CHANGE_OP_ACC_HANGUP_CALLS
PJSUA_IP_CHANGE_OP_ACC_REINVITE_CALLS
-
int callId¶
Information of the call id. This is only available when the operation is PJSUA_IP_CHANGE_OP_ACC_HANGUP_CALLS or PJSUA_IP_CHANGE_OP_ACC_REINVITE_CALLS
-
RegProgressParam regInfo¶
Registration information. This is only available when the operation is PJSUA_IP_CHANGE_OP_ACC_UPDATE_CONTACT
-
pjsua_ip_change_op op¶
-
struct OnMediaEventParam
- #include <endpoint.hpp>
Parameter of Endpoint::onCallMediaEvent() callback.
Public Members
-
MediaEvent ev¶
The media event.
-
MediaEvent ev¶
-
struct OnNatCheckStunServersCompleteParam
- #include <endpoint.hpp>
Argument to Endpoint::onNatCheckStunServersComplete() callback.
Public Members
-
Token userData¶
Arbitrary user data that was passed to Endpoint::natCheckStunServers() function.
-
pj_status_t status¶
This will contain PJ_SUCCESS if at least one usable STUN server is found, otherwise it will contain the last error code during the operation.
-
string name¶
The server name that yields successful result. This will only contain value if status is successful.
-
SocketAddress addr¶
The server IP address and port in “IP:port” format. This will only contain value if status is successful.
-
Token userData¶
-
struct OnNatDetectionCompleteParam
- #include <endpoint.hpp>
Argument to Endpoint::onNatDetectionComplete() callback.
Public Members
-
pj_status_t status¶
Status of the detection process. If this value is not PJ_SUCCESS, the detection has failed and nat_type field will contain PJ_STUN_NAT_TYPE_UNKNOWN.
-
string reason¶
The text describing the status, if the status is not PJ_SUCCESS.
-
pj_stun_nat_type natType¶
This contains the NAT type as detected by the detection procedure. This value is only valid when the status is PJ_SUCCESS.
-
string natTypeName¶
Text describing that NAT type.
-
pj_status_t status¶
-
struct OnSelectAccountParam
- #include <endpoint.hpp>
Parameter of Endpoint::onSelectAccount() callback.
-
struct OnTimerParam
- #include <endpoint.hpp>
Parameter of Endpoint::onTimer() callback.
Public Members
-
Token userData¶
Arbitrary user data that was passed to Endpoint::utilTimerSchedule() function.
-
unsigned msecDelay¶
The interval of this timer, in miliseconds.
-
Token userData¶
-
struct OnTransportStateParam
- #include <endpoint.hpp>
Parameter of Endpoint::onTransportState() callback.
Public Members
-
TransportHandle hnd¶
The transport handle.
-
string type¶
The transport type.
-
pjsip_transport_state state¶
Transport current state.
-
pj_status_t lastError¶
The last error code related to the transport state.
-
TlsInfo tlsInfo¶
TLS transport info, only used if transport type is TLS. Use TlsInfo.isEmpty() to check if this info is available.
-
TransportHandle hnd¶
-
struct PendingJob
-
struct RegProgressParam
- #include <endpoint.hpp>
Information of Update contact on IP change progress.
-
struct SslCertInfo
- #include <endpoint.hpp>
SSL certificate information.
Public Functions
-
SslCertInfo()¶
Constructor.
-
bool isEmpty() const¶
Check if the info is set with empty values.
- Returns
True if the info is empty.
-
void fromPj(const pj_ssl_cert_info &info)¶
Convert from pjsip
Public Members
-
unsigned version¶
Certificate version
-
unsigned char serialNo[20]¶
Serial number, array of octets, first index is MSB
-
string subjectCn¶
Subject common name
-
string subjectInfo¶
One line subject, fields are separated by slash, e.g: “CN=sample.org/OU=HRD”
-
string issuerCn¶
Issuer common name
-
string issuerInfo¶
One line subject, fields are separated by slash
-
bool validityGmt¶
Flag if validity date/time use GMT
-
SslCertNameVector subjectAltName¶
Subject alternative name extension
-
string raw¶
Raw certificate in PEM format, only available for remote certificate
Private Members
-
bool empty¶
-
SslCertInfo()¶
-
struct SslCertName
- #include <endpoint.hpp>
SSL certificate type and name structure.
Public Functions
-
inline SslCertName()¶
Default constructor
-
inline SslCertName()¶
-
struct TlsInfo
- #include <endpoint.hpp>
TLS transport information.
Public Functions
-
TlsInfo()¶
Constructor.
-
bool isEmpty() const¶
Check if the info is set with empty values.
- Returns
True if the info is empty.
-
void fromPj(const pjsip_tls_state_info &info)¶
Convert from pjsip
Public Members
-
bool established¶
Describes whether secure socket connection is established, i.e: TLS/SSL handshaking has been done successfully.
-
unsigned protocol¶
Describes secure socket protocol being used, see pj_ssl_sock_proto. Use bitwise OR operation to combine the protocol type.
-
pj_ssl_cipher cipher¶
Describes cipher suite being used, this will only be set when connection is established.
-
string cipherName¶
Describes cipher name being used, this will only be set when connection is established.
-
SocketAddress localAddr¶
Describes local address.
-
SocketAddress remoteAddr¶
Describes remote address.
-
SslCertInfo localCertInfo¶
Describes active local certificate info. Use SslCertInfo.isEmpty() to check if the local cert info is available.
-
SslCertInfo remoteCertInfo¶
Describes active remote certificate info. Use SslCertInfo.isEmpty() to check if the remote cert info is available.
-
unsigned verifyStatus¶
Status of peer certificate verification.
-
StringVector verifyMsgs¶
Error messages (if any) of peer certificate verification, based on the field verifyStatus above.
Private Members
-
bool empty¶
-
TlsInfo()¶
-
struct UaConfig : public pj::PersistentObject
- #include <endpoint.hpp>
SIP User Agent related settings.
Public Functions
-
UaConfig()¶
Default constructor to initialize with default values.
-
void fromPj(const pjsua_config &ua_cfg)¶
Construct from pjsua_config.
-
pjsua_config toPj() const¶
Export to pjsua_config
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container.
- Parameters
node – Container to write values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container.
- Parameters
node – Container to write values to.
Public Members
-
unsigned maxCalls¶
Maximum calls to support (default: 4). The value specified here must be smaller than the compile time maximum settings PJSUA_MAX_CALLS, which by default is 32. To increase this limit, the library must be recompiled with new PJSUA_MAX_CALLS value.
-
unsigned threadCnt¶
Number of worker threads. Normally application will want to have at least one worker thread, unless when it wants to poll the library periodically, which in this case the worker thread can be set to zero.
-
bool mainThreadOnly¶
When this flag is non-zero, all callbacks that come from thread other than main thread will be posted to the main thread and to be executed by Endpoint::libHandleEvents() function. This includes the logging callback. Note that this will only work if threadCnt is set to zero and Endpoint::libHandleEvents() is performed by main thread. By default, the main thread is set from the thread that invoke Endpoint::libCreate()
Default: false
-
StringVector nameserver¶
Array of nameservers to be used by the SIP resolver subsystem. The order of the name server specifies the priority (first name server will be used first, unless it is not reachable).
-
StringVector outboundProxies¶
Specify the URL of outbound proxies to visit for all outgoing requests. The outbound proxies will be used for all accounts, and it will be used to build the route set for outgoing requests. The final route set for outgoing requests will consists of the outbound proxies and the proxy configured in the account.
-
string userAgent¶
Optional user agent string (default empty). If it’s empty, no User-Agent header will be sent with outgoing requests.
-
StringVector stunServer¶
Array of STUN servers to try. The library will try to resolve and contact each of the STUN server entry until it finds one that is usable. Each entry may be a domain name, host name, IP address, and it may contain an optional port number. For example:
”pjsip.org” (domain name)
”sip.pjsip.org” (host name)
”pjsip.org:33478” (domain name and a non-standard port number)
”10.0.0.1:3478” (IP address and port number)
When nameserver is configured in the pjsua_config.nameserver field, if entry is not an IP address, it will be resolved with DNS SRV resolution first, and it will fallback to use DNS A resolution if this fails. Port number may be specified even if the entry is a domain name, in case the DNS SRV resolution should fallback to a non-standard port.
When nameserver is not configured, entries will be resolved with pj_gethostbyname() if it’s not an IP address. Port number may be specified if the server is not listening in standard STUN port.
-
bool stunTryIpv6¶
This specifies if the library should try to do an IPv6 resolution of the STUN servers if the IPv4 resolution fails. It can be useful in an IPv6-only environment, including on NAT64.
Default: FALSE
-
bool stunIgnoreFailure¶
This specifies if the library startup should ignore failure with the STUN servers. If this is set to PJ_FALSE, the library will refuse to start if it fails to resolve or contact any of the STUN servers.
Default: TRUE
-
int natTypeInSdp¶
Support for adding and parsing NAT type in the SDP to assist troubleshooting. The valid values are:
0: no information will be added in SDP, and parsing is disabled.
1: only the NAT type number is added.
2: add both NAT type number and name.
Default: 1
-
bool mwiUnsolicitedEnabled¶
Handle unsolicited NOTIFY requests containing message waiting indication (MWI) info. Unsolicited MWI is incoming NOTIFY requests which are not requested by client with SUBSCRIBE request.
If this is enabled, the library will respond 200/OK to the NOTIFY request and forward the request to Endpoint::onMwiInfo() callback.
See also AccountMwiConfig.enabled.
Default: PJ_TRUE
-
UaConfig()¶
-
typedef std::vector<SslCertName> SslCertNameVector¶
account.hpp¶
PJSUA2 Account operations.
-
struct AccountIpChangeConfig
- #include <account.hpp>
Account config specific to IP address change.
Public Functions
-
inline virtual ~AccountIpChangeConfig()¶
Virtual destructor
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container node.
- Parameters
node – Container to write values to.
Public Members
-
bool shutdownTp¶
Shutdown the transport used for account registration. If this is set to PJ_TRUE, the transport will be shutdown altough it’s used by multiple account. Shutdown transport will be followed by re-Registration if AccountConfig.natConfig.contactRewriteUse is enabled.
Default: true
-
bool hangupCalls¶
Hangup active calls associated with the acount. If this is set to true, then the calls will be hang up.
Default: false
-
unsigned reinviteFlags¶
Specify the call flags used in the re-INVITE when hangupCalls is set to false. If this is set to 0, no re-INVITE will be sent. The re-INVITE will be sent after re-Registration is finished.
Default: PJSUA_CALL_REINIT_MEDIA | PJSUA_CALL_UPDATE_CONTACT | PJSUA_CALL_UPDATE_VIA
-
inline virtual ~AccountIpChangeConfig()¶
-
namespace pj
PJSUA2 API is inside pj namespace
Typedefs
-
typedef std::vector<AuthCredInfo> AuthCredInfoVector¶
Array of SIP credentials
-
typedef std::vector<SrtpCrypto> SrtpCryptoVector¶
-
class Account
- #include <account.hpp>
Public Functions
-
Account()¶
Constructor.
-
virtual ~Account()¶
Destructor. Note that if the account is deleted, it will also delete the corresponding account in the PJSUA-LIB.
If application implements a derived class, the derived class should call shutdown() in the beginning stage in its destructor, or alternatively application should call shutdown() before deleting the derived class instance. This is to avoid race condition between the derived class destructor and Account callbacks.
- void create (const AccountConfig &cfg, bool make_default=false) PJSUA2_THROW(Error)
Create the account.
If application implements a derived class, the derived class should call shutdown() in the beginning stage in its destructor, or alternatively application should call shutdown() before deleting the derived class instance. This is to avoid race condition between the derived class destructor and Account callbacks.
- Parameters
cfg – The account config.
make_default – Make this the default account.
-
void shutdown()¶
Shutdown the account. This will initiate unregistration if needed, and delete the corresponding account in the PJSUA-LIB.
Note that application must delete all Buddy instances belong to this account before shutting down the account.
If application implements a derived class, the derived class should call this method in the beginning stage in its destructor, or alternatively application should call this method before deleting the derived class instance. This is to avoid race condition between the derived class destructor and Account callbacks.
- void modify (const AccountConfig &cfg) PJSUA2_THROW(Error)
Modify the account to use the specified account configuration. Depending on the changes, this may cause unregistration or reregistration on the account.
- Parameters
cfg – New account config to be applied to the account.
-
bool isValid() const¶
Check if this account is still valid.
- Returns
True if it is.
- void setDefault () PJSUA2_THROW(Error)
Set this as default account to be used when incoming and outgoing requests don’t match any accounts.
-
bool isDefault() const¶
Check if this account is the default account. Default account will be used for incoming and outgoing requests that don’t match any other accounts.
- Returns
True if this is the default account.
-
int getId() const¶
Get PJSUA-LIB account ID or index associated with this account.
- Returns
Integer greater than or equal to zero.
- AccountInfo getInfo () const PJSUA2_THROW(Error)
Get account info.
- Returns
Account info.
- void setRegistration (bool renew) PJSUA2_THROW(Error)
Update registration or perform unregistration. Application normally only needs to call this function if it wants to manually update the registration or to unregister from the server.
- Parameters
renew – If False, this will start unregistration process.
- void setOnlineStatus (const PresenceStatus &pres_st) PJSUA2_THROW(Error)
Set or modify account’s presence online status to be advertised to remote/presence subscribers. This would trigger the sending of outgoing NOTIFY request if there are server side presence subscription for this account, and/or outgoing PUBLISH if presence publication is enabled for this account.
- Parameters
pres_st – Presence online status.
- void setTransport (TransportId tp_id) PJSUA2_THROW(Error)
Lock/bind this account to a specific transport/listener. Normally application shouldn’t need to do this, as transports will be selected automatically by the library according to the destination.
When account is locked/bound to a specific transport, all outgoing requests from this account will use the specified transport (this includes SIP registration, dialog (call and event subscription), and out-of-dialog requests such as MESSAGE).
Note that transport id may be specified in AccountConfig too.
- Parameters
tp_id – The transport ID.
- void presNotify (const PresNotifyParam &prm) PJSUA2_THROW(Error)
Send NOTIFY to inform account presence status or to terminate server side presence subscription. If application wants to reject the incoming request, it should set the param PresNotifyParam.state to PJSIP_EVSUB_STATE_TERMINATED.
- Parameters
prm – The sending NOTIFY parameter.
- const BuddyVector & enumBuddies () const PJSUA2_THROW(Error)
Warning: deprecated, use enumBuddies2() instead. This function is not safe in multithreaded environment.
Enumerate all buddies of the account.
- Returns
The buddy list.
- BuddyVector2 enumBuddies2 () const PJSUA2_THROW(Error)
Enumerate all buddies of the account.
- Returns
The buddy list.
- Buddy * findBuddy (string uri, FindBuddyMatch *buddy_match=NULL) const PJSUA2_THROW(Error)
Warning: deprecated, use findBuddy2 instead. This function is not safe in multithreaded environment.
Find a buddy in the buddy list with the specified URI.
Exception: if buddy is not found, PJ_ENOTFOUND will be thrown.
- Parameters
uri – The buddy URI.
buddy_match – The buddy match algo.
- Returns
The pointer to buddy.
- Buddy findBuddy2 (string uri) const PJSUA2_THROW(Error)
Find a buddy in the buddy list with the specified URI.
Exception: if buddy is not found, PJ_ENOTFOUND will be thrown.
- Parameters
uri – The buddy URI.
- Returns
The pointer to buddy.
-
inline virtual void onIncomingCall(OnIncomingCallParam &prm)¶
Notify application on incoming call.
- Parameters
prm – Callback parameter.
-
inline virtual void onRegStarted(OnRegStartedParam &prm)¶
Notify application when registration or unregistration has been initiated. Note that this only notifies the initial registration and unregistration. Once registration session is active, subsequent refresh will not cause this callback to be called.
- Parameters
prm – Callback parameter.
-
inline virtual void onRegState(OnRegStateParam &prm)¶
Notify application when registration status has changed. Application may then query the account info to get the registration details.
- Parameters
prm – Callback parameter.
-
inline virtual void onIncomingSubscribe(OnIncomingSubscribeParam &prm)¶
Notification when incoming SUBSCRIBE request is received. Application may use this callback to authorize the incoming subscribe request (e.g. ask user permission if the request should be granted).
If this callback is not implemented, all incoming presence subscription requests will be accepted.
If this callback is implemented, application has several choices on what to do with the incoming request:
it may reject the request immediately by specifying non-200 class final response in the IncomingSubscribeParam.code parameter.
it may immediately accept the request by specifying 200 as the IncomingSubscribeParam.code parameter. This is the default value if application doesn’t set any value to the IncomingSubscribeParam.code parameter. In this case, the library will automatically send NOTIFY request upon returning from this callback.
it may delay the processing of the request, for example to request user permission whether to accept or reject the request. In this case, the application MUST set the IncomingSubscribeParam.code argument to 202, then IMMEDIATELY calls presNotify() with state PJSIP_EVSUB_STATE_PENDING and later calls presNotify() again to accept or reject the subscription request.
Any IncomingSubscribeParam.code other than 200 and 202 will be treated as 200.
Application MUST return from this callback immediately (e.g. it must not block in this callback while waiting for user confirmation).
- Parameters
prm – Callback parameter.
-
inline virtual void onInstantMessage(OnInstantMessageParam &prm)¶
Notify application on incoming instant message or pager (i.e. MESSAGE request) that was received outside call context.
- Parameters
prm – Callback parameter.
-
inline virtual void onInstantMessageStatus(OnInstantMessageStatusParam &prm)¶
Notify application about the delivery status of outgoing pager/instant message (i.e. MESSAGE) request.
- Parameters
prm – Callback parameter.
-
inline virtual void onTypingIndication(OnTypingIndicationParam &prm)¶
Notify application about typing indication.
- Parameters
prm – Callback parameter.
-
inline virtual void onMwiInfo(OnMwiInfoParam &prm)¶
Notification about MWI (Message Waiting Indication) status change. This callback can be called upon the status change of the SUBSCRIBE request (for example, 202/Accepted to SUBSCRIBE is received) or when a NOTIFY reqeust is received.
- Parameters
prm – Callback parameter.
Public Static Functions
Private Functions
-
void addBuddy(Buddy *buddy)¶
An internal function to add a Buddy to Account buddy list. This method is used by Buddy::create().
-
void removeBuddy(Buddy *buddy)¶
An internal function to remove a Buddy from Account buddy list. This method is used by Buddy::~Buddy().
Friends
- friend class Endpoint
- friend class Buddy
-
Account()¶
-
struct AccountCallConfig : public pj::PersistentObject
- #include <account.hpp>
Account’s call settings. This will be specified in AccountConfig.
Public Functions
-
inline AccountCallConfig()¶
Default constructor
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container node.
- Parameters
node – Container to write values to.
Public Members
-
pjsua_call_hold_type holdType¶
Specify how to offer call hold to remote peer. Please see the documentation on pjsua_call_hold_type for more info.
Default: PJSUA_CALL_HOLD_TYPE_DEFAULT
-
pjsua_100rel_use prackUse¶
Specify how support for reliable provisional response (100rel/ PRACK) should be used for all sessions in this account. See the documentation of pjsua_100rel_use enumeration for more info.
Default: PJSUA_100REL_NOT_USED
-
pjsua_sip_timer_use timerUse¶
Specify the usage of Session Timers for all sessions. See the pjsua_sip_timer_use for possible values.
Default: PJSUA_SIP_TIMER_OPTIONAL
-
unsigned timerMinSESec¶
Specify minimum Session Timer expiration period, in seconds. Must not be lower than 90. Default is 90.
-
unsigned timerSessExpiresSec¶
Specify Session Timer expiration period, in seconds. Must not be lower than timerMinSE. Default is 1800.
-
inline AccountCallConfig()¶
-
struct AccountConfig : public pj::PersistentObject
- #include <account.hpp>
Account configuration.
Public Functions
-
AccountConfig()¶
Default constructor will initialize with default values.
-
void toPj(pjsua_acc_config &cfg) const¶
This will return a temporary pjsua_acc_config instance, which contents are only valid as long as this AccountConfig structure remains valid AND no modifications are done to it AND no further toPj() function call is made. Any call to toPj() function will invalidate the content of temporary pjsua_acc_config that was returned by the previous call.
-
void fromPj(const pjsua_acc_config &prm, const pjsua_media_config *mcfg)¶
Initialize from pjsip.
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container node.
- Parameters
node – Container to write values to.
Public Members
-
int priority¶
Account priority, which is used to control the order of matching incoming/outgoing requests. The higher the number means the higher the priority is, and the account will be matched first.
-
string idUri¶
The Address of Record or AOR, that is full SIP URL that identifies the account. The value can take name address or URL format, and will look something like “sip:account@serviceprovider”.
This field is mandatory.
-
AccountRegConfig regConfig¶
Registration settings.
-
AccountSipConfig sipConfig¶
SIP settings.
-
AccountCallConfig callConfig¶
Call settings.
-
AccountPresConfig presConfig¶
Presence settings.
-
AccountMwiConfig mwiConfig¶
MWI (Message Waiting Indication) settings.
-
AccountNatConfig natConfig¶
NAT settings.
-
AccountMediaConfig mediaConfig¶
Media settings (applicable for both audio and video).
-
AccountVideoConfig videoConfig¶
Video settings.
-
AccountIpChangeConfig ipChangeConfig¶
IP Change settings.
-
AccountConfig()¶
-
struct AccountInfo
- #include <account.hpp>
Account information. Application can query the account information by calling Account::getInfo().
Public Functions
-
inline AccountInfo()¶
Default constructor
-
void fromPj(const pjsua_acc_info &pai)¶
Import from pjsip data
Public Members
-
pjsua_acc_id id¶
The account ID.
-
bool isDefault¶
Flag to indicate whether this is the default account.
-
bool regIsConfigured¶
Flag to tell whether this account has registration setting (reg_uri is not empty).
-
bool regIsActive¶
Flag to tell whether this account is currently registered (has active registration session).
-
unsigned regExpiresSec¶
An up to date expiration interval for account registration session.
-
pjsip_status_code regStatus¶
Last registration status code. If status code is zero, the account is currently not registered. Any other value indicates the SIP status code of the registration.
-
string regStatusText¶
String describing the registration status.
-
pj_status_t regLastErr¶
Last registration error code. When the status field contains a SIP status code that indicates a registration failure, last registration error code contains the error code that causes the failure. In any other case, its value is zero.
-
bool onlineStatus¶
Presence online status for this account.
-
string onlineStatusText¶
Presence online status text.
-
inline AccountInfo()¶
-
struct AccountMediaConfig : public pj::PersistentObject
- #include <account.hpp>
Account media config (applicable for both audio and video). This will be specified in AccountConfig.
Public Functions
-
inline AccountMediaConfig()¶
Default constructor
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container node.
- Parameters
node – Container to write values to.
Public Members
-
TransportConfig transportConfig¶
Media transport (RTP) configuration.
For port and portRange settings, RTCP port is selected as RTP port+1. Example: port=5000, portRange=4
Available ports: 5000, 5002, 5004 (Media/RTP transport) 5001, 5003, 5005 (Media/RTCP transport)
-
bool lockCodecEnabled¶
If remote sends SDP answer containing more than one format or codec in the media line, send re-INVITE or UPDATE with just one codec to lock which codec to use.
Default: True (Yes).
-
bool streamKaEnabled¶
Specify whether stream keep-alive and NAT hole punching with non-codec-VAD mechanism (see PJMEDIA_STREAM_ENABLE_KA) is enabled for this account.
Default: False
-
pjmedia_srtp_use srtpUse¶
Specify whether secure media transport should be used for this account. Valid values are PJMEDIA_SRTP_DISABLED, PJMEDIA_SRTP_OPTIONAL, and PJMEDIA_SRTP_MANDATORY.
Default: PJSUA_DEFAULT_USE_SRTP
-
int srtpSecureSignaling¶
Specify whether SRTP requires secure signaling to be used. This option is only used when use_srtp option above is non-zero.
Valid values are: 0: SRTP does not require secure signaling 1: SRTP requires secure transport such as TLS 2: SRTP requires secure end-to-end transport (SIPS)
Default: PJSUA_DEFAULT_SRTP_SECURE_SIGNALING
-
pjsua_ipv6_use ipv6Use¶
Specify whether IPv6 should be used on media. Default is not used.
-
bool rtcpMuxEnabled¶
Enable RTP and RTCP multiplexing.
-
RtcpFbConfig rtcpFbConfig¶
RTCP Feedback settings.
-
bool useLoopMedTp¶
Use loopback media transport. This may be useful if application doesn’t want PJSUA2 to create real media transports/sockets, such as when using third party media.
Default: false
-
bool enableLoopback¶
Enable local loopback when useLoopMedTp is set to TRUE. If enabled, packets sent to the transport will be sent back to the streams attached to the transport.
Default: false
-
inline AccountMediaConfig()¶
-
struct AccountMwiConfig : public pj::PersistentObject
- #include <account.hpp>
Account MWI (Message Waiting Indication) settings. This will be specified in AccountConfig.
Public Functions
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container node.
- Parameters
node – Container to write values to.
Public Members
-
bool enabled¶
Subscribe to message waiting indication events (RFC 3842).
See also UaConfig.mwiUnsolicitedEnabled setting.
Default: FALSE
-
unsigned expirationSec¶
Specify the default expiration time (in seconds) for Message Waiting Indication (RFC 3842) event subscription. This must not be zero.
Default: PJSIP_MWI_DEFAULT_EXPIRES (3600)
-
struct AccountNatConfig : public pj::PersistentObject
- #include <account.hpp>
Account’s NAT (Network Address Translation) settings. This will be specified in AccountConfig.
Public Functions
-
inline AccountNatConfig()¶
Default constructor
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container node.
- Parameters
node – Container to write values to.
Public Members
-
pjsua_stun_use sipStunUse¶
Control the use of STUN for the SIP signaling.
Default: PJSUA_STUN_USE_DEFAULT
-
pjsua_stun_use mediaStunUse¶
Control the use of STUN for the media transports.
Default: PJSUA_STUN_USE_DEFAULT
-
pjsua_nat64_opt nat64Opt¶
Specify NAT64 options.
Default: PJSUA_NAT64_DISABLED
-
bool iceEnabled¶
Enable ICE for the media transport.
Default: False
-
pj_ice_sess_trickle iceTrickle¶
Set trickle ICE mode for ICE media transport.
Default: PJ_ICE_SESS_TRICKLE_DISABLED
-
int iceMaxHostCands¶
Set the maximum number of ICE host candidates.
Default: -1 (maximum not set)
-
bool iceAggressiveNomination¶
Specify whether to use aggressive nomination.
Default: True
-
unsigned iceNominatedCheckDelayMsec¶
For controlling agent if it uses regular nomination, specify the delay to perform nominated check (connectivity check with USE-CANDIDATE attribute) after all components have a valid pair.
Default value is PJ_ICE_NOMINATED_CHECK_DELAY.
-
int iceWaitNominationTimeoutMsec¶
For a controlled agent, specify how long it wants to wait (in milliseconds) for the controlling agent to complete sending connectivity check with nominated flag set to true for all components after the controlled agent has found that all connectivity checks in its checklist have been completed and there is at least one successful (but not nominated) check for every component.
Default value for this option is ICE_CONTROLLED_AGENT_WAIT_NOMINATION_TIMEOUT. Specify -1 to disable this timer.
-
bool iceNoRtcp¶
Disable RTCP component.
Default: False
-
bool iceAlwaysUpdate¶
Always send re-INVITE/UPDATE after ICE negotiation regardless of whether the default ICE transport address is changed or not. When this is set to False, re-INVITE/UPDATE will be sent only when the default ICE transport address is changed.
Default: yes
-
bool turnEnabled¶
Enable TURN candidate in ICE.
-
string turnServer¶
Specify TURN domain name or host name, in in “DOMAIN:PORT” or “HOST:PORT” format.
-
pj_turn_tp_type turnConnType¶
Specify the connection type to be used to the TURN server. Valid values are PJ_TURN_TP_UDP or PJ_TURN_TP_TCP.
Default: PJ_TURN_TP_UDP
-
string turnUserName¶
Specify the username to authenticate with the TURN server.
-
int turnPasswordType¶
Specify the type of password. Currently this must be zero to indicate plain-text password will be used in the password.
-
string turnPassword¶
Specify the password to authenticate with the TURN server.
-
int contactRewriteUse¶
This option is used to update the transport address and the Contact header of REGISTER request. When this option is enabled, the library will keep track of the public IP address from the response of REGISTER request. Once it detects that the address has changed, it will unregister current Contact, update the Contact with transport address learned from Via header, and register a new Contact to the registrar. This will also update the public name of UDP transport if STUN is configured.
See also contactRewriteMethod field.
Default: 1 (PJ_TRUE / yes)
-
int contactRewriteMethod¶
Specify how Contact update will be done with the registration, if contactRewriteEnabled is enabled. The value is bitmask combination of pjsua_contact_rewrite_method. See also pjsua_contact_rewrite_method.
Value PJSUA_CONTACT_REWRITE_UNREGISTER(1) is the legacy behavior.
Default value: PJSUA_CONTACT_REWRITE_METHOD (PJSUA_CONTACT_REWRITE_NO_UNREG | PJSUA_CONTACT_REWRITE_ALWAYS_UPDATE)
-
int contactUseSrcPort¶
Specify if source TCP port should be used as the initial Contact address if TCP/TLS transport is used. Note that this feature will be automatically turned off when nameserver is configured because it may yield different destination address due to DNS SRV resolution. Also some platforms are unable to report the local address of the TCP socket when it is still connecting. In these cases, this feature will also be turned off.
Default: 1 (PJ_TRUE / yes).
-
int viaRewriteUse¶
This option is used to overwrite the “sent-by” field of the Via header for outgoing messages with the same interface address as the one in the REGISTER request, as long as the request uses the same transport instance as the previous REGISTER request.
Default: 1 (PJ_TRUE / yes)
-
int sdpNatRewriteUse¶
This option controls whether the IP address in SDP should be replaced with the IP address found in Via header of the REGISTER response, ONLY when STUN and ICE are not used. If the value is FALSE (the original behavior), then the local IP address will be used. If TRUE, and when STUN and ICE are disabled, then the IP address found in registration response will be used.
Default: PJ_FALSE (no)
-
int sipOutboundUse¶
Control the use of SIP outbound feature. SIP outbound is described in RFC 5626 to enable proxies or registrar to send inbound requests back to UA using the same connection initiated by the UA for its registration. This feature is highly useful in NAT-ed deployemtns, hence it is enabled by default.
Note: currently SIP outbound can only be used with TCP and TLS transports. If UDP is used for the registration, the SIP outbound feature will be silently ignored for the account.
Default: 1 (PJ_TRUE / yes)
-
string sipOutboundInstanceId¶
Specify SIP outbound (RFC 5626) instance ID to be used by this account. If empty, an instance ID will be generated based on the hostname of this agent. If application specifies this parameter, the value will look like “<urn:uuid:00000000-0000-1000-8000-AABBCCDDEEFF>” without the double-quotes.
Default: empty
-
string sipOutboundRegId¶
Specify SIP outbound (RFC 5626) registration ID. The default value is empty, which would cause the library to automatically generate a suitable value.
Default: empty
-
unsigned udpKaIntervalSec¶
Set the interval for periodic keep-alive transmission for this account. If this value is zero, keep-alive will be disabled for this account. The keep-alive transmission will be sent to the registrar’s address, after successful registration.
Default: 15 (seconds)
-
string udpKaData¶
Specify the data to be transmitted as keep-alive packets.
Default: CR-LF
-
inline AccountNatConfig()¶
-
struct AccountPresConfig : public pj::PersistentObject
- #include <account.hpp>
Account presence config. This will be specified in AccountConfig.
Public Functions
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container node.
- Parameters
node – Container to write values to.
Public Members
-
SipHeaderVector headers¶
The optional custom SIP headers to be put in the presence subscription request.
-
bool publishEnabled¶
If this flag is set, the presence information of this account will be PUBLISH-ed to the server where the account belongs.
Default: PJ_FALSE
-
bool publishQueue¶
Specify whether the client publication session should queue the PUBLISH request should there be another PUBLISH transaction still pending. If this is set to false, the client will return error on the PUBLISH request if there is another PUBLISH transaction still in progress.
Default: PJSIP_PUBLISHC_QUEUE_REQUEST (TRUE)
-
unsigned publishShutdownWaitMsec¶
Maximum time to wait for unpublication transaction(s) to complete during shutdown process, before sending unregistration. The library tries to wait for the unpublication (un-PUBLISH) to complete before sending REGISTER request to unregister the account, during library shutdown process. If the value is set too short, it is possible that the unregistration is sent before unpublication completes, causing unpublication request to fail.
Value is in milliseconds.
Default: PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC (2000)
-
string pidfTupleId¶
Optional PIDF tuple ID for outgoing PUBLISH and NOTIFY. If this value is not specified, a random string will be used.
-
struct AccountRegConfig : public pj::PersistentObject
- #include <account.hpp>
Account registration config. This will be specified in AccountConfig.
Public Functions
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container node.
- Parameters
node – Container to write values to.
Public Members
-
string registrarUri¶
This is the URL to be put in the request URI for the registration, and will look something like “sip:serviceprovider”.
This field should be specified if registration is desired. If the value is empty, no account registration will be performed.
-
bool registerOnAdd¶
Specify whether the account should register as soon as it is added to the UA. Application can set this to PJ_FALSE and control the registration manually with pjsua_acc_set_registration().
Default: True
-
SipHeaderVector headers¶
The optional custom SIP headers to be put in the registration request.
-
string contactParams¶
Additional parameters that will be appended in the Contact header of the registration requests. This will be appended after AccountSipConfig.contactParams;
The parameters should be preceeded by semicolon, and all strings must be properly escaped. Example: “;my-param=X;another-param=Hi%20there”
-
string contactUriParams¶
Additional parameters that will be appended in the Contact URI of the registration requests. This will be appended after AccountSipConfig.contactUriParams;
The parameters should be preceeded by semicolon, and all strings must be properly escaped. Example: “;my-param=X;another-param=Hi%20there”
-
unsigned timeoutSec¶
Optional interval for registration, in seconds. If the value is zero, default interval will be used (PJSUA_REG_INTERVAL, 300 seconds).
-
unsigned retryIntervalSec¶
Specify interval of auto registration retry upon registration failure (including caused by transport problem), in second. Set to 0 to disable auto re-registration. Note that if the registration retry occurs because of transport failure, the first retry will be done after firstRetryIntervalSec seconds instead. Also note that the interval will be randomized slightly by some seconds (specified in reg_retry_random_interval) to avoid all clients re-registering at the same time.
See also firstRetryIntervalSec and randomRetryIntervalSec settings.
Default: PJSUA_REG_RETRY_INTERVAL
-
unsigned firstRetryIntervalSec¶
This specifies the interval for the first registration retry. The registration retry is explained in retryIntervalSec. Note that the value here will also be randomized by some seconds (specified in reg_retry_random_interval) to avoid all clients re-registering at the same time.
See also retryIntervalSec and randomRetryIntervalSec settings.
Default: 0
-
unsigned randomRetryIntervalSec¶
This specifies maximum randomized value to be added/substracted to/from the registration retry interval specified in reg_retry_interval and reg_first_retry_interval, in second. This is useful to avoid all clients re-registering at the same time. For example, if the registration retry interval is set to 100 seconds and this is set to 10 seconds, the actual registration retry interval will be in the range of 90 to 110 seconds.
See also retryIntervalSec and firstRetryIntervalSec settings.
Default: 10
-
unsigned delayBeforeRefreshSec¶
Specify the number of seconds to refresh the client registration before the registration expires.
Default: PJSIP_REGISTER_CLIENT_DELAY_BEFORE_REFRESH, 5 seconds
-
bool dropCallsOnFail¶
Specify whether calls of the configured account should be dropped after registration failure and an attempt of re-registration has also failed.
Default: FALSE (disabled)
-
unsigned unregWaitMsec¶
Specify the maximum time to wait for unregistration requests to complete during library shutdown sequence.
Default: PJSUA_UNREG_TIMEOUT
-
unsigned proxyUse¶
Specify how the registration uses the outbound and account proxy settings. This controls if and what Route headers will appear in the REGISTER request of this account. The value is bitmask combination of PJSUA_REG_USE_OUTBOUND_PROXY and PJSUA_REG_USE_ACC_PROXY bits. If the value is set to 0, the REGISTER request will not use any proxy (i.e. it will not have any Route headers).
Default: 3 (PJSUA_REG_USE_OUTBOUND_PROXY | PJSUA_REG_USE_ACC_PROXY)
-
struct AccountSipConfig : public pj::PersistentObject
- #include <account.hpp>
Various SIP settings for the account. This will be specified in AccountConfig.
Public Functions
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container node.
- Parameters
node – Container to write values to.
Public Members
-
AuthCredInfoVector authCreds¶
Array of credentials. If registration is desired, normally there should be at least one credential specified, to successfully authenticate against the service provider. More credentials can be specified, for example when the requests are expected to be challenged by the proxies in the route set.
-
StringVector proxies¶
Array of proxy servers to visit for outgoing requests. Each of the entry is translated into one Route URI.
-
string contactForced¶
Optional URI to be put as Contact for this account. It is recommended that this field is left empty, so that the value will be calculated automatically based on the transport address.
-
string contactParams¶
Additional parameters that will be appended in the Contact header for this account. This will affect the Contact header in all SIP messages sent on behalf of this account, including but not limited to REGISTER, INVITE, and SUBCRIBE requests or responses.
The parameters should be preceeded by semicolon, and all strings must be properly escaped. Example: “;my-param=X;another-param=Hi%20there”
-
string contactUriParams¶
Additional URI parameters that will be appended in the Contact URI for this account. This will affect the Contact URI in all SIP messages sent on behalf of this account, including but not limited to REGISTER, INVITE, and SUBCRIBE requests or responses.
The parameters should be preceeded by semicolon, and all strings must be properly escaped. Example: “;my-param=X;another-param=Hi%20there”
-
bool authInitialEmpty¶
If this flag is set, the authentication client framework will send an empty Authorization header in each initial request. Default is no.
-
string authInitialAlgorithm¶
Specify the algorithm to use when empty Authorization header is to be sent for each initial request (see above)
-
TransportId transportId¶
Optionally bind this account to specific transport. This normally is not a good idea, as account should be able to send requests using any available transports according to the destination. But some application may want to have explicit control over the transport to use, so in that case it can set this field.
Default: -1 (PJSUA_INVALID_ID)
See also
-
struct AccountVideoConfig : public pj::PersistentObject
- #include <account.hpp>
Account video config. This will be specified in AccountConfig.
Public Functions
-
inline AccountVideoConfig()¶
Default constructor
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container node.
- Parameters
node – Container to write values to.
Public Members
-
bool autoShowIncoming¶
Specify whether incoming video should be shown to screen by default. This applies to incoming call (INVITE), incoming re-INVITE, and incoming UPDATE requests.
Regardless of this setting, application can detect incoming video by implementing on_call_media_state() callback and enumerating the media stream(s) with pjsua_call_get_info(). Once incoming video is recognised, application may retrieve the window associated with the incoming video and show or hide it with pjsua_vid_win_set_show().
Default: False
-
bool autoTransmitOutgoing¶
Specify whether outgoing video should be activated by default when making outgoing calls and/or when incoming video is detected. This applies to incoming and outgoing calls, incoming re-INVITE, and incoming UPDATE. If the setting is non-zero, outgoing video transmission will be started as soon as response to these requests is sent (or received).
Regardless of the value of this setting, application can start and stop outgoing video transmission with pjsua_call_set_vid_strm().
Default: False
-
unsigned windowFlags¶
Specify video window’s flags. The value is a bitmask combination of pjmedia_vid_dev_wnd_flag.
Default: 0
-
pjmedia_vid_dev_index defaultCaptureDevice¶
Specify the default capture device to be used by this account. If vidOutAutoTransmit is enabled, this device will be used for capturing video.
Default: PJMEDIA_VID_DEFAULT_CAPTURE_DEV
-
pjmedia_vid_dev_index defaultRenderDevice¶
Specify the default rendering device to be used by this account.
Default: PJMEDIA_VID_DEFAULT_RENDER_DEV
-
pjmedia_vid_stream_rc_method rateControlMethod¶
Rate control method.
Default: PJMEDIA_VID_STREAM_RC_SIMPLE_BLOCKING.
-
unsigned rateControlBandwidth¶
Upstream/outgoing bandwidth. If this is set to zero, the video stream will use codec maximum bitrate setting.
Default: 0 (follow codec maximum bitrate).
-
unsigned startKeyframeCount¶
The number of keyframe to be sent after the stream is created.
Default: PJMEDIA_VID_STREAM_START_KEYFRAME_CNT
-
unsigned startKeyframeInterval¶
The keyframe sending interval after the stream is created.
Default: PJMEDIA_VID_STREAM_START_KEYFRAME_INTERVAL_MSEC
-
inline AccountVideoConfig()¶
-
class FindBuddyMatch
- #include <account.hpp>
Wrapper class for Buddy matching algo.
Default algo is a simple substring lookup of search-token in the Buddy URIs, with case sensitive. Application can implement its own matching algo by overriding this class and specifying its instance in Account::findBuddy().
-
struct OnIncomingCallParam
- #include <account.hpp>
This structure contains parameters for onIncomingCall() account callback.
-
struct OnIncomingSubscribeParam
- #include <account.hpp>
This structure contains parameters for onIncomingSubscribe() callback.
Public Members
-
void *srvPres¶
Server presence subscription instance. If application delays the acceptance of the request, it will need to specify this object when calling Account::presNotify().
-
string fromUri¶
Sender URI.
-
pjsip_status_code code¶
The status code to respond to the request. The default value is 200. Application may set this to other final status code to accept or reject the request.
-
string reason¶
The reason phrase to respond to the request.
-
SipTxOption txOption¶
Additional data to be sent with the response, if any.
-
void *srvPres¶
-
struct OnInstantMessageParam
- #include <account.hpp>
Parameters for onInstantMessage() account callback.
-
struct OnInstantMessageStatusParam
- #include <account.hpp>
Parameters for onInstantMessageStatus() account callback.
Public Members
-
string toUri¶
Destination URI.
-
string msgBody¶
The message body.
-
pjsip_status_code code¶
The SIP status code of the transaction.
-
string reason¶
The reason phrase of the transaction.
-
string toUri¶
-
struct OnMwiInfoParam
- #include <account.hpp>
Parameters for onMwiInfo() account callback.
Public Members
-
pjsip_evsub_state state¶
MWI subscription state.
-
pjsip_evsub_state state¶
-
struct OnRegStartedParam
- #include <account.hpp>
This structure contains parameters for onRegStarted() account callback.
Public Members
-
bool renew¶
True for registration and False for unregistration.
-
bool renew¶
-
struct OnRegStateParam
- #include <account.hpp>
This structure contains parameters for onRegState() account callback.
Public Members
-
pj_status_t status¶
Registration operation status.
-
pjsip_status_code code¶
SIP status code received.
-
string reason¶
SIP reason phrase received.
-
unsigned expiration¶
Next expiration interval.
-
pj_status_t status¶
-
struct OnTypingIndicationParam
- #include <account.hpp>
Parameters for onTypingIndication() account callback.
-
struct PresNotifyParam
- #include <account.hpp>
Parameters for presNotify() account method.
Public Members
-
void *srvPres¶
Server presence subscription instance.
-
pjsip_evsub_state state¶
Server presence subscription state to set.
-
string stateStr¶
Optionally specify the state string name, if state is not “active”, “pending”, or “terminated”.
-
string reason¶
If the new state is PJSIP_EVSUB_STATE_TERMINATED, optionally specify the termination reason.
-
bool withBody¶
If the new state is PJSIP_EVSUB_STATE_TERMINATED, this specifies whether the NOTIFY request should contain message body containing account’s presence information.
-
SipTxOption txOption¶
Optional list of headers to be sent with the NOTIFY request.
-
void *srvPres¶
-
struct RtcpFbCap
- #include <account.hpp>
RTCP Feedback capability.
Public Functions
-
inline RtcpFbCap()¶
Constructor.
-
void fromPj(const pjmedia_rtcp_fb_cap &prm)¶
Convert from pjsip
-
pjmedia_rtcp_fb_cap toPj() const¶
Convert to pjsip
Public Members
-
string codecId¶
Specify the codecs to which the capability is applicable. Codec ID is using the same format as in pjmedia_codec_mgr_find_codecs_by_id() and pjmedia_vid_codec_mgr_find_codecs_by_id(), e.g: “L16/8000/1”, “PCMU”, “H264”. This can also be an asterisk (“*”) to represent all codecs.
-
pjmedia_rtcp_fb_type type¶
Specify the RTCP Feedback type.
-
string typeName¶
Specify the type name if RTCP Feedback type is PJMEDIA_RTCP_FB_OTHER.
-
string param¶
Specify the RTCP Feedback parameters.
-
inline RtcpFbCap()¶
-
struct RtcpFbConfig : public pj::PersistentObject
- #include <account.hpp>
RTCP Feedback settings.
Public Functions
-
RtcpFbConfig()¶
Constructor.
-
void fromPj(const pjmedia_rtcp_fb_setting &prm)¶
Convert from pjsip
-
pjmedia_rtcp_fb_setting toPj() const¶
Convert to pjsip
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container node.
- Parameters
node – Container to write values to.
Public Members
-
bool dontUseAvpf¶
Specify whether transport protocol in SDP media description uses RTP/AVP instead of RTP/AVPF. Note that the standard mandates to signal AVPF profile, but it may cause SDP negotiation failure when negotiating with endpoints that does not support RTCP Feedback (including older version of PJSIP).
Default: false.
-
RtcpFbCapVector caps¶
RTCP Feedback capabilities.
-
RtcpFbConfig()¶
-
struct SrtpCrypto
- #include <account.hpp>
SRTP crypto.
Public Functions
-
void fromPj(const pjmedia_srtp_crypto &prm)¶
Convert from pjsip
-
pjmedia_srtp_crypto toPj() const¶
Convert to pjsip
Public Members
-
string key¶
Optional key. If empty, a random key will be autogenerated.
-
string name¶
Crypto name.
-
unsigned flags¶
Flags, bitmask from pjmedia_srtp_crypto_option
-
void fromPj(const pjmedia_srtp_crypto &prm)¶
-
struct SrtpOpt : public pj::PersistentObject
- #include <account.hpp>
SRTP settings.
Public Functions
-
SrtpOpt()¶
Default constructor initializes with default values.
-
void fromPj(const pjsua_srtp_opt &prm)¶
Convert from pjsip
-
pjsua_srtp_opt toPj() const¶
Convert to pjsip
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container node.
- Parameters
node – Container to write values to.
Public Members
-
SrtpCryptoVector cryptos¶
Specify SRTP cryptos. If empty, all crypto will be enabled. Available crypto can be enumerated using Endpoint::srtpCryptoEnum().
Default: empty.
-
SrtpOpt()¶
-
typedef std::vector<AuthCredInfo> AuthCredInfoVector¶
media.hpp¶
PJSUA2 media operations.
-
struct WindowHandle
- #include <media.hpp>
Window handle.
-
struct VideoWindowInfo
- #include <media.hpp>
This structure describes video window info.
Public Members
-
bool isNative¶
Flag to indicate whether this window is a native window, such as created by built-in preview device. If this field is true, only the video window handle field of this structure is valid.
-
VideoWindowHandle winHandle¶
Video window handle.
-
int renderDeviceId¶
Renderer device ID.
-
bool show¶
Window show status. The window is hidden if false.
-
MediaCoordinate pos¶
Window position.
-
MediaSize size¶
Window size.
-
bool isNative¶
-
struct CodecFmtp
- #include <media.hpp>
Structure of codec specific parameters which contains name=value pairs. The codec specific parameters are to be used with SDP according to the standards (e.g: RFC 3555) in SDP ‘a=fmtp’ attribute.
-
union MediaEventData
- #include <media.hpp>
Media event data.
Public Members
-
MediaFmtChangedEvent fmtChanged
Media format changed event data.
-
AudDevErrorEvent audDevError
Audio device error event data.
-
GenericData ptr
Pointer to storage to user event data, if it’s outside this struct
-
MediaFmtChangedEvent fmtChanged
-
namespace pj
PJSUA2 API is inside pj namespace
Typedefs
-
typedef std::vector<MediaFormatAudio> MediaFormatAudioVector¶
Array of MediaFormatAudio
-
typedef std::vector<MediaFormatVideo> MediaFormatVideoVector¶
Array of MediaFormatVideo
-
typedef void *MediaPort¶
Media port, corresponds to pjmedia_port
-
typedef std::vector<AudioMedia*> AudioMediaVector¶
Warning: deprecated, use AudioMediaVector2 instead.
Array of Audio Media.
-
typedef std::vector<AudioMedia> AudioMediaVector2¶
Array of Audio Media
-
typedef std::vector<ToneDigitMapDigit> ToneDigitMapVector¶
Tone digit map
-
typedef std::vector<AudioDevInfo*> AudioDevInfoVector¶
Warning: deprecated, use AudioDevInfoVector2 instead.
Array of audio device info.
-
typedef std::vector<AudioDevInfo> AudioDevInfoVector2¶
Array of audio device info
-
typedef std::vector<VideoMedia> VideoMediaVector¶
Array of Video Media
-
typedef std::vector<VideoDevInfo*> VideoDevInfoVector¶
Warning: deprecated, use VideoDevInfoVector2 instead.
Array of video device info.
-
typedef std::vector<VideoDevInfo> VideoDevInfoVector2¶
Array of video device info
-
struct AudDevErrorEvent
- #include <media.hpp>
This structure describes an audio device error event.
Public Members
-
pjmedia_dir dir¶
The direction.
-
int id¶
The audio device ID.
-
pj_status_t status¶
The status code.
-
pjmedia_dir dir¶
-
class AudDevManager
- #include <media.hpp>
Audio device manager.
Public Functions
- int getCaptureDev () const PJSUA2_THROW(Error)
Get currently active capture sound devices. If sound devices has not been created, it is possible that the function returns -1 as device IDs.
- Returns
Device ID of the capture device.
- AudioMedia & getCaptureDevMedia () PJSUA2_THROW(Error)
Get the AudioMedia of the capture audio device.
- Returns
Audio media for the capture device.
- int getPlaybackDev () const PJSUA2_THROW(Error)
Get currently active playback sound devices. If sound devices has not been created, it is possible that the function returns -1 as device IDs.
- Returns
Device ID of the playback device.
- AudioMedia & getPlaybackDevMedia () PJSUA2_THROW(Error)
Get the AudioMedia of the speaker/playback audio device.
- Returns
Audio media for the speaker/playback device.
- void setCaptureDev (int capture_dev) const PJSUA2_THROW(Error)
Select or change capture sound device. Application may call this function at any time to replace current sound device. Calling this method will not change the state of the sound device (opened/closed).
- Parameters
capture_dev – Device ID of the capture device.
- void setPlaybackDev (int playback_dev) const PJSUA2_THROW(Error)
Select or change playback sound device. Application may call this function at any time to replace current sound device. Calling this method will not change the state of the sound device (opened/closed).
- Parameters
playback_dev – Device ID of the playback device.
- const AudioDevInfoVector & enumDev () PJSUA2_THROW(Error)
Warning: deprecated, use enumDev2 instead. This function is not safe in multithreaded environment.
Enum all audio devices installed in the system. This function is not safe in multithreaded environment.
- Returns
The list of audio device info.
- AudioDevInfoVector2 enumDev2 () const PJSUA2_THROW(Error)
Enum all audio devices installed in the system.
- Returns
The list of audio device info.
- void setNullDev () PJSUA2_THROW(Error)
Set pjsua to use null sound device. The null sound device only provides the timing needed by the conference bridge, and will not interract with any hardware.
-
MediaPort *setNoDev()¶
Disconnect the main conference bridge from any sound devices, and let application connect the bridge to it’s own sound device/master port.
- Returns
The port interface of the conference bridge, so that application can connect this to it’s own sound device or master port.
- void setSndDevMode (unsigned mode) const PJSUA2_THROW(Error)
Set sound device mode.
Note that this method will open the sound device, using current active IDs set via setCaptureDev() or setPlaybackDev(), if the flag PJSUA_SND_DEV_NO_IMMEDIATE_OPEN is not specified.
- Parameters
mode – The sound device mode, as bitmask combination of pjsua_snd_dev_mode
- void setEcOptions (unsigned tail_msec, unsigned options) PJSUA2_THROW(Error)
Change the echo cancellation settings.
The behavior of this function depends on whether the sound device is currently active, and if it is, whether device or software AEC is being used.
If the sound device is currently active, and if the device supports AEC, this function will forward the change request to the device and it will be up to the device on whether support the request. If software AEC is being used (the software EC will be used if the device does not support AEC), this function will change the software EC settings. In all cases, the setting will be saved for future opening of the sound device.
If the sound device is not currently active, this will only change the default AEC settings and the setting will be applied next time the sound device is opened.
- Parameters
tail_msec – The tail length, in miliseconds. Set to zero to disable AEC.
options – Options to be passed to pjmedia_echo_create(). Normally the value should be zero.
- unsigned getEcTail () const PJSUA2_THROW(Error)
Get current echo canceller tail length.
- Returns
The EC tail length in milliseconds, If AEC is disabled, the value will be zero.
-
bool sndIsActive() const¶
Check whether the sound device is currently active. The sound device may be inactive if the application has set the auto close feature to non-zero (the sndAutoCloseTime setting in MediaConfig), or if null sound device or no sound device has been configured via the setNoDev() function.
- void refreshDevs () PJSUA2_THROW(Error)
Refresh the list of sound devices installed in the system. This method will only refresh the list of audio device so all active audio streams will be unaffected. After refreshing the device list, application MUST make sure to update all index references to audio devices before calling any method that accepts audio device index as its parameter.
-
unsigned getDevCount() const¶
Get the number of sound devices installed in the system.
- Returns
The number of sound devices installed in the system.
- AudioDevInfo getDevInfo (int id) const PJSUA2_THROW(Error)
Get device information.
- Parameters
id – The audio device ID.
- Returns
The device information which will be filled in by this method once it returns successfully.
- int lookupDev (const string &drv_name, const string &dev_name) const PJSUA2_THROW(Error)
Lookup device index based on the driver and device name.
- Parameters
drv_name – The driver name.
dev_name – The device name.
- Returns
The device ID. If the device is not found, Error will be thrown.
-
string capName(pjmedia_aud_dev_cap cap) const¶
Get string info for the specified capability.
- Parameters
cap – The capability ID.
- Returns
Capability name.
- void setExtFormat (const MediaFormatAudio &format, bool keep=true) PJSUA2_THROW(Error)
This will configure audio format capability (other than PCM) to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_EXT_FORMAT capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the sound device to be used.
- Parameters
format – The audio format.
keep – Specify whether the setting is to be kept for future use.
- MediaFormatAudio getExtFormat () const PJSUA2_THROW(Error)
Get the audio format capability (other than PCM) of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_EXT_FORMAT capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns
The audio format.
- void setInputLatency (unsigned latency_msec, bool keep=true) PJSUA2_THROW(Error)
This will configure audio input latency control or query capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the sound device to be used.
- Parameters
latency_msec – The input latency.
keep – Specify whether the setting is to be kept for future use.
- unsigned getInputLatency () const PJSUA2_THROW(Error)
Get the audio input latency control or query capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns
The audio input latency.
- void setOutputLatency (unsigned latency_msec, bool keep=true) PJSUA2_THROW(Error)
This will configure audio output latency control or query capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the sound device to be used.
- Parameters
latency_msec – The output latency.
keep – Specify whether the setting is to be kept for future use.
- unsigned getOutputLatency () const PJSUA2_THROW(Error)
Get the audio output latency control or query capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns
The audio output latency.
- void setInputVolume (unsigned volume, bool keep=true) PJSUA2_THROW(Error)
This will configure audio input volume level capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the sound device to be used.
- Parameters
volume – The input volume level, in percent.
keep – Specify whether the setting is to be kept for future use.
- unsigned getInputVolume () const PJSUA2_THROW(Error)
Get the audio input volume level capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING capability in AudioDevInfo.caps flags, otherwise Error will be thrown. *
- Returns
The audio input volume level, in percent.
- void setOutputVolume (unsigned volume, bool keep=true) PJSUA2_THROW(Error)
This will configure audio output volume level capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the sound device to be used.
- Parameters
volume – The output volume level, in percent.
keep – Specify whether the setting is to be kept for future use.
- unsigned getOutputVolume () const PJSUA2_THROW(Error)
Get the audio output volume level capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns
The audio output volume level, in percent.
- unsigned getInputSignal () const PJSUA2_THROW(Error)
Get the audio input signal level capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_INPUT_SIGNAL_METER capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns
The audio input signal level, in percent.
- unsigned getOutputSignal () const PJSUA2_THROW(Error)
Get the audio output signal level capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_OUTPUT_SIGNAL_METER capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns
The audio output signal level, in percent.
- void setInputRoute (pjmedia_aud_dev_route route, bool keep=true) PJSUA2_THROW(Error)
This will configure audio input route capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the sound device to be used.
- Parameters
route – The audio input route.
keep – Specify whether the setting is to be kept for future use.
- pjmedia_aud_dev_route getInputRoute () const PJSUA2_THROW(Error)
Get the audio input route capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns
The audio input route.
- void setOutputRoute (pjmedia_aud_dev_route route, bool keep=true) PJSUA2_THROW(Error)
This will configure audio output route capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the sound device to be used.
- Parameters
route – The audio output route.
keep – Specify whether the setting is to be kept for future use.
- pjmedia_aud_dev_route getOutputRoute () const PJSUA2_THROW(Error)
Get the audio output route capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns
The audio output route.
- void setVad (bool enable, bool keep=true) PJSUA2_THROW(Error)
This will configure audio voice activity detection capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_VAD capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the sound device to be used.
- Parameters
enable – Enable/disable voice activity detection feature. Set true to enable.
keep – Specify whether the setting is to be kept for future use.
- bool getVad () const PJSUA2_THROW(Error)
Get the audio voice activity detection capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_VAD capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns
The audio voice activity detection feature.
- void setCng (bool enable, bool keep=true) PJSUA2_THROW(Error)
This will configure audio comfort noise generation capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_CNG capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the sound device to be used.
- Parameters
enable – Enable/disable comfort noise generation feature. Set true to enable.
keep – Specify whether the setting is to be kept for future use.
- bool getCng () const PJSUA2_THROW(Error)
Get the audio comfort noise generation capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_CNG capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns
The audio comfort noise generation feature.
- void setPlc (bool enable, bool keep=true) PJSUA2_THROW(Error)
This will configure audio packet loss concealment capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_PLC capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the sound device to be used.
- Parameters
enable – Enable/disable packet loss concealment feature. Set true to enable.
keep – Specify whether the setting is to be kept for future use.
- bool getPlc () const PJSUA2_THROW(Error)
Get the audio packet loss concealment capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_PLC capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns
The audio packet loss concealment feature.
Private Functions
-
AudDevManager()¶
Constructor.
-
~AudDevManager()¶
Destructor.
-
void clearAudioDevList()¶
- int getActiveDev (bool is_capture) const PJSUA2_THROW(Error)
Friends
- friend class Endpoint
-
struct AudioDevInfo
- #include <media.hpp>
Audio device information structure.
Public Functions
-
void fromPj(const pjmedia_aud_dev_info &dev_info)¶
Construct from pjmedia_aud_dev_info.
-
~AudioDevInfo()¶
Destructor.
Public Members
-
string name¶
The device name
-
unsigned inputCount¶
Maximum number of input channels supported by this device. If the value is zero, the device does not support input operation (i.e. it is a playback only device).
-
unsigned outputCount¶
Maximum number of output channels supported by this device. If the value is zero, the device does not support output operation (i.e. it is an input only device).
-
unsigned defaultSamplesPerSec¶
Default sampling rate.
-
string driver¶
The underlying driver name
-
unsigned caps¶
Device capabilities, as bitmask combination of pjmedia_aud_dev_cap.
-
unsigned routes¶
Supported audio device routes, as bitmask combination of pjmedia_aud_dev_route. The value may be zero if the device does not support audio routing.
-
MediaFormatAudioVector extFmt¶
Array of supported extended audio formats
-
void fromPj(const pjmedia_aud_dev_info &dev_info)¶
-
class AudioMedia : public pj::Media
- #include <media.hpp>
Audio Media. This is a lite wrapper class for audio conference bridge port, i.e: this class only maintains one data member, conference slot ID, and the methods are simply proxies for conference bridge operations.
Application can create a derived class and use registerMediaPort2()/ unregisterMediaPort() to register/unregister a media port to/from the conference bridge.
The library will not keep a list of AudioMedia instances, so any AudioMedia (descendant) instances instantiated by application must be maintained and destroyed by the application itself.
Note that any PJSUA2 APIs that return AudioMedia instance(s) such as Endpoint::mediaEnumPorts2() or Call::getAudioMedia() will just return generated copy. All AudioMedia methods should work normally on this generated copy instance.
Subclassed by pj::AudioMediaPlayer, pj::AudioMediaRecorder, pj::ExtraAudioDevice, pj::ToneGenerator
Public Functions
- ConfPortInfo getPortInfo () const PJSUA2_THROW(Error)
Get information about the specified conference port.
-
int getPortId() const¶
Get port Id.
- void startTransmit (const AudioMedia &sink) const PJSUA2_THROW(Error)
Establish unidirectional media flow to sink. This media port will act as a source, and it may transmit to multiple destinations/sink. And if multiple sources are transmitting to the same sink, the media will be mixed together. Source and sink may refer to the same Media, effectively looping the media.
If bidirectional media flow is desired, application needs to call this method twice, with the second one called from the opposite source media.
- Parameters
sink – The destination Media.
- void startTransmit2 (const AudioMedia &sink, const AudioMediaTransmitParam ¶m) const PJSUA2_THROW(Error)
Establish unidirectional media flow to sink. This media port will act as a source, and it may transmit to multiple destinations/sink. And if multiple sources are transmitting to the same sink, the media will be mixed together. Source and sink may refer to the same Media, effectively looping the media.
Signal level from this source to the sink can be adjusted by making it louder or quieter via the parameter param. The level adjustment will apply to a specific connection only (i.e. only for signal from this source to the sink), as compared to adjustTxLevel()/adjustRxLevel() which applies to all signals from/to this media port. The signal adjustment will be cumulative, in this following order: signal from this source will be adjusted with the level specified in adjustTxLevel(), then with the level specified via this API, and finally with the level specified to the sink’s adjustRxLevel().
If bidirectional media flow is desired, application needs to call this method twice, with the second one called from the opposite source media.
- Parameters
sink – The destination Media.
param – The parameter.
- void stopTransmit (const AudioMedia &sink) const PJSUA2_THROW(Error)
Stop media flow to destination/sink port.
- Parameters
sink – The destination media.
- void adjustRxLevel (float level) PJSUA2_THROW(Error)
Adjust the signal level to be transmitted from the bridge to this media port by making it louder or quieter.
- Parameters
level – Signal level adjustment. Value 1.0 means no level adjustment, while value 0 means to mute the port.
- void adjustTxLevel (float level) PJSUA2_THROW(Error)
Adjust the signal level to be received from this media port (to the bridge) by making it louder or quieter.
- Parameters
level – Signal level adjustment. Value 1.0 means no level adjustment, while value 0 means to mute the port.
- unsigned getRxLevel () const PJSUA2_THROW(Error)
Get the last received signal level.
- Returns
Signal level in percent.
- unsigned getTxLevel () const PJSUA2_THROW(Error)
Get the last transmitted signal level.
- Returns
Signal level in percent.
-
AudioMedia()¶
Default Constructor.
Normally application will not create AudioMedia object directly, but it instantiates an AudioMedia derived class. This is set as public because some STL vector implementations require it.
-
virtual ~AudioMedia()¶
Virtual Destructor.
Public Static Functions
- static ConfPortInfo getPortInfoFromId (int port_id) PJSUA2_THROW(Error)
Get information from specific port id.
-
static AudioMedia *typecastFromMedia(Media *media)¶
Warning: deprecated and will be removed in future release.
Typecast from base class Media. This is useful for application written in language that does not support downcasting such as Python.
- Parameters
media – The object to be downcasted
- Returns
The object as AudioMedia instance
Protected Functions
- void registerMediaPort (MediaPort port) PJSUA2_THROW(Error)
Warning: deprecated and will be removed in future release, use registerMediaPort2() instead.
This method needs to be called by descendants of this class to register the media port created to the conference bridge and Endpoint’s media list.
param port The media port to be registered to the conference bridge.
- void registerMediaPort2 (MediaPort port, pj_pool_t *pool) PJSUA2_THROW(Error)
This method needs to be called by descendants of this class to register the media port created to the conference bridge and Endpoint’s media list.
param port The media port to be registered to the conference bridge. param pool The memory pool.
-
void unregisterMediaPort()¶
This method needs to be called by descendants of this class to remove the media port from the conference bridge and Endpoint’s media list. Descendant should only call this method if it has registered the media with the previous call to registerMediaPort().
Protected Attributes
-
int id¶
Conference port Id.
-
class AudioMediaPlayer : public pj::AudioMedia
- #include <media.hpp>
Audio Media Player.
Public Functions
-
AudioMediaPlayer()¶
Constructor.
- void createPlayer (const string &file_name, unsigned options=0) PJSUA2_THROW(Error)
Create a file player, and automatically add this player to the conference bridge.
- Parameters
file_name – The filename to be played. Currently only WAV files are supported, and the WAV file MUST be formatted as 16bit PCM mono/single channel (any clock rate is supported).
options – Optional option flag. Application may specify PJMEDIA_FILE_NO_LOOP to prevent playback loop.
- void createPlaylist (const StringVector &file_names, const string &label="", unsigned options=0) PJSUA2_THROW(Error)
Create a file playlist media port, and automatically add the port to the conference bridge.
- Parameters
file_names – Array of file names to be added to the play list. Note that the files must have the same clock rate, number of channels, and number of bits per sample.
label – Optional label to be set for the media port.
options – Optional option flag. Application may specify PJMEDIA_FILE_NO_LOOP to prevent looping.
- AudioMediaPlayerInfo getInfo () const PJSUA2_THROW(Error)
Get additional info about the player. This operation is only valid for player. For playlist, Error will be thrown.
- Returns
the info.
- pj_uint32_t getPos () const PJSUA2_THROW(Error)
Get current playback position in samples. This operation is not valid for playlist.
- Returns
Current playback position, in samples.
- void setPos (pj_uint32_t samples) PJSUA2_THROW(Error)
Set playback position in samples. This operation is not valid for playlist.
- Parameters
samples – The desired playback position, in samples.
-
virtual ~AudioMediaPlayer()¶
Destructor. This will unregister the player port from the conference bridge.
-
inline virtual void onEof2()¶
Register a callback to be called when the file player reading has reached the end of file, or when the file reading has reached the end of file of the last file for a playlist. If the file or playlist is set to play repeatedly, then the callback will be called multiple times.
If application wishes to stop the playback, it can stop the media transmission in the callback, and only after all transmissions have been stopped, could the application safely destroy the player.
Public Static Functions
-
static AudioMediaPlayer *typecastFromAudioMedia(AudioMedia *media)¶
Warning: deprecated and will be removed in future release.
Typecast from base class AudioMedia. This is useful for application written in language that does not support downcasting such as Python.
- Parameters
media – The object to be downcasted
- Returns
The object as AudioMediaPlayer instance
Private Members
-
int playerId¶
Player Id.
Private Static Functions
-
static void eof_cb(pjmedia_port *port, void *usr_data)¶
Low level PJMEDIA callback
-
AudioMediaPlayer()¶
-
struct AudioMediaPlayerInfo
- #include <media.hpp>
This structure contains additional info about AudioMediaPlayer.
Public Functions
-
inline AudioMediaPlayerInfo()¶
Default constructor
Public Members
-
pjmedia_format_id formatId¶
Format ID of the payload.
-
unsigned payloadBitsPerSample¶
The number of bits per sample of the file payload. For example, the value is 16 for PCM WAV and 8 for Alaw/Ulas WAV files.
-
pj_uint32_t sizeBytes¶
The WAV payload size in bytes.
-
pj_uint32_t sizeSamples¶
The WAV payload size in samples.
-
inline AudioMediaPlayerInfo()¶
-
class AudioMediaRecorder : public pj::AudioMedia
- #include <media.hpp>
Audio Media Recorder.
Public Functions
-
AudioMediaRecorder()¶
Constructor.
- void createRecorder (const string &file_name, unsigned enc_type=0, long max_size=0, unsigned options=0) PJSUA2_THROW(Error)
Create a file recorder, and automatically connect this recorder to the conference bridge. The recorder currently supports recording WAV file. The type of the recorder to use is determined by the extension of the file (e.g. “.wav”).
- Parameters
file_name – Output file name. The function will determine the default format to be used based on the file extension. Currently “.wav” is supported on all platforms.
enc_type – Optionally specify the type of encoder to be used to compress the media, if the file can support different encodings. This value must be zero for now.
max_size – Maximum file size. Specify zero or -1 to remove size limitation. This value must be zero or -1 for now.
options – Optional options, which can be used to specify the recording file format. Supported options are PJMEDIA_FILE_WRITE_PCM, PJMEDIA_FILE_WRITE_ALAW, and PJMEDIA_FILE_WRITE_ULAW. Default is zero or PJMEDIA_FILE_WRITE_PCM.
-
virtual ~AudioMediaRecorder()¶
Destructor. This will unregister the recorder port from the conference bridge.
Public Static Functions
-
static AudioMediaRecorder *typecastFromAudioMedia(AudioMedia *media)¶
Warning: deprecated and will be removed in future release.
Typecast from base class AudioMedia. This is useful for application written in language that does not support downcasting such as Python.
- Parameters
media – The object to be downcasted
- Returns
The object as AudioMediaRecorder instance
Private Members
-
int recorderId¶
Recorder Id.
-
AudioMediaRecorder()¶
-
struct AudioMediaTransmitParam
- #include <media.hpp>
Parameters for AudioMedia::startTransmit2() method.
Public Functions
-
AudioMediaTransmitParam()¶
Default constructor
Public Members
-
float level¶
Signal level adjustment. Value 1.0 means no level adjustment, while value 0 means to mute the port.
Default: 1.0
-
AudioMediaTransmitParam()¶
-
struct CodecInfo
- #include <media.hpp>
This structure describes codec information.
Public Functions
-
void fromPj(const pjsua_codec_info &codec_info)¶
Construct from pjsua_codec_info.
Public Members
-
string codecId¶
Codec unique identification.
-
pj_uint8_t priority¶
Codec priority (integer 0-255).
-
string desc¶
Codec description.
-
void fromPj(const pjsua_codec_info &codec_info)¶
-
struct CodecOpusConfig
- #include <media.hpp>
Opus codec parameters setting;
Public Functions
-
pjmedia_codec_opus_config toPj() const¶
-
void fromPj(const pjmedia_codec_opus_config &config)¶
Public Members
-
unsigned sample_rate¶
Sample rate in Hz.
-
unsigned channel_cnt¶
Number of channels.
-
unsigned frm_ptime¶
Frame time in msec.
-
unsigned bit_rate¶
Encoder bit rate in bps.
-
unsigned packet_loss¶
Encoder’s expected packet loss pct.
-
unsigned complexity¶
Encoder complexity, 0-10(10 is highest)
-
bool cbr¶
Constant bit rate?
-
pjmedia_codec_opus_config toPj() const¶
-
struct CodecParam
- #include <media.hpp>
Detailed codec attributes used in configuring an audio codec and in querying the capability of audio codec factories.
Please note that codec parameter also contains SDP specific setting, #setting::decFmtp and #setting::encFmtp, which may need to be set appropriately based on the effective setting. See each codec documentation for more detail.
-
struct CodecParamInfo
- #include <media.hpp>
Audio codec parameters info.
Public Functions
-
inline CodecParamInfo()¶
Default constructor
Public Members
-
unsigned clockRate¶
Sampling rate in Hz
-
unsigned channelCnt¶
Channel count.
-
unsigned avgBps¶
Average bandwidth in bits/sec
-
unsigned maxBps¶
Maximum bandwidth in bits/sec
-
unsigned maxRxFrameSize¶
Maximum frame size
-
unsigned frameLen¶
Decoder frame ptime in msec.
-
unsigned pcmBitsPerSample¶
Bits/sample in the PCM side
-
unsigned pt¶
Payload type.
-
pjmedia_format_id fmtId¶
Source format, it’s format of encoder input and decoder output.
-
inline CodecParamInfo()¶
-
struct CodecParamSetting
- #include <media.hpp>
Audio codec parameters setting.
Public Members
-
unsigned frmPerPkt¶
Number of frames per packet.
-
bool vad¶
Voice Activity Detector.
-
bool cng¶
Comfort Noise Generator.
-
bool penh¶
Perceptual Enhancement
-
bool plc¶
Packet loss concealment
-
bool reserved¶
Reserved, must be zero.
-
CodecFmtpVector encFmtp¶
Encoder’s fmtp params.
-
CodecFmtpVector decFmtp¶
Decoder’s fmtp params.
-
unsigned frmPerPkt¶
-
struct ConfPortInfo
- #include <media.hpp>
This structure descibes information about a particular media port that has been registered into the conference bridge.
Public Functions
-
void fromPj(const pjsua_conf_port_info &port_info)¶
Construct from pjsua_conf_port_info.
Public Members
-
int portId¶
Conference port number.
-
string name¶
Port name.
-
MediaFormatAudio format¶
Media audio format information
-
float txLevelAdj¶
Tx level adjustment. Value 1.0 means no adjustment, value 0 means the port is muted, value 2.0 means the level is amplified two times.
-
float rxLevelAdj¶
Rx level adjustment. Value 1.0 means no adjustment, value 0 means the port is muted, value 2.0 means the level is amplified two times.
-
void fromPj(const pjsua_conf_port_info &port_info)¶
-
class ExtraAudioDevice : public pj::AudioMedia
- #include <media.hpp>
Extra audio device. This class allows application to have multiple sound device instances active concurrently.
Application may also use this class to improve media clock. Normally media clock is driven by sound device in master port, but unfortunately some sound devices may produce jittery clock. To improve media clock, application can install Null Sound Device (i.e: using AudDevManager::setNullDev()), which will act as a master port, and install the sound device as extra sound device.
Note that extra sound device will not have auto-close upon idle feature. Also note that the extra sound device only supports mono channel.
Public Functions
-
ExtraAudioDevice(int playdev, int recdev)¶
Constructor.
- Parameters
playdev – Playback device ID.
recdev – Record device ID.
-
virtual ~ExtraAudioDevice()¶
Destructor.
-
void open()¶
Open the audio device using format (e.g.: clock rate, bit per sample, samples per frame) matched to the conference bridge’s format, except the channel count, which will be set to one (mono channel). This will also register the audio device port to conference bridge.
-
void close()¶
Close the audio device and unregister the audio device port from the conference bridge.
-
bool isOpened()¶
Is the extra audio device opened?
- Returns
‘true’ if it is opened.
-
ExtraAudioDevice(int playdev, int recdev)¶
-
class Media
- #include <media.hpp>
Subclassed by pj::AudioMedia, pj::VideoMedia
Public Functions
-
virtual ~Media()¶
Virtual destructor.
-
pjmedia_type getType() const¶
Get type of the media.
- Returns
The media type.
Protected Functions
-
Media(pjmedia_type med_type)¶
Constructor.
Private Members
-
pjmedia_type type¶
Media type.
-
virtual ~Media()¶
-
struct MediaCoordinate
- #include <media.hpp>
Representation of media coordinate.
-
struct MediaEvent
- #include <media.hpp>
This structure describes a media event. It corresponds to the pjmedia_event structure.
Public Functions
-
inline MediaEvent()¶
Default constructor
-
void fromPj(const pjmedia_event &ev)¶
Convert from pjsip
Public Members
-
pjmedia_event_type type¶
The event type.
-
MediaEventData data¶
Additional data/parameters about the event. The type of data will be specific to the event type being reported.
-
void *pjMediaEvent¶
Pointer to original pjmedia_event. Only valid when the struct is converted from PJSIP’s pjmedia_event.
-
inline MediaEvent()¶
-
struct MediaFmtChangedEvent
- #include <media.hpp>
This structure describes a media format changed event.
-
struct MediaFormat
- #include <media.hpp>
This structure contains all the information needed to completely describe a media.
Subclassed by pj::MediaFormatAudio, pj::MediaFormatVideo
Public Functions
-
inline MediaFormat()¶
Default constructor
Public Members
-
pj_uint32_t id¶
The format id that specifies the audio sample or video pixel format. Some well known formats ids are declared in pjmedia_format_id enumeration.
See also
-
pjmedia_type type¶
The top-most type of the media, as an information.
-
inline MediaFormat()¶
-
struct MediaFormatAudio : public pj::MediaFormat
- #include <media.hpp>
This structure describe detail information about an audio media.
Public Functions
-
void fromPj(const pjmedia_format &format)¶
Construct from pjmedia_format.
-
pjmedia_format toPj() const¶
Export to pjmedia_format.
Public Members
-
unsigned clockRate¶
Audio clock rate in samples or Hz.
-
unsigned channelCount¶
Number of channels.
-
unsigned frameTimeUsec¶
Frame interval, in microseconds.
-
unsigned bitsPerSample¶
Number of bits per sample.
-
pj_uint32_t avgBps¶
Average bitrate
-
pj_uint32_t maxBps¶
Maximum bitrate
-
void fromPj(const pjmedia_format &format)¶
-
struct MediaFormatVideo : public pj::MediaFormat
- #include <media.hpp>
This structure describe detail information about an video media.
Public Functions
-
void fromPj(const pjmedia_format &format)¶
Construct from pjmedia_format.
-
pjmedia_format toPj() const¶
Export to pjmedia_format.
Public Members
-
unsigned width¶
Video width.
-
unsigned height¶
Video height.
-
int fpsNum¶
Frames per second numerator.
-
int fpsDenum¶
Frames per second denumerator.
-
pj_uint32_t avgBps¶
Average bitrate.
-
pj_uint32_t maxBps¶
Maximum bitrate.
-
void fromPj(const pjmedia_format &format)¶
-
struct MediaSize
- #include <media.hpp>
Representation of media size.
-
class ToneDesc : public pjmedia_tone_desc
- #include <media.hpp>
Tone descriptor (abstraction for pjmedia_tone_desc)
-
class ToneDigit : public pjmedia_tone_digit
- #include <media.hpp>
Tone digit (abstraction for pjmedia_tone_digit)
-
struct ToneDigitMapDigit
- #include <media.hpp>
A digit in tone digit map
-
class ToneGenerator : public pj::AudioMedia
- #include <media.hpp>
Tone generator.
Public Functions
-
ToneGenerator()¶
Constructor.
-
~ToneGenerator()¶
Destructor. This will unregister the tone generator port from the conference bridge.
- void createToneGenerator (unsigned clock_rate=16000, unsigned channel_count=1) PJSUA2_THROW(Error)
Create tone generator and register the port to the conference bridge.
-
bool isBusy() const¶
Check if the tone generator is still busy producing some tones.
- Returns
Non-zero if busy.
- void stop () PJSUA2_THROW(Error)
Instruct the tone generator to stop current processing.
- void rewind () PJSUA2_THROW(Error)
Rewind the playback. This will start the playback to the first tone in the playback list.
- void play (const ToneDescVector &tones, bool loop=false) PJSUA2_THROW(Error)
Instruct the tone generator to play single or dual frequency tones with the specified duration. The new tones will be appended to currently playing tones, unless stop() is called before calling this function. The playback will begin as soon as the tone generator is connected to other media.
- Parameters
tones – Array of tones to be played.
loop – Play the tone in a loop.
- void playDigits (const ToneDigitVector &digits, bool loop=false) PJSUA2_THROW(Error)
Instruct the tone generator to play multiple MF digits with each of the digits having individual ON/OFF duration. Each of the digit in the digit array must have the corresponding descriptor in the digit map. The new tones will be appended to currently playing tones, unless stop() is called before calling this function. The playback will begin as soon as the tone generator is connected to a sink media.
- Parameters
digits – Array of MF digits.
loop – Play the tone in a loop.
- ToneDigitMapVector getDigitMap () const PJSUA2_THROW(Error)
Get the digit-map currently used by this tone generator.
- Returns
The digitmap currently used by the tone generator
- void setDigitMap (const ToneDigitMapVector &digit_map) PJSUA2_THROW(Error)
Set digit map to be used by the tone generator.
- Parameters
digit_map – Digitmap to be used by the tone generator.
-
ToneGenerator()¶
-
struct VidCodecParam
- #include <media.hpp>
Detailed codec attributes used in configuring a video codec and in querying the capability of video codec factories.
Please note that codec parameter also contains SDP specific setting, decFmtp and encFmtp, which may need to be set appropriately based on the effective setting. See each codec documentation for more detail.
Public Functions
-
inline VidCodecParam()¶
Default constructor
-
void fromPj(const pjmedia_vid_codec_param ¶m)¶
-
pjmedia_vid_codec_param toPj() const¶
Public Members
-
pjmedia_dir dir¶
Direction
-
pjmedia_vid_packing packing¶
Packetization strategy.
-
struct MediaFormatVideo encFmt¶
Encoded format
-
CodecFmtpVector encFmtp¶
Encoder fmtp params
-
unsigned encMtu¶
MTU or max payload size setting
-
struct MediaFormatVideo decFmt¶
Decoded format
-
CodecFmtpVector decFmtp¶
Decoder fmtp params
-
bool ignoreFmtp¶
Ignore fmtp params. If set to true, the codec will apply format settings specified in encFmt and decFmt only.
-
inline VidCodecParam()¶
-
struct VidConfPortInfo
- #include <media.hpp>
This structure descibes information about a particular media port that has been registered into the conference bridge.
Public Functions
-
void fromPj(const pjsua_vid_conf_port_info &port_info)¶
Construct from pjsua_conf_port_info.
Public Members
-
int portId¶
Conference port number.
-
string name¶
Port name.
-
MediaFormatVideo format¶
Media audio format information
-
void fromPj(const pjsua_vid_conf_port_info &port_info)¶
-
class VidDevManager
- #include <media.hpp>
Video device manager.
Public Functions
- void initSubsys () PJSUA2_THROW(Error)
Initialize the video device subsystem. This will register all supported video device factories to the video device subsystem.
By default, library will initialize video device subsystem automatically on library initialization, so application will never need to invoke this function. However, when PJSUA_DONT_INIT_VID_DEV_SUBSYS is set to non-zero, application should invoke this function before accessing video device.
- void refreshDevs () PJSUA2_THROW(Error)
Refresh the list of video devices installed in the system. This function will only refresh the list of video device so all active video streams will be unaffected. After refreshing the device list, application MUST make sure to update all index references to video devices (i.e. all variables of type pjmedia_vid_dev_index) before calling any function that accepts video device index as its parameter.
-
unsigned getDevCount()¶
Get the number of video devices installed in the system.
- Returns
The number of devices.
- VideoDevInfo getDevInfo (int dev_id) const PJSUA2_THROW(Error)
Retrieve the video device info for the specified device index.
- Parameters
dev_id – The video device id
- Returns
The list of video device info
- const VideoDevInfoVector & enumDev () PJSUA2_THROW(Error)
Warning: deprecated, use enumDev2() instead. This function is not safe in multithreaded environment.
Enum all video devices installed in the system.
- Returns
The list of video device info
- VideoDevInfoVector2 enumDev2 () const PJSUA2_THROW(Error)
Enum all video devices installed in the system.
- Returns
The list of video device info
- int lookupDev (const string &drv_name, const string &dev_name) const PJSUA2_THROW(Error)
Lookup device index based on the driver and device name.
- Parameters
drv_name – The driver name.
dev_name – The device name.
- Returns
The device ID. If the device is not found, Error will be thrown.
-
string capName(pjmedia_vid_dev_cap cap) const¶
Get string info for the specified capability.
- Parameters
cap – The capability ID.
- Returns
Capability name.
- void setFormat (int dev_id, const MediaFormatVideo &format, bool keep) PJSUA2_THROW(Error)
This will configure video format capability to the video device. If video device is currently active, the method will forward the setting to the video device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_VID_DEV_CAP_FORMAT capability in VideoDevInfo.caps flags, otherwise Error will be thrown.
Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the video device to be used.
- Parameters
dev_id – The video device id.
format – The video format.
keep – Specify whether the setting is to be kept for future use.
- MediaFormatVideo getFormat (int dev_id) const PJSUA2_THROW(Error)
Get the video format capability to the video device. If video device is currently active, the method will forward the request to the video device. If video device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_VID_DEV_CAP_FORMAT capability in VideoDevInfo.caps flags, otherwise Error will be thrown.
- Parameters
dev_id – The video device id.
- Returns
keep The video format.
- void setInputScale (int dev_id, const MediaSize &scale, bool keep) PJSUA2_THROW(Error)
This will configure video format capability to the video device. If video device is currently active, the method will forward the setting to the video device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_VID_DEV_CAP_INPUT_SCALE capability in VideoDevInfo.caps flags, otherwise Error will be thrown.
Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the video device to be used.
- Parameters
dev_id – The video device id.
scale – The video scale.
keep – Specify whether the setting is to be kept for future use.
- MediaSize getInputScale (int dev_id) const PJSUA2_THROW(Error)
Get the video input scale capability to the video device. If video device is currently active, the method will forward the request to the video device. If video device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_VID_DEV_CAP_FORMAT capability in VideoDevInfo.caps flags, otherwise Error will be thrown.
- Parameters
dev_id – The video device id.
- Returns
keep The video format.
- void setOutputWindowFlags (int dev_id, int flags, bool keep) PJSUA2_THROW(Error)
This will configure fast switching to another video device. If video device is currently active, the method will forward the setting to the video device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS capability in VideoDevInfo.caps flags, otherwise Error will be thrown.
Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the video device to be used.
- Parameters
dev_id – The video device id.
flags – The video window flag.
keep – Specify whether the setting is to be kept for future use.
- int getOutputWindowFlags (int dev_id) PJSUA2_THROW(Error)
Get the window output flags capability to the video device. If video device is currently active, the method will forward the request to the video device. If video device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.
This method is only valid if the device has PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS capability in VideoDevInfo.caps flags, otherwise Error will be thrown.
- Parameters
dev_id – The video device id.
- Returns
keep The video format.
- void switchDev (int dev_id, const VideoSwitchParam ¶m) PJSUA2_THROW(Error)
This will configure fast switching to another video device. If video device is currently active, the method will forward the setting to the video device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_VID_DEV_CAP_SWITCH capability in VideoDevInfo.caps flags, otherwise Error will be thrown.
- Parameters
dev_id – The video device id.
param – The video switch param.
-
bool isCaptureActive(int dev_id) const¶
Check whether the video capture device is currently active, i.e. if a video preview has been started or there is a video call using the device.
- Parameters
dev_id – The video device id
- Returns
True if it’s active.
- void setCaptureOrient (pjmedia_vid_dev_index dev_id, pjmedia_orient orient, bool keep=true) PJSUA2_THROW(Error)
This will configure video orientation of the video capture device. If the device is currently active (i.e. if there is a video call using the device or a video preview has been started), the method will forward the setting to the video device instance to be applied immediately, if it supports it.
The setting will be saved for future opening of the video device, if the “keep” argument is set to true. If the video device is currently inactive, and the “keep” argument is false, this method will throw Error.
- Parameters
dev_id – The video device id
orient – The video orientation.
keep – Specify whether the setting is to be kept for future use.
Private Functions
-
void clearVideoDevList()¶
-
VidDevManager()¶
Constructor.
-
~VidDevManager()¶
Destructor.
Private Members
-
VideoDevInfoVector videoDevList¶
Friends
- friend class Endpoint
-
struct VideoDevInfo
- #include <media.hpp>
Video device information structure.
Public Functions
-
inline VideoDevInfo()¶
Default constructor
-
void fromPj(const pjmedia_vid_dev_info &dev_info)¶
Construct from pjmedia_vid_dev_info.
-
~VideoDevInfo()¶
Destructor.
Public Members
-
pjmedia_vid_dev_index id¶
The device ID
-
string name¶
The device name
-
string driver¶
The underlying driver name
-
pjmedia_dir dir¶
The supported direction of the video device, i.e. whether it supports capture only, render only, or both.
-
unsigned caps¶
Device capabilities, as bitmask combination of pjmedia_vid_dev_cap
-
MediaFormatVideoVector fmt¶
Array of supported video formats. Some fields in each supported video format may be set to zero or of “unknown” value, to indicate that the value is unknown or should be ignored. When these value are not set to zero, it indicates that the exact format combination is being used.
-
inline VideoDevInfo()¶
-
class VideoMedia : public pj::Media
- #include <media.hpp>
Video Media.
Public Functions
- VidConfPortInfo getPortInfo () const PJSUA2_THROW(Error)
Get information about the specified conference port.
-
int getPortId() const¶
Get port Id.
- void startTransmit (const VideoMedia &sink, const VideoMediaTransmitParam ¶m) const PJSUA2_THROW(Error)
Establish unidirectional media flow to sink. This media port will act as a source, and it may transmit to multiple destinations/sink. And if multiple sources are transmitting to the same sink, the media will be mixed together. Source and sink may refer to the same Media, effectively looping the media.
If bidirectional media flow is desired, application needs to call this method twice, with the second one called from the opposite source media.
- Parameters
sink – The destination Media.
param – The parameter.
- void stopTransmit (const VideoMedia &sink) const PJSUA2_THROW(Error)
Stop media flow to destination/sink port.
- Parameters
sink – The destination media.
- void update () const PJSUA2_THROW(Error)
Update or refresh port states from video port info. Some port may change its port info in the middle of a session, for example when a video stream decoder learns that incoming video size or frame rate has changed, video conference needs to be informed to update its internal states.
-
VideoMedia()¶
Default Constructor.
Normally application will not create VideoMedia object directly, but it instantiates a VideoMedia derived class. This is set as public because some STL vector implementations require it.
-
virtual ~VideoMedia()¶
Virtual Destructor
Public Static Functions
- static VidConfPortInfo getPortInfoFromId (int port_id) PJSUA2_THROW(Error)
Get information from specific port id.
Protected Functions
- void registerMediaPort (MediaPort port, pj_pool_t *pool) PJSUA2_THROW(Error)
This method needs to be called by descendants of this class to register the media port created to the conference bridge and Endpoint’s media list.
param port The media port to be registered to the conference bridge. param pool The memory pool.
-
void unregisterMediaPort()¶
This method needs to be called by descendants of this class to remove the media port from the conference bridge and Endpoint’s media list. Descendant should only call this method if it has registered the media with the previous call to registerMediaPort().
Protected Attributes
-
int id¶
Conference port Id.
-
struct VideoMediaTransmitParam
- #include <media.hpp>
Parameters for VideoMedia::startTransmit() method.
-
class VideoPreview
- #include <media.hpp>
Video Preview
Public Functions
-
VideoPreview(int dev_id)¶
Constructor
-
bool hasNative()¶
Determine if the specified video input device has built-in native preview capability. This is a convenience function that is equal to querying device’s capability for PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW capability.
- Returns
true if it has.
- void start (const VideoPreviewOpParam ¶m) PJSUA2_THROW(Error)
Start video preview window for the specified capture device.
- Parameters
p – Video preview parameters.
- void stop () PJSUA2_THROW(Error)
Stop video preview.
-
VideoWindow getVideoWindow()¶
- VideoMedia getVideoMedia () PJSUA2_THROW(Error)
Get video media or conference bridge port of the video capture device.
- Returns
Video media of the video capture device.
Private Functions
-
void updateDevId()¶
-
VideoPreview(int dev_id)¶
-
struct VideoPreviewOpParam
- #include <media.hpp>
This structure contains parameters for VideoPreview::start()
Public Functions
-
VideoPreviewOpParam()¶
Default constructor initializes with default values.
-
void fromPj(const pjsua_vid_preview_param &prm)¶
Convert from pjsip
-
pjsua_vid_preview_param toPj() const¶
Convert to pjsip
Public Members
-
pjmedia_vid_dev_index rendId¶
Device ID for the video renderer to be used for rendering the capture stream for preview. This parameter is ignored if native preview is being used.
Default: PJMEDIA_VID_DEFAULT_RENDER_DEV
-
bool show¶
Show window initially.
Default: PJ_TRUE.
-
unsigned windowFlags¶
Window flags. The value is a bitmask combination of pjmedia_vid_dev_wnd_flag.
Default: 0.
-
MediaFormat format¶
Media format. If left unitialized, this parameter will not be used.
-
VideoWindowHandle window¶
Optional output window to be used to display the video preview. This parameter will only be used if the video device supports PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW capability and the capability is not read-only.
-
VideoPreviewOpParam()¶
-
struct VideoSwitchParam
- #include <media.hpp>
Parameter for switching device with PJMEDIA_VID_DEV_CAP_SWITCH capability.
Public Members
-
pjmedia_vid_dev_index target_id¶
Target device ID to switch to. Once the switching is successful, the video stream will use this device and the old device will be closed.
-
pjmedia_vid_dev_index target_id¶
-
class VideoWindow
- #include <media.hpp>
Video window.
Public Functions
-
VideoWindow(int win_id)¶
Constructor
- VideoWindowInfo getInfo () const PJSUA2_THROW(Error)
Get window info.
- Returns
video window info.
- VideoMedia getVideoMedia () PJSUA2_THROW(Error)
Get video media or conference bridge port of the renderer of this video window.
- Returns
Video media of this renderer window.
- void Show (bool show) PJSUA2_THROW(Error)
Show or hide window. This operation is not valid for native windows (VideoWindowInfo.isNative=true), on which native windowing API must be used instead.
- Parameters
show – Set to true to show the window, false to hide the window.
- void setPos (const MediaCoordinate &pos) PJSUA2_THROW(Error)
Set video window position. This operation is not valid for native windows (VideoWindowInfo.isNative=true), on which native windowing API must be used instead.
- Parameters
pos – The window position.
- void setSize (const MediaSize &size) PJSUA2_THROW(Error)
Resize window. This operation is not valid for native windows (VideoWindowInfo.isNative=true), on which native windowing API must be used instead.
- Parameters
size – The new window size.
- void rotate (int angle) PJSUA2_THROW(Error)
Rotate the video window. This function will change the video orientation and also possibly the video window size (width and height get swapped). This operation is not valid for native windows (VideoWindowInfo.isNative =true), on which native windowing API must be used instead.
- Parameters
angle – The rotation angle in degrees, must be multiple of 90. Specify positive value for clockwise rotation or negative value for counter-clockwise rotation.
- void setWindow (const VideoWindowHandle &win) PJSUA2_THROW(Error)
Set output window. This operation is valid only when the underlying video device supports PJMEDIA_VIDEO_DEV_CAP_OUTPUT_WINDOW capability AND allows the output window to be changed on-the-fly, otherwise Error will be thrown. Currently it is only supported on Android.
- Parameters
win – The new output window.
- void setFullScreen (bool enabled) PJSUA2_THROW(Error)
Set video window full-screen. This operation is valid only when the underlying video device supports PJMEDIA_VID_DEV_CAP_OUTPUT_FULLSCREEN capability. Currently it is only supported on SDL backend.
- Parameters
enabled – Set to true if full screen is desired, false otherwise.
- void setFullScreen2 (pjmedia_vid_dev_fullscreen_flag mode) PJSUA2_THROW(Error)
Set video window full-screen. This operation is valid only when the underlying video device supports PJMEDIA_VID_DEV_CAP_OUTPUT_FULLSCREEN capability. Currently it is only supported on SDL backend.
- Parameters
mode – Fullscreen mode, see pjmedia_vid_dev_fullscreen_flag.
Private Members
-
pjsua_vid_win_id winId¶
-
VideoWindow(int win_id)¶
-
struct VideoWindowHandle
- #include <media.hpp>
Video window handle.
Public Members
-
pjmedia_vid_dev_hwnd_type type¶
The window handle type.
-
WindowHandle handle¶
The window handle.
-
pjmedia_vid_dev_hwnd_type type¶
-
typedef std::vector<MediaFormatAudio> MediaFormatAudioVector¶
call.hpp¶
PJSUA2 Call manipulation.
-
namespace pj
PJSUA2 API is inside pj namespace
Typedefs
-
typedef void *MediaTransport¶
Media transport, corresponds to pjmedia_transport
-
typedef std::vector<CallMediaInfo> CallMediaInfoVector¶
Array of call media info
-
class Call
- #include <call.hpp>
Call.
Public Functions
-
Call(Account &acc, int call_id = PJSUA_INVALID_ID)¶
Constructor.
-
virtual ~Call()¶
Destructor.
- CallInfo getInfo () const PJSUA2_THROW(Error)
Obtain detail information about this call.
- Returns
Call info.
-
bool isActive() const¶
Check if this call has active INVITE session and the INVITE session has not been disconnected.
- Returns
True if call is active.
-
int getId() const¶
Get PJSUA-LIB call ID or index associated with this call.
- Returns
Integer greater than or equal to zero.
-
bool hasMedia() const¶
Check if call has an active media session.
- Returns
True if yes.
-
Media *getMedia(unsigned med_idx) const¶
Warning: deprecated, use getAudioMedia() instead. This function is not safe in multithreaded environment.
Get media for the specified media index.
- Parameters
med_idx – Media index.
- Returns
The media or NULL if invalid or inactive.
- AudioMedia getAudioMedia (int med_idx) const PJSUA2_THROW(Error)
Get audio media for the specified media index. If the specified media index is not audio or invalid or inactive, exception will be thrown.
- Parameters
med_idx – Media index, or -1 to specify any first audio media registered in the conference bridge.
- Returns
The audio media.
- VideoMedia getEncodingVideoMedia (int med_idx) const PJSUA2_THROW(Error)
Get video media in encoding direction for the specified media index. If the specified media index is not video or invalid or the direction is receive only, exception will be thrown.
- Parameters
med_idx – Media index, or -1 to specify any first video media with encoding direction registered in the conference bridge.
- Returns
The video media.
- VideoMedia getDecodingVideoMedia (int med_idx) const PJSUA2_THROW(Error)
Get video media in decoding direction for the specified media index. If the specified media index is not video or invalid or the direction is send only, exception will be thrown.
- Parameters
med_idx – Media index, or -1 to specify any first video media with decoding direction registered in the conference bridge.
- Returns
The video media.
-
pjsip_dialog_cap_status remoteHasCap(int htype, const string &hname, const string &token) const¶
Check if remote peer support the specified capability.
- Parameters
htype – The header type (pjsip_hdr_e) to be checked, which value may be:
PJSIP_H_ACCEPT
PJSIP_H_ALLOW
PJSIP_H_SUPPORTED
hname – If htype specifies PJSIP_H_OTHER, then the header name must be supplied in this argument. Otherwise the value must be set to empty string (“”).
token – The capability token to check. For example, if htype is PJSIP_H_ALLOW, then token specifies the method names; if htype is PJSIP_H_SUPPORTED, then token specifies the extension names such as “100rel”.
- Returns
PJSIP_DIALOG_CAP_SUPPORTED if the specified capability is explicitly supported, see pjsip_dialog_cap_status for more info.
-
void setUserData(Token user_data)¶
Attach application specific data to the call. Application can then inspect this data by calling getUserData().
- Parameters
user_data – Arbitrary data to be attached to the call.
-
Token getUserData() const¶
Get user data attached to the call, which has been previously set with setUserData().
- Returns
The user data.
- pj_stun_nat_type getRemNatType () PJSUA2_THROW(Error)
Get the NAT type of remote’s endpoint. This is a proprietary feature of PJSUA-LIB which sends its NAT type in the SDP when natTypeInSdp is set in UaConfig.
This function can only be called after SDP has been received from remote, which means for incoming call, this function can be called as soon as call is received as long as incoming call contains SDP, and for outgoing call, this function can be called only after SDP is received (normally in 200/OK response to INVITE). As a general case, application should call this function after or in onCallMediaState() callback.
See also
Endpoint::natGetType(), natTypeInSdp
- Returns
The NAT type.
- void makeCall (const string &dst_uri, const CallOpParam &prm) PJSUA2_THROW(Error)
Make outgoing call to the specified URI.
- Parameters
dst_uri – URI to be put in the To header (normally is the same as the target URI).
prm.opt – Optional call setting.
prm.txOption – Optional headers etc to be added to outgoing INVITE request.
- void answer (const CallOpParam &prm) PJSUA2_THROW(Error)
Send response to incoming INVITE request with call setting param. Depending on the status code specified as parameter, this function may send provisional response, establish the call, or terminate the call. Notes about call setting:
if call setting is changed in the subsequent call to this function, only the first call setting supplied will applied. So normally application will not supply call setting before getting confirmation from the user.
if no call setting is supplied when SDP has to be sent, i.e: answer with status code 183 or 2xx, the default call setting will be used, check CallSetting for its default values.
- Parameters
prm.opt – Optional call setting.
prm.statusCode – Status code, (100-699).
prm.reason – Optional reason phrase. If empty, default text will be used.
prm.txOption – Optional list of headers etc to be added to outgoing response message. Note that this message data will be persistent in all next answers/responses for this INVITE request.
- void hangup (const CallOpParam &prm) PJSUA2_THROW(Error)
Hangup call by using method that is appropriate according to the call state. This function is different than answering the call with 3xx-6xx response (with answer()), in that this function will hangup the call regardless of the state and role of the call, while answer() only works with incoming calls on EARLY state.
- Parameters
prm.statusCode – Optional status code to be sent when we’re rejecting incoming call. If the value is zero, “603/Decline” will be sent.
prm.reason – Optional reason phrase to be sent when we’re rejecting incoming call. If empty, default text will be used.
prm.txOption – Optional list of headers etc to be added to outgoing request/response message.
- void setHold (const CallOpParam &prm) PJSUA2_THROW(Error)
Put the specified call on hold. This will send re-INVITE with the appropriate SDP to inform remote that the call is being put on hold. The final status of the request itself will be reported on the onCallMediaState() callback, which inform the application that the media state of the call has changed.
- Parameters
prm.options – Bitmask of pjsua_call_flag constants. Currently, only the flag PJSUA_CALL_UPDATE_CONTACT can be used.
prm.txOption – Optional message components to be sent with the request.
- void reinvite (const CallOpParam &prm) PJSUA2_THROW(Error)
Send re-INVITE. The final status of the request itself will be reported on the onCallMediaState() callback, which inform the application that the media state of the call has changed.
- Parameters
prm.opt – Optional call setting, if empty, the current call setting will remain unchanged.
prm.opt.flag – Bitmask of pjsua_call_flag constants. Specifying PJSUA_CALL_UNHOLD here will release call hold.
prm.txOption – Optional message components to be sent with the request.
- void update (const CallOpParam &prm) PJSUA2_THROW(Error)
Send UPDATE request.
- Parameters
prm.opt – Optional call setting, if empty, the current call setting will remain unchanged.
prm.txOption – Optional message components to be sent with the request.
- void xfer (const string &dest, const CallOpParam &prm) PJSUA2_THROW(Error)
Initiate call transfer to the specified address. This function will send REFER request to instruct remote call party to initiate a new INVITE session to the specified destination/target.
If application is interested to monitor the successfulness and the progress of the transfer request, it can implement onCallTransferStatus() callback which will report the progress of the call transfer request.
- Parameters
dest – URI of new target to be contacted. The URI may be in name address or addr-spec format.
prm.txOption – Optional message components to be sent with the request.
- void xferReplaces (const Call &dest_call, const CallOpParam &prm) PJSUA2_THROW(Error)
Initiate attended call transfer. This function will send REFER request to instruct remote call party to initiate new INVITE session to the URL of destCall. The party at dest_call then should “replace” the call with us with the new call from the REFER recipient.
- Parameters
dest_call – The call to be replaced.
prm.options – Application may specify PJSUA_XFER_NO_REQUIRE_REPLACES to suppress the inclusion of “Require: replaces” in the outgoing INVITE request created by the REFER request.
prm.txOption – Optional message components to be sent with the request.
- void processRedirect (pjsip_redirect_op cmd) PJSUA2_THROW(Error)
Accept or reject redirection response. Application MUST call this function after it signaled PJSIP_REDIRECT_PENDING in the onCallRedirected() callback, to notify the call whether to accept or reject the redirection to the current target. Application can use the combination of PJSIP_REDIRECT_PENDING command in onCallRedirected() callback and this function to ask for user permission before redirecting the call.
Note that if the application chooses to reject or stop redirection (by using PJSIP_REDIRECT_REJECT or PJSIP_REDIRECT_STOP respectively), the call disconnection callback will be called before this function returns. And if the application rejects the target, the onCallRedirected() callback may also be called before this function returns if there is another target to try.
- Parameters
cmd – Redirection operation to be applied to the current target. The semantic of this argument is similar to the description in the onCallRedirected() callback, except that the PJSIP_REDIRECT_PENDING is not accepted here.
- void dialDtmf (const string &digits) PJSUA2_THROW(Error)
Send DTMF digits to remote using RFC 2833 payload formats.
- Parameters
digits – DTMF string digits to be sent.
- void sendDtmf (const CallSendDtmfParam ¶m) PJSUA2_THROW(Error)
Send DTMF digits to remote.
- Parameters
param – The send DTMF parameter.
- void sendInstantMessage (const SendInstantMessageParam &prm) PJSUA2_THROW(Error)
Send instant messaging inside INVITE session.
- Parameters
prm.contentType – MIME type.
prm.content – The message content.
prm.txOption – Optional list of headers etc to be included in outgoing request. The body descriptor in the txOption is ignored.
prm.userData – Optional user data, which will be given back when the IM callback is called.
- void sendTypingIndication (const SendTypingIndicationParam &prm) PJSUA2_THROW(Error)
Send IM typing indication inside INVITE session.
- Parameters
prm.isTyping – True to indicate to remote that local person is currently typing an IM.
prm.txOption – Optional list of headers etc to be included in outgoing request.
- void sendRequest (const CallSendRequestParam &prm) PJSUA2_THROW(Error)
Send arbitrary request with the call. This is useful for example to send INFO request. Note that application should not use this function to send requests which would change the invite session’s state, such as re-INVITE, UPDATE, PRACK, and BYE.
- Parameters
prm.method – SIP method of the request.
prm.txOption – Optional message body and/or list of headers to be included in outgoing request.
- string dump (bool with_media, const string indent) PJSUA2_THROW(Error)
Dump call and media statistics to string.
- Parameters
with_media – True to include media information too.
indent – Spaces for left indentation.
- Returns
Call dump and media statistics string.
-
int vidGetStreamIdx() const¶
Get the media stream index of the default video stream in the call. Typically this will just retrieve the stream index of the first activated video stream in the call. If none is active, it will return the first inactive video stream.
- Returns
The media stream index or -1 if no video stream is present in the call.
-
bool vidStreamIsRunning(int med_idx, pjmedia_dir dir) const¶
Determine if video stream for the specified call is currently running (i.e. has been created, started, and not being paused) for the specified direction.
- Parameters
med_idx – Media stream index, or -1 to specify default video media.
dir – The direction to be checked.
- Returns
True if stream is currently running for the specified direction.
- void vidSetStream (pjsua_call_vid_strm_op op, const CallVidSetStreamParam ¶m) PJSUA2_THROW(Error)
Add, remove, modify, and/or manipulate video media stream for the specified call. This may trigger a re-INVITE or UPDATE to be sent for the call.
- Parameters
op – The video stream operation to be performed, possible values are pjsua_call_vid_strm_op.
param – The parameters for the video stream operation (see CallVidSetStreamParam).
- StreamInfo getStreamInfo (unsigned med_idx) const PJSUA2_THROW(Error)
Get media stream info for the specified media index.
- Parameters
med_idx – Media stream index.
- Returns
The stream info.
- StreamStat getStreamStat (unsigned med_idx) const PJSUA2_THROW(Error)
Get media stream statistic for the specified media index.
- Parameters
med_idx – Media stream index.
- Returns
The stream statistic.
- MediaTransportInfo getMedTransportInfo (unsigned med_idx) const PJSUA2_THROW(Error)
Get media transport info for the specified media index.
- Parameters
med_idx – Media stream index.
- Returns
The transport info.
-
void processMediaUpdate(OnCallMediaStateParam &prm)¶
Internal function (callled by Endpoint( to process update to call medias when call media state changes.
-
void processStateChange(OnCallStateParam &prm)¶
Internal function (called by Endpoint) to process call state change.
-
inline virtual void onCallState(OnCallStateParam &prm)¶
Notify application when call state has changed. Application may then query the call info to get the detail call states by calling getInfo() function.
- Parameters
prm – Callback parameter.
-
inline virtual void onCallTsxState(OnCallTsxStateParam &prm)¶
This is a general notification callback which is called whenever a transaction within the call has changed state. Application can implement this callback for example to monitor the state of outgoing requests, or to answer unhandled incoming requests (such as INFO) with a final response.
- Parameters
prm – Callback parameter.
-
inline virtual void onCallMediaState(OnCallMediaStateParam &prm)¶
Notify application when media state in the call has changed. Normal application would need to implement this callback, e.g. to connect the call’s media to sound device. When ICE is used, this callback will also be called to report ICE negotiation failure.
- Parameters
prm – Callback parameter.
-
inline virtual void onCallSdpCreated(OnCallSdpCreatedParam &prm)¶
Notify application when a call has just created a local SDP (for initial or subsequent SDP offer/answer). Application can implement this callback to modify the SDP, before it is being sent and/or negotiated with remote SDP, for example to apply per account/call basis codecs priority or to add custom/proprietary SDP attributes.
- Parameters
prm – Callback parameter.
-
inline virtual void onStreamPreCreate(OnStreamPreCreateParam &prm)¶
Notify application when an audio media session is about to be created (as opposed to #on_stream_created() and #on_stream_created2() which are called after the session has been created). The application may change some stream info parameter values, i.e: jbInit, jbMinPre, jbMaxPre, jbMax, useKa, rtcpSdesByeDisabled, jbDiscardAlgo (audio), vidCodecParam.encFmt (video).
- Parameters
prm – Callback parameter.
-
inline virtual void onStreamCreated(OnStreamCreatedParam &prm)¶
Notify application when audio media session is created and before it is registered to the conference bridge. Application may return different audio media port if it has added media processing port to the stream. This media port then will be added to the conference bridge instead.
- Parameters
prm – Callback parameter.
-
inline virtual void onStreamDestroyed(OnStreamDestroyedParam &prm)¶
Notify application when audio media session has been unregistered from the conference bridge and about to be destroyed.
- Parameters
prm – Callback parameter.
-
inline virtual void onDtmfDigit(OnDtmfDigitParam &prm)¶
Notify application upon incoming DTMF digits.
- Parameters
prm – Callback parameter.
-
inline virtual void onDtmfEvent(OnDtmfEventParam &prm)¶
Notify application upon incoming DTMF events.
- Parameters
prm – Callback parameter.
-
inline virtual void onCallTransferRequest(OnCallTransferRequestParam &prm)¶
Notify application on call being transferred (i.e. REFER is received). Application can decide to accept/reject transfer request by setting the code (default is 202). When this callback is not implemented, the default behavior is to accept the transfer.
If application decides to accept the transfer request, it must also instantiate the new Call object for the transfer operation and return this new Call object to prm.newCall.
If application does not specify new Call object, library will reuse the existing Call object for initiating the new call (to the transfer destination). In this case, any events from both calls (transferred and transferring) will be delivered to the same Call object, where the call ID will be switched back and forth between callbacks. Application must be careful to not destroy the Call object when receiving disconnection event of the transferred call after the transfer process is completed.
- Parameters
prm – Callback parameter.
-
inline virtual void onCallTransferStatus(OnCallTransferStatusParam &prm)¶
Notify application of the status of previously sent call transfer request. Application can monitor the status of the call transfer request, for example to decide whether to terminate existing call.
- Parameters
prm – Callback parameter.
-
inline virtual void onCallReplaceRequest(OnCallReplaceRequestParam &prm)¶
Notify application about incoming INVITE with Replaces header. Application may reject the request by setting non-2xx code.
- Parameters
prm – Callback parameter.
-
inline virtual void onCallReplaced(OnCallReplacedParam &prm)¶
Notify application that an existing call has been replaced with a new call. This happens when PJSUA-API receives incoming INVITE request with Replaces header.
After this callback is called, normally PJSUA-API will disconnect this call and establish a new call. To be able to control the call, e.g: hold, transfer, change media parameters, application must instantiate a new Call object for the new call using call ID specified in prm.newCallId, and return the Call object via prm.newCall.
- Parameters
prm – Callback parameter.
-
inline virtual void onCallRxOffer(OnCallRxOfferParam &prm)¶
Notify application when call has received new offer from remote (i.e. re-INVITE/UPDATE with SDP is received). Application can decide to accept/reject the offer by setting the code (default is 200). If the offer is accepted, application can update the call setting to be applied in the answer. When this callback is not implemented, the default behavior is to accept the offer using current call setting.
- Parameters
prm – Callback parameter.
-
inline virtual void onCallRxReinvite(OnCallRxReinviteParam &prm)¶
Notify application when call has received a re-INVITE offer from the peer. It allows more fine-grained control over the response to a re-INVITE. If application sets async to PJ_TRUE, it can send the reply manually using the function #Call::answer() and setting the SDP answer. Otherwise, by default the re-INVITE will be answered automatically after the callback returns.
Currently, this callback is only called for re-INVITE with SDP, but app should be prepared to handle the case of re-INVITE without SDP.
Remarks: If manually answering at a later timing, application may need to monitor onCallTsxState() callback to check whether the re-INVITE is already answered automatically with 487 due to being cancelled.
Note: onCallRxOffer() will still be called after this callback, but only if prm.async is false and prm.code is 200.
-
inline virtual void onCallTxOffer(OnCallTxOfferParam &prm)¶
Notify application when call has received INVITE with no SDP offer. Application can update the call setting (e.g: add audio/video), or enable/disable codecs, or update other media session settings from within the callback, however, as mandated by the standard (RFC3261 section 14.2), it must ensure that the update overlaps with the existing media session (in codecs, transports, or other parameters) that require support from the peer, this is to avoid the need for the peer to reject the offer.
When this callback is not implemented, the default behavior is to send SDP offer using current active media session (with all enabled codecs on each media type).
- Parameters
prm – Callback parameter.
-
inline virtual void onInstantMessage(OnInstantMessageParam &prm)¶
Notify application on incoming MESSAGE request.
- Parameters
prm – Callback parameter.
-
inline virtual void onInstantMessageStatus(OnInstantMessageStatusParam &prm)¶
Notify application about the delivery status of outgoing MESSAGE request.
- Parameters
prm – Callback parameter.
-
inline virtual void onTypingIndication(OnTypingIndicationParam &prm)¶
Notify application about typing indication.
- Parameters
prm – Callback parameter.
-
inline virtual pjsip_redirect_op onCallRedirected(OnCallRedirectedParam &prm)¶
This callback is called when the call is about to resend the INVITE request to the specified target, following the previously received redirection response.
Application may accept the redirection to the specified target, reject this target only and make the session continue to try the next target in the list if such target exists, stop the whole redirection process altogether and cause the session to be disconnected, or defer the decision to ask for user confirmation.
This callback is optional, the default behavior is to NOT follow the redirection response.
- Parameters
prm – Callback parameter.
- Returns
Action to be performed for the target. Set this parameter to one of the value below:
PJSIP_REDIRECT_ACCEPT: immediately accept the redirection. When set, the call will immediately resend INVITE request to the target.
PJSIP_REDIRECT_ACCEPT_REPLACE: immediately accept the redirection and replace the To header with the current target. When set, the call will immediately resend INVITE request to the target.
PJSIP_REDIRECT_REJECT: immediately reject this target. The call will continue retrying with next target if present, or disconnect the call if there is no more target to try.
PJSIP_REDIRECT_STOP: stop the whole redirection process and immediately disconnect the call. The onCallState() callback will be called with PJSIP_INV_STATE_DISCONNECTED state immediately after this callback returns.
PJSIP_REDIRECT_PENDING: set to this value if no decision can be made immediately (for example to request confirmation from user). Application then MUST call processRedirect() to either accept or reject the redirection upon getting user decision.
-
inline virtual void onCallMediaTransportState(OnCallMediaTransportStateParam &prm)¶
This callback is called when media transport state is changed.
- Parameters
prm – Callback parameter.
-
inline virtual void onCallMediaEvent(OnCallMediaEventParam &prm)¶
Notification about media events such as video notifications. This callback will most likely be called from media threads, thus application must not perform heavy processing in this callback. Especially, application must not destroy the call or media in this callback. If application needs to perform more complex tasks to handle the event, it should post the task to another thread.
- Parameters
prm – Callback parameter.
-
inline virtual void onCreateMediaTransport(OnCreateMediaTransportParam &prm)¶
This callback can be used by application to implement custom media transport adapter for the call, or to replace the media transport with something completely new altogether.
This callback is called when a new call is created. The library has created a media transport for the call, and it is provided as the mediaTp argument of this callback. The callback may change it with the instance of media transport to be used by the call.
- Parameters
prm – Callback parameter.
-
inline virtual void onCreateMediaTransportSrtp(OnCreateMediaTransportSrtpParam &prm)¶
Warning: deprecated and may be removed in future release. Application can set SRTP crypto settings (including keys) and keying methods via AccountConfig.mediaConfig.srtpOpt. See also ticket #2100.
This callback is called when SRTP media transport is created. Application can modify the SRTP setting srtpOpt to specify the cryptos and keys which are going to be used. Note that application should not modify the field pjmedia_srtp_setting.close_member_tp and can only modify the field pjmedia_srtp_setting.use for initial INVITE.
- Parameters
prm – Callback parameter.
Public Static Functions
Private Members
Friends
- friend class Endpoint
-
Call(Account &acc, int call_id = PJSUA_INVALID_ID)¶
-
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).
-
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
-
inline CallInfo()¶
-
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
-
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.
-
CallMediaInfo()¶
-
struct CallOpParam
- #include <call.hpp>
This structure contains parameters for Call::answer(), Call::hangup(), Call::reinvite(), Call::update(), Call::xfer(), Call::xferReplaces(), Call::setHold().
Public Functions
-
CallOpParam(bool useDefaultCallSetting = false)¶
Default constructor initializes with zero/empty values. Setting useDefaultCallSetting to true will initialize opt with default call setting values.
Public Members
-
CallSetting opt¶
The call setting.
-
pjsip_status_code statusCode¶
Status code.
-
string reason¶
Reason phrase.
-
unsigned options¶
Options.
-
SipTxOption txOption¶
List of headers etc to be added to outgoing response message. Note that this message data will be persistent in all next answers/responses for this INVITE request.
-
SdpSession sdp¶
SDP answer. Currently only used for Call::answer().
-
CallOpParam(bool useDefaultCallSetting = false)¶
-
struct CallSendDtmfParam
- #include <call.hpp>
This structure contains parameters for Call::sendDtmf()
Public Functions
-
CallSendDtmfParam()¶
Default constructor initialize with default value.
-
pjsua_call_send_dtmf_param toPj() const¶
Convert to pjsip.
-
void fromPj(const pjsua_call_send_dtmf_param ¶m)¶
Convert from pjsip.
Public Members
-
pjsua_dtmf_method method¶
The method used to send DTMF.
Default: PJSUA_DTMF_METHOD_RFC2833
-
unsigned duration¶
The signal duration used for the DTMF.
Default: PJSUA_CALL_SEND_DTMF_DURATION_DEFAULT
-
string digits¶
The DTMF digits to be sent.
-
CallSendDtmfParam()¶
-
struct CallSendRequestParam
- #include <call.hpp>
This structure contains parameters for Call::sendRequest()
Public Functions
-
CallSendRequestParam()¶
Default constructor initializes with zero/empty values.
Public Members
-
string method¶
SIP method of the request.
-
SipTxOption txOption¶
Message body and/or list of headers etc to be included in outgoing request.
-
CallSendRequestParam()¶
-
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
-
CallSetting(bool useDefaultValues = false)¶
-
struct CallVidSetStreamParam
- #include <call.hpp>
This structure contains parameters for Call::vidSetStream()
Public Functions
-
CallVidSetStreamParam()¶
Default constructor
Public Members
-
int medIdx¶
Specify the media stream index. This can be set to -1 to denote the default video stream in the call, which is the first active video stream or any first video stream if none is active.
This field is valid for all video stream operations, except PJSUA_CALL_VID_STRM_ADD.
Default: -1 (first active video stream, or any first video stream if none is active)
-
pjmedia_dir dir¶
Specify the media stream direction.
This field is valid for the following video stream operations: PJSUA_CALL_VID_STRM_ADD and PJSUA_CALL_VID_STRM_CHANGE_DIR.
Default: PJMEDIA_DIR_ENCODING_DECODING
-
pjmedia_vid_dev_index capDev¶
Specify the video capture device ID. This can be set to PJMEDIA_VID_DEFAULT_CAPTURE_DEV to specify the default capture device as configured in the account.
This field is valid for the following video stream operations: PJSUA_CALL_VID_STRM_ADD and PJSUA_CALL_VID_STRM_CHANGE_CAP_DEV.
Default: PJMEDIA_VID_DEFAULT_CAPTURE_DEV.
-
CallVidSetStreamParam()¶
-
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.
-
void fromPj(const pjmedia_jb_state &prm)¶
-
struct LossType
- #include <call.hpp>
Types of loss detected.
-
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
-
MathStat()¶
-
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.
-
void fromPj(const pjmedia_transport_info &info)¶
-
struct OnCallMediaEventParam
- #include <call.hpp>
This structure contains parameters for Call::onCallMediaEvent() callback.
-
struct OnCallMediaStateParam
- #include <call.hpp>
This structure contains parameters for Call::onCallMediaState() callback.
-
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.
-
unsigned medIdx¶
-
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.
-
string targetUri¶
-
struct OnCallReplacedParam
- #include <call.hpp>
This structure contains parameters for Call::onCallReplaced() callback.
Public Members
-
pjsua_call_id newCallId¶
The new call id.
-
pjsua_call_id newCallId¶
-
struct OnCallReplaceRequestParam
- #include <call.hpp>
This structure contains parameters for Call::onCallReplaceRequest() callback.
Public Members
-
pjsip_status_code statusCode¶
Status code to be set by application. Application should only return a final status (200-699)
-
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.
-
pjsip_status_code statusCode¶
-
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 200. Currently, valid values are only 200 and 488.
-
CallSetting opt¶
The current call setting, application can update this setting for answering the offer.
-
SdpSession offer¶
-
struct OnCallRxReinviteParam
- #include <call.hpp>
This structure contains parameters for Call::onCallRxReinvite() callback.
Public Members
-
SdpSession offer¶
The new offer received.
-
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 200. Currently, valid values are only 200 and 488.
-
CallSetting opt¶
The current call setting, application can update this setting for answering the offer.
-
SdpSession offer¶
-
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.
-
SdpSession sdp¶
-
struct OnCallStateParam
- #include <call.hpp>
This structure contains parameters for Call::onCallState() callback.
-
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.
-
string dstUri¶
-
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).
-
pjsip_status_code statusCode¶
-
struct OnCallTsxStateParam
- #include <call.hpp>
This structure contains parameters for Call::onCallTsxState() callback.
-
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.
-
CallSetting opt¶
-
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.
-
unsigned mediaIdx¶
-
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.
-
unsigned mediaIdx¶
-
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.
-
pjsua_dtmf_method method¶
-
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.
-
pjsua_dtmf_method method¶
-
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 PJ_TRUE, pjmedia_port_destroy() will be called on the port when it is no longer needed.
Default: PJ_FALSE
-
MediaStream stream¶
-
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.
-
MediaStream stream¶
-
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.
-
unsigned streamIdx¶
-
struct RtcpSdes
- #include <call.hpp>
RTCP SDES structure.
Public Functions
-
void fromPj(const pjmedia_rtcp_sdes &prm)¶
Convert from pjsip
-
void fromPj(const pjmedia_rtcp_sdes &prm)¶
-
struct RtcpStat
- #include <call.hpp>
Bidirectional RTP stream statistics.
Public Functions
-
void fromPj(const pjmedia_rtcp_stat &prm)¶
Convert from pjsip
Public Members
-
RtcpStreamStat txStat¶
Encoder stream statistics.
-
RtcpStreamStat rxStat¶
Decoder stream statistics.
-
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.
-
void fromPj(const pjmedia_rtcp_stat &prm)¶
-
struct RtcpStreamStat
- #include <call.hpp>
Unidirectional RTP stream statistics.
Public Functions
-
void fromPj(const pjmedia_rtcp_stream_stat &prm)¶
Convert from pjsip
Public Members
-
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
-
void fromPj(const pjmedia_rtcp_stream_stat &prm)¶
-
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.
-
void fromPj(const pjmedia_sdp_session &sdp)¶
-
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.
-
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 useKa¶
Stream keep-alive and NAT hole punch (see #PJMEDIA_STREAM_ENABLE_KA) is enabled?
-
bool rtcpSdesByeDisabled¶
Disable automatic sending of RTCP SDES and BYE.
-
inline StreamInfo()¶
-
struct StreamStat
- #include <call.hpp>
Media stream statistic.
Public Functions
-
void fromPj(const pjsua_stream_stat &prm)¶
Convert from pjsip
-
void fromPj(const pjsua_stream_stat &prm)¶
-
typedef void *MediaTransport¶
presence.hpp¶
PJSUA2 Presence Operations.
-
namespace pj
PJSUA2 API is inside pj namespace
Typedefs
-
class Buddy
- #include <presence.hpp>
Buddy. This is a lite wrapper class for PJSUA-LIB buddy, i.e: this class only maintains one data member, PJSUA-LIB buddy ID, and the methods are simply proxies for PJSUA-LIB buddy operations.
Application can use create() to register a buddy to PJSUA-LIB, and the destructor of the original instance (i.e: the instance that calls create()) will unregister and delete the buddy from PJSUA-LIB. Application must delete all Buddy instances belong to an account before shutting down the account (via Account::shutdown()).
The library will not keep a list of Buddy instances, so any Buddy (or descendant) instances instantiated by application must be maintained and destroyed by the application itself. Any PJSUA2 APIs that return Buddy instance(s) such as Account::enumBuddies2() or Account::findBuddy2() will just return generated copy. All Buddy methods should work normally on this generated copy instance.
Public Functions
-
Buddy()¶
Constructor.
-
virtual ~Buddy()¶
Destructor. Note that if the Buddy original instance (i.e: the instance that calls Buddy::create()) is destroyed, it will also delete the corresponding buddy in the PJSUA-LIB. While the destructor of a generated copy (i.e: Buddy instance returned by PJSUA2 APIs such as Account::enumBuddies2() or Account::findBuddy2()) will do nothing.
- void create (Account &acc, const BuddyConfig &cfg) PJSUA2_THROW(Error)
Create buddy and register the buddy to PJSUA-LIB.
Note that application should maintain the Buddy original instance, i.e: the instance that calls this create() method as it is only the original instance destructor that will delete the underlying Buddy in PJSUA-LIB.
- Parameters
acc – The account for this buddy.
cfg – The buddy config.
-
bool isValid() const¶
Check if this buddy is valid.
- Returns
True if it is.
-
int getId() const¶
Get PJSUA-LIB buddy ID or index associated with this buddy.
- Returns
Integer greater than or equal to zero.
- BuddyInfo getInfo () const PJSUA2_THROW(Error)
Get detailed buddy info.
- Returns
Buddy info.
- void subscribePresence (bool subscribe) PJSUA2_THROW(Error)
Enable/disable buddy’s presence monitoring. Once buddy’s presence is subscribed, application will be informed about buddy’s presence status changed via onBuddyState() callback.
- Parameters
subscribe – Specify true to activate presence subscription.
- void updatePresence (void) PJSUA2_THROW(Error)
Update the presence information for the buddy. Although the library periodically refreshes the presence subscription for all buddies, some application may want to refresh the buddy’s presence subscription immediately, and in this case it can use this function to accomplish this.
Note that the buddy’s presence subscription will only be initiated if presence monitoring is enabled for the buddy. See subscribePresence() for more info. Also if presence subscription for the buddy is already active, this function will not do anything.
Once the presence subscription is activated successfully for the buddy, application will be notified about the buddy’s presence status in the onBuddyState() callback.
- void sendInstantMessage (const SendInstantMessageParam &prm) PJSUA2_THROW(Error)
Send instant messaging outside dialog, using this buddy’s specified account for route set and authentication.
- Parameters
prm – Sending instant message parameter.
- void sendTypingIndication (const SendTypingIndicationParam &prm) PJSUA2_THROW(Error)
Send typing indication outside dialog.
- Parameters
prm – Sending instant message parameter.
-
inline virtual void onBuddyState()¶
Notify application when the buddy state has changed. Application may then query the buddy info to get the details.
-
inline virtual void onBuddyEvSubState(OnBuddyEvSubStateParam &prm)¶
Notify application when the state of client subscription session associated with a buddy has changed. Application may use this callback to retrieve more detailed information about the state changed event.
- Parameters
prm – Callback parameter.
Private Members
-
pjsua_buddy_id id¶
Buddy ID.
Friends
- friend class Endpoint
- friend class Account
-
Buddy()¶
-
struct BuddyConfig : public pj::PersistentObject
- #include <presence.hpp>
This structure describes buddy configuration when adding a buddy to the buddy list with Buddy::create().
Public Functions
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
Write this object to a container node.
- Parameters
node – Container to write values to.
-
struct BuddyInfo
- #include <presence.hpp>
This structure describes buddy info, which can be retrieved by via Buddy::getInfo().
Public Functions
-
inline BuddyInfo()¶
Default constructor
-
void fromPj(const pjsua_buddy_info &pbi)¶
Import from pjsip structure
Public Members
-
string uri¶
The full URI of the buddy, as specified in the configuration.
-
string contact¶
Buddy’s Contact, only available when presence subscription has been established to the buddy.
-
bool presMonitorEnabled¶
Flag to indicate that we should monitor the presence information for this buddy (normally yes, unless explicitly disabled).
-
pjsip_evsub_state subState¶
If presMonitorEnabled is true, this specifies the last state of the presence subscription. If presence subscription session is currently active, the value will be PJSIP_EVSUB_STATE_ACTIVE. If presence subscription request has been rejected, the value will be PJSIP_EVSUB_STATE_TERMINATED, and the termination reason will be specified in subTermReason.
-
string subStateName¶
String representation of subscription state.
-
pjsip_status_code subTermCode¶
Specifies the last presence subscription termination code. This would return the last status of the SUBSCRIBE request. If the subscription is terminated with NOTIFY by the server, this value will be set to 200, and subscription termination reason will be given in the subTermReason field.
-
string subTermReason¶
Specifies the last presence subscription termination reason. If presence subscription is currently active, the value will be empty.
-
PresenceStatus presStatus¶
Presence status.
-
inline BuddyInfo()¶
-
struct OnBuddyEvSubStateParam
- #include <presence.hpp>
This structure contains parameters for Buddy::onBuddyEvSubState() callback.
-
struct PresenceStatus
- #include <presence.hpp>
This describes presence status.
Public Functions
-
PresenceStatus()¶
Constructor.
Public Members
-
pjsua_buddy_status status¶
Buddy’s online status.
-
string statusText¶
Text to describe buddy’s online status.
-
pjrpid_activity activity¶
Activity type.
-
string note¶
Optional text describing the person/element.
-
string rpidId¶
Optional RPID ID string.
-
PresenceStatus()¶
-
class Buddy
persistent.hpp¶
PJSUA2 Persistent Services.
-
namespace pj
PJSUA2 API is inside pj namespace
-
struct container_node_internal_data
- #include <persistent.hpp>
Internal data for ContainerNode. See ContainerNode implementation notes for more info.
-
class ContainerNode
- #include <persistent.hpp>
A container node is a placeholder for storing other data elements, which could be boolean, number, string, array of strings, or another container. Each data in the container is basically a name/value pair, with a type internally associated with it so that written data can be read in the correct type. Data is read and written serially, hence the order of reading must be the same as the order of writing.
Application can read data from it by using the various read methods, and write data to it using the various write methods. Alternatively, it may be more convenient to use the provided macros below to read and write the data, because these macros set the name automatically:
NODE_READ_BOOL(node,item)
NODE_READ_UNSIGNED(node,item)
NODE_READ_INT(node,item)
NODE_READ_FLOAT(node,item)
NODE_READ_NUM_T(node,type,item)
NODE_READ_STRING(node,item)
NODE_READ_STRINGV(node,item)
NODE_READ_OBJ(node,item)
NODE_WRITE_BOOL(node,item)
NODE_WRITE_UNSIGNED(node,item)
NODE_WRITE_INT(node,item)
NODE_WRITE_FLOAT(node,item)
NODE_WRITE_NUM_T(node,type,item)
NODE_WRITE_STRING(node,item)
NODE_WRITE_STRINGV(node,item)
NODE_WRITE_OBJ(node,item)
Implementation notes:
The ContainerNode class is subclass-able, but not in the usual C++ way. With the usual C++ inheritance, some methods will be made pure virtual and must be implemented by the actual class. However, doing so will require dynamic instantiation of the ContainerNode class, which means we will need to pass around the class as pointer, for example as the return value of readContainer() and writeNewContainer() methods. Then we will need to establish who needs or how to delete these objects, or use shared pointer mechanism, each of which is considered too inconvenient or complicated for the purpose.
So hence we use C style “inheritance”, where the methods are declared in container_node_op and the data in container_node_internal_data structures. An implementation of ContainerNode class will need to set up these members with values that makes sense to itself. The methods in container_node_op contains the pointer to the actual implementation of the operation, which would be specific according to the format of the document. The methods in this ContainerNode class are just thin wrappers which call the implementation in the container_node_op structure.
Public Functions
-
bool hasUnread() const¶
Determine if there is unread element. If yes, then app can use one of the readXxx() functions to read it.
- string unreadName () const PJSUA2_THROW(Error)
Get the name of the next unread element.
- int readInt (const string &name="") const PJSUA2_THROW(Error)
Read an integer value from the document and return the value. This will throw Error if the current element is not a number. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
The value.
- float readNumber (const string &name="") const PJSUA2_THROW(Error)
Read a number value from the document and return the value. This will throw Error if the current element is not a number. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
The value.
- bool readBool (const string &name="") const PJSUA2_THROW(Error)
Read a boolean value from the container and return the value. This will throw Error if the current element is not a boolean. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
The value.
- string readString (const string &name="") const PJSUA2_THROW(Error)
Read a string value from the container and return the value. This will throw Error if the current element is not a string. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
The value.
- StringVector readStringVector (const string &name="") const PJSUA2_THROW(Error)
Read a string array from the container. This will throw Error if the current element is not a string array. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
The value.
- void readObject (PersistentObject &obj) const PJSUA2_THROW(Error)
Read the specified object from the container. This is equal to calling PersistentObject.readObject(ContainerNode);
- Parameters
obj – The object to read.
- ContainerNode readContainer (const string &name="") const PJSUA2_THROW(Error)
Read a container from the container. This will throw Error if the current element is not a container. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
Container object.
- ContainerNode readArray (const string &name="") const PJSUA2_THROW(Error)
Read array container from the container. This will throw Error if the current element is not an array. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
Container object.
- void writeNumber (const string &name, float num) PJSUA2_THROW(Error)
Write a number value to the container.
- Parameters
name – The name for the value in the container.
num – The value to be written.
- void writeInt (const string &name, int num) PJSUA2_THROW(Error)
Write a number value to the container.
- Parameters
name – The name for the value in the container.
num – The value to be written.
- void writeBool (const string &name, bool value) PJSUA2_THROW(Error)
Write a boolean value to the container.
- Parameters
name – The name for the value in the container.
value – The value to be written.
- void writeString (const string &name, const string &value) PJSUA2_THROW(Error)
Write a string value to the container.
- Parameters
name – The name for the value in the container.
value – The value to be written.
- void writeStringVector (const string &name, const StringVector &arr) PJSUA2_THROW(Error)
Write string vector to the container.
- Parameters
name – The name for the value in the container.
arr – The vector to be written.
- void writeObject (const PersistentObject &obj) PJSUA2_THROW(Error)
Write an object to the container. This is equal to calling PersistentObject.writeObject(ContainerNode);
- Parameters
obj – The object to be written
- ContainerNode writeNewContainer (const string &name) PJSUA2_THROW(Error)
Create and write an empty Object node that can be used as parent for subsequent write operations.
- Parameters
name – The name for the new container in the container.
- Returns
A sub-container.
- ContainerNode writeNewArray (const string &name) PJSUA2_THROW(Error)
Create and write an empty array node that can be used as parent for subsequent write operations.
- Parameters
name – The name for the array.
- Returns
A sub-container.
Public Members
-
container_node_op *op¶
Method table.
-
container_node_internal_data data¶
Internal data
-
class PersistentDocument
- #include <persistent.hpp>
This a the abstract base class for a persistent document. A document is created either by loading from a string or a file, or by constructing it manually when writing data to it. The document then can be saved to either string or to a file. A document contains one root ContainerNode where all data are stored under.
Document is read and written serially, hence the order of reading must be the same as the order of writing. The PersistentDocument class provides API to read and write to the root node, but for more flexible operations application can use the ContainerNode methods instead. Indeed the read and write API in PersistentDocument is just a shorthand which calls the relevant methods in the ContainerNode. As a tip, normally application only uses the readObject() and writeObject() methods declared here to read/write top level objects, and use the macros that are explained in ContainerNode documentation to read/write more detailed data.
Subclassed by pj::JsonDocument
Public Functions
-
inline virtual ~PersistentDocument()¶
Virtual destructor
- virtual void loadFile (const string &filename) PJSUA2_THROW(Error)=0
Load this document from a file.
- Parameters
filename – The file name.
- virtual void loadString (const string &input) PJSUA2_THROW(Error)=0
Load this document from string.
- Parameters
input – The string.
- virtual void saveFile (const string &filename) PJSUA2_THROW(Error)=0
Write this document to a file.
- Parameters
filename – The file name.
- virtual string saveString () PJSUA2_THROW(Error)=0
Write this document to string.
- Returns
The string document.
-
virtual ContainerNode &getRootContainer() const = 0¶
Get the root container node for this document
- Returns
The root node.
-
bool hasUnread() const¶
Determine if there is unread element. If yes, then app can use one of the readXxx() functions to read it.
- Returns
True if there is.
- string unreadName () const PJSUA2_THROW(Error)
Get the name of the next unread element. It will throw Error if there is no more element to read.
- Returns
The name of the next element .
- int readInt (const string &name="") const PJSUA2_THROW(Error)
Read an integer value from the document and return the value. This will throw Error if the current element is not a number. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
The value.
- float readNumber (const string &name="") const PJSUA2_THROW(Error)
Read a float value from the document and return the value. This will throw Error if the current element is not a number. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
The value.
- bool readBool (const string &name="") const PJSUA2_THROW(Error)
Read a boolean value from the container and return the value. This will throw Error if the current element is not a boolean. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
The value.
- string readString (const string &name="") const PJSUA2_THROW(Error)
Read a string value from the container and return the value. This will throw Error if the current element is not a string. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
The value.
- StringVector readStringVector (const string &name="") const PJSUA2_THROW(Error)
Read a string array from the container. This will throw Error if the current element is not a string array. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
The value.
- void readObject (PersistentObject &obj) const PJSUA2_THROW(Error)
Read the specified object from the container. This is equal to calling PersistentObject.readObject(ContainerNode);
- Parameters
obj – The object to read.
- ContainerNode readContainer (const string &name="") const PJSUA2_THROW(Error)
Read a container from the container. This will throw Error if the current element is not an object. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
Container object.
- ContainerNode readArray (const string &name="") const PJSUA2_THROW(Error)
Read array container from the container. This will throw Error if the current element is not an array. The read position will be advanced to the next element.
- Parameters
name – If specified, then the function will check if the name of the next element matches the specified name and throw Error if it doesn’t match.
- Returns
Container object.
- void writeNumber (const string &name, float num) PJSUA2_THROW(Error)
Write a number value to the container.
- Parameters
name – The name for the value in the container.
num – The value to be written.
- void writeInt (const string &name, int num) PJSUA2_THROW(Error)
Write a number value to the container.
- Parameters
name – The name for the value in the container.
num – The value to be written.
- void writeBool (const string &name, bool value) PJSUA2_THROW(Error)
Write a boolean value to the container.
- Parameters
name – The name for the value in the container.
value – The value to be written.
- void writeString (const string &name, const string &value) PJSUA2_THROW(Error)
Write a string value to the container.
- Parameters
name – The name for the value in the container.
value – The value to be written.
- void writeStringVector (const string &name, const StringVector &arr) PJSUA2_THROW(Error)
Write string vector to the container.
- Parameters
name – The name for the value in the container.
arr – The vector to be written.
- void writeObject (const PersistentObject &obj) PJSUA2_THROW(Error)
Write an object to the container. This is equal to calling PersistentObject.writeObject(ContainerNode);
- Parameters
obj – The object to be written
- ContainerNode writeNewContainer (const string &name) PJSUA2_THROW(Error)
Create and write an empty Object node that can be used as parent for subsequent write operations.
- Parameters
name – The name for the new container in the container.
- Returns
A sub-container.
- ContainerNode writeNewArray (const string &name) PJSUA2_THROW(Error)
Create and write an empty array node that can be used as parent for subsequent write operations.
- Parameters
name – The name for the array.
- Returns
A sub-container.
-
inline virtual ~PersistentDocument()¶
-
class PersistentObject
- #include <persistent.hpp>
This is the abstract base class of objects that can be serialized to/from persistent document.
Subclassed by pj::AccountCallConfig, pj::AccountConfig, pj::AccountMediaConfig, pj::AccountMwiConfig, pj::AccountNatConfig, pj::AccountPresConfig, pj::AccountRegConfig, pj::AccountSipConfig, pj::AccountVideoConfig, pj::AuthCredInfo, pj::BuddyConfig, pj::EpConfig, pj::LogConfig, pj::MediaConfig, pj::RtcpFbConfig, pj::SrtpOpt, pj::TlsConfig, pj::TransportConfig, pj::UaConfig
Public Functions
-
inline virtual ~PersistentObject()¶
Virtual destructor
- virtual void readObject (const ContainerNode &node) PJSUA2_THROW(Error)=0
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)=0
Write this object to a container node.
- Parameters
node – Container to write values to.
-
inline virtual ~PersistentObject()¶
-
struct container_node_internal_data
json.hpp¶
-
namespace pj
PJSUA2 API is inside pj namespace
-
class JsonDocument : public pj::PersistentDocument
- #include <json.hpp>
Persistent document (file) with JSON format.
Public Functions
-
JsonDocument()¶
Default constructor
-
~JsonDocument()¶
Destructor
- virtual void loadFile (const string &filename) PJSUA2_THROW(Error)
Load this document from a file.
- Parameters
filename – The file name.
- virtual void loadString (const string &input) PJSUA2_THROW(Error)
Load this document from string.
- Parameters
input – The string.
- virtual void saveFile (const string &filename) PJSUA2_THROW(Error)
Write this document to a file.
- Parameters
filename – The file name.
- virtual string saveString () PJSUA2_THROW(Error)
Write this document to string.
-
virtual ContainerNode &getRootContainer() const¶
Get the root container node for this document
-
pj_json_elem *allocElement() const¶
An internal function to create JSON element.
Private Functions
-
void initRoot() const¶
-
JsonDocument()¶
-
class JsonDocument : public pj::PersistentDocument
siptypes.hpp¶
-
namespace pj
PJSUA2 API is inside pj namespace
Typedefs
-
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) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
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.
-
string akaK¶
Permanent subscriber key.
-
string akaOp¶
Operator variant key.
-
string akaAmf¶
Authentication Management Field
-
AuthCredInfo()¶
-
struct RxMsgEvent
- #include <siptypes.hpp>
This structure describes message arrival event.
-
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.
-
SendInstantMessageParam()¶
-
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.
-
SendTypingIndicationParam()¶
-
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.
-
SipEvent()¶
-
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.
-
TimerEvent timer¶
-
struct SipHeader
- #include <siptypes.hpp>
Simple SIP header.
Public Functions
- void fromPj (const pjsip_hdr *) PJSUA2_THROW(Error)
Initiaize from PJSIP header.
-
pjsip_generic_string_hdr &toPj() const¶
Convert to PJSIP header.
Private Members
-
mutable pjsip_generic_string_hdr pjHdr¶
Interal buffer for conversion to PJSIP header
-
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.
-
void fromPj(const pjsip_media_type &prm)¶
-
struct SipMultipartPart
- #include <siptypes.hpp>
This describes each multipart part.
Public Functions
- void fromPj (const pjsip_multipart_part &prm) PJSUA2_THROW(Error)
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.
Private Members
-
mutable pjsip_multipart_part pjMpp¶
Interal buffer for conversion to PJSIP pjsip_multipart_part
-
mutable pjsip_msg_body pjMsgBody¶
-
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.
-
SipRxData()¶
-
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
-
SipTransaction()¶
-
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.
-
SipTxData()¶
-
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) PJSUA2_THROW(Error)
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.
-
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.
-
bool isEmpty() const¶
-
struct TimerEvent
- #include <siptypes.hpp>
This structure describes timer event.
Public Members
-
TimerEntry entry¶
The timer entry.
-
TimerEntry entry¶
-
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) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
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.
-
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
-
TlsConfig()¶
-
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) PJSUA2_THROW(Error)
Read this object from a container node.
- Parameters
node – Container to read values from.
- virtual void writeObject (ContainerNode &node) const PJSUA2_THROW(Error)
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 when the start port number is non zero.
Example: port=5000, portRange=4
Available ports: 5000, 5001, 5002, 5003, 5004 (SIP transport)
Available ports are in the range of [port, port + portRange].
Default value is zero.
-
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 is only be used when this transport config is being used to create 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.
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.
Default is QoS not set.
-
TransportConfig()¶
-
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.
-
TransportInfo()¶
-
struct TsxStateEvent
- #include <siptypes.hpp>
This structure describes transaction state changed event.
Public Functions
-
TsxStateEvent()¶
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
-
TsxStateEvent()¶
-
struct TsxStateEventSrc
- #include <siptypes.hpp>
This structure describes transaction state event source.
Public Functions
-
inline TsxStateEventSrc()¶
Public Members
-
TimerEntry timer¶
The timer.
-
pj_status_t status¶
Transport error status.
-
GenericData data¶
Generic data.
-
inline TsxStateEventSrc()¶
-
struct TxErrorEvent
- #include <siptypes.hpp>
This structure describes transmission error event.
-
struct TxMsgEvent
- #include <siptypes.hpp>
This structure describes message transmission event.
-
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.
-
GenericData user1¶
-
typedef std::vector<SipMultipartPart> SipMultipartPartVector¶
types.hpp¶
PJSUA2 Base Types.
Defines
-
PJSUA2_RAISE_ERROR(status)
Raise Error exception
-
PJSUA2_RAISE_ERROR2(status, op)
Raise Error exception
-
PJSUA2_RAISE_ERROR3(status, op, txt)
Raise Error exception
-
PJSUA2_CHECK_RAISE_ERROR2(status, op)
Raise Error exception if the expression fails
-
PJSUA2_CHECK_RAISE_ERROR(status)
Raise Error exception if the status fails
-
PJSUA2_CHECK_EXPR(expr)
Raise Error exception if the expression fails
-
namespace pj
PJSUA2 API is inside pj namespace
Typedefs
-
typedef std::vector<std::string> StringVector¶
Array of strings
-
typedef std::vector<int> IntVector¶
Array of integers
-
typedef std::map<std::string, std::string> StringToStringMap¶
Map string to string
-
typedef void *Token¶
Type of token, i.e. arbitrary application user data
-
typedef string SocketAddress¶
Socket address, encoded as string. The socket address contains host and port number in “host[:port]” format. The host part may contain hostname, domain name, IPv4 or IPv6 address. For IPv6 address, the address will be enclosed with square brackets, e.g. “[::1]:5060”.
-
typedef int TransportId¶
Transport ID is an integer.
-
typedef void *TransportHandle¶
Transport handle, corresponds to pjsip_transport instance.
-
typedef void *TimerEntry¶
Timer entry, corresponds to pj_timer_entry
-
typedef void *GenericData¶
Generic data
Enums
-
struct Error
- #include <types.hpp>
This structure contains information about an error that is thrown as an exception.
Public Functions
-
string info(bool multi_line = false) const¶
Build error string.
-
Error()¶
Default constructor
-
Error(pj_status_t prm_status, const string &prm_title, const string &prm_reason, const string &prm_src_file, int prm_src_line)¶
Construct an Error instance from the specified parameters. If prm_reason is empty, it will be filled with the error description for the status code.
-
string info(bool multi_line = false) const¶
-
struct TimeVal
- #include <types.hpp>
Representation of time value.
Public Functions
-
void fromPj(const pj_time_val &prm)¶
Convert from pjsip
-
void fromPj(const pj_time_val &prm)¶
-
struct Version
- #include <types.hpp>
Version information.
Public Members
-
int major¶
Major number
-
int minor¶
Minor number
-
int rev¶
Additional revision number
-
string full¶
The full version info (e.g. “2.1.0-svn”)
-
unsigned numeric¶
PJLIB version number as three bytes with the following format: 0xMMIIRR00, where MM: major number, II: minor number, RR: revision number, 00: always zero for now.
-
int major¶
-
typedef std::vector<std::string> StringVector¶
config.hpp¶
PJSUA2 Base Agent Operation.
Defines
-
PJSUA2_ERROR_HAS_EXTRA_INFO
Specify if the Error exception info should contain operation and source file information.
-
PJSUA2_MAX_SDP_BUF_LEN
Maximum buffer length to print SDP content for SdpSession. Set this to 0 if the printed SDP is not needed.
-
DEPRECATED_FOR_TICKET_2232
Ticket #2189 described some lists of objects which is not thread safe. The ticket deprecated some APIs which uses those lists and introduce new one to replace them. This settings will disable the deprecated API all together. See also https://trac.pjsip.org/repos/ticket/2232
-
PJSUA2_THROW(x)