mod_httapi.c -- HT-TAPI Hypertext Telephony API (Twillio FreeSWITCH style)

This commit is contained in:
Anthony Minessale 2012-01-05 15:17:40 -06:00
parent 8950a78c41
commit bc8cbee1fb
12 changed files with 3405 additions and 0 deletions

View File

@ -44,6 +44,7 @@ applications/mod_valet_parking
#applications/mod_abstraction
#applications/mod_esl
applications/mod_sms
applications/mod_httapi
codecs/mod_g723_1
codecs/mod_amr
#codecs/mod_amrwb

View File

@ -0,0 +1,87 @@
<configuration name="httapi.conf" description="HT-TAPI Hypertext Telephony API">
<settings>
<!-- print xml on the consol -->
<param name="debug" value="true"/>
<!-- time to keep audio files when discoverd they were deleted from the http server -->
<param name="file-not-found-expires" value="300"/>
<!-- how often to re-check the server to make sure the remote file has not changed -->
<param name="file-cache-ttl" value="300"/>
</settings>
<profiles>
<profile name="default">
<!-- default params for conference action tags -->
<conference>
<param name="default-profile" value="default"/>
</conference>
<!-- default params for dial action tags -->
<dial>
<param name="context" value="default"/>
<param name="dialplan" value="XML"/>
</dial>
<!-- permissions -->
<permissions>
<!-- <permission name="all" value="true"/> -->
<!--<permission name="none" value="true"/> -->
<permission name="set-params" value="true"/>
<permission name="set-vars" value="false"/>
<permission name="extended-data" value="false"/>
<permission name="execute-apps" value="false"/>
<permission name="expand-vars-in-tag-body" value="false"/>
<permission name="dial" value="true"/>
<permission name="dial-set-context" value="false"/>
<permission name="dial-set-dialplan" value="false"/>
<permission name="dial-set-cid-name" value="false"/>
<permission name="dial-set-cid-number" value="false"/>
<permission name="dial-full-originate" value="false"/>
<permission name="conference" value="true"/>
<permission name="conference-set-profile" value="false"/>
</permissions>
<params>
<!-- default url can be overridden by app data -->
<param name="gateway-url" value="http://sidious.freeswitch.org/api/index.cgi" />
<!-- set this to provide authentication credentials to the server -->
<!--<param name="gateway-credentials" value="muser:mypass"/>-->
<!--<param name="auth-scheme" value="basic"/>-->
<!-- optional: this will enable the CA root certificate check by libcurl to
verify that the certificate was issued by a major Certificate Authority.
note: default value is disabled. only enable if you want this! -->
<!--<param name="enable-cacert-check" value="true"/>-->
<!-- optional: verify that the server is actually the one listed in the cert -->
<!-- <param name="enable-ssl-verifyhost" value="true"/> -->
<!-- optional: these options can be used to specify custom SSL certificates
to use for HTTPS communications. Either use both options or neither.
Specify your public key with 'ssl-cert-path' and the private key with
'ssl-key-path'. If your private key has a password, specify it with
'ssl-key-password'. -->
<!-- <param name="ssl-cert-path" value="$${base_dir}/conf/certs/public_key.pem"/> -->
<!-- <param name="ssl-key-path" value="$${base_dir}/conf/certs/private_key.pem"/> -->
<!-- <param name="ssl-key-password" value="MyPrivateKeyPassword"/> -->
<!-- optional timeout -->
<!-- <param name="timeout" value="10"/> -->
<!-- optional: use a custom CA certificate in PEM format to verify the peer
with. This is useful if you are acting as your own certificate authority.
note: only makes sense if used in combination with "enable-cacert-check." -->
<!-- <param name="ssl-cacert-file" value="$${base_dir}/conf/certs/cacert.pem"/> -->
<!-- optional: specify the SSL version to force HTTPS to use. Valid options are
"SSLv3" and "TLSv1". Otherwise libcurl will auto-negotiate the version. -->
<!-- <param name="ssl-version" value="TLSv1"/> -->
<!-- optional: enables cookies and stores them in the specified file. -->
<!-- <param name="cookie-file" value="/tmp/cookie-mod_xml_curl.txt"/> -->
<!-- one or more of these imply you want to pick the exact variables that are transmitted -->
<!--<param name="enable-post-var" value="Unique-ID"/>-->
</params>
</profile>
</profiles>
</configuration>

View File

@ -62,6 +62,7 @@
<load module="mod_valet_parking"/>
<!--<load module="mod_fsk"/>-->
<!--<load module="mod_spy"/>-->
<load module="mod_httapi"/>
<!-- SNOM Module -->
<!--<load module="mod_snom"/>-->

View File

@ -0,0 +1,41 @@
#!/usr/bin/perl
# Object initialization:
use XML::Simple;
use CGI;
use Data::Dumper;
use XML::Writer;
my $q = CGI->new;
my $exiting = $q->param("exiting");
if ($exiting) {
print $q->header(-type => "text/plain");
print "OK";
exit();
}
print $q->header(-type => "text/xml");
my $writer = new XML::Writer(OUTPUT => STDOUT, DATA_MODE => 1);
$writer->startTag('document', type => 'xml/freeswitch-httapi');
$writer->startTag('work');
$writer->emptyTag('pause', milliseconds => "1500");
$writer->startTag('playback',
name => digits,
file => "http://sidious.freeswitch.org/sounds/exten.wav",
'error-file' => "http://sidious.freeswitch.org/sounds/invalid.wav",
'input-timeout' => "5000",
action => "dial:default:XML");
$writer->dataElement("bind", "~\\d+\#", strip => "#");
$writer->endTag('playback');
$writer->endTag('work');
$writer->endTag('document');
$writer->end();

View File

@ -0,0 +1,71 @@
#!/usr/bin/perl
# Object initialization:
use XML::Simple;
use CGI;
use Data::Dumper;
use XML::Writer;
my $q = CGI->new;
my $exten = $q->param("exten");
my $pin = $q->param("pin");
my $exiting = $q->param("exiting");
if ($exiting) {
print $q->header(-type => "text/plain");
print "OK";
exit();
}
print $q->header(-type => "text/xml");
my $writer = new XML::Writer(OUTPUT => STDOUT, DATA_MODE => 1);
$writer->startTag('document', type => 'xml/freeswitch-httapi');
$writer->startTag('params');
if ($exten) {
$writer->dataElement("exten", $exten);
}
if ($pin) {
$writer->dataElement("exten", $pin);
}
$writer->endTag('params');
if ($exten && $pin) {
$writer->startTag('work');
$writer->dataElement("playback", "http://sidious.freeswitch.org/sounds/ext_num.wav");
$writer->dataElement("say", $exten, language => "en", type => "name_spelled", method => "pronounced");
$writer->emptyTag('pause', milliseconds => "1500");
$writer->dataElement("say", $pin, language => "en", type => "name_spelled", method => "pronounced");
$writer->emptyTag('hangup');
$writer->endTag('work');
} elsif ($exten) {
$writer->startTag('work');
$writer->startTag('playback',
name => "pin",
file => "http://sidious.freeswitch.org/sounds/pin.wav",
'error-file' => "http://sidious.freeswitch.org/sounds/bad-pin.wav",
'input-timeout' => "5000");
$writer->dataElement("bind", "~\\d+\#", strip => "#");
$writer->endTag('playback');
$writer->endTag('work');
} else {
$writer->startTag('work');
$writer->startTag('playback',
name => "exten",
file => "http://sidious.freeswitch.org/sounds/exten.wav",
'error-file' => "http://sidious.freeswitch.org/sounds/invalid.wav",
'input-timeout' => "5000");
$writer->dataElement("bind", "~\\d+\#", strip => "#");
$writer->endTag('playback');
$writer->endTag('work');
}
$writer->endTag('document');
$writer->end();

View File

@ -0,0 +1,58 @@
#!/usr/bin/perl
# Object initialization:
use XML::Simple;
use CGI;
use Data::Dumper;
use XML::Writer;
my $q = CGI->new;
my $exiting = $q->param("exiting");
my $file = $q->upload("recorded_file");
if ($file) {
open(O, ">/tmp/recording.wav");
while(<$file>) {
print O $_;
}
close O;
print $q->header(-type => "text/plain");
print "OK\n";
exit();
}
if ($exiting) {
print $q->header(-type => "text/plain");
print "OK";
exit();
}
print $q->header(-type => "text/xml");
my $writer = new XML::Writer(OUTPUT => STDOUT, DATA_MODE => 1);
$writer->startTag('document', type => 'xml/freeswitch-httapi');
$writer->startTag('work');
$writer->emptyTag('pause', milliseconds => "1500");
$writer->emptyTag('playback', file => "http://sidious.freeswitch.org/eg/ivr-say_name.wav");
$writer->startTag('record',
name => "recorded_file",
file => "recording.wav",
'error-file' => "http://sidious.freeswitch.org/sounds/invalid.wav",
'input-timeout' => "5000",
'beep-file', => "tone_stream://%(1000,0,460)");
$writer->dataElement("bind", "~\\d+\#", strip => "#");
$writer->endTag('record');
$writer->endTag('work');
$writer->endTag('document');
$writer->end();

View File

@ -0,0 +1,61 @@
#!/usr/bin/perl
# Object initialization:
use XML::Simple;
use CGI;
use Data::Dumper;
use XML::Writer;
my $q = CGI->new;
my $result = $q->param("result");
my $type = $q->param("input_type");
my $exiting = $q->param("exiting");
if ($exiting) {
print $q->header(-type => "text/plain");
print "OK";
exit();
}
print $q->header(-type => "text/xml");
my $writer = new XML::Writer(OUTPUT => STDOUT, DATA_MODE => 1);
$writer->startTag('document', type => 'xml/freeswitch-httapi');
if ($result) {
$writer->startTag('work');
if ($type eq "dtmf") {
$writer->dataElement("say", $result, language => "en", type => "name_spelled", method => "pronounced");
}
$writer->dataElement("log", $result, level => "crit");
$writer->emptyTag('hangup');
$writer->endTag('work');
} else {
$writer->startTag('work');
$writer->emptyTag('pause', milliseconds => "1500");
$writer->startTag('playback',
name => "result",
'asr-engine' => "pocketsphinx",
'asr-grammar' => "pizza_yesno",
file => "http://sidious.freeswitch.org/sounds/ConfirmDelivery.wav",
'error-file' => "http://sidious.freeswitch.org/sounds/invalid.wav"
);
$writer->dataElement("bind", "~\\d+\#", strip => "#");
#$writer->dataElement("bind", "1");
#$writer->dataElement("bind", "2");
$writer->endTag('playback');
$writer->endTag('work');
}
$writer->endTag('document');
$writer->end();

View File

@ -0,0 +1,87 @@
<configuration name="httapi.conf" description="HT-TAPI Hypertext Telephony API">
<settings>
<!-- print xml on the consol -->
<param name="debug" value="true"/>
<!-- time to keep audio files when discoverd they were deleted from the http server -->
<param name="file-not-found-expires" value="300"/>
<!-- how often to re-check the server to make sure the remote file has not changed -->
<param name="file-cache-ttl" value="300"/>
</settings>
<profiles>
<profile name="default">
<!-- default params for conference action tags -->
<conference>
<param name="default-profile" value="default"/>
</conference>
<!-- default params for dial action tags -->
<dial>
<param name="context" value="default"/>
<param name="dialplan" value="XML"/>
</dial>
<!-- permissions -->
<permissions>
<!-- <permission name="all" value="true"/> -->
<!--<permission name="none" value="true"/> -->
<permission name="set-params" value="true"/>
<permission name="set-vars" value="false"/>
<permission name="extended-data" value="false"/>
<permission name="execute-apps" value="false"/>
<permission name="expand-vars-in-tag-body" value="false"/>
<permission name="dial" value="true"/>
<permission name="dial-set-context" value="false"/>
<permission name="dial-set-dialplan" value="false"/>
<permission name="dial-set-cid-name" value="false"/>
<permission name="dial-set-cid-number" value="false"/>
<permission name="dial-full-originate" value="false"/>
<permission name="conference" value="true"/>
<permission name="conference-set-profile" value="false"/>
</permissions>
<params>
<!-- default url can be overridden by app data -->
<param name="gateway-url" value="http://sidious.freeswitch.org/api/index.cgi" />
<!-- set this to provide authentication credentials to the server -->
<!--<param name="gateway-credentials" value="muser:mypass"/>-->
<!--<param name="auth-scheme" value="basic"/>-->
<!-- optional: this will enable the CA root certificate check by libcurl to
verify that the certificate was issued by a major Certificate Authority.
note: default value is disabled. only enable if you want this! -->
<!--<param name="enable-cacert-check" value="true"/>-->
<!-- optional: verify that the server is actually the one listed in the cert -->
<!-- <param name="enable-ssl-verifyhost" value="true"/> -->
<!-- optional: these options can be used to specify custom SSL certificates
to use for HTTPS communications. Either use both options or neither.
Specify your public key with 'ssl-cert-path' and the private key with
'ssl-key-path'. If your private key has a password, specify it with
'ssl-key-password'. -->
<!-- <param name="ssl-cert-path" value="$${base_dir}/conf/certs/public_key.pem"/> -->
<!-- <param name="ssl-key-path" value="$${base_dir}/conf/certs/private_key.pem"/> -->
<!-- <param name="ssl-key-password" value="MyPrivateKeyPassword"/> -->
<!-- optional timeout -->
<!-- <param name="timeout" value="10"/> -->
<!-- optional: use a custom CA certificate in PEM format to verify the peer
with. This is useful if you are acting as your own certificate authority.
note: only makes sense if used in combination with "enable-cacert-check." -->
<!-- <param name="ssl-cacert-file" value="$${base_dir}/conf/certs/cacert.pem"/> -->
<!-- optional: specify the SSL version to force HTTPS to use. Valid options are
"SSLv3" and "TLSv1". Otherwise libcurl will auto-negotiate the version. -->
<!-- <param name="ssl-version" value="TLSv1"/> -->
<!-- optional: enables cookies and stores them in the specified file. -->
<!-- <param name="cookie-file" value="/tmp/cookie-mod_xml_curl.txt"/> -->
<!-- one or more of these imply you want to pick the exact variables that are transmitted -->
<!--<param name="enable-post-var" value="Unique-ID"/>-->
</params>
</profile>
</profiles>
</configuration>

View File

@ -0,0 +1,287 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="mod_httapi"
ProjectGUID="{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}"
RootNamespace="mod_httapi"
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_httapi.c"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -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_httapi</ProjectName>
<ProjectGuid>{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}</ProjectGuid>
<RootNamespace>mod_httapi</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_httapi.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>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,279 @@
HT-TAPI Hyper-Text Telephony API and http file format plugin
This module provides an HTTP based Telephony API using a standard FreeSWITCH application interface as well as a cached http file format interface.
The file format plugin can be used like this:
<action application="playback" data="http://some.com/sounds/foo.wav"/>
This syntax is valid anywhere a filname parameter is requested in FreeSWITCH.
The application is called like this:
<action application="httapi" data="{url=http://some.host.com/app.cgi}"/>
The target url is expected to be a CGI returning text/xml using the documentation below.
The format is roughly as described below (We could use a DTD maybe).
<document type="xml/freeswitch-httapi">
<params>
<param name="" value=""/>
</params>
<variables>
<variable name="" value=""/>
</variables>
<work>
<...>
</work>
</document>
The profile name must be chosen to bind to a preset series of settings and permissions to use as a basis for the client session.
Its chosen from the specified params or from the channel variable using the keyname 'httapi_profile' and if not specified will default to 'default'
Any params specified in the initial data of the application encased in brackets {} will be parsed into the initial params similar to originate.
These params remain set until the call ends and are supplied as form elements on each hit to the HTTP server.
If the permissions allow, a <params> tag is parsed from the resulting document and set into this data set and will be mirrored back on subsequqent http posts.
Also if the permissions allow a <variables> tag is parsed the same way setting channel variables.
The <work> tag is required and contains one or more of the supported command tags that generally manipulate the call behaviour.
The application will continue to do the task in the work section until an error is encoutered or when an action from the work tag warrants it.
If the session exits the httapi app without hanging up it can do other tasks and make another call to httapi and the session data will remain preserved.
EXAMPLE:
<document type="xml/freeswitch-httapi">
<params></params>
<work>
<playback name="exten" file="http://my.com/sounds/exten.wav" error-file="http://my.com/sounds/invalid.wav" input-timeout="5000">
<bind strip="#">~\d+#</bind>
</playback>
</work>
</document>
BINDINGS
Several of the work tags that indicate they support bindings can contain one of more bind tags that function with similar fashion to bind_digit_action
<bind action strip>*EXPR*</bind>
ATTRS:
action : a specific url to go to next if the binding is dialed
strip : a character to strip from in the result such as #
WORK TAGS:
<work>*ACTIONS*</work>
<playback file name error-file action digit-timeout input-timeout loops asr-engine asr-grammar><bind action strip>*EXPR*</bind></playback>
: Plays a file and optionally collects input.
ATTRS:
file : The file
name : Param name to save result.
error-file : Error file to play on invalid input.
action : Change the new target url
digit-timeout : Timeout waiting for digits after file plays (when input bindings are present)
input-timeout : Timeout waiting for more digits in a multi-digit input.
loops : max times to play the file when input bindings are present.
asr-engine : ASR engine to use
asr-grammar : ASR grammar to use
<record file name error-file action digit-timeout input-timeout><bind action strip>*EXPR*</bind></record>
: Records a file, optionally collects input and posts the file back to the target url
ATTRS:
file : The file
name : Param name to save result.
error-file : Error file to play on invalid input.
action : Change the new target url
digit-timeout : Timeout waiting for digits after file plays (when input bindings are present)
input-timeout : Timeout waiting for more digits in a multi-digit input.
<pause name error-file action digit-timeout input-timeout loops milliseconds><bind action strip>*EXPR*</bind></pause>
: Waits for input for a specific amount of time.
ATTRS:
milliseconds : Number of milliseconds to pause
name : Param name to save result.
error-file : Error file to play on invalid input.
action : Change the new target url
digit-timeout : Timeout waiting for digits after file plays (when input bindings are present)
input-timeout : Timeout waiting for more digits in a multi-digit input.
loops : max times to play the file when input bindings are present.
<speak file name error-file action digit-timeout input-timeout loops engine voice><bind action strip>*EXPR*</bind></speak>
: Read Text to Speech with optional input.
ATTRS:
file : The file
name : Param name to save result.
error-file : Error file to play on invalid input.
action : Change the new target url
digit-timeout : Timeout waiting for digits after file plays (when input bindings are present)
input-timeout : Timeout waiting for more digits in a multi-digit input.
loops : max times to play the file when input bindings are present.
engine : tts engine to use.
voice : tts voice to use.
<say file name error-file action digit-timeout input-timeout loops language type method gender><bind action strip>*EXPR*</bind></say>
: Use the FS say engine to iterate sounds to similate a human speaker.
ATTRS:
file : The file
name : Param name to save result.
error-file : Error file to play on invalid input.
action : Change the new target url
digit-timeout : Timeout waiting for digits after file plays (when input bindings are present)
input-timeout : Timeout waiting for more digits in a multi-digit input.
loops : max times to play the file when input bindings are present.
language : language
type : type (fs param)
method : method (fs param)
gender : gender (fs param)
<execute application>*DATA*</execute>
: Execute a FreeSWITCH app.
ATTRS:
application : The app to run
*DATA* : The app data
<sms to>DATA</sms>
: Send a SMS message.
ATTRS:
to : The dest number
*DATA* : The message data
<dial context dialplan caller-id-name caller-id-number>*DATA*</dial>
: Place an outbound call or transfer.
ATTRS:
context : Dialplan context.
dialplan : Dialplan dialplan.
caller-id-name : Caller ID Name.
caller-id-number : Caller ID Number.
*DATA* : Number to dial or originate string
<recordCall limit name action>
: begin recording the call. The file will be posted when the call ends.
ATTRS:
limit : Timeout in seconds.
name : Name to use for input values.
action : URL action to use.
<conference profile>
: Start a conference call.
ATTRS:
profile : Conference profile to use.
<hangup cause>
: Hangup the call
ATTRS:
cause : Hangup cause
<break>
: Exit the httapi application and continue in the dialplan.
<log level clean>
: Exit the httapi application and continue in the dialplan.
ATTRS:
level : The log level to use.
clean : If true do not pring log prefix.
CONFIGURATION:
<settings>:
<param name="" value="">
debug : <true|false> false Print debug data
file-cache-ttl : <number of sec> 300 How long to wait before checking the server to see if audio file has changed.
file-not-found-expires : <number of sec> 300 How long to still preserve cached audio files that are not found by the server.
<profile name="<name>"> : CREATE NEW PROFILE TO REFERENCE BY NAME
gateway-url : <string> "" Initial URL to connect to.
gateway-credentials : <string> "" HTTP credentials.
auth-scheme : <string > basic auth scheme to use. [basic|digest|NTLM|GSS-NEGOTIATE|any]
disable-100-continue : <true|false> true Disable the 100 continue feature.
method : <string> "" METHOD name to send.
timeout : <number> 0 Timeout waiting for response.
enable-cacert-check : <true|false> false Check CA/CERT.
ssl-cert-path : <string> "" path to file.
ssl-key-path : <string> "" path to file.
ssl-key-password : <string> "" password to use.
ssl-version : <string> "" ssl version
ssl-cacert-file : <string> "" CA/CERT file.
enable-ssl-verifyhost : <true|false> "" Verify ssl host.
cookie-file : <string> "" Path to file to use for cookie.
enable-post-var : <param_name> "" Specify specifc param names ok to send.
bind-local : <string> "" Interface to bind to.
default-profile : <string> default Profile to use when not specified.
<permissions>: * = default
<permission name="" value="">
*set-params : <params> tag can be parsed for session params.
set-vars : <variables> tag can be parsed to set channel vars.
extended-data : Extended data is sent like full channel event data.
execute-apps : <execute> tag is enabled to execute apps.
expand-vars-in-tag-body : body content of tags are run trough variable expansion.
*dial : <dial> tag is enabled allowing outbound dialing.
dial-set-context : <dial context=""> context attribute is permitted.
dial-set-dialplan : <dial dialplan=""> dialplan attribute is permitted.
dial-set-cid-name : <dial cid_name=""> cid_name attribute is permitted.
dial-set-cid-number : <dial cid_number=""> cid_number attribute is permitted.
dial-full-originate : <dial> full originate syntax is permitted instead of just a number.
*conference : <conference> tag is enabled allowing creation of conferences.
conference-set-profile : <conference profile=""> attribure is permitted.
all : all permissions are set
none : no permissions are set