[Asterisk-Users] enabling dtmf detection on zap channel?
The Traveller
traveler at xs4all.nl
Wed Jul 23 11:50:26 MST 2003
Yo Thilo,
On Tue, Jul 22, 2003 at 16:51:04 +0200, Thilo Salmon wrote:
> Hi,
>
> is there a way to enable dtmf detection on zap channels? I am trying to
> pickup, play a ringtone and the dial out. I.e.
>
> exten => s,1,Wait,1
> exten => s,1,Answer
> exten => s,2,Playtones(dial)
> exten => s,3,DigitTimeout,5
> exten => s,4,ResponseTimeout,10
> exten => _X,1,StopPlaytones
> exten => _X,2,Dial,Zap/g8/BYEXTENSION|10
>
> I don't quite recall what I did last, but I remember this used to work.
> My current installation of asterisk does not detect dtmf tones as I can
> easily verify with debugging turned on. Just to be sure I also dialed in
> from different phones, did a fresh checkout of zaptel, libpri and
> asterisk and wrote my configuration from scratch. None of that made
> asterisk detect dtmf, though.
>
> Can anybody suggest what to try next?
I encountered the same problem, and first solved it by using
"BackGround" to play a recording of a dial-tone, as "Playtones"
doesn't do anything with any digits dialled while a tone is beeing played.
A while ago, I made some modifications to "Playtones" to allow it to be
interrupted by dialling a digit and behave very much like "BackGround"
in that respect. The patch to add this new app, called "PlayDialtone", is
attached.
Grtz,
Oliver
-------------- next part --------------
Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.31
diff -u -r1.31 pbx.c
--- pbx.c 1 Jul 2003 20:29:53 -0000 1.31
+++ pbx.c 3 Jul 2003 11:48:33 -0000
@@ -1747,6 +1747,8 @@
/* As long as we're willing to wait, and as long as it's not defined,
keep reading digits until we can't possibly get a right answer anymore. */
digit = ast_waitfordigit(c, waittime * 1000);
+ if (c->writeinterrupt)
+ ast_deactivate_generator(c);
if (c->_softhangup == AST_SOFTHANGUP_ASYNCGOTO) {
c->_softhangup = 0;
} else {
Index: res/res_indications.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_indications.c,v
retrieving revision 1.2
diff -u -r1.2 res_indications.c
--- res/res_indications.c 27 Apr 2003 21:34:27 -0000 1.2
+++ res/res_indications.c 3 Jul 2003 11:48:34 -0000
@@ -201,6 +201,28 @@
}
/*
+ * PlayDialtone command stuff
+ */
+static int handle_playdialtone(struct ast_channel *chan, void *data)
+{
+ struct tone_zone_sound *ts;
+ int res;
+
+ if (!data || !((char*)data)[0]) {
+ ast_log(LOG_NOTICE,"Nothing to play\n");
+ return -1;
+ }
+ ts = ast_get_indication_tone(chan->zone, (const char*)data);
+ if (ts && ts->data[0])
+ res = ast_playtones_start(chan, 0, ts->data, 1);
+ else
+ res = ast_playtones_start(chan, 0, (const char*)data, 1);
+ if (res)
+ ast_log(LOG_NOTICE,"Unable to start playdialtone\n");
+ return res;
+}
+
+/*
* StopPlaylist command stuff
*/
static int handle_stopplaytones(struct ast_channel *chan, void *data)
@@ -377,6 +399,7 @@
ast_cli_register(&remove_indication_cli);
ast_cli_register(&show_indications_cli);
ast_register_application("Playtones", handle_playtones, "Play a tone list","Play a tone list, either registered (through indications.conf) or a direct list of tones and durations.");
+ ast_register_application("PlayDialtone", handle_playdialtone, "Play an interruptable tone list","Play a tone list, either registered (through indications.conf) or a direct list of tones and durations. Interrupt the tones after a digit is dialed.");
ast_register_application("StopPlaytones", handle_stopplaytones, "Stop playing a tone list","Stop playing a tone list");
return 0;
More information about the asterisk-users
mailing list