Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to call uac_auth() without incrementing CSEQ #1613

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
14 changes: 14 additions & 0 deletions modules/uac/README
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ UAC Module
1.3.3. rr_from_store_param (string)
1.3.4. rr_to_store_param (string)
1.3.5. force_dialog (int)
1.3.6. increment_cseq (int)

1.4. Exported Functions

Expand Down Expand Up @@ -163,6 +164,19 @@ modparam("uac","rr_to_store_param","my_Tparam")
modparam("uac", "force_dialog", yes)
...

1.3.6. increment_cseq (int)

Under most circumstances, SIP Authenication can fail if the
mstocco marked this conversation as resolved.
Show resolved Hide resolved
second INVITE (with the Authorization header) uses the same
CSEQ value. The default behavior is to increment the CSEQ.

Default value is 1.

Example 1.6. Set increment_cseq parameter
...
modparam("uac", "increment_cseq", 1)
...

1.4. Exported Functions

1.4.1. uac_replace_from(display,uri) uac_replace_to(display,uri)
Expand Down
5 changes: 4 additions & 1 deletion modules/uac/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ extern uac_auth_api_t uac_auth_api;
extern str rr_uac_cseq_param;
extern struct rr_binds uac_rrb;
extern struct dlg_binds dlg_api;
extern int increment_cseq;

static inline int apply_urihdr_changes( struct sip_msg *req,
str *uri, str *hdr)
Expand Down Expand Up @@ -120,7 +121,9 @@ int apply_cseq_op(struct sip_msg *msg,int val)
return -1;
}

cseq_no=cseq_no+val;
if (increment_cseq) {
cseq_no=cseq_no+val;
mstocco marked this conversation as resolved.
Show resolved Hide resolved
}
obuf = int2str(cseq_no,&olen);
if (obuf == NULL) {
LM_ERR("Failed to convert new integer to string \n");
Expand Down
18 changes: 18 additions & 0 deletions modules/uac/doc/uac_admin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,24 @@ modparam("uac","rr_to_store_param","my_Tparam")
<programlisting format="linespecific">
...
modparam("uac", "force_dialog", yes)
...
</programlisting>
</example>
</section>

<section id="param_increment_cseq" xreflabel="increment_cseq">
<title><varname>increment_cseq</varname> (int)</title>
<para>
Increment the CSEQ value when calling uac_auth().
</para>
<para>
Default value is yes.
</para>
<example>
<title>Set <varname>increment_cseq</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("uac", "increment_cseq", 1)
...
</programlisting>
</example>
Expand Down
2 changes: 2 additions & 0 deletions modules/uac/uac.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct rr_binds uac_rrb;
uac_auth_api_t uac_auth_api;
int force_dialog = 0;
struct dlg_binds dlg_api;
int increment_cseq = 1;

static int w_replace_from(struct sip_msg* msg, char* p1, char* p2);
static int w_restore_from(struct sip_msg* msg);
Expand Down Expand Up @@ -124,6 +125,7 @@ static param_export_t params[] = {
{"restore_mode", STR_PARAM, &restore_mode_str },
{"restore_passwd", STR_PARAM, &uac_passwd.s },
{"force_dialog", INT_PARAM, &force_dialog },
{"increment_cseq", INT_PARAM, &increment_cseq },
{0, 0, 0}
};

Expand Down