Ignore:
Timestamp:
Jul 2, 2006 2:53:05 PM (18 years ago)
Author:
bennylp
Message:

Final changeset from the PROTOS testing, fixed misc. crashes. See
mailing list archive for the details

File:
1 edited

Legend:

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

    r500 r576  
    233233    method = &rdata->msg_info.msg->line.req.method; 
    234234 
    235     if (method->id == PJSIP_INVITE_METHOD || 
    236         method->id == PJSIP_CANCEL_METHOD || 
    237         method->id == PJSIP_BYE_METHOD) 
     235    if (method->id == PJSIP_INVITE_METHOD) { 
     236        return PJ_TRUE; 
     237    } 
     238 
     239    /* BYE and CANCEL must have existing invite session */ 
     240    if (method->id == PJSIP_BYE_METHOD || 
     241        method->id == PJSIP_CANCEL_METHOD) 
    238242    { 
     243        if (inv == NULL) 
     244            return PJ_FALSE; 
     245 
    239246        return PJ_TRUE; 
    240247    } 
     
    781788 
    782789        *p_tdata = tdata; 
     790 
     791        /* Can not return PJ_SUCCESS when response message is produced. 
     792         * Ref: PROTOS test ~#2490 
     793         */ 
     794        if (status == PJ_SUCCESS) 
     795            status = PJSIP_ERRNO_FROM_SIP_STATUS(code); 
     796 
    783797    } 
    784798 
     
    22052219 
    22062220    } 
    2207  
     2221    else if (tsx->method.id == PJSIP_CANCEL_METHOD && 
     2222             tsx->role == PJSIP_ROLE_UAS && 
     2223             tsx->status_code < 200 && 
     2224             e->body.tsx_state.type == PJSIP_EVENT_RX_MSG)  
     2225    { 
     2226 
     2227        /* 
     2228         * Handle strandled incoming CANCEL. 
     2229         */ 
     2230        pjsip_rx_data *rdata = e->body.tsx_state.src.rdata; 
     2231        pjsip_tx_data *tdata; 
     2232        pj_status_t status; 
     2233 
     2234        status = pjsip_dlg_create_response(dlg, rdata, 200, NULL, &tdata); 
     2235        if (status != PJ_SUCCESS) return; 
     2236 
     2237        status = pjsip_dlg_send_response(dlg, tsx, tdata); 
     2238        if (status != PJ_SUCCESS) return; 
     2239 
     2240    } 
    22082241} 
    22092242 
     
    22432276 
    22442277        inv_respond_incoming_bye( inv, tsx, e->body.tsx_state.src.rdata, e ); 
     2278 
     2279    } 
     2280    else if (tsx->method.id == PJSIP_CANCEL_METHOD && 
     2281             tsx->role == PJSIP_ROLE_UAS && 
     2282             tsx->status_code < 200 && 
     2283             e->body.tsx_state.type == PJSIP_EVENT_RX_MSG)  
     2284    { 
     2285 
     2286        /* 
     2287         * Handle strandled incoming CANCEL. 
     2288         */ 
     2289        pjsip_rx_data *rdata = e->body.tsx_state.src.rdata; 
     2290        pjsip_tx_data *tdata; 
     2291        pj_status_t status; 
     2292 
     2293        status = pjsip_dlg_create_response(dlg, rdata, 200, NULL, &tdata); 
     2294        if (status != PJ_SUCCESS) return; 
     2295 
     2296        status = pjsip_dlg_send_response(dlg, tsx, tdata); 
     2297        if (status != PJ_SUCCESS) return; 
    22452298 
    22462299    } 
     
    23782431    PJ_ASSERT_ON_FAIL(tsx && dlg, return); 
    23792432 
    2380     if (tsx->method.id == PJSIP_BYE_METHOD && 
    2381         tsx->role == PJSIP_ROLE_UAS && 
     2433    if (tsx->role == PJSIP_ROLE_UAS && 
    23822434        tsx->status_code < 200 && 
    23832435        e->body.tsx_state.type == PJSIP_EVENT_RX_MSG)  
    23842436    { 
     2437        pjsip_rx_data *rdata = e->body.tsx_state.src.rdata; 
    23852438 
    23862439        /* 
    2387          * Be nice, handle incoming BYE. 
     2440         * Respond BYE with 200/OK 
    23882441         */ 
    2389  
    2390         inv_respond_incoming_bye( inv, tsx, e->body.tsx_state.src.rdata, e ); 
    2391  
    2392     } 
    2393 } 
    2394  
     2442        if (tsx->method.id == PJSIP_BYE_METHOD) { 
     2443            inv_respond_incoming_bye( inv, tsx, rdata, e ); 
     2444        } else if (tsx->method.id == PJSIP_CANCEL_METHOD) { 
     2445            /* 
     2446             * Respond CANCEL with 200/OK too. 
     2447             */ 
     2448            pjsip_tx_data *tdata; 
     2449            pj_status_t status; 
     2450 
     2451            status = pjsip_dlg_create_response(dlg, rdata, 200, NULL, &tdata); 
     2452            if (status != PJ_SUCCESS) return; 
     2453 
     2454            status = pjsip_dlg_send_response(dlg, tsx, tdata); 
     2455            if (status != PJ_SUCCESS) return; 
     2456 
     2457        } 
     2458    } 
     2459} 
     2460 
Note: See TracChangeset for help on using the changeset viewer.