summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-04-23 11:50:25 +0000
committerBenny Prijono <bennylp@teluu.com>2009-04-23 11:50:25 +0000
commit998a1fa8fdb03e9922184fb1202d1e4705086030 (patch)
tree6e82ca2f0629ac5e5ca79a9b92ac3c6d1045ca02
parent0b54cf857cd757da2571a62845894c67fb9e8ecf (diff)
Fixed ticket #794: Bug with generating SDP version in origin line (thanks Joel Dodson for the report)
- the INVITE session now correctly uses the SDP offer "fixed" by the negotiator, hence it will have the correct origin fields. - removed update_sdp_version() from PJSUA-LIB - the negotiator now also fixes the session ID of subsequent answer so that it's identical to the previous SDP git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2643 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjmedia/src/pjmedia/sdp_neg.c12
-rw-r--r--pjsip/src/pjsip-ua/sip_inv.c12
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c23
3 files changed, 22 insertions, 25 deletions
diff --git a/pjmedia/src/pjmedia/sdp_neg.c b/pjmedia/src/pjmedia/sdp_neg.c
index bbc5148e..60ca36ef 100644
--- a/pjmedia/src/pjmedia/sdp_neg.c
+++ b/pjmedia/src/pjmedia/sdp_neg.c
@@ -422,10 +422,18 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_set_local_answer( pj_pool_t *pool,
/* State now is STATE_WAIT_NEGO. */
neg->state = PJMEDIA_SDP_NEG_STATE_WAIT_NEGO;
if (local) {
- if (!neg->initial_sdp) {
+ neg->neg_local_sdp = pjmedia_sdp_session_clone(pool, local);
+ if (neg->initial_sdp) {
+ /* I don't think there is anything in RFC 3264 that mandates
+ * answerer to place the same origin (and increment version)
+ * in the answer, but probably it won't hurt either.
+ * Note that the version will be incremented in
+ * pjmedia_sdp_neg_negotiate()
+ */
+ neg->neg_local_sdp->origin.id = neg->initial_sdp->origin.id;
+ } else {
neg->initial_sdp = pjmedia_sdp_session_clone(pool, local);
}
- neg->neg_local_sdp = pjmedia_sdp_session_clone(pool, local);
} else {
PJ_ASSERT_RETURN(neg->initial_sdp, PJMEDIA_SDPNEG_ENOINITIAL);
neg->neg_local_sdp = pjmedia_sdp_session_clone(pool, neg->initial_sdp);
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c
index 71c5a16a..a54a5f36 100644
--- a/pjsip/src/pjsip-ua/sip_inv.c
+++ b/pjsip/src/pjsip-ua/sip_inv.c
@@ -2248,11 +2248,16 @@ PJ_DEF(pj_status_t) pjsip_inv_update ( pjsip_inv_session *inv,
goto on_error;
}
+ /* Notify negotiator about the new offer. This will fix the offer
+ * with correct SDP origin.
+ */
status = pjmedia_sdp_neg_modify_local_offer(inv->pool,inv->neg,
offer);
if (status != PJ_SUCCESS)
goto on_error;
+ /* Retrieve the "fixed" offer from negotiator */
+ pjmedia_sdp_neg_get_neg_local(inv->neg, &offer);
/* Update Contact if required */
if (new_contact) {
@@ -3619,9 +3624,16 @@ static void inv_on_state_confirmed( pjsip_inv_session *inv, pjsip_event *e)
if (mod_inv.cb.on_create_offer) {
(*mod_inv.cb.on_create_offer)(inv, &sdp);
if (sdp) {
+ /* Notify negotiator about the new offer. This will
+ * fix the offer with correct SDP origin.
+ */
status = pjmedia_sdp_neg_modify_local_offer(dlg->pool,
inv->neg,
sdp);
+
+ /* Retrieve the "fixed" offer from negotiator */
+ if (status==PJ_SUCCESS)
+ pjmedia_sdp_neg_get_neg_local(inv->neg, &sdp);
}
}
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index 2531cd11..746ef0ad 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -78,21 +78,6 @@ static pjsip_redirect_op pjsua_call_on_redirected(pjsip_inv_session *inv,
static pj_status_t create_sdp_of_call_hold(pjsua_call *call,
pjmedia_sdp_session **p_answer);
-/* Update SDP version in the offer */
-static void update_sdp_version(pjsua_call *call,
- pjmedia_sdp_session *sdp)
-{
- const pjmedia_sdp_session *old_sdp = NULL;
- pj_status_t status;
-
- status = pjmedia_sdp_neg_get_active_local(call->inv->neg, &old_sdp);
- if (status != PJ_SUCCESS || old_sdp == NULL)
- return;
-
- sdp->origin.version = old_sdp->origin.version + 1;
-}
-
-
/*
* Callback called by event framework when the xfer subscription state
* has changed.
@@ -1519,8 +1504,6 @@ PJ_DEF(pj_status_t) pjsua_call_set_hold(pjsua_call_id call_id,
return status;
}
- update_sdp_version(call, sdp);
-
/* Create re-INVITE with new offer */
status = pjsip_inv_reinvite( call->inv, NULL, sdp, &tdata);
if (status != PJ_SUCCESS) {
@@ -1591,8 +1574,6 @@ PJ_DEF(pj_status_t) pjsua_call_reinvite( pjsua_call_id call_id,
return status;
}
- update_sdp_version(call, sdp);
-
/* Create re-INVITE with new offer */
status = pjsip_inv_reinvite( call->inv, NULL, sdp, &tdata);
if (status != PJ_SUCCESS) {
@@ -1650,8 +1631,6 @@ PJ_DEF(pj_status_t) pjsua_call_update( pjsua_call_id call_id,
return status;
}
- update_sdp_version(call, sdp);
-
/* Create UPDATE with new offer */
status = pjsip_inv_update(call->inv, NULL, sdp, &tdata);
if (status != PJ_SUCCESS) {
@@ -3321,8 +3300,6 @@ static void pjsua_call_on_create_offer(pjsip_inv_session *inv,
return;
}
- update_sdp_version(call, *offer);
-
PJSUA_UNLOCK();
}