Monday, March 26, 2012

[SKYPEKIT][DM368][IPNC] Starting Skypekit on DM368-IPNC - setup environment and build the 1st tutorial example

It's interesting to have this project to enable Skype on DM368 device, specifically, Appro's IPNC. I got support from boss to initiate this trial project, after requesting funding for more than 6 months.

First of all, I registered "SkypeKit for Embedded", a $5 cost. According to the instruction, I did

1. register a (test) application and version at https://developer.skype.com/
2. download a runtime and an application token (key pair).
    (and sdk. I got skypekit-sdk_sdk-3.7.0.20_xxxxxxx.tar.gz for sdk, linux-armv5-skypekit-voicepcm-videortp_3.7.0.103_xxxxxxx.tar.gz for runtime, and a keypair.pem)
3. save the key pair as keypair.pem file in examples/cpp/tutorial/keypair
4. re-build C++ wrapper from project files located in interfaces/skype/cpp_embedded/build directory.
5. build tutorials from project files located in examples/cpp/tutorial/build

As a dm368-ipnc user, life is not that easy since you won't get it compiled or worked just follow the instructions above.

Note: this article includes sdk 3.7 and 4.1.2. Although 3.7 is stable, officially, I found that 4.1.2(beta) is actually more stable than 3.7.

[This Section is for SDK 3.7]

To make tutorial_1 running, the steps are:

1. Prepare the build environment. 
here I used Rules.make to setup parameters so the only thing to be patched is including "Rules.make" in Makefile.

Rules.make example:


TARGET_ARCH := armv5le-eabi
MVTOOL_PREFIX := arm_v5t_le-
TOOLCHAIN_PREFIX := /opt/mv_pro_5.0.0/montavista/pro/devkit/arm/v5t_le/bin/$(MVTOOL_PREFIX)
CC := $(MVTOOL_PREFIX)gcc
CXX := $(MVTOOL_PREFIX)g++
AR := $(MVTOOL_PREFIX)ar
LD := $(MVTOOL_PREFIX)ld
export CC
export CXX
export AR
you could also want to install utility "premake" from industriousone


2. Build skypekit-cyassl_lib and skypekit-cppwrapper_2_lib.
this is required before build tutorial example!
run make at [skypekit-sdk-dir]/interfaces/skype/cpp_embedded/build/gmake/

3. Build target tutorial 
before building, I had to copy keypair.pem to  [skypekit-sdk-dir]/examples/cpp/tutorial/keypair/
enter [skypekit-sdk-dir]/examples/cpp/tutorial/build/gmake/
make tutorial_1

now I have executable tutorial_1 and skypekit runtime linux-armv5-skypekit-voicepcm-videortp in hand. Per instruction, execute runtime as daemon and run tutorial_1 should demonstrate skype login and logout process.

./linux-armv5-skypekit-voicepcm-videortp &
it will show some information like below

SkypeRuntime Copyright (C) 2003-2012 Skype Technologies S.A.
SkypeRuntime Version: 3.7/linux-armv5-skypekit-voicepcm-videortp_3.7.0.103_xxxxxxx
Proprietary and confidential, do not share this application.


./tutorial_1 [skypename] [password]
Unfortunately, this test failed with messages below


*****************************************************************
 SkypeKit Tutorial, Step 1 - Login with skypename and password.
*****************************************************************
Creating skype ..
Getting account ..
Logging in..
UnixSocket.cpp:101(Connect): /tmp/vidrtp_from_skypekit_key: failed to connect: error #111
UnixSocket.cpp:101(Connect): /tmp/pcm_from_skypekit_key: failed to connect: error #111
PCM client connection was not established.
SidPCMClient.cpp:43(SkypePCMInterfaceGet): Skypekit will exit.
there are several discussions at skypekit forum but no explicitly answer as far. Mostly "Account::LOGOUTREASON<Unknown:0>" problem instead. After digging a little bit deeper, I found that the answer is simple - we need not only  C++ wrapper from project files located in interfaces/skype/cpp_embedded/build directory, but also video/voice host to hook with SkypeKit API. Of course, it is not necessary if your skypekit runtime is chat only (i.e. no video and voice post fix)

4. Build (loopback) video and voice host engines
since my runtime is of videortp and voicepcm option, run make at
[skypekit-sdk-dir]/reference/videortphost-loopback
[skypekit-sdk-dir]/reference/voicepcmhost-loopback
the executables can be found under ./build respectively.

5. Test tutorial 1 again

./linux-armv5-skypekit-voicepcm-videortp &
./videortphost-loopback &
./voicepcmhost-loopback &
./tutorial_1 [skypename] [password]

and the terminal shows

*****************************************************************
 SkypeKit Tutorial, Step 1 - Login with skypename and password.
*****************************************************************
Creating skype ..
Getting account ..
Logging in..
AVTransportWrapper (/tmp/pcm_from_skypekit_key): connected!
AVTransportWrapper (/tmp/pcm_from_skypekit_key): connected!
AVTransportWrapper (/tmp/pcm_to_skypekit_key): connected!
AVTransportWrapper (/tmp/pcm_to_skypekit_key): connected!
Init
UseDefaultDevice: INPUT_DEVICE
UseDefaultDevice: OUTPUT_DEVICE
UseDefaultDevice: NOTIFICATION_DEVICE
GetCurrentDevice: INPUT_DEVICE, guid0
UseDevice: INPUT_DEVICE, guid0
UseDevice: OUTPUT_DEVICE, guid0
UseDefaultDevice: NOTIFICATION_DEVICE
GetCurrentDevice: INPUT_DEVICE, guid0
GetDevices: INPUT_DEVICE
GetDevices: OUTPUT_DEVICE
Stop: INPUT_DEVICE
Stop: OUTPUT_DEVICE
Stop: NOTIFICATION_DEVICE
UseDevice: INPUT_DEVICE, guid0
UseDevice: OUTPUT_DEVICE, guid0
UseDefaultDevice: NOTIFICATION_DEVICE
GetCurrentDevice: INPUT_DEVICE, guid0
UseDevice: INPUT_DEVICE, guid0
UseDevice: OUTPUT_DEVICE, guid0
UseDefaultDevice: NOTIFICATION_DEVICE
GetCurrentDevice: INPUT_DEVICE, guid0
GetCurrentDevice: INPUT_DEVICE, guid0
Start: INPUT_DEVICE
Stop: INPUT_DEVICE
GetCurrentDevice: OUTPUT_DEVICE, guid0
GetCurrentDevice: NOTIFICATION_DEVICE, guid0
Start: OUTPUT_DEVICE
Stop: OUTPUT_DEVICE
Stop: INPUT_DEVICE
Stop: OUTPUT_DEVICE
Stop: NOTIFICATION_DEVICE
Login complete.
Press ENTER to log out...

Note:
if there is segmentation fault or Account::LOGOUTREASON.SERVER_CONNECT_FAILED, try to run ./killall and stop av_server.out. your system memory maybe limited to run this tutorial


[This Section is for SDK 4.1.2(Beta 4.1)]

The C++ wrapper library no longer ships with pre-made project files. Instead, the SDK now comes with CMake scripts. Thus, I had to change [skypekit_sdk]/interfaces/skype/cpp_embedded/cmake-build/CMakeCache.txt which was generated by running [skype_sdk]/interfaces/skype/cpp_embedded/BuildWithCmake.sh.

the change example including:
CMAKE_AR:FILEPATH
CMAKE_CXX_COMPILER:FILEPATH
CMAKE_C_COMPILER:FILEPATH
CMAKE_LINKER:FILEPATH
CMAKE_MAKE_PROGRAM:FILEPATH
CMAKE_OBJCOPY:FILEPATH
CMAKE_OBJDUMP:FILEPATH
CMAKE_STRIP:FILEPATH
the others are similar to SDK 3.7

Note2: Sometime there is login error with message "Account::LOGOUTREASON.SERVER_CONNECT_FAILED" or "Account::LOGOUTREASON<Unknown:673000>" or 
"Account::LOGOUTREASON<Unknown:0>"
The reason is not clarified as far (MAR2012) but it should be skypekit runtime problem. I added a delay before invoking "LoginWithPassword" (i.e. Delay(50)), and tried certain times if failed, to remedy this problem. The insertion of Delay can reduce the chance to be forced logout anyway.









2 comments:

  1. Yes I folloed your steps of section 2, m able to rebuild libskypekit-cppwrapper_2_lib.a in build directory but skypekitclient exe not build, so after that i have tried to build qt_videocalls.pro for exe but am getting an error i.e
    ../interfaces/skype/cpp-embedded/build/libskypekit-cppwrapper_2_lib.a: could not read symbols: File in wrong format.
    Plz give solution

    ReplyDelete