chat messages aren't being forwarded to the second user
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
It is just the header string sometimes - what I did is serialize the 'message:serialize()' and see all header string and craft them similar in my custom event. With that I got it working see below freeswitch.consoleLog("info", "chat console\n"); local event = freeswitch.Event("CUSTOM", "SMS::SEND_MESSAGE"); event:addHeader("proto", "sip"); event:addHeader("dest_proto", "sip"); event:addHeader("from", message:getHeader("from")); event:addHeader("from_host", 'YOURS'); event:addHeader("from_full", message:getHeader("from_full")); event:addHeader("to", to); event:addHeader("to_user", 'YOURS' ); event:addHeader("to_host", 'YOURS'); event:addHeader("type", message:getHeader("type")) msg = message:getBody() if (msg) then event:addBody(msg) end -- freeswitch.consoleLog("info", event:serialize()); -- freeswitch.consoleLog("info", message:serialize()); event:fire(); On Mon, Sep 8, 2014 at 6:35 PM, Snabel Kabiya <snabel@lexifone.com> wrote:
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
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Steve Kieu
participants (2)
-
Snabel Kabiya
-
Steve Kieu