[Freeswitch-users] message object isn't defined in chatplan

Snabel Kabiya snabel at lexifone.com
Sun Sep 7 14:36:30 MSD 2014


Hi,

I'm following the instructions here to create a script the can intercept
chat messages: http://wiki.freeswitch.org/wiki/Mod_sms#send
when i send a chat message i get the error bellow, why is that? and why the
chat method isn't invoked?


2014-09-07 13:29:53.397788 [INFO] mod_sms.c:336 Processing text message
1111->2222 in context public
Chatplan: 2222 parsing [public->public] continue=false
Chatplan: 2222 at x.x.x.1 Regex (PASS) [public] to(2222 at x.x.x.1) =~ /^(.*)$/
break=on-false
Chatplan: 2222 at x.x.x.1 Action lua(handle_chat.lua)
Chatplan: 2222 at x.x.x.1 Action reply(Hello, you said: ${_body})
Chatplan: 2222 at x.x.x.1 Action send()
*2014-09-07 13:29:53.397788 [ERR] mod_lua.cpp:203
/usr/local/freeswitch/scripts/handle_chat.lua:6: '=' expected near 'body'*



*Public.xml:*
<?xml version="1.0" encoding="utf-8"?>
<include>
    <context name="public">
        <extension name="public">
            <condition field="to" expression="^(.*)$">
                <action application="lua" data="handle_chat.lua"/>
                <action application="reply" data="Hello, you said:
${_body}"/>
                <action application="send"/>
            </condition>
        </extension>
    </context>
</include>


*handle_chat.lua:*
logDebug("handle_chat - start before function");
function chat(message, args)
    logDebug("handle_chat - start in function");
    var body = message:getBody();
    logInfo("chatplan body is=" .. body);
--message:chat_execute("reply", "you said: " .. message:getBody());
    logDebug("handle_chat - end");
end



Thanks,
Snabel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140907/cc7f256d/attachment.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list