Merge branch 'master' of fs-git:freeswitch

This commit is contained in:
Raymond Chandler
2011-09-21 18:43:50 -04:00
40 changed files with 3292 additions and 571 deletions
@@ -0,0 +1,287 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="mod_sms"
ProjectGUID="{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}"
RootNamespace="mod_sms"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\mod_sms.c"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.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_sms</ProjectName>
<ProjectGuid>{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}</ProjectGuid>
<RootNamespace>mod_sms</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>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.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>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="mod_sms.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2010.vcxproj">
<Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+510
View File
@@ -0,0 +1,510 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2011, 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_sms.c -- Abstract SMS
*
*/
#include <switch.h>
#define SMS_CHAT_PROTO "GLOBAL_SMS"
#define MY_EVENT_SEND_MESSAGE "SMS::SEND_MESSAGE"
/* Prototypes */
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sms_shutdown);
SWITCH_MODULE_RUNTIME_FUNCTION(mod_sms_runtime);
SWITCH_MODULE_LOAD_FUNCTION(mod_sms_load);
SWITCH_MODULE_DEFINITION(mod_sms, mod_sms_load, mod_sms_shutdown, NULL);
static void event_handler(switch_event_t *event)
{
const char *dest_proto = switch_event_get_header(event, "dest_proto");
switch_core_chat_send(dest_proto, event);
}
typedef enum {
BREAK_ON_TRUE,
BREAK_ON_FALSE,
BREAK_ALWAYS,
BREAK_NEVER
} break_t;
static int parse_exten(switch_event_t *event, switch_xml_t xexten, switch_event_t **extension)
{
switch_xml_t xcond, xaction, xexpression;
char *exten_name = (char *) switch_xml_attr(xexten, "name");
int proceed = 0;
char *expression_expanded = NULL, *field_expanded = NULL;
switch_regex_t *re = NULL;
const char *to = switch_event_get_header(event, "to");
if (!to) {
to = "nobody";
}
if (!exten_name) {
exten_name = "_anon_";
}
for (xcond = switch_xml_child(xexten, "condition"); xcond; xcond = xcond->next) {
char *field = NULL;
char *do_break_a = NULL;
char *expression = NULL;
const char *field_data = NULL;
int ovector[30];
switch_bool_t anti_action = SWITCH_TRUE;
break_t do_break_i = BREAK_ON_FALSE;
int time_match = switch_xml_std_datetime_check(xcond);
switch_safe_free(field_expanded);
switch_safe_free(expression_expanded);
if (switch_xml_child(xcond, "condition")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Nested conditions are not allowed!\n");
proceed = 1;
goto done;
}
field = (char *) switch_xml_attr(xcond, "field");
if ((xexpression = switch_xml_child(xcond, "expression"))) {
expression = switch_str_nil(xexpression->txt);
} else {
expression = (char *) switch_xml_attr_soft(xcond, "expression");
}
if ((expression_expanded = switch_event_expand_headers(event, expression)) == expression) {
expression_expanded = NULL;
} else {
expression = expression_expanded;
}
if ((do_break_a = (char *) switch_xml_attr(xcond, "break"))) {
if (!strcasecmp(do_break_a, "on-true")) {
do_break_i = BREAK_ON_TRUE;
} else if (!strcasecmp(do_break_a, "on-false")) {
do_break_i = BREAK_ON_FALSE;
} else if (!strcasecmp(do_break_a, "always")) {
do_break_i = BREAK_ALWAYS;
} else if (!strcasecmp(do_break_a, "never")) {
do_break_i = BREAK_NEVER;
} else {
do_break_a = NULL;
}
}
if (time_match == 1) {
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG,
"Chatplan: %s Date/Time Match (PASS) [%s] break=%s\n",
to, exten_name, do_break_a ? do_break_a : "on-false");
anti_action = SWITCH_FALSE;
} else if (time_match == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG,
"Chatplan: %s Date/Time Match (FAIL) [%s] break=%s\n",
to, exten_name, do_break_a ? do_break_a : "on-false");
}
if (field) {
if (strchr(field, '$')) {
if ((field_expanded = switch_event_expand_headers(event, field)) == field) {
field_expanded = NULL;
field_data = field;
} else {
field_data = field_expanded;
}
} else {
field_data = switch_event_get_header(event, field);
}
if (!field_data) {
field_data = "";
}
if ((proceed = switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG,
"Chatplan: %s Regex (PASS) [%s] %s(%s) =~ /%s/ break=%s\n",
to, exten_name, field, field_data, expression, do_break_a ? do_break_a : "on-false");
anti_action = SWITCH_FALSE;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG,
"Chatplan: %s Regex (FAIL) [%s] %s(%s) =~ /%s/ break=%s\n",
to, exten_name, field, field_data, expression, do_break_a ? do_break_a : "on-false");
}
} else if (time_match == -1) {
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG,
"Chatplan: %s Absolute Condition [%s]\n", to, exten_name);
anti_action = SWITCH_FALSE;
}
if (anti_action) {
for (xaction = switch_xml_child(xcond, "anti-action"); xaction; xaction = xaction->next) {
const char *application = switch_xml_attr_soft(xaction, "application");
const char *loop = switch_xml_attr(xaction, "loop");
const char *data;
const char *inline_ = switch_xml_attr_soft(xaction, "inline");
int xinline = switch_true(inline_);
int loop_count = 1;
if (!zstr(xaction->txt)) {
data = xaction->txt;
} else {
data = (char *) switch_xml_attr_soft(xaction, "data");
}
if (!*extension) {
if ((switch_event_create(extension, SWITCH_EVENT_CLONE)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
abort();
}
}
if (loop) {
loop_count = atoi(loop);
}
for (;loop_count > 0; loop_count--) {
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG,
"Chatplan: %s ANTI-Action %s(%s) %s\n", to, application, data, xinline ? "INLINE" : "");
if (xinline) {
switch_core_execute_chat_app(event, application, data);
} else {
switch_event_add_header_string(*extension, SWITCH_STACK_BOTTOM, application, data);
}
}
proceed = 1;
}
} else {
if (field && strchr(expression, '(')) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "DP_MATCH", NULL);
switch_capture_regex(re, proceed, field_data, ovector, "DP_MATCH", switch_regex_set_event_header_callback, event);
}
for (xaction = switch_xml_child(xcond, "action"); xaction; xaction = xaction->next) {
char *application = (char *) switch_xml_attr_soft(xaction, "application");
const char *loop = switch_xml_attr(xaction, "loop");
char *data = NULL;
char *substituted = NULL;
uint32_t len = 0;
char *app_data = NULL;
const char *inline_ = switch_xml_attr_soft(xaction, "inline");
int xinline = switch_true(inline_);
int loop_count = 1;
if (!zstr(xaction->txt)) {
data = xaction->txt;
} else {
data = (char *) switch_xml_attr_soft(xaction, "data");
}
if (field && strchr(expression, '(')) {
len = (uint32_t) (strlen(data) + strlen(field_data) + 10) * proceed;
if (!(substituted = malloc(len))) {
abort();
}
memset(substituted, 0, len);
switch_perform_substitution(re, proceed, data, field_data, substituted, len, ovector);
app_data = substituted;
} else {
app_data = data;
}
if (!*extension) {
if ((switch_event_create(extension, SWITCH_EVENT_CLONE)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
abort();
}
}
if (loop) {
loop_count = atoi(loop);
}
for (;loop_count > 0; loop_count--) {
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG,
"Chatplan: %s Action %s(%s) %s\n", to, application, app_data, xinline ? "INLINE" : "");
if (xinline) {
switch_core_execute_chat_app(event, application, app_data);
} else {
switch_event_add_header_string(*extension, SWITCH_STACK_BOTTOM, application, data);
}
}
switch_safe_free(substituted);
}
}
switch_regex_safe_free(re);
if (((anti_action == SWITCH_FALSE && do_break_i == BREAK_ON_TRUE) ||
(anti_action == SWITCH_TRUE && do_break_i == BREAK_ON_FALSE)) || do_break_i == BREAK_ALWAYS) {
break;
}
}
done:
switch_regex_safe_free(re);
switch_safe_free(field_expanded);
switch_safe_free(expression_expanded);
return proceed;
}
static switch_event_t *chatplan_hunt(switch_event_t *event)
{
switch_event_t *extension = NULL;
switch_xml_t alt_root = NULL, cfg, xml = NULL, xcontext, xexten = NULL;
const char *alt_path;
const char *context;
const char *from;
const char *to;
if (!(context = switch_event_get_header(event, "context"))) {
context = "default";
}
if (!(from = switch_event_get_header(event, "from_user"))) {
from = switch_event_get_header(event, "from");
}
if (!(to = switch_event_get_header(event, "to_user"))) {
to = switch_event_get_header(event, "to");
}
alt_path = switch_event_get_header(event, "alt_path");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Processing text message %s->%s in context %s\n", from, to, context);
/* get our handle to the "chatplan" section of the config */
if (!zstr(alt_path)) {
switch_xml_t conf = NULL, tag = NULL;
if (!(alt_root = switch_xml_parse_file_simple(alt_path))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of [%s] failed\n", alt_path);
goto done;
}
if ((conf = switch_xml_find_child(alt_root, "section", "name", "chatplan")) && (tag = switch_xml_find_child(conf, "chatplan", NULL, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Getting chatplan from alternate path: %s\n", alt_path);
xml = alt_root;
cfg = tag;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of chatplan failed\n");
goto done;
}
} else {
if (switch_xml_locate("chatplan", NULL, NULL, NULL, &xml, &cfg, event, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of chatplan failed\n");
goto done;
}
}
/* get a handle to the context tag */
if (!(xcontext = switch_xml_find_child(cfg, "context", "name", context))) {
if (!(xcontext = switch_xml_find_child(cfg, "context", "name", "global"))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Context %s not found\n", context);
goto done;
}
}
xexten = switch_xml_child(xcontext, "extension");
while (xexten) {
int proceed = 0;
const char *cont = switch_xml_attr(xexten, "continue");
const char *exten_name = switch_xml_attr(xexten, "name");
if (!exten_name) {
exten_name = "UNKNOWN";
}
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG,
"Chatplan: %s parsing [%s->%s] continue=%s\n",
to, context, exten_name, cont ? cont : "false");
proceed = parse_exten(event, xexten, &extension);
if (proceed && !switch_true(cont)) {
break;
}
xexten = xexten->next;
}
switch_xml_free(xml);
xml = NULL;
done:
switch_xml_free(xml);
return extension;
}
static switch_status_t chat_send(switch_event_t *message_event)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_event_t *exten;
if ((exten = chatplan_hunt(message_event))) {
switch_event_header_t *hp;
for (hp = exten->headers; hp; hp = hp->next) {
status = switch_core_execute_chat_app(message_event, hp->name, hp->value);
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
}
switch_event_destroy(&exten);
}
status = SWITCH_STATUS_BREAK;
return status;
}
SWITCH_STANDARD_CHAT_APP(stop_function)
{
switch_set_flag(message, EF_NO_CHAT_EXEC);
return SWITCH_STATUS_FALSE;
}
SWITCH_STANDARD_CHAT_APP(send_function)
{
const char *dest_proto = data;
if (zstr(dest_proto)) {
dest_proto = switch_event_get_header(message, "dest_proto");
}
switch_core_chat_send(dest_proto, message);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_CHAT_APP(set_function)
{
char *var, *val;
if (data) {
var = strdup(data);
if ((val = strchr(var, '='))) {
*val++ = '\0';
}
if (zstr(val)) {
switch_event_del_header(message, var);
} else {
switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, var, val);
}
}
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_CHAT_APP(fire_function)
{
switch_event_t *fireme;
switch_event_dup(&fireme, message);
switch_event_fire(&fireme);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_CHAT_APP(reply_function)
{
switch_event_t *reply;
const char *proto = switch_event_get_header(message, "proto");
if (proto) {
switch_ivr_create_message_reply(&reply, message, SMS_CHAT_PROTO);
if (!zstr(data)) {
switch_event_add_body(reply, data);
}
switch_core_chat_deliver(proto, &reply);
return SWITCH_STATUS_SUCCESS;
}
return SWITCH_STATUS_SUCCESS;
}
/* Macro expands to: switch_status_t mod_sms_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
SWITCH_MODULE_LOAD_FUNCTION(mod_sms_load)
{
switch_chat_interface_t *chat_interface;
switch_chat_application_interface_t *chat_app_interface;
if (switch_event_bind(modname, SWITCH_EVENT_CUSTOM, MY_EVENT_SEND_MESSAGE, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
return SWITCH_STATUS_GENERR;
}
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CHAT(chat_interface, SMS_CHAT_PROTO, chat_send);
SWITCH_ADD_CHAT_APP(chat_app_interface, "reply", "reply to a message", "reply to a message", reply_function, "", SCAF_NONE);
SWITCH_ADD_CHAT_APP(chat_app_interface, "stop", "stop execution", "stop execution", stop_function, "", SCAF_NONE);
SWITCH_ADD_CHAT_APP(chat_app_interface, "set", "set a variable", "set a variable", set_function, "", SCAF_NONE);
SWITCH_ADD_CHAT_APP(chat_app_interface, "send", "send the message as-is", "send the message as-is", send_function, "", SCAF_NONE);
SWITCH_ADD_CHAT_APP(chat_app_interface, "fire", "fire the message", "fire the message", fire_function, "", SCAF_NONE);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
/*
Called when the system shuts down
Macro expands to: switch_status_t mod_sms_shutdown() */
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sms_shutdown)
{
switch_event_unbind_callback(event_handler);
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
*/
@@ -806,7 +806,7 @@ static t38_mode_t negotiate_t38(pvt_t *pvt)
switch_channel_set_private(channel, "t38_options", NULL);
} else {
pvt->t38_mode = T38_MODE_NEGOTIATED;
switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38 SDP Origin = %s\n", t38_options->sdp_o_line);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxVersion = %d\n", t38_options->T38FaxVersion);
@@ -1211,6 +1211,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat
} else if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) {
switch_core_session_message_t msg = { 0 };
pvt->t38_mode = T38_MODE_NEGOTIATED;
switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED);
spanfax_init(pvt, T38_MODE);
configure_t38(pvt);
@@ -1493,13 +1494,14 @@ static switch_status_t t38_gateway_on_soft_execute(switch_core_session_t *sessio
spanfax_init(pvt, T38_GATEWAY_MODE);
configure_t38(pvt);
pvt->t38_mode = T38_MODE_NEGOTIATED;
switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED);
} else {
if (negotiate_t38(pvt) != T38_MODE_NEGOTIATED) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Could not negotiate T38\n", switch_channel_get_name(channel));
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
goto end_unlock;
}
switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED);
spanfax_init(pvt, T38_GATEWAY_MODE);
}
@@ -2929,7 +2929,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", to);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", subject);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "normal");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "text/plain");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", hint);
if (msg) {
+7
View File
@@ -5605,6 +5605,12 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
}
goto done;
} else {
if (switch_channel_test_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_NEGOTIATED)) {
nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END());
goto done;
}
sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
if (tech_pvt->num_codecs) {
@@ -5620,6 +5626,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
if (sofia_glue_tech_choose_port(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
goto done;
}
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
+5
View File
@@ -4404,6 +4404,11 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
if (got_udptl && m->m_type == sdp_media_image && m->m_port) {
switch_t38_options_t *t38_options = tech_process_udptl(tech_pvt, sdp, m);
if (switch_channel_test_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_NEGOTIATED)) {
match = 1;
goto done;
}
if (switch_channel_test_app_flag_key("T38", tech_pvt->channel, CF_APP_T38)) {
sofia_set_flag(tech_pvt, TFLAG_NOREPLY);
}
+97 -24
View File
@@ -99,7 +99,10 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
//const char *subject;
const char *body;
const char *type;
const char *hint;
const char *from_full;
char header[256] = "";
char *route_uri = NULL;
const char *network_ip = NULL, *network_port = NULL;
proto = switch_event_get_header(message_event, "proto");
from = switch_event_get_header(message_event, "from");
@@ -107,8 +110,10 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
//subject = switch_event_get_header(message_event, "subject");
body = switch_event_get_body(message_event);
type = switch_event_get_header(message_event, "type");
hint = switch_event_get_header(message_event, "hint");
from_full = switch_event_get_header(message_event, "from_full");
network_ip = switch_event_get_header(message_event, "to_sip_ip");
network_port = switch_event_get_header(message_event, "to_sip_port");
if (!to) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To: header.\n");
@@ -130,6 +135,10 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
user = prof;
prof = NULL;
}
if (!prof) {
prof = switch_event_get_header(message_event, "sip_profile");
}
if (!strncasecmp(user, "sip:", 4)) {
to_uri = user;
@@ -141,8 +150,9 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
} else {
host++;
}
if (!prof)
if (!prof) {
prof = host;
}
}
if (!prof || !(profile = sofia_glue_find_profile(prof))) {
@@ -159,24 +169,34 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
}
}
if (to_uri) {
switch_console_push_match(&list, to_uri);
} else if (!(list = sofia_reg_find_reg_url_multi(profile, user, host))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find registered user %s@%s\n", user, host);
goto end;
sofia_profile_t *test;
if ((test = sofia_glue_find_profile(host))) {
sofia_glue_release_profile(test);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not sending to local box for %s@%s\n", user, host);
/* our box let's not send it */
} else {
char *tmp;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't find registered user %s@%s\n", user, host);
tmp = switch_mprintf("sip:%s@%s", user, host);
switch_console_push_match(&list, tmp);
free(tmp);
}
}
if (!strcasecmp(proto, SOFIA_CHAT_PROTO)) {
from = hint;
from = from_full;
} else {
char *fp, *p = NULL;
fp = strdup(from);
switch_assert(fp);
if (!fp) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
goto end;
}
if ((p = strchr(fp, '@'))) {
*p++ = '\0';
@@ -189,12 +209,23 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
}
}
ffrom = switch_mprintf("\"%s\" <sip:%s+%s@%s>", fp, proto, fp, p);
if (switch_stristr("global", proto)) {
ffrom = switch_mprintf("\"%s\" <sip:%s@%s>", fp, fp, p);
} else {
ffrom = switch_mprintf("\"%s\" <sip:%s+%s@%s>", fp, proto, fp, p);
}
from = ffrom;
switch_safe_free(fp);
}
if (!list) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Chat proto [%s]\nfrom [%s]\nto [%s]\n%s\nNobody to send to: Profile %s\n", proto, from, to,
body ? body : "[no body]", prof ? prof : "NULL");
goto end;
}
for (m = list->head; m; m = m->next) {
if (!(dst = sofia_glue_get_destination(m->val))) {
@@ -250,21 +281,34 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
/* if this cries, add contact here too, change the 1 to 0 and omit the safe_free */
//printf("DEBUG To: [%s] From: [%s] Contact: [%s] RURI [%s] ip [%s] port [%s]\n", to, from, contact, dst->route_uri, network_ip, network_port);
//DUMP_EVENT(message_event);
if (zstr(dst->route_uri) && !zstr(user) && !zstr(network_ip) && (zstr(host) || strcmp(network_ip, host))) {
route_uri = switch_mprintf("sip:%s@%s:%s", user, network_ip, network_port);
}
msg_nh = nua_handle(profile->nua, NULL,
TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)),
TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)),
SIPTAG_FROM_STR(from),
TAG_IF(contact, NUTAG_URL(contact)),
SIPTAG_TO_STR(dup_dest),
SIPTAG_CONTACT_STR(contact_str),
TAG_END());
nua_handle_bind(msg_nh, &mod_sofia_globals.destroy_private);
switch_snprintf(header, sizeof(header), "X-FS-Sending-Message: %s", switch_core_get_uuid());
nua_message(msg_nh,
TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)),
TAG_IF(route_uri, NUTAG_PROXY(route_uri)),
TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)),
SIPTAG_FROM_STR(from),
TAG_IF(contact, NUTAG_URL(contact)),
SIPTAG_TO_STR(dup_dest),
SIPTAG_CONTACT_STR(contact_str),
TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
SIPTAG_CONTENT_TYPE_STR(ct),
SIPTAG_PAYLOAD_STR(body),
SIPTAG_HEADER_STR(header),
TAG_END());
sofia_glue_free_destination(dst);
@@ -277,6 +321,7 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
end:
switch_safe_free(contact);
switch_safe_free(route_uri);
switch_safe_free(ffrom);
switch_safe_free(dup);
@@ -2873,13 +2918,25 @@ void sofia_presence_handle_sip_i_message(int status,
const char *to_host = NULL;
sip_payload_t *payload = sip->sip_payload;
char *msg = NULL;
const char *us;
char network_ip[80];
int network_port = 0;
if ((us = sofia_glue_get_unknown_header(sip, "X-FS-Sending-Message")) && !strcmp(us, switch_core_get_uuid())) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not sending message to ourselves!\n");
goto end;
}
if (sip->sip_content_type && sip->sip_content_type->c_subtype) {
if (strstr(sip->sip_content_type->c_subtype, "composing")) {
return;
goto end;
}
}
sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &network_port);
if (from) {
from_user = from->a_url->url_user;
from_host = from->a_url->url_host;
@@ -2891,7 +2948,7 @@ void sofia_presence_handle_sip_i_message(int status,
}
if (!to_user) {
return;
goto end;
}
if (payload) {
@@ -2924,7 +2981,7 @@ void sofia_presence_handle_sip_i_message(int status,
to_addr = switch_mprintf("%s@%s", to_user, to_host);
}
from_addr = switch_mprintf("%s/%s@%s", profile->name, from_user, from_host);
from_addr = switch_mprintf("%s@%s", from_user, from_host);
if (sofia_test_pflag(profile, PFLAG_IN_DIALOG_CHAT)) {
sofia_presence_set_hash_key(hash_key, sizeof(hash_key), sip);
@@ -2936,10 +2993,22 @@ void sofia_presence_handle_sip_i_message(int status,
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", from_addr);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_user", from_user);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", from_host);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_user", to_user);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_host", to_host);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_sip_ip", network_ip);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from_sip_port", "%d", network_port);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", to_addr);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "SIMPLE MESSAGE");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "normal");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", full_from);
if (sip->sip_content_type && sip->sip_content_type->c_subtype) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", sip->sip_content_type->c_type);
} else {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "text/plain");
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", full_from);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "sip_profile", profile->name);
if (msg) {
switch_event_add_body(event, "%s", msg);
@@ -2952,7 +3021,6 @@ void sofia_presence_handle_sip_i_message(int status,
switch_core_session_queue_event(tech_pvt->session, &event);
} else {
switch_core_chat_send(proto, event);
switch_core_chat_send("GLOBAL", event);
switch_event_destroy(&event);
}
@@ -2964,6 +3032,11 @@ void sofia_presence_handle_sip_i_message(int status,
}
}
}
end:
nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());
}
void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip)
+1 -1
View File
@@ -1397,7 +1397,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
}
/* Log line added to support Fail2Ban */
if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth challenge (%s) on sofia profile '%s' "
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "SIP auth challenge (%s) on sofia profile '%s' "
"for [%s@%s] from ip %s\n", (regtype == REG_INVITE) ? "INVITE" : "REGISTER",
profile->name, to_user, to_host, network_ip);
}
@@ -66,6 +66,14 @@ public class Event {
this(freeswitchJNI.new_Event__SWIG_1(SWIGTYPE_p_switch_event_t.getCPtr(wrap_me), free_me), true);
}
public int chat_execute(String app, String data) {
return freeswitchJNI.Event_chat_execute(swigCPtr, this, app, data);
}
public int chat_send(String dest_proto) {
return freeswitchJNI.Event_chat_send(swigCPtr, this, dest_proto);
}
public String serialize(String format) {
return freeswitchJNI.Event_serialize(swigCPtr, this, format);
}
@@ -54,6 +54,8 @@ class freeswitchJNI {
public final static native long new_Event__SWIG_0(String jarg1, String jarg2);
public final static native long new_Event__SWIG_1(long jarg1, int jarg2);
public final static native void delete_Event(long jarg1);
public final static native int Event_chat_execute(long jarg1, Event jarg1_, String jarg2, String jarg3);
public final static native int Event_chat_send(long jarg1, Event jarg1_, String jarg2);
public final static native String Event_serialize(long jarg1, Event jarg1_, String jarg2);
public final static native boolean Event_setPriority(long jarg1, Event jarg1_, long jarg2);
public final static native String Event_getHeader(long jarg1, Event jarg1_, String jarg2);
@@ -1054,6 +1054,57 @@ SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1Event(JNI
}
SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_Event_1chat_1execute(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
jint jresult = 0 ;
Event *arg1 = (Event *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) NULL ;
int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(Event **)&jarg1;
arg2 = 0;
if (jarg2) {
arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
if (!arg2) return 0;
}
arg3 = 0;
if (jarg3) {
arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
if (!arg3) return 0;
}
result = (int)(arg1)->chat_execute((char const *)arg2,(char const *)arg3);
jresult = (jint)result;
if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
return jresult;
}
SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_Event_1chat_1send(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
jint jresult = 0 ;
Event *arg1 = (Event *) 0 ;
char *arg2 = (char *) NULL ;
int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(Event **)&jarg1;
arg2 = 0;
if (jarg2) {
arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
if (!arg2) return 0;
}
result = (int)(arg1)->chat_send((char const *)arg2);
jresult = (jint)result;
if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
return jresult;
}
SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_Event_1serialize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
jstring jresult = 0 ;
Event *arg1 = (Event *) 0 ;
+20
View File
@@ -430,6 +430,24 @@ SWITCH_STANDARD_API(luarun_api_function)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_CHAT_APP(lua_chat_function)
{
lua_State *L = lua_init();
char *dup = NULL;
if (data) {
dup = strdup(data);
}
mod_lua_conjure_event(L, message, "message", 1);
lua_parse_and_execute(L, (char *)dup);
lua_uninit(L);
switch_safe_free(dup);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_API(lua_api_function)
{
@@ -591,6 +609,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load)
switch_api_interface_t *api_interface;
switch_application_interface_t *app_interface;
switch_dialplan_interface_t *dp_interface;
switch_chat_application_interface_t *chat_app_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
@@ -600,6 +619,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load)
SWITCH_ADD_APP(app_interface, "lua", "Launch LUA ivr", "Run a lua ivr on a channel", lua_function, "<script>", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
SWITCH_ADD_DIALPLAN(dp_interface, "LUA", lua_dialplan_hunt);
SWITCH_ADD_CHAT_APP(chat_app_interface, "lua", "execute a lua script", "execute a lua script", lua_chat_function, "<script>", SCAF_NONE);
globals.pool = pool;
@@ -2890,6 +2890,69 @@ fail:
}
static int _wrap_Event_chat_execute(lua_State* L) {
int SWIG_arg = -1;
Event *arg1 = (Event *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) NULL ;
int result;
SWIG_check_num_args("chat_execute",2,3)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("chat_execute",1,"Event *");
if(!lua_isstring(L,2)) SWIG_fail_arg("chat_execute",2,"char const *");
if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("chat_execute",3,"char const *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
SWIG_fail_ptr("Event_chat_execute",1,SWIGTYPE_p_Event);
}
arg2 = (char *)lua_tostring(L, 2);
if(lua_gettop(L)>=3){
arg3 = (char *)lua_tostring(L, 3);
}
result = (int)(arg1)->chat_execute((char const *)arg2,(char const *)arg3);
SWIG_arg=0;
lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_Event_chat_send(lua_State* L) {
int SWIG_arg = -1;
Event *arg1 = (Event *) 0 ;
char *arg2 = (char *) NULL ;
int result;
SWIG_check_num_args("chat_send",1,2)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("chat_send",1,"Event *");
if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg("chat_send",2,"char const *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
SWIG_fail_ptr("Event_chat_send",1,SWIGTYPE_p_Event);
}
if(lua_gettop(L)>=2){
arg2 = (char *)lua_tostring(L, 2);
}
result = (int)(arg1)->chat_send((char const *)arg2);
SWIG_arg=0;
lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_Event_serialize(lua_State* L) {
int SWIG_arg = -1;
Event *arg1 = (Event *) 0 ;
@@ -3149,6 +3212,8 @@ Event *arg1 = (Event *) obj;
delete arg1;
}
static swig_lua_method swig_Event_methods[] = {
{"chat_execute", _wrap_Event_chat_execute},
{"chat_send", _wrap_Event_chat_send},
{"serialize", _wrap_Event_serialize},
{"setPriority", _wrap_Event_setPriority},
{"getHeader", _wrap_Event_getHeader},
@@ -5590,6 +5590,18 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_regex_set_var_callback(char * jarg1, c
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_regex_set_event_header_callback(char * jarg1, char * jarg2, void * jarg3) {
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
void *arg3 = (void *) 0 ;
arg1 = (char *)jarg1;
arg2 = (char *)jarg2;
arg3 = (void *)jarg3;
switch_regex_set_event_header_callback((char const *)arg1,(char const *)arg2,arg3);
}
SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_CORE_THREAD_SESSION_OBJS_get() {
int jresult ;
int result;
@@ -10542,6 +10554,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_chat_send(char * jarg1, void * jar
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_chat_deliver(char * jarg1, void * jarg2) {
int jresult ;
char *arg1 = (char *) 0 ;
switch_event_t **arg2 = (switch_event_t **) 0 ;
switch_status_t result;
arg1 = (char *)jarg1;
arg2 = (switch_event_t **)jarg2;
result = (switch_status_t)switch_core_chat_deliver((char const *)arg1,arg2);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_preprocess_session(void * jarg1, char * jarg2) {
int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
@@ -11388,6 +11414,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_applicatio
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_chat_application_interface_set(void * jarg1, void * jarg2) {
switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ;
switch_chat_application_interface_t *arg2 = (switch_chat_application_interface_t *) 0 ;
arg1 = (switch_loadable_module_interface *)jarg1;
arg2 = (switch_chat_application_interface_t *)jarg2;
if (arg1) (arg1)->chat_application_interface = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_chat_application_interface_get(void * jarg1) {
void * jresult ;
switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ;
switch_chat_application_interface_t *result = 0 ;
arg1 = (switch_loadable_module_interface *)jarg1;
result = (switch_chat_application_interface_t *) ((arg1)->chat_application_interface);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_api_interface_set(void * jarg1, void * jarg2) {
switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ;
switch_api_interface_t *arg2 = (switch_api_interface_t *) 0 ;
@@ -11810,6 +11859,34 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_application_inte
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_chat_application_interface(char * jarg1) {
void * jresult ;
char *arg1 = (char *) 0 ;
switch_chat_application_interface_t *result = 0 ;
arg1 = (char *)jarg1;
result = (switch_chat_application_interface_t *)switch_loadable_module_get_chat_application_interface((char const *)arg1);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_execute_chat_app(void * jarg1, char * jarg2, char * jarg3) {
int jresult ;
switch_event_t *arg1 = (switch_event_t *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
switch_status_t result;
arg1 = (switch_event_t *)jarg1;
arg2 = (char *)jarg2;
arg3 = (char *)jarg3;
result = (switch_status_t)switch_core_execute_chat_app(arg1,(char const *)arg2,(char const *)arg3);
jresult = result;
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_api_interface(char * jarg1) {
void * jresult ;
char *arg1 = (char *) 0 ;
@@ -23227,6 +23304,302 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_application_interface(void * ja
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_application_interface_interface_name_set(void * jarg1, char * jarg2) {
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->interface_name, (const char *)arg2);
} else {
arg1->interface_name = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_chat_application_interface_interface_name_get(void * jarg1) {
char * jresult ;
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
char *result = 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
result = (char *) ((arg1)->interface_name);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_application_interface_chat_application_function_set(void * jarg1, void * jarg2) {
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
switch_chat_application_function_t arg2 = (switch_chat_application_function_t) 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
arg2 = (switch_chat_application_function_t)jarg2;
if (arg1) (arg1)->chat_application_function = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_application_interface_chat_application_function_get(void * jarg1) {
void * jresult ;
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
switch_chat_application_function_t result;
arg1 = (switch_chat_application_interface *)jarg1;
result = (switch_chat_application_function_t) ((arg1)->chat_application_function);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_application_interface_long_desc_set(void * jarg1, char * jarg2) {
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->long_desc = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->long_desc, (const char *)arg2);
} else {
arg1->long_desc = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_chat_application_interface_long_desc_get(void * jarg1) {
char * jresult ;
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
char *result = 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
result = (char *) ((arg1)->long_desc);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_application_interface_short_desc_set(void * jarg1, char * jarg2) {
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->short_desc = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->short_desc, (const char *)arg2);
} else {
arg1->short_desc = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_chat_application_interface_short_desc_get(void * jarg1) {
char * jresult ;
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
char *result = 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
result = (char *) ((arg1)->short_desc);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_application_interface_syntax_set(void * jarg1, char * jarg2) {
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->syntax = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->syntax, (const char *)arg2);
} else {
arg1->syntax = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_chat_application_interface_syntax_get(void * jarg1) {
char * jresult ;
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
char *result = 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
result = (char *) ((arg1)->syntax);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_application_interface_flags_set(void * jarg1, unsigned long jarg2) {
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
uint32_t arg2 ;
arg1 = (switch_chat_application_interface *)jarg1;
arg2 = (uint32_t)jarg2;
if (arg1) (arg1)->flags = arg2;
}
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_chat_application_interface_flags_get(void * jarg1) {
unsigned long jresult ;
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
uint32_t result;
arg1 = (switch_chat_application_interface *)jarg1;
result = (uint32_t) ((arg1)->flags);
jresult = (unsigned long)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_application_interface_rwlock_set(void * jarg1, void * jarg2) {
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
arg2 = (switch_thread_rwlock_t *)jarg2;
if (arg1) (arg1)->rwlock = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_application_interface_rwlock_get(void * jarg1) {
void * jresult ;
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
switch_thread_rwlock_t *result = 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_application_interface_refs_set(void * jarg1, int jarg2) {
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
int arg2 ;
arg1 = (switch_chat_application_interface *)jarg1;
arg2 = (int)jarg2;
if (arg1) (arg1)->refs = arg2;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_chat_application_interface_refs_get(void * jarg1) {
int jresult ;
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
int result;
arg1 = (switch_chat_application_interface *)jarg1;
result = (int) ((arg1)->refs);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_application_interface_reflock_set(void * jarg1, void * jarg2) {
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
arg2 = (switch_mutex_t *)jarg2;
if (arg1) (arg1)->reflock = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_application_interface_reflock_get(void * jarg1) {
void * jresult ;
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
switch_mutex_t *result = 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
result = (switch_mutex_t *) ((arg1)->reflock);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_application_interface_parent_set(void * jarg1, void * jarg2) {
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
arg2 = (switch_loadable_module_interface_t *)jarg2;
if (arg1) (arg1)->parent = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_application_interface_parent_get(void * jarg1) {
void * jresult ;
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
switch_loadable_module_interface_t *result = 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
result = (switch_loadable_module_interface_t *) ((arg1)->parent);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_application_interface_next_set(void * jarg1, void * jarg2) {
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
switch_chat_application_interface *arg2 = (switch_chat_application_interface *) 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
arg2 = (switch_chat_application_interface *)jarg2;
if (arg1) (arg1)->next = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_application_interface_next_get(void * jarg1) {
void * jresult ;
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
switch_chat_application_interface *result = 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
result = (switch_chat_application_interface *) ((arg1)->next);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_chat_application_interface() {
void * jresult ;
switch_chat_application_interface *result = 0 ;
result = (switch_chat_application_interface *)new switch_chat_application_interface();
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_chat_application_interface(void * jarg1) {
switch_chat_application_interface *arg1 = (switch_chat_application_interface *) 0 ;
arg1 = (switch_chat_application_interface *)jarg1;
delete arg1;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_interface_name_set(void * jarg1, char * jarg2) {
switch_api_interface *arg1 = (switch_api_interface *) 0 ;
char *arg2 = (char *) 0 ;
@@ -26443,6 +26816,22 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_get_header_idx(void * jarg1, c
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_rename_header(void * jarg1, char * jarg2, char * jarg3) {
int jresult ;
switch_event_t *arg1 = (switch_event_t *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
switch_status_t result;
arg1 = (switch_event_t *)jarg1;
arg2 = (char *)jarg2;
arg3 = (char *)jarg3;
result = (switch_status_t)switch_event_rename_header(arg1,(char const *)arg2,(char const *)arg3);
jresult = result;
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_get_body(void * jarg1) {
char * jresult ;
switch_event_t *arg1 = (switch_event_t *) 0 ;
@@ -26551,6 +26940,20 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_merge(void * jarg1, void * jarg2
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_dup_reply(void * jarg1, void * jarg2) {
int jresult ;
switch_event_t **arg1 = (switch_event_t **) 0 ;
switch_event_t *arg2 = (switch_event_t *) 0 ;
switch_status_t result;
arg1 = (switch_event_t **)jarg1;
arg2 = (switch_event_t *)jarg2;
result = (switch_status_t)switch_event_dup_reply(arg1,arg2);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_fire_detailed(char * jarg1, char * jarg2, int jarg3, void * jarg4, void * jarg5) {
int jresult ;
char *arg1 = (char *) 0 ;
@@ -26783,6 +27186,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_running() {
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_set_body(void * jarg1, char * jarg2) {
int jresult ;
switch_event_t *arg1 = (switch_event_t *) 0 ;
char *arg2 = (char *) 0 ;
switch_status_t result;
arg1 = (switch_event_t *)jarg1;
arg2 = (char *)jarg2;
result = (switch_status_t)switch_event_set_body(arg1,(char const *)arg2);
jresult = result;
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_expand_headers(void * jarg1, char * jarg2) {
char * jresult ;
switch_event_t *arg1 = (switch_event_t *) 0 ;
@@ -29763,6 +30180,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_insert_file(void * jarg1, char * ja
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_create_message_reply(void * jarg1, void * jarg2, char * jarg3) {
int jresult ;
switch_event_t **arg1 = (switch_event_t **) 0 ;
switch_event_t *arg2 = (switch_event_t *) 0 ;
char *arg3 = (char *) 0 ;
switch_status_t result;
arg1 = (switch_event_t **)jarg1;
arg2 = (switch_event_t *)jarg2;
arg3 = (char *)jarg3;
result = (switch_status_t)switch_ivr_create_message_reply(arg1,arg2,(char const *)arg3);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() {
int jresult ;
int result;
@@ -34872,6 +35305,36 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_Event(void * jarg1) {
}
SWIGEXPORT int SWIGSTDCALL CSharp_Event_chat_execute(void * jarg1, char * jarg2, char * jarg3) {
int jresult ;
Event *arg1 = (Event *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) NULL ;
int result;
arg1 = (Event *)jarg1;
arg2 = (char *)jarg2;
arg3 = (char *)jarg3;
result = (int)(arg1)->chat_execute((char const *)arg2,(char const *)arg3);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_Event_chat_send(void * jarg1, char * jarg2) {
int jresult ;
Event *arg1 = (Event *) 0 ;
char *arg2 = (char *) NULL ;
int result;
arg1 = (Event *)jarg1;
arg2 = (char *)jarg2;
result = (int)(arg1)->chat_send((char const *)arg2);
jresult = result;
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_Event_Serialize(void * jarg1, char * jarg2) {
char * jresult ;
Event *arg1 = (Event *) 0 ;
File diff suppressed because it is too large Load Diff
+2
View File
@@ -292,6 +292,8 @@ sub DESTROY {
}
}
*chat_execute = *freeswitchc::Event_chat_execute;
*chat_send = *freeswitchc::Event_chat_send;
*serialize = *freeswitchc::Event_serialize;
*setPriority = *freeswitchc::Event_setPriority;
*getHeader = *freeswitchc::Event_getHeader;
@@ -3679,6 +3679,99 @@ XS(_wrap_delete_Event) {
}
XS(_wrap_Event_chat_execute) {
{
Event *arg1 = (Event *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) NULL ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 2) || (items > 3)) {
SWIG_croak("Usage: Event_chat_execute(self,app,data);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_chat_execute" "', argument " "1"" of type '" "Event *""'");
}
arg1 = reinterpret_cast< Event * >(argp1);
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_chat_execute" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
if (items > 2) {
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_chat_execute" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
}
result = (int)(arg1)->chat_execute((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
XSRETURN(argvi);
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
SWIG_croak_null();
}
}
XS(_wrap_Event_chat_send) {
{
Event *arg1 = (Event *) 0 ;
char *arg2 = (char *) NULL ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 1) || (items > 2)) {
SWIG_croak("Usage: Event_chat_send(self,dest_proto);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_chat_send" "', argument " "1"" of type '" "Event *""'");
}
arg1 = reinterpret_cast< Event * >(argp1);
if (items > 1) {
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_chat_send" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
}
result = (int)(arg1)->chat_send((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
XSRETURN(argvi);
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
SWIG_croak_null();
}
}
XS(_wrap_Event_serialize) {
{
Event *arg1 = (Event *) 0 ;
@@ -9492,6 +9585,8 @@ static swig_command_info swig_commands[] = {
{"freeswitchc::Event_mine_get", _wrap_Event_mine_get},
{"freeswitchc::new_Event", _wrap_new_Event},
{"freeswitchc::delete_Event", _wrap_delete_Event},
{"freeswitchc::Event_chat_execute", _wrap_Event_chat_execute},
{"freeswitchc::Event_chat_send", _wrap_Event_chat_send},
{"freeswitchc::Event_serialize", _wrap_Event_serialize},
{"freeswitchc::Event_setPriority", _wrap_Event_setPriority},
{"freeswitchc::Event_getHeader", _wrap_Event_getHeader},
@@ -175,6 +175,8 @@ class Event(_object):
except: self.this = this
__swig_destroy__ = _freeswitch.delete_Event
__del__ = lambda self : None;
def chat_execute(*args): return _freeswitch.Event_chat_execute(*args)
def chat_send(*args): return _freeswitch.Event_chat_send(*args)
def serialize(*args): return _freeswitch.Event_serialize(*args)
def setPriority(*args): return _freeswitch.Event_setPriority(*args)
def getHeader(*args): return _freeswitch.Event_getHeader(*args)
@@ -4541,6 +4541,90 @@ fail:
}
SWIGINTERN PyObject *_wrap_Event_chat_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
Event *arg1 = (Event *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) NULL ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO|O:Event_chat_execute",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_chat_execute" "', argument " "1"" of type '" "Event *""'");
}
arg1 = reinterpret_cast< Event * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_chat_execute" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
if (obj2) {
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_chat_execute" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
}
result = (int)(arg1)->chat_execute((char const *)arg2,(char const *)arg3);
resultobj = SWIG_From_int(static_cast< int >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return NULL;
}
SWIGINTERN PyObject *_wrap_Event_chat_send(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
Event *arg1 = (Event *) 0 ;
char *arg2 = (char *) NULL ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O|O:Event_chat_send",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_chat_send" "', argument " "1"" of type '" "Event *""'");
}
arg1 = reinterpret_cast< Event * >(argp1);
if (obj1) {
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_chat_send" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
}
result = (int)(arg1)->chat_send((char const *)arg2);
resultobj = SWIG_From_int(static_cast< int >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return NULL;
}
SWIGINTERN PyObject *_wrap_Event_serialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
Event *arg1 = (Event *) 0 ;
@@ -9042,6 +9126,8 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"Event_mine_get", _wrap_Event_mine_get, METH_VARARGS, NULL},
{ (char *)"new_Event", _wrap_new_Event, METH_VARARGS, NULL},
{ (char *)"delete_Event", _wrap_delete_Event, METH_VARARGS, NULL},
{ (char *)"Event_chat_execute", _wrap_Event_chat_execute, METH_VARARGS, NULL},
{ (char *)"Event_chat_send", _wrap_Event_chat_send, METH_VARARGS, NULL},
{ (char *)"Event_serialize", _wrap_Event_serialize, METH_VARARGS, NULL},
{ (char *)"Event_setPriority", _wrap_Event_setPriority, METH_VARARGS, NULL},
{ (char *)"Event_getHeader", _wrap_Event_getHeader, METH_VARARGS, NULL},