Changeset 6035 for pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c
- Timestamp:
- Jul 1, 2019 7:12:43 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c
r5984 r6035 46 46 #define REGC_TSX_TIMEOUT 33000 47 47 48 enum { NOEXP = 0x1FFFFFFF};48 enum { NOEXP = PJSIP_REGC_EXPIRATION_NOT_SPECIFIED }; 49 49 50 50 static const pj_str_t XUID_PARAM_NAME = { "x-uid", 5 }; … … 740 740 pj_status_t status, int st_code, 741 741 const pj_str_t *reason, 742 pjsip_rx_data *rdata, pj_ int32_t expiration,742 pjsip_rx_data *rdata, pj_uint32_t expiration, 743 743 int contact_cnt, pjsip_contact_hdr *contact[], 744 744 pj_bool_t is_unreg) … … 751 751 cbparam->rdata = rdata; 752 752 cbparam->contact_cnt = contact_cnt; 753 cbparam->expiration = (expiration >= 0? expiration:754 753 cbparam->expiration = (expiration != PJSIP_REGC_EXPIRATION_NOT_SPECIFIED? 754 expiration: regc->expires_requested); 755 755 cbparam->is_unreg = is_unreg; 756 756 if (contact_cnt) { … … 762 762 static void call_callback(pjsip_regc *regc, pj_status_t status, int st_code, 763 763 const pj_str_t *reason, 764 pjsip_rx_data *rdata, pj_ int32_t expiration,764 pjsip_rx_data *rdata, pj_uint32_t expiration, 765 765 int contact_cnt, pjsip_contact_hdr *contact[], 766 766 pj_bool_t is_unreg) … … 799 799 char errmsg[PJ_ERR_MSG_SIZE]; 800 800 pj_str_t reason = pj_strerror(status, errmsg, sizeof(errmsg)); 801 call_callback(regc, status, 400, &reason, NULL, -1, 0, NULL,801 call_callback(regc, status, 400, &reason, NULL, NOEXP, 0, NULL, 802 802 PJ_FALSE); 803 803 } … … 809 809 } 810 810 811 static void schedule_registration ( pjsip_regc *regc, pj_ int32_t expiration )812 { 813 if (regc->auto_reg && expiration > 0 ) {811 static void schedule_registration ( pjsip_regc *regc, pj_uint32_t expiration ) 812 { 813 if (regc->auto_reg && expiration > 0 && expiration != NOEXP) { 814 814 pj_time_val delay = { 0, 0}; 815 815 … … 893 893 894 894 895 static pj_ int32_t calculate_response_expiration(const pjsip_regc *regc,896 const pjsip_rx_data *rdata,897 unsigned *contact_cnt,898 unsigned max_contact,899 pjsip_contact_hdr *contacts[])900 { 901 pj_ int32_t expiration = NOEXP;895 static pj_uint32_t calculate_response_expiration(const pjsip_regc *regc, 896 const pjsip_rx_data *rdata, 897 unsigned *contact_cnt, 898 unsigned max_contact, 899 pjsip_contact_hdr *contacts[]) 900 { 901 pj_uint32_t expiration = NOEXP; 902 902 const pjsip_msg *msg = rdata->msg_info.msg; 903 903 const pjsip_hdr *hdr; … … 983 983 has_our_contact = PJ_TRUE; 984 984 985 if (contacts[i]->expires >= 0 &&986 contacts[i]->expires < expiration)985 if (contacts[i]->expires != PJSIP_EXPIRES_NOT_SPECIFIED 986 && contacts[i]->expires < expiration) 987 987 { 988 988 /* Get the lowest expiration time. */ … … 1038 1038 1039 1039 if (*contact_cnt == our_contact_cnt && *contact_cnt && 1040 contacts[0]->expires >= 0)1040 contacts[0]->expires != PJSIP_EXPIRES_NOT_SPECIFIED) 1041 1041 { 1042 1042 expiration = contacts[0]->expires; … … 1098 1098 (event->body.tsx_state.type==PJSIP_EVENT_RX_MSG) ? 1099 1099 event->body.tsx_state.src.rdata : NULL, 1100 -1, 0, NULL, PJ_FALSE);1100 NOEXP, 0, NULL, PJ_FALSE); 1101 1101 1102 1102 /* Call regc tsx callback before handling any response */ … … 1118 1118 pjsip_contact_hdr *next = h->next; 1119 1119 1120 if (h->expires == -1) {1120 if (h->expires == PJSIP_EXPIRES_NOT_SPECIFIED) { 1121 1121 pj_list_erase(h); 1122 1122 } … … 1206 1206 call_callback(regc, status, tsx->status_code, 1207 1207 &rdata->msg_info.msg->line.status.reason, 1208 rdata, -1, 0, NULL, is_unreg);1208 rdata, NOEXP, 0, NULL, is_unreg); 1209 1209 pj_lock_acquire(regc->lock); 1210 1210 } … … 1233 1233 pjsip_min_expires_hdr *me_hdr; 1234 1234 pjsip_tx_data *tdata; 1235 pj_ int32_t min_exp;1235 pj_uint32_t min_exp; 1236 1236 1237 1237 /* reset current op */ … … 1295 1295 call_callback(regc, status, tsx->status_code, 1296 1296 &rdata->msg_info.msg->line.status.reason, 1297 rdata, -1, 0, NULL, PJ_FALSE);1297 rdata, NOEXP, 0, NULL, PJ_FALSE); 1298 1298 pj_lock_acquire(regc->lock); 1299 1299 } … … 1307 1307 if (!handled) { 1308 1308 pjsip_rx_data *rdata; 1309 pj_ int32_t expiration = NOEXP;1309 pj_uint32_t expiration = NOEXP; 1310 1310 unsigned contact_cnt = 0; 1311 1311 pjsip_contact_hdr *contact[PJSIP_REGC_MAX_CONTACT]; … … 1331 1331 1332 1332 /* Update registration */ 1333 if (expiration==NOEXP) expiration=-1;1333 // if (expiration==NOEXP) expiration=-1; 1334 1334 regc->expires = expiration; 1335 1335
Note: See TracChangeset
for help on using the changeset viewer.