Group PJSIP_PROXY_CORE

group PJSIP_PROXY_CORE

Core proxy operations.

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)

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:
  • endpt – The endpoint instance.

  • rdata – The incoming request message.

  • uri – The URI where the request will be forwarded to.

  • branch – Optional 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.

  • options – Optional option flags when duplicating the message.

  • tdata – The 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:
  • endpt – The endpoint instance.

  • rdata – The incoming response message.

  • options – Optional option flags when duplicate the message.

  • tdata – The 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:

rdata – The incoming request message.

Returns:

Unique branch-ID string.