path: root/channels/sip
diff options
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2010-07-13 22:18:38 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2010-07-13 22:18:38 +0000
commit4bbc69ca096b585a7eeef3b32b57d662e918338d (patch)
tree76de3c342d4129d23bbf38685e91ab8cf8cc2ccb /channels/sip
parent9e1fd439554bc09d6548bddb12a6681adada9085 (diff)
chan_sip: RFC compliant retransmission timeout
Retransmission of packets should not be based on how many packets were sent, but instead on a timeout period. Depending on whether or not the packet is for a INVITE or NON-INVITE transaction, the number of packets sent during the retransmission timeout period will be different, so timing out based on the number of packets sent is not accurate. This patch fixes this by removing the retransmit limit and only stopping retransmission after a timeout period is reached. By default this timeout period is 64*(Timer T1) for both INVITE and non-INVITE transactions. For more information on sip timer values refer to RFC3261 Appendix A. Review: https://reviewboard.asterisk.org/r/749/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@276219 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/sip')
1 files changed, 3 insertions, 1 deletions
diff --git a/channels/sip/include/sip.h b/channels/sip/include/sip.h
index 92fa68e82..2644536cd 100644
--- a/channels/sip/include/sip.h
+++ b/channels/sip/include/sip.h
@@ -83,7 +83,6 @@
#define DEFAULT_FREQ_NOTOK 10 * 1000 /*!< Qualification: How often to check, if the host is down... */
#define DEFAULT_RETRANS 1000 /*!< How frequently to retransmit Default: 2 * 500 ms in RFC 3261 */
-#define MAX_RETRANS 6 /*!< Try only 6 times for retransmissions, a total of 7 transmissions */
#define DEFAULT_TIMER_T1 500 /*!< SIP timer T1 (according to RFC 3261) */
#define SIP_TRANS_TIMEOUT 64 * DEFAULT_TIMER_T1 /*!< SIP request timeout (rfc 3261) 64*T1
* \todo Use known T1 for timeout (peerpoke)
@@ -1118,6 +1117,9 @@ struct sip_pkt {
int retransid; /*!< Retransmission ID */
int timer_a; /*!< SIP timer A, retransmission timer */
int timer_t1; /*!< SIP Timer T1, estimated RTT or 500 ms */
+ struct timeval time_sent; /*!< When pkt was sent */
+ int64_t retrans_stop_time; /*!< Time in ms after 'now' that retransmission must stop */
+ int retrans_stop; /*!< Timeout is reached, stop retransmission */
int packetlen; /*!< Length of packet */
struct ast_str *data;