aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--channels/chan_iax2.c22
-rw-r--r--configs/iax.conf.sample4
3 files changed, 16 insertions, 11 deletions
diff --git a/CHANGES b/CHANGES
index 51c88b224..1630f587d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -64,6 +64,7 @@ Changes since Asterisk 1.4-beta was branched:
* Added G729 passthrough support to chan_phone for Sigma Designs boards.
* Added the parkedcalltransfers option to features.conf
* Added 's' option to Page application.
+ * Added the srvlookup option to iax.conf
SIP changes
-----------
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 1ede22ade..5ca384280 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -180,6 +180,8 @@ static unsigned int tos = 0;
static int min_reg_expire;
static int max_reg_expire;
+static int srvlookup = 0;
+
static int timingfd = -1; /* Timing file descriptor */
static struct ast_netsock_list *netsock;
@@ -2674,8 +2676,6 @@ struct create_addr_info {
static int create_addr(const char *peername, struct sockaddr_in *sin, struct create_addr_info *cai)
{
- struct ast_hostent ahp;
- struct hostent *hp;
struct iax2_peer *peer;
ast_clear_flag(cai, IAX_SENDANI | IAX_TRUNK);
@@ -2685,18 +2685,14 @@ static int create_addr(const char *peername, struct sockaddr_in *sin, struct cre
if (!(peer = find_peer(peername, 1))) {
cai->found = 0;
-
- hp = ast_gethostbyname(peername, &ahp);
- if (hp) {
- memcpy(&sin->sin_addr, hp->h_addr, sizeof(sin->sin_addr));
- sin->sin_port = htons(IAX_DEFAULT_PORTNO);
- /* use global iax prefs for unknown peer/user */
- ast_codec_pref_convert(&prefs, cai->prefs, sizeof(cai->prefs), 1);
- return 0;
- } else {
+ if (ast_get_ip_or_srv(sin, peername, srvlookup ? "_iax._udp" : NULL)) {
ast_log(LOG_WARNING, "No such host: %s\n", peername);
return -1;
}
+ sin->sin_port = htons(IAX_DEFAULT_PORTNO);
+ /* use global iax prefs for unknown peer/user */
+ ast_codec_pref_convert(&prefs, cai->prefs, sizeof(cai->prefs), 1);
+ return 0;
}
cai->found = 1;
@@ -8968,6 +8964,8 @@ static int set_config(char *config_file, int reload)
maxauthreq = 3;
+ srvlookup = 0;
+
v = ast_variable_browse(cfg, "general");
/* Seed initial tos value */
@@ -9171,6 +9169,8 @@ static int set_config(char *config_file, int reload)
maxauthreq = 0;
} else if (!strcasecmp(v->name, "adsi")) {
adsi = ast_true(v->value);
+ } else if (!strcasecmp(v->name, "srvlookup")) {
+ srvlookup = ast_true(v->value);
} /*else if (strcasecmp(v->name,"type")) */
/* ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */
v = v->next;
diff --git a/configs/iax.conf.sample b/configs/iax.conf.sample
index 4d8663c2e..89e485bfe 100644
--- a/configs/iax.conf.sample
+++ b/configs/iax.conf.sample
@@ -51,6 +51,10 @@
;
;adsi=no
;
+; Perform an SRV lookup on outbound calls
+;
+;srvlookup=yes
+;
; You may specify a default account for Call Detail Records in addition
; to specifying on a per-user basis
;