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

API for managing SIP transports. More...

Data Structures

struct  pjsua_transport_config
 
struct  pjsua_transport_info
 

Typedefs

typedef int pjsua_transport_id
 

Functions

void pjsua_transport_config_default (pjsua_transport_config *cfg)
 
void pjsua_transport_config_dup (pj_pool_t *pool, pjsua_transport_config *dst, const pjsua_transport_config *src)
 
pj_status_t pjsua_transport_create (pjsip_transport_type_e type, const pjsua_transport_config *cfg, pjsua_transport_id *p_id)
 
pj_status_t pjsua_transport_register (pjsip_transport *tp, pjsua_transport_id *p_id)
 
pj_status_t pjsua_tpfactory_register (pjsip_tpfactory *tf, pjsua_transport_id *p_id)
 
pj_status_t pjsua_enum_transports (pjsua_transport_id id[], unsigned *count)
 
pj_status_t pjsua_transport_get_info (pjsua_transport_id id, pjsua_transport_info *info)
 
pj_status_t pjsua_transport_set_enable (pjsua_transport_id id, pj_bool_t enabled)
 
pj_status_t pjsua_transport_close (pjsua_transport_id id, pj_bool_t force)
 
pj_status_t pjsua_transport_lis_start (pjsua_transport_id id, const pjsua_transport_config *cfg)
 

Detailed Description

PJSUA-API supports creating multiple transport instances, for example UDP, TCP, and TLS transport. SIP transport must be created before adding an account.

Typedef Documentation

◆ pjsua_transport_id

typedef int pjsua_transport_id

SIP transport identification.

Function Documentation

◆ pjsua_transport_config_default()

void pjsua_transport_config_default ( pjsua_transport_config cfg)

Call this function to initialize UDP config with default values.

Parameters
cfgThe UDP config to be initialized.

◆ pjsua_transport_config_dup()

void pjsua_transport_config_dup ( pj_pool_t pool,
pjsua_transport_config dst,
const pjsua_transport_config src 
)

Duplicate transport config.

Parameters
poolThe pool.
dstThe destination config.
srcThe source config.

◆ pjsua_transport_create()

pj_status_t pjsua_transport_create ( pjsip_transport_type_e  type,
const pjsua_transport_config cfg,
pjsua_transport_id p_id 
)

Create and start a new SIP transport according to the specified settings.

Parameters
typeTransport type.
cfgTransport configuration.
p_idOptional pointer to receive transport ID.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_transport_register()

pj_status_t pjsua_transport_register ( pjsip_transport tp,
pjsua_transport_id p_id 
)

Register transport that has been created by application. This function is useful if application wants to implement custom SIP transport and use it with pjsua.

Parameters
tpTransport instance.
p_idOptional pointer to receive transport ID.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_tpfactory_register()

pj_status_t pjsua_tpfactory_register ( pjsip_tpfactory tf,
pjsua_transport_id p_id 
)

Register transport factory that has been created by application. This function is useful if application wants to implement custom SIP transport and use it with pjsua.

Parameters
tfTransport factory instance.
p_idOptional pointer to receive transport ID.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_enum_transports()

pj_status_t pjsua_enum_transports ( pjsua_transport_id  id[],
unsigned *  count 
)

Enumerate all transports currently created in the system. This function will return all transport IDs, and application may then call pjsua_transport_get_info() function to retrieve detailed information about the transport.

Parameters
idArray to receive transport ids.
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_transport_get_info()

pj_status_t pjsua_transport_get_info ( pjsua_transport_id  id,
pjsua_transport_info info 
)

Get information about transports.

Parameters
idTransport ID.
infoPointer to receive transport info.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_transport_set_enable()

pj_status_t pjsua_transport_set_enable ( pjsua_transport_id  id,
pj_bool_t  enabled 
)

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
idTransport ID.
enabledNon-zero to enable, zero to disable.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_transport_close()

pj_status_t pjsua_transport_close ( pjsua_transport_id  id,
pj_bool_t  force 
)

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 it is safe to do so.

NOTE: Forcefully closing transport (force = PJ_TRUE) is deprecated, since any pending transactions that are using the transport may not terminate properly and can even crash. Application wishing to immediately close the transport for the purpose of restarting it should use pjsua_handle_ip_change() instead.

Parameters
idTransport ID.
forceMust be PJ_FALSE. force = PJ_TRUE is deprecated.
Returns
PJ_SUCCESS on success, or the appropriate error code.

◆ pjsua_transport_lis_start()

pj_status_t pjsua_transport_lis_start ( pjsua_transport_id  id,
const pjsua_transport_config cfg 
)

Start the listener of the transport. This is useful when listener is not automatically started when creating the transport.

Parameters
idTransport ID.
cfgThe new transport config used by the listener. Only port, public_addr and bound_addr are used at the moment.
Returns
PJ_SUCCESS on success, or the appropriate error code.

 


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