Added test project. Remoed post build because it references VS2005? Need to fix that later.
This commit is contained in:
		
							parent
							
								
									f6d419aa39
								
							
						
					
					
						commit
						236f6af81e
					
				
					 9 changed files with 868 additions and 1 deletions
				
			
		| 
						 | 
					@ -10,9 +10,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Asterisk.NET", "Asterisk.NE
 | 
				
			||||||
EndProject
 | 
					EndProject
 | 
				
			||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Asterisk.NET.WinForm", "Asterisk.NET.WinForm\Asterisk.NET.WinForm.csproj", "{03687626-613A-4E41-8F60-7C7839D6DD5D}"
 | 
					Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Asterisk.NET.WinForm", "Asterisk.NET.WinForm\Asterisk.NET.WinForm.csproj", "{03687626-613A-4E41-8F60-7C7839D6DD5D}"
 | 
				
			||||||
EndProject
 | 
					EndProject
 | 
				
			||||||
 | 
					Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Asterisk.NET.Test", "..\..\dfd\Asterisk.NET.1.6.3.1\Asterisk.NET.Test\Asterisk.NET.Test.csproj", "{B82B8EBF-8180-401D-8D3A-4BF7CFDB7A08}"
 | 
				
			||||||
 | 
					EndProject
 | 
				
			||||||
Global
 | 
					Global
 | 
				
			||||||
	GlobalSection(TeamFoundationVersionControl) = preSolution
 | 
						GlobalSection(TeamFoundationVersionControl) = preSolution
 | 
				
			||||||
		SccNumberOfProjects = 3
 | 
							SccNumberOfProjects = 4
 | 
				
			||||||
		SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
 | 
							SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
 | 
				
			||||||
		SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs33
 | 
							SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs33
 | 
				
			||||||
		SccLocalPath0 = .
 | 
							SccLocalPath0 = .
 | 
				
			||||||
| 
						 | 
					@ -22,6 +24,9 @@ Global
 | 
				
			||||||
		SccProjectUniqueName2 = Asterisk.NET\\Asterisk.NET.csproj
 | 
							SccProjectUniqueName2 = Asterisk.NET\\Asterisk.NET.csproj
 | 
				
			||||||
		SccProjectName2 = Asterisk.NET
 | 
							SccProjectName2 = Asterisk.NET
 | 
				
			||||||
		SccLocalPath2 = Asterisk.NET
 | 
							SccLocalPath2 = Asterisk.NET
 | 
				
			||||||
 | 
							SccProjectUniqueName3 = ..\\..\\dfd\\Asterisk.NET.1.6.3.1\\Asterisk.NET.Test\\Asterisk.NET.Test.csproj
 | 
				
			||||||
 | 
							SccProjectName3 = Asterisk.NET.Test/Asterisk.NET.Test
 | 
				
			||||||
 | 
							SccLocalPath3 = ..\\..\\dfd\\Asterisk.NET.1.6.3.1\\Asterisk.NET.Test
 | 
				
			||||||
	EndGlobalSection
 | 
						EndGlobalSection
 | 
				
			||||||
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 | 
						GlobalSection(SolutionConfigurationPlatforms) = preSolution
 | 
				
			||||||
		Debug|Any CPU = Debug|Any CPU
 | 
							Debug|Any CPU = Debug|Any CPU
 | 
				
			||||||
| 
						 | 
					@ -36,6 +41,10 @@ Global
 | 
				
			||||||
		{03687626-613A-4E41-8F60-7C7839D6DD5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
							{03687626-613A-4E41-8F60-7C7839D6DD5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
				
			||||||
		{03687626-613A-4E41-8F60-7C7839D6DD5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
							{03687626-613A-4E41-8F60-7C7839D6DD5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
				
			||||||
		{03687626-613A-4E41-8F60-7C7839D6DD5D}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
							{03687626-613A-4E41-8F60-7C7839D6DD5D}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
				
			||||||
 | 
							{B82B8EBF-8180-401D-8D3A-4BF7CFDB7A08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 | 
				
			||||||
 | 
							{B82B8EBF-8180-401D-8D3A-4BF7CFDB7A08}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
				
			||||||
 | 
							{B82B8EBF-8180-401D-8D3A-4BF7CFDB7A08}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
				
			||||||
 | 
							{B82B8EBF-8180-401D-8D3A-4BF7CFDB7A08}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
				
			||||||
	EndGlobalSection
 | 
						EndGlobalSection
 | 
				
			||||||
	GlobalSection(SolutionProperties) = preSolution
 | 
						GlobalSection(SolutionProperties) = preSolution
 | 
				
			||||||
		HideSolutionNode = FALSE
 | 
							HideSolutionNode = FALSE
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,113 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
 | 
				
			||||||
 | 
					  <PropertyGroup>
 | 
				
			||||||
 | 
					    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
 | 
				
			||||||
 | 
					    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
 | 
				
			||||||
 | 
					    <ProductVersion>8.0.50727</ProductVersion>
 | 
				
			||||||
 | 
					    <SchemaVersion>2.0</SchemaVersion>
 | 
				
			||||||
 | 
					    <ProjectGuid>{B82B8EBF-8180-401D-8D3A-4BF7CFDB7A08}</ProjectGuid>
 | 
				
			||||||
 | 
					    <OutputType>Exe</OutputType>
 | 
				
			||||||
 | 
					    <AppDesignerFolder>Properties</AppDesignerFolder>
 | 
				
			||||||
 | 
					    <RootNamespace>Asterisk.NET.Test</RootNamespace>
 | 
				
			||||||
 | 
					    <AssemblyName>Asterisk.NET.Test</AssemblyName>
 | 
				
			||||||
 | 
					    <IsWebBootstrapper>false</IsWebBootstrapper>
 | 
				
			||||||
 | 
					    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
 | 
				
			||||||
 | 
					    <FileUpgradeFlags>
 | 
				
			||||||
 | 
					    </FileUpgradeFlags>
 | 
				
			||||||
 | 
					    <UpgradeBackupLocation>
 | 
				
			||||||
 | 
					    </UpgradeBackupLocation>
 | 
				
			||||||
 | 
					    <OldToolsVersion>2.0</OldToolsVersion>
 | 
				
			||||||
 | 
					    <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.10</ApplicationVersion>
 | 
				
			||||||
 | 
					    <UseApplicationTrust>false</UseApplicationTrust>
 | 
				
			||||||
 | 
					    <BootstrapperEnabled>true</BootstrapperEnabled>
 | 
				
			||||||
 | 
					    <TargetFrameworkProfile />
 | 
				
			||||||
 | 
					    <SccProjectName>SAK</SccProjectName>
 | 
				
			||||||
 | 
					    <SccLocalPath>SAK</SccLocalPath>
 | 
				
			||||||
 | 
					    <SccAuxPath>SAK</SccAuxPath>
 | 
				
			||||||
 | 
					    <SccProvider>SAK</SccProvider>
 | 
				
			||||||
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
 | 
				
			||||||
 | 
					    <DebugSymbols>true</DebugSymbols>
 | 
				
			||||||
 | 
					    <DebugType>full</DebugType>
 | 
				
			||||||
 | 
					    <Optimize>false</Optimize>
 | 
				
			||||||
 | 
					    <OutputPath>bin\Debug\</OutputPath>
 | 
				
			||||||
 | 
					    <DefineConstants>TRACE;DEBUG;TIMEOUT</DefineConstants>
 | 
				
			||||||
 | 
					    <ErrorReport>prompt</ErrorReport>
 | 
				
			||||||
 | 
					    <WarningLevel>4</WarningLevel>
 | 
				
			||||||
 | 
					    <Prefer32Bit>false</Prefer32Bit>
 | 
				
			||||||
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
 | 
				
			||||||
 | 
					    <DebugType>pdbonly</DebugType>
 | 
				
			||||||
 | 
					    <Optimize>true</Optimize>
 | 
				
			||||||
 | 
					    <OutputPath>bin\Release\</OutputPath>
 | 
				
			||||||
 | 
					    <DefineConstants>TRACE</DefineConstants>
 | 
				
			||||||
 | 
					    <ErrorReport>prompt</ErrorReport>
 | 
				
			||||||
 | 
					    <WarningLevel>4</WarningLevel>
 | 
				
			||||||
 | 
					    <Prefer32Bit>false</Prefer32Bit>
 | 
				
			||||||
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					  <ItemGroup>
 | 
				
			||||||
 | 
					    <Reference Include="System" />
 | 
				
			||||||
 | 
					    <Reference Include="System.Data" />
 | 
				
			||||||
 | 
					    <Reference Include="System.Xml" />
 | 
				
			||||||
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					  <ItemGroup>
 | 
				
			||||||
 | 
					    <Compile Include="CustomIVR.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Program.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Properties\AssemblyInfo.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.2.0">
 | 
				
			||||||
 | 
					      <Visible>False</Visible>
 | 
				
			||||||
 | 
					      <ProductName>.NET Framework 2.0</ProductName>
 | 
				
			||||||
 | 
					      <Install>true</Install>
 | 
				
			||||||
 | 
					    </BootstrapperPackage>
 | 
				
			||||||
 | 
					    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
 | 
				
			||||||
 | 
					      <Visible>False</Visible>
 | 
				
			||||||
 | 
					      <ProductName>.NET Framework 3.5 SP1</ProductName>
 | 
				
			||||||
 | 
					      <Install>false</Install>
 | 
				
			||||||
 | 
					    </BootstrapperPackage>
 | 
				
			||||||
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					  <ItemGroup>
 | 
				
			||||||
 | 
					    <EmbeddedResource Include="fastagi-mapping.resx">
 | 
				
			||||||
 | 
					      <LastGenOutput>fastagi-mapping.Designer.cs</LastGenOutput>
 | 
				
			||||||
 | 
					      <SubType>Designer</SubType>
 | 
				
			||||||
 | 
					    </EmbeddedResource>
 | 
				
			||||||
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					  <ItemGroup>
 | 
				
			||||||
 | 
					    <ProjectReference Include="..\..\..\Asterisk.NET.1.6.3.1\Asterisk.NET.1.6.3.1\Asterisk.NET\Asterisk.NET.csproj">
 | 
				
			||||||
 | 
					      <Project>{bc6e7dba-c05a-45fe-a2a3-b1637ce16274}</Project>
 | 
				
			||||||
 | 
					      <Name>Asterisk.NET</Name>
 | 
				
			||||||
 | 
					    </ProjectReference>
 | 
				
			||||||
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					  <ItemGroup>
 | 
				
			||||||
 | 
					    <None Include="app.config" />
 | 
				
			||||||
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					  <Import Project="$(MSBuildBinPath)\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>
 | 
				
			||||||
 | 
					  -->
 | 
				
			||||||
 | 
					  <PropertyGroup>
 | 
				
			||||||
 | 
					    <PostBuildEvent>
 | 
				
			||||||
 | 
					    </PostBuildEvent>
 | 
				
			||||||
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					</Project>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,10 @@
 | 
				
			||||||
 | 
					""
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					"FILE_VERSION" = "9237"
 | 
				
			||||||
 | 
					"ENLISTMENT_CHOICE" = "NEVER"
 | 
				
			||||||
 | 
					"PROJECT_FILE_RELATIVE_PATH" = ""
 | 
				
			||||||
 | 
					"NUMBER_OF_EXCLUDED_FILES" = "0"
 | 
				
			||||||
 | 
					"ORIGINAL_PROJECT_FILE_PATH" = ""
 | 
				
			||||||
 | 
					"NUMBER_OF_NESTED_PROJECTS" = "0"
 | 
				
			||||||
 | 
					"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										118
									
								
								Asterisk.2013/Asterisk.NET.Test/Asterisk.NET.Test/CustomIVR.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										118
									
								
								Asterisk.2013/Asterisk.NET.Test/Asterisk.NET.Test/CustomIVR.cs
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,118 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using Asterisk.NET.FastAGI;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Asterisk.NET.Test
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						public class CustomIVR : AGIScript
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							private string escapeKeys = "0123456789*#";
 | 
				
			||||||
 | 
							/*
 | 
				
			||||||
 | 
							 * Call -> play "wellcome" -> wait digit 5 seconds -> press 1 -> play "press-1" -> wait digit -> press * ----------------------------\
 | 
				
			||||||
 | 
							 *               ^                    ^                                                 ^     -> press 4 -> play "press-4" -------\  |
 | 
				
			||||||
 | 
							 *               |                    |                                                 |     -> press any -> play "bad" "digit" -+  |
 | 
				
			||||||
 | 
							 *               |                    |                                                 \-----------------------------------------/  |
 | 
				
			||||||
 | 
							 *               |                    |                                                       -> press # or timeout -\               |
 | 
				
			||||||
 | 
							 *               |                    |                                                                              |               |
 | 
				
			||||||
 | 
							 *               |                    |            -> press # or timeout -> play "goodbye" -> Hangup                 |               |
 | 
				
			||||||
 | 
							 *               |                    |                                          ^                                   |               |
 | 
				
			||||||
 | 
							 *               |                    |                                          \-----------------------------------+               |
 | 
				
			||||||
 | 
							 *               |                    |                                                                              |               |
 | 
				
			||||||
 | 
							 *               |                    |                                                                              |               |
 | 
				
			||||||
 | 
							 *               |                    |           -> press 2 -> play "press-1" -> wait digit  -> press # or timeout -/               |
 | 
				
			||||||
 | 
							 *               |                    |                                                 ^     -> press * ----------------------------+
 | 
				
			||||||
 | 
							 *               |                    |                                                 |     -> press 4 -> play "press-4" -------\  |
 | 
				
			||||||
 | 
							 *               |                    |                                                 |     -> press any -> play "bad" "digit" -+  |
 | 
				
			||||||
 | 
							 *               |                    |                                                 \-----------------------------------------/  |
 | 
				
			||||||
 | 
							 *               |                    |                                                                                              |
 | 
				
			||||||
 | 
							 *               |                    |            -> press other -> play "bad" "digit" -\                                           |
 | 
				
			||||||
 | 
							 *               |                    \--------------------------------------------------/                                           |
 | 
				
			||||||
 | 
							 *               \-------------------------------------------------------------------------------------------------------------------/
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public override void Service(AGIRequest request, AGIChannel channel)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Answer();
 | 
				
			||||||
 | 
								int submenu = 0;
 | 
				
			||||||
 | 
								char key = '\0';
 | 
				
			||||||
 | 
								bool welcome = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								while (true)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									if (welcome)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										key = StreamFile("welcome", escapeKeys);
 | 
				
			||||||
 | 
										welcome = false;
 | 
				
			||||||
 | 
										submenu = 0;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									if (key == '\0')
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										key = WaitForDigit(5000);
 | 
				
			||||||
 | 
										if (key == '\0' || key == '#')
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											StreamFile("goodbye");
 | 
				
			||||||
 | 
											break;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									char newKey = '\0';
 | 
				
			||||||
 | 
									switch (submenu)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										case 0:
 | 
				
			||||||
 | 
											switch (key)
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												case '1':
 | 
				
			||||||
 | 
													newKey = StreamFile("press-1", escapeKeys);
 | 
				
			||||||
 | 
													submenu = 1;
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
												case '2':
 | 
				
			||||||
 | 
													newKey = StreamFile("press-2", escapeKeys);
 | 
				
			||||||
 | 
													submenu = 2;
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
												case '3':
 | 
				
			||||||
 | 
													newKey = StreamFile("press-3", escapeKeys);
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
												default:
 | 
				
			||||||
 | 
													newKey = StreamFile("bad", escapeKeys);
 | 
				
			||||||
 | 
													if(newKey == '\0')
 | 
				
			||||||
 | 
														newKey = StreamFile("digit", escapeKeys);
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											break;
 | 
				
			||||||
 | 
										case 1:
 | 
				
			||||||
 | 
											switch (key)
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												case '*':
 | 
				
			||||||
 | 
													welcome = true;
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
												case '4':
 | 
				
			||||||
 | 
													newKey = StreamFile("press-4", escapeKeys);
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
												default:
 | 
				
			||||||
 | 
													newKey = StreamFile("bad", escapeKeys);
 | 
				
			||||||
 | 
													if (newKey == '\0')
 | 
				
			||||||
 | 
														newKey = StreamFile("digit", escapeKeys);
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											break;
 | 
				
			||||||
 | 
										case 2:
 | 
				
			||||||
 | 
											switch (key)
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												case '*':
 | 
				
			||||||
 | 
													welcome = true;
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
												case '5':
 | 
				
			||||||
 | 
													newKey = StreamFile("press-5", escapeKeys);
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
												default:
 | 
				
			||||||
 | 
													newKey = StreamFile("bad", escapeKeys);
 | 
				
			||||||
 | 
													if (newKey == '\0')
 | 
				
			||||||
 | 
														newKey = StreamFile("digit", escapeKeys);
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											break;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									key = newKey;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								Hangup();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										466
									
								
								Asterisk.2013/Asterisk.NET.Test/Asterisk.NET.Test/Program.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										466
									
								
								Asterisk.2013/Asterisk.NET.Test/Asterisk.NET.Test/Program.cs
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,466 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					using Asterisk.NET.Manager;
 | 
				
			||||||
 | 
					using Asterisk.NET.Manager.Action;
 | 
				
			||||||
 | 
					using Asterisk.NET.Manager.Response;
 | 
				
			||||||
 | 
					using Asterisk.NET.FastAGI;
 | 
				
			||||||
 | 
					using Asterisk.NET.Manager.Event;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Asterisk.NET.Test
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						class Program
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							const string DEV_HOST = "192.168.2.34";
 | 
				
			||||||
 | 
							const int ASTERISK_PORT = 5038;
 | 
				
			||||||
 | 
							const string ASTERISK_HOST = "192.168.2.39";
 | 
				
			||||||
 | 
							const string ASTERISK_LOGINNAME = "admin";
 | 
				
			||||||
 | 
							const string ASTERISK_LOGINPWD = "amp111";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							const string ORIGINATE_CONTEXT = "from-internal";
 | 
				
			||||||
 | 
							const string ORIGINATE_CHANNEL = "IAX2/100";
 | 
				
			||||||
 | 
							const string ORIGINATE_EXTRA_CHANNEL = "SIP/101";
 | 
				
			||||||
 | 
							const string ORIGINATE_EXTRA_EXTEN = "101";
 | 
				
			||||||
 | 
							const string ORIGINATE_EXTEN = "101";
 | 
				
			||||||
 | 
							const string ORIGINATE_CALLERID = "Asterisk.NET";
 | 
				
			||||||
 | 
							const int ORIGINATE_TIMEOUT = 15000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							[STAThread]
 | 
				
			||||||
 | 
							static void Main()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								checkManagerAPI();
 | 
				
			||||||
 | 
								checkFastAGI();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							#region checkFastAGI()
 | 
				
			||||||
 | 
							private static void checkFastAGI()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Console.WriteLine(@"
 | 
				
			||||||
 | 
					Add next lines to your extension.conf file
 | 
				
			||||||
 | 
						exten => 200,1,agi(agi://" + DEV_HOST + @"/customivr)
 | 
				
			||||||
 | 
						exten => 200,2,Hangup()
 | 
				
			||||||
 | 
					reload Asterisk and dial 200 from phone.
 | 
				
			||||||
 | 
					Also enter 'agi debug' from Asterisk console to more information.
 | 
				
			||||||
 | 
					See CustomIVR.cs and fastagi-mapping.resx to detail.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Ctrl-C to exit");
 | 
				
			||||||
 | 
								AsteriskFastAGI agi = new AsteriskFastAGI();
 | 
				
			||||||
 | 
								agi.Start();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							private static ManagerConnection manager;
 | 
				
			||||||
 | 
							private static string monitorChannel = null;
 | 
				
			||||||
 | 
							private static string transferChannel = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							#region displayQueue()
 | 
				
			||||||
 | 
							private static void displayQueue()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								manager = new ManagerConnection(ASTERISK_HOST, ASTERISK_PORT, ASTERISK_LOGINNAME, ASTERISK_LOGINPWD);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								try
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
					#if NOTIMEOUT
 | 
				
			||||||
 | 
									manager.Connection.DefaultTimeout = 0;
 | 
				
			||||||
 | 
									manager.Connection.DefaultEventTimeout = 0;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
									manager.Login();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								catch (Exception ex)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									Console.WriteLine(ex.Message);
 | 
				
			||||||
 | 
									Console.WriteLine("Press ENTER to next test or CTRL-C to exit.");
 | 
				
			||||||
 | 
									Console.ReadLine();
 | 
				
			||||||
 | 
									return;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								ResponseEvents re;
 | 
				
			||||||
 | 
								try
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									re = manager.SendEventGeneratingAction(new QueueStatusAction());
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								catch (EventTimeoutException e)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									// this happens with Asterisk 1.0.x as it doesn't send a QueueStatusCompleteEvent
 | 
				
			||||||
 | 
									re = e.PartialResult;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								foreach (ManagerEvent e in re.Events)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									if (e is QueueParamsEvent)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										QueueParamsEvent qe = (QueueParamsEvent)e;
 | 
				
			||||||
 | 
										Console.WriteLine("QueueParamsEvent" + "\n\tQueue:\t\t" + qe.Queue + "\n\tServiceLevel:\t" + qe.ServiceLevel);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									else if (e is QueueMemberEvent)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										QueueMemberEvent qme = (QueueMemberEvent)e;
 | 
				
			||||||
 | 
										Console.WriteLine("QueueMemberEvent" + "\n\tQueue:\t\t" + qme.Queue + "\n\tLocation:\t" + qme.Location);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									else if (e is QueueEntryEvent)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										QueueEntryEvent qee = (QueueEntryEvent)e;
 | 
				
			||||||
 | 
										Console.WriteLine("QueueEntryEvent" + "\n\tQueue:\t\t" + qee.Queue + "\n\tChannel:\t" + qee.Channel + "\n\tPosition:\t" + qee.Position);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								Console.WriteLine("Press ENTER to next test or CTRL-C to exit.");
 | 
				
			||||||
 | 
								Console.ReadLine();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							#region checkManagerAPI()
 | 
				
			||||||
 | 
							private static void checkManagerAPI()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								manager = new ManagerConnection(ASTERISK_HOST, ASTERISK_PORT, ASTERISK_LOGINNAME, ASTERISK_LOGINPWD);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Register user event class
 | 
				
			||||||
 | 
								manager.RegisterUserEventClass(typeof(UserAgentLoginEvent));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Add or Remove events
 | 
				
			||||||
 | 
								manager.UserEvents += new UserEventHandler(dam_UserEvents);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Dont't display this event
 | 
				
			||||||
 | 
								manager.NewExten += new NewExtenEventHandler(manager_IgnoreEvent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Display all other
 | 
				
			||||||
 | 
								manager.UnhandledEvent += new ManagerEventHandler(dam_Events);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// +++ Only to debug purpose
 | 
				
			||||||
 | 
								manager.FireAllEvents = true;
 | 
				
			||||||
 | 
								// manager.DefaultEventTimeout = 0;
 | 
				
			||||||
 | 
								// manager.DefaultResponseTimeout = 0;
 | 
				
			||||||
 | 
								manager.PingInterval = 0;
 | 
				
			||||||
 | 
								// +++
 | 
				
			||||||
 | 
								try
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									manager.Login();			// Login only (fast)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									Console.WriteLine("Asterisk version : " + manager.Version);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								catch (Exception ex)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									Console.WriteLine(ex);
 | 
				
			||||||
 | 
									Console.ReadLine();
 | 
				
			||||||
 | 
									manager.Logoff();
 | 
				
			||||||
 | 
									return;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									Console.WriteLine("\nGetConfig action");
 | 
				
			||||||
 | 
									ManagerResponse response = manager.SendAction(new GetConfigAction("manager.conf"));
 | 
				
			||||||
 | 
									if (response.IsSuccess())
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										GetConfigResponse responseConfig = (GetConfigResponse)response;
 | 
				
			||||||
 | 
										foreach (int key in responseConfig.Categories.Keys)
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											Console.WriteLine(string.Format("{0}:{1}", key, responseConfig.Categories[key]));
 | 
				
			||||||
 | 
											foreach (int keyLine in responseConfig.Lines(key).Keys)
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												Console.WriteLine(string.Format("\t{0}:{1}", keyLine, responseConfig.Lines(key)[keyLine]));
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
										Console.WriteLine(response);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									Console.WriteLine("\nUpdateConfig action");
 | 
				
			||||||
 | 
									UpdateConfigAction config = new UpdateConfigAction("manager.conf", "manager.conf");
 | 
				
			||||||
 | 
									config.AddCommand(UpdateConfigAction.ACTION_NEWCAT, "testadmin");
 | 
				
			||||||
 | 
									config.AddCommand(UpdateConfigAction.ACTION_APPEND, "testadmin", "secret", "blabla");
 | 
				
			||||||
 | 
									ManagerResponse response = manager.SendAction(config);
 | 
				
			||||||
 | 
									Console.WriteLine(response);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Originate call example
 | 
				
			||||||
 | 
								Console.WriteLine("\nPress ENTER key to originate call.\n"
 | 
				
			||||||
 | 
									+ "Start phone (or connect) or make a call to see events.\n"
 | 
				
			||||||
 | 
									+ "After all events press a key to originate call.");
 | 
				
			||||||
 | 
								Console.ReadLine();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								OriginateAction oc = new OriginateAction();
 | 
				
			||||||
 | 
								oc.Context = ORIGINATE_CONTEXT;
 | 
				
			||||||
 | 
								oc.Priority = 1;
 | 
				
			||||||
 | 
								oc.Channel = ORIGINATE_CHANNEL;
 | 
				
			||||||
 | 
								oc.CallerId = ORIGINATE_CALLERID;
 | 
				
			||||||
 | 
								oc.Exten = ORIGINATE_EXTEN;
 | 
				
			||||||
 | 
								oc.Timeout = ORIGINATE_TIMEOUT;
 | 
				
			||||||
 | 
								// oc.Variable = "VAR1=abc|VAR2=def";
 | 
				
			||||||
 | 
								// oc.SetVariable("VAR3", "ghi");
 | 
				
			||||||
 | 
								ManagerResponse originateResponse = manager.SendAction(oc, oc.Timeout);
 | 
				
			||||||
 | 
								Console.WriteLine("Response:");
 | 
				
			||||||
 | 
								Console.WriteLine(originateResponse);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								Console.WriteLine("Press ENTER key to next test.");
 | 
				
			||||||
 | 
								Console.ReadLine();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								//
 | 
				
			||||||
 | 
								// Display result of Show Queues command
 | 
				
			||||||
 | 
								//
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									CommandAction command = new CommandAction();
 | 
				
			||||||
 | 
									CommandResponse response = new CommandResponse();
 | 
				
			||||||
 | 
									if (manager.AsteriskVersion == AsteriskVersion.ASTERISK_1_6)
 | 
				
			||||||
 | 
										command.Command = "queue show";
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
										command.Command = "show queues";
 | 
				
			||||||
 | 
									try
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										response = (CommandResponse)manager.SendAction(command);
 | 
				
			||||||
 | 
										Console.WriteLine("Result of " + command.Command);
 | 
				
			||||||
 | 
										foreach (string str in response.Result)
 | 
				
			||||||
 | 
											Console.WriteLine("\t" + str);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									catch (Exception err)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										Console.WriteLine("Response error: " + err);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									Console.WriteLine("Press ENTER to next test or CTRL-C to exit.");
 | 
				
			||||||
 | 
									Console.ReadLine();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								//
 | 
				
			||||||
 | 
								// Display Queues and Members
 | 
				
			||||||
 | 
								//
 | 
				
			||||||
 | 
								ResponseEvents re;
 | 
				
			||||||
 | 
								try
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									re = manager.SendEventGeneratingAction(new QueueStatusAction());
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								catch (EventTimeoutException e)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									// this happens with Asterisk 1.0.x as it doesn't send a QueueStatusCompleteEvent
 | 
				
			||||||
 | 
									re = e.PartialResult;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								foreach (ManagerEvent e in re.Events)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									if (e is QueueParamsEvent)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										QueueParamsEvent qe = (QueueParamsEvent)e;
 | 
				
			||||||
 | 
										Console.WriteLine("QueueParamsEvent" + "\n\tQueue:\t\t" + qe.Queue + "\n\tServiceLevel:\t" + qe.ServiceLevel);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									else if (e is QueueMemberEvent)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										QueueMemberEvent qme = (QueueMemberEvent)e;
 | 
				
			||||||
 | 
										Console.WriteLine("QueueMemberEvent" + "\n\tQueue:\t\t" + qme.Queue + "\n\tLocation:\t" + qme.Location);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									else if (e is QueueEntryEvent)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										QueueEntryEvent qee = (QueueEntryEvent)e;
 | 
				
			||||||
 | 
										Console.WriteLine("QueueEntryEvent" + "\n\tQueue:\t\t" + qee.Queue + "\n\tChannel:\t" + qee.Channel + "\n\tPosition:\t" + qee.Position);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								Console.WriteLine("Press ENTER to next test or CTRL-C to exit.");
 | 
				
			||||||
 | 
								Console.ReadLine();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								//
 | 
				
			||||||
 | 
								//	To test create 3 extensions:
 | 
				
			||||||
 | 
								//	1 - SIP/4012 w/o voicemail (with eyeBeam softphone)
 | 
				
			||||||
 | 
								//	2 - IAX2/4008 w/o voicemail (with iaxComm softphone)
 | 
				
			||||||
 | 
								//	3 - SIP/4010 w/ voicemal but no phone connect
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								//	RedirectCall: call from IAX2/4008 to SIP/4012
 | 
				
			||||||
 | 
								//	Don't answer on SIP/4012 and call must redirect to SIP/4010 (to voicemail really)
 | 
				
			||||||
 | 
								//	Dial event used to define redirect channel
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								Console.WriteLine("Redirect Call from " + ORIGINATE_CHANNEL + " to " + ORIGINATE_EXTRA_CHANNEL + " or press ESC.");
 | 
				
			||||||
 | 
								// Wait for Dial Event from ORIGINATE_CHANNEL
 | 
				
			||||||
 | 
								DialEventHandler de = new DialEventHandler(dam_Dial);
 | 
				
			||||||
 | 
								manager.Dial += de;
 | 
				
			||||||
 | 
								while (transferChannel == null)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									System.Threading.Thread.Sleep(100);
 | 
				
			||||||
 | 
									if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								manager.Dial -= de;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Now send Redirect action
 | 
				
			||||||
 | 
								RedirectAction ra = new RedirectAction();
 | 
				
			||||||
 | 
								ra.Channel = transferChannel;
 | 
				
			||||||
 | 
								ra.ExtraChannel = ORIGINATE_EXTRA_CHANNEL;
 | 
				
			||||||
 | 
								ra.Context = ORIGINATE_CONTEXT;
 | 
				
			||||||
 | 
								ra.Exten = ORIGINATE_EXTRA_EXTEN;
 | 
				
			||||||
 | 
								ra.Priority = 1;
 | 
				
			||||||
 | 
								try
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									ManagerResponse mr = manager.SendAction(ra, 10000);
 | 
				
			||||||
 | 
									Console.WriteLine("Transfer Call"
 | 
				
			||||||
 | 
										+ "\n\tResponse:" + mr.Response
 | 
				
			||||||
 | 
										+ "\n\tMessage:" + mr.Message
 | 
				
			||||||
 | 
										);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								catch (Exception ex)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									Console.WriteLine(ex.Message);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								//	Monitor call.
 | 
				
			||||||
 | 
								//	Call from IA2/4008 to SIP/4012
 | 
				
			||||||
 | 
								//	Link event used to define monitor channel
 | 
				
			||||||
 | 
								Console.WriteLine("Monitor call. Please call " + ORIGINATE_CHANNEL + " and answer or press ESC.");
 | 
				
			||||||
 | 
								// Wait for Link event
 | 
				
			||||||
 | 
								LinkEventHandler le = new LinkEventHandler(dam_Link);
 | 
				
			||||||
 | 
								manager.Link += le;
 | 
				
			||||||
 | 
								while (monitorChannel == null)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									System.Threading.Thread.Sleep(100);
 | 
				
			||||||
 | 
									if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								manager.Link -= le;
 | 
				
			||||||
 | 
								// Now send Monitor action
 | 
				
			||||||
 | 
								MonitorAction ma = new MonitorAction();
 | 
				
			||||||
 | 
								ma.Channel = monitorChannel;
 | 
				
			||||||
 | 
								ma.File = "voicefile";
 | 
				
			||||||
 | 
								ma.Format = "gsm";
 | 
				
			||||||
 | 
								ma.Mix = true;
 | 
				
			||||||
 | 
								try
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									ManagerResponse mr = manager.SendAction(ma, 10000);
 | 
				
			||||||
 | 
									Console.WriteLine("Monitor Call"
 | 
				
			||||||
 | 
										+ "\n\tResponse:" + mr.Response);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								catch (Exception ex)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									Console.WriteLine(ex.Message);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								manager.Logoff();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							static void manager_IgnoreEvent(object sender, NewExtenEvent e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								// Ignore this event.
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							#region Event handlers
 | 
				
			||||||
 | 
							static void dam_Events(object sender, ManagerEvent e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Console.WriteLine(e);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							static void dam_Reload(object sender, ReloadEvent e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Console.WriteLine(string.Format("\nReload Event: {0}", e.Message));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							static void dam_Link(object sender, LinkEvent e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Console.WriteLine("Link Event"
 | 
				
			||||||
 | 
									+ "\n\tChannel1:\t" + e.Channel1
 | 
				
			||||||
 | 
									+ "\n\tChannel2:\t" + e.Channel2
 | 
				
			||||||
 | 
									);
 | 
				
			||||||
 | 
								if (e.Channel1.StartsWith(ORIGINATE_CHANNEL) || e.Channel2.StartsWith(ORIGINATE_CHANNEL))
 | 
				
			||||||
 | 
									monitorChannel = e.Channel1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							static void dam_ExtensionStatus(object sender, ExtensionStatusEvent e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Console.WriteLine("ExtensionStatus Event"
 | 
				
			||||||
 | 
									+ "\n\tContext\t\t" + e.Context
 | 
				
			||||||
 | 
									+ "\n\tExten\t\t" + e.Exten
 | 
				
			||||||
 | 
									+ "\n\tStatus\t\t" + e.Status
 | 
				
			||||||
 | 
								);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							static void dam_Dial(object sender, DialEvent e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Console.WriteLine(
 | 
				
			||||||
 | 
									"Dial Event"
 | 
				
			||||||
 | 
									+ "\n\tCallerId\t" + e.CallerId
 | 
				
			||||||
 | 
									+ "\n\tCallerIdName\t" + e.CallerIdName
 | 
				
			||||||
 | 
									+ "\n\tDestination\t" + e.Destination
 | 
				
			||||||
 | 
									+ "\n\tDestUniqueId\t" + e.DestUniqueId
 | 
				
			||||||
 | 
									+ "\n\tSrc\t\t" + e.Src
 | 
				
			||||||
 | 
									+ "\n\tSrcUniqueId\t" + e.SrcUniqueId
 | 
				
			||||||
 | 
									);
 | 
				
			||||||
 | 
								if (e != null && e.Destination != null && e.Destination.StartsWith(ORIGINATE_CHANNEL))
 | 
				
			||||||
 | 
									transferChannel = e.Src;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							static void dam_Hangup(object sender, HangupEvent e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Console.WriteLine("Hangup Event"
 | 
				
			||||||
 | 
									+ "\n\tChannel\t\t" + e.Channel
 | 
				
			||||||
 | 
									+ "\n\tUniqueId\t" + e.UniqueId
 | 
				
			||||||
 | 
									);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							static void dam_NewExten(object sender, NewExtenEvent e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Console.WriteLine(
 | 
				
			||||||
 | 
									"New Extension Event"
 | 
				
			||||||
 | 
									+ "\n\tChannel\t\t" + e.Channel
 | 
				
			||||||
 | 
									+ "\n\tExtension\t" + e.Extension
 | 
				
			||||||
 | 
									+ "\n\tContext\t\t" + e.Context
 | 
				
			||||||
 | 
									+ "\n\tDateReceived\t" + e.DateReceived.ToString()
 | 
				
			||||||
 | 
									+ "\n\tPriority\t" + e.Priority.ToString()
 | 
				
			||||||
 | 
									+ "\n\tPrivilege\t" + e.Privilege
 | 
				
			||||||
 | 
									+ "\n\tUniqueId\t" + e.UniqueId
 | 
				
			||||||
 | 
									+ "\n\tAppData\t\t" + e.AppData
 | 
				
			||||||
 | 
									+ "\n\tApplication\t" + e.Application
 | 
				
			||||||
 | 
									);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							static void dam_NewChannel(object sender, NewChannelEvent e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Console.WriteLine("New channel Event"
 | 
				
			||||||
 | 
									+ "\n\tChannel\t\t" + e.Channel
 | 
				
			||||||
 | 
									+ "\n\tUniqueId\t" + e.UniqueId
 | 
				
			||||||
 | 
									+ "\n\tCallerId\t" + e.CallerId
 | 
				
			||||||
 | 
									+ "\n\tCallerIdName\t" + e.CallerIdName
 | 
				
			||||||
 | 
									+ "\n\tState\t\t" + e.State
 | 
				
			||||||
 | 
									+ "\n\tDateReceived\t" + e.DateReceived.ToString()
 | 
				
			||||||
 | 
									);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							static void dam_PeerStatus(object sender, PeerStatusEvent e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Console.WriteLine("Peer Status Event"
 | 
				
			||||||
 | 
									+ "\n\tPeer\t\t" + e.Peer
 | 
				
			||||||
 | 
									+ "\n\tStatus\t\t" + e.PeerStatus
 | 
				
			||||||
 | 
									+ "\n\tDateReceived\t" + e.DateReceived.ToString()
 | 
				
			||||||
 | 
									);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							static void dam_UserEvents(object sender, UserEvent e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (e is UserAgentLoginEvent)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									Console.WriteLine("User Event - AgentLogin:"
 | 
				
			||||||
 | 
										+ "\n\tAgent\t\t" + ((UserAgentLoginEvent)e).Agent
 | 
				
			||||||
 | 
										);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									Console.WriteLine("User Event:"
 | 
				
			||||||
 | 
										+ "\n\tUserEventName\t\t" + e.UserEventName
 | 
				
			||||||
 | 
										);
 | 
				
			||||||
 | 
									foreach (System.Collections.Generic.KeyValuePair<string, string> pair in e.Attributes)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										Console.WriteLine(String.Format("\t{0}\t{1}", pair.Key, pair.Value));
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							#endregion
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public class UserAgentLoginEvent : UserEvent
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							private string agent;
 | 
				
			||||||
 | 
							public string Agent
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								get { return agent; }
 | 
				
			||||||
 | 
								set { agent = value; }
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public UserAgentLoginEvent(ManagerConnection source)
 | 
				
			||||||
 | 
								: base(source)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,20 @@
 | 
				
			||||||
 | 
					using System.Reflection;
 | 
				
			||||||
 | 
					using System.Runtime.CompilerServices;
 | 
				
			||||||
 | 
					using System.Runtime.InteropServices;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[assembly: AssemblyTitle("Asterisk.NET.Test")]
 | 
				
			||||||
 | 
					[assembly: AssemblyDescription("")]
 | 
				
			||||||
 | 
					[assembly: AssemblyConfiguration("")]
 | 
				
			||||||
 | 
					[assembly: AssemblyCompany("x893")]
 | 
				
			||||||
 | 
					[assembly: AssemblyProduct("Asterisk.NET.Test")]
 | 
				
			||||||
 | 
					[assembly: AssemblyCopyright("Copyright © 2008")]
 | 
				
			||||||
 | 
					[assembly: AssemblyTrademark("")]
 | 
				
			||||||
 | 
					[assembly: AssemblyCulture("")]
 | 
				
			||||||
 | 
					[assembly: Guid("1a245924-e504-4cb4-9885-67a39085196a")]
 | 
				
			||||||
 | 
					[assembly: AssemblyVersion("1.0.0.0")]
 | 
				
			||||||
 | 
					[assembly: AssemblyFileVersion("1.0.0.0")]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Setting ComVisible to false makes the types in this assembly not visible 
 | 
				
			||||||
 | 
					// to COM components.  If you need to access a type in this assembly from 
 | 
				
			||||||
 | 
					// COM, set the ComVisible attribute to true on that type.
 | 
				
			||||||
 | 
					[assembly: ComVisible(false)]
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					<?xml version="1.0"?>
 | 
				
			||||||
 | 
					<configuration>
 | 
				
			||||||
 | 
					<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,126 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					<root>
 | 
				
			||||||
 | 
					  <!-- 
 | 
				
			||||||
 | 
					    Microsoft ResX Schema 
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    Version 2.0
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    The primary goals of this format is to allow a simple XML format 
 | 
				
			||||||
 | 
					    that is mostly human readable. The generation and parsing of the 
 | 
				
			||||||
 | 
					    various data types are done through the TypeConverter classes 
 | 
				
			||||||
 | 
					    associated with the data types.
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    Example:
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    ... ado.net/XML headers & schema ...
 | 
				
			||||||
 | 
					    <resheader name="resmimetype">text/microsoft-resx</resheader>
 | 
				
			||||||
 | 
					    <resheader name="version">2.0</resheader>
 | 
				
			||||||
 | 
					    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
 | 
				
			||||||
 | 
					    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
 | 
				
			||||||
 | 
					    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
 | 
				
			||||||
 | 
					    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
 | 
				
			||||||
 | 
					    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
 | 
				
			||||||
 | 
					        <value>[base64 mime encoded serialized .NET Framework object]</value>
 | 
				
			||||||
 | 
					    </data>
 | 
				
			||||||
 | 
					    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
 | 
				
			||||||
 | 
					        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
 | 
				
			||||||
 | 
					        <comment>This is a comment</comment>
 | 
				
			||||||
 | 
					    </data>
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
 | 
					    There are any number of "resheader" rows that contain simple 
 | 
				
			||||||
 | 
					    name/value pairs.
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    Each data row contains a name, and value. The row also contains a 
 | 
				
			||||||
 | 
					    type or mimetype. Type corresponds to a .NET class that support 
 | 
				
			||||||
 | 
					    text/value conversion through the TypeConverter architecture. 
 | 
				
			||||||
 | 
					    Classes that don't support this are serialized and stored with the 
 | 
				
			||||||
 | 
					    mimetype set.
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    The mimetype is used for serialized objects, and tells the 
 | 
				
			||||||
 | 
					    ResXResourceReader how to depersist the object. This is currently not 
 | 
				
			||||||
 | 
					    extensible. For a given mimetype the value must be set accordingly:
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    Note - application/x-microsoft.net.object.binary.base64 is the format 
 | 
				
			||||||
 | 
					    that the ResXResourceWriter will generate, however the reader can 
 | 
				
			||||||
 | 
					    read any of the formats listed below.
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    mimetype: application/x-microsoft.net.object.binary.base64
 | 
				
			||||||
 | 
					    value   : The object must be serialized with 
 | 
				
			||||||
 | 
					            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
 | 
				
			||||||
 | 
					            : and then encoded with base64 encoding.
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    mimetype: application/x-microsoft.net.object.soap.base64
 | 
				
			||||||
 | 
					    value   : The object must be serialized with 
 | 
				
			||||||
 | 
					            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
 | 
				
			||||||
 | 
					            : and then encoded with base64 encoding.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mimetype: application/x-microsoft.net.object.bytearray.base64
 | 
				
			||||||
 | 
					    value   : The object must be serialized into a byte array 
 | 
				
			||||||
 | 
					            : using a System.ComponentModel.TypeConverter
 | 
				
			||||||
 | 
					            : and then encoded with base64 encoding.
 | 
				
			||||||
 | 
					    -->
 | 
				
			||||||
 | 
					  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
 | 
				
			||||||
 | 
					    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
 | 
				
			||||||
 | 
					    <xsd:element name="root" msdata:IsDataSet="true">
 | 
				
			||||||
 | 
					      <xsd:complexType>
 | 
				
			||||||
 | 
					        <xsd:choice maxOccurs="unbounded">
 | 
				
			||||||
 | 
					          <xsd:element name="metadata">
 | 
				
			||||||
 | 
					            <xsd:complexType>
 | 
				
			||||||
 | 
					              <xsd:sequence>
 | 
				
			||||||
 | 
					                <xsd:element name="value" type="xsd:string" minOccurs="0" />
 | 
				
			||||||
 | 
					              </xsd:sequence>
 | 
				
			||||||
 | 
					              <xsd:attribute name="name" use="required" type="xsd:string" />
 | 
				
			||||||
 | 
					              <xsd:attribute name="type" type="xsd:string" />
 | 
				
			||||||
 | 
					              <xsd:attribute name="mimetype" type="xsd:string" />
 | 
				
			||||||
 | 
					              <xsd:attribute ref="xml:space" />
 | 
				
			||||||
 | 
					            </xsd:complexType>
 | 
				
			||||||
 | 
					          </xsd:element>
 | 
				
			||||||
 | 
					          <xsd:element name="assembly">
 | 
				
			||||||
 | 
					            <xsd:complexType>
 | 
				
			||||||
 | 
					              <xsd:attribute name="alias" type="xsd:string" />
 | 
				
			||||||
 | 
					              <xsd:attribute name="name" type="xsd:string" />
 | 
				
			||||||
 | 
					            </xsd:complexType>
 | 
				
			||||||
 | 
					          </xsd:element>
 | 
				
			||||||
 | 
					          <xsd:element name="data">
 | 
				
			||||||
 | 
					            <xsd:complexType>
 | 
				
			||||||
 | 
					              <xsd:sequence>
 | 
				
			||||||
 | 
					                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
 | 
				
			||||||
 | 
					                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
 | 
				
			||||||
 | 
					              </xsd:sequence>
 | 
				
			||||||
 | 
					              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
 | 
				
			||||||
 | 
					              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
 | 
				
			||||||
 | 
					              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
 | 
				
			||||||
 | 
					              <xsd:attribute ref="xml:space" />
 | 
				
			||||||
 | 
					            </xsd:complexType>
 | 
				
			||||||
 | 
					          </xsd:element>
 | 
				
			||||||
 | 
					          <xsd:element name="resheader">
 | 
				
			||||||
 | 
					            <xsd:complexType>
 | 
				
			||||||
 | 
					              <xsd:sequence>
 | 
				
			||||||
 | 
					                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
 | 
				
			||||||
 | 
					              </xsd:sequence>
 | 
				
			||||||
 | 
					              <xsd:attribute name="name" type="xsd:string" use="required" />
 | 
				
			||||||
 | 
					            </xsd:complexType>
 | 
				
			||||||
 | 
					          </xsd:element>
 | 
				
			||||||
 | 
					        </xsd:choice>
 | 
				
			||||||
 | 
					      </xsd:complexType>
 | 
				
			||||||
 | 
					    </xsd:element>
 | 
				
			||||||
 | 
					  </xsd:schema>
 | 
				
			||||||
 | 
					  <resheader name="resmimetype">
 | 
				
			||||||
 | 
					    <value>text/microsoft-resx</value>
 | 
				
			||||||
 | 
					  </resheader>
 | 
				
			||||||
 | 
					  <resheader name="version">
 | 
				
			||||||
 | 
					    <value>2.0</value>
 | 
				
			||||||
 | 
					  </resheader>
 | 
				
			||||||
 | 
					  <resheader name="reader">
 | 
				
			||||||
 | 
					    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
 | 
				
			||||||
 | 
					  </resheader>
 | 
				
			||||||
 | 
					  <resheader name="writer">
 | 
				
			||||||
 | 
					    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
 | 
				
			||||||
 | 
					  </resheader>
 | 
				
			||||||
 | 
					  <data name="customivr" xml:space="preserve">
 | 
				
			||||||
 | 
					    <value>Asterisk.NET.Test.CustomIVR, Asterisk.NET.Test</value>
 | 
				
			||||||
 | 
					  </data>
 | 
				
			||||||
 | 
					  <data name="noaction" xml:space="preserve">
 | 
				
			||||||
 | 
					    <value>Asterisk.NET.FastAGI.Scripts.AGINoAction, Asterisk.NET</value>
 | 
				
			||||||
 | 
					  </data>
 | 
				
			||||||
 | 
					</root>
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,8 @@
 | 
				
			||||||
	Re-homed project to CodePlex with TFS Support
 | 
						Re-homed project to CodePlex with TFS Support
 | 
				
			||||||
	Upgraded Project to .NET 4.5
 | 
						Upgraded Project to .NET 4.5
 | 
				
			||||||
	Allow connection to Asterisk 1.8.x - Still uses the 1.6.x logic, so any 1.8 changes are not yet implemented. <- TODO
 | 
						Allow connection to Asterisk 1.8.x - Still uses the 1.6.x logic, so any 1.8 changes are not yet implemented. <- TODO
 | 
				
			||||||
 | 
						Readded the Test Project, upgraded to .NET 4.5 and post build fix.
 | 
				
			||||||
 | 
						Removed "@"%ProgramFiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\ResGen.exe" "$(ProjectDir)fastagi-mapping.resx" fastagi-mapping.resources" for now until I know what it does
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
09.06.2009
 | 
					09.06.2009
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue