Skip to content
This repository has been archived by the owner on Sep 26, 2018. It is now read-only.

Event and Notification Feature: #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@ of patent rights can be found in the PATENTS file in the same directory.
<!-- This is a free_sms so we don't need to pass a destination_number to VBTS_Get_Service_Tariff -->
<action inline="true" application="set" data='call_tariff=${python(VBTS_Get_Service_Tariff ${service_type}|sms|)}'/>

<!-- Get the IMSIs status -->
<action inline="true" application="set" data='vbts_account_status=${python(VBTS_Get_Account_Status ${from_imsi})}'/>
<action inline="true" application="set" data='vbts_dest_account_status=${python(VBTS_Get_Account_Status ${vbts_destid}|True)}'/>
<action inline="true" application="set" data='vbts_incoming_account_status=${python(VBTS_Get_Account_Status ${vbts_destid}|True)}'/>

<!-- Determine if the dest number is local -->
<action inline="true" application="python" data='endaga_camped ${vbts_canonical_tp_dest_address}'/>
<action inline="true" application="set" data="endaga_islocal=${_openbts_ret}"/>

<!--Check if number is mapped and has cloud event -->
<action inline="true" application="python" data='endaga_notification EVENT_${vbts_tp_dest_address}'/>
<action inline="true" application="set" data="is_dest_mapped=${_localstr}"/>
<!-- Indicate that default ('global') message forwarding should be
ignored, i.e., message only gets delivered by whatever
actions are taken in the chatplan. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ of patent rights can be found in the PATENTS file in the same directory.
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&ip=${from_sip_ip}&port=${from_sip_port}&ret_num=${vbts_tp_dest_address}" http://127.0.0.1/endaga_registration'/>
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${vbts_tp_dest_address}" http://127.0.0.1/smscdr'/>
<!-- if already provisioned -->
<anti-action application="python" data='endaga_i18n Already registered with number %(number)s.|{"number": ${vbts_callerid}}'/>
<anti-action application="python" data='endaga_notification provisioning|{"from_number": ${vbts_callerid}}'/>
<anti-action application="python" data="VBTS_Send_SMS ${vbts_callerid}|${vbts_tp_dest_address}|${_localstr}"/>
<anti-action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${vbts_tp_dest_address}" http://127.0.0.1/smscdr'/>
</condition>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ of patent rights can be found in the PATENTS file in the same directory.
<!-- Handles unprovisioned phones sending messages to numbers other than 101. -->
<extension name="unprovisioned">
<condition field='${python(VBTS_Get_Auth_From_IMSI ${from_imsi})}' expression="False">
<action application="python" data="endaga_i18n Your phone is not provisioned."/>
<action application="python" data="endaga_notification unprovisioned"/>
<action application="python" data="VBTS_Send_SMS_Direct ${from_imsi}|${from_sip_ip}|${from_sip_port}|101|${_localstr}"/>
</condition>
</extension>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ of patent rights can be found in the PATENTS file in the same directory.
<extension name="billing-check">
<condition field="${vbts_tp_dest_address}" expression="^${credit_check_number}$">
<action application="python" data='endaga_currency ${vbts_account_balance}'/>
<action application="python" data='endaga_i18n Your balance is %(account_bal)s.|{"account_bal": "${_endaga_ret}"}'/>
<action application="python" data='endaga_notification ${credit_check_number}|{"account_bal": "${_endaga_ret}"}'/>
<action application="python" data="VBTS_Send_SMS ${vbts_callerid}|${vbts_tp_dest_address}|${_localstr}"/>
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${vbts_tp_dest_address}" http://127.0.0.1/smscdr'/>
</condition>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ of patent rights can be found in the PATENTS file in the same directory.

<extension name="number-check">
<condition field="${vbts_tp_dest_address}" expression="^${number_check_number}$">
<action application="python" data='endaga_i18n Your number is %(number)s.|{"number": ${vbts_callerid}}'/>
<action application="python" data='endaga_notification ${number_check_number}|{"from_number": ${vbts_callerid}}'/>
<action application="python" data="VBTS_Send_SMS ${vbts_callerid}|${vbts_tp_dest_address}|${_localstr}"/>
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${vbts_tp_dest_address}" http://127.0.0.1/smscdr'/>
</condition>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.

This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
-->

<extension name="endaga-response">
<!--Check first if there is any response against this number-->
<condition field='${is_dest_mapped}' expression="True">
<action application="python" data='endaga_notification ${vbts_tp_dest_address}'/>
<action application="python" data="VBTS_Send_SMS ${vbts_callerid}|${vbts_tp_dest_address}|${_localstr}"/>
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${vbts_tp_dest_address}" http://127.0.0.1/smscdr'/>
</condition>
</extension>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ of patent rights can be found in the PATENTS file in the same directory.
<!-- bad message -->
<extension name="error">
<condition field="${vbts_text}" expression="^@$|^\x05$">
<action application="python" data='endaga_i18n Message not sent to %(dest_number)s.|{"dest_number": ${vbts_tp_dest_address}}'/>
<action application="python" data='endaga_notification sms_error|{"to_number": ${vbts_tp_dest_address}}'/>
<action application="python" data="VBTS_Send_SMS ${vbts_callerid}|${vbts_tp_dest_address}|${_localstr}"/>
<action application="set" data="service_type=error_sms"/>
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${vbts_tp_dest_address}" http://127.0.0.1/smscdr'/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ of patent rights can be found in the PATENTS file in the same directory.
<!-- local routing -->
<extension name="no_money">
<condition field='${cond(${vbts_account_balance} < ${call_tariff} ? YES : NO)}' expression="^YES$">
<action application="python" data="endaga_i18n Your account doesn't have sufficient funds to send an SMS."/>
<action application="python" data="endaga_notification no_money_sms"/>
<action application="python" data="VBTS_Send_SMS ${vbts_callerid}|103|${_localstr}"/>
<action application="set" data="service_type=error_sms"/>
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${vbts_tp_dest_address}" http://127.0.0.1/smscdr'/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.

This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
-->

<extension name="number_status">
<condition field='${vbts_account_status}' expression="False">
<action application="python" data="endaga_notification block_expired"/>
<action application="python" data="VBTS_Send_SMS ${vbts_callerid}|103|${_localstr}"/>
<action application="set" data="service_type=error_sms"/>
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${vbts_tp_dest_address}" http://127.0.0.1/smscdr'/>
</condition>
</extension>

<extension name="called_number_status">
<condition field='${vbts_dest_account_status}' expression="False">
<action application="python" data="endaga_notification receiver_expired"/>
<action application="python" data="VBTS_Send_SMS ${vbts_callerid}|103|${_localstr}"/>
<action application="set" data="service_type=error_sms"/>
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${vbts_tp_dest_address}" http://127.0.0.1/smscdr'/>
<action application="hangup"/>
</condition>
</extension>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ of patent rights can be found in the PATENTS file in the same directory.
<!-- local routing -->
<extension name="address_check">
<condition field="${vbts_tp_dest_address}" expression="^(.*)$">
<action application="python" data="endaga_i18n Invalid Address"/>
<action application="python" data="endaga_notification invalid_address"/>
<action application="python" data="VBTS_Send_SMS ${vbts_callerid}|000|${_localstr}"/>
<action application="set" data="service_type=error_sms"/>
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${vbts_tp_dest_address}" http://127.0.0.1/smscdr'/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ of patent rights can be found in the PATENTS file in the same directory.
<action inline="true" application="set" data='vbts_destid=${python(VBTS_Get_IMSI_From_Number ${canonical_destination_number})}'/>
<!-- Get the caller's account balance, 'from_imsi' is an IMSI -->
<action inline="true" application="set" data='vbts_account_balance=${python(VBTS_Get_Account_Balance ${from_imsi})}'/>
<!--Get IMSIs Status -->
<action inline="true" application="set" data='vbts_account_status=${python(VBTS_Get_Account_Status ${from_imsi})}'/>
<action inline="true" application="set" data='vbts_dest_account_status=${python(VBTS_Get_Account_Status ${vbts_destid}|True)}'/>
<action inline="true" application="set" data='endaga_uuid=${system /usr/local/bin/snowflake}'/>
<action inline="true" application="set" data='endaga_uuid=${endaga_uuid:0:36}'/>
<action inline="true" application="set" data='endaga_apikey=${python(endaga_config_get endaga_token)}'/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ of patent rights can be found in the PATENTS file in the same directory.
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&ip=${sip_received_ip}&port=${sip_received_port}&ret_num=${destination_number}" http://127.0.0.1/endaga_registration'/>
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${destination_number}" http://127.0.0.1/smscdr'/>
<!-- if already provisioned -->
<anti-action application="python" data='endaga_i18n Already registered with number %(number)s.|{"number": ${vbts_callerid}}'/>
<anti-action application="python" data='endaga_notification provisioning|{"from_number": ${vbts_callerid}}'/>
<anti-action application="python" data="VBTS_Send_SMS ${vbts_callerid}|${destination_number}|${_localstr}"/>
<anti-action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${destination_number}" http://127.0.0.1/smscdr'/>
</condition>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
-->

<extension name="unprovisioned">
<!-- register a user in the subscriber registry -->
<extension name="registration_endaga">
<!-- user not already provisioned -->
<condition field="${destination_number}" expression="^101$"/>
<condition field='${python(VBTS_Get_Auth_From_IMSI ${from_imsi})}' expression="False">
<action application="set" data='service_type=error_call'/>
<action application="export" data='service_type=error_call'/>
<action application="python" data='endaga_i18n Your phone is not provisioned.'/>
<action application="set" data='res=${python(VBTS_Send_SMS_Direct ${from_imsi}|${sip_received_ip}|${sip_received_port}|101|${_localstr})}'/>
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&ip=${sip_received_ip}&port=${sip_received_port}&ret_num=${destination_number}" http://127.0.0.1/endaga_registration'/>
<action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${destination_number}" http://127.0.0.1/smscdr'/>
<!-- if already provisioned -->
<anti-action application="python" data='endaga_notification provisioning|{"from_number": ${vbts_callerid}}'/>
<anti-action application="python" data="VBTS_Send_SMS ${vbts_callerid}|${destination_number}|${_localstr}"/>
<anti-action application="system" data='curl --data "from_number=${vbts_callerid}&from_name=${from_imsi}&service_type=${service_type}&destination=${destination_number}" http://127.0.0.1/smscdr'/>
</condition>
</extension>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ of patent rights can be found in the PATENTS file in the same directory.
<extension name="credit_check">
<condition field="${destination_number}" expression="^${credit_check_number}$">
<action application="set" data='balance=${python(endaga_currency ${vbts_account_balance})}' />
<action application="python" data='endaga_i18n Your balance is %(account_bal)s.|{"account_bal": "${balance}"}'/>
<action application="python" data='endaga_notification ${credit_check_number}|{"account_bal": "${balance}"}'/>
<action application="set" data='res=${python(VBTS_Send_SMS ${vbts_callerid}|${destination_number}|${_localstr})}'/>
</condition>
</extension>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ of patent rights can be found in the PATENTS file in the same directory.

<extension name="number_check">
<condition field="${destination_number}" expression="^${number_check_number}$">
<action application="python" data='endaga_i18n Your number is %(number)s.|{"number": ${vbts_callerid}}'/>
<action application="python" data='endaga_notification ${number_check_number}|{"from_number": ${vbts_callerid}}'/>
<action application="set" data='res=${python(VBTS_Send_SMS ${vbts_callerid}|${destination_number}|${_localstr})}'/>
</condition>
</extension>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ of patent rights can be found in the PATENTS file in the same directory.
<condition field='${cond(${vbts_account_balance} < ${call_tariff} ? YES : NO)}' expression="^YES$">
<action application="set" data='service_type=error_call'/>
<action application="export" data='service_type=error_call'/>
<action application="python" data="endaga_i18n Your account doesn't have sufficient funds."/>
<action application="python" data="endaga_notification no_money"/>
<action application="set" data='res=${python(VBTS_Send_SMS ${vbts_callerid}|103|${_localstr})}'/>
<action application="answer"/>
<action application="speak" data='flite|slt|${_localstr}'/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.

This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
-->

<extension name="number_status">
<condition field='${vbts_callerid}' expression="^\d+$"/>
<condition field='${vbts_account_status}' expression="False">
<action application="set" data='service_type=error_call'/>
<action application="export" data='service_type=error_call'/>
<action application="python" data="endaga_notification block_expired"/>
<action application="set" data='res=${python(VBTS_Send_SMS ${vbts_callerid}|103|${_localstr})}'/>
<action application="answer"/>
<action application="speak" data='flite|slt|${_localstr}'/>
<action application="hangup"/>
</condition>
</extension>

<extension name="called_number_status">
<condition field='${vbts_dest_account_status}' expression="False">
<action application="hangup"/>
</condition>
</extension>
Loading