Ignore:
Timestamp:
Oct 12, 2010 12:45:15 PM (14 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/src/pjsua-lib/pjsua_pres.c

    r3190 r3339  
    15581558        } 
    15591559 
    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 
    15611565        if (pjsua_var.ua_cfg.cb.on_buddy_state) 
    15621566            (*pjsua_var.ua_cfg.cb.on_buddy_state)(buddy->index); 
     
    16571661 
    16581662 
    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, unless  
    1666              * we want to authenticate  
    1667              */ 
    1668  
    1669     &pjsua_evsub_on_rx_notify, 
    1670  
    1671     NULL,   /* on_client_refresh: Use default behaviour, which is to  
    1672              * refresh client subscription. */ 
    1673  
    1674     NULL,   /* on_server_timeout: Use default behaviour, which is to send  
    1675              * NOTIFY to terminate.  
    1676              */ 
    1677 }; 
    1678  
    1679  
    16801663/* It does what it says.. */ 
    16811664static void subscribe_buddy_presence(pjsua_buddy_id buddy_id) 
    16821665{ 
     1666    pjsip_evsub_user pres_callback; 
    16831667    pj_pool_t *tmp_pool = NULL; 
    16841668    pjsua_buddy *buddy; 
     
    16881672    pjsip_tx_data *tdata; 
    16891673    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; 
    16901680 
    16911681    buddy = &pjsua_var.buddy[buddy_id]; 
Note: See TracChangeset for help on using the changeset viewer.