This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- In dialplan | |
-- | |
-- actin set pin_number=123456 | |
-- actin lua add_call_block.lua | |
-- | |
require "resources.functions.split" | |
local Database = require "resources.functions.database" | |
local log = require "resources.functions.log".call_block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%module freeswitch | |
%{ | |
#include "freeswitch_lua.h" | |
%} | |
%typemap(in, checkfn = "lua_isfunction") SWIGLUA_FN { | |
$1.L = L; | |
$1.idx = $input; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Native backend to FusionPBX database class | |
-- | |
local log = require "resources.functions.log".database | |
assert(freeswitch, "Require FreeSWITCH environment") | |
local param_pattern = "%f[%a%d:][:]([%a][%a%d_]*)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local curl = require "cURL" | |
local lom = require "lxp.lom" | |
local GISMETEO_CODES = { | |
['7495'] = '27612_1'; | |
['7496'] = '27612_1'; | |
['7499'] = '27612_1'; | |
} | |
local gismeteo_base_url = "http://informer.gismeteo.ru/xml/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- socket = require "pgmoon.lluv".Socket.new() | |
local ut = require "lluv.utils" | |
local socket = require "lluv.luasocket" | |
local flatten = require("pgmoon.util").flatten | |
local function Super(class) | |
return function(self, m, ...) | |
if class.__base and class.__base[m] then | |
return class.__base[m](self, ...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Database = require "resources.functions.database" | |
local route_to_bridge = require "resources.functions.route_to_bridge" | |
local json = require "resources.functions.lunajson" | |
local function decode_value(v) | |
return (string.gsub(v, [[\u00(%x%x)]], { | |
['22'] = '"'; | |
['27'] = "'"; | |
['26'] = "&"; | |
['3C'] = "<"; ['3c'] = "<"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--! @usage | |
-- forward incoming message to some extension | |
-- <action application="lua" data="sms_forward.lua '${from}' '100@my.domain.com'" /> | |
local function escape(s) | |
s = string.gsub(s, '\\', '\\\\') | |
s = string.gsub(s, '|', '\\|') | |
return s | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- API command to fix ALPHANUMERIC source numbers received from mod_gsmopen | |
-- Usage: <action application="set" data="from=${lua(sms_bcd2gsm.lua ${from})}" /> | |
-- !! Do not forget that for resending uses not `from` header but `from_full`. | |
-- | |
-- https://github.com/moteus/lua-tpdu | |
-- | |
assert(stream, 'this is API command') | |
local tut = require "tpdu.utils" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This service can be run as standalone application | |
-- or from FreeSWITCH using `luarun att_xfer_mon.lua` | |
-------------------------------------------------------- | |
local EventService = require "uv_event_service" | |
local Memcached = require "lluv.memcached" | |
local service_name = 'att_xfer' | |
local service = EventService.new(service_name, { '127.0.0.1', '8021', 'ClueCon', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Registry = {} do | |
Registry.__index = Registry | |
function Registry:new() | |
return setmetatable({_r = {0}}, {__index = self}) | |
end | |
function Registry:ref(value) | |
local registry = self._r |