OpenBTS/FreeswitchConfig/chatplan/openbts-chatplan.xml
Kurtis Heimerl 7167ffd198 new versions of freeswitch stuff
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2435 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-04 05:52:11 +00:00

90 lines
4.1 KiB
XML

<!--
Copyright 2011 Kurtis Heimerl. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
THIS SOFTWARE IS PROVIDED BY KURTIS HEIMERL ''AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KURTIS HEIMERL OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the
authors and should not be interpreted as representing official policies, either expressed
or implied, of Kurtis Heimerl.
-->
<?xml version="1.0" encoding="utf-8"?>
<include>
<context name="default">
<!-- set all the openbts variables -->
<extension name="openbts" continue="true">
<condition field="to_user" expression="^smsc$">
<!-- first, parse SMS -->
<action inline="true" application="python" data="OpenBTS_Parse_SMS"/>
<!-- second, look up sender -->
<!-- freeswitch eats 's, switch them up here -->
<action inline="true" application="python" data='OpenBTS_DB SELECT callerid FROM sip_buddies WHERE name="${from_user}"'/>
<!-- result in _openbts_ret -->
<action inline="true" application="set" data="openbts_callerid=${_openbts_ret}"/>
</condition>
</extension>
<!-- register a user in the subscriber registry -->
<extension name="registration">
<condition field="openbts_tp_dest_address" expression="^101$"/>
<!-- is it a number? -->
<condition field="openbts_text" expression="^\d{7,10}$">
<action application="python" data="OpenBTS_New_User"/>
<action application="set" data="response_text=${_openbts_ret}"/>
<!-- lookup new number -->
<action application="python" data='OpenBTS_DB SELECT callerid FROM sip_buddies WHERE name="${from_user}"'/>
<!-- text back the return value -->
<action application="python" data="OpenBTS_Send_SMS ${_openbts_ret}|101|${response_text}"/>
<!-- if not, reply -->
<!-- this doesn't work yet, missing MC->MS encoder
<anti-action application="python" data="OpenBTS_Reply_SMS 101|101|Please send a 7-10 digit number!"/>
-->
</condition>
</extension>
<extension name="echo">
<condition field="openbts_tp_dest_address" expression="^9189$">
<action application="python" data="OpenBTS_Send_SMS ${openbts_callerid}|9189|${openbts_text}"/>
</condition>
</extension>
<extension name="callbacks">
<condition field="openbts_tp_dest_address" expression="^919(\d)$">
<!-- bgapi lets us finish this without waiting for the originate -->
<!-- the space between the args and the dest is important, for some reason -->
<action application="set" data="api_result=${bgapi(originate {origination_caller_id_number=${openbts_tp_dest_address}}sofia/internal/${from}:${from_sip_port} ${openbts_tp_dest_address})}"/>
</condition>
</extension>
<!-- send any other messages onto smqueue -->
<!-- reencode for now... though I'll probably write a "forward" script -->
<extension name="forward">
<condition field="openbts_tp_dest_address" expression="^(.*)$">
<action application="python" data="OpenBTS_Send_SMS ${openbts_tp_dest_address}|${from_user}|${openbts_text}"/>
</condition>
</extension>
</context>
</include>