Home --> Documentations --> PJSIP Reference

Stateful Operations

Utility function to send requests/responses statefully. More...


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


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

Detailed Description

Typedef Documentation

◆ pjsip_endpt_send_callback

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

Type of callback to be specified in pjsip_endpt_send_request().

tokenThe token that was given in pjsip_endpt_send_request()
eCompletion event.

Function Documentation

◆ pjsip_endpt_respond()

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.

endptThe endpoint instance.
tsx_userThe module to be registered as transaction user.
rdataThe incoming request message.
st_codeStatus code of the response.
st_textOptional status text of the response.
hdr_listOptional header list to be added to the response.
bodyOptional message body to be added to the response.
p_tsxOptional pointer to receive the transaction which was created to send the response.
PJ_SUCCESS if response message has successfully been created.

◆ pjsip_endpt_send_request()

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.

endptThe endpoint instance.
tdataThe transmit data to be sent.
timeoutOptional 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.
tokenOptional token to be associated with the transaction, and to be passed to the callback.
cbOptional 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.
PJ_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.