Changeset 5557 for pjproject


Ignore:
Timestamp:
Feb 20, 2017 1:23:54 AM (3 years ago)
Author:
ming
Message:

Closed #1997: Add setting to retry timer upon transport disconnection failure (503)

Location:
pjproject/trunk/pjsip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsip/sip_config.h

    r5336 r5557  
    12431243 
    12441244/** 
     1245 * Default delay for retrying session refresh request upon 
     1246 * receiving transport error (503). Set it to -1 to end the session 
     1247 * immediately instead. 
     1248 * 
     1249 * Default: 10 seconds 
     1250 */ 
     1251#ifndef PJSIP_SESS_TIMER_RETRY_DELAY 
     1252#   define PJSIP_SESS_TIMER_RETRY_DELAY         10 
     1253#endif 
     1254 
     1255 
     1256/** 
    12451257 * Specify whether the client publication session should queue the 
    12461258 * PUBLISH request should there be another PUBLISH transaction still 
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_timer.c

    r5488 r5557  
    971971 
    972972            PJ_LOG(3, (inv->pool->obj_name,  
    973                         "Receive error %d for refresh request %.*s/cseq=%d, " 
    974                         "stopping session now", st_code,  
    975                         event->body.tsx_state.tsx->method.name.slen, 
     973                        "Receive error %d for refresh request %.*s/cseq=%d", 
     974                        st_code, event->body.tsx_state.tsx->method.name.slen, 
    976975                        event->body.tsx_state.tsx->method.name.ptr, 
    977976                        event->body.tsx_state.tsx->cseq)); 
    978977 
    979             status = pjsip_inv_end_session(inv,  
     978            if (st_code == 503 && PJSIP_SESS_TIMER_RETRY_DELAY >= 0) { 
     979                /* Retry the refresh after some delay */ 
     980                pj_time_val delay = {PJSIP_SESS_TIMER_RETRY_DELAY, 0}; 
     981 
     982                PJ_LOG(3, (inv->pool->obj_name, "Scheduling to retry refresh " 
     983                           "request after %d second(s)", delay.sec)); 
     984 
     985                inv->timer->timer.id = 1; 
     986                pjsip_endpt_schedule_timer(inv->dlg->endpt, 
     987                                           &inv->timer->timer, &delay); 
     988            } else { 
     989                PJ_LOG(3, (inv->pool->obj_name, "Ending session now")); 
     990 
     991                status = pjsip_inv_end_session(inv,  
    980992                                    event->body.tsx_state.tsx->status_code,  
    981993                                    pjsip_get_status_text(st_code),  
    982994                                    &bye); 
    983995 
    984             if (status == PJ_SUCCESS && bye) 
    985                 status = pjsip_inv_send_msg(inv, bye); 
    986  
     996                if (status == PJ_SUCCESS && bye) 
     997                    status = pjsip_inv_send_msg(inv, bye); 
     998            } 
    987999        } 
    9881000    } 
Note: See TracChangeset for help on using the changeset viewer.