Ignore:
Timestamp:
Oct 12, 2010 12:45:15 PM (12 years ago)
Author:
bennylp
Message:

Closed #1144: New presence callback to report subscription state (thanks Johan Lantz for the suggestion):

  • added on_buddy_evsub_state() callback
  • added sample implementation in pjsua_app.c
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r3323 r3339  
    27982798 
    27992799 
     2800/* 
     2801 * Subscription state has changed. 
     2802 */ 
     2803static void on_buddy_evsub_state(pjsua_buddy_id buddy_id, 
     2804                                 pjsip_evsub *sub, 
     2805                                 pjsip_event *event) 
     2806{ 
     2807    char event_info[80]; 
     2808 
     2809    PJ_UNUSED_ARG(sub); 
     2810 
     2811    event_info[0] = '\0'; 
     2812 
     2813    if (event->type == PJSIP_EVENT_TSX_STATE && 
     2814            event->body.tsx_state.type == PJSIP_EVENT_RX_MSG) 
     2815    { 
     2816        pjsip_rx_data *rdata = event->body.tsx_state.src.rdata; 
     2817        snprintf(event_info, sizeof(event_info), 
     2818                 " (RX %s)", 
     2819                 pjsip_rx_data_get_info(rdata)); 
     2820    } 
     2821 
     2822    PJ_LOG(4,(THIS_FILE, 
     2823              "Buddy %d: subscription state: %s (event: %s%s)", 
     2824              buddy_id, pjsip_evsub_get_state_name(sub), 
     2825              pjsip_event_str(event->type), 
     2826              event_info)); 
     2827 
     2828} 
     2829 
     2830 
    28002831/** 
    28012832 * Incoming IM message (i.e. MESSAGE request)! 
     
    46034634    app_config.cfg.cb.on_incoming_subscribe = &on_incoming_subscribe; 
    46044635    app_config.cfg.cb.on_buddy_state = &on_buddy_state; 
     4636    app_config.cfg.cb.on_buddy_evsub_state = &on_buddy_evsub_state; 
    46054637    app_config.cfg.cb.on_pager = &on_pager; 
    46064638    app_config.cfg.cb.on_typing = &on_typing; 
Note: See TracChangeset for help on using the changeset viewer.