From IvanV, 5 Years ago, written in FreeSWITCH.
- go back
Embed
Viewing differences between and uuid_broadcast & avmd
  1. gateway dialplan is:
  2.  
  3. <extension name="mytelco">
  4.         <condition field="destination_number" expression="^987(\d+)$">
  5.             <action application="set" data="effective_caller_id_number=46xxxxxxxx"/>
  6.             <param name="caller-id-in-from" value="true"/>
  7.             <action application="set" data="record_link=${strftime(%Y-%m-%d-%H-%M-%S)}_${destination_number}_${caller_id_number}.wav"/>
  8.             <action application="record_session" data="/var/www/html/freeswitch/recordings/${record_link}"/>
  9.             <action application="lua" data="/etc/freeswitch/scripts/beep_detection-from-call-v0.1.2.lua $1 ${record_link}"/>
  10.             <action application="hangup"/>
  11.         </condition>
  12.     </extension>
  13.    
  14.    
  15.    
  16. file beep_detection-from-call-v0.1.2.lua
  17.  
  18. #!/usr/local/bin/lua
  19.  
  20. DNID = argv[1]
  21.  
  22. if session:ready() then
  23.    session:sleep(1000)
  24.    session:execute("avmd_start", "inbound_channel=1,outbound_channel=0,sample_n_continuous_streak=10,sample_n_to_skip=0,debug=1,report_status=1")
  25.  
  26.     session:execute("bridge", "{execute_on_answer=lua /etc/freeswitch/scripts/on_answer-v0.3.lua " .. uuid .. "}sofia/gateway/mytelco/" .. DNID)
  27.  
  28.     session:execute("avmd_stop","")
  29.  
  30. end --if
  31.  
  32.  
  33.  
  34. file on_answer-v0.3.lua
  35.  
  36. #!/usr/bin/lua
  37.  
  38. uuid_original = argv[1]
  39.  
  40. api = freeswitch.API()
  41.  
  42. reply = api:executeString("bgapi uuid_broadcast " .. uuid_original .. " /usr/share/asterisk/sounds/en/dennis-ivan.gsm both")
  43.  
  44. freeswitch.consoleLog("INFO","==============================================")
  45. freeswitch.consoleLog("INFO","API reply is:" .. reply)
  46. freeswitch.consoleLog("INFO","==============================================")