From 07dbb0f074af830b4f34860bad2809898ca9f26f Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Wed, 5 May 2010 16:42:22 +0000 Subject: [PATCH] Registration fix for SIP realtime. 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 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index fdb4c98e30..84209b0dd8 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -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)) -- 2.47.2