Add ability to configure the Max-Forwards header in the dialplan, as well as in

sip.conf configuration for the channel and for devices.

The Max-Forwards header is used to prevent loops in a SIP network. Each intermediary,
like SIP proxys and SBCs, decrement this counter and detects when it reaches zero,
at which point the SIP request is nicely killed in a SIP-friendly way.

Review: https://reviewboard.asterisk.org/r/778/

Thanks to dvossel for the review and good advice.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@276951 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Olle Johansson
2010-07-16 10:00:58 +00:00
parent 65203b12dd
commit e129b31fc6
5 changed files with 55 additions and 4 deletions

View File

@@ -57,7 +57,7 @@
#define DEFAULT_MAX_EXPIRY 3600
#define DEFAULT_MWI_EXPIRY 3600
#define DEFAULT_REGISTRATION_TIMEOUT 20
#define DEFAULT_MAX_FORWARDS "70"
#define DEFAULT_MAX_FORWARDS 70
/* guard limit must be larger than guard secs */
/* guard min must be < 1000, and should be >= 250 */
@@ -703,6 +703,7 @@ struct sip_settings {
struct ast_ha *contact_ha; /*! \brief Global list of addresses dynamic peers are not allowed to use */
format_t capability; /*!< Supported codecs */
int tcp_enabled;
int default_max_forwards; /*!< Default max forwards (SIP Anti-loop) */
};
/*! \brief The SIP socket definition */
@@ -953,6 +954,7 @@ struct sip_pvt {
AST_STRING_FIELD(dialstring); /*!< The dialstring used to call this SIP endpoint */
);
char via[128]; /*!< Via: header */
int maxforwards; /*!< SIP Loop prevention */
struct sip_socket socket; /*!< The socket used for this dialog */
unsigned int ocseq; /*!< Current outgoing seqno */
unsigned int icseq; /*!< Current incoming seqno */
@@ -1194,6 +1196,7 @@ struct sip_peer {
int call_limit; /*!< Limit of concurrent calls */
int t38_maxdatagram; /*!< T.38 FaxMaxDatagram override */
int busy_level; /*!< Level of active channels where we signal busy */
int maxforwards; /*!< SIP Loop prevention */
enum transfermodes allowtransfer; /*! SIP Refer restriction scheme */
struct ast_codec_pref prefs; /*!< codec prefs */
int lastmsgssent;