[Asterisk-Users] dialed number notify at invalid dial situation

James Golovich james at wwnet.net
Tue Apr 15 21:28:54 MST 2003


Here is a patch that adds a SayNumber and SayDigits app as builtins.  It
would probably be better implemented as an external app so if someone
wants to throw something together and ship a patch off to mark that would
be cool

James


On Tue, 15 Apr 2003, Benjamin Miller wrote:

> I've been meaning to write an app_saydigits, which would be quite trivial given that there is a say_digits function.  However, until I have a few moments, or some one else writes it, you could call an AGI script which DOES have access to a say digits command.
> Ben
> 
> -----Original Message-----
> From: Masakazu Nakano [mailto:n-mack at md.neweb.ne.jp]
> Sent: Tuesday, April 15, 2003 5:43 PM
> To: Asterisk-Users at lists.digium.com
> Subject: [Asterisk-Users] dialed number notify at invalid dial situation
> 
> 
> 
> Hi all
> 
> Now I'm making IVR sequance that is customised [mainmanu].
> 
> I wish to notify invaid command like a following 
> 
> exten => i,1,playback('your command is ...')
> exten => i,2,playback(${EXTEN}) ; <---- Say 'i' oops! ;-(
> exten => i,3,playback(' is incorrect! please again ')
> 
> # This exten lines are figure for instruction.
> # I know to use with gsm filename.
> 
> but ${EXTEN} meaning 'i' that isn't dialed number.
> 
> Does anyone have good idea?
> 
> please help
> 
> ---
> Masakazu Nakano.
> Dairiten.com - an open source VoIP and Ubiquitus Portal site in Japan.
> http://www.dairiten.com:81/modules/news/
> powered by xoops at http://www.xoops.org
> 
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> 
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> 
-------------- next part --------------
Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk-ng/pbx.c,v
retrieving revision 1.129
diff -u -r1.129 pbx.c
--- pbx.c	19 Jan 2003 17:56:11 -0000	1.129
+++ pbx.c	30 Jan 2003 23:28:43 -0000
@@ -25,6 +25,7 @@
 #include <asterisk/ast_expr.h>
 #include <asterisk/channel_pvt.h>
 #include <asterisk/linkedlists.h>
+#include <asterisk/say.h>
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -146,6 +147,8 @@
 static int pbx_builtin_busy(struct ast_channel *, void *);
 static int pbx_builtin_setvar(struct ast_channel *, void *);
 static int pbx_builtin_gotoif(struct ast_channel *, void *);
+static int pbx_builtin_saynumber(struct ast_channel *, void *);
+static int pbx_builtin_saydigits(struct ast_channel *, void *);
 void pbx_builtin_setvar_helper(struct ast_channel *chan, char *name, char *value);
 char *pbx_builtin_getvar_helper(struct ast_channel *chan, char *name);
 
@@ -268,6 +271,14 @@
 "omitted (in that case, we just don't take the particular branch) but not\n"
 "both.  Look for the condition syntax in examples or documentation." },
 
+	{ "SayNumber", pbx_builtin_saynumber,
+"Say Number",
+"  SayNumber(digits): Says the passed number\n" },
+
+	{ "SayDigits", pbx_builtin_saydigits,
+"Say Digits",
+"  SayDigits(digits): Says the passed digits\n" },
+
 };
 
 /* Lock for the application list */
@@ -3596,6 +3607,22 @@
 	free(s);
 	return(rc);
 }           
+
+static int pbx_builtin_saynumber(struct ast_channel *chan, void *data)
+{
+	int res = 0;
+	if (data && atoi((char *)data) )
+		res = ast_say_number(chan, atoi((char *)data), "", chan->language);
+	return res;
+}
+
+static int pbx_builtin_saydigits(struct ast_channel *chan, void *data)
+{
+	int res = 0;
+	if (data && atoi((char *)data))
+		res = ast_say_digits(chan, atoi((char *)data), "", chan->language);
+	return res;
+}
 	
 int load_pbx(void)
 {


More information about the asterisk-users mailing list