Hello,

I want to make a program, that makes a call to the user and calls my script when it ends.

I run the following script:

dialA = "{origination_caller_id_number="..telephone_from..",ignore_early_media=true}sofia/gateway/iskratel/"..telephone_to

                             
while(legA:ready() and dispoA ~= "ANSWER") do
  dispoA = legA:getVariable("endpoint_disposition")
  freeswitch.consoleLog("INFO","Leg A disposition is '" .. dispoA .. "'\n")
  legA:execute("set", "api_hangup_hook=luarun autoinform_cleanup.lua");
  legA:execute("set", "session_in_hangup_hook=true");
  legA:execute("playback", "/usr/local/freeswitch/sounds/alert.wav");
  legA:execute("hangup");
end

and simple log of autoinform_cleanup.lua

dat = env:serialize()           
freeswitch.consoleLog("INFO","Here's everything:\n" .. dat .. "\n")


It makes a call, but when autoinform_cleanup.lua is called
I see this in console

/usr/local/freeswitch/scripts/autoinform_cleanup.lua:1: attempt to index global 'env' (a nil value)


--
Kamil Nigmatullin
Tel: 77272323748
mob: 7 (707) 2517003
Skype: kamil.nigmatullin