Changeset 5490


Ignore:
Timestamp:
Dec 6, 2016 7:29:11 AM (2 years ago)
Author:
ming
Message:

Fixed #1982: Add option to reinitialize call media transports

Location:
pjproject/trunk/pjsip
Files:
3 edited

Legend:

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

    r5455 r5490  
    42854285     * PJSUA_CALL_UNHOLD will take precedence over this flag. 
    42864286     */ 
    4287     PJSUA_CALL_NO_SDP_OFFER = 8 
     4287    PJSUA_CALL_NO_SDP_OFFER = 8, 
     4288 
     4289    /** 
     4290     * Deinitialize and recreate media, including media transport. This flag 
     4291     * is useful in IP address change situation, if the media transport 
     4292     * address (or address family) changes, for example during IPv4/IPv6 
     4293     * network handover. 
     4294     * This flag is only valid for #pjsua_call_reinvite()/reinvite2(), or 
     4295     * #pjsua_call_update()/update2(). 
     4296     * 
     4297     * Warning: If the re-INVITE/UPDATE fails, the old media will not be 
     4298     * reverted. 
     4299     */ 
     4300    PJSUA_CALL_REINIT_MEDIA = 16 
    42884301 
    42894302} pjsua_call_flag; 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r5329 r5490  
    570570{ 
    571571    opt->flag &= ~(PJSUA_CALL_UNHOLD | PJSUA_CALL_UPDATE_CONTACT | 
    572                    PJSUA_CALL_NO_SDP_OFFER); 
     572                   PJSUA_CALL_NO_SDP_OFFER | PJSUA_CALL_REINIT_MEDIA); 
    573573} 
    574574 
     
    609609    call->opt = *opt; 
    610610 
     611    if (call->opt.flag & PJSUA_CALL_REINIT_MEDIA) { 
     612        pjsua_media_channel_deinit(call->index); 
     613    } 
     614 
    611615    /* If call is established or media channel hasn't been initialized, 
    612616     * reinit media channel. 
     
    614618    if ((call->inv && call->inv->state == PJSIP_INV_STATE_CONNECTING && 
    615619         call->med_cnt == 0) || 
    616         (call->inv && call->inv->state == PJSIP_INV_STATE_CONFIRMED)) 
     620        (call->inv && call->inv->state == PJSIP_INV_STATE_CONFIRMED) || 
     621        (call->opt.flag & PJSUA_CALL_REINIT_MEDIA)) 
    617622    { 
    618623        pjsip_role_e role = rem_sdp? PJSIP_ROLE_UAS : PJSIP_ROLE_UAC; 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r5489 r5490  
    19761976         * Otherwise, apply media count from the call setting directly. 
    19771977         */ 
    1978         if (reinit) { 
     1978        if (reinit && (call->opt.flag & PJSUA_CALL_REINIT_MEDIA) == 0) { 
    19791979 
    19801980            /* We are sending reoffer, check media count for each media type 
Note: See TracChangeset for help on using the changeset viewer.