Ignore:
Timestamp:
Jul 17, 2008 1:53:41 PM (16 years ago)
Author:
bennylp
Message:

Ticket #574: Add new API to know why the outgoing subscription request is terminated and added support for delaying subscription acceptance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-simple/presence.c

    r2039 r2149  
    462462    PJ_ASSERT_RETURN(pres != NULL, PJSIP_SIMPLE_ENOPRESENCE); 
    463463 
    464     /* Must have at least one presence info. */ 
    465     PJ_ASSERT_RETURN(pres->status.info_cnt > 0, PJSIP_SIMPLE_ENOPRESENCEINFO); 
     464    /* Must have at least one presence info, unless state is  
     465     * PJSIP_EVSUB_STATE_TERMINATED. This could happen if subscription 
     466     * has not been active (e.g. we're waiting for user authorization) 
     467     * and remote cancels the subscription. 
     468     */ 
     469    PJ_ASSERT_RETURN(state==PJSIP_EVSUB_STATE_TERMINATED || 
     470                     pres->status.info_cnt > 0, PJSIP_SIMPLE_ENOPRESENCEINFO); 
    466471 
    467472 
     
    475480 
    476481 
    477     /* Create message body to reflect the presence status. */ 
    478     status = pres_create_msg_body( pres, tdata ); 
    479     if (status != PJ_SUCCESS) 
    480         goto on_return; 
    481  
     482    /* Create message body to reflect the presence status.  
     483     * Only do this if we have presence status info to send (see above). 
     484     */ 
     485    if (pres->status.info_cnt > 0) { 
     486        status = pres_create_msg_body( pres, tdata ); 
     487        if (status != PJ_SUCCESS) 
     488            goto on_return; 
     489    } 
    482490 
    483491    /* Done. */ 
     
    508516    PJ_ASSERT_RETURN(pres != NULL, PJSIP_SIMPLE_ENOPRESENCE); 
    509517 
    510     /* Must have at least one presence info. */ 
    511     PJ_ASSERT_RETURN(pres->status.info_cnt > 0, PJSIP_SIMPLE_ENOPRESENCEINFO); 
     518    /* We may not have a presence info yet, e.g. when we receive SUBSCRIBE 
     519     * to refresh subscription while we're waiting for user authorization. 
     520     */ 
     521    //PJ_ASSERT_RETURN(pres->status.info_cnt > 0,  
     522    //                 PJSIP_SIMPLE_ENOPRESENCEINFO); 
    512523 
    513524 
     
    522533 
    523534    /* Create message body to reflect the presence status. */ 
    524     status = pres_create_msg_body( pres, tdata ); 
    525     if (status != PJ_SUCCESS) 
    526         goto on_return; 
    527  
     535    if (pres->status.info_cnt > 0) { 
     536        status = pres_create_msg_body( pres, tdata ); 
     537        if (status != PJ_SUCCESS) 
     538            goto on_return; 
     539    } 
    528540 
    529541    /* Done. */ 
Note: See TracChangeset for help on using the changeset viewer.