Changeset 843


Ignore:
Timestamp:
Dec 2, 2006 7:25:29 AM (14 years ago)
Author:
bennylp
Message:

Fixed ticket #36: pjsip_regc_unregister() SHOULD NOT unregister all contacts but rather only contact that was previously sent in the registration. In addition, added function pjsip_regc_unregister_all() to unregister all contacts

Location:
pjproject/trunk/pjsip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsip-ua/sip_regc.h

    r799 r843  
    231231 
    232232/** 
    233  * Create REGISTER request to unregister all contacts from server records. 
     233 * Create REGISTER request to unregister the contacts that were previously 
     234 * registered by this client registration. 
    234235 * 
    235236 * @param regc      The client registration structure. 
     
    240241PJ_DECL(pj_status_t) pjsip_regc_unregister(pjsip_regc *regc, 
    241242                                           pjsip_tx_data **p_tdata); 
     243 
     244/** 
     245 * Create REGISTER request to unregister all contacts from server records. 
     246 * Note that this will unregister all registered contact for the AOR 
     247 * including contacts registered by other user agents. To only unregister 
     248 * contact registered by this client registration instance, use 
     249 * #pjsip_regc_unregister() instead. 
     250 * 
     251 * @param regc      The client registration structure. 
     252 * @param p_tdata   Pointer to receive the REGISTER request. 
     253 * 
     254 * @return          PJ_SUCCESS on success. 
     255 */ 
     256PJ_DECL(pj_status_t) pjsip_regc_unregister_all(pjsip_regc *regc, 
     257                                               pjsip_tx_data **p_tdata); 
    242258 
    243259/** 
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c

    r841 r843  
    444444 
    445445    msg = tdata->msg; 
     446    pjsip_msg_add_hdr(msg, pjsip_hdr_shallow_clone(tdata->pool,  
     447                                                   regc->contact_hdr)); 
     448    pjsip_msg_add_hdr( msg, (pjsip_hdr*)regc->unreg_expires_hdr); 
     449 
     450    *p_tdata = tdata; 
     451    return PJ_SUCCESS; 
     452} 
     453 
     454PJ_DEF(pj_status_t) pjsip_regc_unregister_all(pjsip_regc *regc, 
     455                                              pjsip_tx_data **p_tdata) 
     456{ 
     457    pjsip_tx_data *tdata; 
     458    pjsip_msg *msg; 
     459    pj_status_t status; 
     460 
     461    PJ_ASSERT_RETURN(regc && p_tdata, PJ_EINVAL); 
     462 
     463    if (regc->timer.id != 0) { 
     464        pjsip_endpt_cancel_timer(regc->endpt, &regc->timer); 
     465        regc->timer.id = 0; 
     466    } 
     467 
     468    status = create_request(regc, &tdata); 
     469    if (status != PJ_SUCCESS) 
     470        return status; 
     471 
     472    msg = tdata->msg; 
    446473    pjsip_msg_add_hdr( msg, (pjsip_hdr*)regc->unreg_contact_hdr); 
    447474    pjsip_msg_add_hdr( msg, (pjsip_hdr*)regc->unreg_expires_hdr); 
Note: See TracChangeset for help on using the changeset viewer.