Using Chanspy to listen to call and detect DTMF

Hi Im wondering if I can do the follow
Use chanspy to listen to call and listen for two tones
then detect DTMF tones played after this,
listen for a further tone then
record DTMF tones in a flat file and then action a php file with them.

The chanspy part is very easy to do. the DTMF part can be completed using AMI events could be DTMFBegin or DTMFEnd you can use the php fsockopen() function to conect your php script to the Asterisk’s manager.

Why don’t use Read application to get the dtmf values in a variable and then export it to the flat file that you need.

thanks astbox, this could be possible, but my aim is to listen in to a connection on a Cisco SPA3102 between the phone and pstn line connection, so I was just out for some ideas.

Using Read is good method, but in this case is useless. As I already said before, you need to catch the AMI’s events related to DTMF

Thanks Ambiorixg, Ive just to determine if you can even use chanspy to listen in to a direct connection on a Cisco Device as the call wont actually be going through asterisk, unless I can make it come in and go out the PSTN line.

ChanSpy() can only Listen to an Asterisk channel, and optionally whisper into it.