[Freeswitch-users] chat messages aren't being forwarded to the second user

Snabel Kabiya snabel at lexifone.com
Mon Sep 8 12:35:10 MSD 2014


Hi,

I'm using Linphone to test mod_sms on smart phones, the chat messages
aren't being forwarded to the second user.
I've two registered users 3333 and 4444. when i use action "send" the
message is forwarded, but when i use my script with event fire it's
not...what am i missing?

*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*

local body = message:getBody();
local from = message:getHeader("from");
local to = message:getHeader("to");
freeswitch.consoleLog("info", message:getHeader("from"));
freeswitch.consoleLog("info", message:getHeader("to"));
freeswitch.consoleLog("info", message:serialize());
freeswitch.consoleLog("info", message:getBody() .. "\n");
local event = freeswitch.Event("CUSTOM", "SMS::SEND_MESSAGE");
event:addHeader("proto", "sip");
event:addHeader("dest_proto", "sip");
event:addHeader("from", "sip:" .. from);
event:addHeader("from_full", "sip:" .. from);
event:addHeader("to", to);
event:addHeader("type", "text/html");
event:addHeader("replying", "true");
event:addBody("Hello from Seven Du! Have funnnnnnn!");
freeswitch.consoleLog("info", event:serialize());
event:fire();



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


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