Commit fc4b1c8b authored by Pekka Pessi's avatar Pekka Pessi

nua_stack.c: allow the application to set the initial CSeq in the dialog.

Application can now use SIPTAG_CSEQ() or SIPTAG_CSEQ_STR() to set the
initial CSeq. Note that the first CSeq actually sent is 1 more than the
number specified in tag.

This is based on a patch contributed by Colin Whittaker.

darcs-hash:20060724184444-65a35-14a0a502adafe6b90374f6ce1d5b79803b0efd5b.gz
parent 86e3f50c
......@@ -1016,11 +1016,11 @@ msg_t *nua_creq_msg(nua_t *nua,
goto error;
}
else {
nta_leg_t *leg = nua->nua_dhandle->nh_ds->ds_leg;
if (sip_add_tl(msg, sip, ta_tags(ta)) < 0
|| (ds->ds_remote_tag &&
sip_to_tag(nh->nh_home, sip->sip_to, ds->ds_remote_tag) < 0)
|| nta_msg_request_complete(msg, nua->nua_dhandle->nh_ds->ds_leg,
method, name, url) < 0
|| (sip->sip_from == NULL &&
sip_add_dup(msg, sip, (sip_header_t *)nua->nua_from) < 0))
goto error;
......@@ -1036,12 +1036,17 @@ msg_t *nua_creq_msg(nua_t *nua,
if (!ds->ds_leg)
goto error;
leg = ds->ds_leg;
if (!sip->sip_from->a_tag &&
sip_from_tag(msg_home(msg), sip->sip_from,
nta_leg_tag(ds->ds_leg, NULL)) < 0)
goto error;
}
if (nta_msg_request_complete(msg, leg, method, name, url) < 0)
goto error;
add_service_route = !restart;
}
......
......@@ -1594,6 +1594,7 @@ int test_register(struct context *ctx)
struct call *a_reg = a->reg, *b_reg = b->reg, *c_reg = c->reg;
struct event *e;
sip_t const *sip;
sip_cseq_t cseq[1];
if (ctx->p)
test_proxy_set_expiration(ctx->p, 5, 5, 10);
......@@ -1663,9 +1664,14 @@ int test_register(struct context *ctx)
TEST_1(a_reg->nh = nua_handle(a->nua, a_reg, TAG_END()));
sip_cseq_init(cseq)->cs_seq = 12;
cseq->cs_method = sip_method_register;
cseq->cs_method_name = sip_method_name_register;
REGISTER(a, a_reg, a_reg->nh, SIPTAG_TO(a->to),
NUTAG_OUTBOUND("natify options-keepalive validate"),
NUTAG_KEEPALIVE(1000),
SIPTAG_CSEQ(cseq),
TAG_END());
run_a_until(ctx, -1, save_until_final_response);
......@@ -1674,6 +1680,7 @@ int test_register(struct context *ctx)
TEST_1(sip = sip_object(e->data->e_msg));
TEST(e->data->e_status, 401);
TEST(sip->sip_status->st_status, 401);
TEST(sip->sip_cseq->cs_seq, 13);
TEST_1(!sip->sip_contact);
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
......@@ -1687,6 +1694,7 @@ int test_register(struct context *ctx)
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_contact);
TEST(sip->sip_cseq->cs_seq, 14);
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment