- Timestamp:
- Oct 31, 2007 10:20:31 AM (17 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r1533 r1534 3083 3083 3084 3084 /** 3085 * This specifies how long the library should retry resending SUBSCRIBE 3086 * if the previous SUBSCRIBE failed. 3087 * 3088 * Default: 300 seconds 3089 */ 3090 #ifndef PJSUA_PRES_TIMER 3091 # define PJSUA_PRES_TIMER 300 3092 #endif 3093 3094 3095 /** 3085 3096 * This structure describes buddy configuration when adding a buddy to 3086 3097 * the buddy list with #pjsua_buddy_add(). Application MUST initialize -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
r1424 r1534 23 23 #define THIS_FILE "pjsua_pres.c" 24 24 25 #ifndef PJSUA_PRES_TIMER 26 # define PJSUA_PRES_TIMER 120 27 #endif 25 26 static void subscribe_buddy_presence(unsigned index); 27 28 29 /* 30 * Find buddy. 31 */ 32 static pjsua_buddy_id pjsua_find_buddy(const pjsip_uri *uri) 33 { 34 const pjsip_sip_uri *sip_uri; 35 unsigned i; 36 37 uri = pjsip_uri_get_uri((pjsip_uri*)uri); 38 39 if (!PJSIP_URI_SCHEME_IS_SIP(uri) && !PJSIP_URI_SCHEME_IS_SIPS(uri)) 40 return PJSUA_INVALID_ID; 41 42 sip_uri = (const pjsip_sip_uri*) uri; 43 44 for (i=0; i<PJ_ARRAY_SIZE(pjsua_var.buddy); ++i) { 45 const pjsua_buddy *b = &pjsua_var.buddy[i]; 46 47 if (!pjsua_buddy_is_valid(i)) 48 continue; 49 50 if (pj_stricmp(&sip_uri->user, &b->name)==0 && 51 pj_stricmp(&sip_uri->host, &b->host)==0 && 52 (sip_uri->port==(int)b->port || (sip_uri->port==0 && b->port==5060))) 53 { 54 /* Match */ 55 return i; 56 } 57 } 58 59 return PJSUA_INVALID_ID; 60 } 28 61 29 62 … … 466 499 pjsip_expires_hdr *expires_hdr; 467 500 pjsip_evsub_state ev_state; 501 pjsua_buddy_id buddy_id; 468 502 pj_status_t status; 469 503 … … 596 630 } 597 631 632 633 /* Subscribe to buddy's presence if we're not subscribed */ 634 buddy_id = pjsua_find_buddy(dlg->remote.info->uri); 635 if (buddy_id != PJSUA_INVALID_ID) { 636 pjsua_buddy *b = &pjsua_var.buddy[buddy_id]; 637 if (b->monitor && b->sub == NULL) { 638 PJ_LOG(4,(THIS_FILE, "Received SUBSCRIBE from buddy %d, " 639 "activating outgoing subscription", buddy_id)); 640 subscribe_buddy_presence(buddy_id); 641 } 642 } 598 643 599 644 /* Done: */
Note: See TracChangeset
for help on using the changeset viewer.