When attempting to resolve hostnames, we need to be sure
authorMark Michelson <mmichelson@digium.com>
Tue, 21 Oct 2008 23:08:56 +0000 (23:08 +0000)
committerMark Michelson <mmichelson@digium.com>
Tue, 21 Oct 2008 23:08:56 +0000 (23:08 +0000)
to remove any parameters from the string so that name
resolution succeeds.

(closes issue #13727)
Reported by: fnordian
Patches:
      resolvewithouturiparameter.patch uploaded by fnordian (license 110)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@151420 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 1349480..1df8b72 100644 (file)
@@ -21927,9 +21927,17 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
 
        if (srvlookup && peer->dnsmgr == NULL) {
                char transport[MAXHOSTNAMELEN];
+               char _srvlookup[MAXHOSTNAMELEN];
+               char *params;
+
+               ast_copy_string(_srvlookup, srvlookup, sizeof(_srvlookup));
+               if (params = strchr(_srvlookup, ';')) {
+                       *params++ = '\0';
+               }
+               
                snprintf(transport, sizeof(transport), "_sip._%s", get_transport(peer->socket.type));
 
-               if (ast_dnsmgr_lookup(srvlookup, &peer->addr, &peer->dnsmgr, global_srvlookup ? transport : NULL)) {
+               if (ast_dnsmgr_lookup(_srvlookup, &peer->addr, &peer->dnsmgr, global_srvlookup ? transport : NULL)) {
                        unref_peer(peer, "getting rid of a peer pointer");
                        return NULL;
                }