[mod_snom] Remove from tree.

This commit is contained in:
Andrey Volk 2024-12-02 17:58:09 +03:00
parent 33f7be8986
commit 4c447a98ed
17 changed files with 1 additions and 553 deletions

View File

@ -291,8 +291,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_shout", "src\mod\format
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libogg", "libs\win32\libogg\libogg.2017.vcxproj", "{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_snom", "src\mod\applications\mod_snom\mod_snom.2017.vcxproj", "{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_zh", "src\mod\say\mod_say_zh\mod_say_zh.2017.vcxproj", "{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_managed", "src\mod\languages\mod_managed\mod_managed.2017.vcxproj", "{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}"
@ -1216,17 +1214,6 @@ Global
{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|Win32.Build.0 = Release|Win32
{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.ActiveCfg = Release|x64
{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.Build.0 = Release|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|Win32.ActiveCfg = Release|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64.ActiveCfg = Release|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64.Build.0 = Release|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.ActiveCfg = Debug|Win32
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.Build.0 = Debug|Win32
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.ActiveCfg = Debug|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.Build.0 = Debug|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.ActiveCfg = Release|Win32
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.Build.0 = Release|Win32
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.ActiveCfg = Release|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.Build.0 = Release|x64
{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|Win32.ActiveCfg = Release|x64
{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.ActiveCfg = Release|x64
{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.Build.0 = Release|x64
@ -2526,7 +2513,6 @@ Global
{D3D8B329-20BE-475E-9E83-653CEA0E0EF5} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{38FE0559-9910-43A8-9E45-3E5004C27692} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E} = {0C808854-54D1-4230-BFF5-77B5FD905000}
{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0} = {0C808854-54D1-4230-BFF5-77B5FD905000}

View File

@ -38,7 +38,6 @@ applications/mod_httapi
applications/mod_signalwire
applications/mod_sms
#applications/mod_snapshot
#applications/mod_snom
applications/mod_spandsp
#applications/mod_spy
applications/mod_test

View File

@ -38,7 +38,6 @@ applications/mod_rss
applications/mod_signalwire
applications/mod_sms
applications/mod_snapshot
applications/mod_snom
applications/mod_spandsp
applications/mod_spy
applications/mod_test

View File

@ -48,9 +48,6 @@
<load module="mod_fsv"/>
<!--<load module="mod_translate"/>-->
<!-- SNOM Module -->
<!--<load module="mod_snom"/>-->
<!-- Dialplan Interfaces -->
<!-- <load module="mod_dialplan_directory"/> -->
<load module="mod_dialplan_xml"/>

View File

@ -116,24 +116,6 @@
</condition>
</extension>
-->
<!--
snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
-->
<extension name="snom-demo-2">
<condition field="destination_number" expression="^9001$">
<action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/>
<action application="transfer" data="3000"/>
</condition>
</extension>
<extension name="snom-demo-1">
<condition field="destination_number" expression="^9000$">
<!--<key> <light> <label> <user> <host> <profile> <action_name> <action>-->
<action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/>
<action application="playback" data="$${hold_music}"/>
</condition>
</extension>
<extension name="eavesdrop">
<condition field="destination_number" expression="^88(.*)$|^\*0(.*)$">

View File

@ -115,24 +115,6 @@
</condition>
</extension>
-->
<!--
snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
-->
<extension name="snom-demo-2">
<condition field="destination_number" expression="^9001$">
<action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/>
<action application="transfer" data="3000"/>
</condition>
</extension>
<extension name="snom-demo-1">
<condition field="destination_number" expression="^9000$">
<!--<key> <light> <label> <user> <host> <profile> <action_name> <action>-->
<action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/>
<action application="playback" data="$${hold_music}"/>
</condition>
</extension>
<extension name="eavesdrop">
<condition field="destination_number" expression="^88(.*)$|^\*0(.*)$">

View File

@ -75,9 +75,6 @@
<load module="mod_httapi"/>
<!--<load module="mod_translate"/>-->
<!-- SNOM Module -->
<!--<load module="mod_snom"/>-->
<!-- Dialplan Interfaces -->
<!-- <load module="mod_dialplan_directory"/> -->
<load module="mod_dialplan_xml"/>

View File

@ -179,24 +179,6 @@
</condition>
</extension>
-->
<!--
Snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
-->
<extension name="snom-demo-2">
<condition field="destination_number" expression="^9001$">
<action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/>
<action application="transfer" data="3000"/>
</condition>
</extension>
<extension name="snom-demo-1">
<condition field="destination_number" expression="^9000$">
<!--<key> <light> <label> <user> <host> <profile> <action_name> <action>-->
<action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/>
<action application="playback" data="$${hold_music}"/>
</condition>
</extension>
<extension name="eavesdrop">
<condition field="destination_number" expression="^88(\d{4})$|^\*0(.*)$">

View File

@ -2126,7 +2126,6 @@ AC_CONFIG_FILES([Makefile
src/mod/applications/mod_signalwire/Makefile
src/mod/applications/mod_sms/Makefile
src/mod/applications/mod_snapshot/Makefile
src/mod/applications/mod_snom/Makefile
src/mod/applications/mod_spandsp/Makefile
src/mod/applications/mod_spy/Makefile
src/mod/applications/mod_test/Makefile

3
debian/bootstrap.sh vendored
View File

@ -543,7 +543,6 @@ Recommends:
freeswitch-mod-rss (= \${binary:Version}),
freeswitch-mod-sms (= \${binary:Version}),
freeswitch-mod-snapshot (= \${binary:Version}),
freeswitch-mod-snom (= \${binary:Version}),
freeswitch-mod-spandsp (= \${binary:Version}),
freeswitch-mod-spy (= \${binary:Version}),
freeswitch-mod-valet-parking (= \${binary:Version}),
@ -630,7 +629,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-shout (= \${binary:Version}),
freeswitch-mod-sms (= \${binary:Version}),
freeswitch-mod-snapshot (= \${binary:Version}),
freeswitch-mod-snom (= \${binary:Version}),
freeswitch-mod-spandsp (= \${binary:Version}),
freeswitch-mod-spy (= \${binary:Version}),
freeswitch-mod-translate (= \${binary:Version}),
@ -854,7 +852,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-rss-dbg (= \${binary:Version}),
freeswitch-mod-sms-dbg (= \${binary:Version}),
freeswitch-mod-snapshot-dbg (= \${binary:Version}),
freeswitch-mod-snom-dbg (= \${binary:Version}),
freeswitch-mod-spandsp-dbg (= \${binary:Version}),
freeswitch-mod-spy-dbg (= \${binary:Version}),
freeswitch-mod-translate-dbg (= \${binary:Version}),

View File

@ -201,10 +201,6 @@ Description: Snapshot
This module can record a sliding window of audio and take snapshots
to disk.
Module: applications/mod_snom
Description: SNOM specific features
This module implements features specific to SNOM phones.
Module: applications/mod_spandsp
Description: SpanDSP
This module implements spandsp fax, dsp, and codec functionality.

View File

@ -505,15 +505,6 @@ Requires: %{name} = %{version}-%{release}
Provides FreeSWITCH mod_snapshot, allows recording a sliding window of audio
and taking snapshots to disk.
%package application-snom
Summary: FreeSWITCH mod_snom
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
%description application-snom
Provides FreeSWITCH mod_snom, an application for controlling the functionality
and appearance of the programmable softkeys on Snom phones
%package application-spy
Summary: FreeSWITCH mod_spy
Group: System/Libraries
@ -1204,7 +1195,6 @@ Requires: freeswitch-application-rss
Requires: freeswitch-application-signalwire
Requires: freeswitch-application-sms
Requires: freeswitch-application-snapshot
Requires: freeswitch-application-snom
Requires: freeswitch-application-spy
Requires: freeswitch-application-valet_parking
Requires: freeswitch-application-video_filter
@ -1283,7 +1273,7 @@ APPLICATION_MODULES_FR="applications/mod_fifo applications/mod_fsk applications/
applications/mod_memcache applications/mod_mongo applications/mod_nibblebill applications/mod_rad_auth \
applications/mod_redis applications/mod_rss "
APPLICATION_MODULES_SZ="applications/mod_signalwire applications/mod_sms applications/mod_snapshot applications/mod_snom \
APPLICATION_MODULES_SZ="applications/mod_signalwire applications/mod_sms applications/mod_snapshot \
applications/mod_spandsp applications/mod_spy \
applications/mod_valet_parking applications/mod_translate applications/mod_voicemail \
applications/mod_voicemail_ivr applications/mod_video_filter"
@ -1947,9 +1937,6 @@ fi
%files application-snapshot
%{MODINSTDIR}/mod_snapshot.so*
%files application-snom
%{MODINSTDIR}/mod_snom.so*
%files application-spy
%{MODINSTDIR}/mod_spy.so*

View File

@ -1,9 +0,0 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_snom
mod_LTLIBRARIES = mod_snom.la
mod_snom_la_SOURCES = mod_snom.c
mod_snom_la_CFLAGS = $(AM_CFLAGS)
mod_snom_la_CPPFLAGS = $(CURL_CFLAGS) $(AM_CPPFLAGS)
mod_snom_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_snom_la_LDFLAGS = $(CURL_LIBS) -avoid-version -module -no-undefined -shared

View File

@ -1,16 +0,0 @@
<include>
<extension name="snom-demo-1">
<condition field="destination_number" expression="^9000$">
<!-- <key> <light> <label> <user> <host> <profile> <action_name> <action> -->
<action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/>
<action application="playback" data="$${hold_music}"/>
</condition>
</extension>
<extension name="snom-demo-2">
<condition field="destination_number" expression="^9001$">
<action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/>
<action application="transfer" data="3000"/>
</condition>
</extension>
</include>

View File

@ -1,146 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>mod_snom</ProjectName>
<ProjectGuid>{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}</ProjectGuid>
<RootNamespace>mod_snom</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(SolutionDir)\w32\curl.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
<DisableSpecificWarnings>6385;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(SolutionDir)\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
<DisableSpecificWarnings>6385;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(SolutionDir)\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<DisableSpecificWarnings>6385;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(SolutionDir)\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<DisableSpecificWarnings>6385;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(SolutionDir)\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="mod_snom.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2017.vcxproj">
<Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,276 +0,0 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* mod_snom.c -- SNOM Specific Features
*
*/
#include <switch.h>
#include <switch_curl.h>
SWITCH_MODULE_LOAD_FUNCTION(mod_snom_load);
SWITCH_MODULE_DEFINITION(mod_snom, mod_snom_load, NULL, NULL);
static switch_bool_t snom_bind_key(const char *key,
const char *light,
const char *label, const char *user, const char *host, const char *profile, const char *action_name, const char *action)
{
switch_event_t *event;
if (user && host && profile) {
if (switch_event_create(&event, SWITCH_EVENT_SEND_MESSAGE) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "user", user);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "host", host);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "profile", profile);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "content-type", "application/x-buttons");
if (action && action_name) {
switch_event_add_body(event, "k=%s\nc=%s\nl=%s\nn=%s\na=%s\n", key, light, label, action, action_name);
} else {
switch_event_add_body(event, "k=%s\nc=%s\nl=%s\n\n", key, light, label);
}
switch_event_fire(&event);
}
return SWITCH_TRUE;
}
return SWITCH_FALSE;
}
#define URL_SYNTAX ""
SWITCH_STANDARD_API(snom_url_api_function)
{
#if 0
char *tmp;
switch_event_serialize(stream->param_event, &tmp, SWITCH_TRUE);
printf("W00t\n%s\n", tmp);
free(tmp);
#endif
return SWITCH_STATUS_SUCCESS;
}
#define KEY_BIND_SYNTAX "<key> <light> <label> <user> <host> <profile> <action_name> <action>"
SWITCH_STANDARD_API(snom_bind_key_api_function)
{
int argc;
char *mydata = NULL, *argv[8];
mydata = strdup(cmd);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if (argc < 6) {
goto err;
}
if (snom_bind_key(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7])) {
stream->write_function(stream, "+OK %s\n", cmd);
goto end;
}
err:
stream->write_function(stream, "-Error %s\n", KEY_BIND_SYNTAX);
end:
free(mydata);
return SWITCH_STATUS_SUCCESS;
}
static size_t curl_callback(void *ptr, size_t size, size_t nmemb, void *data)
{
register unsigned int realsize = (unsigned int) (size * nmemb);
return realsize;
}
#define COMMAND_SYNTAX "<ip|user> <command> <type> <username> <password>"
SWITCH_STANDARD_API(snom_command_api_function)
{
int argc;
long httpRes = 0;
char *key = NULL;
char *url = NULL;
char *argv[5] = { 0 };
char host[32];
char *argdata = NULL;
char *userpwd = NULL;
char *apiresp = NULL;
ip_t ip;
switch_CURL *curl_handle = NULL;
if (zstr(cmd) || !(argdata = strdup(cmd))) {
goto end;
}
argc = switch_separate_string(argdata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if (argc < 3 || (argc > 3 && argc < 5)) {
stream->write_function(stream, "-ERR %s\n", COMMAND_SYNTAX);
goto end;
}
if (strcasecmp(argv[1],"key") && strcasecmp(argv[1],"action")) {
stream->write_function(stream, "-ERR only key or action commands allowed at the moment\n");
goto end;
}
if (switch_inet_pton(AF_INET, argv[0], &ip)) {
snprintf(host, sizeof(host), "%s", argv[0]);
} else {
char *sql = NULL;
char *ret = NULL;
switch_cache_db_handle_t *db = NULL;
switch_stream_handle_t apistream = { 0 };
SWITCH_STANDARD_STREAM(apistream);
if (switch_api_execute("sofia_contact", argv[0], NULL, &apistream) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "-ERR error executing sofia_contact\n");
goto end;
}
apiresp = (char*) apistream.data;
if (!zstr(apiresp)) {
if (!strcasecmp(apistream.data,"error/user_not_registered")) {
stream->write_function(stream, "-ERR user '%s' not registered\n",argv[0]);
goto end;
}
} else {
goto end;
}
if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "%s", "-ERR Database Error!\n");
goto end;
}
sql = switch_mprintf("select network_ip from registrations where url = '%q'", apiresp);
ret = switch_cache_db_execute_sql2str(db, sql, host, sizeof(host), NULL);
switch_safe_free(sql);
switch_cache_db_release_db_handle(&db);
if (!ret) {
stream->write_function(stream, "%s", "-ERR Query '%s' failed!\n", sql);
goto end;
}
}
curl_handle = curl_easy_init();
if (0 == strcasecmp(argv[1],"key")) {
key = curl_easy_escape(curl_handle, argv[2], 0);
url = switch_mprintf("http://%s/command.htm?key=%s", host, key);
curl_free(key);
}
if (0 == strcasecmp(argv[1],"action")) {
if (0 == strcasecmp(argv[2],"reboot")) {
url = switch_mprintf("http://%s/advanced_update.htm?reboot=Reboot", host);
} else if (0 == strcasecmp(argv[2],"reset")) {
url = switch_mprintf("http://%s/advanced_update.htm?reset=Reset", host);
} else if (0 == strcasecmp(argv[2],"dialeddel")) {
url = switch_mprintf("http://%s/index.htm?dialeddel=0", host);
} else if (0 == strcasecmp(argv[2],"misseddel")) {
url = switch_mprintf("http://%s/index.htm?misseddel=0", host);
} else if (0 == strcasecmp(argv[2],"receiveddel")) {
url = switch_mprintf("http://%s/index.htm?receiveddel=0", host);
} else {
stream->write_function(stream, "-ERR action '%s' not supported (supported actions are reboot, reset, dialeddel, misseddel, receiveddel)\n", argv[2]);
curl_easy_cleanup(curl_handle);
goto end;
}
}
curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1);
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, curl_callback);
curl_easy_setopt(curl_handle, CURLOPT_URL, url);
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-curl/1.0");
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 15);
curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
if (argc == 5) {
userpwd = switch_mprintf("%s:%s",argv[3],argv[4]);
curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);
curl_easy_setopt(curl_handle, CURLOPT_USERPWD, userpwd);
}
curl_easy_perform(curl_handle);
curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
curl_easy_cleanup(curl_handle);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "curl url %s , result %ld\n", url,httpRes);
if (httpRes != 200)
stream->write_function(stream, "-ERR %s [HTTP:%ld]\n", cmd, httpRes);
else
stream->write_function(stream, "+OK %s\n", cmd);
end:
switch_safe_free(apiresp);
switch_safe_free(userpwd);
switch_safe_free(argdata);
switch_safe_free(url);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MODULE_LOAD_FUNCTION(mod_snom_load)
{
switch_api_interface_t *commands_api_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_API(commands_api_interface, "snom_bind_key", "Bind a key", snom_bind_key_api_function, KEY_BIND_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "snom_url", "url", snom_url_api_function, URL_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "snom_command", "Sends Command over HTTP Request", snom_command_api_function, COMMAND_SYNTAX);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -313,14 +313,6 @@
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
<ProjectReference Include="..\..\src\mod\applications\mod_snom\mod_snom.2017.vcxproj">
<Name>mod_snom</Name>
<Project>{2a3d00c6-588d-4e86-81ac-9ef5ede86e03}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
<ProjectReference Include="..\..\src\mod\applications\mod_spandsp\mod_spandsp.2017.vcxproj">
<Name>mod_spandsp</Name>
<Project>{1e21afe0-6fdb-41d2-942d-863607c24b91}</Project>