- Timestamp:
- Mar 15, 2011 10:49:59 AM (14 years ago)
- Location:
- pjproject/trunk/pjsip/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c
r3441 r3444 392 392 } 393 393 394 PJ_DEF(pj_status_t)395 pjsip_regc_set_delay_before_refresh( pjsip_regc *regc,396 pj_uint32_t delay )397 {398 PJ_ASSERT_RETURN(regc, PJ_EINVAL);399 regc->delay_before_refresh = delay;400 return PJ_SUCCESS;401 }402 403 394 PJ_DEF(pj_status_t) pjsip_regc_set_credentials( pjsip_regc *regc, 404 395 int count, … … 783 774 } 784 775 } 776 777 static void schedule_registration ( pjsip_regc *regc, pj_int32_t expiration ) 778 { 779 if (regc->auto_reg && expiration > 0) { 780 pj_time_val delay = { 0, 0}; 781 782 delay.sec = expiration - regc->delay_before_refresh; 783 if (regc->expires != PJSIP_REGC_EXPIRATION_NOT_SPECIFIED && 784 delay.sec > (pj_int32_t)regc->expires) 785 { 786 delay.sec = regc->expires; 787 } 788 if (delay.sec < DELAY_BEFORE_REFRESH) 789 delay.sec = DELAY_BEFORE_REFRESH; 790 regc->timer.cb = ®c_refresh_timer_cb; 791 regc->timer.id = REFRESH_TIMER; 792 regc->timer.user_data = regc; 793 pjsip_endpt_schedule_timer( regc->endpt, ®c->timer, &delay); 794 pj_gettimeofday(®c->last_reg); 795 regc->next_reg = regc->last_reg; 796 regc->next_reg.sec += delay.sec; 797 } 798 } 799 800 PJ_DEF(pj_status_t) 801 pjsip_regc_set_delay_before_refresh( pjsip_regc *regc, 802 pj_uint32_t delay ) 803 { 804 PJ_ASSERT_RETURN(regc, PJ_EINVAL); 805 806 if (delay > regc->expires) 807 return PJ_ETOOBIG; 808 809 if (regc->delay_before_refresh != delay) 810 { 811 regc->delay_before_refresh = delay; 812 813 if (regc->timer.id != 0) { 814 /* Cancel registration timer */ 815 pjsip_endpt_cancel_timer(regc->endpt, ®c->timer); 816 regc->timer.id = 0; 817 818 /* Schedule next registration */ 819 schedule_registration(regc, regc->expires); 820 } 821 } 822 823 return PJ_SUCCESS; 824 } 825 785 826 786 827 static pj_int32_t calculate_response_expiration(const pjsip_regc *regc, … … 1128 1169 1129 1170 /* Schedule next registration */ 1130 if (regc->auto_reg && expiration > 0) { 1131 pj_time_val delay = { 0, 0}; 1132 1133 delay.sec = expiration - regc->delay_before_refresh; 1134 if (regc->expires != PJSIP_REGC_EXPIRATION_NOT_SPECIFIED && 1135 delay.sec > (pj_int32_t)regc->expires) 1136 { 1137 delay.sec = regc->expires; 1138 } 1139 if (delay.sec < DELAY_BEFORE_REFRESH) 1140 delay.sec = DELAY_BEFORE_REFRESH; 1141 regc->timer.cb = ®c_refresh_timer_cb; 1142 regc->timer.id = REFRESH_TIMER; 1143 regc->timer.user_data = regc; 1144 pjsip_endpt_schedule_timer( regc->endpt, ®c->timer, &delay); 1145 pj_gettimeofday(®c->last_reg); 1146 regc->next_reg = regc->last_reg; 1147 regc->next_reg.sec += delay.sec; 1148 } 1171 schedule_registration(regc, expiration); 1149 1172 1150 1173 } else { -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r3441 r3444 946 946 /* Registration */ 947 947 acc->cfg.reg_timeout = cfg->reg_timeout; 948 acc->cfg.reg_delay_before_refresh = cfg->reg_delay_before_refresh;949 948 acc->cfg.unreg_timeout = cfg->unreg_timeout; 950 949 acc->cfg.allow_contact_rewrite = cfg->allow_contact_rewrite; 951 950 acc->cfg.reg_retry_interval = cfg->reg_retry_interval; 952 951 acc->cfg.drop_calls_on_reg_fail = cfg->drop_calls_on_reg_fail; 952 if (acc->cfg.reg_delay_before_refresh != cfg->reg_delay_before_refresh) { 953 acc->cfg.reg_delay_before_refresh = cfg->reg_delay_before_refresh; 954 pjsip_regc_set_delay_before_refresh(acc->regc, 955 cfg->reg_delay_before_refresh); 956 } 953 957 954 958 /* Normalize registration timeout and refresh delay */
Note: See TracChangeset
for help on using the changeset viewer.