@ -9011,6 +9011,20 @@ static int process_sdp_a_image(const char *a, struct sip_pvt *p)
return found ;
return found ;
}
}
/*! \brief Add "Supported" header to sip message. Since some options may
* be disabled in the config , the sip_pvt must be inspected to determine what
* is supported for this dialog . */
static int add_supported_header ( struct sip_pvt * pvt , struct sip_request * req )
{
int res ;
if ( st_get_mode ( pvt ) ! = SESSION_TIMER_MODE_REFUSE ) {
res = add_header ( req , " Supported " , " replaces, timer " ) ;
} else {
res = add_header ( req , " Supported " , " replaces " ) ;
}
return res ;
}
/*! \brief Add header to SIP message */
/*! \brief Add header to SIP message */
static int add_header ( struct sip_request * req , const char * var , const char * value )
static int add_header ( struct sip_request * req , const char * var , const char * value )
{
{
@ -9452,7 +9466,7 @@ static int respprep(struct sip_request *resp, struct sip_pvt *p, const char *msg
if ( ! ast_strlen_zero ( global_useragent ) )
if ( ! ast_strlen_zero ( global_useragent ) )
add_header ( resp , " Server " , global_useragent ) ;
add_header ( resp , " Server " , global_useragent ) ;
add_header ( resp , " Allow " , ALLOWED_METHODS ) ;
add_header ( resp , " Allow " , ALLOWED_METHODS ) ;
add_ header( resp , " Supported " , SUPPORTED_EXTENSIONS ) ;
add_ supported_header( p , resp ) ;
/* If this is an invite, add Session-Timers related headers if the feature is active for this session */
/* If this is an invite, add Session-Timers related headers if the feature is active for this session */
if ( p - > method = = SIP_INVITE & & p - > stimer & & p - > stimer - > st_active = = TRUE & & p - > stimer - > st_active_peer_ua = = TRUE ) {
if ( p - > method = = SIP_INVITE & & p - > stimer & & p - > stimer - > st_active = = TRUE & & p - > stimer - > st_active_peer_ua = = TRUE ) {
@ -10932,7 +10946,7 @@ static int transmit_reinvite_with_sdp(struct sip_pvt *p, int t38version, int old
reqprep ( & req , p , ast_test_flag ( & p - > flags [ 0 ] , SIP_REINVITE_UPDATE ) ? SIP_UPDATE : SIP_INVITE , 0 , 1 ) ;
reqprep ( & req , p , ast_test_flag ( & p - > flags [ 0 ] , SIP_REINVITE_UPDATE ) ? SIP_UPDATE : SIP_INVITE , 0 , 1 ) ;
add_header ( & req , " Allow " , ALLOWED_METHODS ) ;
add_header ( & req , " Allow " , ALLOWED_METHODS ) ;
add_ header( & req , " Supported " , SUPPORTED_EXTENSIONS ) ;
add_ supported_header( p , & req ) ;
if ( sipdebug ) {
if ( sipdebug ) {
if ( oldsdp = = TRUE )
if ( oldsdp = = TRUE )
add_header ( & req , " X-asterisk-Info " , " SIP re-invite (Session-Timers) " ) ;
add_header ( & req , " X-asterisk-Info " , " SIP re-invite (Session-Timers) " ) ;
@ -11328,7 +11342,7 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init,
}
}
add_header ( & req , " Allow " , ALLOWED_METHODS ) ;
add_header ( & req , " Allow " , ALLOWED_METHODS ) ;
add_ header( & req , " Supported " , SUPPORTED_EXTENSIONS ) ;
add_ supported_header( p , & req ) ;
if ( p - > options & & p - > options - > addsipheaders & & p - > owner ) {
if ( p - > options & & p - > options - > addsipheaders & & p - > owner ) {
struct ast_channel * chan = p - > owner ; /* The owner channel */
struct ast_channel * chan = p - > owner ; /* The owner channel */
@ -11883,7 +11897,7 @@ static int transmit_notify_with_sipfrag(struct sip_pvt *p, int cseq, char *messa
add_header ( & req , " Subscription-state " , terminate ? " terminated;reason=noresource " : " active " ) ;
add_header ( & req , " Subscription-state " , terminate ? " terminated;reason=noresource " : " active " ) ;
add_header ( & req , " Content-Type " , " message/sipfrag;version=2.0 " ) ;
add_header ( & req , " Content-Type " , " message/sipfrag;version=2.0 " ) ;
add_header ( & req , " Allow " , ALLOWED_METHODS ) ;
add_header ( & req , " Allow " , ALLOWED_METHODS ) ;
add_ header( & req , " Supported " , SUPPORTED_EXTENSIONS ) ;
add_ supported_header( p , & req ) ;
snprintf ( tmp , sizeof ( tmp ) , " SIP/2.0 %s \r \n " , message ) ;
snprintf ( tmp , sizeof ( tmp ) , " SIP/2.0 %s \r \n " , message ) ;
add_content ( & req , tmp ) ;
add_content ( & req , tmp ) ;
@ -11992,7 +12006,7 @@ static void update_connectedline(struct sip_pvt *p, const void *data, size_t dat
reqprep ( & req , p , ast_test_flag ( & p - > flags [ 0 ] , SIP_REINVITE_UPDATE ) ? SIP_UPDATE : SIP_INVITE , 0 , 1 ) ;
reqprep ( & req , p , ast_test_flag ( & p - > flags [ 0 ] , SIP_REINVITE_UPDATE ) ? SIP_UPDATE : SIP_INVITE , 0 , 1 ) ;
add_header ( & req , " Allow " , ALLOWED_METHODS ) ;
add_header ( & req , " Allow " , ALLOWED_METHODS ) ;
add_ header( & req , " Supported " , SUPPORTED_EXTENSIONS ) ;
add_ supported_header( p , & req ) ;
add_rpid ( & req , p ) ;
add_rpid ( & req , p ) ;
add_sdp ( & req , p , FALSE , TRUE , FALSE ) ;
add_sdp ( & req , p , FALSE , TRUE , FALSE ) ;
@ -12482,7 +12496,7 @@ static int transmit_refer(struct sip_pvt *p, const char *dest)
add_header ( & req , " Refer-To " , referto ) ;
add_header ( & req , " Refer-To " , referto ) ;
add_header ( & req , " Allow " , ALLOWED_METHODS ) ;
add_header ( & req , " Allow " , ALLOWED_METHODS ) ;
add_ header( & req , " Supported " , SUPPORTED_EXTENSIONS ) ;
add_ supported_header( p , & req ) ;
if ( ! ast_strlen_zero ( p - > our_contact ) ) {
if ( ! ast_strlen_zero ( p - > our_contact ) ) {
add_header ( & req , " Referred-By " , p - > our_contact ) ;
add_header ( & req , " Referred-By " , p - > our_contact ) ;
}
}