Не понимаю... Вот что в итоге родилось
Код:
freeswitch.consoleLog("info", "chat console\n");
local body = message:getBody();
local from = string.gsub(message:getHeader("from"),"8.8.8.8", "192.168.0.40" );
local to = string.gsub(message:getHeader("to"),"8.8.8.8", "192.168.0.40" );
local event = freeswitch.Event("CUSTOM", "SMS::SEND_MESSAGE");
event:addHeader("from", from);
event:addHeader("from_host", '192.168.0.40');
event:addHeader("from_full", from);
event:addHeader("to", to);
event:addHeader("to_user", to );
event:addHeader("to_host", '192.168.0.40');
event:addHeader("type", message:getHeader("type"));
msg = message:getBody()
if (msg) then
event:addBody(msg)
end
event:fire();
freeswitch.consoleLog("info", event:serialize());
--freeswitch.consoleLog("info", message:serialize());
И вроде бы оно этот скрипт жрёт. Но в итоге сообщения не приходят и в логе выходит следующее:
Код:
2015-06-04 12:32:29.280019 [INFO] mod_sms.c:336 Processing text message 1007->1001 in context public
Chatplan: 1001 parsing [public->sms_test] continue=false
Chatplan: 1001@8.8.8.8 Regex (PASS) [sms_test] destination_number() =~ /^(.*)$/ break=on-false
Chatplan: 1001@8.8.8.8 Action lua(lua/sms.lua)
2015-06-04 12:32:29.280019 [INFO] switch_cpp.cpp:1328 chat console
2015-06-04 12:32:29.280019 [INFO] switch_cpp.cpp:1328 'Event-Name: CUSTOM
Core-UUID: 3ebcb2ae-e68a-4725-80cd-d39827f6af04
FreeSWITCH-Hostname: voipsrv
FreeSWITCH-Switchname: voipsrv
FreeSWITCH-IPv4: 192.168.0.40
FreeSWITCH-IPv6: %3A%3A1
Event-Date-Local: 2015-06-04%2012%3A32%3A29
Event-Date-GMT: Thu,%2004%20Jun%202015%2009%3A32%3A29%20GMT
Event-Date-Timestamp: 1433410349280019
Event-Calling-File: switch_cpp.cpp
Event-Calling-Function: Event%3A%3AEvent
Event-Calling-Line-Number: 296
Event-Sequence: 901
Event-Subclass: SMS%3A%3ASEND_MESSAGE
from: 1007%40192.168.0.40
from_host: 192.168.0.40
from_full: 1007%40192.168.0.40
to: 1001%40192.168.0.40
to_user: 1001%40192.168.0.40
to_host: 192.168.0.40
type: text/plain
Content-Length: 6
121212'2015-06-04 12:32:29.280019 [DEBUG] sofia_presence.c:225 Can't find registered user 1001@8.8.8.8
(Где на 8,8,8,8 заменил внешний адрес.) Что ему ещё нужно то, а?