Changeset 3339
- Timestamp:
- Oct 12, 2010 12:45:15 PM (14 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r3323 r3339 2798 2798 2799 2799 2800 /* 2801 * Subscription state has changed. 2802 */ 2803 static 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 2800 2831 /** 2801 2832 * Incoming IM message (i.e. MESSAGE request)! … … 4603 4634 app_config.cfg.cb.on_incoming_subscribe = &on_incoming_subscribe; 4604 4635 app_config.cfg.cb.on_buddy_state = &on_buddy_state; 4636 app_config.cfg.cb.on_buddy_evsub_state = &on_buddy_evsub_state; 4605 4637 app_config.cfg.cb.on_pager = &on_pager; 4606 4638 app_config.cfg.cb.on_typing = &on_typing; -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r3330 r3339 687 687 */ 688 688 void (*on_buddy_state)(pjsua_buddy_id buddy_id); 689 690 691 /** 692 * Notify application when the state of client subscription session 693 * associated with a buddy has changed. Application may use this 694 * callback to retrieve more detailed information about the state 695 * changed event. 696 * 697 * @param buddy_id The buddy id. 698 * @param sub Event subscription session. 699 * @param event The event which triggers state change event. 700 */ 701 void (*on_buddy_evsub_state)(pjsua_buddy_id buddy_id, 702 pjsip_evsub *sub, 703 pjsip_event *event); 689 704 690 705 /** -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
r3190 r3339 1558 1558 } 1559 1559 1560 /* Call callback */ 1560 /* Call callbacks */ 1561 if (pjsua_var.ua_cfg.cb.on_buddy_evsub_state) 1562 (*pjsua_var.ua_cfg.cb.on_buddy_evsub_state)(buddy->index, sub, 1563 event); 1564 1561 1565 if (pjsua_var.ua_cfg.cb.on_buddy_state) 1562 1566 (*pjsua_var.ua_cfg.cb.on_buddy_state)(buddy->index); … … 1657 1661 1658 1662 1659 /* Event subscription callback. */1660 static pjsip_evsub_user pres_callback =1661 {1662 &pjsua_evsub_on_state,1663 &pjsua_evsub_on_tsx_state,1664 1665 NULL, /* on_rx_refresh: don't care about SUBSCRIBE refresh, unless1666 * we want to authenticate1667 */1668 1669 &pjsua_evsub_on_rx_notify,1670 1671 NULL, /* on_client_refresh: Use default behaviour, which is to1672 * refresh client subscription. */1673 1674 NULL, /* on_server_timeout: Use default behaviour, which is to send1675 * NOTIFY to terminate.1676 */1677 };1678 1679 1680 1663 /* It does what it says.. */ 1681 1664 static void subscribe_buddy_presence(pjsua_buddy_id buddy_id) 1682 1665 { 1666 pjsip_evsub_user pres_callback; 1683 1667 pj_pool_t *tmp_pool = NULL; 1684 1668 pjsua_buddy *buddy; … … 1688 1672 pjsip_tx_data *tdata; 1689 1673 pj_status_t status; 1674 1675 /* Event subscription callback. */ 1676 pj_bzero(&pres_callback, sizeof(pres_callback)); 1677 pres_callback.on_evsub_state = &pjsua_evsub_on_state; 1678 pres_callback.on_tsx_state = &pjsua_evsub_on_tsx_state; 1679 pres_callback.on_rx_notify = &pjsua_evsub_on_rx_notify; 1690 1680 1691 1681 buddy = &pjsua_var.buddy[buddy_id];
Note: See TracChangeset
for help on using the changeset viewer.