diff options
Diffstat (limited to 'Samples/C++')
-rw-r--r-- | Samples/C++/REGISTER/test/ReadMe.txt | 33 | ||||
-rw-r--r-- | Samples/C++/REGISTER/test/stdafx.cpp | 8 | ||||
-rw-r--r-- | Samples/C++/REGISTER/test/stdafx.h | 15 | ||||
-rw-r--r-- | Samples/C++/REGISTER/test/targetver.h | 13 | ||||
-rw-r--r-- | Samples/C++/REGISTER/test/test.cpp | 86 | ||||
-rw-r--r-- | Samples/C++/REGISTER/test/test.sln | 20 | ||||
-rw-r--r-- | Samples/C++/REGISTER/test/test.vcproj | 211 |
7 files changed, 386 insertions, 0 deletions
diff --git a/Samples/C++/REGISTER/test/ReadMe.txt b/Samples/C++/REGISTER/test/ReadMe.txt new file mode 100644 index 0000000..ce20636 --- /dev/null +++ b/Samples/C++/REGISTER/test/ReadMe.txt @@ -0,0 +1,33 @@ +======================================================================== + CONSOLE APPLICATION : test Project Overview +======================================================================== + +AppWizard has created this test application for you. + +This file contains a summary of what you will find in each of the files that +make up your test application. + + +test.vcproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +test.cpp + This is the main application source file. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named test.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/Samples/C++/REGISTER/test/stdafx.cpp b/Samples/C++/REGISTER/test/stdafx.cpp new file mode 100644 index 0000000..ab6cf71 --- /dev/null +++ b/Samples/C++/REGISTER/test/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// test.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/Samples/C++/REGISTER/test/stdafx.h b/Samples/C++/REGISTER/test/stdafx.h new file mode 100644 index 0000000..b005a83 --- /dev/null +++ b/Samples/C++/REGISTER/test/stdafx.h @@ -0,0 +1,15 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#include <stdio.h> +#include <tchar.h> + + + +// TODO: reference additional headers your program requires here diff --git a/Samples/C++/REGISTER/test/targetver.h b/Samples/C++/REGISTER/test/targetver.h new file mode 100644 index 0000000..6fe8eb7 --- /dev/null +++ b/Samples/C++/REGISTER/test/targetver.h @@ -0,0 +1,13 @@ +#pragma once + +// The following macros define the minimum required platform. The minimum required platform +// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run +// your application. The macros work by enabling all features available on platform versions up to and +// including the version specified. + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. +#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + diff --git a/Samples/C++/REGISTER/test/test.cpp b/Samples/C++/REGISTER/test/test.cpp new file mode 100644 index 0000000..2668366 --- /dev/null +++ b/Samples/C++/REGISTER/test/test.cpp @@ -0,0 +1,86 @@ +// test.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" +#include <assert.h> +#include <api_engine.h> +#include <api_stack.h> + +#define STACK_ID 1234 + +#ifdef WIN32 +# include <windows.h> +#endif + +/* Event listening using a static method */ +void OnRegistrationStateChanged(int stack_id, dgo::sip_state_registration_t state, int sipcode, const char* sipdesc) +{ + /* check if it's our stack */ + if(stack_id != STACK_ID) return; + + switch(state) + { + case dgo::srs_none: printf("Test_OnRegistrationStateChanged: %s(%s)\n", "srs_none", sipdesc); break; + case dgo::srs_trying: printf("Test_OnRegistrationStateChanged: %s(%s)\n", "srs_trying", sipdesc); break; + case dgo::srs_authentifying: printf("Test_OnRegistrationStateChanged: %s(%s)\n", "srs_authentifying", sipdesc); break; + case dgo::srs_unregistered: printf("Test_OnRegistrationStateChanged: %s(%s)\n", "srs_unregistered", sipdesc); break; + case dgo::srs_registered: printf("Test_OnRegistrationStateChanged: %s(%s)\n", "srs_registered", sipdesc); break; + } +} + +int _tmain(int argc, _TCHAR* argv[]) +{ + /* MUST call this function to initialize the engine befor using the first stack */ + assert( ERR_SUCCEED(dgo::engine_initialize()) ); + + /* create the stack */ + dgo::stack* stack = new dgo::stack(STACK_ID); + + /* Events registration */ + stack->registrationStateChanged.connect(&OnRegistrationStateChanged); + + /* check that the stack has been successfuly initialized */ + assert(stack->get_initialized()); + + /* MUST: Initialize mandatory parameters */ + stack->set_public_id("sip:bob@ims.inexbee.com"); + stack->set_private_id("bob@ims.inexbee.com"); + + stack->set_pcscf("192.168.0.14"); + stack->set_pcscf_port(4060); + stack->set_realm("ims.inexbee.com"); + + /* Not mandatory but must be set before starting */ + stack->set_sigcomp(true); + + /* run stack */ + assert( ERR_SUCCEED(stack->run()) ); + + /* set other optional parameters */ + stack->set_displayname("Doubango"); + stack->set_privacy("none"); + stack->set_password("bob"); + stack->set_early_ims(false); + stack->set_expires(10); + + /* register */ + stack->sip_register(); + + /* wait */ +#ifdef WIN32 + Sleep(500000); +#else + getchar(); +#endif + + /* Now it's time to unregister */ + stack->sip_unregister(); + + /* wait */ + getchar(); + + /* destroy the engine and unregister all identities*/ + assert( ERR_SUCCEED(dgo::engine_deinitialize()) ); + + return 0; +}
\ No newline at end of file diff --git a/Samples/C++/REGISTER/test/test.sln b/Samples/C++/REGISTER/test/test.sln new file mode 100644 index 0000000..a4cebca --- /dev/null +++ b/Samples/C++/REGISTER/test/test.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcproj", "{EB6DC417-98BF-45FD-90D0-F5C72F945316}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EB6DC417-98BF-45FD-90D0-F5C72F945316}.Debug|Win32.ActiveCfg = Debug|Win32 + {EB6DC417-98BF-45FD-90D0-F5C72F945316}.Debug|Win32.Build.0 = Debug|Win32 + {EB6DC417-98BF-45FD-90D0-F5C72F945316}.Release|Win32.ActiveCfg = Release|Win32 + {EB6DC417-98BF-45FD-90D0-F5C72F945316}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Samples/C++/REGISTER/test/test.vcproj b/Samples/C++/REGISTER/test/test.vcproj new file mode 100644 index 0000000..b251c82 --- /dev/null +++ b/Samples/C++/REGISTER/test/test.vcproj @@ -0,0 +1,211 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="test" + ProjectGUID="{EB6DC417-98BF-45FD-90D0-F5C72F945316}" + RootNamespace="test" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(DOUBANGO_HOME)\doubango\src";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\win32";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\su";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\ipt";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\sresolv";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\bnf";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\url";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\msg";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\sip";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\nta";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\nua";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\iptsec";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\http";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\nth";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\nea";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\sdp";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\soa";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\stun";"$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\tport"" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="$(OutDir)\doubango.lib" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\stdafx.cpp" + > + </File> + <File + RelativePath=".\test.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\stdafx.h" + > + </File> + <File + RelativePath=".\targetver.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + <File + RelativePath=".\ReadMe.txt" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> |