aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-29 05:02:17 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-29 05:02:17 +0000
commit31a8ac0fd5ba7ddaed0d5b76102b1f4ab1367c08 (patch)
tree6928f41c82aaad4c648c5ba0294b7d66e351abd7
parent40a5624b85b03ba9e7bb95aa2a85aaa03498a257 (diff)
- don't create duplicate log messages
- note when the data part of the tech/data pair is missing not only when using the app version, but the exten version as well - instead of logging syntax errors, just output them to the CLI git-svn-id: http://svn.digium.com/svn/asterisk/trunk@23284 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--res/res_clioriginate.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/res/res_clioriginate.c b/res/res_clioriginate.c
index a9ebb3647..1c02491d2 100644
--- a/res/res_clioriginate.c
+++ b/res/res_clioriginate.c
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 2005, Digium, Inc.
+ * Copyright (C) 2005 - 2006, Digium, Inc.
*
* Russell Bryant <russell@digium.com>
*
@@ -18,6 +18,7 @@
/*!
* \file
+ * \author Russell Bryant <russell@digium.com>
*
* \brief Originate calls via the CLI
*
@@ -66,7 +67,7 @@ static char *complete_orig(const char *line, const char *word, int pos, int stat
struct ast_cli_entry cli_orig = { { "originate", NULL }, handle_orig, "Originate a call", orig_help, complete_orig };
-static int orig_app(const char *chan, const char *app, const char *appdata)
+static int orig_app(int fd, const char *chan, const char *app, const char *appdata)
{
char *chantech;
char *chandata;
@@ -75,14 +76,12 @@ static int orig_app(const char *chan, const char *app, const char *appdata)
if (ast_strlen_zero(app))
return RESULT_SHOWUSAGE;
- chandata = ast_strdupa(chan);
- if (!chandata) {
- ast_log(LOG_ERROR, "Out of Memory!\n");
+ if (!(chandata = ast_strdupa(chan)))
return RESULT_FAILURE;
- }
+
chantech = strsep(&chandata, "/");
if (!chandata) {
- ast_log(LOG_ERROR, "No dial string.\n");
+ ast_cli(fd, "*** No data provided after channel type! ***\n");
return RESULT_SHOWUSAGE;
}
@@ -91,7 +90,7 @@ static int orig_app(const char *chan, const char *app, const char *appdata)
return RESULT_SUCCESS;
}
-static int orig_exten(const char *chan, const char *data)
+static int orig_exten(int fd, const char *chan, const char *data)
{
char *chantech;
char *chandata;
@@ -99,19 +98,18 @@ static int orig_exten(const char *chan, const char *data)
char *context = NULL;
int reason = 0;
- chandata = ast_strdupa(chan);
- if (!chandata) {
- ast_log(LOG_ERROR, "Out of Memory!\n");
+ if (!(chandata = ast_strdupa(chan)))
return RESULT_FAILURE;
- }
+
chantech = strsep(&chandata, "/");
+ if (!chandata) {
+ ast_cli(fd, "*** No data provided after channel type! ***\n");
+ return RESULT_SHOWUSAGE;
+ }
if (!ast_strlen_zero(data)) {
- context = ast_strdupa(data);
- if (!context) {
- ast_log(LOG_ERROR, "Out of Memory!\n");
+ if (!(context = ast_strdupa(data)))
return RESULT_FAILURE;
- }
exten = strsep(&context, "@");
}
@@ -135,9 +133,9 @@ static int handle_orig(int fd, int argc, char *argv[])
ast_atomic_fetchadd_int(&me->usecnt, +1);
if (!strcasecmp("application", argv[2])) {
- res = orig_app(argv[1], argv[3], argv[4]);
+ res = orig_app(fd, argv[1], argv[3], argv[4]);
} else if (!strcasecmp("extension", argv[2])) {
- res = orig_exten(argv[1], argv[3]);
+ res = orig_exten(fd, argv[1], argv[3]);
} else
res = RESULT_SHOWUSAGE;