脚本代码

脚本名称:setrandomcaller.lua
调用方式:在拨号方案中调用

  1. local callerNumbers={
  2. "02012344566",
  3. "02012344567"
  4. }
  5. math.randomseed(tostring(os.time()):reverse():sub(1, 6))
  6. id = math.random(1,#callerNumbers)
  7. destNum = session:getVariable("destination_number") or "";
  8. freeswitch.consoleLog("info", "___" .. argv[0] .. ":" .. destNum .. "___change caller number to " .. callerNumbers[id] .. "\n");
  9. session:setVariable("effective_caller_id_number", callerNumbers[id])