Home --> Documentations --> PJSIP Reference

Data Structures | Typedefs | Functions
PJSUA-API Signaling Transport

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

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

SIP transport identification.

Function Documentation

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.
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.
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.
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.
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.
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.
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.
pj_status_t pjsua_transport_close ( pjsua_transport_id  id,
pj_bool_t  force 
)

Close the transport. If transport is forcefully closed, it will be immediately closed, and any pending transactions that are using the transport may not terminate properly (it may even crash). Otherwise, 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.

Parameters
idTransport ID.
forceNon-zero to immediately close the transport. This is not recommended!
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.