Changeset 4989


Ignore:
Timestamp:
Mar 3, 2015 7:52:36 AM (10 years ago)
Author:
ming
Message:

Fixed #1819: Use expiration field to indicate registration/unregistration in registration callback

File:
1 edited

Legend:

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

    r4876 r4989  
    8989    pjsip_expires_hdr           *expires_hdr; 
    9090    pj_uint32_t                  expires; 
     91    pj_uint32_t                  expires_requested; 
    9192    pj_uint32_t                  delay_before_refresh; 
    9293    pjsip_route_hdr              route_set; 
     
    214215    else if (regc->auto_reg == 0) 
    215216        info->next_reg = 0; 
    216     else if (regc->expires < 0) 
     217    else if (regc->expires == PJSIP_REGC_EXPIRATION_NOT_SPECIFIED) 
    217218        info->next_reg = regc->expires; 
    218219    else { 
     
    551552 
    552553    pj_lock_acquire(regc->lock); 
     554     
     555    regc->expires_requested = 1; 
    553556 
    554557    status = create_request(regc, &tdata); 
     
    621624        regc->timer.id = 0; 
    622625    } 
     626 
     627    regc->expires_requested = 0; 
    623628 
    624629    status = create_request(regc, &tdata); 
     
    743748    cbparam->rdata = rdata; 
    744749    cbparam->contact_cnt = contact_cnt; 
    745     cbparam->expiration = expiration; 
     750    cbparam->expiration = (expiration >= 0? expiration: 
     751                           regc->expires_requested); 
    746752    if (contact_cnt) { 
    747753        pj_memcpy( cbparam->contact, contact,  
     
    13931399    else 
    13941400        regc->current_op = REGC_REGISTERING; 
     1401     
     1402    if (expires_hdr && expires_hdr->ivalue) 
     1403        regc->expires_requested = expires_hdr->ivalue; 
    13951404 
    13961405    /* Prevent deletion of tdata, e.g: when something wrong in sending, 
Note: See TracChangeset for help on using the changeset viewer.