]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
reject call attempts when gatekeeper is configured but not registered
authorAlexandr Anikin <may@telecom-service.ru>
Fri, 31 May 2013 08:10:30 +0000 (08:10 +0000)
committerAlexandr Anikin <may@telecom-service.ru>
Fri, 31 May 2013 08:10:30 +0000 (08:10 +0000)
(closes issue ASTERISK-21800)
Reported by: Dmitry Melekhov
Patches:
        ASTERISK-21800-1.patch
Tested by: Dmitry Melekhov

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

addons/chan_ooh323.c

index 81839f397f2a1af806074db276844c40ffd4069d..7ee70c8f68e983f1e34b5d45f6e756ad6ea611c2 100644 (file)
@@ -286,6 +286,8 @@ int onCallEstablished(ooCallData *call);
 int onCallCleared(ooCallData *call);
 void onModeChanged(ooCallData *call, int t38mode);
 
+extern OOH323EndPoint gH323ep;
+
 static char gLogFile[256] = DEFAULT_LOGFILE;
 static int  gPort = 1720;
 static char gIP[20];
@@ -629,6 +631,7 @@ static struct ast_channel *ooh323_request(const char *type, format_t format,
                ooh323_destroy(p);
                ast_mutex_unlock(&iflock);
                ast_log(LOG_ERROR, "Destination format is not supported\n");
+               *cause = AST_CAUSE_INVALID_NUMBER_FORMAT;
                return NULL;
        }
 
@@ -672,6 +675,10 @@ static struct ast_channel *ooh323_request(const char *type, format_t format,
                        ooh323_destroy(p);
                        ast_mutex_unlock(&iflock);
                        return NULL;
+               } else if (gH323ep.gkClient && gH323ep.gkClient->state != GkClientRegistered) {
+                       ast_log(LOG_ERROR, "Gatekeeper client is configured but not registered\n");
+                       *cause = AST_CAUSE_NORMAL_TEMPORARY_FAILURE;
+                       return NULL;
                }
                p->g729onlyA = g729onlyA;
                p->dtmfmode = gDTMFMode;