From 979de9323a92a1c79f46159a23c36b9369f764fa Mon Sep 17 00:00:00 2001 From: Jeremy McNamara <jj@nufone.net> Date: Fri, 11 Apr 2003 20:28:25 +0000 Subject: [PATCH] make non matching IP addresses go to invalid extension if default context exists git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@836 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/h323/chan_h323.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/channels/h323/chan_h323.c b/channels/h323/chan_h323.c index 24f9ed9e1e..52a989f541 100755 --- a/channels/h323/chan_h323.c +++ b/channels/h323/chan_h323.c @@ -961,8 +961,14 @@ int setup_incoming_call(call_details_t cd) } else { if (user->host) { if (strcasecmp(cd.sourceIp, inet_ntoa(user->addr.sin_addr))){ - ast_log(LOG_ERROR, "Call from user '%s' rejected due to non-matching IP address of '%s'\n", user->name, cd.sourceIp); - return 0; + + if(!strlen(default_context)) { + ast_log(LOG_ERROR, "Call from user '%s' rejected due to non-matching IP address of '%s'\n", user->name, cd.sourceIp); + return 0; + } + strncpy(p->context, default_context, sizeof(p->context)-1); + sprintf(p->exten,"i"); + goto exit; } } if (user->incominglimit > 0) { @@ -993,7 +999,9 @@ int setup_incoming_call(call_details_t cd) user->inUse++; } } - + +/* I know this is horrid, don't kill me saddam */ +exit: /* allocate a channel and tell asterisk about it */ c = oh323_new(p, AST_STATE_RINGING, cd.call_token); -- GitLab