Changeset 4301 for pjproject/trunk


Ignore:
Timestamp:
Nov 26, 2012 2:54:17 AM (12 years ago)
Author:
ming
Message:

Fixes #1596: Fix handling of incoming UPDATE request

File:
1 edited

Legend:

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

    r4208 r4301  
    29582958    neg_state = pjmedia_sdp_neg_get_state(inv->neg); 
    29592959 
     2960    /* If UPDATE doesn't contain SDP, just respond with 200/OK. 
     2961     * This is a valid scenario according to session-timer draft. 
     2962     */ 
     2963    if (rdata->msg_info.msg->body == NULL) { 
     2964 
     2965        status = pjsip_dlg_create_response(inv->dlg, rdata,  
     2966                                           200, NULL, &tdata); 
     2967    } 
    29602968    /* Send 491 if we receive UPDATE while we're waiting for an answer */ 
    2961     if (neg_state == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER) { 
     2969    else if (neg_state == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER) { 
    29622970        status = pjsip_dlg_create_response(inv->dlg, rdata,  
    29632971                                           PJSIP_SC_REQUEST_PENDING, NULL, 
     
    29682976     */ 
    29692977    else if (neg_state == PJMEDIA_SDP_NEG_STATE_REMOTE_OFFER || 
    2970              neg_state == PJMEDIA_SDP_NEG_STATE_WAIT_NEGO) { 
    2971         status = pjsip_dlg_create_response(inv->dlg, rdata,  
     2978             neg_state == PJMEDIA_SDP_NEG_STATE_WAIT_NEGO) 
     2979    { 
     2980        pjsip_retry_after_hdr *ra_hdr; 
     2981        int val; 
     2982 
     2983        status = pjsip_dlg_create_response(inv->dlg, rdata,  
    29722984                                           PJSIP_SC_INTERNAL_SERVER_ERROR, 
    29732985                                           NULL, &tdata); 
    29742986 
    2975     /* If UPDATE doesn't contain SDP, just respond with 200/OK. 
    2976      * This is a valid scenario according to session-timer draft. 
    2977      */ 
    2978     } else if (rdata->msg_info.msg->body == NULL) { 
    2979  
    2980         status = pjsip_dlg_create_response(inv->dlg, rdata,  
    2981                                            200, NULL, &tdata); 
     2987        val = (pj_rand() % 10); 
     2988        ra_hdr = pjsip_retry_after_hdr_create(tdata->pool, val); 
     2989        pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)ra_hdr); 
    29822990 
    29832991    } else { 
Note: See TracChangeset for help on using the changeset viewer.