summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-06-24 18:52:57 +0000
committerBenny Prijono <bennylp@teluu.com>2009-06-24 18:52:57 +0000
commit9e87cf617bf01284f69f2fa3e0ce2c83b50b5465 (patch)
tree4eee65f699b5afa99f6158d87151653d72c8d03e
parent62cda870bf3188a6246277d28543daabb97daf0e (diff)
Ticket #795: merged changes from ticket #794
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.0@2795 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjmedia/src/pjmedia/sdp_neg.c12
-rw-r--r--pjsip/src/pjsip-ua/sip_inv.c15
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c23
3 files changed, 25 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 009b8cee..fca25670 100644
--- a/pjsip/src/pjsip-ua/sip_inv.c
+++ b/pjsip/src/pjsip-ua/sip_inv.c
@@ -2246,11 +2246,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) {
@@ -3617,9 +3622,19 @@ 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) {
+ const pjmedia_sdp_session *lsdp = NULL;
+ pjmedia_sdp_neg_get_neg_local(inv->neg, &lsdp);
+ sdp = (pjmedia_sdp_session*)lsdp;
+ }
}
}
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index c2f9ae2d..5d73faeb 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.
@@ -1507,8 +1492,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) {
@@ -1579,8 +1562,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) {
@@ -1638,8 +1619,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) {
@@ -3309,8 +3288,6 @@ static void pjsua_call_on_create_offer(pjsip_inv_session *inv,
return;
}
- update_sdp_version(call, *offer);
-
PJSUA_UNLOCK();
}