Changeset 1396


Ignore:
Timestamp:
Jun 27, 2007 1:01:59 PM (12 years ago)
Author:
bennylp
Message:

Ticket #347: Assertion failure when handling incoming presence subscription with Expires=0

Location:
pjproject/trunk/pjsip/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-simple/presence.c

    r1266 r1396  
    225225    pjsip_accept_hdr *accept; 
    226226    pjsip_event_hdr *event; 
    227     pjsip_expires_hdr *expires_hdr; 
    228     unsigned expires; 
    229227    content_type_e content_type = CONTENT_TYPE_NONE; 
    230228    pjsip_evsub *sub; 
     
    282280    } 
    283281 
    284     /* Check that expires is not too short. */ 
    285     expires_hdr=(pjsip_expires_hdr*) 
    286                 pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_EXPIRES, NULL); 
    287     if (expires_hdr) { 
    288         if (expires_hdr->ivalue < 5) { 
    289             return PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_INTERVAL_TOO_BRIEF); 
    290         } 
    291  
    292         expires = expires_hdr->ivalue; 
    293         if (expires > PRES_DEFAULT_EXPIRES) 
    294             expires = PRES_DEFAULT_EXPIRES; 
    295  
    296     } else { 
    297         expires = PRES_DEFAULT_EXPIRES; 
    298     } 
    299      
    300282    /* Lock dialog */ 
    301283    pjsip_dlg_inc_lock(dlg); 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c

    r1385 r1396  
    457457    pjsip_pres_status pres_status; 
    458458    pjsip_dialog *dlg; 
     459    pjsip_expires_hdr *expires_hdr; 
     460    pjsip_evsub_state ev_state; 
    459461    pj_status_t status; 
    460462 
     
    559561    pjsip_pres_set_status(sub, &pres_status); 
    560562 
     563    /* Check expires value. If it's zero, send our presense state but 
     564     * set subscription state to TERMINATED. 
     565     */ 
     566    expires_hdr=(pjsip_expires_hdr*) 
     567                pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_EXPIRES, NULL); 
     568 
     569    if (expires_hdr && expires_hdr->ivalue == 0) 
     570        ev_state = PJSIP_EVSUB_STATE_TERMINATED; 
     571    else 
     572        ev_state = PJSIP_EVSUB_STATE_ACTIVE; 
     573 
    561574    /* Create and send the first NOTIFY to active subscription: */ 
    562     status = pjsip_pres_notify( sub, PJSIP_EVSUB_STATE_ACTIVE, NULL, 
    563                                 NULL, &tdata); 
     575    status = pjsip_pres_notify( sub, ev_state, NULL, NULL, &tdata); 
    564576    if (status == PJ_SUCCESS) { 
    565577        pjsua_process_msg_data(tdata, NULL); 
Note: See TracChangeset for help on using the changeset viewer.