Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! Add support of out-of-dialog SIP transact…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
wosrediinanatour committed Nov 19, 2024
1 parent 0f1f15d commit 283cb8d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
28 changes: 17 additions & 11 deletions pjsip/src/pjsua-lib/pjsua_acc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1510,17 +1510,17 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id,
return status;
}

typedef struct pjsua_send_request_data
typedef struct send_request_data
{
pjsua_acc_id acc_id;
void *token;
} pjsua_send_request_data;
} send_request_data;

static void on_acc_tsx_state(void *request_data, pjsip_event *event)
static void on_send_request(void *request_data, pjsip_event *event)
{
pjsua_send_request_data *request_data_ = (pjsua_send_request_data*) request_data;
if (request_data_)
(pjsua_var.ua_cfg.cb.on_acc_send_request)(request_data_->acc_id, request_data_->token, event);
send_request_data *data = (send_request_data*) request_data;
if (data && pjsua_var.ua_cfg.cb.on_acc_send_request)
(pjsua_var.ua_cfg.cb.on_acc_send_request)(data->acc_id, data->token, event);
}

PJ_DEF(pj_status_t) pjsua_acc_send_request(pjsua_acc_id acc_id,
Expand All @@ -1530,15 +1530,17 @@ PJ_DEF(pj_status_t) pjsua_acc_send_request(pjsua_acc_id acc_id,
void *token,
const pjsua_msg_data *msg_data)
{
const pjsip_hdr *cap_hdr;
const pjsip_hdr *cap_hdr = NULL;
pjsip_method method_;
pj_status_t status;
pjsip_tx_data *tdata = NULL;
pjsua_send_request_data *request_data;
send_request_data *request_data = NULL;

PJ_UNUSED_ARG(options);
PJ_ASSERT_RETURN(acc_id>=0, PJ_EINVAL);
PJ_ASSERT_RETURN(dest_uri, PJ_EINVAL);
PJ_ASSERT_RETURN(method, PJ_EINVAL);
PJ_UNUSED_ARG(options);
PJ_ASSERT_RETURN(msg_data, PJ_EINVAL);

PJ_LOG(4,(THIS_FILE, "Account %d sending %.*s request..",
acc_id, (int)method->slen, method->ptr));
Expand All @@ -1551,7 +1553,11 @@ PJ_DEF(pj_status_t) pjsua_acc_send_request(pjsua_acc_id acc_id,
goto on_return;
}

request_data = PJ_POOL_ZALLOC_T(tdata->pool, pjsua_send_request_data);
request_data = PJ_POOL_ZALLOC_T(tdata->pool, send_request_data);
if (!request_data) {
status = PJ_ENOMEM;
goto on_return;
}
request_data->acc_id = acc_id;
request_data->token = token;

Expand All @@ -1563,7 +1569,7 @@ PJ_DEF(pj_status_t) pjsua_acc_send_request(pjsua_acc_id acc_id,
(pjsip_hdr*) pjsip_hdr_clone(tdata->pool, cap_hdr));
}

status = pjsip_endpt_send_request(pjsua_var.endpt, tdata, -1, request_data, &on_acc_tsx_state);
status = pjsip_endpt_send_request(pjsua_var.endpt, tdata, -1, request_data, &on_send_request);
if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE, "Unable to send request", status);
goto on_return;
Expand Down
2 changes: 1 addition & 1 deletion pjsip/src/pjsua2/account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void RtcpFbConfig::writeObject(ContainerNode &node) const PJSUA2_THROW(Error)
///////////////////////////////////////////////////////////////////////////////

SendRequestParam::SendRequestParam()
: method("")
: userData(NULL), method("")
{
}

Expand Down

0 comments on commit 283cb8d

Please sign in to comment.