diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-02-22 22:18:58 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-02-22 22:18:58 +0000 |
commit | 210bdf1f9c1c9681d1cee6978cfc3bcdafbd79a4 (patch) | |
tree | 75858085a2c6b4d7a5a99b8865dec0308ac4a492 /pjsip | |
parent | 540845cd6f9f9cdb4de5ec36628fa4a4823aa543 (diff) |
Fixed bug in registration (CSeq not incremented after 401)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@219 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/src/pjsip-ua/sip_reg.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pjsip/src/pjsip-ua/sip_reg.c b/pjsip/src/pjsip-ua/sip_reg.c index 6a614bc2..84fb57dd 100644 --- a/pjsip/src/pjsip-ua/sip_reg.c +++ b/pjsip/src/pjsip-ua/sip_reg.c @@ -30,6 +30,7 @@ #include <pj/os.h> #include <pj/pool.h> #include <pj/log.h> +#include <pj/rand.h> #include <pj/string.h> @@ -266,7 +267,7 @@ PJ_DEF(pj_status_t) pjsip_regc_init( pjsip_regc *regc, /* Set "CSeq" header. */ regc->cseq_hdr = pjsip_cseq_hdr_create(regc->pool); - regc->cseq_hdr->cseq = 0; + regc->cseq_hdr->cseq = pj_rand() % 0xFFFF; pjsip_method_set( ®c->cseq_hdr->method, PJSIP_REGISTER_METHOD); /* Create "Contact" header used in unregistration. */ @@ -591,6 +592,8 @@ static void tsx_callback(void *token, pjsip_event *event) PJ_DEF(pj_status_t) pjsip_regc_send(pjsip_regc *regc, pjsip_tx_data *tdata) { pj_status_t status; + pjsip_cseq_hdr *cseq_hdr; + pj_uint32_t cseq; /* Make sure we don't have pending transaction. */ if (regc->pending_tsx) { @@ -602,7 +605,9 @@ PJ_DEF(pj_status_t) pjsip_regc_send(pjsip_regc *regc, pjsip_tx_data *tdata) pjsip_tx_data_invalidate_msg(tdata); /* Increment CSeq */ - regc->cseq_hdr->cseq++; + cseq = ++regc->cseq_hdr->cseq; + cseq_hdr = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ, NULL); + cseq_hdr->cseq = cseq; /* Send. */ status = pjsip_endpt_send_request(regc->endpt, tdata, -1, regc, &tsx_callback); |