Skip to content

Commit

Permalink
assertion when the ACK response is recognized as a merged request (#4203
Browse files Browse the repository at this point in the history
)
  • Loading branch information
LeonidGoltsblat authored Dec 10, 2024
1 parent 9030274 commit fb4ccef
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions pjsip/src/pjsua-lib/pjsua_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,15 +667,31 @@ static pj_bool_t mod_pjsua_on_rx_request(pjsip_rx_data *rdata)
pj_bool_t processed = PJ_FALSE;

#if PJSUA_DETECT_MERGED_REQUESTS
if (pjsip_tsx_detect_merged_requests(rdata)) {
PJ_LOG(4, (THIS_FILE, "Merged request detected"));
pjsip_transaction *tsx;
if ((tsx = pjsip_tsx_detect_merged_requests(rdata)) != NULL) {

/* Respond with 482 (Loop Detected) */
pjsip_endpt_respond(pjsua_var.endpt, NULL, rdata,
PJSIP_SC_LOOP_DETECTED, NULL,
NULL, NULL, NULL);
pjsip_dialog *dlg = pjsip_tsx_get_dlg(tsx);

return PJ_TRUE;
PJ_LOG(4, (THIS_FILE, "Merged request detected (%s) (%s): %s from %s:%d",
dlg ? dlg->obj_name : "-no-dlg-",
tsx->obj_name,
pjsip_rx_data_get_info(rdata),
rdata->pkt_info.src_name,
rdata->pkt_info.src_port));

/* Don't respond to ACK, even if it looks like a merged request
* Let it be "dropped/unhandled by any modules"
*/
if (pjsip_method_cmp(&rdata->msg_info.msg->line.req.method,
&pjsip_ack_method) == 0) {
return PJ_FALSE;
} else {
/* Respond with 482 (Loop Detected) */
pjsip_endpt_respond(pjsua_var.endpt, NULL, rdata,
PJSIP_SC_LOOP_DETECTED, NULL,
NULL, NULL, NULL);
return PJ_TRUE;
}
}
#endif

Expand Down

0 comments on commit fb4ccef

Please sign in to comment.