Changeset 4967 for pjproject


Ignore:
Timestamp:
Dec 5, 2014 4:03:06 AM (9 years ago)
Author:
ming
Message:

Fixed #1805: Make UAS as refresher in session timer when UAC doesn't support it (thanks to Glenn Walbran for the patch)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_timer.c

    r4715 r4967  
    10891089            inv->timer->refresher = as_refresher? TR_UAS : TR_UAC; 
    10901090        } else { 
    1091             /* If UAC support timer (currently check the existance of  
    1092              * Session-Expires header in the request), set UAC as refresher. 
     1091            /* If UAC supports timer and Session-Expires header is present 
     1092             * in the request, set UAC as refresher. 
     1093             * If UAC doesn't support timer and a proxy inserts a 
     1094             * Session-Expires header, then UAS has to be the 
     1095             * refresher (according to RFC 4028 Section 9). 
    10931096             */ 
    1094             inv->timer->refresher = se_hdr? TR_UAC : TR_UAS; 
     1097            pj_bool_t uac_supports_timer = PJ_FALSE; 
     1098            pjsip_supported_hdr *sup_hdr; 
     1099             
     1100            sup_hdr = (pjsip_supported_hdr*) 
     1101                      pjsip_msg_find_hdr(msg, PJSIP_H_SUPPORTED, NULL); 
     1102            if (sup_hdr) { 
     1103                unsigned i; 
     1104                 
     1105                for (i = 0; i < sup_hdr->count; i++) { 
     1106                    if (pj_stricmp(&sup_hdr->values[i], &STR_TIMER) == 0) { 
     1107                        uac_supports_timer = PJ_TRUE; 
     1108                        break; 
     1109                    } 
     1110                } 
     1111            } 
     1112            inv->timer->refresher = (uac_supports_timer && se_hdr)? TR_UAC: 
     1113                                    TR_UAS; 
    10951114        } 
    10961115    } 
Note: See TracChangeset for help on using the changeset viewer.