Changeset 4929


Ignore:
Timestamp:
Sep 24, 2014 8:26:33 AM (6 years ago)
Author:
nanang
Message:

Close #1793: Avoid call setting flags PJSUA_CALL_UNHOLD, PJSUA_CALL_UPDATE_CONTACT, and PJSUA_CALL_NO_SDP_OFFER to be sticky or reused in the next calls of pjsua_call_reinvite/update().

Location:
pjproject/trunk/pjsip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r4921 r4929  
    613613     * Bitmask of #pjsua_call_flag constants. 
    614614     * 
    615      * Default: 0 
     615     * Default: PJSUA_CALL_INCLUDE_DISABLED_MEDIA 
    616616     */ 
    617617    unsigned         flag; 
     
    620620     * This flag controls what methods to request keyframe are allowed on 
    621621     * the call. Value is bitmask of #pjsua_vid_req_keyframe_method. 
     622     * 
     623     * Default: PJSUA_VID_REQ_KEYFRAME_SIP_INFO 
    622624     */ 
    623625    unsigned         req_keyframe_method; 
     
    40864088    /** 
    40874089     * When the call is being put on hold, specify this flag to unhold it. 
    4088      * This flag is only valid for #pjsua_call_reinvite(). Note: for 
    4089      * compatibility reason, this flag must have value of 1 because 
    4090      * previously the unhold option is specified as boolean value. 
     4090     * This flag is only valid for #pjsua_call_reinvite() and 
     4091     * #pjsua_call_update(). Note: for compatibility reason, this flag must 
     4092     * have value of 1 because previously the unhold option is specified as 
     4093     * boolean value. 
    40914094     */ 
    40924095    PJSUA_CALL_UNHOLD = 1, 
     
    41064109     * Include SDP "m=" line with port set to zero for each disabled media 
    41074110     * (i.e when aud_cnt or vid_cnt is set to zero). This flag is only valid 
    4108      * for #pjsua_call_make_call(). 
     4111     * for #pjsua_call_make_call(), #pjsua_call_reinvite(), and 
     4112     * #pjsua_call_update(). Note that even this flag is applicable in 
     4113     * #pjsua_call_reinvite() and #pjsua_call_update(), it will only take 
     4114     * effect when the re-INVITE/UPDATE operation regenerates SDP offer, 
     4115     * such as changing audio or video count in the call setting. 
    41094116     */ 
    41104117    PJSUA_CALL_INCLUDE_DISABLED_MEDIA = 4, 
     
    45914598 
    45924599/** 
    4593  * Send re-INVITE to release hold. 
     4600 * Send re-INVITE request or release hold. 
    45944601 * The final status of the request itself will be reported on the 
    45954602 * \a on_call_media_state() callback, which inform the application that 
     
    46114618 
    46124619/** 
    4613  * Send re-INVITE to release hold. 
     4620 * Send re-INVITE request or release hold. 
    46144621 * The final status of the request itself will be reported on the 
    46154622 * \a on_call_media_state() callback, which inform the application that 
     
    46184625 * @param call_id       Call identification. 
    46194626 * @param opt           Optional call setting, if NULL, the current call 
    4620  *                      setting will remain unchanged. 
     4627 *                      setting will be used. Note that to release hold 
     4628 *                      or update contact or omit SDP offer, this parameter 
     4629 *                      cannot be NULL and it must specify appropriate flags, 
     4630 *                      e.g: PJSUA_CALL_UNHOLD, PJSUA_CALL_UPDATE_CONTACT, 
     4631 *                      PJSUA_CALL_NO_SDP_OFFER. 
    46214632 * @param msg_data      Optional message components to be sent with 
    46224633 *                      the request. 
     
    46494660 * @param call_id       Call identification. 
    46504661 * @param opt           Optional call setting, if NULL, the current call 
    4651  *                      setting will remain unchanged. 
     4662 *                      setting will be used. Note that to release hold 
     4663 *                      or update contact or omit SDP offer, this parameter 
     4664 *                      cannot be NULL and it must specify appropriate flags, 
     4665 *                      e.g: PJSUA_CALL_UNHOLD, PJSUA_CALL_UPDATE_CONTACT, 
     4666 *                      PJSUA_CALL_NO_SDP_OFFER. 
    46524667 * @param msg_data      Optional message components to be sent with 
    46534668 *                      the request. 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r4924 r4929  
    557557 
    558558/* 
     559 * Cleanup call setting flag to avoid one time flags, such as 
     560 * PJSUA_CALL_UNHOLD, PJSUA_CALL_UPDATE_CONTACT, or 
     561 * PJSUA_CALL_NO_SDP_OFFER, to be sticky (ticket #1793). 
     562 */ 
     563static void cleanup_call_setting_flag(pjsua_call_setting *opt) 
     564{ 
     565    opt->flag &= ~(PJSUA_CALL_UNHOLD | PJSUA_CALL_UPDATE_CONTACT | 
     566                   PJSUA_CALL_NO_SDP_OFFER); 
     567} 
     568 
     569 
     570/* 
    559571 * Initialize call settings based on account ID. 
    560572 */ 
     
    580592    pj_assert(call); 
    581593 
    582     if (!opt) 
     594    if (!opt) { 
     595        cleanup_call_setting_flag(&call->opt); 
    583596        return PJ_SUCCESS; 
     597    } 
    584598 
    585599#if !PJMEDIA_HAS_VIDEO 
     
    11461160        /* Copy call setting from the replaced call */ 
    11471161        call->opt = replaced_call->opt; 
     1162        cleanup_call_setting_flag(&call->opt); 
    11481163 
    11491164        /* Notify application */ 
     
    24112426        call->opt.flag = options; 
    24122427 
    2413     status = pjsua_call_reinvite2(call_id, NULL, msg_data); 
     2428    status = pjsua_call_reinvite2(call_id, &call->opt, msg_data); 
    24142429 
    24152430on_return: 
     
    25252540        call->opt.flag = options; 
    25262541 
    2527     status = pjsua_call_update2(call_id, NULL, msg_data); 
     2542    status = pjsua_call_update2(call_id, &call->opt, msg_data); 
    25282543 
    25292544on_return: 
     
    39523967    if (pjsua_var.ua_cfg.cb.on_call_rx_offer) { 
    39533968        pjsip_status_code code = PJSIP_SC_OK; 
    3954         pjsua_call_setting opt = call->opt; 
     3969        pjsua_call_setting opt; 
     3970 
     3971        cleanup_call_setting_flag(&call->opt); 
     3972        opt = call->opt; 
    39553973 
    39563974        (*pjsua_var.ua_cfg.cb.on_call_rx_offer)(call->index, offer, NULL, 
     
    43744392    } 
    43754393 
     4394    cleanup_call_setting_flag(&existing_call->opt); 
    43764395    call_opt = existing_call->opt; 
    43774396    if (pjsua_var.ua_cfg.cb.on_call_transfer_request2) { 
     
    46774696        { 
    46784697            /* Call unhold failed */ 
    4679             call->opt.flag &= ~PJSUA_CALL_UNHOLD; 
    46804698            call->local_hold = PJ_TRUE; 
    46814699            PJ_LOG(3,(THIS_FILE, "Error releasing hold on call %d (reason=%d)", 
Note: See TracChangeset for help on using the changeset viewer.