]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Registration fix for SIP realtime.
authorPaul Belanger <paul.belanger@polybeacon.com>
Wed, 5 May 2010 16:42:22 +0000 (16:42 +0000)
committerPaul Belanger <paul.belanger@polybeacon.com>
Wed, 5 May 2010 16:42:22 +0000 (16:42 +0000)
Make sure realtime fields are not empty.

(closes issue #17266)
Reported by: Nick_Lewis
Patches:
      chan_sip.c-realtime.patch uploaded by Nick Lewis (license 657)
Tested by: Nick_Lewis, sberney

Review: https://reviewboard.asterisk.org/r/643/

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

channels/chan_sip.c

index fdb4c98e30a2bff7ed05de2e004534672ab68a94..84209b0dd8a8f202b7bcdb3691f1f32a413b5cf3 100644 (file)
@@ -18076,14 +18076,18 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
                                        }
                                }
                        } else if (!strcasecmp(v->name, "defaultip")) {
-                               if (ast_get_ip(&peer->defaddr, v->value)) {
+                               if (!ast_strlen_zero(v->value) && ast_get_ip(&peer->defaddr, v->value)) {
                                        ASTOBJ_UNREF(peer, sip_destroy_peer);
                                        return NULL;
                                }
                        } else if (!strcasecmp(v->name, "permit") || !strcasecmp(v->name, "deny")) {
-                               peer->ha = ast_append_ha(v->name, v->value, peer->ha);
+                               if (!ast_strlen_zero(v->value)) {
+                                       peer->ha = ast_append_ha(v->name, v->value, peer->ha);
+                               }
                        } else if (!strcasecmp(v->name, "contactpermit") || !strcasecmp(v->name, "contactdeny")) {
-                               peer->contactha = ast_append_ha(v->name + 7, v->value, peer->contactha);
+                               if (!ast_strlen_zero(v->value)) {
+                                       peer->contactha = ast_append_ha(v->name + 7, v->value, peer->contactha);
+                               }
                        } else if (!strcasecmp(v->name, "port")) {
                                peer->portinuri = 1;
                                if (!realtime && ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC))