Skip to content

Commit

Permalink
dialog: don't allow RE-INVITE and OPTIONS pinging at the same time
Browse files Browse the repository at this point in the history
Enabling both RE-INVITE and OPTIONS pinging for the same endpoint causes
issues with the CSEQ value in:
* ACK (incremented value compared to the corresponding INVITE)
* INVITE and OPTIONS (decreasing values between the requests), in case
  races occur between computing the new CSEQ values and sending the messages.
  • Loading branch information
rvlad-patrascu committed Jul 17, 2020
1 parent 1b4fcc0 commit 182ceb0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/dialog/dialog.c
Expand Up @@ -1011,6 +1011,14 @@ static int w_create_dialog(struct sip_msg *req, str *flags_str)

flags = flags_str? parse_create_dlg_flags(flags_str): 0;

/* don't allow both Re-INVITE and OPTIONS pinging */
if ((flags & (DLG_FLAG_PING_CALLER|DLG_FLAG_REINVITE_PING_CALLER)) ==
(DLG_FLAG_PING_CALLER|DLG_FLAG_REINVITE_PING_CALLER))
flags &= ~DLG_FLAG_PING_CALLER;
if ((flags & (DLG_FLAG_PING_CALLEE|DLG_FLAG_REINVITE_PING_CALLEE)) ==
(DLG_FLAG_PING_CALLEE|DLG_FLAG_REINVITE_PING_CALLEE))
flags &= ~DLG_FLAG_PING_CALLEE;

t = d_tmb.t_gett();
if (dlg_create_dialog( (t==T_UNDEFINED)?NULL:t, req, flags)!=0)
return -1;
Expand Down
5 changes: 5 additions & 0 deletions modules/dialog/doc/dialog_admin.xml
Expand Up @@ -1411,6 +1411,11 @@ modparam("dialog", "replicate_profiles_expire", 10)
</para></listitem>
</itemizedlist>
<para>
NOTE: both RE-INVITE and OPTIONS pinging cannot be enabled at the same time
for a single dialog leg. If both flags ("<emphasis>PR</emphasis>" or
"<emphasis>pr</emphasis>") are provided only RE-INVITE pinging will be used.
</para>
<para>
The function returns true if the dialog was successfully created or
if the dialog was previously created.
</para>
Expand Down

0 comments on commit 182ceb0

Please sign in to comment.