BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJSIP Reference

Core Proxy Layer

Core proxy operations. More...

Functions

pj_status_t pjsip_endpt_create_request_fwd (pjsip_endpoint *endpt, pjsip_rx_data *rdata, const pjsip_uri *uri, const pj_str_t *branch, unsigned options, pjsip_tx_data **tdata)
 
pj_status_t pjsip_endpt_create_response_fwd (pjsip_endpoint *endpt, pjsip_rx_data *rdata, unsigned options, pjsip_tx_data **tdata)
 
pj_str_t pjsip_calculate_branch_id (pjsip_rx_data *rdata)
 

Detailed Description

Function Documentation

pj_status_t pjsip_endpt_create_request_fwd ( pjsip_endpoint endpt,
pjsip_rx_data rdata,
const pjsip_uri uri,
const pj_str_t branch,
unsigned  options,
pjsip_tx_data **  tdata 
)

Create new request message to be forwarded upstream to new destination URI in uri. The new request is a full/deep clone of the request received in rdata, unless if other copy mechanism is specified in the options. The branch parameter, if not NULL, will be used as the branch-param in the Via header. If it is NULL, then a unique branch parameter will be used.

Note: this function DOES NOT perform Route information preprocessing as described in RFC 3261 Section 16.4. Application must take care of removing/updating the Route headers according of the rules as described in that section.

Parameters
endptThe endpoint instance.
rdataThe incoming request message.
uriThe URI where the request will be forwarded to.
branchOptional branch parameter. Application may specify its own branch, for example if it wishes to perform loop detection. If the branch parameter is not specified, this function will generate its own by calling pjsip_calculate_branch_id() function.
optionsOptional option flags when duplicating the message.
tdataThe result.
Returns
PJ_SUCCESS on success.
pj_status_t pjsip_endpt_create_response_fwd ( pjsip_endpoint endpt,
pjsip_rx_data rdata,
unsigned  options,
pjsip_tx_data **  tdata 
)

Create new response message to be forwarded downstream by the proxy from the response message found in rdata. Note that this function practically will clone the response as is, i.e. without checking the validity of the response or removing top most Via header. This function will perform full/deep clone of the response, unless other copy mechanism is used in the options.

Parameters
endptThe endpoint instance.
rdataThe incoming response message.
optionsOptional option flags when duplicate the message.
tdataThe result
Returns
PJ_SUCCESS on success.
pj_str_t pjsip_calculate_branch_id ( pjsip_rx_data rdata)

Create a globally unique branch parameter based on the information in the incoming request message, for the purpose of creating a new request for forwarding. This is the default implementation used by pjsip_endpt_create_request_fwd() function if the branch parameter is not specified.

The default implementation here will just create an MD5 hash of the top-most Via.

Note that the returned string was allocated from rdata's pool.

Parameters
rdataThe incoming request message.
Returns
Unique branch-ID string.

 


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