diff --git a/libs/esl/managed/ESL.2010.vcxproj b/libs/esl/managed/ESL.2010.vcxproj
new file mode 100644
index 0000000000..1656ddd1db
--- /dev/null
+++ b/libs/esl/managed/ESL.2010.vcxproj
@@ -0,0 +1,195 @@
+<?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>ESL</ProjectName>
+    <ProjectGuid>{FEA2D0AE-6713-4E41-A473-A143849BC7FF}</ProjectGuid>
+    <RootNamespace>ESL</RootNamespace>
+    <Keyword>ManagedCProj</Keyword>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+    <CLRSupport>true</CLRSupport>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+    <CLRSupport>true</CLRSupport>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+    <CLRSupport>true</CLRSupport>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+    <CLRSupport>true</CLRSupport>
+  </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" />
+  </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" />
+  </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" />
+  </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" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>..\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level4</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>esl.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>..\..\..\libs\esl\src\$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AssemblyDebug>true</AssemblyDebug>
+      <TargetMachine>NotSet</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <AdditionalIncludeDirectories>..\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>esl.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>..\..\..\libs\esl\src\$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Midl>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>..\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level4</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>esl.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>..\..\..\libs\esl\src\$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AssemblyDebug>true</AssemblyDebug>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Midl>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <AdditionalIncludeDirectories>..\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>esl.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>..\..\..\libs\esl\src\$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <Reference Include="System">
+      <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
+      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
+    </Reference>
+    <Reference Include="System.Data">
+      <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
+      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
+    </Reference>
+    <Reference Include="System.Xml">
+      <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
+      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\src\esl_oop.cpp" />
+    <ClCompile Include="esl_wrap.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\src\include\esl_oop.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/libs/esl/managed/ESL.2010.vcxproj.filters b/libs/esl/managed/ESL.2010.vcxproj.filters
new file mode 100644
index 0000000000..0f46492f09
--- /dev/null
+++ b/libs/esl/managed/ESL.2010.vcxproj.filters
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\src\esl_oop.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="esl_wrap.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\src\include\esl_oop.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/libs/esl/managed/ManagedEsl.2010.csproj b/libs/esl/managed/ManagedEsl.2010.csproj
new file mode 100644
index 0000000000..7be21f44cb
--- /dev/null
+++ b/libs/esl/managed/ManagedEsl.2010.csproj
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{DEE5837B-E01D-4223-B351-EDF9418F3F8E}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>ManagedEsl</RootNamespace>
+    <AssemblyName>ManagedEsl</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <OldToolsVersion>3.5</OldToolsVersion>
+    <UpgradeBackupLocation />
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="ESL.cs" />
+    <Compile Include="ESLconnection.cs" />
+    <Compile Include="ESLevent.cs" />
+    <Compile Include="ESLPINVOKE.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SWIGTYPE_p_esl_event_t.cs" />
+    <Compile Include="SWIGTYPE_p_esl_priority_t.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file
diff --git a/libs/esl/managed/ManagedEslTest/ManagedEslTest.2010.csproj b/libs/esl/managed/ManagedEslTest/ManagedEslTest.2010.csproj
new file mode 100644
index 0000000000..8b97ffc2df
--- /dev/null
+++ b/libs/esl/managed/ManagedEslTest/ManagedEslTest.2010.csproj
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{2321D01A-D64B-4461-9837-FACF38652212}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>ManagedEslTest</RootNamespace>
+    <AssemblyName>ManagedEslTest</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <OldToolsVersion>3.5</OldToolsVersion>
+    <UpgradeBackupLocation />
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\ManagedEsl.csproj">
+      <Project>{DEE5837B-E01D-4223-B351-EDF9418F3F8E}</Project>
+      <Name>ManagedEsl</Name>
+      <Private>True</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file
diff --git a/libs/esl/managed/managed_esl.2010.sln b/libs/esl/managed/managed_esl.2010.sln
new file mode 100644
index 0000000000..3460af4746
--- /dev/null
+++ b/libs/esl/managed/managed_esl.2010.sln
@@ -0,0 +1,74 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ESL", "ESL.2010.vcxproj", "{FEA2D0AE-6713-4E41-A473-A143849BC7FF}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManagedEsl.2010", "ManagedEsl.2010.csproj", "{DEE5837B-E01D-4223-B351-EDF9418F3F8E}"
+	ProjectSection(ProjectDependencies) = postProject
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF} = {FEA2D0AE-6713-4E41-A473-A143849BC7FF}
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManagedEslTest.2010", "ManagedEslTest\ManagedEslTest.2010.csproj", "{2321D01A-D64B-4461-9837-FACF38652212}"
+	ProjectSection(ProjectDependencies) = postProject
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF} = {FEA2D0AE-6713-4E41-A473-A143849BC7FF}
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|Mixed Platforms = Debug|Mixed Platforms
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Any CPU = Release|Any CPU
+		Release|Mixed Platforms = Release|Mixed Platforms
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Any CPU.ActiveCfg = Debug|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Win32.ActiveCfg = Debug|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Win32.Build.0 = Debug|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|x64.ActiveCfg = Debug|x64
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|x64.Build.0 = Debug|x64
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Any CPU.ActiveCfg = Release|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Mixed Platforms.Build.0 = Release|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Win32.ActiveCfg = Release|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Win32.Build.0 = Release|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|x64.ActiveCfg = Release|x64
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|x64.Build.0 = Release|x64
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Win32.ActiveCfg = Debug|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|x64.Build.0 = Debug|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Win32.ActiveCfg = Release|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|x64.ActiveCfg = Release|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|x64.Build.0 = Release|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Debug|Win32.ActiveCfg = Debug|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Debug|x64.Build.0 = Debug|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Release|Any CPU.Build.0 = Release|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Release|Win32.ActiveCfg = Release|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Release|x64.ActiveCfg = Release|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Release|x64.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c
index f5bab62fcb..078c5de973 100644
--- a/libs/esl/src/esl.c
+++ b/libs/esl/src/esl.c
@@ -1094,9 +1094,9 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_
 						esl_log(ESL_LOG_DEBUG, "RECV INNER HEADER [%s] = [%s]\n", hname, hval);
 						if (!strcasecmp(hname, "event-name")) {
 							esl_event_del_header(handle->last_ievent, "event-name");
+						        esl_name_event(hval, &handle->last_ievent->event_id);
 						}
 						esl_event_add_header_string(handle->last_ievent, ESL_STACK_BOTTOM, hname, hval);
-						esl_name_event(hval, &handle->last_ievent->event_id);
 					}
 				
 					beg = c + 1;
diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c
index f1e0bf45ce..f2afd1cf9c 100644
--- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c
+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c
@@ -120,7 +120,7 @@ ftdm_state_map_t sangoma_isdn_state_map = {
 		ZSD_INBOUND,
 		ZSM_UNACCEPTABLE,
 		{FTDM_CHANNEL_STATE_RING, FTDM_END},
-		{FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_END}
+		{FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}
 	},
 	{
 		ZSD_INBOUND,
diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c
index c979000223..100631f345 100644
--- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c
+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c
@@ -38,6 +38,7 @@ static ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span
 static ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span);
 static ftdm_status_t add_local_number(const char* val, ftdm_span_t *span);
 static ftdm_status_t parse_yesno(const char* var, const char* val, uint8_t *target);
+static ftdm_status_t set_switchtype_defaults(ftdm_span_t *span);
 
 extern ftdm_sngisdn_data_t	g_sngisdn_data;
 
@@ -149,7 +150,7 @@ static ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span
 
 	g_sngisdn_data.spans[signal_data->link_id] = signal_data;
 	
-	ftdm_log(FTDM_LOG_DEBUG, "%s: cc_id:%d dchan_id:%d span_id:%d\n", span->name, signal_data->cc_id, signal_data->dchan_id, signal_data->span_id);
+	ftdm_log(FTDM_LOG_DEBUG, "%s: cc_id:%d dchan_id:%d span_id:%d link_id:%d\n", span->name, signal_data->cc_id, signal_data->dchan_id, signal_data->span_id, signal_data->link_id);
 
 	
 	chaniter = ftdm_span_get_chan_iterator(span, NULL);
@@ -191,6 +192,63 @@ static ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span)
 	return FTDM_SUCCESS;
 }
 
+static ftdm_status_t set_switchtype_defaults(ftdm_span_t *span)
+{
+	sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data;
+	switch(signal_data->switchtype) {
+		case SNGISDN_SWITCH_NI2:
+		case SNGISDN_SWITCH_5ESS:
+		case SNGISDN_SWITCH_4ESS:
+		case SNGISDN_SWITCH_DMS100:
+			if (span->default_caller_data.dnis.plan >= FTDM_NPI_INVALID) {
+				ftdm_set_npi("isdn", &span->default_caller_data.dnis.plan);
+			}
+			if (span->default_caller_data.dnis.type >= FTDM_TON_INVALID) {
+				ftdm_set_ton("national", &span->default_caller_data.dnis.type);
+			}
+			if (span->default_caller_data.cid_num.plan >= FTDM_NPI_INVALID) {
+				ftdm_set_npi("isdn", &span->default_caller_data.cid_num.plan);
+			}
+			if (span->default_caller_data.cid_num.type >= FTDM_TON_INVALID) {
+				ftdm_set_ton("national", &span->default_caller_data.cid_num.type);
+			}
+			if (span->default_caller_data.rdnis.plan >= FTDM_NPI_INVALID) {
+				ftdm_set_npi("isdn", &span->default_caller_data.rdnis.plan);
+			}
+			if (span->default_caller_data.rdnis.type >= FTDM_TON_INVALID) {
+				ftdm_set_ton("national", &span->default_caller_data.rdnis.type);
+			}
+			break;
+		case SNGISDN_SWITCH_EUROISDN:
+		case SNGISDN_SWITCH_QSIG:
+		case SNGISDN_SWITCH_INSNET:
+			if (span->default_caller_data.dnis.plan >= FTDM_NPI_INVALID) {
+				ftdm_set_npi("unknown", &span->default_caller_data.dnis.plan);
+			}
+			if (span->default_caller_data.dnis.type >= FTDM_TON_INVALID) {
+				ftdm_set_ton("unknown", &span->default_caller_data.dnis.type);
+			}
+			if (span->default_caller_data.cid_num.plan >= FTDM_NPI_INVALID) {
+				ftdm_set_npi("unknown", &span->default_caller_data.cid_num.plan);
+			}
+			if (span->default_caller_data.cid_num.type >= FTDM_TON_INVALID) {
+				ftdm_set_ton("unknown", &span->default_caller_data.cid_num.type);
+			}
+			if (span->default_caller_data.rdnis.plan >= FTDM_NPI_INVALID) {
+				ftdm_set_npi("unknown", &span->default_caller_data.rdnis.plan);
+			}
+			if (span->default_caller_data.rdnis.type >= FTDM_TON_INVALID) {
+				ftdm_set_ton("unknown", &span->default_caller_data.rdnis.type);
+			}
+			break;
+		case SNGISDN_SWITCH_INVALID:
+		default:
+			ftdm_log(FTDM_LOG_ERROR, "Unsupported switchtype[%d]\n", signal_data->switchtype);
+			return FTDM_FAIL;
+	}
+	return FTDM_SUCCESS;
+}
+
 ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span)
 {
 	unsigned paramindex;
@@ -205,31 +263,19 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_
 	signal_data->ignore_cause_value = SNGISDN_OPT_DEFAULT;
 	signal_data->timer_t3 = 8;
 	signal_data->restart_opt = SNGISDN_OPT_DEFAULT;
-
 	signal_data->link_id = span->span_id;
-	span->default_caller_data.bearer_capability = IN_ITC_SPEECH;
+	
+	span->default_caller_data.dnis.plan = FTDM_NPI_INVALID;
+	span->default_caller_data.dnis.type = FTDM_TON_INVALID;
+	span->default_caller_data.cid_num.plan = FTDM_NPI_INVALID;
+	span->default_caller_data.cid_num.type = FTDM_TON_INVALID;
+	span->default_caller_data.rdnis.plan = FTDM_NPI_INVALID;
+	span->default_caller_data.rdnis.type = FTDM_TON_INVALID;
 
+	span->default_caller_data.bearer_capability = IN_ITC_SPEECH;
 	/* Cannot set default bearer_layer1 yet, as we do not know the switchtype */
 	span->default_caller_data.bearer_layer1 = FTDM_INVALID_INT_PARM;
 
-	if (span->trunk_type == FTDM_TRUNK_BRI ||
-		span->trunk_type == FTDM_TRUNK_BRI_PTMP) {
-
-		ftdm_set_npi("unknown", &span->default_caller_data.dnis.plan);
-		ftdm_set_ton("unknown", &span->default_caller_data.dnis.type);
-		ftdm_set_npi("unknown", &span->default_caller_data.cid_num.plan);
-		ftdm_set_ton("unknown", &span->default_caller_data.cid_num.type);
-		ftdm_set_npi("unknown", &span->default_caller_data.rdnis.plan);
-		ftdm_set_ton("unknown", &span->default_caller_data.rdnis.type);
-	} else {
-		ftdm_set_npi("isdn", &span->default_caller_data.dnis.plan);
-		ftdm_set_ton("national", &span->default_caller_data.dnis.type);
-		ftdm_set_npi("isdn", &span->default_caller_data.cid_num.plan);
-		ftdm_set_ton("national", &span->default_caller_data.cid_num.type);
-		ftdm_set_npi("isdn", &span->default_caller_data.rdnis.plan);
-		ftdm_set_ton("national", &span->default_caller_data.rdnis.type);
-	}
-
 	for (paramindex = 0; ftdm_parameters[paramindex].var; paramindex++) {
 		ftdm_log(FTDM_LOG_DEBUG, "Sangoma ISDN key=value, %s=%s\n", ftdm_parameters[paramindex].var, ftdm_parameters[paramindex].val);
 		var = ftdm_parameters[paramindex].var;
@@ -239,6 +285,9 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_
 			if (parse_switchtype(val, span) != FTDM_SUCCESS) {
 				return FTDM_FAIL;
 			}
+			if (set_switchtype_defaults(span) != FTDM_SUCCESS) {
+				return FTDM_FAIL;
+			}
 		} else if (!strcasecmp(var, "signalling") ||
 				   !strcasecmp(var, "interface")) {
 			if (parse_signalling(val, span) != FTDM_SUCCESS) {
diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c
index de10a9fac0..a52a624dd0 100644
--- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c
+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c
@@ -216,7 +216,7 @@ ftdm_status_t sngisdn_stack_cfg_phy_psap(ftdm_span_t *span)
 	cfg.hdr.entId.inst  = S_INST;
 	cfg.hdr.elmId.elmnt = STPSAP;
 
-	cfg.hdr.elmId.elmntInst1    = signal_data->link_id;
+	cfg.hdr.elmId.elmntInst1    = signal_data->dchan_id;
 
 	if (!signal_data->dchan) {
 		ftdm_log(FTDM_LOG_ERROR, "%s:No d-channels specified\n", span->name);
@@ -241,7 +241,8 @@ ftdm_status_t sngisdn_stack_cfg_phy_psap(ftdm_span_t *span)
 			ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported trunk type %d\n", span->name, span->trunk_type);
 			return FTDM_FAIL;
 	}
-	cfg.t.cfg.s.l1PSAP.spId		= signal_data->link_id;
+
+	cfg.t.cfg.s.l1PSAP.spId		= signal_data->dchan_id;
 
 	if (sng_isdn_phy_config(&pst, &cfg)) {
 		return FTDM_FAIL;
@@ -315,7 +316,7 @@ ftdm_status_t sngisdn_stack_cfg_q921_msap(ftdm_span_t *span)
 	cfg.hdr.entId.inst  = S_INST;
 	cfg.hdr.elmId.elmnt = STMSAP;
 
-	cfg.t.cfg.s.bdMSAP.lnkNmb      = signal_data->link_id;
+	cfg.t.cfg.s.bdMSAP.lnkNmb      = signal_data->dchan_id;
 
 	cfg.t.cfg.s.bdMSAP.maxOutsFrms = 24;            /* MAC window */
 	cfg.t.cfg.s.bdMSAP.tQUpperTrs  = 32;           /* Tx Queue Upper Threshold */
@@ -408,7 +409,7 @@ ftdm_status_t sngisdn_stack_cfg_q921_dlsap(ftdm_span_t *span, uint8_t management
 	cfg.hdr.entId.inst  = S_INST;
 	cfg.hdr.elmId.elmnt = STDLSAP;
 
-	cfg.t.cfg.s.bdDLSAP.lnkNmb		= signal_data->link_id;
+	cfg.t.cfg.s.bdDLSAP.lnkNmb		= signal_data->dchan_id;
 
 	cfg.t.cfg.s.bdDLSAP.n201		= 1028;          	/* n201 */
 	if (span->trunk_type == FTDM_TRUNK_BRI_PTMP ||
@@ -613,9 +614,9 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span)
 
 	cfg.hdr.response.selector=0;
 
+	cfg.t.cfg.s.inDLSAP.sapId = signal_data->dchan_id;
+	cfg.t.cfg.s.inDLSAP.spId = signal_data->dchan_id;
 
-	cfg.t.cfg.s.inDLSAP.sapId = signal_data->link_id;
-	cfg.t.cfg.s.inDLSAP.spId = signal_data->link_id;
 	cfg.t.cfg.s.inDLSAP.swtch = sng_isdn_stack_switchtype(signal_data->switchtype);
 
 	cfg.t.cfg.s.inDLSAP.n201 = 1024;
@@ -876,8 +877,7 @@ ftdm_status_t sngisdn_stack_cfg_q931_lce(ftdm_span_t *span)
 
 	cfg.hdr.response.selector=0;
 
-	cfg.t.cfg.s.inLCe.sapId = signal_data->link_id;
-
+	cfg.t.cfg.s.inLCe.sapId = signal_data->dchan_id;
 
 	cfg.t.cfg.s.inLCe.lnkUpDwnInd = TRUE;
 	cfg.t.cfg.s.inLCe.tCon.enb = TRUE;
diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c
index 225244f57e..2023f4c54c 100644
--- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c
+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c
@@ -146,7 +146,8 @@ ftdm_status_t sngisdn_deactivate_phy(ftdm_span_t *span)
 
 	cntrl.t.cntrl.action = AUBND_DIS;
 	cntrl.t.cntrl.subAction = SAELMNT;
-	cntrl.t.cntrl.sapId = signal_data->link_id;
+
+	cntrl.t.cntrl.sapId = signal_data->dchan_id;
 	
 	if (sng_isdn_phy_cntrl(&pst, &cntrl)) {
 		return FTDM_FAIL;
@@ -180,7 +181,8 @@ ftdm_status_t sngisdn_wake_up_phy(ftdm_span_t *span)
 
 	cntrl.t.cntrl.action = AENA;
 	cntrl.t.cntrl.subAction = SAELMNT;
-	cntrl.t.cntrl.sapId = signal_data->link_id;
+
+	cntrl.t.cntrl.sapId = signal_data->dchan_id;
 	
 	if (sng_isdn_phy_cntrl(&pst, &cntrl)) {
 		return FTDM_FAIL;
@@ -298,7 +300,8 @@ ftdm_status_t sngisdn_cntrl_q931(ftdm_span_t *span, uint8_t action, uint8_t suba
 	if (action == AENA && subaction == SATRC) {
 		cntrl.t.cntrl.trcLen = -1; /* Trace the entire message buffer */
 	}
-	cntrl.t.cntrl.sapId = signal_data->link_id;
+
+	cntrl.t.cntrl.sapId = signal_data->dchan_id;
 	cntrl.t.cntrl.ces = 0;
 
 	if(sng_isdn_q931_cntrl(&pst, &cntrl)) {
@@ -339,11 +342,11 @@ ftdm_status_t sngisdn_cntrl_q921(ftdm_span_t *span, uint8_t action, uint8_t suba
 	cntrl.t.cntrl.subAction    = subaction;
 
 #if (SMBD_LMINT3 || BD_LMINT3)
-	cntrl.t.cntrl.lnkNmb       = signal_data->link_id;
+	cntrl.t.cntrl.lnkNmb       = signal_data->dchan_id;
 	cntrl.t.cntrl.sapi         = NOTUSED;
 	cntrl.t.cntrl.tei          = NOTUSED;
 #else /* _LMINT3 */
-	cntrl.hdr.elmId.elmntInst1 = signal_data->link_id;
+	cntrl.hdr.elmId.elmntInst1 = signal_data->dchan_id;
 	cntrl.hdr.elmId.elmntInst2 = NOTUSED;
 	cntrl.hdr.elmId.elmntInst3 = NOTUSED;
 #endif /* _LMINT3 */
diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c
index 9b4b7872c4..4b27f21e1c 100644
--- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c
+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c
@@ -491,8 +491,8 @@ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len)
 		/* Should we trigger congestion here? */
 		l1_frame.flags |= SNG_L1FRAME_QUEUE_FULL;
 	}
-	
-	sng_isdn_data_ind(signal_data->link_id, &l1_frame);
+
+	sng_isdn_data_ind(signal_data->dchan_id, &l1_frame);
 }
 
 void sngisdn_snd_event(ftdm_channel_t *dchan, ftdm_oob_event_t event)
@@ -506,11 +506,11 @@ void sngisdn_snd_event(ftdm_channel_t *dchan, ftdm_oob_event_t event)
 	switch(event) {
 		case FTDM_OOB_ALARM_CLEAR:
 			l1_event.type = SNG_L1EVENT_ALARM_OFF;
-			sng_isdn_event_ind(signal_data->link_id, &l1_event);
+			sng_isdn_event_ind(signal_data->dchan_id, &l1_event);
 			break;
 		case FTDM_OOB_ALARM_TRAP:
 			l1_event.type = SNG_L1EVENT_ALARM_ON;
-			sng_isdn_event_ind(signal_data->link_id, &l1_event);
+			sng_isdn_event_ind(signal_data->dchan_id, &l1_event);
 			break;
 		default:
 			/* We do not care about the other OOB events for now */
diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c
index a90968f64b..791b65f0f6 100644
--- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c
+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c
@@ -662,7 +662,9 @@ void sngisdn_rcv_phy_ind(SuId suId, Reason reason)
 void sngisdn_rcv_q921_ind(BdMngmt *status)
 {	
 	ftdm_span_t *ftdmspan;
-	sngisdn_span_data_t	*signal_data = g_sngisdn_data.spans[status->t.usta.lnkNmb];
+
+	sngisdn_span_data_t	*signal_data = g_sngisdn_data.dchans[status->t.usta.lnkNmb].spans[1];
+	
 	if (!signal_data) {
 		ftdm_log(FTDM_LOG_INFO, "Received q921 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.lnkNmb);
 		return;
@@ -715,7 +717,7 @@ void sngisdn_rcv_q931_ind(InMngmt *status)
 		case LCM_EVENT_DOWN:
 		{
 			ftdm_span_t *ftdmspan;
-			sngisdn_span_data_t	*signal_data = g_sngisdn_data.spans[status->t.usta.suId];
+			sngisdn_span_data_t	*signal_data = g_sngisdn_data.dchans[status->t.usta.suId].spans[1];
 			if (!signal_data) {
 				ftdm_log(FTDM_LOG_INFO, "Received q931 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.suId);
 				return;
@@ -784,7 +786,8 @@ void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf)
 	uint8_t data;
 	ftdm_trace_dir_t dir;
 	uint8_t tdata[1000];
-	sngisdn_span_data_t	*signal_data = g_sngisdn_data.spans[trc->t.trc.suId];
+
+	sngisdn_span_data_t	*signal_data = g_sngisdn_data.dchans[trc->t.trc.suId].spans[1];
 
 	ftdm_assert(mBuf != NULLP, "Received a Q931 trace with no buffer");
 	mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len;
@@ -830,7 +833,8 @@ void sngisdn_rcv_q921_trace(BdMngmt *trc, Buffer *mBuf)
 	uint8_t data;
 	ftdm_trace_dir_t dir;
 	uint8_t tdata[1000];
-	sngisdn_span_data_t	*signal_data = g_sngisdn_data.spans[trc->t.trc.lnkNmb];
+
+	sngisdn_span_data_t	*signal_data = g_sngisdn_data.dchans[trc->t.trc.lnkNmb].spans[1];
 
 	if (trc->t.trc.evnt == TL2TMR) {
 		return;
@@ -879,7 +883,7 @@ int16_t sngisdn_rcv_l1_data_req(uint16_t spId, sng_l1_frame_t *l1_frame)
 {
 	ftdm_status_t status;
 	ftdm_wait_flag_t flags = FTDM_WRITE;
-	sngisdn_span_data_t	*signal_data = g_sngisdn_data.spans[spId];	
+	sngisdn_span_data_t	*signal_data = g_sngisdn_data.dchans[spId].spans[1];
 	ftdm_size_t length = l1_frame->len;
 
 	ftdm_assert(signal_data, "Received Data request on unconfigured span\n");
@@ -912,8 +916,8 @@ int16_t sngisdn_rcv_l1_data_req(uint16_t spId, sng_l1_frame_t *l1_frame)
 }
 
 int16_t sngisdn_rcv_l1_cmd_req(uint16_t spId, sng_l1_cmd_t *l1_cmd)
-{	
-	sngisdn_span_data_t	*signal_data = g_sngisdn_data.spans[spId];
+{
+	sngisdn_span_data_t	*signal_data = g_sngisdn_data.dchans[spId].spans[1];
 	ftdm_assert(signal_data, "Received Data request on unconfigured span\n");
 	
 	switch(l1_cmd->type) {
diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h
index dc26a5dbfd..0b9c619a70 100644
--- a/libs/freetdm/src/include/freetdm.h
+++ b/libs/freetdm/src/include/freetdm.h
@@ -401,7 +401,6 @@ typedef enum {
 	FTDM_SIGEVENT_ADD_CALL, /*!< New call should be added to the channel */
 	FTDM_SIGEVENT_RESTART, /*!< Restart has been requested. Typically you hangup your call resources here */
 	FTDM_SIGEVENT_SIGSTATUS_CHANGED, /*!< Signaling protocol status changed (ie: D-chan up), see new status in raw_data ftdm_sigmsg_t member */
-	FTDM_SIGEVENT_COLLISION, /*!< Outgoing call was dropped because an incoming call arrived at the same time */
 	FTDM_SIGEVENT_FACILITY, /*!< In call facility event */
 	FTDM_SIGEVENT_TRACE, /*!<Interpreted trace event */
 	FTDM_SIGEVENT_TRACE_RAW, /*!<Raw trace event */
diff --git a/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86.s b/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86.s
index 743eff56fe..650aa2ad80 100644
--- a/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86.s
+++ b/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86.s
@@ -1,42 +1,42 @@
-/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-/ 
-/ 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 the Netscape Portable Runtime (NSPR).
-/ 
-/ The Initial Developer of the Original Code is Netscape
-/ Communications Corporation.  Portions created by Netscape are 
-/ Copyright (C) 2000 Netscape Communications Corporation.  All
-/ Rights Reserved.
-/ 
-/ Contributor(s):
-/ 
-/ Alternatively, the contents of this file may be used under the
-/ terms of the GNU General Public License Version 2 or later (the
-/ "GPL"), in which case the provisions of the GPL are applicable 
-/ instead of those above.  If you wish to allow use of your 
-/ version of this file only under the terms of the GPL and not to
-/ allow others to use your version of this file under the MPL,
-/ indicate your decision by deleting the provisions above and
-/ replace them with the notice and other provisions required by
-/ the GPL.  If you do not delete the provisions above, a recipient
-/ may use your version of this file under either the MPL or the
-/ GPL.
-/ 
+// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+// 
+// 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 the Netscape Portable Runtime (NSPR).
+// 
+// The Initial Developer of the Original Code is Netscape
+// Communications Corporation.  Portions created by Netscape are 
+// Copyright (C) 2000 Netscape Communications Corporation.  All
+// Rights Reserved.
+// 
+// Contributor(s):
+// 
+// Alternatively, the contents of this file may be used under the
+// terms of the GNU General Public License Version 2 or later (the
+// "GPL"), in which case the provisions of the GPL are applicable 
+// instead of those above.  If you wish to allow use of your 
+// version of this file only under the terms of the GPL and not to
+// allow others to use your version of this file under the MPL,
+// indicate your decision by deleting the provisions above and
+// replace them with the notice and other provisions required by
+// the GPL.  If you do not delete the provisions above, a recipient
+// may use your version of this file under either the MPL or the
+// GPL.
+// 
 
-/ PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val)
-/
-/ Atomically increment the integer pointed to by 'val' and return
-/ the result of the increment.
-/
+// PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val)
+//
+// Atomically increment the integer pointed to by 'val' and return
+// the result of the increment.
+//
     .text
     .globl _PR_x86_AtomicIncrement
     .align 4
@@ -48,11 +48,11 @@ _PR_x86_AtomicIncrement:
     incl %eax
     ret
 
-/ PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val)
-/
-/ Atomically decrement the integer pointed to by 'val' and return
-/ the result of the decrement.
-/
+// PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val)
+//
+// Atomically decrement the integer pointed to by 'val' and return
+// the result of the decrement.
+//
     .text
     .globl _PR_x86_AtomicDecrement
     .align 4
@@ -64,25 +64,25 @@ _PR_x86_AtomicDecrement:
     decl %eax
     ret
 
-/ PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval)
-/
-/ Atomically set the integer pointed to by 'val' to the new
-/ value 'newval' and return the old value.
-/
-/ An alternative implementation:
-/   .text
-/   .globl _PR_x86_AtomicSet
-/   .align 4
-/_PR_x86_AtomicSet:
-/   movl 4(%esp), %ecx
-/   movl 8(%esp), %edx
-/   movl (%ecx), %eax
-/retry:
-/   lock
-/   cmpxchgl %edx, (%ecx)
-/   jne retry
-/   ret
-/
+// PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval)
+//
+// Atomically set the integer pointed to by 'val' to the new
+// value 'newval' and return the old value.
+//
+// An alternative implementation:
+//   .text
+//   .globl _PR_x86_AtomicSet
+//   .align 4
+//_PR_x86_AtomicSet:
+//   movl 4(%esp), %ecx
+//   movl 8(%esp), %edx
+//   movl (%ecx), %eax
+//retry:
+//   lock
+//   cmpxchgl %edx, (%ecx)
+//   jne retry
+//   ret
+//
     .text
     .globl _PR_x86_AtomicSet
     .align 4
@@ -92,11 +92,11 @@ _PR_x86_AtomicSet:
     xchgl %eax, (%ecx)
     ret
 
-/ PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val)
-/
-/ Atomically add 'val' to the integer pointed to by 'ptr'
-/ and return the result of the addition.
-/
+// PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val)
+//
+// Atomically add 'val' to the integer pointed to by 'ptr'
+// and return the result of the addition.
+//
     .text
     .globl _PR_x86_AtomicAdd
     .align 4
@@ -109,5 +109,5 @@ _PR_x86_AtomicAdd:
     addl %edx, %eax
     ret
 
-/ Magic indicating no need for an executable stack
+// Magic indicating no need for an executable stack
 .section .note.GNU-stack, "", @progbits ; .previous
diff --git a/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86_64.s b/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86_64.s
index c62437b23a..230dd82887 100644
--- a/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86_64.s
+++ b/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86_64.s
@@ -1,42 +1,42 @@
-/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-/ 
-/ 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 the Netscape Portable Runtime (NSPR).
-/ 
-/ The Initial Developer of the Original Code is Netscape
-/ Communications Corporation.  Portions created by Netscape are 
-/ Copyright (C) 2004 Netscape Communications Corporation.  All
-/ Rights Reserved.
-/ 
-/ Contributor(s):
-/ 
-/ Alternatively, the contents of this file may be used under the
-/ terms of the GNU General Public License Version 2 or later (the
-/ "GPL"), in which case the provisions of the GPL are applicable 
-/ instead of those above.  If you wish to allow use of your 
-/ version of this file only under the terms of the GPL and not to
-/ allow others to use your version of this file under the MPL,
-/ indicate your decision by deleting the provisions above and
-/ replace them with the notice and other provisions required by
-/ the GPL.  If you do not delete the provisions above, a recipient
-/ may use your version of this file under either the MPL or the
-/ GPL.
-/ 
+// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+// 
+// 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 the Netscape Portable Runtime (NSPR).
+// 
+// The Initial Developer of the Original Code is Netscape
+// Communications Corporation.  Portions created by Netscape are 
+// Copyright (C) 2004 Netscape Communications Corporation.  All
+// Rights Reserved.
+// 
+// Contributor(s):
+// 
+// Alternatively, the contents of this file may be used under the
+// terms of the GNU General Public License Version 2 or later (the
+// "GPL"), in which case the provisions of the GPL are applicable 
+// instead of those above.  If you wish to allow use of your 
+// version of this file only under the terms of the GPL and not to
+// allow others to use your version of this file under the MPL,
+// indicate your decision by deleting the provisions above and
+// replace them with the notice and other provisions required by
+// the GPL.  If you do not delete the provisions above, a recipient
+// may use your version of this file under either the MPL or the
+// GPL.
+// 
 
-/ PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val)
-/
-/ Atomically increment the integer pointed to by 'val' and return
-/ the result of the increment.
-/
+// PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val)
+//
+// Atomically increment the integer pointed to by 'val' and return
+// the result of the increment.
+//
     .text
     .globl _PR_x86_64_AtomicIncrement
     .align 4
@@ -47,11 +47,11 @@ _PR_x86_64_AtomicIncrement:
     incl %eax
     ret
 
-/ PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val)
-/
-/ Atomically decrement the integer pointed to by 'val' and return
-/ the result of the decrement.
-/
+// PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val)
+//
+// Atomically decrement the integer pointed to by 'val' and return
+// the result of the decrement.
+//
     .text
     .globl _PR_x86_64_AtomicDecrement
     .align 4
@@ -62,11 +62,11 @@ _PR_x86_64_AtomicDecrement:
     decl %eax
     ret
 
-/ PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval)
-/
-/ Atomically set the integer pointed to by 'val' to the new
-/ value 'newval' and return the old value.
-/
+// PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval)
+//
+// Atomically set the integer pointed to by 'val' to the new
+// value 'newval' and return the old value.
+//
     .text
     .globl _PR_x86_64_AtomicSet
     .align 4
@@ -75,11 +75,11 @@ _PR_x86_64_AtomicSet:
     xchgl %eax, (%rdi)
     ret
 
-/ PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val)
-/
-/ Atomically add 'val' to the integer pointed to by 'ptr'
-/ and return the result of the addition.
-/
+// PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val)
+//
+// Atomically add 'val' to the integer pointed to by 'ptr'
+// and return the result of the addition.
+//
     .text
     .globl _PR_x86_64_AtomicAdd
     .align 4
@@ -90,5 +90,5 @@ _PR_x86_64_AtomicAdd:
     addl %esi, %eax
     ret
 
-/ Magic indicating no need for an executable stack
-/.section .note.GNU-stack, "", @progbits ; .previous
+// Magic indicating no need for an executable stack
+//.section .note.GNU-stack, "", @progbits ; .previous
diff --git a/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86.s b/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86.s
index a46c20fe1e..6e94a732da 100644
--- a/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86.s
+++ b/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86.s
@@ -1,36 +1,36 @@
-/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-/ 
-/ 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 the Netscape Portable Runtime (NSPR).
-/ 
-/ The Initial Developer of the Original Code is Netscape
-/ Communications Corporation.  Portions created by Netscape are 
-/ Copyright (C) 1998-2000 Netscape Communications Corporation.  All
-/ Rights Reserved.
-/ 
-/ Contributor(s):
-/ 
-/ Alternatively, the contents of this file may be used under the
-/ terms of the GNU General Public License Version 2 or later (the
-/ "GPL"), in which case the provisions of the GPL are applicable 
-/ instead of those above.  If you wish to allow use of your 
-/ version of this file only under the terms of the GPL and not to
-/ allow others to use your version of this file under the MPL,
-/ indicate your decision by deleting the provisions above and
-/ replace them with the notice and other provisions required by
-/ the GPL.  If you do not delete the provisions above, a recipient
-/ may use your version of this file under either the MPL or the
-/ GPL.
-/ 
+// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+// 
+// 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 the Netscape Portable Runtime (NSPR).
+// 
+// The Initial Developer of the Original Code is Netscape
+// Communications Corporation.  Portions created by Netscape are 
+// Copyright (C) 1998-2000 Netscape Communications Corporation.  All
+// Rights Reserved.
+// 
+// Contributor(s):
+// 
+// Alternatively, the contents of this file may be used under the
+// terms of the GNU General Public License Version 2 or later (the
+// "GPL"), in which case the provisions of the GPL are applicable 
+// instead of those above.  If you wish to allow use of your 
+// version of this file only under the terms of the GPL and not to
+// allow others to use your version of this file under the MPL,
+// indicate your decision by deleting the provisions above and
+// replace them with the notice and other provisions required by
+// the GPL.  If you do not delete the provisions above, a recipient
+// may use your version of this file under either the MPL or the
+// GPL.
+// 
 
 	.text
 
@@ -56,31 +56,31 @@ _MD_FlushRegisterWindows:
 
 	ret
 
-/
-/ sol_getsp()
-/
-/ Return the current sp (for debugging)
-/
+//
+// sol_getsp()
+//
+// Return the current sp (for debugging)
+//
 	.globl sol_getsp
 sol_getsp:
 	movl	%esp, %eax
 	ret
 
-/
-/ sol_curthread()
-/
-/ Return a unique identifier for the currently active thread.
-/
+//
+// sol_curthread()
+//
+// Return a unique identifier for the currently active thread.
+//
 	.globl sol_curthread
 sol_curthread:
 	movl	%ecx, %eax
 	ret
 
-/ PRInt32 _MD_AtomicIncrement(PRInt32 *val)
-/
-/ Atomically increment the integer pointed to by 'val' and return
-/ the result of the increment.
-/
+// PRInt32 _MD_AtomicIncrement(PRInt32 *val)
+//
+// Atomically increment the integer pointed to by 'val' and return
+// the result of the increment.
+//
     .text
     .globl _MD_AtomicIncrement
     .align 4
@@ -92,11 +92,11 @@ _MD_AtomicIncrement:
     incl %eax
     ret
 
-/ PRInt32 _MD_AtomicDecrement(PRInt32 *val)
-/
-/ Atomically decrement the integer pointed to by 'val' and return
-/ the result of the decrement.
-/
+// PRInt32 _MD_AtomicDecrement(PRInt32 *val)
+//
+// Atomically decrement the integer pointed to by 'val' and return
+// the result of the decrement.
+//
     .text
     .globl _MD_AtomicDecrement
     .align 4
@@ -108,25 +108,25 @@ _MD_AtomicDecrement:
     decl %eax
     ret
 
-/ PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval)
-/
-/ Atomically set the integer pointed to by 'val' to the new
-/ value 'newval' and return the old value.
-/
-/ An alternative implementation:
-/   .text
-/   .globl _MD_AtomicSet
-/   .align 4
-/_MD_AtomicSet:
-/   movl 4(%esp), %ecx
-/   movl 8(%esp), %edx
-/   movl (%ecx), %eax
-/retry:
-/   lock
-/   cmpxchgl %edx, (%ecx)
-/   jne retry
-/   ret
-/
+// PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval)
+//
+// Atomically set the integer pointed to by 'val' to the new
+// value 'newval' and return the old value.
+//
+// An alternative implementation:
+//   .text
+//   .globl _MD_AtomicSet
+//   .align 4
+//_MD_AtomicSet:
+//   movl 4(%esp), %ecx
+//   movl 8(%esp), %edx
+//   movl (%ecx), %eax
+//retry:
+//   lock
+//   cmpxchgl %edx, (%ecx)
+//   jne retry
+//   ret
+//
     .text
     .globl _MD_AtomicSet
     .align 4
@@ -136,11 +136,11 @@ _MD_AtomicSet:
     xchgl %eax, (%ecx)
     ret
 
-/ PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val)
-/
-/ Atomically add 'val' to the integer pointed to by 'ptr'
-/ and return the result of the addition.
-/
+// PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val)
+//
+// Atomically add 'val' to the integer pointed to by 'ptr'
+// and return the result of the addition.
+//
     .text
     .globl _MD_AtomicAdd
     .align 4
diff --git a/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s b/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s
index d4446a5f6b..6d30bc505e 100644
--- a/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s
+++ b/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s
@@ -1,42 +1,42 @@
-/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-/ 
-/ 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 the Netscape Portable Runtime (NSPR).
-/ 
-/ The Initial Developer of the Original Code is Netscape
-/ Communications Corporation.  Portions created by Netscape are 
-/ Copyright (C) 2004 Netscape Communications Corporation.  All
-/ Rights Reserved.
-/ 
-/ Contributor(s):
-/ 
-/ Alternatively, the contents of this file may be used under the
-/ terms of the GNU General Public License Version 2 or later (the
-/ "GPL"), in which case the provisions of the GPL are applicable 
-/ instead of those above.  If you wish to allow use of your 
-/ version of this file only under the terms of the GPL and not to
-/ allow others to use your version of this file under the MPL,
-/ indicate your decision by deleting the provisions above and
-/ replace them with the notice and other provisions required by
-/ the GPL.  If you do not delete the provisions above, a recipient
-/ may use your version of this file under either the MPL or the
-/ GPL.
-/ 
+// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+// 
+// 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 the Netscape Portable Runtime (NSPR).
+// 
+// The Initial Developer of the Original Code is Netscape
+// Communications Corporation.  Portions created by Netscape are 
+// Copyright (C) 2004 Netscape Communications Corporation.  All
+// Rights Reserved.
+// 
+// Contributor(s):
+// 
+// Alternatively, the contents of this file may be used under the
+// terms of the GNU General Public License Version 2 or later (the
+// "GPL"), in which case the provisions of the GPL are applicable 
+// instead of those above.  If you wish to allow use of your 
+// version of this file only under the terms of the GPL and not to
+// allow others to use your version of this file under the MPL,
+// indicate your decision by deleting the provisions above and
+// replace them with the notice and other provisions required by
+// the GPL.  If you do not delete the provisions above, a recipient
+// may use your version of this file under either the MPL or the
+// GPL.
+// 
 
-/ PRInt32 _MD_AtomicIncrement(PRInt32 *val)
-/
-/ Atomically increment the integer pointed to by 'val' and return
-/ the result of the increment.
-/
+// PRInt32 _MD_AtomicIncrement(PRInt32 *val)
+//
+// Atomically increment the integer pointed to by 'val' and return
+// the result of the increment.
+//
     .text
     .globl _MD_AtomicIncrement
     .align 4
@@ -47,11 +47,11 @@ _MD_AtomicIncrement:
     incl %eax
     ret
 
-/ PRInt32 _MD_AtomicDecrement(PRInt32 *val)
-/
-/ Atomically decrement the integer pointed to by 'val' and return
-/ the result of the decrement.
-/
+// PRInt32 _MD_AtomicDecrement(PRInt32 *val)
+//
+// Atomically decrement the integer pointed to by 'val' and return
+// the result of the decrement.
+//
     .text
     .globl _MD_AtomicDecrement
     .align 4
@@ -62,11 +62,11 @@ _MD_AtomicDecrement:
     decl %eax
     ret
 
-/ PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval)
-/
-/ Atomically set the integer pointed to by 'val' to the new
-/ value 'newval' and return the old value.
-/
+// PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval)
+//
+// Atomically set the integer pointed to by 'val' to the new
+// value 'newval' and return the old value.
+//
     .text
     .globl _MD_AtomicSet
     .align 4
@@ -75,11 +75,11 @@ _MD_AtomicSet:
     xchgl %eax, (%rdi)
     ret
 
-/ PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val)
-/
-/ Atomically add 'val' to the integer pointed to by 'ptr'
-/ and return the result of the addition.
-/
+// PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val)
+//
+// Atomically add 'val' to the integer pointed to by 'ptr'
+// and return the result of the addition.
+//
     .text
     .globl _MD_AtomicAdd
     .align 4
diff --git a/src/include/switch_types.h b/src/include/switch_types.h
index 9a5e09db7c..3972404290 100644
--- a/src/include/switch_types.h
+++ b/src/include/switch_types.h
@@ -859,7 +859,7 @@ typedef enum {
 	SWITCH_STATUS_FALSE,
 	SWITCH_STATUS_TIMEOUT,
 	SWITCH_STATUS_RESTART,
-	SWITCH_STATUS_TERM,
+	SWITCH_STATUS_INTR,
 	SWITCH_STATUS_NOTIMPL,
 	SWITCH_STATUS_MEMERR,
 	SWITCH_STATUS_NOOP,
@@ -876,6 +876,7 @@ typedef enum {
 	SWITCH_STATUS_TOO_SMALL,
 	SWITCH_STATUS_FOUND,
 	SWITCH_STATUS_CONTINUE,
+	SWITCH_STATUS_TERM,
 	SWITCH_STATUS_NOT_INITALIZED
 } switch_status_t;
 
diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h
index 4771dba40a..2c4de14334 100644
--- a/src/include/switch_utils.h
+++ b/src/include/switch_utils.h
@@ -327,7 +327,7 @@ SWITCH_DECLARE(unsigned short) get_port(struct sockaddr *sa);
  */
 SWITCH_DECLARE(int) switch_build_uri(char *uri, switch_size_t size, const char *scheme, const char *user, const switch_sockaddr_t *sa, int flags);
 
-#define SWITCH_STATUS_IS_BREAK(x) (x == SWITCH_STATUS_BREAK || x == 730035 || x == 35)
+#define SWITCH_STATUS_IS_BREAK(x) (x == SWITCH_STATUS_BREAK || x == 730035 || x == 35 || x == SWITCH_STATUS_INTR)
 
 /*!
   \brief Return a printable name of a switch_priority_t
diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c
index a9da20e9d9..2d9341a598 100644
--- a/src/mod/applications/mod_conference/mod_conference.c
+++ b/src/mod/applications/mod_conference/mod_conference.c
@@ -5046,7 +5046,7 @@ static switch_status_t conference_local_play_file(conference_obj_t *conference,
 			goto done;
 		}
 
-		if (conference->sound_prefix) {
+		if (!switch_is_file_path(path) && conference->sound_prefix) {
 			if (!(dpath = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR, path))) {
 				status = SWITCH_STATUS_MEMERR;
 				goto done;
@@ -5827,7 +5827,7 @@ SWITCH_STANDARD_APP(conference_function)
 				toplay = conference->kicked_sound; 
 			}
 
-			if (conference->sound_prefix) {
+			if (!switch_is_file_path(toplay) && conference->sound_prefix) {
 				dfile = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR, toplay);
 				switch_assert(dfile);
 				toplay = dfile;
@@ -5845,6 +5845,8 @@ SWITCH_STANDARD_APP(conference_function)
 	if (rl) {
 		switch_thread_rwlock_unlock(conference->rwlock);
 	}
+
+	switch_channel_set_variable(channel, "last_transfered_conference", NULL);
 }
 
 /* Create a thread for the conference and launch it */
diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c
index d03ff92765..e3f01cec96 100644
--- a/src/mod/applications/mod_hash/mod_hash.c
+++ b/src/mod/applications/mod_hash/mod_hash.c
@@ -263,10 +263,14 @@ SWITCH_HASH_DELETE_FUNC(limit_hash_remote_cleanup_callback)
 SWITCH_STANDARD_SCHED_FUNC(limit_hash_cleanup_callback)
 {
 	switch_thread_rwlock_wrlock(globals.limit_hash_rwlock);
-	switch_core_hash_delete_multi(globals.limit_hash, limit_hash_cleanup_delete_callback, NULL);
+	if (globals.limit_hash) {
+		switch_core_hash_delete_multi(globals.limit_hash, limit_hash_cleanup_delete_callback, NULL);
+	}
 	switch_thread_rwlock_unlock(globals.limit_hash_rwlock);
-	
-	task->runtime = switch_epoch_time_now(NULL) + LIMIT_HASH_CLEANUP_INTERVAL;
+
+	if (globals.limit_hash) {	
+		task->runtime = switch_epoch_time_now(NULL) + LIMIT_HASH_CLEANUP_INTERVAL;
+	}
 }
 
 /* !\brief Releases usage of a limit_hash-controlled ressource  */
@@ -991,7 +995,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown)
 		free(val);
 		switch_core_hash_delete(globals.db_hash, key);
 	}
-	
+
+	switch_core_hash_destroy(&globals.limit_hash);
+	switch_core_hash_destroy(&globals.db_hash);	
 
 	switch_thread_rwlock_unlock(globals.limit_hash_rwlock);
 	switch_thread_rwlock_unlock(globals.db_hash_rwlock);
@@ -999,8 +1005,6 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown)
 	switch_thread_rwlock_destroy(globals.db_hash_rwlock);
 	switch_thread_rwlock_destroy(globals.limit_hash_rwlock);
 
-	switch_core_hash_destroy(&globals.limit_hash);
-	switch_core_hash_destroy(&globals.db_hash);
 
 	return SWITCH_STATUS_SUCCESS;
 }
diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c
index a0bcdbdbd1..85b233d5f3 100644
--- a/src/mod/endpoints/mod_sofia/mod_sofia.c
+++ b/src/mod/endpoints/mod_sofia/mod_sofia.c
@@ -43,8 +43,6 @@ SWITCH_MODULE_DEFINITION(mod_sofia, mod_sofia_load, mod_sofia_shutdown, NULL);
 
 struct mod_sofia_globals mod_sofia_globals;
 switch_endpoint_interface_t *sofia_endpoint_interface;
-static switch_frame_t silence_frame = { 0 };
-static char silence_data[13] = "";
 
 #define STRLEN 15
 
@@ -1094,8 +1092,10 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
 										sofia_glue_do_invite(session);
 									}
 #endif
-
-									*frame = &silence_frame;
+									*frame = &tech_pvt->read_frame;
+									switch_set_flag((*frame), SFF_CNG);
+									(*frame)->datalen = tech_pvt->read_impl.encoded_bytes_per_packet;
+									memset((*frame)->data, 0, (*frame)->datalen);
 									return SWITCH_STATUS_SUCCESS;
 								}
 
@@ -4718,11 +4718,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
 	switch_management_interface_t *management_interface;
 	struct in_addr in;
 
-	silence_frame.data = silence_data;
-	silence_frame.datalen = sizeof(silence_data);
-	silence_frame.buflen = sizeof(silence_data);
-	silence_frame.flags = SFF_CNG;
-
 	memset(&mod_sofia_globals, 0, sizeof(mod_sofia_globals));
 	mod_sofia_globals.destroy_private.destroy_nh = 1;
 	mod_sofia_globals.destroy_private.is_static = 1;
diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c
index 904f3ecb46..1d8d6a9a21 100644
--- a/src/mod/endpoints/mod_sofia/sofia.c
+++ b/src/mod/endpoints/mod_sofia/sofia.c
@@ -1477,8 +1477,6 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
 									 TPTAG_TLS_VERIFY_POLICY(0)),
 							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS),
 									 TPTAG_TLS_VERSION(profile->tls_version)),
-							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS),
-									 TPTAG_KEEPALIVE(20000)),
 							  TAG_IF(!strchr(profile->sipip, ':'),
 									 NTATAG_UDP_MTU(65535)),
 							  TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_SRV),
@@ -7137,6 +7135,9 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
 						switch_channel_set_variable(channel, "sip_history_info", un->un_value);
 					}
 				}
+			} else if (!strcasecmp(un->un_name, "X-FS-Channel-Name") && !zstr(un->un_value)) {
+				switch_channel_set_name(channel, un->un_value);
+				switch_channel_set_variable(channel, "push_channel_name", "true");
 			} else if (!strcasecmp(un->un_name, "X-FS-Support")) {
 				tech_pvt->x_freeswitch_support_remote = switch_core_session_strdup(session, un->un_value);
 			} else if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2)) {
diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
index 0ebf6d5b53..344b0ee117 100644
--- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
+++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
@@ -1548,7 +1548,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
 			char api_reply[512] = "Allowed-API: all\n";
 			char log_reply[512] = "";
 			int allowed_log = 1;
-
+			char *tmp;
 
 			switch_clear_flag(listener, LFLAG_ALLOW_LOG);
 
@@ -1564,8 +1564,9 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
 				*pass++ = '\0';
 			}
 
-			if ((pass = strchr(user, ':'))) {
-				*pass++ = '\0';
+			if ((tmp = strchr(user, ':'))) {
+				*tmp++ = '\0';
+				pass = tmp;
 			}
 			
 			if (zstr(user) || zstr(domain_name)) {
diff --git a/src/switch_event.c b/src/switch_event.c
index 3941fabe1e..003fc82296 100644
--- a/src/switch_event.c
+++ b/src/switch_event.c
@@ -744,7 +744,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_del_header_val(switch_event_t *even
 		tp = tp->next;
 
 		x++;
-		switch_assert(x < 1000);
+		switch_assert(x < 1000000);
 		hash = switch_ci_hashfunc_default(header_name, &hlen);
 
 		if ((!hp->hash || hash == hp->hash) && !strcasecmp(header_name, hp->name) && (zstr(val) || !strcmp(hp->value, val))) {
diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c
index f31d0f5559..d17105a465 100644
--- a/src/switch_ivr_originate.c
+++ b/src/switch_ivr_originate.c
@@ -2602,6 +2602,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 					}
 				}
 
+				if (caller_channel && switch_true(switch_channel_get_variable(caller_channel, "push_channel_name"))) {
+					char *new_name = switch_core_session_sprintf(session, "%s__B", switch_channel_get_name(caller_channel));
+					switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_channel_name", new_name);
+					new_name = switch_core_session_sprintf(session, "_%s", switch_channel_get_name(caller_channel));
+					switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "sip_h_X-FS-Channel-Name", new_name);
+				}
+
 				/* make a special var event with mixture of the {} and the [] vars to pass down as global vars to the outgoing channel 
 				   so if something like the user channel does another originate our options will be passed down properly
 				 */
@@ -2690,6 +2697,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 					if (switch_true(switch_channel_get_variable(originate_status[i].peer_channel, "leg_required"))) {
 						originate_status[i].tagged = 1;
 					}
+					
+					if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "origination_channel_name"))) {
+						switch_channel_set_name(originate_status[i].peer_channel, vvar);
+					}
 
 					if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "origination_callee_id_name"))) {
 						switch_channel_set_profile_var(originate_status[i].peer_channel, "callee_id_name", vvar);
diff --git a/src/switch_rtp.c b/src/switch_rtp.c
index 038e1d981b..4e5450d7e8 100644
--- a/src/switch_rtp.c
+++ b/src/switch_rtp.c
@@ -2440,6 +2440,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
 	recvfrom:
 		bytes = 0;
 		read_loops++;
+		poll_loop = 0;
 
 		if (!switch_rtp_ready(rtp_session)) {
 			break;
@@ -2466,27 +2467,41 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
 			status = read_rtp_packet(rtp_session, &bytes, flags);
 		} else {
 			if (!SWITCH_STATUS_IS_BREAK(poll_status) && poll_status != SWITCH_STATUS_TIMEOUT) {
+				char tmp[128] = "";
+				strerror_r(poll_status, tmp, sizeof(tmp));
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Poll failed with error: %d [%s]\n", poll_status, tmp);
 				ret = -1;
 				goto end;
 			}
 
 			poll_loop = 1;
-			rtp_session->missed_count += (poll_sec * 1000) / (rtp_session->ms_per_packet ? rtp_session->ms_per_packet / 1000 : 20);
-			bytes = 0;
 
-			if (rtp_session->max_missed_packets) {
-				if (rtp_session->missed_count >= rtp_session->max_missed_packets) {
-					ret = -2;
-					goto end;
+			if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) {
+				rtp_session->missed_count += (poll_sec * 1000) / (rtp_session->ms_per_packet ? rtp_session->ms_per_packet / 1000 : 20);
+				bytes = 0;
+
+				if (rtp_session->max_missed_packets) {
+					if (rtp_session->missed_count >= rtp_session->max_missed_packets) {
+						ret = -2;
+						goto end;
+					}
 				}
 			}
-			
+
 			if ((!(io_flags & SWITCH_IO_FLAG_NOBLOCK)) && 
 				(rtp_session->dtmf_data.out_digit_dur == 0 || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO))) {
 				return_cng_frame();
 			}
 		}
-		
+
+		if (rtp_session->recv_msg.header.pt != 13 && 
+			rtp_session->recv_msg.header.pt != rtp_session->recv_te && 
+			(!rtp_session->cng_pt || rtp_session->recv_msg.header.pt != rtp_session->cng_pt) && 
+			rtp_session->recv_msg.header.pt != rtp_session->payload) {
+			/* drop frames of incorrect payload number and return CNG frame instead */
+			return_cng_frame();
+		}
+
 		if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP) && rtp_session->rtcp_read_pollfd) {
 			rtcp_poll_status = switch_poll(rtp_session->rtcp_read_pollfd, 1, &rtcp_fdr, 0);
 						
@@ -3254,21 +3269,25 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp
 						switch_rtp_t *other_rtp_session = switch_channel_get_private(other_channel, "__zrtp_audio_rtp_session");
 
 						if (other_rtp_session) {
-							if (zrtp_status_ok == zrtp_session_get(other_rtp_session->zrtp_session, &zrtp_session_info)) {
-								if (rtp_session->zrtp_mitm_tries > ZRTP_MITM_TRIES) {
-									switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
-									switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
-									switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
-									switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
-								} else if (zrtp_status_ok == zrtp_resolve_mitm_call(other_rtp_session->zrtp_stream, rtp_session->zrtp_stream)) {
-									switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
-									switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
-									switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
-									switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
-									zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid,
-													  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified ^ 1);
-									rtp_session->zrtp_mitm_tries++;
+							if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) {
+								switch_mutex_lock(other_rtp_session->read_mutex);
+								if (zrtp_status_ok == zrtp_session_get(other_rtp_session->zrtp_session, &zrtp_session_info)) {
+									if (rtp_session->zrtp_mitm_tries > ZRTP_MITM_TRIES) {
+										switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+										switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+										switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+										switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+									} else if (zrtp_status_ok == zrtp_resolve_mitm_call(other_rtp_session->zrtp_stream, rtp_session->zrtp_stream)) {
+										switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+										switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+										switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+										switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+										zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid,
+														  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified ^ 1);
+										rtp_session->zrtp_mitm_tries++;
+									}
 								}
+								switch_mutex_unlock(other_rtp_session->read_mutex);
 							}
 						}
 
diff --git a/src/switch_utils.c b/src/switch_utils.c
index 3622442710..0c492525b1 100644
--- a/src/switch_utils.c
+++ b/src/switch_utils.c
@@ -372,7 +372,7 @@ SWITCH_DECLARE(char *) switch_find_end_paren(const char *s, char open, char clos
 	if (s && *s == open) {
 		depth++;
 		for (e = s + 1; e && *e; e++) {
-			if (*e == open) {
+			if (*e == open && open != close) {
 				depth++;
 			} else if (*e == close) {
 				depth--;
@@ -809,23 +809,29 @@ SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str)
 {
 	const char *sp = str;
 	char *p, *s = NULL;
+	size_t len;
 
-	if (!sp)
-		return NULL;
+	if (zstr(sp)) {
+		return (char *) sp;
+	}
 
 	while ((*sp == 13 ) || (*sp == 10 ) || (*sp == 9 ) || (*sp == 32) || (*sp == 11) ) {
 		sp++;
 	}
+	
+	if (zstr(sp)) {
+		return (char *) sp;
+	}
 
 	s = strdup(sp);
+	switch_assert(s);
 
-	if (!s)
-		return NULL;
+	if ((len = strlen(s)) > 0) {
+		p = s + (len - 1);
 
-	p = s + (strlen(s) - 1);
-
-    while ((*p == 13 ) || (*p == 10 ) || (*p == 9 ) || (*p == 32) || (*p == 11) ) {
-		*p-- = '\0';
+		while (p > s && ((*p == 13 ) || (*p == 10 ) || (*p == 9 ) || (*p == 32) || (*p == 11))) {
+			*p-- = '\0';
+		}
 	}
 
 	return s;
@@ -835,9 +841,11 @@ SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup)
 {
 	char *sp = str;
 	char *p, *s = NULL;
+	size_t len;
 
-	if (!sp)
-		return NULL;
+	if (zstr(sp)) {
+		return sp;
+	}
 
 	while (*sp == ' ') {
 		sp++;
@@ -845,17 +853,21 @@ SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup)
 
 	if (dup) {
 		s = strdup(sp);
+		switch_assert(s);
 	} else {
 		s = sp;
 	}
 
-	if (!s)
-		return NULL;
+	if (zstr(s)) {
+		return s;
+	}
 
-	p = s + (strlen(s) - 1);
+	if ((len = strlen(s)) > 0) {
+		p = s + (len - 1);
 
-	while (*p == ' ') {
-		*p-- = '\0';
+		while (p && *p && p > s && *p == ' ') {
+			*p-- = '\0';
+		}
 	}
 
 	return s;