Changeset 4923


Ignore:
Timestamp:
Sep 15, 2014 9:04:21 AM (10 years ago)
Author:
ming
Message:

Fixed #1783: Restart ICE if a mid-dialog re-INVITE contains no offer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r4920 r4923  
    3434 */ 
    3535#define LOCK_CODEC_MAX_RETRY         5 
     36 
     37/* Determine whether we should restart ICE upon receiving a re-INVITE 
     38 * with no SDP. 
     39 */ 
     40#define RESTART_ICE_ON_REINVITE      1 
    3641 
    3742/* 
     
    40014006    pjsua_call *call; 
    40024007    pj_status_t status; 
     4008    unsigned mi; 
    40034009 
    40044010    pj_log_push_indent(); 
     
    40104016        goto on_return; 
    40114017    } 
     4018     
     4019#if RESTART_ICE_ON_REINVITE 
     4020 
     4021    /* Ticket #1783, RFC 5245 section 12.5: 
     4022     * If an agent receives a mid-dialog re-INVITE that contains no offer, 
     4023     * it MUST restart ICE for each media stream and go through the process 
     4024     * of gathering new candidates. 
     4025     */ 
     4026    for (mi=0; mi<call->med_cnt; ++mi) { 
     4027        pjsua_call_media *call_med = &call->media[mi]; 
     4028        pjmedia_transport_info tpinfo; 
     4029        pjmedia_ice_transport_info *ice_info; 
     4030 
     4031        /* Check if the media is using ICE */ 
     4032        pjmedia_transport_info_init(&tpinfo); 
     4033        pjmedia_transport_get_info(call_med->tp, &tpinfo); 
     4034        ice_info = (pjmedia_ice_transport_info*) 
     4035                    pjmedia_transport_info_get_spc_info( 
     4036                        &tpinfo, PJMEDIA_TRANSPORT_TYPE_ICE); 
     4037        if (!ice_info) 
     4038            continue; 
     4039 
     4040        /* Stop and re-init ICE stream transport. 
     4041         * According to RFC 5245 section 9.1.1.1, during ICE restart, 
     4042         * media can continue to be sent to the previously validated pair. 
     4043         */ 
     4044        pjmedia_transport_media_stop(call_med->tp); 
     4045        pjmedia_transport_media_create(call_med->tp, call->inv->pool_prov, 
     4046                                       0, NULL, mi); 
     4047 
     4048        PJ_LOG(4, (THIS_FILE, "Restarting ICE for media %d", mi)); 
     4049    } 
     4050#endif 
    40124051 
    40134052    /* See if we've put call on hold. */ 
Note: See TracChangeset for help on using the changeset viewer.