WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJSIP Reference

PJSUA Accounts management. More...

Data Structures

struct  pjsua_ice_config
 
struct  pjsua_turn_config
 
struct  pjsua_acc_config
 
struct  pjsua_acc_info
 

Macros

#define PJSUA_MAX_ACC   8
 
#define PJSUA_REG_INTERVAL   300
 
#define PJSUA_UNREG_TIMEOUT   4000
 
#define PJSUA_PUBLISH_EXPIRATION   PJSIP_PUBC_EXPIRATION_NOT_SPECIFIED
 
#define PJSUA_DEFAULT_ACC_PRIORITY   0
 
#define PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC   2000
 
#define PJSUA_REG_RETRY_INTERVAL   300
 
#define PJSUA_REG_AUTO_REG_REFRESH   1
 
#define PJSUA_CONTACT_REWRITE_METHOD
 
#define PJSUA_REG_USE_OUTBOUND_PROXY   1
 
#define PJSUA_REG_USE_ACC_PROXY   2
 
#define PJSUA_CALL_HOLD_TYPE_DEFAULT   PJSUA_CALL_HOLD_TYPE_RFC3264
 

Enumerations

enum  pjsua_call_hold_type { PJSUA_CALL_HOLD_TYPE_RFC3264 , PJSUA_CALL_HOLD_TYPE_RFC2543 }
 
enum  pjsua_stun_use { PJSUA_STUN_USE_DEFAULT , PJSUA_STUN_USE_DISABLED , PJSUA_STUN_RETRY_ON_FAILURE }
 
enum  pjsua_upnp_use { PJSUA_UPNP_USE_DEFAULT , PJSUA_UPNP_USE_DISABLED }
 
enum  pjsua_ice_config_use { PJSUA_ICE_CONFIG_USE_DEFAULT , PJSUA_ICE_CONFIG_USE_CUSTOM }
 
enum  pjsua_turn_config_use { PJSUA_TURN_CONFIG_USE_DEFAULT , PJSUA_TURN_CONFIG_USE_CUSTOM }
 
enum  pjsua_ipv6_use { PJSUA_IPV6_DISABLED , PJSUA_IPV6_ENABLED }
 
enum  pjsua_nat64_opt { PJSUA_NAT64_DISABLED , PJSUA_NAT64_ENABLED }
 

Functions

void pjsua_ice_config_from_media_config (pj_pool_t *pool, pjsua_ice_config *dst, const pjsua_media_config *src)
 
void pjsua_ice_config_dup (pj_pool_t *pool, pjsua_ice_config *dst, const pjsua_ice_config *src)
 
void pjsua_turn_config_from_media_config (pj_pool_t *pool, pjsua_turn_config *dst, const pjsua_media_config *src)
 
void pjsua_turn_config_dup (pj_pool_t *pool, pjsua_turn_config *dst, const pjsua_turn_config *src)
 
void pjsua_srtp_opt_default (pjsua_srtp_opt *cfg)
 
void pjsua_srtp_opt_dup (pj_pool_t *pool, pjsua_srtp_opt *dst, const pjsua_srtp_opt *src, pj_bool_t check_str)
 
void pjsua_acc_config_default (pjsua_acc_config *cfg)
 
void pjsua_acc_config_dup (pj_pool_t *pool, pjsua_acc_config *dst, const pjsua_acc_config *src)
 
unsigned pjsua_acc_get_count (void)
 
pj_bool_t pjsua_acc_is_valid (pjsua_acc_id acc_id)
 
pj_status_t pjsua_acc_set_default (pjsua_acc_id acc_id)
 
pjsua_acc_id pjsua_acc_get_default (void)
 
pj_status_t pjsua_acc_add (const pjsua_acc_config *acc_cfg, pj_bool_t is_default, pjsua_acc_id *p_acc_id)
 
pj_status_t pjsua_acc_add_local (pjsua_transport_id tid, pj_bool_t is_default, pjsua_acc_id *p_acc_id)
 
pj_status_t pjsua_acc_set_user_data (pjsua_acc_id acc_id, void *user_data)
 
void * pjsua_acc_get_user_data (pjsua_acc_id acc_id)
 
pj_status_t pjsua_acc_del (pjsua_acc_id acc_id)
 
pj_status_t pjsua_acc_get_config (pjsua_acc_id acc_id, pj_pool_t *pool, pjsua_acc_config *acc_cfg)
 
pj_status_t pjsua_acc_modify (pjsua_acc_id acc_id, const pjsua_acc_config *acc_cfg)
 
pj_status_t pjsua_acc_set_online_status (pjsua_acc_id acc_id, pj_bool_t is_online)
 
pj_status_t pjsua_acc_set_online_status2 (pjsua_acc_id acc_id, pj_bool_t is_online, const pjrpid_element *pr)
 
pj_status_t pjsua_acc_set_registration (pjsua_acc_id acc_id, pj_bool_t renew)
 
pj_status_t pjsua_acc_get_info (pjsua_acc_id acc_id, pjsua_acc_info *info)
 
pj_status_t pjsua_enum_accs (pjsua_acc_id ids[], unsigned *count)
 
pj_status_t pjsua_acc_enum_info (pjsua_acc_info info[], unsigned *count)
 
pjsua_acc_id pjsua_acc_find_for_outgoing (const pj_str_t *url)
 
pjsua_acc_id pjsua_acc_find_for_incoming (pjsip_rx_data *rdata)
 
pj_status_t pjsua_acc_create_request (pjsua_acc_id acc_id, const pjsip_method *method, const pj_str_t *target, pjsip_tx_data **p_tdata)
 
pj_status_t pjsua_acc_create_uac_contact (pj_pool_t *pool, pj_str_t *contact, pjsua_acc_id acc_id, const pj_str_t *uri)
 
pj_status_t pjsua_acc_create_uas_contact (pj_pool_t *pool, pj_str_t *contact, pjsua_acc_id acc_id, pjsip_rx_data *rdata)
 
pj_status_t pjsua_acc_set_transport (pjsua_acc_id acc_id, pjsua_transport_id tp_id)
 

Detailed Description

PJSUA accounts provide identity (or identities) of the user who is currently using the application. In SIP terms, the identity is used as the From header in outgoing requests.

PJSUA-API supports creating and managing multiple accounts. The maximum number of accounts is limited by a compile time constant PJSUA_MAX_ACC.

Account may or may not have client registration associated with it. An account is also associated with route set and some authentication credentials, which are used when sending SIP request messages using the account. An account also has presence's online status, which will be reported to remote peer when they subscribe to the account's presence, or which is published to a presence server if presence publication is enabled for the account.

At least one account MUST be created in the application. If no user association is required, application can create a userless account by calling pjsua_acc_add_local(). A userless account identifies local endpoint instead of a particular user, and it correspond with a particular transport instance.

Also one account must be set as the default account, which is used as the account to use when PJSUA fails to match a request with any other accounts.

When sending outgoing SIP requests (such as making calls or sending instant messages), normally PJSUA requires the application to specify which account to use for the request. If no account is specified, PJSUA may be able to select the account by matching the destination domain name, and fall back to default account when no match is found.

Macro Definition Documentation

◆ PJSUA_MAX_ACC

#define PJSUA_MAX_ACC   8

Maximum accounts.

◆ PJSUA_REG_INTERVAL

#define PJSUA_REG_INTERVAL   300

Default registration interval.

◆ PJSUA_UNREG_TIMEOUT

#define PJSUA_UNREG_TIMEOUT   4000

Default maximum time to wait for account unregistration transactions to complete during library shutdown sequence.

Default: 4000 (4 seconds)

◆ PJSUA_PUBLISH_EXPIRATION

#define PJSUA_PUBLISH_EXPIRATION   PJSIP_PUBC_EXPIRATION_NOT_SPECIFIED

Default PUBLISH expiration

◆ PJSUA_DEFAULT_ACC_PRIORITY

#define PJSUA_DEFAULT_ACC_PRIORITY   0

Default account priority.

◆ PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC

#define PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC   2000

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.

Default: 2000 (2 seconds)

◆ PJSUA_REG_RETRY_INTERVAL

#define PJSUA_REG_RETRY_INTERVAL   300

Default auto retry re-registration interval, in seconds. Set to 0 to disable this. Application can set the timer on per account basis by setting the pjsua_acc_config.reg_retry_interval field instead.

Default: 300 (5 minutes)

◆ PJSUA_REG_AUTO_REG_REFRESH

#define PJSUA_REG_AUTO_REG_REFRESH   1

When the registration is successfull, the auto registration refresh will be sent before it expires. Setting this to 0 will disable it. This is useful for app that uses Push Notification and doesn't require auto registration refresh. App can periodically send refresh registration or send it before making a call.= See https://github.com/pjsip/pjproject/pull/2652 for more info.

Default: 1 (enabled)

◆ PJSUA_CONTACT_REWRITE_METHOD

#define PJSUA_CONTACT_REWRITE_METHOD
Value:
PJSUA_CONTACT_REWRITE_ALWAYS_UPDATE)
@ PJSUA_CONTACT_REWRITE_NO_UNREG
Definition: pjsua-lib/pjsua.h:816

This macro specifies the default value for contact_rewrite_method field in pjsua_acc_config. It specifies how Contact update will be done with the registration, if allow_contact_rewrite is enabled in the account config. See pjsua_contact_rewrite_method for the options.

Value PJSUA_CONTACT_REWRITE_UNREGISTER(1) is the legacy behavior.

Default value: PJSUA_CONTACT_REWRITE_NO_UNREG(2) | PJSUA_CONTACT_REWRITE_ALWAYS_UPDATE(4)

◆ PJSUA_REG_USE_OUTBOUND_PROXY

#define PJSUA_REG_USE_OUTBOUND_PROXY   1

Bit value used in pjsua_acc_config.reg_use_proxy field to indicate that the global outbound proxy list should be added to the REGISTER request.

◆ PJSUA_REG_USE_ACC_PROXY

#define PJSUA_REG_USE_ACC_PROXY   2

Bit value used in pjsua_acc_config.reg_use_proxy field to indicate that the account proxy list should be added to the REGISTER request.

◆ PJSUA_CALL_HOLD_TYPE_DEFAULT

#define PJSUA_CALL_HOLD_TYPE_DEFAULT   PJSUA_CALL_HOLD_TYPE_RFC3264

Specify the default call hold type to be used in pjsua_acc_config.

Default is PJSUA_CALL_HOLD_TYPE_RFC3264, and there's no reason to change this except if you're communicating with an old/non-standard peer.

Enumeration Type Documentation

◆ pjsua_call_hold_type

This enumeration specifies how we should offer call hold request to remote peer. The default value is set by compile time constant PJSUA_CALL_HOLD_TYPE_DEFAULT, and application may control the setting on per-account basis by manipulating call_hold_type field in pjsua_acc_config.

Enumerator
PJSUA_CALL_HOLD_TYPE_RFC3264 

This will follow RFC 3264 recommendation to use a=sendonly, a=recvonly, and a=inactive attribute as means to signal call hold status. This is the correct value to use.

PJSUA_CALL_HOLD_TYPE_RFC2543 

This will use the old and deprecated method as specified in RFC 2543, and will offer c=0.0.0.0 in the SDP instead. Using this has many drawbacks such as inability to keep the media transport alive while the call is being put on hold, and should only be used if remote does not understand RFC 3264 style call hold offer.

◆ pjsua_stun_use

This enumeration controls the use of STUN in the account.

Enumerator
PJSUA_STUN_USE_DEFAULT 

Follow the default setting in the global pjsua_config.

PJSUA_STUN_USE_DISABLED 

Disable STUN. If STUN is not enabled in the global pjsua_config, this setting has no effect.

PJSUA_STUN_RETRY_ON_FAILURE 

Retry other STUN servers if the STUN server selected during startup (pjsua_init()) or after calling pjsua_update_stun_servers() is unavailable during runtime. This setting is valid only for account's media STUN setting and if the call is using UDP media transport.

◆ pjsua_upnp_use

This enumeration controls the use of UPnP in the account.

Enumerator
PJSUA_UPNP_USE_DEFAULT 

Follow the default setting in the global pjsua_config.

PJSUA_UPNP_USE_DISABLED 

Disable UPnP.

◆ pjsua_ice_config_use

This enumeration controls the use of ICE settings in the account.

Enumerator
PJSUA_ICE_CONFIG_USE_DEFAULT 

Use the default settings in the global pjsua_media_config.

PJSUA_ICE_CONFIG_USE_CUSTOM 

Use the custom pjsua_ice_config setting in the account.

◆ pjsua_turn_config_use

This enumeration controls the use of TURN settings in the account.

Enumerator
PJSUA_TURN_CONFIG_USE_DEFAULT 

Use the default setting in the global pjsua_media_config.

PJSUA_TURN_CONFIG_USE_CUSTOM 

Use the custom pjsua_turn_config setting in the account.

◆ pjsua_ipv6_use

Specify how IPv6 transport should be used in account config.

Enumerator
PJSUA_IPV6_DISABLED 

IPv6 is not used.

PJSUA_IPV6_ENABLED 

IPv6 is enabled.

◆ pjsua_nat64_opt

Specify NAT64 options to be used in account config.

Enumerator
PJSUA_NAT64_DISABLED 

NAT64 is not used.

PJSUA_NAT64_ENABLED 

NAT64 is enabled.

Function Documentation

◆ pjsua_ice_config_from_media_config()

void pjsua_ice_config_from_media_config ( pj_pool_t pool,
pjsua_ice_config dst,
const pjsua_media_config src 
)

Initialize ICE config from a media config. If the pool argument is NULL, a simple memcpy() will be used.

Parameters
poolMemory to duplicate strings.
dstDestination config.
srcSource config.

◆ pjsua_ice_config_dup()

void pjsua_ice_config_dup ( pj_pool_t pool,
pjsua_ice_config dst,
const pjsua_ice_config src 
)

Clone. If the pool argument is NULL, a simple memcpy() will be used.

Parameters
poolMemory to duplicate strings.
dstDestination config.
srcSource config.

◆ pjsua_turn_config_from_media_config()

void pjsua_turn_config_from_media_config ( pj_pool_t pool,
pjsua_turn_config dst,
const pjsua_media_config src 
)

Initialize TURN config from a media config. If the pool argument is NULL, a simple memcpy() will be used.

Parameters
poolMemory to duplicate strings.
dstDestination config.
srcSource config.

◆ pjsua_turn_config_dup()

void pjsua_turn_config_dup ( pj_pool_t pool,
pjsua_turn_config dst,
const pjsua_turn_config src 
)

Clone. If the pool argument is NULL, a simple memcpy() will be used.

Parameters
poolMemory to duplicate strings.
dstDestination config.
srcSource config.

◆ pjsua_srtp_opt_default()

void pjsua_srtp_opt_default ( pjsua_srtp_opt cfg)

Call this function to initialize SRTP config with default values.

Parameters
cfgThe SRTP config to be initialized.

◆ pjsua_srtp_opt_dup()

void pjsua_srtp_opt_dup ( pj_pool_t pool,
pjsua_srtp_opt dst,
const pjsua_srtp_opt src,
pj_bool_t  check_str 
)

Duplicate SRTP transport setting. If the pool argument is NULL, a simple memcpy() will be used.

Parameters
poolMemory to duplicate strings.
dstDestination setting.
srcSource setting.
check_strIf set to TRUE, the function will check if strings are identical before copying. Identical strings will not be duplicated. If set to FALSE, all strings will be duplicated.

◆ pjsua_acc_config_default()

void pjsua_acc_config_default ( pjsua_acc_config cfg)

Call this function to initialize account config with default values.

Parameters
cfgThe account config to be initialized.

◆ pjsua_acc_config_dup()

void pjsua_acc_config_dup ( pj_pool_t pool,
pjsua_acc_config dst,
const pjsua_acc_config src 
)

Duplicate account config.

Parameters
poolPool to be used for duplicating the config.
dstDestination configuration.
srcSource configuration.

◆ pjsua_acc_get_count()

unsigned pjsua_acc_get_count ( void  )

Get number of current accounts.

Returns
Current number of accounts.

◆ pjsua_acc_is_valid()

pj_bool_t pjsua_acc_is_valid ( pjsua_acc_id  acc_id)

Check if the specified account ID is valid.

Parameters
acc_idAccount ID to check.
Returns
Non-zero if account ID is valid.

◆ pjsua_acc_set_default()

pj_status_t pjsua_acc_set_default ( pjsua_acc_id  acc_id)

Set default account to be used when incoming and outgoing requests doesn't match any accounts.

Parameters
acc_idThe account ID to be used as default.
Returns
PJ_SUCCESS on success.

◆ pjsua_acc_get_default()

pjsua_acc_id pjsua_acc_get_default ( void  )

Get default account to be used when receiving incoming requests (calls), when the destination of the incoming call doesn't match any other accounts.

Returns
The default account ID, or PJSUA_INVALID_ID if no default account is configured.

◆ pjsua_acc_add()

pj_status_t pjsua_acc_add ( const pjsua_acc_config acc_cfg,
pj_bool_t  is_default,
pjsua_acc_id p_acc_id 
)

Add a new account to pjsua. PJSUA must have been initialized (with pjsua_init()) before calling this function. If registration is configured for this account, this function would also start the SIP registration session with the SIP registrar server. This SIP registration session will be maintained internally by the library, and application doesn't need to do anything to maintain the registration session.

Parameters
acc_cfgAccount configuration.
is_defaultIf non-zero, this account will be set as the default account. The default account will be used when sending outgoing requests (e.g. making call) when no account is specified, and when receiving incoming requests when the request does not match any accounts. It is recommended that default account is set to local/LAN account.
p_acc_idPointer to receive account ID of the new account.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_acc_add_local()

pj_status_t pjsua_acc_add_local ( pjsua_transport_id  tid,
pj_bool_t  is_default,
pjsua_acc_id p_acc_id 
)

Add a local account. A local account is used to identify local endpoint instead of a specific user, and for this reason, a transport ID is needed to obtain the local address information.

Parameters
tidTransport ID to generate account address.
is_defaultIf non-zero, this account will be set as the default account. The default account will be used when sending outgoing requests (e.g. making call) when no account is specified, and when receiving incoming requests when the request does not match any accounts. It is recommended that default account is set to local/LAN account.
p_acc_idPointer to receive account ID of the new account.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_acc_set_user_data()

pj_status_t pjsua_acc_set_user_data ( pjsua_acc_id  acc_id,
void *  user_data 
)

Set arbitrary data to be associated with the account.

Parameters
acc_idThe account ID.
user_dataUser/application data.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_acc_get_user_data()

void * pjsua_acc_get_user_data ( pjsua_acc_id  acc_id)

Retrieve arbitrary data associated with the account.

Parameters
acc_idThe account ID.
Returns
The user data. In the case where the account ID is not valid, NULL is returned.

◆ pjsua_acc_del()

pj_status_t pjsua_acc_del ( pjsua_acc_id  acc_id)

Delete an account. This will unregister the account from the SIP server, if necessary, and terminate server side presence subscriptions associated with this account.

Parameters
acc_idId of the account to be deleted.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_acc_get_config()

pj_status_t pjsua_acc_get_config ( pjsua_acc_id  acc_id,
pj_pool_t pool,
pjsua_acc_config acc_cfg 
)

Get current config for the account. This will copy current account setting to the specified parameter. Note that all pointers in the settings will point to the original settings in the account and application must not modify the values in any way. Application must also take care that these data is only valid until the account is destroyed.

Parameters
acc_idThe account ID.
poolPool to duplicate the config.
acc_cfgStructure to receive the settings.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_acc_modify()

pj_status_t pjsua_acc_modify ( pjsua_acc_id  acc_id,
const pjsua_acc_config acc_cfg 
)

Modify account configuration setting. This function may trigger unregistration (of old account setting) and re-registration (of the new account setting), e.g: changing account ID, credential, registar, or proxy setting.

Note:

  • when the new config triggers unregistration, the pjsua callback on_reg_state()/on_reg_state2() for the unregistration will not be called and any failure in the unregistration will be ignored, so if application needs to be sure about the unregistration status, it should unregister manually and wait for the callback before calling this function
  • when the new config triggers re-registration and the re-registration fails, the account setting will not be reverted back to the old setting and the account will be in unregistered state.
Parameters
acc_idId of the account to be modified.
acc_cfgNew account configuration.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_acc_set_online_status()

pj_status_t pjsua_acc_set_online_status ( pjsua_acc_id  acc_id,
pj_bool_t  is_online 
)

Modify account's presence 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.

See also
pjsua_acc_set_online_status2()
Parameters
acc_idThe account ID.
is_onlineTrue of false.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_acc_set_online_status2()

pj_status_t pjsua_acc_set_online_status2 ( pjsua_acc_id  acc_id,
pj_bool_t  is_online,
const pjrpid_element pr 
)

Modify account's presence 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.

See also
pjsua_acc_set_online_status()
Parameters
acc_idThe account ID.
is_onlineTrue of false.
prExtended information in subset of RPID format which allows setting custom presence text.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_acc_set_registration()

pj_status_t pjsua_acc_set_registration ( pjsua_acc_id  acc_id,
pj_bool_t  renew 
)

Update registration or perform unregistration. If registration is configured for this account, then initial SIP REGISTER will be sent when the account is added with pjsua_acc_add(). Application normally only need to call this function if it wants to manually update the registration or to unregister from the server.

Parameters
acc_idThe account ID.
renewIf renew argument is zero, this will start unregistration process.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_acc_get_info()

pj_status_t pjsua_acc_get_info ( pjsua_acc_id  acc_id,
pjsua_acc_info info 
)

Get information about the specified account.

Parameters
acc_idAccount identification.
infoPointer to receive account information.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_enum_accs()

pj_status_t pjsua_enum_accs ( pjsua_acc_id  ids[],
unsigned *  count 
)

Enumerate all account currently active in the library. This will fill the array with the account Ids, and application can then query the account information for each id with pjsua_acc_get_info().

See also
pjsua_acc_enum_info().
Parameters
idsArray of account IDs to be initialized.
countIn input, specifies the maximum number of elements. On return, it contains the actual number of elements.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_acc_enum_info()

pj_status_t pjsua_acc_enum_info ( pjsua_acc_info  info[],
unsigned *  count 
)

Enumerate account informations.

Parameters
infoArray of account infos to be initialized.
countIn input, specifies the maximum number of elements. On return, it contains the actual number of elements.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_acc_find_for_outgoing()

pjsua_acc_id pjsua_acc_find_for_outgoing ( const pj_str_t url)

This is an internal function to find the most appropriate account to used to reach to the specified URL.

Parameters
urlThe remote URL to reach.
Returns
Account id.

◆ pjsua_acc_find_for_incoming()

pjsua_acc_id pjsua_acc_find_for_incoming ( pjsip_rx_data rdata)

This is an internal function to find the most appropriate account to be used to handle incoming calls.

Parameters
rdataThe incoming request message.
Returns
Account id.

◆ pjsua_acc_create_request()

pj_status_t pjsua_acc_create_request ( pjsua_acc_id  acc_id,
const pjsip_method method,
const pj_str_t target,
pjsip_tx_data **  p_tdata 
)

Create arbitrary requests using the account. Application should only use this function to create auxiliary requests outside dialog, such as OPTIONS, and use the call or presence API to create dialog related requests.

Parameters
acc_idThe account ID.
methodThe SIP method of the request.
targetTarget URI.
p_tdataPointer to receive the request.
Returns
PJ_SUCCESS or the error code.

◆ pjsua_acc_create_uac_contact()

pj_status_t pjsua_acc_create_uac_contact ( pj_pool_t pool,
pj_str_t contact,
pjsua_acc_id  acc_id,
const pj_str_t uri 
)

Create a suitable Contact header value, based on the specified target URI for the specified account.

Parameters
poolPool to allocate memory for the string.
contactThe string where the Contact will be stored.
acc_idAccount ID.
uriDestination URI of the request.
Returns
PJ_SUCCESS on success, other on error.

◆ pjsua_acc_create_uas_contact()

pj_status_t pjsua_acc_create_uas_contact ( pj_pool_t pool,
pj_str_t contact,
pjsua_acc_id  acc_id,
pjsip_rx_data rdata 
)

Create a suitable Contact header value, based on the information in the incoming request.

Parameters
poolPool to allocate memory for the string.
contactThe string where the Contact will be stored.
acc_idAccount ID.
rdataIncoming request.
Returns
PJ_SUCCESS on success, other on error.

◆ pjsua_acc_set_transport()

pj_status_t pjsua_acc_set_transport ( pjsua_acc_id  acc_id,
pjsua_transport_id  tp_id 
)

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 stack 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 pjsua_acc_config too.

Parameters
acc_idThe account ID.
tp_idThe transport ID.
Returns
PJ_SUCCESS on success.

 


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