aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_zapateller.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-01 05:37:46 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-01 05:37:46 +0000
commit52352d88d922deee6256f2210e7152028fa062ea (patch)
tree3104e9ea7d5822c92336c187593a538dcfd0de8b /apps/app_zapateller.c
parent885085e4d2ad889c6fbcec734edf42b80d483a48 (diff)
Janitor for Zapateller: convert to use argument macros
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44100 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_zapateller.c')
-rw-r--r--apps/app_zapateller.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/apps/app_zapateller.c b/apps/app_zapateller.c
index 06941b16a..7355670b6 100644
--- a/apps/app_zapateller.c
+++ b/apps/app_zapateller.c
@@ -40,6 +40,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/translate.h"
+#include "asterisk/app.h"
static char *app = "Zapateller";
@@ -59,36 +60,36 @@ static int zapateller_exec(struct ast_channel *chan, void *data)
{
int res = 0;
struct ast_module_user *u;
- int answer = 0, nocallerid = 0;
- char *c;
- char *stringp=NULL;
-
+ int i, answer = 0, nocallerid = 0;
+ char *parse = ast_strdupa((char *)data);
+ AST_DECLARE_APP_ARGS(args,
+ AST_APP_ARG(options)[2];
+ );
+
u = ast_module_user_add(chan);
- stringp=data;
- c = strsep(&stringp, "|");
- while(!ast_strlen_zero(c)) {
- if (!strcasecmp(c, "answer"))
+ AST_STANDARD_APP_ARGS(args, parse);
+
+ for (i = 0; i < args.argc; i++) {
+ if (!strcasecmp(args.options[i], "answer"))
answer = 1;
- else if (!strcasecmp(c, "nocallerid"))
+ else if (!strcasecmp(args.options[i], "nocallerid"))
nocallerid = 1;
-
- c = strsep(&stringp, "|");
- }
+ }
ast_stopstream(chan);
if (chan->_state != AST_STATE_UP) {
-
if (answer)
res = ast_answer(chan);
- if (!res) {
+ if (!res)
res = ast_safe_sleep(chan, 500);
- }
}
- if (chan->cid.cid_num && nocallerid) {
+
+ if (!ast_strlen_zero(chan->cid.cid_num) && nocallerid) {
ast_module_user_remove(u);
return res;
}
+
if (!res)
res = ast_tonepair(chan, 950, 0, 330, 0);
if (!res)
@@ -97,6 +98,7 @@ static int zapateller_exec(struct ast_channel *chan, void *data)
res = ast_tonepair(chan, 1800, 0, 330, 0);
if (!res)
res = ast_tonepair(chan, 0, 0, 1000, 0);
+
ast_module_user_remove(u);
return res;
}