Skip to content

Commit 6ab5ee1

Browse files
committed
[b2b_entities] avoid sending 408 on a completed transaction
upon entities cleanup, is the UAS/UPDATE transactions are completed, just unref without sending a 408. Reported by @davegreeko2023 Fixes #3899
1 parent a25c3fb commit 6ab5ee1

1 file changed

Lines changed: 26 additions & 16 deletions

File tree

  • modules/b2b_entities

modules/b2b_entities/dlg.c

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,29 +2229,39 @@ void b2b_delete_record(b2b_dlg_t* dlg, b2b_table htable, unsigned int hash_index
22292229
shm_free(dlg->logic_key.s);
22302230

22312231
if(dlg->uas_tran) {
2232-
tmb.unref_cell(dlg->uas_tran);
22332232

2234-
pto = get_to(dlg->uas_tran->uas.request);
2235-
if (pto == NULL || pto->error != PARSE_OK) {
2236-
LM_ERR("'To' header COULD NOT be parsed\n");
2237-
} else {
2238-
if (run_tm_api(&tmb, t_reply_with_body, dlg->uas_tran, 408, &reply_text, 0, 0,
2239-
&pto->tag_value) < 0)
2240-
LM_ERR("Failed to send 408 reply\n");
2233+
/* if we come across an already finally replied trans,
2234+
* just release it; otherwise send 408 */
2235+
if ( dlg->uas_tran->uas.status<200) {
2236+
pto = get_to(dlg->uas_tran->uas.request);
2237+
if (pto == NULL || pto->error != PARSE_OK) {
2238+
LM_ERR("'To' header COULD NOT be parsed\n");
2239+
} else {
2240+
if (run_tm_api(&tmb, t_reply_with_body, dlg->uas_tran,
2241+
408, &reply_text, 0, 0, &pto->tag_value) < 0)
2242+
LM_ERR("Failed to send 408 reply\n");
2243+
}
22412244
}
2245+
2246+
tmb.unref_cell(dlg->uas_tran);
22422247
}
22432248

22442249
if (dlg->update_tran) {
2245-
tmb.unref_cell(dlg->update_tran);
22462250

2247-
pto = get_to(dlg->update_tran->uas.request);
2248-
if (pto == NULL || pto->error != PARSE_OK) {
2249-
LM_ERR("'To' header COULD NOT be parsed\n");
2250-
} else {
2251-
if (run_tm_api(&tmb, t_reply_with_body, dlg->update_tran, 408, &reply_text, 0, 0,
2252-
&pto->tag_value) < 0)
2253-
LM_ERR("Failed to send 408 reply\n");
2251+
/* if we come across an already finally replied trans,
2252+
* just release it; otherwise send 408 */
2253+
if ( dlg->update_tran->uas.status<200) {
2254+
pto = get_to(dlg->update_tran->uas.request);
2255+
if (pto == NULL || pto->error != PARSE_OK) {
2256+
LM_ERR("'To' header COULD NOT be parsed\n");
2257+
} else {
2258+
if (run_tm_api(&tmb, t_reply_with_body, dlg->update_tran,
2259+
408, &reply_text, 0, 0, &pto->tag_value) < 0)
2260+
LM_ERR("Failed to send 408 reply\n");
2261+
}
22542262
}
2263+
2264+
tmb.unref_cell(dlg->update_tran);
22552265
}
22562266

22572267
if(dlg->ack_sdp.s)

0 commit comments

Comments
 (0)