Call Us Today! 877.742.2583




Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

mod_sms bind on GLOBAL message event system, so it catches all MESSAGE events and then route them to the chatplan. If no chatplan entry matches, it works as default - e.g. two clients sending message in a point-to-point manner.

 


Expand
titleClick here to expand Table of Contents


Panel
borderColorlightgray
bgColor#f7f7f7
borderWidth1
borderStyledotted

Table of Contents
maxLevel3
outlinetrue
indent1em
excludeAbout
stylenone
printablefalse


...

Code Block
languagexml
themeEmacs
<?xml version="1.0" encoding="utf-8"?>
<include>
  <context name="default">
    <extension name="demo">
      <condition field="to" expression="^(.*)$">
        <action application="reply" data="Hello, you said: ${_body}"/>
      </condition>
    </extension>
  </context>
</include>

 


Basic Usage With Default Config

...

Code Block
languagexml
themeEmacs
<action application="lua" data="handle_chat.lua"/>
<action application="python" data="handle_chat.py"/>

To prevent the default behavior of sending the message directly even after a chatplan action has matched, set final_delivery to true.

Code Block
<action application="set" data="final_delivery=true"/>


Interface

These scripts are run directly inside the chatplan. They have to define a function called "chat", which is then run. Here's an example from python:

...

Code Block
themeEmacs
freeswitch.consoleLog("info", message:getHeader("from"));
freeswitch.consoleLog("info", message:getHeader("to"));
freeswitch.consoleLog("info", message:serialize());

 


message is a standard event so it's the same API as always with an extra method chat_execute to run the apps.

...