diff options
author | Benny Prijono <bennylp@teluu.com> | 2011-03-16 03:52:20 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2011-03-16 03:52:20 +0000 |
commit | 84b666666eadfe8d2c853d7b04e4dda831890ed9 (patch) | |
tree | 9f903867bd66875267d9a2a58439c4a6499cc1b4 /pjsip/src | |
parent | bfd49295b48a31eae9d7d9d8c018eea8e193179c (diff) |
Fixed #1209: new enhancement: Option to update Contact URI when sending re-INVITE or UPDATE
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3452 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_call.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c index 5a4ab2f7..4d95066b 100644 --- a/pjsip/src/pjsua-lib/pjsua_call.c +++ b/pjsip/src/pjsua-lib/pjsua_call.c @@ -1660,10 +1660,11 @@ PJ_DEF(pj_status_t) pjsua_call_set_hold(pjsua_call_id call_id, * Send re-INVITE (to release hold). */ PJ_DEF(pj_status_t) pjsua_call_reinvite( pjsua_call_id call_id, - pj_bool_t unhold, + unsigned options, const pjsua_msg_data *msg_data) { pjmedia_sdp_session *sdp; + pj_str_t *new_contact = NULL; pjsip_tx_data *tdata; pjsua_call *call; pjsip_dialog *dlg; @@ -1684,7 +1685,7 @@ PJ_DEF(pj_status_t) pjsua_call_reinvite( pjsua_call_id call_id, } /* Create SDP */ - if (call->local_hold && !unhold) { + if (call->local_hold && (options & PJSUA_CALL_UNHOLD)==0) { status = create_sdp_of_call_hold(call, &sdp); } else { status = pjsua_media_channel_create_sdp(call->index, @@ -1699,8 +1700,14 @@ PJ_DEF(pj_status_t) pjsua_call_reinvite( pjsua_call_id call_id, return status; } + if ((options & PJSUA_CALL_UPDATE_CONTACT) & + pjsua_acc_is_valid(call->acc_id)) + { + new_contact = &pjsua_var.acc[call->acc_id].contact; + } + /* Create re-INVITE with new offer */ - status = pjsip_inv_reinvite( call->inv, NULL, sdp, &tdata); + status = pjsip_inv_reinvite( call->inv, new_contact, sdp, &tdata); if (status != PJ_SUCCESS) { pjsua_perror(THIS_FILE, "Unable to create re-INVITE", status); pjsip_dlg_dec_lock(dlg); @@ -1732,6 +1739,7 @@ PJ_DEF(pj_status_t) pjsua_call_update( pjsua_call_id call_id, const pjsua_msg_data *msg_data) { pjmedia_sdp_session *sdp; + pj_str_t *new_contact = NULL; pjsip_tx_data *tdata; pjsua_call *call; pjsip_dialog *dlg; @@ -1757,8 +1765,14 @@ PJ_DEF(pj_status_t) pjsua_call_update( pjsua_call_id call_id, return status; } + if ((options & PJSUA_CALL_UPDATE_CONTACT) & + pjsua_acc_is_valid(call->acc_id)) + { + new_contact = &pjsua_var.acc[call->acc_id].contact; + } + /* Create UPDATE with new offer */ - status = pjsip_inv_update(call->inv, NULL, sdp, &tdata); + status = pjsip_inv_update(call->inv, new_contact, sdp, &tdata); if (status != PJ_SUCCESS) { pjsua_perror(THIS_FILE, "Unable to create UPDATE request", status); pjsip_dlg_dec_lock(dlg); |