summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h33
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c28
2 files changed, 47 insertions, 14 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index b589f2d1..1d9594c3 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -612,13 +612,15 @@ typedef struct pjsua_call_setting
/**
* Bitmask of #pjsua_call_flag constants.
*
- * Default: 0
+ * Default: PJSUA_CALL_INCLUDE_DISABLED_MEDIA
*/
unsigned flag;
/**
* This flag controls what methods to request keyframe are allowed on
* the call. Value is bitmask of #pjsua_vid_req_keyframe_method.
+ *
+ * Default: PJSUA_VID_REQ_KEYFRAME_SIP_INFO
*/
unsigned req_keyframe_method;
@@ -4085,9 +4087,10 @@ typedef enum pjsua_call_flag
{
/**
* When the call is being put on hold, specify this flag to unhold it.
- * This flag is only valid for #pjsua_call_reinvite(). Note: for
- * compatibility reason, this flag must have value of 1 because
- * previously the unhold option is specified as boolean value.
+ * This flag is only valid for #pjsua_call_reinvite() and
+ * #pjsua_call_update(). Note: for compatibility reason, this flag must
+ * have value of 1 because previously the unhold option is specified as
+ * boolean value.
*/
PJSUA_CALL_UNHOLD = 1,
@@ -4105,7 +4108,11 @@ typedef enum pjsua_call_flag
/**
* Include SDP "m=" line with port set to zero for each disabled media
* (i.e when aud_cnt or vid_cnt is set to zero). This flag is only valid
- * for #pjsua_call_make_call().
+ * for #pjsua_call_make_call(), #pjsua_call_reinvite(), and
+ * #pjsua_call_update(). Note that even this flag is applicable in
+ * #pjsua_call_reinvite() and #pjsua_call_update(), it will only take
+ * effect when the re-INVITE/UPDATE operation regenerates SDP offer,
+ * such as changing audio or video count in the call setting.
*/
PJSUA_CALL_INCLUDE_DISABLED_MEDIA = 4,
@@ -4590,7 +4597,7 @@ PJ_DECL(pj_status_t) pjsua_call_set_hold2(pjsua_call_id call_id,
const pjsua_msg_data *msg_data);
/**
- * Send re-INVITE to release hold.
+ * Send re-INVITE request or release hold.
* The final status of the request itself will be reported on the
* \a on_call_media_state() callback, which inform the application that
* the media state of the call has changed.
@@ -4610,14 +4617,18 @@ PJ_DECL(pj_status_t) pjsua_call_reinvite(pjsua_call_id call_id,
/**
- * Send re-INVITE to release hold.
+ * Send re-INVITE request or release hold.
* The final status of the request itself will be reported on the
* \a on_call_media_state() callback, which inform the application that
* the media state of the call has changed.
*
* @param call_id Call identification.
* @param opt Optional call setting, if NULL, the current call
- * setting will remain unchanged.
+ * setting will be used. Note that to release hold
+ * or update contact or omit SDP offer, this parameter
+ * cannot be NULL and it must specify appropriate flags,
+ * e.g: PJSUA_CALL_UNHOLD, PJSUA_CALL_UPDATE_CONTACT,
+ * PJSUA_CALL_NO_SDP_OFFER.
* @param msg_data Optional message components to be sent with
* the request.
*
@@ -4648,7 +4659,11 @@ PJ_DECL(pj_status_t) pjsua_call_update(pjsua_call_id call_id,
*
* @param call_id Call identification.
* @param opt Optional call setting, if NULL, the current call
- * setting will remain unchanged.
+ * setting will be used. Note that to release hold
+ * or update contact or omit SDP offer, this parameter
+ * cannot be NULL and it must specify appropriate flags,
+ * e.g: PJSUA_CALL_UNHOLD, PJSUA_CALL_UPDATE_CONTACT,
+ * PJSUA_CALL_NO_SDP_OFFER.
* @param msg_data Optional message components to be sent with
* the request.
*
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index fd8bae01..554e512e 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -556,6 +556,18 @@ on_error:
/*
+ * Cleanup call setting flag to avoid one time flags, such as
+ * PJSUA_CALL_UNHOLD, PJSUA_CALL_UPDATE_CONTACT, or
+ * PJSUA_CALL_NO_SDP_OFFER, to be sticky (ticket #1793).
+ */
+static void cleanup_call_setting_flag(pjsua_call_setting *opt)
+{
+ opt->flag &= ~(PJSUA_CALL_UNHOLD | PJSUA_CALL_UPDATE_CONTACT |
+ PJSUA_CALL_NO_SDP_OFFER);
+}
+
+
+/*
* Initialize call settings based on account ID.
*/
PJ_DEF(void) pjsua_call_setting_default(pjsua_call_setting *opt)
@@ -579,8 +591,10 @@ static pj_status_t apply_call_setting(pjsua_call *call,
{
pj_assert(call);
- if (!opt)
+ if (!opt) {
+ cleanup_call_setting_flag(&call->opt);
return PJ_SUCCESS;
+ }
#if !PJMEDIA_HAS_VIDEO
pj_assert(opt->vid_cnt == 0);
@@ -1145,6 +1159,7 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
/* Copy call setting from the replaced call */
call->opt = replaced_call->opt;
+ cleanup_call_setting_flag(&call->opt);
/* Notify application */
if (pjsua_var.ua_cfg.cb.on_call_replace_request) {
@@ -2410,7 +2425,7 @@ PJ_DEF(pj_status_t) pjsua_call_reinvite( pjsua_call_id call_id,
if (options != call->opt.flag)
call->opt.flag = options;
- status = pjsua_call_reinvite2(call_id, NULL, msg_data);
+ status = pjsua_call_reinvite2(call_id, &call->opt, msg_data);
on_return:
if (dlg) pjsip_dlg_dec_lock(dlg);
@@ -2524,7 +2539,7 @@ PJ_DEF(pj_status_t) pjsua_call_update( pjsua_call_id call_id,
if (options != call->opt.flag)
call->opt.flag = options;
- status = pjsua_call_update2(call_id, NULL, msg_data);
+ status = pjsua_call_update2(call_id, &call->opt, msg_data);
on_return:
if (dlg) pjsip_dlg_dec_lock(dlg);
@@ -3951,7 +3966,10 @@ static void pjsua_call_on_rx_offer(pjsip_inv_session *inv,
if (pjsua_var.ua_cfg.cb.on_call_rx_offer) {
pjsip_status_code code = PJSIP_SC_OK;
- pjsua_call_setting opt = call->opt;
+ pjsua_call_setting opt;
+
+ cleanup_call_setting_flag(&call->opt);
+ opt = call->opt;
(*pjsua_var.ua_cfg.cb.on_call_rx_offer)(call->index, offer, NULL,
&code, &opt);
@@ -4373,6 +4391,7 @@ static void on_call_transferred( pjsip_inv_session *inv,
&code);
}
+ cleanup_call_setting_flag(&existing_call->opt);
call_opt = existing_call->opt;
if (pjsua_var.ua_cfg.cb.on_call_transfer_request2) {
(*pjsua_var.ua_cfg.cb.on_call_transfer_request2)(existing_call->index,
@@ -4676,7 +4695,6 @@ static void pjsua_call_on_tsx_state_changed(pjsip_inv_session *inv,
(tsx->status_code!=401 && tsx->status_code!=407))
{
/* Call unhold failed */
- call->opt.flag &= ~PJSUA_CALL_UNHOLD;
call->local_hold = PJ_TRUE;
PJ_LOG(3,(THIS_FILE, "Error releasing hold on call %d (reason=%d)",
call->index, tsx->status_code));