Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

first commit

  • Loading branch information...
commit 768107e4fee25ae7a1003d6b9ad1f181982e823d 0 parents
@juzna authored
1  .gitignore
@@ -0,0 +1 @@
+page.html
9 .gitmodules
@@ -0,0 +1,9 @@
+[submodule "linphone"]
+ path = 3rdParty/linphone/
+ url = git://git.sv.gnu.org/linphone.git
+[submodule "oRTP"]
+ path = 3rdParty/linphone/oRTP
+ url = git://git.linphone.org/ortp.git
+[submodule "mediastreamer2"]
+ path = 3rdParty/linphone/mediastreamer2
+ url = git://git.linphone.org/mediastreamer2.git
38 CMakeLists.txt
@@ -0,0 +1,38 @@
+#/**********************************************************\
+# Auto-generated CMakeLists.txt for the linphone project
+#\**********************************************************/
+
+# Written to work with cmake 2.6
+cmake_minimum_required (VERSION 2.6)
+set (CMAKE_BACKWARDS_COMPATIBILITY 2.6)
+
+include(${CMAKE_DIR}/common.cmake)
+
+set (PROJNAME ${PLUGIN_NAME})
+
+browserplugin_project(${PROJNAME})
+
+file (GLOB GENERAL RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ *.cpp
+ *.h
+ *.cmake
+ )
+
+# Generated files are stored in ${GENERATED} by the project configuration
+SET_SOURCE_FILES_PROPERTIES(
+ ${GENERATED}
+ PROPERTIES
+ GENERATED 1
+ )
+
+SOURCE_GROUP(Generated FILES
+ ${GENERATED}
+ )
+
+SET( SOURCES
+ ${GENERAL}
+ ${GENERATED}
+ )
+
+# This will include Win/projectDef.cmake, Linux/projectDef.cmake, etc
+include_platform()
26 FactoryMain.cpp
@@ -0,0 +1,26 @@
+/**********************************************************\
+
+ Auto-generated FactoryMain.cpp
+
+ This file contains the auto-generated factory methods
+ for the linphone project
+
+\**********************************************************/
+
+#include "FactoryDefinitions.h"
+#include "linphone.h"
+
+FB::PluginCore *_getMainPlugin()
+{
+ return new linphone();
+}
+
+void GlobalPluginInitialize()
+{
+ linphone::StaticInitialize();
+}
+
+void GlobalPluginDeinitialize()
+{
+ linphone::StaticDeinitialize();
+}
21 Mac/FactoryMainMac.cpp
@@ -0,0 +1,21 @@
+/**********************************************************\
+ Default Mac factory methods
+
+ These are used to create the Npapi plugin type and
+ the PluginWindow type on windows; if you want to extend
+ these classses, do so and update these functions to
+ instantiate the correct types.
+\**********************************************************/
+
+#include "NpapiPlugin.h"
+#include "Mac/PluginWindowMacQuickDraw.h"
+
+FB::Npapi::NpapiPlugin *_getNpapiPlugin(FB::Npapi::NpapiBrowserHost *host)
+{
+ return new FB::Npapi::NpapiPlugin(host);
+}
+
+FB::PluginWindowMacQuickDraw* _createPluginWindow(CGrafPtr port, int x, int y)
+{
+ return new FB::PluginWindowMacQuickDraw(port, x, y);
+}
54 Mac/bundle_template/Info.plist
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${PLUGIN_NAME}</string>
+ <key>CFBundleGetInfoString</key>
+ <string>${PLUGIN_NAME} ${FBSTRING_PLUGIN_VERSION}, ${FBSTRING_LegalCopyright}</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.${ACTIVEX_PROGID}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>BRPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${PLUGIN_NAME} ${FBSTRING_PLUGIN_VERSION}</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>${FBSTRING_PLUGIN_VERSION}</string>
+ <key>CFPlugInDynamicRegisterFunction</key>
+ <string></string>
+ <key>CFPlugInDynamicRegistration</key>
+ <string>NO</string>
+ <key>CFPlugInFactories</key>
+ <dict>
+ <key>00000000-0000-0000-0000-000000000000</key>
+ <string>MyFactoryFunction</string>
+ </dict>
+ <key>CFPlugInTypes</key>
+ <dict>
+ <key>00000000-0000-0000-0000-000000000000</key>
+ <array>
+ <string>00000000-0000-0000-0000-000000000000</string>
+ </array>
+ </dict>
+ <key>CFPlugInUnloadFunction</key>
+ <string></string>
+ <key>WebPluginName</key>
+ <string>${FBSTRING_ProductName}</string>
+ <key>WebPluginDescription</key>
+ <string>${FBSTRING_FileDescription}</string>
+ <key>WebPluginMIMETypes</key>
+ <dict>
+ <key>${FBSTRING_MIMEType}</key>
+ <dict>
+ <key>WebPluginTypeDescription</key>
+ <string>${FBSTRING_FileDescription}</string>
+ </dict>
+ </dict>
+</dict>
+</plist>
4 Mac/bundle_template/InfoPlist.strings
@@ -0,0 +1,4 @@
+/* Localized versions of Info.plist keys */
+
+CFBundleName = "${PLUGIN_NAME}.plugin";
+NSHumanReadableCopyright = "${FBSTRING_LegalCopyright}";
18 Mac/bundle_template/Localized.r
@@ -0,0 +1,18 @@
+#include <CoreServices/CoreServices.r>
+
+resource 'STR#' (126)
+{ {
+ "${FBSTRING_LegalCopyright}",
+ "${FBSTRING_ProductName}"
+} };
+
+resource 'STR#' (127)
+{ {
+ "${FBSTRING_FileDescription}"
+} };
+
+resource 'STR#' (128)
+{ {
+ "${FBSTRING_MIMEType}",
+ "${FBSTRING_FileExtents}"
+} };
69 Mac/np_macmain.cpp
@@ -0,0 +1,69 @@
+/**********************************************************\
+ Default auto-generated np_winmain.cpp
+
+ This file contains the entrypoints for a Mac NPAPI
+ plugin. Don't change this unless you know what you're
+ doing!
+\**********************************************************/
+
+#include "NpapiTypes.h"
+#include "NpapiPluginModule.h"
+
+using namespace FB::Npapi;
+FB::Npapi::NpapiPluginModule *module = NULL;
+
+typedef void (*NPP_ShutdownProcPtr)(void);
+
+#pragma GCC visibility push(default)
+
+extern "C" {
+ NPError NP_Initialize(NPNetscapeFuncs *browserFuncs);
+ NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs);
+ NPError NP_Shutdown(void);
+
+#ifndef _NO_MAIN
+ // For compatibility with CFM browsers.
+ int main(NPNetscapeFuncs *browserFuncs, NPPluginFuncs *pluginFuncs, NPP_ShutdownProcPtr *shutdown);
+#endif
+}
+
+#pragma GCC visibility pop
+
+#ifndef _NO_MAIN
+int main(NPNetscapeFuncs *browserFuncs, NPPluginFuncs *pluginFuncs, NPP_ShutdownProcPtr *shutdown)
+{
+ NP_Initialize(browserFuncs);
+ NP_GetEntryPoints(pluginFuncs);
+ *shutdown = (NPP_ShutdownProcPtr)&NP_Shutdown;
+}
+#endif
+
+void initPluginModule()
+{
+ if (module == NULL) {
+ module = new NpapiPluginModule();
+ NpapiPluginModule::Default = module;
+ }
+}
+
+NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs)
+{
+ initPluginModule();
+ module->getPluginFuncs(pFuncs);
+ return NPERR_NO_ERROR;
+}
+
+NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs)
+{
+ initPluginModule();
+ module->setNetscapeFuncs(pFuncs);
+
+ return NPERR_NO_ERROR;
+}
+
+NPError OSCALL NP_Shutdown()
+{
+ delete module;
+ module = NULL;
+ return NPERR_NO_ERROR;
+}
41 Mac/projectDef.cmake
@@ -0,0 +1,41 @@
+#/**********************************************************\
+# Auto-generated Mac project definition file for the
+# linphone project
+#\**********************************************************/
+
+# Mac template platform definition CMake file
+# Included from ../CMakeLists.txt
+
+# remember that the current source dir is the project root; this file is in Mac/
+file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ Mac/*.cpp
+ Mac/*.h
+ Mac/*.cmake
+ )
+
+# use this to add preprocessor definitions
+add_definitions(
+
+)
+
+SOURCE_GROUP(Mac FILES ${PLATFORM})
+
+set (SOURCES
+ ${SOURCES}
+ ${PLATFORM}
+ )
+
+set(PLIST "Mac/bundle_template/Info.plist")
+set(STRINGS "Mac/bundle_template/InfoPlist.strings")
+set(LOCALIZED "Mac/bundle_template/Localized.r")
+
+add_mac_plugin(${PROJNAME} ${PLIST} ${STRINGS} ${LOCALIZED} SOURCES)
+
+# add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing!
+target_link_libraries(${PROJNAME}
+ ${PLUGIN_INTERNAL_DEPS}
+ )
+
+add_dependencies(${PROJNAME}
+ ${PLUGIN_INTERNAL_DEPS}
+ )
42 PluginConfig.cmake
@@ -0,0 +1,42 @@
+#/**********************************************************\
+# Auto-Generated Plugin Configuration file
+# for linphone
+#\**********************************************************/
+
+set(PLUGIN_NAME "linphone")
+set(PLUGIN_PREFIX "LIN")
+set(COMPANY_NAME "helemik")
+
+# ActiveX constants:
+set(FBTYPELIB_NAME linphoneLib)
+set(FBTYPELIB_DESC "linphone 1.0 Type Library")
+set(IFBControl_DESC "linphone Control Interface")
+set(FBControl_DESC "linphone Control Class")
+set(IFBComJavascriptObject_DESC "linphone IComJavascriptObject Interface")
+set(FBComJavascriptObject_DESC "linphone ComJavascriptObject Class")
+set(IFBComEventSource_DESC "linphone IFBComEventSource Interface")
+set(AXVERSION_NUM "1")
+
+# NOTE: THESE GUIDS *MUST* BE UNIQUE TO YOUR PLUGIN/ACTIVEX CONTROL! YES, ALL OF THEM!
+set(FBTYPELIB_GUID a05db625-a64e-5b09-addd-b531be8d2717)
+set(IFBControl_GUID 41ac69db-5c55-5dd8-a0fc-f9da4b7cb5b9)
+set(FBControl_GUID feec8296-e15e-5853-8948-95966dcb7053)
+set(IFBComJavascriptObject_GUID 3cfa488f-3842-5742-b07d-055cfd7a35c4)
+set(FBComJavascriptObject_GUID 5f072196-fbfd-59d5-9018-1cb20af8b9b9)
+set(IFBComEventSource_GUID ac62b0b0-15e9-52b6-aad7-da493ecfbb3e)
+
+# these are the pieces that are relevant to using it from Javascript
+set(ACTIVEX_PROGID "helemik.linphone")
+set(MOZILLA_PLUGINID "helemik.cz/linphone")
+
+# strings
+set(FBSTRING_CompanyName "Helemik s.r.o.")
+set(FBSTRING_FileDescription "Linphone API")
+set(FBSTRING_PLUGIN_VERSION "1.0.0")
+set(FBSTRING_LegalCopyright "Copyright 2010 Helemik s.r.o.")
+set(FBSTRING_PluginFileName "np${PLUGIN_NAME}.dll")
+set(FBSTRING_ProductName "linphone")
+set(FBSTRING_FileExtents "")
+set(FBSTRING_PluginName "linphone")
+set(FBSTRING_MIMEType "application/x-linphone")
+
3  README
@@ -0,0 +1,3 @@
+JavaScript binding to Linphone core API
+
+This projects provides linphone core API to JavaScript.
22 Win/FactoryMainWin.cpp
@@ -0,0 +1,22 @@
+/**********************************************************\
+ Default Windows factory methods
+
+ These are used to create the Npapi plugin type and
+ the PluginWindow type on windows; if you want to extend
+ these classses, do so and update these functions to
+ instantiate the correct types.
+\**********************************************************/
+
+#include "Win/FactoryDefinitionsWin.h"
+#include "Win/NpapiPluginWin.h"
+#include "Win/PluginWindowWin.h"
+
+FB::Npapi::NpapiPlugin *_getNpapiPlugin(FB::Npapi::NpapiBrowserHost *host)
+{
+ return new FB::Npapi::NpapiPluginWin(host);
+}
+
+FB::PluginWindowWin *_createPluginWindow(HWND hWnd)
+{
+ return new FB::PluginWindowWin(hWnd);
+}
38 Win/WiX/linphoneInstaller.wxs
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+ <Product Id="{733cfaa6-4094-5344-a6f8-fe897f6a9650}" Name="${PLUGIN_NAME}" Language="1033" Version="${FBSTRING_PLUGIN_VERSION}" Manufacturer="${FBSTRING_CompanyName}" UpgradeCode="fae1332a-1654-56f9-977d-04c459303aa4">
+ <Package InstallerVersion="200" Compressed="yes" Description="Installer for the ${PLUGIN_NAME} plugin" InstallScope="perUser" />
+ <Media Id="1" Cabinet="${PLUGIN_NAME}.cab" EmbedCab="yes" />
+
+ <Directory Id="TARGETDIR" Name="SourceDir">
+ <Directory Id="AppDataFolder">
+ <Directory Id="CompanyDir" Name="${COMPANY_NAME}">
+ <Component Id="CompanyDirComp" Guid="{5844a368-b671-529a-9309-2e91f5f7a633}">
+ <RemoveFolder Id="RemoveCompanyDir" On="uninstall" />
+ <RegistryValue Root="HKCU" Key="SOFTWARE\${COMPANY_NAME}" Name="Uninstall" Type="string" Value="${FBSTRING_PLUGIN_VERSION}" KeyPath="yes" />
+ </Component>
+ <Directory Id="INSTALLDIR" Name="${PLUGIN_NAME}">
+ <Component Id="InstallDirComp" Guid="{0cf83efb-4a5c-56d7-83b0-34c2834aae04}">
+ <RemoveFolder Id="RemoveInstallDir" On="uninstall" />
+ <RegistryValue Root="HKCU" Key="SOFTWARE\${COMPANY_NAME}\${PLUGIN_NAME}" Name="Uninstall" Type="string" Value="${FBSTRING_PLUGIN_VERSION}" KeyPath="yes" />
+ </Component>
+
+ <!-- Put Additional files here: -->
+ <!-- example:
+ <Component Id="UniqueComponentId" Guid="UniqueGUID">
+ <File Id="uniqueFileId" KeyPath="yes" Source="SourceDir\filename.ext" />
+ </Component>
+ /example -->
+ <!-- -->
+ </Directory>
+ </Directory>
+ </Directory>
+ </Directory>
+
+ <Feature Id="MainPluginFeature" Title="${FBSTRING_ProductName}" Level="1">
+ <ComponentRef Id="InstallDirComp"/>
+ <ComponentRef Id="CompanyDirComp"/>
+ <ComponentGroupRef Id="PluginDLLGroup"/>
+ </Feature>
+ </Product>
+</Wix>
34 Win/dllmain.cpp
@@ -0,0 +1,34 @@
+/**********************************************************\
+ Default auto-generated dllmain.cpp
+
+ This file contains DLLMain; don't change this unless you
+ know what you're doing!
+\**********************************************************/
+
+// dllmain.cpp : Implementation of DllMain.
+
+
+#include "Win/win_common.h"
+#include "resource.h"
+#include "axmain.h"
+#include "axutil.h"
+
+STDAPI DllRegisterServer(void);
+
+HINSTANCE gInstance(NULL);
+std::string g_dllPath;
+
+// DLL Entry Point
+extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+ if (!gInstance) {
+ USES_CONVERSION;
+ gInstance = hInstance;
+ LPTSTR strDLLPath1 = new TCHAR[_MAX_PATH];
+ ::GetModuleFileName(gInstance, strDLLPath1, _MAX_PATH);
+
+ g_dllPath = CW2A(strDLLPath1);
+ }
+ return _AtlModule.DllMain(dwReason, lpReserved);
+}
+
45 Win/np_winmain.cpp
@@ -0,0 +1,45 @@
+/**********************************************************\
+ Default auto-generated np_winmain.cpp
+
+ This file contains the entrypoints for a windows NPAPI
+ plugin. Don't change this unless you know what you're
+ doing!
+\**********************************************************/
+
+#include "Win/win_common.h"
+
+#include "NpapiTypes.h"
+#include "NpapiPluginModule.h"
+
+using namespace FB::Npapi;
+FB::Npapi::NpapiPluginModule *module = NULL;
+
+void initPluginModule()
+{
+ if (module == NULL) {
+ module = new NpapiPluginModule();
+ NpapiPluginModule::Default = module;
+ }
+}
+
+NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs)
+{
+ initPluginModule();
+ module->getPluginFuncs(pFuncs);
+ return NPERR_NO_ERROR;
+}
+
+NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs)
+{
+ initPluginModule();
+ module->setNetscapeFuncs(pFuncs);
+
+ return NPERR_NO_ERROR;
+}
+
+NPError OSCALL NP_Shutdown()
+{
+ delete module;
+ module = NULL;
+ return NPERR_NO_ERROR;
+}
58 Win/projectDef.cmake
@@ -0,0 +1,58 @@
+#/**********************************************************\
+# Auto-generated Windows project definition file for the
+# linphone project
+#\**********************************************************/
+
+# Windows template platform definition CMake file
+# Included from ../CMakeLists.txt
+
+# remember that the current source dir is the project root; this file is in Win/
+file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ Win/*.cpp
+ Win/*.h
+ Win/*.cmake
+ )
+
+# use this to add preprocessor definitions
+add_definitions(
+ /D "_ATL_STATIC_REGISTRY"
+)
+
+SOURCE_GROUP(Win FILES ${PLATFORM})
+
+set (SOURCES
+ ${SOURCES}
+ ${PLATFORM}
+ )
+
+add_library(${PROJNAME} SHARED ${SOURCES})
+
+set_target_properties (${PROJNAME} PROPERTIES
+ OUTPUT_NAME np${PLUGIN_NAME}
+ PROJECT_LABEL ${PROJNAME}
+ RUNTIME_OUTPUT_DIRECTORY "${BIN_DIR}/${PLUGIN_NAME}"
+ LIBRARY_OUTPUT_DIRECTORY "${BIN_DIR}/${PLUGIN_NAME}"
+ )
+
+# add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing!
+target_link_libraries(${PROJNAME}
+ ${PLUGIN_INTERNAL_DEPS}
+ )
+
+add_dependencies(${PROJNAME}
+ ${PLUGIN_INTERNAL_DEPS}
+ )
+
+set(WIX_HEAT_FLAGS
+ -gg # Generate GUIDs
+ -srd # Suppress Root Dir
+ -cg PluginDLLGroup # Set the Component group name
+ -dr INSTALLDIR # Set the directory ID to put the files in
+ )
+add_wix_installer( ${PLUGIN_NAME}
+ ${CMAKE_CURRENT_SOURCE_DIR}/Win/WiX/linphoneInstaller.wxs
+ PluginDLLGroup
+ ${BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/
+ ${BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/np${PLUGIN_NAME}.dll
+ ${PROJNAME}
+ )
23 X11/FactoryMainX11.cpp
@@ -0,0 +1,23 @@
+/**********************************************************\
+ Default X11 factory methods
+
+ These are used to create the Npapi plugin type and
+ the PluginWindow type on x11 (*nix); if you want to extend
+ these classses, do so and update these functions to
+ instantiate the correct types.
+\**********************************************************/
+
+#include <gtk/gtk.h>
+#include "NpapiPlugin.h"
+#include "X11/PluginWindowX11.h"
+#include "X11/NpapiPluginX11.h"
+
+FB::Npapi::NpapiPlugin *_getNpapiPlugin(FB::Npapi::NpapiBrowserHost *host)
+{
+ return new FB::Npapi::NpapiPluginX11(host);
+}
+
+FB::PluginWindowX11 *_createPluginWindow(GdkNativeWindow win)
+{
+ return new FB::PluginWindowX11(win);
+}
50 X11/np_x11main.cpp
@@ -0,0 +1,50 @@
+/**********************************************************\
+ Default auto-generated np_x11main.cpp
+
+ This file contains the entrypoints for a *nix NPAPI
+ plugin. Don't change this unless you know what you're
+ doing!
+\**********************************************************/
+
+#include "config.h"
+#include "NpapiTypes.h"
+#include "NpapiPluginModule.h"
+
+using namespace FB::Npapi;
+FB::Npapi::NpapiPluginModule *module = NULL;
+
+void initPluginModule()
+{
+ if (module == NULL) {
+ module = new NpapiPluginModule();
+ NpapiPluginModule::Default = module;
+ }
+}
+
+extern "C" char * NP_GetMIMEDescription()
+{
+ return (char *)FBSTRING_X11MIMEType;
+}
+
+extern "C" NPError NP_GetValue(void *future, NPPVariable variable, void *value)
+{
+ initPluginModule();
+ return module->NPP_GetValue((NPP_t *)future, variable, value);
+}
+
+extern "C" NPError NP_Initialize(NPNetscapeFuncs* pFuncs
+ , NPPluginFuncs *pluginFuncs)
+{
+ initPluginModule();
+ module->getPluginFuncs(pluginFuncs);
+ module->setNetscapeFuncs(pFuncs);
+
+ return NPERR_NO_ERROR;
+}
+
+extern "C" NPError NP_Shutdown()
+{
+ delete module;
+ module = NULL;
+ return NPERR_NO_ERROR;
+}
36 X11/projectDef.cmake
@@ -0,0 +1,36 @@
+#/**********************************************************\
+# Auto-generated X11 project definition file for the
+# linphone project
+#\**********************************************************/
+
+# X11 template platform definition CMake file
+# Included from ../CMakeLists.txt
+
+# remember that the current source dir is the project root; this file is in ${PLATFORM_NAME}/
+file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ ${PLATFORM_NAME}/*.cpp
+ ${PLATFORM_NAME}/*.h
+ ${PLATFORM_NAME}/*.cmake
+ )
+
+SOURCE_GROUP(${PLATFORM_NAME} FILES ${PLATFORM})
+
+# use this to add preprocessor definitions
+add_definitions(
+)
+
+set (SOURCES
+ ${SOURCES}
+ ${PLATFORM}
+ )
+
+add_x11_plugin(${PROJNAME} SOURCES)
+
+# add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing!
+target_link_libraries(${PROJNAME}
+ ${PLUGIN_INTERNAL_DEPS}
+ )
+
+add_dependencies(${PROJNAME}
+ ${PLUGIN_INTERNAL_DEPS}
+ )
15 doc/firebreath-howto.txt
@@ -0,0 +1,15 @@
+fbgen questions?
+ - prepare list of properties, methods and events first and fbgen will prepare 'em
+ - how to add include path for gcc?
+ - how to add statically linked library?
+ - add install target - copy *.so to firefox dir
+
+./fbgen.py
+update files
+prepmake.sh
+compile linphone with -fPIC
+edit CMakeFiles/test1.dir/flags.make, link.txt
+make in build/
+
+
+linphone libraries: ../coreapi/liblinphone.la ../mediastreamer2/src/libmediastreamer.la ../oRTP/src/libortp.la -lspeex -losipparser2 -losip2
32 doc/js-api.txt
@@ -0,0 +1,32 @@
+JavaScript API
+
+methods:
+ start() - start linphone core
+ quit() - quit
+ addAuthInfo(username, realm, password)
+ addProxy(identity, proxy-url)
+ register(identity, proxy, password) - try to register to a proxy
+ accept() - accepts incoming call
+ terminate() - terminate call
+ call(sip uri) - make new call
+ refer(sip uri) - refer call to someone else
+ getHookState() -> int, get hook state as integer, you can parse it bit per bit
+
+
+properties:
+ autoAnswer = false - answer automatically
+ captureVideo = false - allow video capturing in video calls
+ showVideo = false - show video window when video call
+
+
+events:
+ onAuthInfoRequested(realm, username) - fired when registration needs auth data.
+ onMessage(string msg)
+ onStatus(string msg)
+ onWarning(string msg)
+ onURL(string msg, url)
+ onCall(string caller)
+ onHangUp(string caller)
+ onDTMF(int code)
+ onStateChange(int newState, string msg)
+ onLog(level, msg)
87 doc/linphone-core-howto.txt
@@ -0,0 +1,87 @@
+linhpone how to get registered to a proxy
+
+1/ create auth_info
+2/ fill it - at least username, password and realm can be used too but not necessary.
+3/ add_auth_info - add it to lcore (than you can destroy it by auth_info_destroy)
+
+4/ get proxy config list
+5/ find proxy config that you want, or create new proxy config if none exists (if you're editing proxy, mark is as 'in use' by proxy_config_edit)
+6/ update proxy config parameters (ser identity and proxy, and optionally realm)
+7/ enable registering on this proxy
+8/ unmark 'in-use' by proxy_config_done (if editing old config) or add it to lcore by add_proxy_config
+
+9/ optionally, set is as default config (for outgoing calls)
+
+10/ wait, if all ok, you'll get registered
+ otherwise
+ a/ you can abort it by linphone_core_abort_authentication
+ b/ auth_info_requested callback will be called (with username and realm as params)
+ c/ create new auth info, fill it with username, realm and password
+ d/ add it to lcore
+ e/ if ok, you'll get registered
+
+
+
+
+how to answer call
+1/ inv_recv event is invoked (with caller as argument)
+2/ call linphone_core_accept_call. You can use caller as second argument, of just let it NULL to answer the unique incoming call
+3/ or you can terminate it by linphone_core_terminate_call (again with or without caller name)
+4/ when the call is terminated, bye_recv event is fired
+
+
+
+how to start new call out:
+1/ ivite other side by linphone_core_invite(uri)
+
+
+refer call:
+1/ linphone_core_refer(new destination)
+
+
+
+how to quit:
+1/ terminate call (never mind if there's no call present at the time)
+2/ destroy it by linphone_core_destroy
+
+
+
+how to initialize:
+1/ prepare VTable
+2/ create lcore with linphone_core_new
+3/ prepare thread, which will call core_iterate() periodically (with sleep about 20ms; gotta be thread safe)
+
+
+how to traverse nat:
+1/ set stun server with linphone_core_set_stun_server(servername)
+!!! FIND MORE INFO
+
+
+how to record or play wavs
+....
+
+
+
+how to unregister
+1/ get config by linphone_core_get_default_proxy
+2/ check, whether it's registered
+3/ mark cfg as editing
+4/ unset register flag
+5/ store proxy config
+
+
+how to get hook state:
+1/ call linphone_core_get_state
+2/ parse it bit per bit
+3/ register state - for each config get linphone_proxy_config_is_registered
+
+
+how to enable or disable video
+1/ linphone_core_enable_video(linphonec,vcap_enabled,display_enabled);
+
+
+how to work with logs
+1/ to enable logs to file, call linphone_core_enable_logs(FILE *)
+2/ to enable logs to std out, use null as argument
+3/ to disable logs completely, call linphone_core_disable_logs()
+4/ when you want to process logs using callback function, define cb(level, format, args) and call linphone_core_enable_logs_with_cb(cb)
71 linphone.cpp
@@ -0,0 +1,71 @@
+/**********************************************************\
+
+ Auto-generated linphone.cpp
+
+ This file contains the auto-generated main plugin object
+ implementation for the linphone project
+
+\**********************************************************/
+
+#include "NpapiTypes.h"
+#include "linphoneAPI.h"
+
+#include "linphone.h"
+
+void linphone::StaticInitialize()
+{
+ // Place one-time initialization stuff here; note that there isn't an absolute guarantee that
+ // this will only execute once per process, just a guarantee that it won't execute again until
+ // after StaticDeinitialize is called
+ printf("juzna: first init\n");
+}
+
+void linphone::StaticDeinitialize()
+{
+ // Place one-time deinitialization stuff here
+ printf("juzna: last init\n");
+}
+
+
+linphone::linphone()
+{
+}
+
+linphone::~linphone()
+{
+}
+
+FB::JSAPI* linphone::createJSAPI()
+{
+ // m_host is the BrowserHostWrapper
+ return new linphoneAPI(m_host);
+}
+
+bool linphone::onMouseDown(FB::MouseDownEvent *evt, FB::PluginWindow *)
+{
+ //printf("Mouse down at: %d, %d\n", evt->m_x, evt->m_y);
+ return false;
+}
+
+bool linphone::onMouseUp(FB::MouseUpEvent *evt, FB::PluginWindow *)
+{
+ //printf("Mouse up at: %d, %d\n", evt->m_x, evt->m_y);
+ return false;
+}
+
+bool linphone::onMouseMove(FB::MouseMoveEvent *evt, FB::PluginWindow *)
+{
+ //printf("Mouse move at: %d, %d\n", evt->m_x, evt->m_y);
+ return false;
+}
+bool linphone::onWindowAttached(FB::AttachedEvent *evt, FB::PluginWindow *)
+{
+ // The window is attached; act appropriately
+ return false;
+}
+
+bool linphone::onWindowDetached(FB::DetachedEvent *evt, FB::PluginWindow *)
+{
+ // The window is about to be detached; act appropriately
+ return false;
+}
50 linphone.h
@@ -0,0 +1,50 @@
+/**********************************************************\
+
+ Auto-generated linphone.cpp
+
+ This file contains the auto-generated main plugin object
+ implementation for the linphone project
+
+\**********************************************************/
+#ifndef H_linphonePLUGIN
+#define H_linphonePLUGIN
+
+#include "PluginWindow.h"
+#include "PluginEvents/MouseEvents.h"
+#include "PluginEvents/AttachedEvent.h"
+
+#include "PluginCore.h"
+
+class linphone : public FB::PluginCore
+{
+public:
+ static void StaticInitialize();
+ static void StaticDeinitialize();
+
+public:
+ linphone();
+ virtual ~linphone();
+
+public:
+ virtual FB::JSAPI* createJSAPI();
+ virtual bool IsWindowless() { return false; }
+
+ BEGIN_PLUGIN_EVENT_MAP()
+ EVENTTYPE_CASE(FB::MouseDownEvent, onMouseDown, FB::PluginWindow)
+ EVENTTYPE_CASE(FB::MouseUpEvent, onMouseUp, FB::PluginWindow)
+ EVENTTYPE_CASE(FB::MouseMoveEvent, onMouseMove, FB::PluginWindow)
+ EVENTTYPE_CASE(FB::MouseMoveEvent, onMouseMove, FB::PluginWindow)
+ EVENTTYPE_CASE(FB::AttachedEvent, onWindowAttached, FB::PluginWindow)
+ EVENTTYPE_CASE(FB::DetachedEvent, onWindowDetached, FB::PluginWindow)
+ END_PLUGIN_EVENT_MAP()
+
+ /** BEGIN EVENTDEF -- DON'T CHANGE THIS LINE **/
+ virtual bool onMouseDown(FB::MouseDownEvent *evt, FB::PluginWindow *);
+ virtual bool onMouseUp(FB::MouseUpEvent *evt, FB::PluginWindow *);
+ virtual bool onMouseMove(FB::MouseMoveEvent *evt, FB::PluginWindow *);
+ virtual bool onWindowAttached(FB::AttachedEvent *evt, FB::PluginWindow *);
+ virtual bool onWindowDetached(FB::DetachedEvent *evt, FB::PluginWindow *);
+ /** END EVENTDEF -- DON'T CHANGE THIS LINE **/
+};
+
+#endif
359 linphoneAPI.cpp
@@ -0,0 +1,359 @@
+/**********************************************************\
+
+ Auto-generated linphoneAPI.cpp
+
+\**********************************************************/
+
+#include "BrowserObjectAPI.h"
+#include "variant_list.h"
+#include "DOM/JSAPI_DOMDocument.h"
+
+static void * instance = NULL;
+
+#include "linphoneAPI.h"
+
+// Global callbacks which wraps linphoneAPI object methods
+// #define GLC printf("x %u %u\n", lc, linphone_core_get_user_data(lc)); if(!linphone_core_get_user_data(lc)) printf("not found linphone api\n"); else ((linphoneAPI*) linphone_core_get_user_data(lc))
+#define GLC ((linphoneAPI*) instance)
+static void cb_lcb_call_received(LinphoneCore *lc, const char *from) { GLC->lcb_call_received(lc, from); }
+static void cb_lcb_bye_received(LinphoneCore *lc, const char *from) { GLC->lcb_bye_received(lc, from); }
+static void cb_lcb_notify_received(LinphoneCore *lc, LinphoneFriend *fid, const char *url, const char *status, const char *img) { GLC->lcb_notify_received(lc, fid, url, status, img); }
+static void cb_lcb_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username) { GLC->lcb_auth_info_requested(lc, realm, username); }
+static void cb_lcb_display_status(LinphoneCore *lc, const char *message) { GLC->lcb_display_status(lc, message); }
+
+static void cb_lcb_display_something(LinphoneCore *lc, const char *message) { GLC->lcb_display_something(lc, message); }
+static void cb_lcb_display_warning(LinphoneCore *lc, const char *message) { GLC->lcb_display_warning(lc, message); }
+static void cb_lcb_display_url(LinphoneCore *lc, const char *something, const char *url) { GLC->lcb_display_url(lc, something, url); }
+static void cb_lcb_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, const char *from, const char *msg) { GLC->lcb_text_received(lc, cr, from, msg); }
+static void cb_lcb_general_state(LinphoneCore *lc, LinphoneGeneralState *gstate) { GLC->lcb_general_state(lc, gstate); }
+static void cb_lcb_dtmf_received(LinphoneCore *lc, int dtmf) { GLC->lcb_dtmf_received(lc, dtmf); }
+
+
+
+linphoneAPI::linphoneAPI(FB::BrowserHostWrapper *host) : m_host(host)
+{
+ printf("creating new plugin instance\n");
+
+ // Register exported methods
+ rmethod(start);
+ rmethod(quit);
+ rmethod(addAuthInfo);
+ rmethod(addProxy);
+ rmethod(accept);
+ rmethod(terminate);
+ rmethod(call);
+ rmethod(refer);
+ rmethod(getHookState);
+
+ // Register properties
+ rproperty(autoAnswer);
+ rproperty(captureVideo);
+ rproperty(showVideo);
+ rpropertyg(registered);
+
+ // Register events
+ registerEvent("onAuthInfoRequested");
+ registerEvent("onMessage");
+ registerEvent("onStatus");
+ registerEvent("onWarning");
+ registerEvent("onURL");
+ registerEvent("onCall");
+ registerEvent("onHangUp");
+ registerEvent("onDTMF");
+ registerEvent("onStateChange");
+ registerEvent("onLog");
+ registerEvent("onProxyAdded");
+
+ // Initialize mutex
+ pthread_mutex_init(&mutex, NULL);
+
+ // Initialize as null pointer
+ lin = NULL;
+ iterate_thread = NULL;
+}
+
+linphoneAPI::~linphoneAPI()
+{
+ printf("deallocating plugin instance\n");
+
+ // Quit first
+ call_quit();
+}
+
+/**
+* Initialie linphone core and start iterate thread
+*/
+bool linphoneAPI::call_start(void) {
+ if(lin) return false; // Already initialized
+
+ Lock lck(&mutex, NULL);
+
+ // Initialize callback table
+ lin_vtable.show = (ShowInterfaceCb) stub;
+ lin_vtable.inv_recv = mcb(lcb_call_received);
+ lin_vtable.bye_recv = mcb(lcb_bye_received);
+ lin_vtable.notify_recv = (NotifyReceivedCb) stub;
+ lin_vtable.new_unknown_subscriber = (NewUnknownSubscriberCb) stub;
+ lin_vtable.auth_info_requested = mcb(lcb_auth_info_requested);
+ lin_vtable.display_status = mcb(lcb_display_status);
+ lin_vtable.display_message = mcb(lcb_display_something);
+ lin_vtable.display_warning = mcb(lcb_display_warning);
+ lin_vtable.display_url = mcb(lcb_display_url);
+ lin_vtable.display_question = (DisplayQuestionCb) stub;
+ lin_vtable.text_received = mcb(lcb_text_received);
+ lin_vtable.general_state = mcb(lcb_general_state);
+ lin_vtable.dtmf_received = mcb(lcb_dtmf_received);
+
+ char configfile_name[PATH_MAX];
+ snprintf(configfile_name, PATH_MAX, "%s/.linphonerc", getenv("HOME"));
+
+ // Create linphone core
+ instance = this;
+ lin = linphone_core_new(&lin_vtable, NULL, NULL, (void *) this);
+ printf("linphone initialized, %u %u, %u\n", (void *)this, linphone_core_get_user_data(lin), lin->data);
+
+
+ // Disable/enable logs
+ linphone_core_disable_logs();
+ //linphone_core_enable_logs(stdout);
+
+ linphone_core_set_firewall_policy(lin, LINPHONE_POLICY_USE_STUN);
+ linphone_core_set_stun_server(lin, "stun.helemik.cz");
+
+ // Initialize iterating thread
+ iterate_thread_running = true;
+ ortp_thread_create(&iterate_thread,NULL, iterate_thread_main, this);
+
+ return true;
+}
+
+/**
+* Thread, which iterates in linphone core each 20ms
+*/
+static void *iterate_thread_main(void*p){
+ linphoneAPI *t = (linphoneAPI*) p; // Get main object
+ printf("iterate thread started\n");
+
+ while(t->iterate_thread_running) {
+ t->iterateWithMutex();
+ usleep(20000);
+ }
+ printf("iterate thread stopped\n");
+}
+
+
+/**
+* Quit linphone core: stop iterate thread
+*/
+bool linphoneAPI::call_quit(void) {
+ if(!lin) return false;
+
+ {
+ Lock lck(&mutex, "terminate call");
+
+ // Terminate call
+ linphone_core_terminate_call(lin, NULL);
+ }
+
+ // Stop iterating
+ iterate_thread_running = false;
+ ortp_thread_join(iterate_thread,NULL);
+ printf("iterate thread joined\n");
+
+ // Destroy linphone core
+ linphone_core_destroy(lin);
+
+ return true;
+}
+
+/**
+* Add authentication info
+*/
+void linphoneAPI::call_addAuthInfo(std::string username, std::string realm, std::string passwd) {
+ Lock lck(&mutex, "add auth info");
+ LinphoneAuthInfo *info;
+
+ info = linphone_auth_info_new(username.c_str(), NULL, passwd.c_str(), NULL, realm.c_str());
+ linphone_core_add_auth_info(lin, info);
+ linphone_auth_info_destroy(info);
+}
+
+/**
+* Add proxy server
+*/
+void linphoneAPI::call_addProxy(std::string proxy, std::string identity) {
+ {
+ Lock lck(&mutex, "add proxy");
+
+ LinphoneProxyConfig *cfg;
+ cfg = linphone_proxy_config_new();
+
+ linphone_proxy_config_set_identity(cfg, identity.c_str());
+ linphone_proxy_config_set_server_addr(cfg, proxy.c_str());
+ linphone_proxy_config_enable_register(cfg, TRUE);
+
+ // finish the config
+ linphone_core_add_proxy_config(lin, cfg);
+
+ // set config as default proxy
+ linphone_core_set_default_proxy(lin, cfg);
+ }
+
+ //FireEvent("onProxyAdded", FB::variant_list_of(proxy)(identity));
+}
+
+/**
+* Accept incoming call
+*/
+bool linphoneAPI::call_accept(void) {
+ Lock lck(&mutex, "accept");
+ return linphone_core_accept_call(lin, NULL) != -1;
+}
+
+/**
+* Terminate actual call
+*/
+bool linphoneAPI::call_terminate(void) {
+ Lock lck(&mutex, "terminate");
+ return linphone_core_terminate_call(lin, NULL) != -1;
+}
+
+/**
+* Initialize new call
+*/
+bool linphoneAPI::call_call(std::string uri) {
+ Lock lck(&mutex, "call");
+ if(-1 == linphone_core_invite(lin, uri.c_str())) {
+ return false;
+ }
+ else {
+ callee = uri;
+ return false;
+ }
+}
+
+/**
+* Refer call to someone else
+*/
+bool linphoneAPI::call_refer(std::string uri) {
+ return linphone_core_refer(lin, uri.c_str()) != -1;
+}
+
+/**
+* Get hook state
+*/
+int linphoneAPI::call_getHookState(void) {
+ Lock lck(&mutex, "get hook state");
+ gstate_t call_state = linphone_core_get_state(lin, GSTATE_GROUP_CALL);
+ return call_state;
+}
+
+// Property manipulation methods
+bool linphoneAPI::get_autoAnswer(void) {
+ return m_autoAnswer;
+}
+
+void linphoneAPI::set_autoAnswer(bool x) {
+ m_autoAnswer = x;
+}
+
+bool linphoneAPI::get_captureVideo(void) {
+ return m_captureVideo;
+}
+
+void linphoneAPI::set_captureVideo(bool x) {
+ m_captureVideo = x;
+ linphone_core_enable_video(lin, m_captureVideo, m_showVideo);
+}
+
+bool linphoneAPI::get_showVideo(void) {
+ return m_showVideo;
+}
+
+void linphoneAPI::set_showVideo(bool x) {
+ m_showVideo = x;
+ linphone_core_enable_video(lin, m_captureVideo, m_showVideo);
+}
+
+bool linphoneAPI::get_registered(void) {
+ Lock lck(&mutex, "get-registered");
+
+ LinphoneProxyConfig *cfg;
+ int ret;
+
+ linphone_core_get_default_proxy(lin, &cfg); // Get default proxy
+ if(!cfg) {
+ printf("get registered: no proxy present\n");
+ return false;
+ }
+ ret = linphone_proxy_config_is_registered(cfg);
+
+ printf("get registered: got cfg %u; %d\n", cfg, ret);
+
+ if(cfg) return ret > 0;
+ else return false;
+}
+
+
+/*
+* Callbacks
+*/
+
+
+void linphoneAPI::lcb_call_received(LinphoneCore *lc, const char *from) {
+ caller = from;
+ if(m_autoAnswer) linphone_core_accept_call(lin, NULL); // Auto accept
+
+ printf("new call from %s\n", from);
+
+ // Fire event
+ FireEvent("onCall", FB::variant_list_of(caller)(m_autoAnswer));
+}
+
+void linphoneAPI::lcb_bye_received(LinphoneCore *lc, const char *from) {
+ printf("hanged up from %s\n", from);
+
+ // Fire event
+ FireEvent("onHangUp", FB::variant_list_of(std::string(from)));
+}
+
+void linphoneAPI::lcb_notify_received(LinphoneCore *lc, LinphoneFriend *fid, const char *url, const char *status, const char *img) {}
+void linphoneAPI::lcb_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username) {
+ printf("auth info requested for %s on %s\n", username, realm);
+ FireEvent("onAuthInfoRequested", FB::variant_list_of(realm)(username));
+}
+void linphoneAPI::lcb_display_status(LinphoneCore *lc, const char *message) {
+ printf("status warning: %s\n", message);
+ FireEvent("onStatus", FB::variant_list_of(message));
+}
+void linphoneAPI::lcb_display_something(LinphoneCore *lc, const char *message) {
+ printf("something: %s\n", message);
+ //FireEvent("onStatus", FB::variant_list_of(message));
+}
+void linphoneAPI::lcb_display_warning(LinphoneCore *lc, const char *message) {
+ printf("Linphone warning: %s\n", message);
+ FireEvent("onWarning", FB::variant_list_of(message));
+}
+void linphoneAPI::lcb_display_url(LinphoneCore * lc, const char *something, const char *url) {
+ FireEvent("onURL", FB::variant_list_of(something)(url));
+}
+void linphoneAPI::lcb_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, const char *from, const char *msg) {
+ FireEvent("onMessage", FB::variant_list_of(from)(msg));
+}
+void linphoneAPI::lcb_general_state(LinphoneCore *lc, LinphoneGeneralState *gstate) {
+ int state = gstate->new_state;
+ printf("new state: %u\n", state);
+ if(gstate->message) printf(" %s\n", gstate->message);
+ FireEvent("onStateChange", FB::variant_list_of(state));
+}
+void linphoneAPI::lcb_dtmf_received(LinphoneCore *lc, int dtmf) {
+ printf("DTMF received: %d\n", dtmf);
+ FireEvent("onDTMF", FB::variant_list_of(dtmf));
+}
+
+
+
+// Other methods
+void linphoneAPI::log(std::string) {
+ // TODO: do log
+}
125 linphoneAPI.h
@@ -0,0 +1,125 @@
+/**********************************************************\
+
+ Auto-generated linphoneAPI.h
+
+\**********************************************************/
+
+#include <string>
+#include <sstream>
+#include <cstdio>
+#include <cstdlib>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <cerrno>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <sys/un.h>
+
+#include <sys/time.h>
+#include <unistd.h>
+#include <signal.h>
+#include "private.h" /*coreapi/private.h, needed for LINPHONE_VERSION */
+#include <limits.h>
+#include <ctype.h>
+
+#include <linphonecore.h>
+
+#include "ortp/ortp.h"
+
+#include "JSAPIAuto.h"
+#include "BrowserHostWrapper.h"
+
+#include <pthread.h>
+
+#ifndef H_linphoneAPI
+#define H_linphoneAPI
+
+
+/* Lock class */
+class Lock {
+public:
+ Lock(pthread_mutex_t* plock, char* from) { if(from) printf("locking mutex: "); pthread_mutex_lock(_lock = plock); if(_from = from) printf("locked from %s\n", from); }
+ ~Lock() { if(_from) printf("unlocking mutex: %s\n", _from); pthread_mutex_unlock(_lock); }
+
+private:
+ pthread_mutex_t* _lock;
+ char *_from;
+};
+
+#define mmethod(name) make_method(this, &linphoneAPI::name)
+#define rmethod(name) registerMethod(#name, make_method(this, &linphoneAPI::call_##name))
+#define rmethod2(name, func) registerMethod(#name, make_method(this, &linphoneAPI::call_##func))
+#define rproperty(name) registerProperty(#name, make_property(this, &linphoneAPI::get_##name, &linphoneAPI::set_##name))
+#define rpropertyg(name) registerProperty(#name, make_property(this, &linphoneAPI::get_##name))
+#define mcb(name) cb_##name
+
+class linphoneAPI : public FB::JSAPIAuto
+{
+public:
+ linphoneAPI(FB::BrowserHostWrapper *host);
+ virtual ~linphoneAPI();
+
+ // Exported methods
+ bool call_start(void);
+ bool call_quit(void);
+ void call_addAuthInfo(std::string username, std::string realm, std::string password);
+ void call_addProxy(std::string proxy, std::string identity);
+ bool call_accept(void);
+ bool call_terminate(void);
+ bool call_call(std::string uri);
+ bool call_refer(std::string uri);
+ int call_getHookState(void);
+
+ // Property manipulation methods
+ bool get_autoAnswer(void);
+ void set_autoAnswer(bool);
+ bool get_captureVideo(void);
+ void set_captureVideo(bool);
+ bool get_showVideo(void);
+ void set_showVideo(bool);
+ bool get_registered(void);
+
+ // Linhpone core callbacks
+ void lcb_call_received(LinphoneCore *lc, const char *from); // New call received
+ void lcb_bye_received(LinphoneCore *lc, const char *from); // Call is terminated by the other side
+ void lcb_notify_received(LinphoneCore *lc, LinphoneFriend *fid, const char *url, const char *status, const char *img);
+ void lcb_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username);
+ void lcb_display_status(LinphoneCore *lc, const char *message);
+ void lcb_display_something(LinphoneCore *lc, const char *message);
+ void lcb_display_warning(LinphoneCore *lc, const char *message);
+ void lcb_display_url(LinphoneCore * lc, const char *something, const char *url);
+ void lcb_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, const char *from, const char *msg);
+ void lcb_general_state(LinphoneCore * lc, LinphoneGeneralState *gstate);
+ void lcb_dtmf_received(LinphoneCore *lc, int dtmf);
+
+ // Other methods
+ void log(std::string);
+
+ void lock() { pthread_mutex_lock(&mutex); }
+ void unlock() { pthread_mutex_unlock(&mutex); }
+ void iterate() { if(lin) linphone_core_iterate(lin); }
+ void iterateWithMutex() { lock(); iterate(); unlock(); }
+
+
+private:
+ FB::AutoPtr<FB::BrowserHostWrapper> m_host;
+ bool m_autoAnswer;
+ bool m_captureVideo;
+ bool m_showVideo;
+
+ LinphoneCore *lin; // Linphone core object
+ LinphoneCoreVTable lin_vtable; // Linphone callback methods table
+ pthread_mutex_t mutex; // Mutex for serializing core calls
+ ortp_thread_t iterate_thread; // Iterate thread
+ std::string callee; // Who do we call
+ std::string caller; // Who is calling
+
+public: bool iterate_thread_running; // Indicate, when should iterate thread stop
+};
+
+static void stub () {}
+static void* iterate_thread_main(void *p); // Main function for iterate thread
+
+#endif // H_linphoneAPI
+
Please sign in to comment.
Something went wrong with that request. Please try again.