[asterisk-users] [SOLVED] PlayDTMF and Asterisk Manager

Steve Murphy murf at digium.com
Thu Jul 12 15:23:28 CDT 2007


On Thu, 2007-07-12 at 12:51 -0600, Steve Murphy wrote:
> On Thu, 2007-07-12 at 12:54 +0000, lemmel lemmel wrote:
> > So I'm back on this matter (I thus give enough time for a good samartan to 
> > help), and now, I think that PlayDTMF is not designed for what I want to do 
> > :
> 
> 
> I've done this, and yes, you are correct, PlayDTMF is the wrong thing,
> it goes in the wrong direction.
> 
> There is no app to do this; but you can do it in the code:
> 
> 
>    struct channel *chan;
>    int j;
>    struct ast_frame f = { AST_FRAME_DTMF, };
>    char *str = "#2";
>    /* Send the feature code to the PBX as DTMF, as if the handset had
> sent it */
>    f.len = 100;
>    for (j=0; j < strlen(str); j++) {
>         f.subclass = str[j];
>         ast_queue_frame(chan, &f);
>         ast_verbose("* DTMF-relay event faked: %c\n", f.subclass);
>    }
> 
> 
> Where chan is the channel to inject the dtmf.
> 
> Maybe a small App to do this might be handy... it would give users just
> enough rope to... (*cough*)

On second thought--- it would be silly to make this sort of application!
When 
would you run it? When dialplan apps are running, Asterisk is not
listening for
tones. I can't think of a single place where, if an app is to be run,
that Asterisk would be listening for DTMF. Menu selections are listened
for, after the
's' extension is finished running. DTMF for features, during a bridge
(like in Dial). In Dial, you can run a macro/gosub, but that's on the
peer channel, and before the call is bridged. Nope, such an app would be
useless.

The only times this code would be useful, is for instance, in a channel
driver,
while a bridge is in effect. (see chan_sip.c; this kind of code is run
when the 
SNOM360 "Record" button is hit, for instance.)


murf



-- 
Steve Murphy
Software Developer
Digium
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3227 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20070712/a979eecd/attachment.bin 


More information about the asterisk-users mailing list