Create send.lua

This commit is contained in:
FusionPBX 2024-06-17 15:01:02 -06:00 committed by GitHub
parent 0f48b98ced
commit 577e929a4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
--get the channel variables
if (session:ready()) then
domain_uuid = session:getVariable("domain_uuid");
uuid = session:getVariable("uuid");
event_subclass = session:getVariable("event_subclass");
json_data = session:getVariable("json_data");
caller_id_name = session:getVariable("caller_id_name");
caller_id_number = session:getVariable("caller_id_number");
end
--initialize and send the event
local event = freeswitch.Event("CUSTOM", event_subclass);
event:addHeader('domain_uuid', domain_uuid);
event:addHeader('uuid', uuid);
event:addHeader('caller_id_name', caller_id_name);
event:addHeader('caller_id_number', caller_id_number);
if (json_data) then
event:addBody(json_data);
end
event:fire();