Ignore:
Timestamp:
Apr 28, 2009 10:19:49 PM (10 years ago)
Author:
bennylp
Message:

Ticket #760: Enhancements to PUBLISH management (thanks Johan Lantz for the suggestion)

  • Changes in PJSUA-LIB
    • retry with fresh request on 412/Conditional Request Failed response
    • changed default Expires in PUBLISH request to none (we will not put Expires), to avoid getting 423/Interval Too Brief response
    • if the PUBLISH fails for any reason, it will be retried on every PJSUA_PRES_TIMER (default 300 seconds), similar to how failed SUBSCRIBE will be retried
  • Changes to publish.h:
    • added API to add headers in every PUBLISH request
  • Added test scenario in Python unit tests
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c

    r2596 r2661  
    962962 
    963963    if (param->code/100 != 2 || param->status != PJ_SUCCESS) { 
     964 
     965        pjsip_publishc_destroy(param->pubc); 
     966        acc->publish_sess = NULL; 
     967 
    964968        if (param->status != PJ_SUCCESS) { 
    965969            char errmsg[PJ_ERR_MSG_SIZE]; 
     
    969973                      "Client publication (PUBLISH) failed, status=%d, msg=%s", 
    970974                       param->status, errmsg)); 
     975        } else if (param->code == 412) { 
     976            /* 412 (Conditional Request Failed) 
     977             * The PUBLISH refresh has failed, retry with new one. 
     978             */ 
     979            pjsua_pres_init_publish_acc(acc->index); 
     980             
    971981        } else { 
    972982            PJ_LOG(1,(THIS_FILE,  
     
    976986        } 
    977987 
    978         pjsip_publishc_destroy(param->pubc); 
    979         acc->publish_sess = NULL; 
     988    } else { 
     989        if (param->expiration == -1) { 
     990            /* Could happen if server "forgot" to include Expires header 
     991             * in the response. We will not renew, so destroy the pubc. 
     992             */ 
     993            pjsip_publishc_destroy(param->pubc); 
     994            acc->publish_sess = NULL; 
     995        } 
    980996    } 
    981997} 
     
    10921108                                     &acc_cfg->id, &acc_cfg->id, 
    10931109                                     &acc_cfg->id,  
    1094                                      PJSUA_PRES_TIMER); 
     1110                                     PJSUA_PUBLISH_EXPIRATION); 
    10951111        if (status != PJ_SUCCESS) { 
    10961112            acc->publish_sess = NULL; 
     
    16071623                          pj_timer_entry *entry) 
    16081624{ 
     1625    unsigned i; 
    16091626    pj_time_val delay = { PJSUA_PRES_TIMER, 0 }; 
     1627 
     1628    /* Retry failed PUBLISH requests */ 
     1629    for (i=0; i<PJ_ARRAY_SIZE(pjsua_var.acc); ++i) { 
     1630        pjsua_acc *acc = &pjsua_var.acc[i]; 
     1631        if (acc->cfg.publish_enabled && acc->publish_sess==NULL) 
     1632            pjsua_pres_init_publish_acc(acc->index); 
     1633    } 
    16101634 
    16111635    entry->id = PJ_FALSE; 
Note: See TracChangeset for help on using the changeset viewer.