From 9642d93117ebfc5d493917e2551a4e0ca09d87cc Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Tue, 11 Sep 2007 17:58:48 +0000 Subject: [PATCH] (closes issue #9433) Reported by: junky Patches: register_trying.diff.txt uploaded by jcmoore Disable sending 100 Trying on REGISTER attempts and make it an option. This has been signed off by oej. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82257 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- CHANGES | 5 ++++- channels/chan_sip.c | 7 ++++++- configs/sip.conf.sample | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index a724ac6674..e420aabf5d 100644 --- a/CHANGES +++ b/CHANGES @@ -81,7 +81,10 @@ SIP changes * Added rtpdest option to CHANNEL() dialplan function. * Added SIPREFERRINGCONTEXT and SIPREFERREDBYHDR variables which are set when a transfer takes place. * SIP now adds a header to the CANCEL if the call was answered by another phone - in the same dial command, or if the new c option in dial() is used. + in the same dial command, or if the new c option in dial() is used. + * The new default is that 100 Trying is not sent on REGISTER attempts as the RFC specifically + states it is not needed. For phones, however, that do require it the registertrying option + has been added so it can be enabled. IAX2 changes ------------ diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 8208d3b702..880eb2e0cd 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -855,6 +855,7 @@ struct sip_auth { #define SIP_PAGE2_RFC2833_COMPENSATE (1 << 25) /*!< DP: Compensate for buggy RFC2833 implementations */ #define SIP_PAGE2_BUGGY_MWI (1 << 26) /*!< DP: Buggy CISCO MWI fix */ #define SIP_PAGE2_TEXTSUPPORT (1 << 28) /*!< GDP: Global text enable */ +#define SIP_PAGE2_REGISTERTRYING (1 << 29) /*!< DP: Send 100 Trying on REGISTER attempts */ #define SIP_PAGE2_FLAGS_TO_COPY \ (SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_VIDEOSUPPORT | \ @@ -9280,7 +9281,8 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct sockaddr res = AUTH_PEER_NOT_DYNAMIC; } else { ast_copy_flags(&p->flags[0], &peer->flags[0], SIP_NAT); - transmit_response(p, "100 Trying", req); + if (ast_test_flag(&p->flags[1], SIP_PAGE2_REGISTERTRYING)) + transmit_response(p, "100 Trying", req); if (!(res = check_auth(p, req, peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri, XMIT_UNRELIABLE, req->ignore))) { sip_cancel_destroy(p); @@ -11277,6 +11279,7 @@ static int _sip_show_peer(int type, int fd, struct mansession *s, const struct m ast_cli(fd, ")\n"); ast_cli(fd, " Auto-Framing: %s \n", cli_yesno(peer->autoframing)); + ast_cli(fd, " 100 on REG : %s\n", ast_test_flag(&peer->flags[1], SIP_PAGE2_REGISTERTRYING) ? "Yes" : "No"); ast_cli(fd, " Status : "); peer_status(peer, status, sizeof(status)); ast_cli(fd, "%s\n",status); @@ -17562,6 +17565,8 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str int error = ast_parse_allow_disallow(&peer->prefs, &peer->capability, v->value, FALSE); if (error) ast_log(LOG_WARNING, "Codec configuration errors found in line %d : %s = %s\n", v->lineno, v->name, v->value); + } else if (!strcasecmp(v->name, "registertrying")) { + ast_set2_flag(&peer->flags[1], ast_true(v->value), SIP_PAGE2_REGISTERTRYING); } else if (!strcasecmp(v->name, "autoframing")) { peer->autoframing = ast_true(v->value); } else if (!strcasecmp(v->name, "rtptimeout")) { diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample index e2a62620f5..bf69c2bf01 100644 --- a/configs/sip.conf.sample +++ b/configs/sip.conf.sample @@ -579,6 +579,7 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ; outboundproxy ; rfc2833compensate ; callbackextension +; registertrying ;[sip_proxy] ; For incoming calls only. Example: FWD (Free World Dialup)