WINRT SIP Solution QuickStart

  1. Download the code and build the entire WinRTSock-1.0.0 solution.
  2. Set the startup project to WinRTSock.Test
  3. Create Sip2Sip accounts (see section 4.1 of this document).
  4. Change the WinRTSockTests.cpp at lines 110-113 with your Sip2Sip parameters.
  5. Download DebugView so you can see the network traffic on your PC.
    http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx
  6. Start DebugView in admin mode. Set the capture features to on.
  7. Run the application (Ctrl-F5).
  8. Run the SIP Connect test.
  9. Output will be recorded in DebugView.

The WinRT Sip solution folder structure follows a similar hierarchy as defined by the original download of Boghe and Doubango. In order to allow Subversion to be used to check in and out of the Subversion safe, this structure should be maintained.


Here is the basic folder structure:

image

Beginning at the folder named Doubango and Boghe respectively are the individual projects. This picture also show the structure of the 3rd party library folder.

PROJECTS

The projects are part of a larger solution called DoubangoWinRT. The solution and files may be downloaded from https://doubangowinrt.codeplex.com/.

WINRTSOCK

Boghe is a SIP video client for Windows Phone 8 and Surface Pro. It relies on the Doubango library, an experimental, open source, 3GPP IMS/LTE framework for both embedded and desktop systems.


For Windows Phone 8, Doubango relies on Winsock 2.0 for socket communications.

Winsock is not a library that is usable for Windows 8 applications that will be download from the Microsoft Store. As Microsoft works towards a common API and a common store for Windows Phone 8 and Windows 8, a new API was necessary. That API is called Windows Runtime (WinRT).

WinRTSock is a library replacement for Winsock that uses WinRT for socket communications. The WinRTSock library implements much of the functionality found in Winsock 2.0. The Winsock API is not used for any communications within the WinRTSock library.

Changes have been made to the Doubango project in order to replace Winsock with WinRTSock.

Please note that WInRTSock is not intended as a complete replacement for Winsock. The functionality implemented in WinRTSock was been written based on what was needed for the Boghe and Doubango projects to work.

For a list of the Winsock functions implemented in WinRTSock, see the table at WinRTSock Function Implementation.

WINRTSOCK TESTS

WinRTSock.Test is an application that is used to test the WinRTSock library. It is a Windows 8.1 application that is used to test the various functions the library.
image


The tests that are run are simple tests that make certain that the WinRTSock library is functioning correctly.

To test the library from end-to-end you must run the Boghe application setup to run with a SIP service.

BOGHE WP8

Boghe is the SIP video UI client that is used for Windows Phone 8. A new solution and project file has been created to support building Boghe for WinRT. The original Boghe was built for Windows 8. Boghe WinRT has been updated to build for Windows 8.1.


The Boghe WP8 solution is made up of several projects as follows:

Project Notes
Boghe-WP8 The client application.
Agents Windows Phone background processing
Backend Communications—contains all of the Doubango code plus C++ wrappers to abstract the Doubango API.
Boghe-core-rt UI misc, including models & SIP Session management. Contains the configuration.cs file where parameters must be placed for connecting to the SIP server.
Boghe-xdm-rt Support


Doubango This project should not be mistaken for the Doubango code in the Backend project. This project is used to define callbacks and events.

The name of the Boghe WinRT solution file is boghe-wp8 WinRT.sln. The boghe-wp8 project file contains all of the files and options necessary to build Boghe to run using the Windows Runtime.

The Backend project structure builds the library that is used for all communications by the Boghe client application. The project structure looks as follows:

The Doubango project folder has all of the files needed for communications and video conferencing defined with the Backend project. In addition, the Backend project has helper classes that abstract the complexity of using the Doubango code.
The SipService.h file has numerous interface definitions and wrapper classes to assist in making audio/visual calls.

BOGHE CONFIGURATION

The Boghe-core-rt project has the configuration.cs in the Model folder file where the SIP parameters must be defined. Here is a code snippet with sample parameters for SIP2SIP for real-time communications:

public static String DEFAULTIDENTITYDISPLAY_NAME = "Display Name";
public static String DEFAULTIDENTITYIMPI = "2229876543";
public static String DEFAULTIDENTITYIMPU = "sip:2229876543@sip2sip.info";
public static String DEFAULTIDENTITYPASSWORD = "password";
public static String DEFAULTIDENTITYPRIVACY = "none";
public static String DEFAULTNETWORKPCSCF_HOST = "proxy.sipthor.net";
public static int DEFAULTNETWORKPCSCF_PORT = 5060;
public static String DEFAULTNETWORKREALM = "sip2sip.info";

Once the parameters are set correctly build the Boghe solution. From Visual Studio run Boghe in the emulator. If the parameters are set correctly and match the parameters set at SIP2SIP, the client will show as connected.

image

BOGHE WP8 LIBRARY DEPENDENCIES

There are additional libraries needed before the Boghe solution can be successfully built. Boghe is dependent on the projects outlined in the following table:

Library

Solution File

Notes

Libgsm libgsm-WP8-WinRT.sln GSM library is responsible for speech compression.
Libogg libogg_dynamic.sln Responsible for manipulating Ogg bitstream file formats.
Libeayrt/ssleayrt   Open source SSL/TLS implementation. These libraries are part of OpenSSL. There is no Visual Studio solution. Instead there is a batch file in the OpenSSL root folder that is used to generate the necessary files and build the libraries. The batch file name is CleanAndBuild.bat.
Libspeex libspeex-WP8-WinRT.sln Open source audio compression format designed for speech.
WinRTSock WinRTSock-1.0.0.sln Winsock replacement. Solution will compile libraries for both Windows 8 and Windows Phone 8.


These libraries must be exist before attempting to build Boghe-WinRT. The Boghe-WinRT project expects these libraries to exist in the “thirdparties/WinRT” folder. Each library folder is further divided by platform, ARM or Win32.

Here is an example of the folders for gsm, speex and WinRTSock:
image


Once the 3rd party libraries are available, you can use Visual Studio 2013 to build the Boghe project. The Windows Phone 8 emulator may be used to test the communications. See the Test Requirements for information on what is needed for testing.

OPENSSL


OpenSSL is the library used to provide SSL/TLS capabilities to SIP communications. Since there is no Visual Studio solution or project files, a batch file must be used in order to build the library files.

In the OpenSSL root folder there is a batch file called CleanAndBuild.bat. Here is how the batch file is used:

CleanAndBuild clean [32|64|ARM]

The optional “clean” option will remove object files and temporary files forcing a complete build of OpenSSL. All libraries and unit tests will be compiled and linked.


The next option is the platform. OpenSSL may be built for 32 bit or 64 bit Windows or for ARM processors.

If the platform is not specified, OpenSSL will be built for 32 bit Windows.

Building OpenSSL requires that a Visual Studio command window be open for the platform. Visual Studio has a batch file called “vcvarsall.bat” that is used to setup the necessary environment variables for the platform chosen.
This table defines the options that may be provided to vcvarsall.bat.

Option

Notes

x86

 

amd64

64 bit

x64

Same as amd64

x86_arm

ARM processors

OPENSSL UNIT TESTS

In addition to the OpenSSL libraries, there are numerous executables that are built when the batch file is run to build OpenSSL. These executables are unit tests that may be run against the OpenSSL libraries. The tests may be run individually or a batch file may be used to run all of the tests.

The batch file is in the OpenSSL root folder called: OpenSSLTests.bat.

The unit tests test the crypto features of the Windows Runtime.

WinRTSock Function Implementation


Winsock Function Implemented in WinRTSock Notes

Winsock Function

Implemented in WinRTSock

Notes

accept

Y

 

AcceptEx

N

 

bind

Y

Datagram sockets only. Stream sockets always returns success.

closesocket

Y

 

connect

Y

 

ConnectEx

N

 

DisconnectEx

N

 

EnumProtocols

N

 

freeaddrinfo

Y

 

FreeAddrInfoW

N

 

FreeAddrInfoEx

N

 

gai_strerror

N

 

GetAcceptExSockaddrs

N

 

GetAddressByName

N

 

getaddrinfo

Y

 

GetAddrInfoEx

N

 

GetAddrInfoExCancel

N

 

GetAddrInfoExOverlappedResult

N

 

GetAddrInfoW

N

 

gethostbyaddr

N

 

gethostbyname

Y

 

gethostname

Y

 

GetNameByType

N

 

getnameinfo

Y

 

GetNameInfoW

N

 

getpeername

Y

 

getprotobyname

N

 

getprotobynumber

N

 

getservbyname

Y

 

getservbyport

N

 

GetService

N

 

getsockname

Y

 

getsockopt

Y

Always returns -1.

GetTypeByName

N

 

htond

N

 

htonf

N

 

htonl

Y

 

htonll

N

 

htons

Y

 

inet_addr

N

 

inet_ntoa

N

 

InetNtop

Y

Uses Paul Vixie’s inet_ntop

InetPton

Y

Uses Paul Vixie’s inet_pton

ioctlsocket

Y

FIONREAD only

listen

Y

 

ntohd

N

 

ntohf

N

 

ntohl

Y

 

ntohll

N

 

ntohs

Y

 

Recv

Y

 

recvfrom

Y

 

RIOCloseCompletionQueue

N

 

RIOCreateCompletionQueue

N

 

RIOCreateRequestQueue

N

 

RIODequeueCompletion

N

 

RIODeregisterBuffer

N

 

RIONotify

N

 

RIOReceive

N

 

RIOReceiveEx

N

 

RIORegisterBuffer

N

 

RIOResizeCompletionQueue

N

 

RIOResizeRequestQueue

N

 

RIOSend

N

 

RIOSendEx

N

 

select

Y

 

Send

Y

 

Sendto

Y

 

SetAddrInfoEx

N

 

SetService

N

 

SetSocketMediaStreamingMode

N

 

setsockopt

Y

Skeleton implementation that always returns success.

shutdown

Y

Treated same as closesocket.

socket

Y

 

TransmitFile

N

 

TransmitPackets

N

 

WSAAccept

Y

 

WSAAddressToString

N

 

WSAAsyncGetHostByAddr

N

 

WSAAsyncGetHostByName

N

 

WSAAsyncGetProtoByName

N

 

WSAAsyncGetProtoByNumber

N

 

WSAAsyncGetServByName

N

 

WSAAsyncGetServByPort

N

 

WSAAsyncSelect

N

 

WSACancelAsyncRequest

N

 

WSACancelBlockingCall

Y

Does nothing since all WinRT calls are non-blocking.

WSACleanup

Y

Does nothing. Always returns success.

WSACloseEvent

Y

 

WSAConnect

Y

 

WSAConnectByList

N

 

WSAConnectByName

N

 

WSACreateEvent

Y

Implemented as WSACreateEventEx that takes a socket argument.

WSADeleteSocketPeerTargetName

N

 

WSADuplicateSocket

N

 

WSAEnumNameSpaceProviders

N

 

WSAEnumNameSpaceProvidersEx

N

 

WSAEnumNetworkEvents

Y

 

WSAEnumProtocols

N

 

WSAEventSelect

Y

 

__WSAFDIsSet

N

 

WSAGetLastError

Y

 

WSAGetOverlappedResult

N

 

WSAGetQOSByName

N

 

WSAGetServiceClassInfo

N

 

WSAGetServiceClassNameByClassId

N

 

WSAHtonl

N

 

WSAHtons

N

 

WSAImpersonateSocketPeer

N

 

WSAInstallServiceClass

N

 

WSAIoctl

N

 

WSAIsBlocking

N

 

WSAJoinLeaf

N

 

WSALookupServiceBegin

N

 

WSALookupServiceEnd

N

 

WSALookupServiceNext

N

 

WSANSPIoctl

N

 

WSANtohl

N

 

WSANtohs

N

 

WSAPoll

N

 

WSAQuerySocketSecurity

N

 

WSAProviderConfigChange

N

 

WSARecv

Y

 

WSARecvDisconnect

N

 

WSARecvEx

N

 

WSARecvFrom

Y

 

WSARecvMsg

N

 

WSARemoveServiceClass

N

 

WSAResetEvent

N

 

WSARevertImpersonation

N

 

WSASend

Y

 

WSASendDisconnect

N

 

WSASendMsg

N

 

WSASendTo

Y

 

WSASetBlockingHook

N

 

WSASetEvent

Y

 

WSASetLastError

Y

 

WSASetService

N

 

WSASetSocketPeerTargetName

N

 

WSASetSocketSecurity

N

 

WSASocket

N

 

WSAStartup

Y

Always returns the version requested.

WSAStringToAddress

N

 

WSAUnhookBlockingHook

N

 

WSAWaitForMultipleEvents

Y

 


BOGHE/DOUBANGO/WINRTSOCK TEST REQUIREMENTS


In order to test the VoIP functionality of WinRTSock library, you need to register with a service that will provide the real time communications. For example SIP2SIP.

You will also need to install a client application. This client application will answer calls and allow calls to be made. You may download a client application from https://jitsi.org/Main/Download.

REGISTERING WITH SIP2SIP


In order to make and receive calls you should register for 2 accounts. One account will be used by the client application (Jitsi) in order to answer and receive calls. The second will be used by the emulator to make and receive calls.

  1. Go to https://mdns.sipthor.net/registersipaccount.phtml
    image
  2. Fill in the form. Please note that in order to use the Boghe application, the first part of the account must be made up of numbers only. This is the number that will be used when dialing.
    e.g: 1119876532@sip2sip.info
  3. Repeat steps 1 and 2 to create a second account with a different SIP Id. E.g. the first account created was 1119876532@sip2sip.info. For the second account choose an id like 2229876532@sip2sip.info.

INSTALLING COMMUNICATIONS CLIENT

  1. Download Jitsi for Windows from https://jitsi.org/Main/Download
  2. Once Jitsi is installed, start Jitsi and select Tools/Options
    image
  3. Press Add and select SIP from the dropdown.
    image
  4. On the Account tab enter the SIP id and password of one of the accounts created at SIP2SIP. E.g 1119876532@sip2sip.info
    image
  5. For the remainder of the tabs the defaults should work. Here is an example of the summary:
    image



%MCEPASTEBIN%

Last edited Mar 16, 2014 at 8:52 PM by crolon, version 6