Skip to content

Commit f2d2a0d

Browse files
committed
dialog PRACK: Add a couple knobs/settings for UAC-side control
* auto_prack_hangup_on_failure (default: 0) -> enable strict UAC * auto_prack_fr_timeout (default: 2 sec) -> related to above
1 parent fa2d3f2 commit f2d2a0d

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

modules/dialog/dialog.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ int dlg_del_delay = 0; /* in seconds, default off */
7878
str dlg_extra_hdrs = {NULL,0};
7979
int race_condition_timeout = 5; /* seconds until call termination is triggered,
8080
after 200OK -> CANCEL race detection */
81+
int auto_prack_hangup_on_failure = 0;
82+
int auto_prack_fr_timeout = 3;
8183

8284
/* statistic variables */
8385
int dlg_enable_stats = 1;
@@ -305,6 +307,8 @@ static const param_export_t mod_params[]={
305307
{ "delete_delay", INT_PARAM, &dlg_del_delay },
306308
{ "dlg_extra_hdrs", STR_PARAM, &dlg_extra_hdrs.s },
307309
{ "dlg_match_mode", INT_PARAM, &seq_match_mode },
310+
{ "auto_prack_hangup_on_failure", INT_PARAM, &auto_prack_hangup_on_failure },
311+
{ "auto_prack_fr_timeout", INT_PARAM, &auto_prack_fr_timeout },
308312
{ "db_url", STR_PARAM, &db_url.s },
309313
{ "db_mode", INT_PARAM, &dlg_db_mode },
310314
{ "table_name", STR_PARAM, &dialog_table_name },

modules/dialog/dlg_req_within.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545

4646
extern str dlg_extra_hdrs;
4747

48-
#define DLG_AUTO_PRACK_FR_TIMEOUT 2
4948
#define DLG_TM_TID_LEN ((sizeof(int) * 2) + 1 + (sizeof(int) * 2))
5049

5150
struct dlg_auto_prack_ctx {
@@ -66,6 +65,12 @@ static void dlg_auto_prack_reply_failure(struct dlg_auto_prack_ctx *ctx)
6665
struct cell *invite_t;
6766
int rc;
6867

68+
if (!auto_prack_hangup_on_failure) {
69+
LM_DBG("auto PRACK failure observed for correlated INVITE transaction <%.*s>, but auto_prack_hangup_on_failure is disabled\n",
70+
ctx->invite_tid.len, ctx->invite_tid.s);
71+
return;
72+
}
73+
6974
rc = d_tmb.t_lookup_ident(&invite_t, ctx->invite_hash_index,
7075
ctx->invite_label);
7176
if (rc < 0) {
@@ -157,7 +162,7 @@ static void dlg_auto_prack_t_created(struct cell *t, void *param)
157162
str prack_tid = STR_NULL;
158163
struct dlg_auto_prack_ctx *ctx = param;
159164

160-
t->fr_timeout = DLG_AUTO_PRACK_FR_TIMEOUT;
165+
t->fr_timeout = auto_prack_fr_timeout;
161166

162167
if (dlg_format_trans_id(t->hash_index, t->label, &prack_tid, prack_tid_buf,
163168
sizeof(prack_tid_buf)) < 0) {

modules/dialog/dlg_req_within.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#define DLG_PING_FAIL 2
4444

4545
extern struct tm_binds d_tmb;
46+
extern int auto_prack_hangup_on_failure;
47+
extern int auto_prack_fr_timeout;
4648

4749
typedef void (dlg_request_callback)(struct cell *t,int type,
4850
struct tmcb_params* ps);

0 commit comments

Comments
 (0)