Group PJSIP_TRANSACT_UTIL

group PJSIP_TRANSACT_UTIL

Utility function to send requests/responses statefully.

Typedefs

typedef void (*pjsip_endpt_send_callback)(void *token, pjsip_event *e)

Type of callback to be specified in pjsip_endpt_send_request().

Param token:

The token that was given in pjsip_endpt_send_request()

Param e:

Completion event.

Functions

pj_status_t pjsip_endpt_respond(pjsip_endpoint *endpt, pjsip_module *tsx_user, pjsip_rx_data *rdata, int st_code, const pj_str_t *st_text, const pjsip_hdr *hdr_list, const pjsip_msg_body *body, pjsip_transaction **p_tsx)

This composite function creates and sends response statefully for the incoming request.

Parameters:
  • endpt – The endpoint instance.

  • tsx_user – The module to be registered as transaction user.

  • rdata – The incoming request message.

  • st_code – Status code of the response.

  • st_text – Optional status text of the response.

  • hdr_list – Optional header list to be added to the response.

  • body – Optional message body to be added to the response.

  • p_tsx – Optional pointer to receive the transaction which was created to send the response.

Returns:

PJ_SUCCESS if response message has successfully been created.

pj_status_t pjsip_endpt_send_request(pjsip_endpoint *endpt, pjsip_tx_data *tdata, pj_int32_t timeout, void *token, pjsip_endpt_send_callback cb)

Send outgoing request and initiate UAC transaction for the request. This is an auxiliary function to be used by application to send arbitrary requests outside a dialog. To send a request within a dialog, application should use pjsip_dlg_send_request instead.

Parameters:
  • endpt – The endpoint instance.

  • tdata – The transmit data to be sent.

  • timeout – Optional timeout for final response to be received, or -1 if the transaction should not have a timeout restriction. The value is in miliseconds. Note that this is not implemented yet, so application needs to use its own timer to handle timeout.

  • token – Optional token to be associated with the transaction, and to be passed to the callback.

  • cb – Optional callback to be called when the transaction has received a final response. The callback will be called with the previously registered token and the event that triggers the completion of the transaction.

Returns:

PJ_SUCCESS, or the appropriate error code.