Ignore:
Timestamp:
Jun 21, 2010 1:28:55 PM (14 years ago)
Author:
bennylp
Message:

Fixes #1047 (Don't send UPDATE if remote doesn't support it (thanks Bogdan Krakowski for the report)) and fixes #1097 (Support sending UPDATE without SDP). Details:

  • Session timer fixes:
    • will look at remote capability in Allow header
    • if UPDATE is supported, will send UPDATE without SDP first. If this fails, will send UPDATE with SDP
    • otherwise will send re-INVITE
  • PJSUA-LIB will look at dialog's remote capability to determine whether re-INVITE or UPDATE should be sent to change default addresses after ICE negotiation.
  • pjsip_inv_update() now allows NULL offer, in which case the UPDATE will be sent without SDP.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c

    r3208 r3215  
    23942394 
    23952395    /* Verify arguments. */ 
    2396     PJ_ASSERT_RETURN(inv && p_tdata && offer, PJ_EINVAL); 
     2396    PJ_ASSERT_RETURN(inv && p_tdata, PJ_EINVAL); 
    23972397 
    23982398    /* Dialog must have been established */ 
     
    24072407    pjsip_dlg_inc_lock(inv->dlg); 
    24082408 
    2409     /* Process offer */ 
    2410     if (pjmedia_sdp_neg_get_state(inv->neg)!=PJMEDIA_SDP_NEG_STATE_DONE) { 
    2411         PJ_LOG(4,(inv->dlg->obj_name,  
    2412                   "Invalid SDP offer/answer state for UPDATE")); 
    2413         status = PJ_EINVALIDOP; 
    2414         goto on_error; 
    2415     } 
    2416  
    2417     /* Notify negotiator about the new offer. This will fix the offer 
    2418      * with correct SDP origin. 
    2419      */ 
    2420     status = pjmedia_sdp_neg_modify_local_offer(inv->pool_prov, inv->neg, 
    2421                                                 offer); 
    2422     if (status != PJ_SUCCESS) 
    2423         goto on_error; 
    2424  
    2425     /* Retrieve the "fixed" offer from negotiator */ 
    2426     pjmedia_sdp_neg_get_neg_local(inv->neg, &offer); 
     2409    /* Process offer, if any */ 
     2410    if (offer) { 
     2411        if (pjmedia_sdp_neg_get_state(inv->neg)!=PJMEDIA_SDP_NEG_STATE_DONE) { 
     2412            PJ_LOG(4,(inv->dlg->obj_name, 
     2413                      "Invalid SDP offer/answer state for UPDATE")); 
     2414            status = PJ_EINVALIDOP; 
     2415            goto on_error; 
     2416        } 
     2417 
     2418        /* Notify negotiator about the new offer. This will fix the offer 
     2419         * with correct SDP origin. 
     2420         */ 
     2421        status = pjmedia_sdp_neg_modify_local_offer(inv->pool_prov, inv->neg, 
     2422                                                    offer); 
     2423        if (status != PJ_SUCCESS) 
     2424            goto on_error; 
     2425 
     2426        /* Retrieve the "fixed" offer from negotiator */ 
     2427        pjmedia_sdp_neg_get_neg_local(inv->neg, &offer); 
     2428    } 
    24272429 
    24282430    /* Update Contact if required */ 
     
    24502452 
    24512453    /* Attach SDP body */ 
    2452     sdp_copy = pjmedia_sdp_session_clone(tdata->pool, offer); 
    2453     pjsip_create_sdp_body(tdata->pool, sdp_copy, &tdata->msg->body); 
     2454    if (offer) { 
     2455        sdp_copy = pjmedia_sdp_session_clone(tdata->pool, offer); 
     2456        pjsip_create_sdp_body(tdata->pool, sdp_copy, &tdata->msg->body); 
     2457    } 
    24542458 
    24552459    /* Unlock dialog. */ 
     
    28802884    else  
    28812885    { 
     2886        /* Session-Timer needs to see any error responses, to determine 
     2887         * whether peer supports UPDATE with empty body. 
     2888         */ 
     2889        if (tsx->state == PJSIP_TSX_STATE_COMPLETED && 
     2890            tsx->role == PJSIP_ROLE_UAC) 
     2891        { 
     2892            status = handle_timer_response(inv, e->body.tsx_state.src.rdata, 
     2893                                           PJ_FALSE); 
     2894        } 
     2895 
    28822896        tsx_inv_data = (struct tsx_inv_data*)tsx->mod_data[mod_inv.mod.id]; 
    28832897        if (tsx_inv_data == NULL) { 
Note: See TracChangeset for help on using the changeset viewer.