[asterisk-bugs] [Asterisk 0012312]: DNS SRV lookups causing re-registration problems
noreply at bugs.digium.com
noreply at bugs.digium.com
Wed Mar 26 19:49:57 CDT 2008
A NOTE has been added to this issue.
======================================================================
http://bugs.digium.com/view.php?id=12312
======================================================================
Reported By: jrast
Assigned To:
======================================================================
Project: Asterisk
Issue ID: 12312
Category: Channels/chan_sip/Registration
Reproducibility: always
Severity: major
Priority: normal
Status: new
Asterisk Version: 1.4.18
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Disclaimer on File?: N/A
Request Review:
======================================================================
Date Submitted: 03-26-2008 17:38 CDT
Last Modified: 03-26-2008 19:49 CDT
======================================================================
Summary: DNS SRV lookups causing re-registration problems
Description:
SIP peer uses DNS SRV records which list multiple entries for
_sip._udp.domain.
Asterisk is selecting one and successfully registering with it. When
attempting to re-register, Asterisk is not selecting the same host.
Instead it is ALWAYS selecting another host, sending seven SIP REGISTER
requests to it, then failing over to the next (correct) host, at which
point the re-register succeeds. However, this process exceeds the
registration expiry and the registration is timing out on every
re-registration cycle.
Peer in question is callcentric.com.
======================================================================
----------------------------------------------------------------------
jrast - 03-26-08 19:49
----------------------------------------------------------------------
Problem seems to be that Asterisk is performing a new SRV lookup on every
re-register. Callcentric's SRV entries are equally weighted, so Asterisk
is selecting from them in a round-robin fashion. Asterisk's attempt to
re-register to a server other than that which it is registered to is
failing.
The following hack stores the host looked up during the initial register's
SRV lookup and re-uses it for the re-registers. This solves the problem
for Callcentric.
Hopefully someone more familiar with the workings of the code can change
this hack into a proper patch.
<pre>
--- channels/chan_sip.oc 2008-03-26 17:47:12.000000000 -0400
+++ channels/chan_sip.c 2008-03-26 20:42:42.000000000 -0400
@@ -1149,6 +1149,7 @@
AST_STRING_FIELD(username); /*!< Who we are
registering as */
AST_STRING_FIELD(authuser); /*!< Who we *authenticate*
as */
AST_STRING_FIELD(hostname); /*!< Domain or host we
register to */
+ AST_STRING_FIELD(srvhost); /*!< Hostname from srv
lookup we register to */
AST_STRING_FIELD(secret); /*!< Password in clear
text */
AST_STRING_FIELD(md5secret); /*!< Password in md5 */
AST_STRING_FIELD(contact); /*!< Contact extension */
@@ -2901,6 +2902,9 @@
portno = tportno;
}
}
+ if (dialog->registry) {
+ ast_string_field_set(dialog->registry, srvhost, hostn);
+ }
hp = ast_gethostbyname(hostn, &ahp);
if (!hp) {
ast_log(LOG_WARNING, "No such host: %s\n", peer);
@@ -7535,8 +7539,9 @@
}
if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY))
append_history(p, "RegistryInit", "Account:
%s@%s", r->username, r->hostname);
+ p->registry = ASTOBJ_REF(r); /* Add pointer to registry
in packet */
/* Find address to hostname */
- if (create_addr(p, r->hostname)) {
+ if (create_addr(p, (*(r->srvhost)) ? r->srvhost :
r->hostname)) {
/* we have what we hope is a temporary network
error,
* probably DNS. We need to reschedule a
registration try */
sip_destroy(p);
</pre>
Issue History
Date Modified Username Field Change
======================================================================
03-26-08 19:49 jrast Note Added: 0084635
======================================================================
More information about the asterisk-bugs
mailing list