[Freeswitch-users] easy way to crash freeswitch

Thomas Hoellriegel admin at blindi.net
Sun Dec 9 11:25:37 MSK 2012


Hi guys, i found a easy way to crash fs.

first, you must record a testsoundfile 5 secs, for example: 
/usr/local/freeswitch/sounds/test.alaw
Write the following luascript in:
/usr/local/freeswitch/script/simpy-crash.lua
with:

-- simply script to crash freeswitch
session:sleep(100);
session:answer()
session:sleep(200);
  session:setInputCallback("onInput", "");
function onInput(s, type, obj)
   freeswitch.consoleLog("info", "Callback with type " .. type .. "\n");
--  freeswitch.consoleLog("info", "DTMF Digit: " .. obj.digit .. "\n");

   if ( obj['digit'] == '1' ) then

session:streamFile("/usr/local/freeswitch/sounds/test.alaw")
read_msg_menu()
  return("false");

end

   if ( obj['digit'] == '2' ) then

-- if (obj.digit   == "2")  then 
--  session:streamFile(msg_file_play)
session:streamFile("/usr/local/freeswitch/sounds/test.alaw")
read_msg_menu()
  return("false");

end

   if ( obj['digit'] == '3' ) then

-- if (obj.digit   == "3")  then 
--  session:streamFile(msg_file_play)
session:streamFile("/usr/local/freeswitch/sounds/test.alaw")
read_msg_menu()
  return("false");

end


end

function read_msg_menu( )
  session:setInputCallback("onInput");
session:streamFile("/usr/local/freeswitch/sounds/test.alaw")
end


  read_msg_menu()

-- end script


edit:
/usr/local/freeswitch/dialplan/default/crash.xml

<!-- crash test lua  -->
   <!--    -->

<extension name="crashtest" >
<condition field="destination_number" expression="^104$">
<action application="lua" data="simply-crash.lua"/>
<!-- <action application="start_dtmf" />    --> 
</condition>
</extension>

reload the dialplan:
fs_cli -x "reloadxml"

Dial extension 104, and heare your voice.
you must break the voice: press 90 times 1.
Fs is ready to crash.
Fs crash with segfault.
This is a good bug for sysadmins.-).










Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list