diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-11-06 08:59:17 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-11-06 08:59:17 +0000 |
commit | 9e623dad8dbe5e4a011143b16ea96a5034f50d8e (patch) | |
tree | 55999b7c4a7131e1b48d0ea0c94281a93578cf49 | |
parent | a35c3aa14ad42074b05e701de0a8f0edc065a80d (diff) |
Fixed bug in route set calculation: prevent updating route set upon receiving failure response (e.g. 401/407 response), and remove the first_cseq check since this would not work when the first request is challenged
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1555 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjsip/src/pjsip/sip_dialog.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/pjsip/src/pjsip/sip_dialog.c b/pjsip/src/pjsip/sip_dialog.c index 595574aa..09954c6b 100644 --- a/pjsip/src/pjsip/sip_dialog.c +++ b/pjsip/src/pjsip/sip_dialog.c @@ -1560,9 +1560,12 @@ static void dlg_update_routeset(pjsip_dialog *dlg, const pjsip_rx_data *rdata) if (msg->type != PJSIP_RESPONSE_MSG) return; - /* Ignore subsequent responses with higher CSeq than initial CSeq */ - if (msg_cseq != dlg->local.first_cseq) - return; + /* Ignore subsequent responses with higher CSeq than initial CSeq. + * Unfortunately this would be broken when the first request is + * challenged! + */ + //if (msg_cseq != dlg->local.first_cseq) + // return; } else { @@ -1577,6 +1580,10 @@ static void dlg_update_routeset(pjsip_dialog *dlg, const pjsip_rx_data *rdata) /* Based on the checks above, we should only get response message here */ pj_assert(msg->type == PJSIP_RESPONSE_MSG); + /* Ignore if this is not 1xx or 2xx response */ + if (msg->line.status.code >= 300) + return; + /* Reset route set */ pj_list_init(&dlg->route_set); @@ -1591,6 +1598,8 @@ static void dlg_update_routeset(pjsip_dialog *dlg, const pjsip_rx_data *rdata) } } + PJ_LOG(5,(dlg->obj_name, "Route-set updated")); + /* Freeze the route set only when the route set comes in 2xx response. * If it is in 1xx response, prepare to recompute the route set when * the 2xx response comes in. @@ -1599,9 +1608,15 @@ static void dlg_update_routeset(pjsip_dialog *dlg, const pjsip_rx_data *rdata) * is established with reliable provisional response, but I think * it is safer to not freeze the route set (thus recompute the route set * upon receiving 2xx response). Also RFC 3261 says so in 13.2.2.4. + * + * The pjsip_method_creates_dialog() check protects from wrongly + * freezing the route set upon receiving 200/OK response for PRACK. */ - if (PJSIP_IS_STATUS_IN_CLASS(msg->line.status.code, 200)) { + if (pjsip_method_creates_dialog(&rdata->msg_info.cseq->method) && + PJSIP_IS_STATUS_IN_CLASS(msg->line.status.code, 200)) + { dlg->route_set_frozen = PJ_TRUE; + PJ_LOG(5,(dlg->obj_name, "Route-set frozen")); } } |