Looking at the logs, I see that when Handle Queue Announcements is set to Yes, it seems like VQplus is generating a ChanSpy call that plays the greeting, which is now obvious to me why it does not stop MOH.
-- Executing [[email protected]:64] Queue("SIP/SIPTrunk-0002f699", "88801,t,,,,,,,0,") in new stack
-- Started music on hold, class 'default', on channel 'SIP/SIPTrunk-0002f699'
Called 1630407528*[email protected]/n
-- Executing [1630407528*[email protected]:1] Set("Local/1630407528*[email protected];2", "CDR_PROP(disable)=true") in new stack
-- Executing [1630407528*[email protected]:2] Set("Local/1630407528*[email protected];2", "CHANNEL(language)=en") in new stack
-- Executing [1630407528*[email protected]:3] Answer("Local/1630407528*[email protected];2", "") in new stack
-- Local/1630407528*[email protected];1 answered
-- Executing [1630407528*[email protected]_chanspy:1] Set("Local/1630407528*[email protected];1", "CDR_PROP(disable)=true") in new stack
-- Executing [1630407528*[email protected]_chanspy:2] ChanSpy("Local/1630407528*[email protected];1", "SIP/SIPTrunk-0002f699,wqv(4)") in new stack
== Spying on channel SIP/SIPTrunk-0002f699
-- Attaching spy channel Local/1630407528*[email protected];1 to SIP/SIPTrunk-0002f699
-- Attaching spy channel Local/1630407528*[email protected];1 to SIP/SIPTrunk-0002f699
-- Executing [1630407528*[email protected]:4] GotoIf("Local/1630407528*[email protected];2", "0?pos:holdtime") in new stack
-- Goto (queuecallback-playposition,1630407528*1594943,9)
-- Executing [1630407528*[email protected]:9] GotoIf("Local/1630407528*[email protected];2", "0?playhold:periodic") in new stack
-- Goto (queuecallback-playposition,1630407528*1594943,14)
-- Executing [1630407528*[email protected]:14] GotoIf("Local/1630407528*[email protected];2", "1?periodicannounce:hangup") in new stack
-- Goto (queuecallback-playposition,1630407528*1594943,15)
-- Executing [1630407528*[email protected]:15] Playback("Local/1630407528*[email protected];2", "custom/ToRequestAcallbackPress1") in new stack
-- <Local/1630407528*[email protected];2> Playing 'custom/ToRequestAcallbackPress1.slin' (language 'en')
-- Executing [1630407528*[email protected]:16] Hangup("Local/1630407528*[email protected];2", "") in new stack
== Spawn extension (queuecallback-playposition, 1630407528*1594943, 16) exited non-zero on 'Local/1630407528*[email protected];2'
== Done Spying on channel SIP/SIPTrunk-0002f699
== Spawn extension (queuecallback_chanspy, 1630407528*1594943, 2) exited non-zero on 'Local/1630407528*[email protected];1'
Sooo… This got me thinking if that dialplan can stop MOH on the channel, play the recording and start MOH again?
Looking through the Asterisk functions and applications, it seems like you can only manipulate the audio steams on the current channel, not on another channel.
With ARI, if the channel is in Statis, it is possible:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Channels+REST+API#Asterisk16ChannelsRESTAPI-stopMoh
https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Channels+REST+API#Asterisk16ChannelsRESTAPI-startMoh
Is there a way to do the equivalent in the dialplan, or through AGI/AMI?
THanks