<div dir="ltr">Hi Ivan,<div><br></div><div>You can start avmd on channel and then process ESL events waiting for a <span style="color:rgb(0,0,0);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">AVMD_EVENT_BEEP and </span><span style="font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">AVMD_EVENT_SESSION_STOP.</span></div><div><p style="margin:10px 0px 0px;padding:0px;color:rgb(23,43,77);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">To get all avmd events you can subscribe to all FS events and filter them by "Call-command":</p><div class="gmail-code gmail-panel gmail-pdl gmail-conf-macro gmail-output-block" style="margin:10px 0px;padding:0px;color:rgb(51,51,51);border:1px solid rgb(223,225,229);overflow:auto;border-radius:3px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><div class="gmail-codeContent gmail-panelContent gmail-pdl" style="margin:0px;padding:0px;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;line-height:20px;overflow:hidden;border-bottom-left-radius:3px;border-bottom-right-radius:3px"><div style="margin:0px;padding:0px"><div id="gmail-highlighter_494712" class="gmail-syntaxhighlighter gmail-sh-fadetogrey gmail-nogutter gmail-cpp" style="margin:0px;padding:0px;width:2158px;overflow:auto;font-size:1em;background-color:rgb(18,18,18)"><table border="0" cellpadding="0" cellspacing="0" style="border-radius:0px;background:none;border:0px;float:none;height:auto;line-height:20px;margin:0px;outline:0px;overflow:visible;padding:0px;vertical-align:baseline;width:2158px;box-sizing:content-box;font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;min-height:inherit"><tbody style="border-radius:0px;background:none;border:0px;float:none;height:auto;line-height:20px;margin:0px;outline:0px;overflow:visible;padding:0px;vertical-align:baseline;width:auto;box-sizing:content-box;min-height:inherit"><tr style="border-radius:0px;background:none;border:0px;float:none;height:auto;line-height:20px;margin:0px;outline:0px;overflow:visible;padding:0px;vertical-align:baseline;width:auto;box-sizing:content-box;min-height:inherit"><td class="gmail-code" style="border:0px;background:none;overflow:visible;border-radius:0px;float:none;height:auto;line-height:20px;outline:0px;padding:0px 0px 0px 15px;vertical-align:baseline;width:2143px;box-sizing:content-box;font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;min-height:inherit"><div class="gmail-container" title="Hint: double-click to select code" style="margin:15px 0px 0px;padding:0px 0px 15px 0em;border-radius:0px;background:none;border:0px;float:none;height:auto;line-height:20px;outline:0px;overflow:visible;vertical-align:baseline;width:auto;box-sizing:content-box;min-height:inherit;white-space:pre-wrap"><div class="gmail-line gmail-number1 gmail-index0 gmail-alt2" style="margin:0px;padding:0px 1em 0px 0em;border-radius:0px;background-image:none;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;border:0px;float:none;height:auto;line-height:20px;outline:0px;overflow:visible;vertical-align:baseline;width:auto;box-sizing:content-box;min-height:inherit;white-space:nowrap"><code class="gmail-cpp gmail-plain" style="font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;white-space:pre-wrap;border-radius:0px;background:none;border:0px;float:none;height:auto;line-height:20px;margin:0px;outline:0px;overflow:visible;padding:0px;vertical-align:baseline;width:auto;box-sizing:content-box;min-height:inherit;color:white">event all</code></div><div class="gmail-line gmail-number2 gmail-index1 gmail-alt1" style="margin:0px;padding:0px 1em 0px 0em;border-radius:0px;background-image:none;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;border:0px;float:none;height:auto;line-height:20px;outline:0px;overflow:visible;vertical-align:baseline;width:auto;box-sizing:content-box;min-height:inherit;white-space:nowrap"><code class="gmail-cpp gmail-plain" style="font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;white-space:pre-wrap;border-radius:0px;background:none;border:0px;float:none;height:auto;line-height:20px;margin:0px;outline:0px;overflow:visible;padding:0px;vertical-align:baseline;width:auto;box-sizing:content-box;min-height:inherit;color:white">filter Call-command avmd</code></div></div></td></tr></tbody></table></div></div></div></div></div><div><font face="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Fira Sans, Droid Sans, Helvetica Neue, sans-serif"><span style="font-size:14px"><br></span></font></div><div><font face="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Fira Sans, Droid Sans, Helvetica Neue, sans-serif"><span style="font-size:14px">see: </span></font><a href="https://freeswitch.org/confluence/display/FREESWITCH/mod_avmd#mod_avmd-Events">https://freeswitch.org/confluence/display/FREESWITCH/mod_avmd#mod_avmd-Events</a></div><div><br></div><div>Examples can be found here: <a href="https://freeswitch.org/confluence/display/FREESWITCH/mod_avmd#mod_avmd-SubscribetoAVMDevents">https://freeswitch.org/confluence/display/FREESWITCH/mod_avmd#mod_avmd-SubscribetoAVMDevents</a></div><div>and in the source: ls src/mod/applications/mod_avmd/scripts/</div><div><a href="http://avmd_get_events.pl">avmd_get_events.pl</a> <a href="http://avmd_originate_multiple_loopback.pl">avmd_originate_multiple_loopback.pl</a> <a href="http://avmd_originate_multiple.pl">avmd_originate_multiple.pl</a> <a href="http://avmd_originate.pl">avmd_originate.pl</a> <a href="http://avmd_test.pl">avmd_test.pl</a> </div><div><br></div><div>all the best,</div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><font style="background-color:rgb(255,255,255)" size="4" face="arial, helvetica, sans-serif"><img src="https://drive.google.com/a/dataandsignal.com/uc?id=1lUdzdLjEycxXcGhDz-bKqDX8-AIlZuCq&export=download" width="96" height="49"><br></font></div><div><font style="background-color:rgb(255,255,255)" size="4" face="arial, helvetica, sans-serif"><br></font></div><div><font style="background-color:rgb(255,255,255)" size="4" face="arial, helvetica, sans-serif">Piotr Gregor</font></div><div><span style="background-color:rgb(255,255,255)"><font size="2" face="arial, helvetica, sans-serif">Software Engineer</font></span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:x-small"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:x-small">M: (+44) 07483 866 525 </span><span style="font-family:arial,helvetica,sans-serif;font-size:x-small"> </span><span style="font-family:arial,helvetica,sans-serif;font-size:x-small">www: </span><a href="http://dataandsignal.com" style="font-family:arial,helvetica,sans-serif;font-size:x-small" target="_blank">dataandsignal.com</a></div><div><br></div><div><br><br><br></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 24, 2019 at 6:30 PM ivan381eu <<a href="mailto:i.vujisic@gmail.com">i.vujisic@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">What I need is to start intro sound file playback on call answer and detect<br>
beep sound from callee side<br>
<br>
What I tried is:<br>
<br>
1. start avmd<br>
2. bridge call<br>
3. on answer start intro sound message playback using bgapi<br>
BUT when background playback starts avmd seems to be paused and continues<br>
after playback is completed.<br>
<br>
gateway dialplan is:<br>
<br>
<extension name="mytelco"><br>
<condition field="destination_number" expression="^987(\d+)$"><br>
<action application="set"<br>
data="effective_caller_id_number=46xxxxxxxx"/><br>
<br>
<action application="set"<br>
data="record_link=${strftime(%Y-%m-%d-%H-%M-%S)}_${destination_number}_${caller_id_number}.wav"/><br>
<action application="record_session"<br>
data="/var/www/html/freeswitch/recordings/${record_link}"/><br>
<action application="lua"<br>
data="/etc/freeswitch/scripts/beep_detection-from-call-v0.1.2.lua $1<br>
${record_link}"/><br>
<action application="hangup"/><br>
</condition><br>
</extension><br>
<br>
<br>
<br>
file beep_detection-from-call-v0.1.2.lua<br>
<br>
#!/usr/local/bin/lua<br>
<br>
DNID = argv[1]<br>
<br>
if session:ready() then<br>
session:sleep(1000)<br>
session:execute("avmd_start",<br>
"inbound_channel=1,outbound_channel=0,sample_n_continuous_streak=10,sample_n_to_skip=0,debug=1,report_status=1")<br>
<br>
session:execute("bridge", "{execute_on_answer=lua<br>
/etc/freeswitch/scripts/on_answer-v0.3.lua " .. uuid ..<br>
"}sofia/gateway/mytelco/" .. DNID)<br>
<br>
session:execute("avmd_stop","")<br>
<br>
end --if<br>
<br>
<br>
<br>
<br>
file on_answer-v0.3.lua<br>
<br>
#!/usr/bin/lua<br>
<br>
uuid_original = argv[1]<br>
<br>
api = freeswitch.API()<br>
<br>
reply = api:executeString("bgapi uuid_broadcast " .. uuid_original .. "<br>
/usr/share/asterisk/sounds/en/dennis-ivan.gsm both")<br>
<br>
freeswitch.consoleLog("INFO","==============================================")<br>
freeswitch.consoleLog("INFO","API reply is:" .. reply)<br>
freeswitch.consoleLog("INFO","==============================================")<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://freeswitch-users.2379917.n2.nabble.com/" rel="noreferrer" target="_blank">http://freeswitch-users.2379917.n2.nabble.com/</a><br>
<br>
_________________________________________________________________________<br>
<br>
The FreeSWITCH project is sponsored by SignalWire <a href="https://signalwire.com" rel="noreferrer" target="_blank">https://signalwire.com</a><br>
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.<br>
Build your next product on our scalable cloud platform.<br>
<br>
Join our online community to chat in real time <a href="https://signalwire.community" rel="noreferrer" target="_blank">https://signalwire.community</a><br>
<br>
Professional FreeSWITCH Services<br>
<a href="mailto:sales@freeswitch.com" target="_blank">sales@freeswitch.com</a><br>
<a href="https://freeswitch.com" rel="noreferrer" target="_blank">https://freeswitch.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="https://freeswitch.com/oss" rel="noreferrer" target="_blank">https://freeswitch.com/oss</a><br>
<a href="https://freeswitch.org/confluence" rel="noreferrer" target="_blank">https://freeswitch.org/confluence</a><br>
<a href="https://cluecon.com" rel="noreferrer" target="_blank">https://cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="https://freeswitch.com" rel="noreferrer" target="_blank">https://freeswitch.com</a></blockquote></div>