[asterisk-commits] trunk r23284 - /trunk/res/res_clioriginate.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Apr 28 22:02:18 MST 2006
Author: russell
Date: Sat Apr 29 00:02:17 2006
New Revision: 23284
URL: http://svn.digium.com/view/asterisk?rev=23284&view=rev
Log:
- 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
Modified:
trunk/res/res_clioriginate.c
Modified: trunk/res/res_clioriginate.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_clioriginate.c?rev=23284&r1=23283&r2=23284&view=diff
==============================================================================
--- trunk/res/res_clioriginate.c (original)
+++ trunk/res/res_clioriginate.c Sat Apr 29 00:02:17 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 2005, Digium, Inc.
+ * Copyright (C) 2005 - 2006, Digium, Inc.
*
* Russell Bryant <russell at digium.com>
*
@@ -18,6 +18,7 @@
/*!
* \file
+ * \author Russell Bryant <russell at digium.com>
*
* \brief Originate calls via the CLI
*
@@ -66,7 +67,7 @@
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 @@
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 @@
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 @@
char *context = NULL;
int reason = 0;
- chandata = ast_strdupa(chan);
+ if (!(chandata = ast_strdupa(chan)))
+ return RESULT_FAILURE;
+
+ chantech = strsep(&chandata, "/");
if (!chandata) {
- ast_log(LOG_ERROR, "Out of Memory!\n");
- return RESULT_FAILURE;
+ ast_cli(fd, "*** No data provided after channel type! ***\n");
+ return RESULT_SHOWUSAGE;
}
- chantech = strsep(&chandata, "/");
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 @@
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;
More information about the asterisk-commits
mailing list