@@ -399,29 +399,20 @@ var InviteServerTransactionPrototype = function() {
399399
400400 console . log ( LOG_PREFIX + 'transport error occurred, deleting INVITE server transaction ' + this . id ) ;
401401
402- window . clearTimeout ( this . reliableProvisionalTimer ) ;
402+ if ( this . resendProvisionalTimer !== null ) {
403+ window . clearInterval ( this . resendProvisionalTimer ) ;
404+ this . resendProvisionalTimer = null ;
405+ }
403406 window . clearTimeout ( this . L ) ;
404407 window . clearTimeout ( this . H ) ;
405408 window . clearTimeout ( this . I ) ;
406409 delete this . ua . transactions . ist [ this . id ] ;
407410 }
408411 } ;
409412
410- this . timer_reliableProvisional = function ( retransmissions ) {
411- var
412- tr = this ,
413- response = this . last_response ,
414- timeout = JsSIP . Timers . T1 * ( Math . pow ( 2 , retransmissions + 1 ) ) ;
415-
416- if ( retransmissions > 8 ) {
417- window . clearTimeout ( this . reliableProvisionalTimer ) ;
418- } else {
419- retransmissions += 1 ;
420- if ( ! this . transport . send ( response ) ) {
421- this . onTransportError ( ) ;
422- }
423- this . reliableProvisionalTimer = window . setTimeout ( function ( ) {
424- tr . timer_reliableProvisional ( retransmissions ) ; } , timeout ) ;
413+ this . resend_provisional = function ( ) {
414+ if ( ! this . transport . send ( this . last_response ) ) {
415+ this . onTransportError ( ) ;
425416 }
426417 } ;
427418
@@ -440,11 +431,11 @@ var InviteServerTransactionPrototype = function() {
440431 }
441432 }
442433
443- if ( status_code > 100 && status_code <= 199 ) {
444- // Trigger the reliableProvisionalTimer only for the first non 100 provisional response.
445- if ( ! this . reliableProvisionalTimer ) {
446- this . reliableProvisionalTimer = window . setTimeout ( function ( ) {
447- tr . timer_reliableProvisional ( 1 ) ; } , JsSIP . Timers . T1 ) ;
434+ if ( status_code > 100 && status_code <= 199 && this . state === C . STATUS_PROCEEDING ) {
435+ // Trigger the resendProvisionalTimer only for the first non 100 provisional response.
436+ if ( this . resendProvisionalTimer === null ) {
437+ this . resendProvisionalTimer = window . setInterval ( function ( ) {
438+ tr . resend_provisional ( ) ; } , JsSIP . Timers . PROVISIONAL_RESPONSE_INTERVAL ) ;
448439 }
449440 } else if ( status_code >= 200 && status_code <= 299 ) {
450441 switch ( this . state ) {
@@ -454,7 +445,10 @@ var InviteServerTransactionPrototype = function() {
454445 this . L = window . setTimeout ( function ( ) {
455446 tr . timer_L ( ) ;
456447 } , JsSIP . Timers . TIMER_L ) ;
457- window . clearTimeout ( this . reliableProvisionalTimer ) ;
448+ if ( this . resendProvisionalTimer !== null ) {
449+ window . clearInterval ( this . resendProvisionalTimer ) ;
450+ this . resendProvisionalTimer = null ;
451+ }
458452 /* falls through */
459453 case C . STATUS_ACCEPTED :
460454 // Note that this point will be reached for proceeding tr.state also.
@@ -471,7 +465,10 @@ var InviteServerTransactionPrototype = function() {
471465 } else if ( status_code >= 300 && status_code <= 699 ) {
472466 switch ( this . state ) {
473467 case C . STATUS_PROCEEDING :
474- window . clearTimeout ( this . reliableProvisionalTimer ) ;
468+ if ( this . resendProvisionalTimer !== null ) {
469+ window . clearInterval ( this . resendProvisionalTimer ) ;
470+ this . resendProvisionalTimer = null ;
471+ }
475472 if ( ! this . transport . send ( response ) ) {
476473 this . onTransportError ( ) ;
477474 if ( onFailure ) {
@@ -564,7 +561,7 @@ Transactions.InviteServerTransaction = function(request, ua) {
564561
565562 ua . transactions . ist [ this . id ] = this ;
566563
567- this . reliableProvisionalTimer = null ;
564+ this . resendProvisionalTimer = null ;
568565
569566 request . reply ( 100 ) ;
570567} ;
0 commit comments