BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJSIP Reference

#include <pjsua.h>

Data Fields

unsigned max_calls
 
unsigned thread_cnt
 
unsigned nameserver_count
 
pj_str_t nameserver [4]
 
pj_bool_t force_lr
 
unsigned outbound_proxy_cnt
 
pj_str_t outbound_proxy [4]
 
pj_str_t stun_domain
 
pj_str_t stun_host
 
unsigned stun_srv_cnt
 
pj_str_t stun_srv [8]
 
pj_bool_t stun_try_ipv6
 
pj_bool_t stun_ignore_failure
 
pj_bool_t stun_map_use_stun2
 
int nat_type_in_sdp
 
pjsua_100rel_use require_100rel
 
pjsua_sip_timer_use use_timer
 
pj_bool_t enable_unsolicited_mwi
 
pjsip_timer_setting timer_setting
 
unsigned cred_count
 
pjsip_cred_info cred_info [8]
 
pjsua_callback cb
 
pj_str_t user_agent
 
pjmedia_srtp_use use_srtp
 
int srtp_secure_signaling
 
pj_bool_t srtp_optional_dup_offer
 
pjsua_srtp_opt srtp_opt
 
pj_bool_t hangup_forked_call
 

Detailed Description

This structure describes the settings to control the API and user agent behavior, and can be specified when calling pjsua_init(). Before setting the values, application must call pjsua_config_default() to initialize this structure with the default values.

Field Documentation

unsigned pjsua_config::max_calls

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 pjsua_config::thread_cnt

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.

unsigned pjsua_config::nameserver_count

Number of nameservers. If no name server is configured, the SIP SRV resolution would be disabled, and domain will be resolved with standard pj_gethostbyname() function.

pj_str_t pjsua_config::nameserver[4]

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).

pj_bool_t pjsua_config::force_lr

Force loose-route to be used in all route/proxy URIs (outbound_proxy and account's proxy settings). When this setting is enabled, the library will check all the route/proxy URIs specified in the settings and append ";lr" parameter to the URI if the parameter is not present.

Default: 1

unsigned pjsua_config::outbound_proxy_cnt

Number of outbound proxies in the outbound_proxy array.

pj_str_t pjsua_config::outbound_proxy[4]

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.

pj_str_t pjsua_config::stun_domain

Warning: deprecated, please use stun_srv field instead. To maintain backward compatibility, if stun_srv_cnt is zero then the value of this field will be copied to stun_srv field, if present.

Specify domain name to be resolved with DNS SRV resolution to get the address of the STUN server. Alternatively application may specify stun_host instead.

If DNS SRV resolution failed for this domain, then DNS A resolution will be performed only if stun_host is specified.

pj_str_t pjsua_config::stun_host

Warning: deprecated, please use stun_srv field instead. To maintain backward compatibility, if stun_srv_cnt is zero then the value of this field will be copied to stun_srv field, if present.

Specify STUN server to be used, in "HOST[:PORT]" format. If port is not specified, default port 3478 will be used.

unsigned pjsua_config::stun_srv_cnt

Number of STUN server entries in stun_srv array.

pj_str_t pjsua_config::stun_srv[8]

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.

pj_bool_t pjsua_config::stun_try_ipv6

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: PJ_FALSE

pj_bool_t pjsua_config::stun_ignore_failure

This specifies if the library 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.

This setting will also determine what happens if STUN servers are unavailable during runtime (if set to PJ_FALSE, calls will directly fail, otherwise (if PJ_TRUE) call medias will fallback to proceed as though not using STUN servers.

Default: PJ_TRUE

pj_bool_t pjsua_config::stun_map_use_stun2

This specifies whether STUN requests for resolving socket mapped address should use the new format, i.e: having STUN magic cookie in its transaction ID.

Default: PJ_FALSE

int pjsua_config::nat_type_in_sdp

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

pjsua_100rel_use pjsua_config::require_100rel

Specify how the support for reliable provisional response (100rel/ PRACK) should be used by default. Note that this setting can be further customized in account configuration (pjsua_acc_config).

Default: PJSUA_100REL_NOT_USED

pjsua_sip_timer_use pjsua_config::use_timer

Specify the usage of Session Timers for all sessions. See the pjsua_sip_timer_use for possible values. Note that this setting can be further customized in account configuration (pjsua_acc_config).

Default: PJSUA_SIP_TIMER_OPTIONAL

pj_bool_t pjsua_config::enable_unsolicited_mwi

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 on_mwi_info() callback.

See also mwi_enabled field #on pjsua_acc_config.

Default: PJ_TRUE

pjsip_timer_setting pjsua_config::timer_setting

Specify Session Timer settings, see pjsip_timer_setting. Note that this setting can be further customized in account configuration (pjsua_acc_config).

unsigned pjsua_config::cred_count

Number of credentials in the credential array.

pjsip_cred_info pjsua_config::cred_info[8]

Array of credentials. These credentials will be used by all accounts, and can be used to authenticate against outbound proxies. If the credential is specific to the account, then application should set the credential in the pjsua_acc_config rather than the credential here.

pjsua_callback pjsua_config::cb

Application callback to receive various event notifications from the library.

pj_str_t pjsua_config::user_agent

Optional user agent string (default empty). If it's empty, no User-Agent header will be sent with outgoing requests.

pjmedia_srtp_use pjsua_config::use_srtp

Specify default value of secure media transport usage. Valid values are PJMEDIA_SRTP_DISABLED, PJMEDIA_SRTP_OPTIONAL, and PJMEDIA_SRTP_MANDATORY.

Note that this setting can be further customized in account configuration (pjsua_acc_config).

Default: PJSUA_DEFAULT_USE_SRTP

int pjsua_config::srtp_secure_signaling

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)

Note that this setting can be further customized in account configuration (pjsua_acc_config).

Default: PJSUA_DEFAULT_SRTP_SECURE_SIGNALING

pj_bool_t pjsua_config::srtp_optional_dup_offer

This setting has been deprecated and will be ignored.

pjsua_srtp_opt pjsua_config::srtp_opt

Specify SRTP transport setting. Application can initialize it with default values using pjsua_srtp_opt_default().

pj_bool_t pjsua_config::hangup_forked_call

Disconnect other call legs when more than one 2xx responses for outgoing INVITE are received due to forking. Currently the library is not able to handle simultaneous forked media, so disconnecting the other call legs is necessary.

With this setting enabled, the library will handle only one of the connected call leg, and the other connected call legs will be disconnected.

Default: PJ_TRUE (only disable this setting for testing purposes).


The documentation for this struct was generated from the following file:
  • pjsua-lib/pjsua.h

 


PJSIP Open Source, high performance, small footprint, and very very portable SIP stack
Copyright (C) 2006-2008 Teluu Inc.