Changeset 3594


Ignore:
Timestamp:
Jun 22, 2011 8:00:20 AM (13 years ago)
Author:
bennylp
Message:

Closed #1313 (Account option to disable registration when account is added) and closed #1314 (New callback to notify application when registration or unregistration has been initiated). Thanks Tony Jago Million for the patch

Location:
pjproject/branches/1.x/pjsip
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.x/pjsip/include/pjsua-lib/pjsua.h

    r3585 r3594  
    604604 
    605605 
     606    /** 
     607     * Notify application when registration or unregistration has been 
     608     * initiated. Note that this only notifies the initial registration 
     609     * and unregistration. Once registration session is active, subsequent 
     610     * refresh will not cause this callback to be called. 
     611     * 
     612     * @param acc_id        The account ID. 
     613     * @param renew         Non-zero for registration and zero for 
     614     *                      unregistration. 
     615     */ 
     616    void (*on_reg_started)(pjsua_acc_id acc_id, pj_bool_t renew); 
     617     
    606618    /** 
    607619     * Notify application when registration status has changed. 
     
    25532565     */ 
    25542566    pjsua_call_hold_type call_hold_type; 
     2567     
     2568     
     2569    /** 
     2570     * Specify whether the account should register as soon as it is 
     2571     * added to the UA. Application can set this to PJ_FALSE and control 
     2572     * the registration manually with pjsua_acc_set_registration(). 
     2573     * 
     2574     * Default: PJ_TRUE 
     2575     */ 
     2576    pj_bool_t         register_on_acc_add; 
    25552577 
    25562578} pjsua_acc_config; 
  • pjproject/branches/1.x/pjsip/src/pjsua-lib/pjsua_acc.c

    r3591 r3594  
    453453 
    454454    /* If accounts has registration enabled, start registration */ 
    455     if (pjsua_var.acc[id].cfg.reg_uri.slen) 
    456         pjsua_acc_set_registration(id, PJ_TRUE); 
    457     else { 
     455    if (pjsua_var.acc[id].cfg.reg_uri.slen) { 
     456        if (pjsua_var.acc[id].cfg.register_on_acc_add) 
     457            pjsua_acc_set_registration(id, PJ_TRUE); 
     458    } else { 
    458459        /* Otherwise subscribe to MWI, if it's enabled */ 
    459460        if (pjsua_var.acc[id].cfg.mwi_enabled) 
     
    20102011        pjsip_regc_get_info(pjsua_var.acc[acc_id].regc, &reg_info); 
    20112012        pjsua_var.acc[acc_id].auto_rereg.reg_tp = reg_info.transport; 
     2013         
     2014        if (pjsua_var.ua_cfg.cb.on_reg_started) { 
     2015            (*pjsua_var.ua_cfg.cb.on_reg_started)(acc_id, renew); 
     2016        } 
    20122017    } 
    20132018 
  • pjproject/branches/1.x/pjsip/src/pjsua-lib/pjsua_core.c

    r3553 r3594  
    194194    pj_list_init(&cfg->sub_hdr_list); 
    195195    cfg->call_hold_type = PJSUA_CALL_HOLD_TYPE_DEFAULT; 
     196    cfg->register_on_acc_add = PJ_TRUE; 
    196197} 
    197198 
Note: See TracChangeset for help on using the changeset viewer.