From: Olle Johansson Date: Mon, 30 Jan 2006 19:50:39 +0000 (+0000) Subject: Issue 5892: Set a minimum T1 timer for calls. Reporter: twisted X-Git-Tag: 1.4.0-beta1~2754 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=125fd8446c74f6099f84c5a2a55a85ac4935bedc;p=thirdparty%2Fasterisk.git Issue 5892: Set a minimum T1 timer for calls. Reporter: twisted git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8926 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index c8fa9b300b..06703accf2 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -363,6 +363,7 @@ static const struct cfsip_options { #define DEFAULT_PEDANTIC FALSE #define DEFAULT_AUTOCREATEPEER FALSE #define DEFAULT_QUALIFY FALSE +#define DEFAULT_T1MIN 100 /*!< 100 MS for minimal roundtrip time */ #ifndef DEFAULT_USERAGENT #define DEFAULT_USERAGENT "Asterisk PBX" /*!< Default Useragent: header unless re-defined in sip.conf */ #endif @@ -403,6 +404,7 @@ static char regcontext[AST_MAX_CONTEXT]; /*!< Context for auto-extensions */ static char global_useragent[AST_MAX_EXTENSION]; /*!< Useragent for the SIP channel */ static int allow_external_domains; /*!< Accept calls to external SIP domains? */ static int global_callevents; /*!< Whether we send manager events or not */ +static int global_t1min; /*!< T1 roundtrip time minimum */ /*! \brief Codecs that we support by default: */ static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263; @@ -1915,8 +1917,9 @@ static int create_addr_from_peer(struct sip_pvt *r, struct sip_peer *peer) r->callgroup = peer->callgroup; r->pickupgroup = peer->pickupgroup; /* Set timer T1 to RTT for this peer (if known by qualify=) */ + /* Minimum is settable or default to 100 ms */ if (peer->maxms && peer->lastms) - r->timer_t1 = peer->lastms; + r->timer_t1 = peer->lastms < global_t1min ? global_t1min : peer->lastms; if ((ast_test_flag(r, SIP_DTMF) == SIP_DTMF_RFC2833) || (ast_test_flag(r, SIP_DTMF) == SIP_DTMF_AUTO)) r->noncodeccapability |= AST_RTP_DTMF; else @@ -8289,6 +8292,7 @@ static int sip_show_settings(int fd, int argc, char *argv[]) ast_cli(fd, " Codecs: "); print_codec_to_cli(fd, &prefs); ast_cli(fd, "\n"); + ast_cli(fd, " T1 minimum: %d\n", global_t1min); ast_cli(fd, " Relax DTMF: %s\n", global_relaxdtmf ? "Yes" : "No"); ast_cli(fd, " Compact SIP headers: %s\n", compactheaders ? "Yes" : "No"); ast_cli(fd, " RTP Timeout: %d %s\n", global_rtptimeout, global_rtptimeout ? "" : "(Disabled)" ); @@ -12403,6 +12407,7 @@ static int reload_config(enum channelreloadreason reason) /* Misc settings for the channel */ global_relaxdtmf = FALSE; global_callevents = FALSE; + global_t1min = DEFAULT_T1MIN; /* Read the [general] config section of sip.conf (or from realtime config) */ for (v = ast_variable_browse(cfg, "general"); v; v = v->next) { @@ -12423,6 +12428,8 @@ static int reload_config(enum channelreloadreason reason) ast_set2_flag((&global_flags_page2), ast_true(v->value), SIP_PAGE2_RTUPDATE); } else if (!strcasecmp(v->name, "ignoreregexpire")) { ast_set2_flag((&global_flags_page2), ast_true(v->value), SIP_PAGE2_IGNOREREGEXPIRE); + } else if (!strcasecmp(v->name, "t1min")) { + global_t1min = atoi(v->value); } else if (!strcasecmp(v->name, "rtautoclear")) { int i = atoi(v->value); if (i > 0) diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample index aff02f9ffe..d334bfb655 100644 --- a/configs/sip.conf.sample +++ b/configs/sip.conf.sample @@ -61,6 +61,8 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ;maxexpiry=3600 ; Max length of incoming registrations/subscriptions we allow (seconds) ;minexpiry=60 ; Minimum length of registrations/subscriptions (default 60) ;defaultexpiry=120 ; Default length of incoming/outoing registration +;t1min=100 ; Minimum roundtrip time for messages to monitored hosts + ; Defaults to 100 ms ;notifymimetype=text/plain ; Allow overriding of mime type in MWI NOTIFY ;checkmwi=10 ; Default time between mailbox checks for peers ;vmexten=voicemail ; dialplan extension to reach mailbox sets the