[Freeswitch-users] Problems with wait_for_silence API call

Matthew matthew at brightfire.net
Thu Jun 9 01:05:02 MSD 2016


Hello All,

I've having a problem with the wait_for_silence API call in lua. When I 
attempt to orginate a call and then check for silence on the line, I'm 
getting unpredictable results. Sometimes it seems to work, but more 
times than not it times out ( switch_ivr_wait_for_silence: TIMEOUT 0 ). 
To test this, I answer the call, speak a short greeting and then mute 
the handset. In other words, I know the script should be detecting 
silence on the other end of the call. Here is a good portion of the test 
script I'm using ...

local cid_name   = argv[1]
local cid_number = argv[2]
local gw_string  = argv[3]
local queue_ext  = argv[4]

dialout_string =
   "{origination_caller_id_name='" .. cid_name .. "'," ..
   "origination_caller_id_number=" .. cid_number .. "," ..
   "ignore_early_media=true}" .. gw_string

dialout_session = freeswitch.Session( dialout_string )

while dialout_session:ready() and not dialout_session:answered() do
   freeswitch.msleep( 250 )
end

if dialout_session:ready() and dialout_session:answered() then

   dialout_session:consoleLog( "INFO", "dialout: connected to " .. 
gw_string ) )

   dialout_session:execute( "voice_start" )
   dialout_session:sleep( 2000 )
   dialout_session:execute( "wait_for_silence", "300 30 15 15000" )
   dialout_session:execute( "voice_stop" )

   dialout_session:consoleLog( "INFO", "dialout: amd_detect = " .. 
amd_detect )

end

And here is an example of how I would invoke the script ...

luarun dialout.lua TEST 1234567890 sofia/gateway/twilio/+1234567890 7000

Any ideas why the wait_for_silence API call would be misbehaving? Any 
suggestions on how I could debug this problem further?

Thanks,

-Matthew



Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list