From: Paul Belanger Date: Wed, 5 May 2010 16:42:22 +0000 (+0000) Subject: Registration fix for SIP realtime. X-Git-Tag: 1.4.32-rc1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07dbb0f074af830b4f34860bad2809898ca9f26f;p=thirdparty%2Fasterisk.git 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 --- 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))