Asterisk synchronous / asynchronous management

Hello everyone…
in IVR with Asterisk I have been using mixed TTS (amazon Polly) and STT (Google SR) systems for years, with asynchronous operation, therefore with Record() and Playback(). I was wondering how to handle this asynchrony differently, in the sense of intercepting the caller’s voice towards the pbx by interrupting any playback(), for example when the caller intends to interrupt the current playback and speaks for more than a couple of seconds. In order to be able to restart the Record() function.

Maybe check out the BackgroundDetect() application or some of the Speech… applications ?

i tried,nothing…

I managed…when the call came in :

same => n,Answer()
same => n,Set(CURRENT_CHANNEL=${CHANNEL})
same => n,System(echo -e “Action: Login\nUsername: admin\nSecret: 123secret\n\nAction: Originate\nChannel: Local/s@whisper-to-all\nApplication: Playback\nData: office\nSetVar: CHANNEL_TO_SPY=${CURRENT_CHANNEL}\n\nAction: Logoff\n” | nc 127.0.0.1 5038)
same => n,Playback(./silence/1)

[whisper-to-all]
exten => s,1,Answer()
same => n,ChanSpy(${CHANNEL_TO_SPY},qw)
same => n,Hangup()

this inject office.wav on the channel

now a further problem has arisen… if I restart asterisk the file is whispered in the background in the 2 subsequent calls… then from the third onwards no more…
does anyone know why?

Assuming that is ${CHANNEL(name)}or if not you are using FILTER() function ?

Overall, that is one clever way to do it with System(), which is a very powerful application; however, it is synchronous, and any typos or dirty user data can cause problems. Another option is Originate(), which puts up a few more guardrails, and it offers an asynchronous option ‘a’.

Are there some left over call spool files from a previous attempt to get this working eg. in /var/spool/asterisk/outgoing/ ? Channel numbering restarts when you restart Asterisk.

Slightly aside, the markdown-lite options for formatting code can help line up dial plan a little better eg. three back-ticks at the beginning and end of a multi-line section.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.