@ -2865,7 +2865,6 @@ static pjsip_module session_reinvite_module = {
. on_rx_request = session_reinvite_on_rx_request ,
. on_rx_request = session_reinvite_on_rx_request ,
} ;
} ;
void ast_sip_session_send_request_with_cb ( struct ast_sip_session * session , pjsip_tx_data * tdata ,
void ast_sip_session_send_request_with_cb ( struct ast_sip_session * session , pjsip_tx_data * tdata ,
ast_sip_session_response_cb on_response )
ast_sip_session_response_cb on_response )
{
{
@ -3120,6 +3119,8 @@ struct ast_sip_session *ast_sip_session_alloc(struct ast_sip_endpoint *endpoint,
return NULL ;
return NULL ;
}
}
session - > authentication_challenge_count = 0 ;
/* Fire seesion begin handlers */
/* Fire seesion begin handlers */
handle_session_begin ( session ) ;
handle_session_begin ( session ) ;
@ -3289,6 +3290,10 @@ static pj_bool_t outbound_invite_auth(pjsip_rx_data *rdata)
}
}
ast_debug ( 3 , " %s: Initial INVITE is being challenged. \n " , ast_sip_session_get_name ( session ) ) ;
ast_debug ( 3 , " %s: Initial INVITE is being challenged. \n " , ast_sip_session_get_name ( session ) ) ;
if ( + + session - > authentication_challenge_count > MAX_RX_CHALLENGES ) {
ast_debug ( 3 , " %s: Initial INVITE reached maximum number of auth attempts. \n " , ast_sip_session_get_name ( session ) ) ;
return PJ_FALSE ;
}
if ( ast_sip_create_request_with_auth ( & session - > endpoint - > outbound_auths , rdata ,
if ( ast_sip_create_request_with_auth ( & session - > endpoint - > outbound_auths , rdata ,
tsx - > last_tx , & tdata ) ) {
tsx - > last_tx , & tdata ) ) {
@ -4696,6 +4701,7 @@ static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_trans
ast_sip_session_get_name ( session ) ,
ast_sip_session_get_name ( session ) ,
tsx - > status_code ) ;
tsx - > status_code ) ;
if ( ( tsx - > status_code = = 401 | | tsx - > status_code = = 407 )
if ( ( tsx - > status_code = = 401 | | tsx - > status_code = = 407 )
& & + + session - > authentication_challenge_count < MAX_RX_CHALLENGES
& & ! ast_sip_create_request_with_auth (
& & ! ast_sip_create_request_with_auth (
& session - > endpoint - > outbound_auths ,
& session - > endpoint - > outbound_auths ,
e - > body . tsx_state . src . rdata , tsx - > last_tx , & tdata ) ) {
e - > body . tsx_state . src . rdata , tsx - > last_tx , & tdata ) ) {
@ -4789,6 +4795,7 @@ static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_trans
( int ) pj_strlen ( & tsx - > method . name ) , pj_strbuf ( & tsx - > method . name ) ,
( int ) pj_strlen ( & tsx - > method . name ) , pj_strbuf ( & tsx - > method . name ) ,
tsx - > status_code ) ;
tsx - > status_code ) ;
if ( ( tsx - > status_code = = 401 | | tsx - > status_code = = 407 )
if ( ( tsx - > status_code = = 401 | | tsx - > status_code = = 407 )
& & + + session - > authentication_challenge_count < MAX_RX_CHALLENGES
& & ! ast_sip_create_request_with_auth (
& & ! ast_sip_create_request_with_auth (
& session - > endpoint - > outbound_auths ,
& session - > endpoint - > outbound_auths ,
e - > body . tsx_state . src . rdata , tsx - > last_tx , & tdata ) ) {
e - > body . tsx_state . src . rdata , tsx - > last_tx , & tdata ) ) {