Changeset 1396
- Timestamp:
- Jun 27, 2007 1:01:59 PM (17 years ago)
- Location:
- pjproject/trunk/pjsip/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip-simple/presence.c
r1266 r1396 225 225 pjsip_accept_hdr *accept; 226 226 pjsip_event_hdr *event; 227 pjsip_expires_hdr *expires_hdr;228 unsigned expires;229 227 content_type_e content_type = CONTENT_TYPE_NONE; 230 228 pjsip_evsub *sub; … … 282 280 } 283 281 284 /* Check that expires is not too short. */285 expires_hdr=(pjsip_expires_hdr*)286 pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_EXPIRES, NULL);287 if (expires_hdr) {288 if (expires_hdr->ivalue < 5) {289 return PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_INTERVAL_TOO_BRIEF);290 }291 292 expires = expires_hdr->ivalue;293 if (expires > PRES_DEFAULT_EXPIRES)294 expires = PRES_DEFAULT_EXPIRES;295 296 } else {297 expires = PRES_DEFAULT_EXPIRES;298 }299 300 282 /* Lock dialog */ 301 283 pjsip_dlg_inc_lock(dlg); -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
r1385 r1396 457 457 pjsip_pres_status pres_status; 458 458 pjsip_dialog *dlg; 459 pjsip_expires_hdr *expires_hdr; 460 pjsip_evsub_state ev_state; 459 461 pj_status_t status; 460 462 … … 559 561 pjsip_pres_set_status(sub, &pres_status); 560 562 563 /* Check expires value. If it's zero, send our presense state but 564 * set subscription state to TERMINATED. 565 */ 566 expires_hdr=(pjsip_expires_hdr*) 567 pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_EXPIRES, NULL); 568 569 if (expires_hdr && expires_hdr->ivalue == 0) 570 ev_state = PJSIP_EVSUB_STATE_TERMINATED; 571 else 572 ev_state = PJSIP_EVSUB_STATE_ACTIVE; 573 561 574 /* Create and send the first NOTIFY to active subscription: */ 562 status = pjsip_pres_notify( sub, PJSIP_EVSUB_STATE_ACTIVE, NULL, 563 NULL, &tdata); 575 status = pjsip_pres_notify( sub, ev_state, NULL, NULL, &tdata); 564 576 if (status == PJ_SUCCESS) { 565 577 pjsua_process_msg_data(tdata, NULL);
Note: See TracChangeset
for help on using the changeset viewer.