├── .gitignore
├── .gitmodules
├── CMakeLists.txt
├── COPYING
├── Common
├── clean_js.py
├── common.cmake
├── concat_files.py
├── copy.py
├── crxmake.py
├── icon16.png
├── icon48.png
├── icon64.png
├── importlib.py
├── mac_rpath.py
├── regex.py
├── sdk.cmake
├── signtool.py
└── xpisign.py
├── Doc
├── APIWeb.ods
├── plugin_specifics.js
├── script.sh
└── tutorials
│ ├── README
│ ├── call.html
│ ├── chat.html
│ ├── file_transfer.html
│ ├── login.html
│ ├── logo.png
│ ├── plugin.html
│ ├── presence.html
│ ├── utils.js
│ └── video.html
├── GETTING_STARTED.md
├── LICENSE.md
├── Mac
├── CRX
│ └── manifest.json
├── PKG.pmdoc
│ ├── 01linphone-contents.xml
│ ├── 01linphone.xml
│ ├── index.xml
│ └── scripts
│ │ └── remove-old-install.sh
├── XPI
│ ├── bootstrap.js
│ ├── chrome.manifest
│ └── install.rdf
├── bundle_template
│ ├── Info.plist
│ ├── InfoPlist.strings
│ └── Localized.r
├── projectDef.cmake
├── videowindowmac.h
└── videowindowmac.mm
├── PluginConfig.cmake
├── README.md
├── Src
├── addressapi.cpp
├── addressapi.h
├── authinfoapi.cpp
├── authinfoapi.h
├── base64.cpp
├── base64.h
├── callapi.cpp
├── callapi.h
├── calllogapi.cpp
├── calllogapi.h
├── callparamsapi.cpp
├── callparamsapi.h
├── callstatsapi.cpp
├── callstatsapi.h
├── chatmessageapi.cpp
├── chatmessageapi.h
├── chatroomapi.cpp
├── chatroomapi.h
├── contentapi.cpp
├── contentapi.h
├── coreapi.cpp
├── coreapi.h
├── coreplugin.cpp
├── coreplugin.h
├── errorinfoapi.cpp
├── errorinfoapi.h
├── factory.cpp
├── factoryapi.cpp
├── factoryapi.h
├── filemanagerapi.cpp
├── filemanagerapi.h
├── friendapi.cpp
├── friendapi.h
├── lpconfigapi.cpp
├── lpconfigapi.h
├── macro.h
├── msvideosizeapi.cpp
├── msvideosizeapi.h
├── payloadtypeapi.cpp
├── payloadtypeapi.h
├── presenceapi.cpp
├── presenceapi.h
├── proxyconfigapi.cpp
├── proxyconfigapi.h
├── siptransportsapi.cpp
├── siptransportsapi.h
├── tunnelapi.cpp
├── tunnelapi.h
├── tunnelconfigapi.cpp
├── tunnelconfigapi.h
├── utils.cpp
├── utils.h
├── videoapi.cpp
├── videoapi.h
├── videoplugin.cpp
├── videoplugin.h
├── videopolicyapi.cpp
├── videopolicyapi.h
├── videowindow.h
├── whiteboard.cpp
├── whiteboard.h
├── wrapperapi.cpp
└── wrapperapi.h
├── Tools
├── convert.sh
├── crx2zip.py
└── download.sh
├── Transfers
├── downloadfiletransferapi.cpp
├── downloadfiletransferapi.h
├── filestreamhelper.h
├── filetransferapi.cpp
├── filetransferapi.h
├── localfiletransferapi.cpp
├── localfiletransferapi.h
├── uploadfiletransferapi.cpp
└── uploadfiletransferapi.h
├── Win
├── CRX
│ └── manifest.json
├── WiX
│ ├── linphone-web.ddf
│ ├── linphone-web.inf
│ ├── linphone.ico
│ └── linphoneInstaller.wxs
├── XPI
│ ├── bootstrap.js
│ ├── chrome.manifest
│ └── install.rdf
├── projectDef.cmake
├── videowindowwin.cpp
└── videowindowwin.h
└── X11
├── CRX
└── manifest.json
├── XPI
├── bootstrap.js
├── chrome.manifest
└── install.rdf
├── projectDef.cmake
├── videowindowx11.cpp
└── videowindowx11.h
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_store
2 | *~
3 | .kdev4/
4 | *.kdev4
5 | /Sign/
6 | /Rootfs/
7 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "Core"]
2 | path = Core
3 | url = git://git.linphone.org/linphone-cmake-builder.git
4 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | ##
2 | # Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | # Copyright (C) 2012-2014 Belledonne Communications
4 | #
5 | # This program is free software; you can redistribute it and/or
6 | # modify it under the terms of the GNU General Public License
7 | # as published by the Free Software Foundation; either version 2
8 | # of the License, or (at your option) any later version.
9 | #
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with this program; if not, write to the Free Software
17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 | ##
19 |
20 | # Written to work with cmake 2.6
21 | cmake_minimum_required (VERSION 2.6)
22 | set (CMAKE_BACKWARDS_COMPATIBILITY 2.6)
23 |
24 | # Force use of python 2.7 as m2crypto is not available for python 3
25 | set(Python_ADDITIONAL_VERSIONS 2.7)
26 |
27 | Project(${PLUGIN_NAME})
28 |
29 | file (GLOB GENERAL RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
30 | Src/[^.]*.cpp
31 | Src/[^.]*.h
32 | [^.]*.cmake
33 | )
34 |
35 | file (GLOB TRANSFERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
36 | Transfers/[^.]*.cpp
37 | Transfers/[^.]*.h
38 | Transfers/[^.]*.cmake
39 | )
40 |
41 | include_directories(${PLUGIN_INCLUDE_DIRS})
42 | include_directories(${FB_UTF8_SOURCE_DIR})
43 | include_directories(${CMAKE_CURRENT_SOURCE_DIR})
44 |
45 | # Generated files are stored in ${GENERATED} by the project configuration
46 | SET_SOURCE_FILES_PROPERTIES(
47 | ${GENERATED}
48 | PROPERTIES
49 | GENERATED 1
50 | )
51 |
52 | SOURCE_GROUP(Generated FILES ${GENERATED})
53 | SOURCE_GROUP(Transfers FILES ${TRANSFERS})
54 |
55 | SET(SOURCES
56 | ${GENERAL}
57 | ${TRANSFERS}
58 | ${GENERATED}
59 | )
60 |
61 | add_definitions("-DBOOST_FILESYSTEM_VERSION=3")
62 | add_boost_library(filesystem)
63 |
64 | if(CMAKE_BUILD_TYPE MATCHES Debug)
65 | add_firebreath_library(log4cplus)
66 | add_definitions("-DDEBUG")
67 | endif()
68 |
69 | # Maximum warnings
70 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
71 | add_definitions("-Werror" "-Wno-error=deprecated-declarations")
72 | endif()
73 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
74 | add_definitions("-Werror" "-Wno-error=deprecated-declarations")
75 | add_definitions("-Wno-unused-private-field")
76 | endif()
77 |
78 | set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Stage CACHE PATH "Install prefix" FORCE)
79 | set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH "Prefix path" FORCE)
80 |
81 | # Include linphone-cmake-builder
82 | set(LINPHONE_BUILDER_CONFIG_FILE "configs/config-webplugin.cmake" CACHE STRING "Path to the linphone builder configuration file to build linphone core library." FORCE)
83 | set(LINPHONE_BUILDER_WORK_DIR "${CMAKE_BINARY_DIR}/Core" CACHE PATH "Working directory to build linphone core library." FORCE)
84 | add_subdirectory(Core)
85 |
86 | # This will include Win/projectDef.cmake, X11/projectDef.cmake, Mac/projectDef
87 | # depending on the platform
88 | include_platform()
89 |
--------------------------------------------------------------------------------
/Common/clean_js.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | import re
4 | import shutil
5 | import sys
6 |
7 | def main(argv=None):
8 | if argv is None:
9 | argv = sys.argv
10 | if len(argv) == 2:
11 | filename = argv[1]
12 | fin = open(filename, "r")
13 | text = fin.read()
14 | pattern = re.compile(r'(var linphone.*?$)|(\s*?/\*.*?\*/\s*?$)', re.S | re.MULTILINE)
15 | text = re.sub(pattern, '', text)
16 | fout = open(filename, "w")
17 | fout.write("/*globals linphone*/")
18 | fout.write(text)
19 |
20 | if __name__ == "__main__":
21 | sys.exit(main())
22 |
--------------------------------------------------------------------------------
/Common/common.cmake:
--------------------------------------------------------------------------------
1 | #Common cmake function
2 |
3 | find_package(Java REQUIRED)
4 | find_package(PythonInterp REQUIRED)
5 |
6 | if (NOT FB_XPI_SIGNED_SUFFIX)
7 | set (FB_XPI_SIGNED_SUFFIX _XPI_signed)
8 | endif()
9 | function (create_signed_xpi PROJNAME DIRECTORY OUT_FILE PEMFILE PASSFILE PROJDEP)
10 | set (XPI_SOURCES
11 | ${FB_OUT_DIR}/XPI.updated
12 | ${PEMFILE}
13 | ${PASSFILE}
14 | )
15 |
16 | if (EXISTS ${PEMFILE})
17 | ADD_CUSTOM_TARGET(${PROJNAME}${FB_XPI_SIGNED_SUFFIX} ALL DEPENDS ${OUT_FILE})
18 | ADD_DEPENDENCIES(${PROJNAME}${FB_XPI_SIGNED_SUFFIX} ${PROJDEP})
19 | ADD_CUSTOM_COMMAND(OUTPUT ${OUT_FILE}
20 | DEPENDS ${XPI_SOURCES}
21 | COMMAND ${CMAKE_COMMAND} -E remove ${OUT_FILE}
22 | COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Common/xpisign.py ${DIRECTORY} ${OUT_FILE} ${PEMFILE} ${PASSFILE}
23 | )
24 | SET_TARGET_PROPERTIES(${PLUGIN_NAME}${FB_XPI_SIGNED_SUFFIX} PROPERTIES FOLDER ${FBSTRING_ProductName})
25 | message("-- Successfully added Sign XPI step")
26 | else()
27 | message("-- No signtool certificate found; assuming development machine (${PEMFILE})")
28 | endif()
29 | endfunction(create_signed_xpi)
30 |
31 | if (NOT FB_CRX_SIGNED_SUFFIX)
32 | set (FB_CRX_SIGNED_SUFFIX _CRX_signed)
33 | endif()
34 | function (create_signed_crx PROJNAME DIRECTORY OUT_FILE PEMFILE PASSFILE PROJDEP)
35 | set (CRX_SOURCES
36 | ${FB_OUT_DIR}/CRX.updated
37 | ${PEMFILE}
38 | ${PASSFILE}
39 | )
40 |
41 | if (EXISTS ${PEMFILE})
42 | ADD_CUSTOM_TARGET(${PROJNAME}${FB_CRX_SIGNED_SUFFIX} ALL DEPENDS ${OUT_FILE})
43 | ADD_DEPENDENCIES(${PROJNAME}${FB_CRX_SIGNED_SUFFIX} ${PROJDEP})
44 | ADD_CUSTOM_COMMAND(OUTPUT ${OUT_FILE}
45 | DEPENDS ${CRX_SOURCES}
46 | COMMAND ${CMAKE_COMMAND} -E remove ${OUT_FILE}
47 | COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Common/crxmake.py ${DIRECTORY} ${OUT_FILE} ${PEMFILE} ${PASSFILE}
48 | )
49 | SET_TARGET_PROPERTIES(${PLUGIN_NAME}${FB_CRX_SIGNED_SUFFIX} PROPERTIES FOLDER ${FBSTRING_ProductName})
50 | message("-- Successfully added Sign CRX step")
51 | else()
52 | message("-- No signtool certificate found; assuming development machine (${PEMFILE})")
53 | endif()
54 | endfunction(create_signed_crx)
55 |
56 | if (NOT FB_PKG_SIGNED_SUFFIX)
57 | set (FB_PKG_SIGNED_SUFFIX _PKG_signed)
58 | endif()
59 | function (create_signed_pkg PROJNAME IN_FILE OUT_FILE SIGNING_IDENTITY PROJDEP)
60 | set (PKG_SOURCES
61 | ${IN_FILE}
62 | )
63 | ADD_CUSTOM_TARGET(${PROJNAME}${FB_PKG_SIGNED_SUFFIX} ALL DEPENDS ${OUT_FILE})
64 | ADD_DEPENDENCIES(${PROJNAME}${FB_PKG_SIGNED_SUFFIX} ${PROJDEP})
65 | ADD_CUSTOM_COMMAND(OUTPUT ${OUT_FILE}
66 | DEPENDS ${PKG_SOURCES}
67 | COMMAND ${CMAKE_COMMAND} -E remove ${OUT_FILE}
68 | COMMAND productsign --sign ${SIGNING_IDENTITY} ${IN_FILE} ${OUT_FILE}
69 | )
70 | SET_TARGET_PROPERTIES(${PLUGIN_NAME}${FB_PKG_SIGNED_SUFFIX} PROPERTIES FOLDER ${FBSTRING_ProductName})
71 | message("-- Successfully added Sign PKG step")
72 | endfunction(create_signed_pkg)
73 |
74 | function(configure_file_ext SRC DEST)
75 | configure_file("${SRC}" "${DEST}" COPYONLY)
76 | get_cmake_property(_variableNames VARIABLES)
77 | foreach(VAR ${_variableNames})
78 | if(VAR MATCHES "^ENABLE_.*$" OR VAR MATCHES "^WITH_DYNAMIC_MSVC_RUNTIME$")
79 | set(VALUE "${${VAR}}")
80 | execute_process(COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/Common/regex.py" "${DEST}" "${DEST}" "${VAR}" "${VALUE}")
81 | endif()
82 | endforeach()
83 | # Remove IF references that have not been replaced by previous calls to regex.py
84 | execute_process(COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/Common/regex.py" "${DEST}" "${DEST}")
85 |
86 | configure_file("${DEST}" "${DEST}")
87 | endfunction(configure_file_ext)
88 |
--------------------------------------------------------------------------------
/Common/concat_files.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | import shutil
4 | import sys
5 |
6 | def main(argv=None):
7 | if argv is None:
8 | argv = sys.argv
9 | if len(argv) >= 3:
10 | dest = argv[1]
11 | srcs = argv[2:]
12 | fout = open(dest, "w")
13 | for src in srcs:
14 | fin = open(src, "r")
15 | text = fin.read()
16 | fout.write(text)
17 | fout.write("\n")
18 |
19 | if __name__ == "__main__":
20 | sys.exit(main())
21 |
--------------------------------------------------------------------------------
/Common/copy.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | import shutil
4 | import sys
5 |
6 | def main(argv=None):
7 | if argv is None:
8 | argv = sys.argv
9 | if len(argv) == 3:
10 | src = argv[1]
11 | dest = argv[2]
12 | shutil.copytree(src,dest)
13 |
14 | if __name__ == "__main__":
15 | sys.exit(main())
16 |
--------------------------------------------------------------------------------
/Common/crxmake.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- mode: python coding: utf-8 -*-
3 | """
4 | building google chrome extension crx with commandline
5 | it is inspired by rubygem's crxmake
6 | requires: M2Crypto module (and "openssl" commandline)
7 | """
8 | import dircache
9 | import hashlib
10 | import io
11 | import os
12 | import struct
13 | import subprocess
14 | import sys
15 | import zipfile
16 | import M2Crypto.EVP
17 | import M2Crypto.RSA
18 | import M2Crypto.BIO
19 |
20 | class PassFile:
21 | def __init__(self, file):
22 | self.file = file
23 | def password(self, v):
24 | file = open(self.file, 'r');
25 | line = file.readline().strip()
26 | file.close()
27 | return line
28 |
29 | def crxmake(dirname, pem_name, pass_file, crx_name):
30 | if dirname.endswith(os.path.sep): dirname = dirname[:-1]
31 |
32 | # make raw zip data
33 | zip_memory = io.BytesIO()
34 | zip = zipfile.ZipFile(zip_memory, "w", zipfile.ZIP_DEFLATED)
35 | def make_zip(z, path, parent):
36 | for ch in dircache.listdir(path):
37 | child = os.path.join(path, ch)
38 | name = "%s/%s" % (parent, ch)
39 | if os.path.isfile(child): z.write(child, name)
40 | if os.path.isdir(child): make_zip(z, child, name)
41 | pass
42 | pass
43 | make_zip(zip, dirname, "")
44 | zip.close()
45 | zip_data = zip_memory.getvalue()
46 |
47 | # load or make private key PEM
48 | if pem_name is not None:
49 | key = M2Crypto.RSA.load_key(pem_name, callback=PassFile(pass_file).password)
50 | else:
51 | pem_name = "tmp_pem"
52 | pass_file = "tmp_pass"
53 | f = open(pass_file, 'w')
54 | f.write("dummy")
55 | f.close()
56 | key = M2Crypto.RSA.gen_key(2048, 65537)
57 | key.save_key(pem_name, callback=PassFile(pass_file).password)
58 |
59 | # make sign for zip_data with private key
60 | sign = key.sign(hashlib.sha1(zip_data).digest(), "sha1")
61 |
62 | # generate public key DER
63 | if key is not None:
64 | if hasattr(key, "save_pub_key_der_bio"):
65 | mem_bio = M2Crypto.BIO.MemoryBuffer()
66 | key.save_pub_key_der_bio(mem_bio) # missing API on M2Crypto <= 0.20.2
67 | der_key = mem_bio.getvalue()
68 | pass
69 | else:
70 | der_key = subprocess.Popen(
71 | ["openssl", "rsa", "-pubout", "-outform", "DER",
72 | "-inform", "PEM", "-in", pem_name, "-passin", "file:"+pass_file],
73 | stdout=subprocess.PIPE).stdout.read()
74 | pass
75 |
76 | # make crx
77 | magic = "Cr24"
78 | version = struct.pack("= 3:
12 | dllfile = argv[1]
13 | dllpath, dllextension = os.path.splitext(dllfile)
14 | dllname = os.path.basename(dllpath)
15 | libfile = argv[2]
16 | deffile = dllpath + ".def"
17 | ret = subprocess.check_output(["dumpbin", "/exports", dllfile, "/out:" + deffile], stderr=subprocess.STDOUT)
18 | fin = open(deffile, "r")
19 | lines = fin.readlines()
20 | exports = []
21 | for line in lines:
22 | exportre = re.compile('^\s+\d+\s+[\dA-F]+\s+[\dA-F]+\s+(\w+)(\s=\s\w+)?$')
23 | m = exportre.match(line)
24 | if m:
25 | exports.append(m.group(1))
26 | fin.close()
27 | fin = open(deffile, "w")
28 | fin.write("EXPORTS " + dllname + "\n")
29 | for export in exports:
30 | fin.write("\t" + export + "\n")
31 | fin.close()
32 | ret = subprocess.check_output(["lib", "/def:" + deffile, "/out:" + libfile, "/machine:X86"], stderr=subprocess.STDOUT)
33 | print(ret)
34 |
35 | if __name__ == "__main__":
36 | sys.exit(main())
37 |
--------------------------------------------------------------------------------
/Common/mac_rpath.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | import sys
4 | import getopt
5 | import os
6 | import subprocess
7 | import re
8 |
9 |
10 | # List directory files
11 | def list_files(source_dir):
12 | source_dir = os.path.abspath(source_dir)
13 |
14 | # Build file list
15 | filelist = []
16 | for file in os.listdir(source_dir):
17 | if os.path.isdir(os.path.join(source_dir, file)) == False:
18 | filelist.append(file)
19 | return filelist
20 |
21 | # List libraries used in a file
22 | def list_libraries(file):
23 | print "Exec: /usr/bin/otool -L %s" % file
24 | ret = subprocess.check_output(["/usr/bin/otool", "-L", file])
25 |
26 | librarylist = []
27 | for a in ret.split("\n"):
28 | pop = re.search("^\s+(\S*).*$", a)
29 | if pop:
30 | librarylist.append(pop.group(1))
31 | return librarylist
32 |
33 | # Change library id
34 | def change_library_id(file, id):
35 | id = "@loader_path/" + id
36 | os.chmod(file, 0o755)
37 | print "%s: Change id %s" % (file, id)
38 | ret = subprocess.check_output(["/usr/bin/install_name_tool", "-id", id, file], stderr=subprocess.STDOUT)
39 |
40 | # Change path to a library in a file
41 | def change_library_path(file, old, new, path = ""):
42 | if len(path)> 0 and path[-1] <> '/':
43 | path = path + "/"
44 | new = "@loader_path/" + path + new
45 | os.chmod(file, 0o755)
46 | print "%s: Replace %s -> %s" % (file, old, new)
47 | ret = subprocess.check_output(["/usr/bin/install_name_tool", "-change", old, new, file])
48 |
49 | # Replace libraries used by a file
50 | def replace_libraries(file, name, libraries, path = ""):
51 | print "---------------------------------------------"
52 | print "Replace libraries in %s" % file
53 | change_library_id(file, name)
54 | librarylist = list_libraries(file)
55 | for lib in libraries:
56 | if lib <> name:
57 | completelib = [s for s in librarylist if lib in s]
58 | if len(completelib) == 1:
59 | change_library_path(file, completelib[0], lib, path)
60 | print "---------------------------------------------"
61 |
62 | def main(argv=None):
63 | if argv is None:
64 | argv = sys.argv
65 | if len(argv) > 1 and len(argv) <= 3:
66 | path = argv[1]
67 | file_list = list_files(path)
68 | if len(argv) <= 2:
69 | for file in file_list:
70 | replace_libraries(os.path.join(path, file), file, file_list)
71 | else:
72 | path2 = argv[2]
73 | if os.path.isdir(path2):
74 | file_list2 = list_files(path2)
75 | for file in file_list2:
76 | replace_libraries(os.path.join(path2, file), file, file_list, os.path.relpath(path, path2))
77 | else:
78 | file = argv[2]
79 | replace_libraries(file, os.path.basename(file), file_list, os.path.relpath(path, os.path.dirname(file)))
80 |
81 |
82 | if __name__ == "__main__":
83 | sys.exit(main())
84 |
--------------------------------------------------------------------------------
/Common/regex.py:
--------------------------------------------------------------------------------
1 | import re, sys
2 |
3 | def str2bool(v):
4 | return v.lower() in ("yes", "true", "t", "on", "1")
5 |
6 | def replace(src, dest, variable = '', value = ''):
7 | infile = open(src, "r")
8 | intext = infile.read()
9 | infile.close()
10 | if variable == '':
11 | match = r"\${IF .*?}(.*?)\${ENDIF}"
12 | else:
13 | match = r"\${IF " + variable + r"}(.*?)\${ENDIF}"
14 | if value != '' and str2bool(value):
15 | replace = r"\1"
16 | else:
17 | replace = r""
18 | re_match = re.compile(match, re.MULTILINE|re.DOTALL)
19 | outtext = re.sub(re_match, replace, intext)
20 | outfile = open(dest, "w")
21 | outfile.write(outtext)
22 | outfile.close()
23 |
24 | if __name__ == '__main__':
25 | if len(sys.argv) == 3:
26 | replace(sys.argv[1], sys.argv[2])
27 | elif len(sys.argv) == 5:
28 | replace(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
29 | else:
30 | sys.exit(5)
31 |
--------------------------------------------------------------------------------
/Common/sdk.cmake:
--------------------------------------------------------------------------------
1 | ##
2 | # Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | # Copyright (C) 2012-2014 Belledonne Communications
4 | #
5 | # This program is free software; you can redistribute it and/or
6 | # modify it under the terms of the GNU General Public License
7 | # as published by the Free Software Foundation; either version 2
8 | # of the License, or (at your option) any later version.
9 | #
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with this program; if not, write to the Free Software
17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 | ##
19 |
20 | find_package(PythonInterp REQUIRED)
21 | find_program(ZIP_PROGRAM zip REQUIRED)
22 | find_program(JSDOC_PROGRAM jsdoc REQUIRED)
23 |
24 | file(GLOB DOCUMENTATION
25 | ${SDK_STAGE_DIR}/share/doc/linphone-[^.]*.[^.]*.[^.]*/xml/[^.]*.xml
26 | )
27 |
28 | file(GLOB TUTORIALS
29 | ${SDK_PROJECT_SOURCE_DIR}/Doc/tutorials/README
30 | ${SDK_PROJECT_SOURCE_DIR}/Doc/tutorials/[^.]*.html
31 | ${SDK_PROJECT_SOURCE_DIR}/Doc/tutorials/[^.]*.js
32 | )
33 |
34 | set(SDK_SOURCES
35 | ${SDK_PROJECT_SOURCE_DIR}/README.md
36 | ${SDK_PROJECT_SOURCE_DIR}/LICENSE.md
37 | ${SDK_PROJECT_SOURCE_DIR}/GETTING_STARTED.md
38 | ${SDK_PROJECT_SOURCE_DIR}/Doc/plugin_specifics.js
39 | ${DOCUMENTATION}
40 | ${TUTORIALS}
41 | )
42 |
43 | set(SDK_WORK_DIR ${CMAKE_CURRENT_BINARY_DIR}/Sdk)
44 | set(JSWRAPPER_DIR ${SDK_WORK_DIR}/jswrapper)
45 | set(SDK_DIR ${SDK_WORK_DIR}/${SDK_PROJECT_NAME}-${SDK_PROJECT_VERSION}-sdk)
46 |
47 | execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${SDK_WORK_DIR})
48 | execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${SDK_WORK_DIR})
49 | execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${JSWRAPPER_DIR})
50 | execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${JSWRAPPER_DIR})
51 | execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${SDK_DIR})
52 | execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${SDK_DIR})
53 | execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SDK_PROJECT_SOURCE_DIR}/Common/concat_files.py ${SDK_WORK_DIR}/MAINPAGE.md ${SDK_PROJECT_SOURCE_DIR}/GETTING_STARTED.md ${SDK_PROJECT_SOURCE_DIR}/README.md ${SDK_PROJECT_SOURCE_DIR}/LICENSE.md)
54 | execute_process(COMMAND ${SDK_STAGE_DIR}/bin/lp-gen-wrappers --output javascript --project linphone ${DOCUMENTATION}
55 | WORKING_DIRECTORY ${JSWRAPPER_DIR})
56 | execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${SDK_PROJECT_SOURCE_DIR}/Doc/plugin_specifics.js ${JSWRAPPER_DIR}/linphone/)
57 | file(GLOB JSWRAPPER_SOURCES ${JSWRAPPER_DIR}/linphone/[^.]*.js)
58 | execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SDK_PROJECT_SOURCE_DIR}/Common/concat_files.py ${SDK_DIR}/linphone.js ${JSWRAPPER_SOURCES})
59 | execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SDK_PROJECT_SOURCE_DIR}/Common/clean_js.py ${SDK_DIR}/linphone.js)
60 | execute_process(COMMAND ${JSDOC_PROGRAM} --recurse --destination ${SDK_PROJECT_NAME}-${SDK_PROJECT_VERSION}-doc ${JSWRAPPER_DIR} ${SDK_WORK_DIR}/MAINPAGE.md
61 | WORKING_DIRECTORY ${SDK_DIR})
62 | execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SDK_PROJECT_SOURCE_DIR}/Common/copy.py ${SDK_PROJECT_SOURCE_DIR}/Doc/tutorials ${SDK_DIR}/tutorials)
63 | execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${SDK_DIR}/linphone.js ${SDK_DIR}/tutorials/)
64 | execute_process(COMMAND ${ZIP_PROGRAM} -r ${SDK_FILENAME} ${SDK_PROJECT_NAME}-${SDK_PROJECT_VERSION}-sdk
65 | WORKING_DIRECTORY ${SDK_WORK_DIR})
66 |
--------------------------------------------------------------------------------
/Common/signtool.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os, sys
3 | import subprocess
4 | class PassFile:
5 | def __init__(self, file):
6 | self.file = file
7 | def password(self, v):
8 | file = open(self.file, "r");
9 | line = file.readline().strip()
10 | file.close()
11 | return line
12 |
13 | if __name__ == '__main__':
14 | if len(sys.argv) <= 2:
15 | sys.exit(0)
16 | for i,arg in enumerate(sys.argv):
17 | if arg == "/p":
18 | if (i + 1) == len(sys.argv):
19 | print "Missing password argument"
20 | sys.exit(3)
21 | try:
22 | sys.argv[i+1] = PassFile(sys.argv[i+1]).password(None)
23 | except IOError:
24 | print "Password file not found"
25 | sys.exit(3)
26 | actual_args = sys.argv[1:]
27 | ret = subprocess.call(actual_args)
28 | sys.exit(ret)
29 |
--------------------------------------------------------------------------------
/Common/xpisign.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os, sys, re, hashlib, zipfile, base64, M2Crypto
3 | class PassFile:
4 | def __init__(self, file):
5 | self.file = file
6 | def password(self, v):
7 | file = open(self.file, 'r');
8 | line = file.readline().strip()
9 | file.close()
10 | return line
11 |
12 | def signDir(source_dir, key_file, pass_file, output_file):
13 | source_dir = os.path.abspath(source_dir)
14 |
15 | # Build file list
16 | filelist = []
17 | for dirpath, dirs, files in os.walk(source_dir):
18 | for file in files:
19 | abspath = os.path.join(dirpath, file)
20 | relpath = os.path.relpath(abspath, source_dir).replace('\\', '/')
21 | handle = open(abspath, 'rb')
22 | filelist.append((abspath, relpath, handle.read()))
23 | handle.close()
24 |
25 | # Generate manifest.mf and zigbert.sf data
26 | manifest_sections = []
27 | signature_sections = []
28 | def digest(data):
29 | md5 = hashlib.md5()
30 | md5.update(data)
31 | sha1 = hashlib.sha1()
32 | sha1.update(data)
33 | return 'Digest-Algorithms: MD5 SHA1\nMD5-Digest: %s\nSHA1-Digest: %s\n' % \
34 | (base64.b64encode(md5.digest()), base64.b64encode(sha1.digest()))
35 | def section(manifest, signature):
36 | manifest_sections.append(manifest)
37 | signature_sections.append(signature + digest(manifest))
38 | section('Manifest-Version: 1.0\n', 'Signature-Version: 1.0\n')
39 | for filepath, relpath, data in filelist:
40 | section('Name: %s\n%s' % (relpath, digest(data)), 'Name: %s\n' % relpath)
41 | manifest = '\n'.join(manifest_sections)
42 | signature = '\n'.join(signature_sections)
43 |
44 | # Generate zigbert.rsa (detached zigbert.sf signature)
45 | handle = open(key_file, 'rb')
46 | key_data = handle.read()
47 | handle.close()
48 | certstack = M2Crypto.X509.X509_Stack()
49 | first = True
50 | certificates = re.finditer(r'-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----', key_data, re.S)
51 | # Ignore first certificate, we will sign with this one. Rest of them needs to
52 | # be added to the stack manually however.
53 | certificates.next()
54 | for match in certificates:
55 | certstack.push(M2Crypto.X509.load_cert_string(match.group(0)))
56 |
57 | mime = M2Crypto.SMIME.SMIME()
58 | if key_file is not None:
59 | mime.load_key(key_file, callback=PassFile(pass_file).password)
60 | else:
61 | key = M2Crypto.RSA.gen_key(2048, 65537)
62 | bio = M2Crypto.BIO.MemoryBuffer()
63 | key.save_key_bio(bio, None)
64 | mime.load_key_bio(bio)
65 |
66 | mime.set_x509_stack(certstack)
67 | pkcs7 = mime.sign(M2Crypto.BIO.MemoryBuffer(signature),
68 | M2Crypto.SMIME.PKCS7_DETACHED | M2Crypto.SMIME.PKCS7_BINARY)
69 | pkcs7_buffer = M2Crypto.BIO.MemoryBuffer()
70 | pkcs7.write_der(pkcs7_buffer)
71 |
72 | # Write everything into a ZIP file, with zigbert.rsa as first file
73 | zip = zipfile.ZipFile(output_file, 'w', zipfile.ZIP_DEFLATED)
74 | zip.writestr('META-INF/zigbert.rsa', pkcs7_buffer.read())
75 | zip.writestr('META-INF/zigbert.sf', signature)
76 | zip.writestr('META-INF/manifest.mf', manifest)
77 | for filepath, relpath, data in filelist:
78 | zip.writestr(relpath, data)
79 |
80 | if __name__ == '__main__':
81 | if len(sys.argv) != 5 and len(sys.argv) != 3:
82 | print 'Usage: %s source_dir key_file pass_file output_file' % sys.argv[0]
83 | sys.exit(2)
84 | if len(sys.argv) == 5:
85 | signDir(sys.argv[1], sys.argv[3], sys.argv[4], sys.argv[2])
86 | elif len(sys.argv) == 3:
87 | signDir(sys.argv[1], None, None, sys.argv[2])
88 |
--------------------------------------------------------------------------------
/Doc/APIWeb.ods:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BelledonneCommunications/linphone-web-plugin/5d9a14033b696c4e75af3a57c13e8173acdace95/Doc/APIWeb.ods
--------------------------------------------------------------------------------
/Doc/script.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | MODDIR=$(pwd)/mod/
4 | DESTDIR=$(pwd)/tmp/
5 | BOOST=$(pwd)/../../../src/3rdParty/boost/
6 | BOOST_FILES="boost/preprocessor/control/if.hpp \
7 | boost/preprocessor/array/elem.hpp \
8 | boost/preprocessor/repetition/enum.hpp \
9 | boost/preprocessor/debug/assert.hpp \
10 | boost/preprocessor/comparison/equal.hpp \
11 | boost/preprocessor/stringize.hpp \
12 | boost/mpl/aux_/preprocessor/token_equal.hpp"
13 | CPP_EXTRA=
14 | for f in $BOOST_FILES ; do
15 | CPP_EXTRA="$CPP_EXTRA -imacros $BOOST/$f"
16 | done
17 | echo $CPP_EXTRA
18 |
19 | echo $DESTDIR
20 | rm result.txt
21 | rm -rf $MODDIR
22 | mkdir -p $MODDIR
23 | rm -rf $DESTDIR
24 | mkdir -p $DESTDIR
25 |
26 | pushd ../
27 |
28 | headers=$(find . -maxdepth 1 -type f -name '*.h')
29 | for file in $headers ; do
30 | echo $file
31 | cat $file | \
32 | sed "s/#include/\/\/#include/g" | \
33 | sed "s/\/\/#include \"macro.h\"/#include \"macro.h\"/g" | \
34 | sed "s/\/\/#include \"wrapperapi.h\"/#include \"wrapperapi.h\"/g" \
35 | > $MODDIR/$file
36 | done
37 |
38 | popd
39 |
40 | pushd $MODDIR
41 |
42 | headers=$(find . -maxdepth 1 -type f -name '*.h')
43 | for file in $headers ; do
44 | echo $file
45 | cat $file | \
46 | c++ -I$BOOST $CPP_EXTRA -x c++ -E - | \
47 | sed 's/;/;\'$'\n/g' \
48 | > $DESTDIR/$file
49 | done
50 |
51 | popd
52 |
53 | pushd $DESTDIR
54 | anjuta-tags --c-kinds=p --fields=-k+n+S+T -f - *.h | \
55 | perl -pe '1 while s/\/\^(.*)\t(.*)\/\;/\/\^\1 \2\/\;/gc' | \
56 | sed "s#$DESTDIR##g" > ../result.txt
57 | popd
58 |
--------------------------------------------------------------------------------
/Doc/tutorials/README:
--------------------------------------------------------------------------------
1 | Linphone Web Ui Tutorials
2 | =========================
3 |
4 |
5 | Call
6 | ----
7 |
8 | *Prerequisites: installed plugin
9 |
10 | 1. Open call.html in a web browser
11 | 2. Fill the first form to register to a SIP proxy
12 | 3. Fill the second form to perform an outgoing call
13 |
14 |
15 | Chat
16 | ----
17 |
18 | *Prerequisites: installed plugin
19 |
20 | 1. Open chat.html in a web browser
21 | 2. Fill the first form to register to a SIP proxy
22 | 3. Fill the second form to send a chat message to yourself
23 |
24 |
25 | Presence
26 | --------
27 |
28 | *Prerequisites: installed plugin
29 |
30 | 1. Open presence.html in a web browser
31 | 2. Fill the first form to register to a SIP proxy
32 | 3. Fill the second form to add a friend
33 | 4. Change your status in the third form
34 |
--------------------------------------------------------------------------------
/Doc/tutorials/call.html:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
11 |
12 |
13 |
89 |
90 |
91 |
92 |
95 |
96 |
104 |
105 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/Doc/tutorials/chat.html:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
96 |
97 |
98 |
99 |
100 |
103 |
111 |
118 |
119 |
120 |
--------------------------------------------------------------------------------
/Doc/tutorials/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
61 |
62 |
63 |
64 |
67 |
68 |
76 |
77 |
--------------------------------------------------------------------------------
/Doc/tutorials/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BelledonneCommunications/linphone-web-plugin/5d9a14033b696c4e75af3a57c13e8173acdace95/Doc/tutorials/logo.png
--------------------------------------------------------------------------------
/Doc/tutorials/plugin.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
66 |
67 |
68 |
71 |
72 | Detection of the plugin ...
73 |
74 |
--------------------------------------------------------------------------------
/Doc/tutorials/video.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
16 |
17 |
18 |
118 |
119 |
120 |
121 |
124 |
125 |
133 |
134 |
141 |
142 |
143 |
144 |
146 |
147 |
148 |
149 |
150 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | License
2 | =======
3 |
4 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
5 | Copyright (C) 2012-2013 Belledonne Communications
6 |
7 | This program is free software; you can redistribute it and/or
8 | modify it under the terms of the GNU General Public License
9 | as published by the Free Software Foundation; either version 2
10 | of the License, or (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with this program; if not, write to the Free Software
19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 |
21 |
22 | Full terms of GPLv2 is available in COPYING file.
23 |
24 | Any web application or web site making use of the Linphone-web plugin is considered
25 | by copyright owners as "work based on the Program" according the GPL terminology.
26 | As a result, such web app or web site shall be licensed under the GPLv2 or later.
27 |
28 | Proprietary licensing is available from http://www.belledonne-communications.com .
29 |
--------------------------------------------------------------------------------
/Mac/CRX/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "${FBSTRING_PluginName}",
3 | "version" : "${FBSTRING_PLUGIN_VERSION}",
4 | "description" : "${FBSTRING_FileDescription}",
5 | "icons": { "16": "icon16.png", "48": "icon48.png" },
6 | "plugins": [
7 | { "path": "${FBSTRING_PluginFileName}.${PLUGIN_EXT}", "public": true }
8 | ],
9 | "manifest_version": 2
10 | }
11 |
--------------------------------------------------------------------------------
/Mac/PKG.pmdoc/01linphone-contents.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ${IF ENABLE_SRTP}
18 |
19 | ${ENDIF}
20 | ${IF ENABLE_ZRTP}
21 |
22 | ${ENDIF}
23 | ${IF ENABLE_FFMPEG}
24 |
25 |
26 |
27 | ${ENDIF}
28 | ${IF ENABLE_TUNNEL}
29 |
30 | ${ENDIF}
31 |
32 |
33 |
34 |
35 | ${IF ENABLE_AMR}
36 |
37 | ${ENDIF}
38 | ${IF ENABLE_G729}
39 |
40 | ${ENDIF}
41 | ${IF ENABLE_ILBC}
42 | dold ${ENDIF}
43 | ${IF ENABLE_OPENH264}
44 |
45 | ${ENDIF}
46 | ${IF ENABLE_X264}
47 |
48 | ${ENDIF}
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/Mac/PKG.pmdoc/01linphone.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ${FBSTRING_CompanyDomain}.${FBSTRING_PluginDomain}
4 | 1.0
5 |
6 |
7 | ${FBSTRING_PluginFileName}.${PLUGIN_EXT}
8 | /Library/Internet Plug-Ins/
9 |
10 |
11 |
12 |
13 | relocatable
14 | requireAuthorization
15 | identifier
16 | parent
17 | installFrom.isRelativeType
18 | scripts.scriptsDirectoryPath.path
19 | scripts.preinstall.path
20 | scripts.postinstall.path
21 |
22 |
23 | ${CMAKE_CURRENT_BINARY_DIR}/PKG.pmdoc/scripts/remove-old-install.sh
24 | ${CMAKE_CURRENT_BINARY_DIR}/PKG.pmdoc/scripts
25 |
26 |
27 | 01linphone-contents.xml
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Mac/PKG.pmdoc/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ${FBSTRING_PluginName}
4 | ${FBSTRING_CompanyName}
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | - 01linphone.xml
23 | properties.title
24 | properties.userDomain
25 |
26 |
--------------------------------------------------------------------------------
/Mac/PKG.pmdoc/scripts/remove-old-install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | rm -rf "$2"/np@PROJNAME@-*.plugin
4 |
--------------------------------------------------------------------------------
/Mac/XPI/bootstrap.js:
--------------------------------------------------------------------------------
1 | function startup(aData, aReason) {}
2 |
3 | function shutdown(aData, aReason) {}
4 |
5 | function install(aData, aReason) {}
6 |
7 | function uninstall(aData, aReason) {}
8 |
--------------------------------------------------------------------------------
/Mac/XPI/chrome.manifest:
--------------------------------------------------------------------------------
1 | skin ${PLUGIN_SHAREDIR} classic/1.0 chrome/skin/
--------------------------------------------------------------------------------
/Mac/XPI/install.rdf:
--------------------------------------------------------------------------------
1 |
2 |
20 |
22 |
23 | ${FBSTRING_PluginName}
24 | ${FBSTRING_PLUGIN_VERSION}
25 |
26 | ${FBControl_XPI_GUID}
27 | 2
28 | ${FBSTRING_FileDescription}
29 |
30 | chrome://${PLUGIN_SHAREDIR}/skin/icon64.png
31 | chrome://${PLUGIN_SHAREDIR}/skin/icon48.png
32 |
33 |
34 |
35 |
36 | {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
37 | 1.5
38 | 24.0
39 |
40 |
41 | Darwin
42 |
43 | ${FBSTRING_CompanyName}
44 | Yann Diorcet
45 | true
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Mac/bundle_template/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | ${FBSTRING_PluginFileName}
9 | CFBundleGetInfoString
10 | ${FBSTRING_PluginName} ${FBSTRING_PLUGIN_VERSION}, ${FBSTRING_LegalCopyright}
11 | CFBundleIdentifier
12 | ${FBSTRING_CompanyDomain}.${FBSTRING_PluginDomain}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundlePackageType
16 | BRPL
17 | CFBundleShortVersionString
18 | ${FBSTRING_PLUGIN_VERSION}
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${FBSTRING_PLUGIN_VERSION}
23 | CFPlugInDynamicRegisterFunction
24 |
25 | CFPlugInDynamicRegistration
26 | NO
27 | CFPlugInFactories
28 |
29 | 00000000-0000-0000-0000-000000000000
30 | MyFactoryFunction
31 |
32 | CFPlugInTypes
33 |
34 | 00000000-0000-0000-0000-000000000000
35 |
36 | 00000000-0000-0000-0000-000000000000
37 |
38 |
39 | CFPlugInUnloadFunction
40 |
41 | WebPluginName
42 | ${FBSTRING_PluginName}
43 | WebPluginDescription
44 | ${FBSTRING_FileDescription}
45 | WebPluginMIMETypes
46 |
47 | @foreach (FBSTRING_MIMEType CUR_MIMETYPE FBSTRING_PluginDescription CUR_DESC)
48 | ${CUR_MIMETYPE}
49 |
50 | WebPluginExtensions
51 |
52 |
53 |
54 | WebPluginTypeDescription
55 | ${CUR_DESC}
56 |
57 | @endforeach
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Mac/bundle_template/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 | CFBundleName = "${FBSTRING_PluginName}";
4 | NSHumanReadableCopyright = "${FBSTRING_LegalCopyright}";
5 |
--------------------------------------------------------------------------------
/Mac/bundle_template/Localized.r:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | resource 'STR#' (126)
4 | { {
5 | "${FBSTRING_LegalCopyright}",
6 | "${FBSTRING_PluginName}"
7 | } };
8 |
9 | resource 'STR#' (127)
10 | { {
11 | "",
12 | } };
13 |
14 | resource 'STR#' (128)
15 | { {
16 | @foreach (FBSTRING_MIMEType CUR_MIMETYPE FBSTRING_FileExtents CUR_EXTENT)
17 | "${CUR_MIMETYPE}",
18 | "${CUR_EXTENT}",
19 | @endforeach
20 | } };
21 |
--------------------------------------------------------------------------------
/Mac/videowindowmac.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #ifndef H_VIDEOWINDOWMAC
26 | #define H_VIDEOWINDOWMAC
27 |
28 | #import
29 |
30 | #include
31 | #include
32 | #include "../Src/videowindow.h"
33 |
34 | namespace LinphoneWeb {
35 |
36 | class VideoWindowMac: public VideoWindow {
37 | public:
38 | VideoWindowMac();
39 | ~VideoWindowMac();
40 |
41 | void setWindow(FB::PluginWindow *window);
42 | void* getNativeHandle() const;
43 | void setBackgroundColor(int r, int g, int b);
44 | bool draw();
45 |
46 | private:
47 | void drawBackground();
48 |
49 | FB::PluginWindowMac *mWindow;
50 | CGColorRef mBackgroundColor;
51 | };
52 |
53 | } // LinphoneWeb
54 |
55 | #endif // H_VIDEOWINDOWMAC
56 |
--------------------------------------------------------------------------------
/Mac/videowindowmac.mm:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #include
26 | #include "videowindowmac.h"
27 |
28 | namespace LinphoneWeb {
29 |
30 | VideoWindowPtr VideoWindow::create() {
31 | return boost::make_shared();
32 | }
33 |
34 | VideoWindowMac::VideoWindowMac():
35 | mWindow(NULL), mBackgroundColor(nil) {
36 | FBLOG_DEBUG("VideoWindowMac::VideoWindowMac", "this=" << this);
37 | }
38 |
39 | VideoWindowMac::~VideoWindowMac() {
40 | FBLOG_DEBUG("VideoWindowMac::~VideoWindowMac", "this=" << this);
41 | if(mBackgroundColor != nil) {
42 | CGColorRelease(mBackgroundColor);
43 | }
44 | }
45 |
46 | void VideoWindowMac::setBackgroundColor(int r, int g, int b) {
47 | if(mBackgroundColor != nil) {
48 | CGColorRelease(mBackgroundColor);
49 | mBackgroundColor = nil;
50 | }
51 | mBackgroundColor = CGColorCreateGenericRGB(r/255.0f, g/255.0f, b/255.0f, 1.0f);
52 | drawBackground();
53 | }
54 |
55 | void VideoWindowMac::drawBackground() {
56 | [(CALayer *)mWindow->getDrawingPrimitive() setBackgroundColor:mBackgroundColor];
57 | }
58 |
59 | void VideoWindowMac::setWindow(FB::PluginWindow *window) {
60 | FBLOG_DEBUG("VideoWindowMac::setWindow", "this=" << this << "\t" << "window=" << window);
61 | FB::PluginWindowMac* wnd = reinterpret_cast(window);
62 | if (wnd) {
63 | mWindow = wnd;
64 | CALayer *layer = (CALayer *)mWindow->getDrawingPrimitive();
65 |
66 | drawBackground();
67 |
68 | // Auto invalidate each 33ms
69 | FBLOG_DEBUG("VideoWindowMac::setWindow", "this=" << this << "\t" << "Model=" << mWindow->getDrawingModel());
70 | if (FB::PluginWindowMac::DrawingModelInvalidatingCoreAnimation == mWindow->getDrawingModel()) {
71 | wnd->StartAutoInvalidate(1.0/30.0);
72 | }
73 |
74 | FBLOG_DEBUG("VideoWindowMac::setWindow", "this=" << this << "\t" << "LOAD DRAWINGPRIMITIVE=" << layer);
75 | } else {
76 | if(mWindow) {
77 | if (FB::PluginWindowMac::DrawingModelInvalidatingCoreAnimation == mWindow->getDrawingModel()) {
78 | mWindow->StopAutoInvalidate();
79 | }
80 | CALayer *layer = (CALayer *)mWindow->getDrawingPrimitive();
81 | FBLOG_DEBUG("VideoWindowMac::setWindow", "this=" << this << "\t" << "UNLOAD DRAWINGPRIMITIVE=" << layer);
82 | mWindow = NULL;
83 | }
84 | }
85 | }
86 |
87 | void* VideoWindowMac::getNativeHandle() const {
88 | FBLOG_DEBUG("VideoWindowMac::getNativeHandle", "this=" << this);
89 | if(mWindow) {
90 | return (void*)mWindow->getDrawingPrimitive();
91 | } else {
92 | return NULL;
93 | }
94 | }
95 |
96 | bool VideoWindowMac::draw() {
97 | return false;
98 | }
99 |
100 | } // LinphoneWeb
101 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Compilation
2 | ===========
3 |
4 | Prerequisites
5 | -------------
6 |
7 | ### Common
8 | * python (2.7)
9 | * python-M2Crypto (for python 2.7): Used for signing
10 | * cmake (2.8.2 or greater)
11 | * java (used for packaging)
12 | * openssl
13 | * awk (on Windows get it from http://gnuwin32.sourceforge.net/packages/gawk.htm
14 | and add it to your PATH environment variable)
15 | * patch (on Windows get it from http://gnuwin32.sourceforge.net/packages/patch.htm
16 | and add it to your PATH environment variable)
17 | * Make sure you have cloned the linphone-web-plugin repository recursively.
18 | If this is not the case, get the submodules:
19 |
20 | git submodules update --recursive --init
21 |
22 | ### Windows platform
23 | * Visual studio C++ 2010
24 | * Windows Driver Kit Version 7.1.0 (http://www.microsoft.com/en-us/download/details.aspx?id=11800)
25 | * WiX to generate the MSI installer (http://wixtoolset.org/). Use the version 3.7, newer versions do not work as of now.
26 | * MinGW32 (http://mingw.org/)
27 | You need to install mingw-developer-toolkit, mingw32-base, mingw32-gcc-g++ and msys-base in the "Basic Setup".
28 | Make sure to follow the post-installation instruction from http://mingw.org/wiki/Getting_Started#toc2.
29 | * nasm (http://www.nasm.us/)
30 |
31 | ### Linux platform
32 | * X11 dev
33 | * chrpath
34 |
35 | ### Mac OS X platform
36 | * Xcode
37 | * Mac ports (for python and modules)
38 |
39 | Firebreath
40 | ----------
41 | FireBreath aims to be a cross-platform plugin architecture. You have to
42 | download the last stable version using git:
43 |
44 | git clone git://git.linphone.org/firebreath.git -b firebreath-1.7 --recursive
45 |
46 | Place linphone-web-plugin project in the `./projects/` directory at the firebreath
47 | root (create it if doesn't exist).
48 | Follow the [Firebreath documentation](http://www.firebreath.org/display/documentation/Building+FireBreath+Plugins)
49 | following the used system for compiling linphone-web.
50 |
51 |
52 | Compile
53 | -------
54 | Follow firebreath document in order to compile linphone-web plugin.
55 | The generated files can be found in `./build/bin` directory inside
56 | Firebreath project root.
57 |
58 | ### Windows
59 | You have to add python, openssl and WiX in the PATH environment variable.
60 | Make sure you are building with Visual Studio 2010, using the prep2010.cmd
61 | script.
62 | If you want to compile in Debug mode, use the command line:
63 |
64 | prep2010.cmd projects\linphone-web-plugin build "-DWITH_DYNAMIC_MSVC_RUNTIME=1" "-DCMAKE_BUILD_TYPE=Debug"
65 |
66 | and then use the Debug configuration in Visual Studio.
67 | If you want to compile in Release mode, use the command line:
68 |
69 | prep2010.cmd projects\linphone-web-plugin build "-DWITH_DYNAMIC_MSVC_RUNTIME=1"
70 |
71 | and then use the Release configuration in Visual Studio.
72 |
73 | ### Mac OS X
74 | Don't use XCode directly it doesn't use corrects environment and target
75 | architectures. For configuring the firebreath, use the following command:
76 |
77 | ./prepmac.sh -DCMAKE_OSX_DEPLOYMENT_TARGET="10.6" -DCMAKE_OSX_ARCHITECTURES="i386"
78 |
79 | This is permit the plugin to run on older version of Mac OS X than the one
80 | you use and force only one architecture. After enter in `./build/` directory
81 | of Firebreath and run the following command:
82 |
83 | xcodebuild -arch i386
84 |
85 | ### Support for additional features
86 | If you want to activate/deactivate some features, you can add some "-D{option}=0|1" options to the
87 | preparation command described above. Here is a list of some available features:
88 | * ENABLE_VIDEO
89 | * ENABLE_GPL_THIRD_PARTIES
90 | * ENABLE_SRTP
91 | * ENABLE_AMRNB
92 | * ENABLE_AMRWB
93 | * ENABLE_G729
94 | * ENABLE_GSM
95 | * ENABLE_OPUS
96 | * ENABLE_SPEEX
97 | * ENABLE_FFMPEG
98 | * ENABLE_H263
99 | * ENABLE_H263P
100 | * ENABLE_MPEG4
101 | * ENABLE_VPX
102 | * ENABLE_X264
103 | * ENABLE_OPENH264
104 |
105 | For example, if you want to activate OpenH264 support, add the "-DENABLE_OPENH264=1" option to
106 | the preparation command.
107 |
108 |
109 | Sign
110 | ---
111 | In order to sign each produced container you have to copy in `./sign/`
112 | directory at the linphone-web project root (create it if doesn't exist) the
113 | following files:
114 |
115 | * **linphoneweb.pfx**: The file containing private/public keys and the
116 | certificate (only for active-x part)
117 | * **linphoneweb.pem**: The file containing private/public keys and the
118 | certificate
119 | * **passphrase.txt**: The password used for open the two previous files
120 | (can be added just before compile and remove after)
121 |
--------------------------------------------------------------------------------
/Src/addressapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #ifndef H_ADDRESSAPI
26 | #define H_ADDRESSAPI
27 |
28 | #include
29 | #include "wrapperapi.h"
30 |
31 | namespace LinphoneWeb {
32 |
33 | FB_FORWARD_PTR(AddressAPI)
34 | class AddressAPI: public WrapperAPI {
35 | friend class FactoryAPI;
36 | private:
37 | LinphoneAddress *mAddress;
38 |
39 | AddressAPI(LinphoneAddress *address);
40 | AddressAPI(const LinphoneAddress *address);
41 | AddressAPI(StringPtr const &uri);
42 |
43 | protected:
44 | virtual void initProxy();
45 |
46 | public:
47 | virtual ~AddressAPI();
48 |
49 | StringPtr asString() const;
50 | StringPtr asStringUriOnly() const;
51 | void clean();
52 | AddressAPIPtr clone() const;
53 | StringPtr getDisplayName() const;
54 | StringPtr getDomain() const;
55 | int getPort() const;
56 | StringPtr getScheme() const;
57 | int getTransport() const;
58 | StringPtr getUsername() const;
59 | void setDisplayName(StringPtr const &displayname);
60 | void setDomain(StringPtr const &domain);
61 | void setPort(int port);
62 | void setTransport(int transport);
63 | void setUsername(StringPtr const &username);
64 |
65 | inline LinphoneAddress *getRef() {
66 | return mAddress;
67 | }
68 | };
69 |
70 | } // LinphoneWeb
71 |
72 | #endif //H_ADDRESSAPI
73 |
--------------------------------------------------------------------------------
/Src/authinfoapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #ifndef H_AUTHINFOAPI
26 | #define H_AUTHINFOAPI
27 |
28 | #include
29 | #include "wrapperapi.h"
30 |
31 | namespace LinphoneWeb {
32 |
33 | FB_FORWARD_PTR(AuthInfoAPI)
34 | class AuthInfoAPI: public WrapperAPI {
35 | friend class FactoryAPI;
36 | private:
37 | LinphoneAuthInfo *mAuthInfo;
38 |
39 | AuthInfoAPI(LinphoneAuthInfo *authInfo);
40 | AuthInfoAPI(const LinphoneAuthInfo *authInfo);
41 | AuthInfoAPI(StringPtr const &username, StringPtr const &userid,
42 | StringPtr const &passwd, StringPtr const &ha1, StringPtr const &realm, StringPtr const &domain);
43 |
44 | protected:
45 | virtual void initProxy();
46 |
47 | public:
48 | virtual ~AuthInfoAPI();
49 |
50 | StringPtr getHa1() const;
51 | void setHa1(StringPtr const &ha1);
52 |
53 | StringPtr getRealm() const;
54 | void setRealm(StringPtr const &realm);
55 |
56 | StringPtr getUserid() const;
57 | void setUserid(StringPtr const &userid);
58 |
59 | StringPtr getUsername() const;
60 | void setUsername(StringPtr const &username);
61 |
62 | StringPtr getPasswd() const;
63 | void setPasswd(StringPtr const &passwd);
64 |
65 | StringPtr getDomain() const;
66 | void setDomain(StringPtr const &domain);
67 |
68 | inline LinphoneAuthInfo *getRef() {
69 | return mAuthInfo;
70 | }
71 |
72 | };
73 |
74 | } // LinphoneWeb
75 |
76 | #endif //H_AUTHINFOAPI
77 |
--------------------------------------------------------------------------------
/Src/base64.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * base64.cpp
3 | * fbplugin
4 | *
5 | */
6 |
7 | #include "base64.h"
8 | #include
9 |
10 | namespace LinphoneWeb {
11 |
12 | static const unsigned char* base64_charset = (const unsigned char *)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
13 |
14 | std::string base64_encode(std::string const &indata) {
15 | std::string outdata;
16 | outdata.reserve(((indata.size() * 8) / 6) + 2);
17 | std::string::size_type remaining = indata.size();
18 | const char* dp = indata.data();
19 |
20 | while (remaining >= 3) {
21 | outdata.push_back(base64_charset[(dp[0] & 0xfc) >> 2]);
22 | outdata.push_back(base64_charset[((dp[0] & 0x03) << 4) | ((dp[1] & 0xf0) >> 4)]);
23 | outdata.push_back(base64_charset[((dp[1] & 0x0f) << 2) | ((dp[2] & 0xc0) >> 6)]);
24 | outdata.push_back(base64_charset[(dp[2] & 0x3f)]);
25 | remaining -= 3; dp += 3;
26 | }
27 |
28 | if (remaining == 2) {
29 | outdata.push_back(base64_charset[(dp[0] & 0xfc) >> 2]);
30 | outdata.push_back(base64_charset[((dp[0] & 0x03) << 4) | ((dp[1] & 0xf0) >> 4)]);
31 | outdata.push_back(base64_charset[((dp[1] & 0x0f) << 2)]);
32 | outdata.push_back(base64_charset[64]);
33 | } else if (remaining == 1) {
34 | outdata.push_back(base64_charset[(dp[0] & 0xfc) >> 2]);
35 | outdata.push_back(base64_charset[((dp[0] & 0x03) << 4)]);
36 | outdata.push_back(base64_charset[64]);
37 | outdata.push_back(base64_charset[64]);
38 | }
39 |
40 | return outdata;
41 | }
42 |
43 | std::string base64_decode(std::string const &indata) {
44 | std::string outdata;
45 | outdata.reserve((indata.size() * 6) / 8);
46 | static char* xtbl = NULL;
47 | if (! xtbl) {
48 | // Build translation table from base64_charset string (once)
49 | xtbl = new char[256];
50 | memset(xtbl, 0, 256);
51 | for (unsigned char s = 0; s < 64; ++s) {
52 | xtbl[base64_charset[s]] = s;
53 | }
54 | xtbl[base64_charset[64]] = 0; // padding character
55 | }
56 |
57 | std::string::size_type remaining = indata.size();
58 | const unsigned char* p = (const unsigned char*)indata.data();
59 | while (remaining >= 4) {
60 | char xp[4];
61 | for (size_t s = 0; s < 4; ++s) xp[s] = xtbl[p[s]];
62 | outdata.push_back((xp[0] << 2) | ((xp[1] & 0x30) >> 4));
63 | outdata.push_back(((xp[1] & 0x0f) << 4) | ((xp[2] & 0x3c) >> 2));
64 | outdata.push_back(((xp[2] & 0x03) << 6) | xp[3]);
65 | remaining -= 4;
66 | if (remaining == 0) {
67 | if (p[3] == base64_charset[64]) outdata.resize(outdata.size() - 1);
68 | if (p[2] == base64_charset[64]) outdata.resize(outdata.size() - 1);
69 | break;
70 | }
71 | p += 4;
72 | }
73 | if (remaining) { // compatibility for old, broken padding
74 | while (*(p++) == base64_charset[64]) outdata.resize(outdata.size() - 1); // pop_back
75 | }
76 | return outdata;
77 | }
78 |
79 | } // LinphoneWeb
80 |
81 |
--------------------------------------------------------------------------------
/Src/base64.h:
--------------------------------------------------------------------------------
1 | /**********************************************************\
2 | Original Author: Dan Weatherford
3 |
4 | Imported into FireBreath: Oct 4, 2010
5 | License: Dual license model; choose one of two:
6 | New BSD License
7 | http://www.opensource.org/licenses/bsd-license.php
8 | - or -
9 | GNU Lesser General Public License, version 2.1
10 | http://www.gnu.org/licenses/lgpl-2.1.html
11 |
12 | Copyright 2010 Dan Weatherford and Facebook, Inc
13 | \**********************************************************/
14 |
15 | #pragma once
16 | #include
17 |
18 | namespace LinphoneWeb {
19 |
20 | std::string base64_encode(std::string const &indata);
21 | std::string base64_decode(std::string const &indata);
22 |
23 | } // LinphoneWeb
24 |
--------------------------------------------------------------------------------
/Src/callapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #ifndef H_CALLAPI
26 | #define H_CALLAPI
27 |
28 | #include
29 | #include "wrapperapi.h"
30 |
31 | namespace LinphoneWeb {
32 |
33 | FB_FORWARD_PTR(CallLogAPI)
34 | FB_FORWARD_PTR(CallParamsAPI)
35 | FB_FORWARD_PTR(CallStatsAPI)
36 | FB_FORWARD_PTR(AddressAPI)
37 | FB_FORWARD_PTR(CoreAPI)
38 | FB_FORWARD_PTR(ErrorInfoAPI)
39 | FB_FORWARD_PTR(VideoAPI)
40 |
41 | FB_FORWARD_PTR(CallAPI)
42 | class CallAPI: public WrapperAPI {
43 | friend class FactoryAPI;
44 | private:
45 | LinphoneCall *mCall;
46 |
47 | CallAPI(LinphoneCall *call);
48 |
49 | protected:
50 | virtual void initProxy();
51 |
52 | public:
53 | virtual ~CallAPI();
54 |
55 | CallStatsAPIPtr getAudioStats() const;
56 | StringPtr getAuthenticationToken() const;
57 | bool getAuthenticationTokenVerified() const;
58 | float getAverageQuality() const;
59 | CallLogAPIPtr getCallLog() const;
60 | CoreAPIPtr getCore() const;
61 | CallParamsAPIPtr getCurrentParams() const;
62 | float getCurrentQuality() const;
63 | int getDir() const;
64 | int getDuration() const;
65 | ErrorInfoAPIPtr getErrorInfo() const;
66 | float getPlayVolume() const;
67 | int getReason() const;
68 | float getRecordVolume() const;
69 | StringPtr getReferTo() const;
70 | AddressAPIPtr getRemoteAddress() const;
71 | StringPtr getRemoteAddressAsString() const;
72 | StringPtr getRemoteContact() const;
73 | CallParamsAPIPtr getRemoteParams() const;
74 | StringPtr getRemoteUserAgent() const;
75 | CallAPIPtr getReplacedCall() const;
76 | LinphoneCallState getState() const;
77 | LinphoneCallState getTransferState() const;
78 | CallStatsAPIPtr getVideoStats() const;
79 |
80 | bool cameraEnabled() const;
81 | void enableCamera(bool enabled);
82 | bool echoCancellationEnabled() const;
83 | void enableEchoCancellation(bool enabled);
84 | bool echoLimiterEnabled() const;
85 | void enableEchoLimiter(bool enabled);
86 | void setNativeVideoWindowId(WhiteBoard::IdType id);
87 | WhiteBoard::IdType getNativeVideoWindowId() const;
88 |
89 | bool askedToAutoanswer() const;
90 | bool hasTransferPending() const;
91 | void sendVfuRequest();
92 | void setAuthenticationTokenVerified(bool verified);
93 | void zoomVideo(float zoom, float cx, float cy);
94 |
95 | void startRecording();
96 | void stopRecording();
97 |
98 | inline LinphoneCall *getRef() const {
99 | return mCall;
100 | }
101 |
102 | private:
103 | VideoAPIWeakPtr mVideoWindow;
104 | static void videoWindowEventHandler(const CallAPIWeakPtr &callPtr, void *ptr);
105 | void setVideoWindow(void *ptr);
106 | };
107 |
108 | } // LinphoneWeb
109 |
110 | #endif //H_CALLAPI
111 |
--------------------------------------------------------------------------------
/Src/calllogapi.cpp:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #include "calllogapi.h"
26 |
27 | #include "utils.h"
28 | #include "factoryapi.h"
29 |
30 | namespace LinphoneWeb {
31 |
32 | CallLogAPI::CallLogAPI(LinphoneCallLog *callLog) :
33 | WrapperAPI(APIDescription(this)), mCallLog(callLog) {
34 | FBLOG_DEBUG("CallLogAPI::CallLogAPI", "this=" << this << "\t" << "callLog=" << callLog);
35 | linphone_call_log_set_user_pointer(mCallLog, this);
36 | }
37 |
38 | void CallLogAPI::initProxy() {
39 | registerMethod("toStr", make_method(this, &CallLogAPI::toStr));
40 |
41 | registerProperty("callId", make_property(this, &CallLogAPI::getCallId));
42 | registerProperty("dir", make_property(this, &CallLogAPI::getDir));
43 | registerProperty("duration", make_property(this, &CallLogAPI::getDuration));
44 | registerProperty("from", make_property(this, &CallLogAPI::getFrom));
45 | registerProperty("quality", make_property(this, &CallLogAPI::getQuality));
46 | registerProperty("remoteAddress", make_property(this, &CallLogAPI::getRemoteAddress));
47 | registerProperty("startDate", make_property(this, &CallLogAPI::getStartDate));
48 | registerProperty("status", make_property(this, &CallLogAPI::getStatus));
49 | registerProperty("to", make_property(this, &CallLogAPI::getTo));
50 | registerProperty("videoEnabled", make_property(this, &CallLogAPI::videoEnabled));
51 | }
52 |
53 | CallLogAPI::~CallLogAPI() {
54 | FBLOG_DEBUG("CallLogAPI::~CallLogAPI", "this=" << this);
55 | linphone_call_log_set_user_pointer(mCallLog, NULL);
56 | }
57 |
58 | StringPtr CallLogAPI::getCallId() const {
59 | CORE_MUTEX
60 |
61 | FBLOG_DEBUG("CallLogAPI::getCallId", "this=" << this);
62 | return CHARPTR_TO_STRING(linphone_call_log_get_call_id(mCallLog));
63 | }
64 |
65 | LinphoneCallDir CallLogAPI::getDir() const {
66 | CORE_MUTEX
67 |
68 | FBLOG_DEBUG("CallLogAPI::getDir", "this=" << this);
69 | return linphone_call_log_get_dir(mCallLog);
70 | }
71 |
72 | int CallLogAPI::getDuration() const {
73 | CORE_MUTEX
74 |
75 | FBLOG_DEBUG("CallLogAPI::getDuration", "this=" << this);
76 | return linphone_call_log_get_duration(mCallLog);
77 | }
78 |
79 | AddressAPIPtr CallLogAPI::getFrom() const {
80 | CORE_MUTEX
81 |
82 | FBLOG_DEBUG("CallLogAPI::getFrom", "this=" << this);
83 | return getFactory()->getAddress(linphone_call_log_get_from(mCallLog));
84 | }
85 |
86 | float CallLogAPI::getQuality() const {
87 | CORE_MUTEX
88 |
89 | FBLOG_DEBUG("CallLogAPI::getQuality", "this=" << this);
90 | return linphone_call_log_get_quality(mCallLog);
91 | }
92 |
93 | AddressAPIPtr CallLogAPI::getRemoteAddress() const {
94 | CORE_MUTEX
95 |
96 | FBLOG_DEBUG("CallLogAPI::getRemoteAddress", "this=" << this);
97 | return getFactory()->getAddress(linphone_call_log_get_remote_address(mCallLog));
98 | }
99 |
100 | time_t CallLogAPI::getStartDate() const {
101 | CORE_MUTEX
102 |
103 | FBLOG_DEBUG("CallLogAPI::getStartDate", "this=" << this);
104 | // WARNING: Keep only the least-significant 32 bits because of difference of definition of time_t between mingw and visual studio
105 | return (linphone_call_log_get_start_date(mCallLog) & 0xFFFFFFFF);
106 | }
107 |
108 | LinphoneCallStatus CallLogAPI::getStatus() const {
109 | CORE_MUTEX
110 |
111 | FBLOG_DEBUG("CallLogAPI::getStatus", "this=" << this);
112 | return linphone_call_log_get_status(mCallLog);
113 | }
114 |
115 | AddressAPIPtr CallLogAPI::getTo() const {
116 | CORE_MUTEX
117 |
118 | FBLOG_DEBUG("CallLogAPI::getTo", "this=" << this);
119 | return getFactory()->getAddress(linphone_call_log_get_to(mCallLog));
120 | }
121 |
122 | bool CallLogAPI::videoEnabled() const {
123 | CORE_MUTEX
124 |
125 | FBLOG_DEBUG("CallLogAPI::videoEnabled", "this=" << this);
126 | return linphone_call_log_video_enabled(mCallLog) == TRUE? true:false;
127 | }
128 |
129 | StringPtr CallLogAPI::toStr() const {
130 | CORE_MUTEX
131 |
132 | FBLOG_DEBUG("CallLogAPI::toStr", "this=" << this);
133 | return CHARPTR_TO_STRING(linphone_call_log_to_str(mCallLog));
134 | }
135 |
136 | } // LinphoneWeb
137 |
--------------------------------------------------------------------------------
/Src/calllogapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #ifndef H_CALLLOGAPI
26 | #define H_CALLLOGAPI
27 |
28 | #include
29 | #include "wrapperapi.h"
30 |
31 | namespace LinphoneWeb {
32 |
33 | FB_FORWARD_PTR(AddressAPI)
34 |
35 | FB_FORWARD_PTR(CallLogAPI)
36 | class CallLogAPI: public WrapperAPI {
37 | friend class FactoryAPI;
38 | private:
39 | LinphoneCallLog *mCallLog;
40 |
41 | CallLogAPI(LinphoneCallLog *callLog);
42 |
43 | protected:
44 | virtual void initProxy();
45 |
46 | public:
47 | virtual ~CallLogAPI();
48 |
49 | StringPtr getCallId() const;
50 | LinphoneCallDir getDir() const;
51 | int getDuration() const;
52 | AddressAPIPtr getFrom() const;
53 | float getQuality() const;
54 | AddressAPIPtr getRemoteAddress() const;
55 | time_t getStartDate() const;
56 | LinphoneCallStatus getStatus() const;
57 | AddressAPIPtr getTo() const;
58 | bool videoEnabled() const;
59 |
60 | StringPtr toStr() const;
61 |
62 | inline LinphoneCallLog *getRef() {
63 | return mCallLog;
64 | }
65 | };
66 |
67 | } // LinphoneWeb
68 |
69 | #endif //H_CALLLOGAPI
70 |
--------------------------------------------------------------------------------
/Src/callparamsapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #ifndef H_CALLPARAMSAPI
26 | #define H_CALLPARAMSAPI
27 |
28 | #include
29 | #include "wrapperapi.h"
30 |
31 | namespace LinphoneWeb {
32 |
33 | FB_FORWARD_PTR(MSVideoSizeAPI)
34 | FB_FORWARD_PTR(PayloadTypeAPI)
35 |
36 | FB_FORWARD_PTR(CallParamsAPI)
37 | class CallParamsAPI: public WrapperAPI {
38 | friend class FactoryAPI;
39 | private:
40 | LinphoneCallParams *mCallParams;
41 |
42 | CallParamsAPI(LinphoneCallParams *callParams);
43 | CallParamsAPI(const LinphoneCallParams *callParams);
44 |
45 | protected:
46 | virtual void initProxy();
47 |
48 | public:
49 | virtual ~CallParamsAPI();
50 |
51 | int getAudioBandwidthLimit() const;
52 | void setAudioBandwidthLimit(int bw);
53 | int getAudioDirection() const;
54 | void setAudioDirection(int dir);
55 | bool earlyMediaSendingEnabled() const;
56 | void enableEarlyMediaSending(bool enable);
57 | bool localConferenceMode() const;
58 | bool lowBandwidthEnabled() const;
59 | void enableLowBandwidth(bool enable);
60 | int getMediaEncryption() const;
61 | void setMediaEncryption(int encryption);
62 | MSVideoSizeAPIPtr getReceivedVideoSize() const;
63 | MSVideoSizeAPIPtr getSentVideoSize() const;
64 | PayloadTypeAPIPtr getUsedAudioCodec() const;
65 | PayloadTypeAPIPtr getUsedVideoCodec() const;
66 | StringPtr getRecordFile() const;
67 | void setRecordFile(StringPtr const &file);
68 | int getVideoDirection() const;
69 | void setVideoDirection(int dir);
70 | void enableVideo(bool enable);
71 | bool videoEnabled() const;
72 | CallParamsAPIPtr copy() const;
73 | void addCustomHeader(StringPtr const &headerName, StringPtr const &headerValue);
74 | StringPtr getCustomHeader(StringPtr const &headerName) const;
75 |
76 | inline LinphoneCallParams *getRef() {
77 | return mCallParams;
78 | }
79 | };
80 |
81 | } // LinphoneWeb
82 |
83 | #endif //H_CALLPARAMSAPI
84 |
--------------------------------------------------------------------------------
/Src/callstatsapi.cpp:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #include "callstatsapi.h"
26 |
27 | #include "utils.h"
28 | #include "factoryapi.h"
29 |
30 | namespace LinphoneWeb {
31 |
32 | CallStatsAPI::CallStatsAPI(const LinphoneCallStats *callStats) :
33 | WrapperAPI(APIDescription(this)), mCallStats(const_cast(callStats)) {
34 | FBLOG_DEBUG("CallStatsAPI::CallStatsAPI", "this=" << this << "\t" << "callStats=" << callStats);
35 | }
36 |
37 | void CallStatsAPI::initProxy() {
38 | registerProperty("downloadBandwidth", make_property(this, &CallStatsAPI::getDownloadBandwidth));
39 | registerProperty("iceStats", make_property(this, &CallStatsAPI::getIceStats));
40 | registerProperty("localLateRate", make_property(this, &CallStatsAPI::getLocalLateRate));
41 | registerProperty("localLossRate", make_property(this, &CallStatsAPI::getLocalLossRate));
42 | registerProperty("roundTripDelay", make_property(this, &CallStatsAPI::getRoundTripDelay));
43 | registerProperty("type", make_property(this, &CallStatsAPI::getType));
44 | registerProperty("uploadBandwidth", make_property(this, &CallStatsAPI::getUploadBandwidth));
45 | registerProperty("upnpState", make_property(this, &CallStatsAPI::getUpnpState));
46 | }
47 |
48 | CallStatsAPI::~CallStatsAPI() {
49 | FBLOG_DEBUG("CallStatsAPI::~CallStatsAPI", "this=" << this);
50 | }
51 |
52 | float CallStatsAPI::getDownloadBandwidth() const {
53 | CORE_MUTEX
54 |
55 | FBLOG_DEBUG("CallStatsAPI::getDownloadBandwidth", "this=" << this);
56 | return mCallStats->download_bandwidth;
57 | }
58 |
59 | int CallStatsAPI::getIceStats() const {
60 | CORE_MUTEX
61 |
62 | FBLOG_DEBUG("CallStatsAPI::getIceStats", "this=" << this);
63 | return mCallStats->ice_state;
64 | }
65 |
66 | float CallStatsAPI::getLocalLateRate() const {
67 | CORE_MUTEX
68 |
69 | FBLOG_DEBUG("CallStatsAPI::getLocalLossRate", "this=" << this);
70 | return mCallStats->local_late_rate;
71 | }
72 |
73 | float CallStatsAPI::getLocalLossRate() const {
74 | CORE_MUTEX
75 |
76 | FBLOG_DEBUG("CallStatsAPI::getLocalLossRate", "this=" << this);
77 | return mCallStats->local_loss_rate;
78 | }
79 |
80 | //receivedRtcp() const;
81 | float CallStatsAPI::getRoundTripDelay() const {
82 | CORE_MUTEX
83 |
84 | FBLOG_DEBUG("CallStatsAPI::getRoundTripDelay", "this=" << this);
85 | return mCallStats->round_trip_delay;
86 | }
87 |
88 | //getSentRtcp() const;
89 |
90 | int CallStatsAPI::getType() const {
91 | CORE_MUTEX
92 |
93 | FBLOG_DEBUG("CallStatsAPI::getType", "this=" << this);
94 | return mCallStats->type;
95 | }
96 |
97 | float CallStatsAPI::getUploadBandwidth() const {
98 | CORE_MUTEX
99 |
100 | FBLOG_DEBUG("CallStatsAPI::getUploadBandwidth", "this=" << this);
101 | return mCallStats->upload_bandwidth;
102 | }
103 |
104 | int CallStatsAPI::getUpnpState() const {
105 | CORE_MUTEX
106 |
107 | FBLOG_DEBUG("CallStatsAPI::getUpnpState", "this=" << this);
108 | return mCallStats->upnp_state;
109 | }
110 |
111 | } // LinphoneWeb
112 |
--------------------------------------------------------------------------------
/Src/callstatsapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #ifndef H_CALLSTATSAPI
26 | #define H_CALLSTATSAPI
27 |
28 | #include
29 | #include "wrapperapi.h"
30 |
31 | namespace LinphoneWeb {
32 |
33 | FB_FORWARD_PTR(CallStatsAPI)
34 | class CallStatsAPI: public WrapperAPI {
35 | friend class FactoryAPI;
36 | private:
37 | LinphoneCallStats *mCallStats;
38 |
39 | CallStatsAPI(const LinphoneCallStats *callStats);
40 |
41 | protected:
42 | virtual void initProxy();
43 |
44 | public:
45 | virtual ~CallStatsAPI();
46 |
47 | float getDownloadBandwidth() const;
48 | int getIceStats() const;
49 | float getLocalLateRate() const;
50 | float getLocalLossRate() const;
51 | //receivedRtcp() const;
52 | float getRoundTripDelay() const;
53 | //getSentRtcp() const;
54 | int getType() const;
55 | float getUploadBandwidth() const;
56 | int getUpnpState() const;
57 |
58 | inline LinphoneCallStats *getRef() {
59 | return mCallStats;
60 | }
61 | };
62 |
63 | } // LinphoneWeb
64 |
65 | #endif //H_CALLSTATSAPI
66 |
--------------------------------------------------------------------------------
/Src/chatmessageapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2014 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Ghislain MARY
22 |
23 | */
24 |
25 | #ifndef H_CHATMESSAGEAPI
26 | #define H_CHATMESSAGEAPI
27 |
28 | #include
29 | #include "wrapperapi.h"
30 |
31 | namespace LinphoneWeb {
32 | FB_FORWARD_PTR(AddressAPI)
33 | FB_FORWARD_PTR(ChatMessageAPI)
34 | FB_FORWARD_PTR(ChatRoomAPI)
35 | FB_FORWARD_PTR(ContentAPI)
36 | FB_FORWARD_PTR(ErrorInfoAPI)
37 |
38 | class ChatMessageAPI: public WrapperAPI {
39 | friend class FactoryAPI;
40 |
41 | private:
42 | LinphoneChatMessage *mChatMessage;
43 |
44 | ChatMessageAPI(LinphoneChatMessage *chatMessage);
45 |
46 | protected:
47 | virtual void initProxy();
48 |
49 | public:
50 | virtual ~ChatMessageAPI();
51 |
52 | DECLARE_PROPERTY_FILE(ChatMessageAPI, getFileTransferFilepath, setFileTransferFilepath);
53 | StringPtr getFileTransferFilepathOnFilesystem() const;
54 | void addCustomHeader(StringPtr const &headerName, StringPtr const &headerValue);
55 | StringPtr getAppdata() const;
56 | void setAppdata(StringPtr const &data);
57 | void cancelFileTransfer();
58 | ChatRoomAPIPtr getChatRoom() const;
59 | ChatMessageAPIPtr clone() const;
60 | ErrorInfoAPIPtr getErrorInfo() const;
61 | StringPtr getExternalBodyUrl() const;
62 | ContentAPIPtr getFileTransferInformation() const;
63 | AddressAPIPtr getFromAddress() const;
64 | StringPtr getCustomHeader(StringPtr const &headerName);
65 | AddressAPIPtr getLocalAddress() const;
66 | bool outgoing() const;
67 | AddressAPIPtr getPeerAddress() const;
68 | bool read() const;
69 | int getState() const;
70 | unsigned int getStorageId() const;
71 | StringPtr getText() const;
72 | time_t getTime() const;
73 | AddressAPIPtr getToAddress() const;
74 | void downloadFile();
75 |
76 | inline LinphoneChatMessage *getRef() {
77 | return mChatMessage;
78 | }
79 |
80 | public: // Event helpers
81 | FB_JSAPI_EVENT(msgStateChanged, 2, (ChatMessageAPIPtr, const int&));
82 | FB_JSAPI_EVENT(fileTransferProgressIndication, 4, (ChatMessageAPIPtr, ContentAPIPtr, size_t, size_t));
83 |
84 | protected:
85 | virtual void onMsgStateChanged(LinphoneChatMessageState state);
86 | virtual void onFileTransferProgressIndication(const LinphoneContent *content, size_t offset, size_t total);
87 |
88 | private:
89 | // C Wrappers
90 | static void wrapper_msg_state_changed(LinphoneChatMessage *msg, LinphoneChatMessageState state);
91 | static void wrapper_file_transfer_progress_indication(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total);
92 | };
93 | } // LinphoneWeb
94 |
95 | #endif //H_CHATMESSAGEAPI
--------------------------------------------------------------------------------
/Src/chatroomapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2014 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Ghislain MARY
22 |
23 | */
24 |
25 | #ifndef H_CHATROOMAPI
26 | #define H_CHATROOMAPI
27 |
28 | #include
29 | #include "wrapperapi.h"
30 |
31 | namespace LinphoneWeb {
32 | FB_FORWARD_PTR(AddressAPI)
33 | FB_FORWARD_PTR(ChatMessageAPI)
34 | FB_FORWARD_PTR(ChatRoomAPI)
35 | FB_FORWARD_PTR(ContentAPI)
36 | FB_FORWARD_PTR(CoreAPI)
37 |
38 | class ChatRoomAPI: public WrapperAPI {
39 | friend class FactoryAPI;
40 |
41 | private:
42 | LinphoneChatRoom *mChatRoom;
43 |
44 | ChatRoomAPI(LinphoneChatRoom *chatRoom);
45 |
46 | protected:
47 | virtual void initProxy();
48 |
49 | public:
50 | virtual ~ChatRoomAPI();
51 |
52 | void compose();
53 | CoreAPIPtr getCore() const;
54 | ChatMessageAPIPtr createFileTransferMessage(ContentAPIPtr const &content);
55 | ChatMessageAPIPtr createMessage(StringPtr const &message);
56 | ChatMessageAPIPtr createMessage2(StringPtr const &message, StringPtr const &externalBodyUrl, int state, time_t time, bool isRead, bool isIncoming);
57 | void deleteHistory();
58 | void deleteMessage(ChatMessageAPIPtr const &chatMessage);
59 | std::vector getHistoryRange(int begin, int end) const;
60 | int getHistorySize() const;
61 | AddressAPIPtr getPeerAddress() const;
62 | int getUnreadMessagesCount() const;
63 | void markAsRead();
64 | bool remoteComposing() const;
65 | void sendChatMessage(ChatMessageAPIPtr const &chatMessage);
66 |
67 | inline LinphoneChatRoom *getRef() {
68 | return mChatRoom;
69 | }
70 | };
71 | } // LinphoneWeb
72 |
73 | #endif //H_CHATROOMAPI
--------------------------------------------------------------------------------
/Src/contentapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2014 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Ghislain MARY
22 |
23 | */
24 |
25 | #ifndef H_CONTENTAPI
26 | #define H_CONTENTAPI
27 |
28 | #include
29 | #include "wrapperapi.h"
30 |
31 | namespace LinphoneWeb {
32 | class ContentAPI: public WrapperAPI {
33 | friend class FactoryAPI;
34 |
35 | private:
36 | LinphoneContent *mContent;
37 |
38 | ContentAPI(LinphoneContent *content);
39 | ContentAPI(const LinphoneContent *content);
40 |
41 | protected:
42 | virtual void initProxy();
43 |
44 | public:
45 | virtual ~ContentAPI();
46 |
47 | StringPtr getBuffer() const;
48 | void setBuffer(StringPtr const &b64String);
49 | StringPtr getEncoding() const;
50 | void setEncoding(StringPtr const &encoding);
51 | StringPtr getName() const;
52 | void setName(StringPtr const &name);
53 | size_t getSize() const;
54 | void setSize(size_t size);
55 | StringPtr getStringBuffer() const;
56 | void setStringBuffer(StringPtr const &buffer);
57 | StringPtr getSubtype() const;
58 | void setSubtype(StringPtr const &subtype);
59 | StringPtr getType() const;
60 | void setType(StringPtr const &type);
61 |
62 | inline LinphoneContent *getRef() {
63 | return mContent;
64 | }
65 | };
66 | } // LinphoneWeb
67 |
68 | #endif //H_CONTENTAPI
--------------------------------------------------------------------------------
/Src/coreplugin.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #ifndef H_COREPLUGIN
26 | #define H_COREPLUGIN
27 |
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 | #include "whiteboard.h"
34 | #include "factoryapi.h"
35 | #include
36 |
37 | namespace LinphoneWeb {
38 |
39 | FB_FORWARD_PTR(CorePlugin)
40 | class CorePlugin: public FB::PluginCore {
41 | private:
42 | #ifdef DEBUG
43 | #ifdef WIN32
44 | static FILE *s_log_file;
45 | #endif //WIN32
46 | #endif //DEBUG
47 | static CorePluginWeakPtr s_log_plugin;
48 | static void log(OrtpLogLevel lev, const char *fmt, va_list args);
49 | static void enableLog();
50 | static void disableLog();
51 |
52 | WhiteBoardPtr mWhiteBoard;
53 |
54 | public:
55 | static void StaticInitialize();
56 | static void StaticDeinitialize();
57 |
58 | public:
59 | CorePlugin(WhiteBoardPtr const &whiteboard);
60 | virtual ~CorePlugin();
61 |
62 | public:
63 | void onPluginReady();
64 | void shutdown();
65 | virtual FB::JSAPIPtr createJSAPI();
66 | // If you want your plugin to always be windowless, set this to true
67 | // If you want your plugin to be optionally windowless based on the
68 | // value of the "windowless" param tag, remove this method or return
69 | // FB::PluginCore::isWindowless()
70 | virtual bool isWindowless() {
71 | return true;
72 | }
73 |
74 | BEGIN_PLUGIN_EVENT_MAP()
75 | EVENTTYPE_CASE(FB::MouseDownEvent, onMouseDown, FB::PluginWindow)
76 | EVENTTYPE_CASE(FB::MouseUpEvent, onMouseUp, FB::PluginWindow)
77 | EVENTTYPE_CASE(FB::MouseMoveEvent, onMouseMove, FB::PluginWindow)
78 | EVENTTYPE_CASE(FB::MouseMoveEvent, onMouseMove, FB::PluginWindow)
79 | EVENTTYPE_CASE(FB::AttachedEvent, onWindowAttached, FB::PluginWindow)
80 | EVENTTYPE_CASE(FB::DetachedEvent, onWindowDetached, FB::PluginWindow)
81 | END_PLUGIN_EVENT_MAP()
82 |
83 | /** BEGIN EVENTDEF -- DON'T CHANGE THIS LINE **/
84 | virtual bool onMouseDown(FB::MouseDownEvent *evt, FB::PluginWindow *);
85 | virtual bool onMouseUp(FB::MouseUpEvent *evt, FB::PluginWindow *);
86 | virtual bool onMouseMove(FB::MouseMoveEvent *evt, FB::PluginWindow *);
87 | virtual bool onWindowAttached(FB::AttachedEvent *evt, FB::PluginWindow *);
88 | virtual bool onWindowDetached(FB::DetachedEvent *evt, FB::PluginWindow *);
89 | /** END EVENTDEF -- DON'T CHANGE THIS LINE **/
90 | };
91 |
92 | } // LinphoneWeb
93 |
94 | #endif //H_COREPLUGIN
95 |
--------------------------------------------------------------------------------
/Src/errorinfoapi.cpp:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2014 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 | */
20 |
21 | #include "errorinfoapi.h"
22 | #include "coreapi.h"
23 |
24 | #include "utils.h"
25 | #include "factoryapi.h"
26 |
27 | namespace LinphoneWeb {
28 |
29 | ErrorInfoAPI::ErrorInfoAPI(const LinphoneErrorInfo *ei) :
30 | WrapperAPI(APIDescription(this)) {
31 | FBLOG_DEBUG("ErrorInfoAPI::ErrorInfoAPI", "this=" << this << "\t" << "ei=" << ei);
32 | mReason = linphone_error_info_get_reason(ei);
33 | mProtocolCode = linphone_error_info_get_protocol_code(ei);
34 | mPhrase = CHARPTR_TO_STRING(linphone_error_info_get_phrase(ei));
35 | mDetails = CHARPTR_TO_STRING(linphone_error_info_get_details(ei));
36 | }
37 |
38 | void ErrorInfoAPI::initProxy() {
39 | registerProperty("details", make_property(this, &ErrorInfoAPI::getDetails));
40 | registerProperty("phrase", make_property(this, &ErrorInfoAPI::getPhrase));
41 | registerProperty("protocolCode", make_property(this, &ErrorInfoAPI::getProtocolCode));
42 | registerProperty("reason", make_property(this, &ErrorInfoAPI::getReason));
43 | }
44 |
45 | ErrorInfoAPI::~ErrorInfoAPI() {
46 | FBLOG_DEBUG("ErrorInfoAPI::~ErrorInfoAPI", "this=" << this);
47 | }
48 |
49 | int ErrorInfoAPI::getReason() const {
50 | FBLOG_DEBUG("ErrorInfoAPI::getReason", "this=" << this);
51 | return mReason;
52 | }
53 |
54 | int ErrorInfoAPI::getProtocolCode() const {
55 | FBLOG_DEBUG("ErrorInfoAPI::getProtocolCode", "this=" << this);
56 | return mProtocolCode;
57 | }
58 |
59 | StringPtr ErrorInfoAPI::getPhrase() const {
60 | FBLOG_DEBUG("ErrorInfoAPI::getPhrase", "this=" << this);
61 | return mPhrase;
62 | }
63 |
64 | StringPtr ErrorInfoAPI::getDetails() const {
65 | FBLOG_DEBUG("ErrorInfoAPI::getDetails", "this=" << this);
66 | return mDetails;
67 | }
68 |
69 | } // LinphoneWeb
70 |
--------------------------------------------------------------------------------
/Src/errorinfoapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2014 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 | */
20 |
21 | #ifndef H_ERRORINFOAPI
22 | #define H_ERRORINFOAPI
23 |
24 | #include
25 | #include "wrapperapi.h"
26 |
27 | namespace LinphoneWeb {
28 |
29 | FB_FORWARD_PTR(ErrorInfoAPI)
30 | class ErrorInfoAPI: public WrapperAPI {
31 | friend class FactoryAPI;
32 | private:
33 | int mReason;
34 | int mProtocolCode;
35 | StringPtr mPhrase;
36 | StringPtr mDetails;
37 |
38 | ErrorInfoAPI(const LinphoneErrorInfo *ei);
39 |
40 | protected:
41 | virtual void initProxy();
42 |
43 | public:
44 | virtual ~ErrorInfoAPI();
45 |
46 | int getReason() const;
47 | int getProtocolCode() const;
48 | StringPtr getPhrase() const;
49 | StringPtr getDetails() const;
50 | };
51 |
52 | } // LinphoneWeb
53 |
54 | #endif //H_ERRORINFOAPI
55 |
--------------------------------------------------------------------------------
/Src/filemanagerapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #ifndef H_FILEMANAGERAPI
26 | #define H_FILEMANAGERAPI
27 |
28 | #include "macro.h"
29 | #include
30 | #include "wrapperapi.h"
31 |
32 | #include
33 |
34 | #include
35 | #include
36 |
37 | namespace LinphoneWeb {
38 |
39 | FB_FORWARD_PTR(FileTransferAPI)
40 |
41 | FB_FORWARD_PTR(FileManagerAPI)
42 | class FileManagerAPI: public WrapperAPI {
43 | friend class FactoryAPI;
44 | private:
45 | FileManagerAPI();
46 | void initializePaths();
47 |
48 | /*
49 | * < Protocol
50 | */
51 | class Protocol {
52 | private:
53 | std::string mProtocol;
54 | boost::filesystem::path mPath;
55 |
56 | public:
57 | Protocol(std::string const &protocol, boost::filesystem::path const &path);
58 | std::string const &getProtocol();
59 | boost::filesystem::path const &getPath();
60 |
61 | public:
62 | static const std::string http;
63 | static const std::string https;
64 | static const std::string internal;
65 | static const std::string temp;
66 | static const std::string local;
67 | };
68 | /*
69 | * Protocol >
70 | */
71 |
72 | std::list mProtocols;
73 |
74 | protected:
75 | virtual void setFactory(FactoryAPIPtr factory);
76 |
77 | public:
78 | bool isSameHost(FB::URI const &uri);
79 | static bool isInternal(FB::URI const &uri);
80 | static bool isFile(FB::URI const &uri);
81 | static bool isHttp(FB::URI const &uri);
82 | std::string uriToFile(FB::URI const &uri);
83 | FB::URI fileToUri(std::string const &file);
84 |
85 | protected:
86 | virtual void initProxy();
87 |
88 | public:
89 | virtual ~FileManagerAPI();
90 |
91 | FileTransferAPIPtr copy(std::string const &sourceUrl, std::string const &targetUrl, FB::JSObjectPtr const &callback);
92 | void exists(std::string const &url, FB::JSObjectPtr const &callback);
93 | void remove(std::string const &url, FB::JSObjectPtr const &callback);
94 | void mkdir(std::string const &url, FB::JSObjectPtr const &callback);
95 | };
96 |
97 | } // LinphoneWeb
98 |
99 | #endif // H_FILEMANAGERAPI
100 |
--------------------------------------------------------------------------------
/Src/friendapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Ghislain MARY
22 |
23 | */
24 |
25 | #ifndef H_FRIENDAPI
26 | #define H_FRIENDAPI
27 |
28 | #include
29 | #include
30 | #include "wrapperapi.h"
31 |
32 | namespace LinphoneWeb {
33 |
34 | FB_FORWARD_PTR(AddressAPI)
35 | FB_FORWARD_PTR(FriendAPI)
36 | FB_FORWARD_PTR(PresenceModelAPI)
37 |
38 | class FriendAPI: public WrapperAPI {
39 | friend class FactoryAPI;
40 |
41 | private:
42 | LinphoneFriend *mFriend;
43 |
44 | FriendAPI();
45 | FriendAPI(LinphoneFriend *lFriend);
46 | FriendAPI(StringPtr const &address);
47 |
48 | protected:
49 | virtual void initProxy();
50 |
51 | public:
52 | virtual ~FriendAPI();
53 |
54 | void setAddress(AddressAPIPtr const &address);
55 | AddressAPIPtr getAddress() const;
56 | void setName(StringPtr const &name);
57 | StringPtr getName() const;
58 | void enableSubscribes(bool enable);
59 | bool subscribesEnabled() const;
60 | void setIncSubscribePolicy(int policy);
61 | int getIncSubscribePolicy() const;
62 | void setRefKey(StringPtr const &key);
63 | StringPtr getRefKey() const;
64 | void edit();
65 | void done();
66 | bool inList() const;
67 | PresenceModelAPIPtr getPresenceModel() const;
68 |
69 | inline LinphoneFriend *getRef() {
70 | return mFriend;
71 | }
72 | };
73 |
74 | } // LinphoneWeb
75 |
76 | #endif //H_FRIENDAPI
77 |
--------------------------------------------------------------------------------
/Src/lpconfigapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Ghislain MARY
22 |
23 | */
24 |
25 | #ifndef H_LPCONFIGAPI
26 | #define H_LPCONFIGAPI
27 |
28 | #include
29 | #include "wrapperapi.h"
30 |
31 | namespace LinphoneWeb {
32 |
33 | FB_FORWARD_PTR(LpConfigAPI)
34 |
35 | class LpConfigAPI: public WrapperAPI {
36 | friend class FactoryAPI;
37 |
38 | private:
39 | LpConfig *mLpConfig;
40 |
41 | LpConfigAPI(const LpConfig *lpconfig);
42 | LpConfigAPI(StringPtr const &configFilename);
43 | LpConfigAPI(StringPtr const &configFilename, StringPtr const &factoryConfigFilename);
44 |
45 | protected:
46 | virtual void initProxy();
47 |
48 | public:
49 | virtual ~LpConfigAPI();
50 |
51 | int readFile(StringPtr const &configFilename);
52 | int sync();
53 | bool hasSection(StringPtr const §ion) const;
54 | void cleanSection(StringPtr const §ion);
55 |
56 | float getFloat(StringPtr const §ion, StringPtr const &key, float defaultValue) const;
57 | int getInt(StringPtr const §ion, StringPtr const &key, int defaultValue) const;
58 | FB::VariantList getRange(StringPtr const §ion, StringPtr const &key, FB::VariantList const &defaultValues) const;
59 | StringPtr getString(StringPtr const §ion, StringPtr const &key, StringPtr const &defaultValue) const;
60 |
61 | void setFloat(StringPtr const §ion, StringPtr const &key, float value);
62 | void setInt(StringPtr const §ion, StringPtr const &key, int value);
63 | void setIntHex(StringPtr const §ion, StringPtr const &key, int value);
64 | void setRange(StringPtr const §ion, StringPtr const &key, FB::VariantList const &values);
65 | void setString(StringPtr const §ion, StringPtr const &key, StringPtr const &value);
66 |
67 | inline LpConfig *getRef() {
68 | return mLpConfig;
69 | }
70 | };
71 |
72 | } // LinphoneWeb
73 |
74 | #endif //H_LPCONFIGAPI
75 |
--------------------------------------------------------------------------------
/Src/msvideosizeapi.cpp:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 | */
20 |
21 | #include "msvideosizeapi.h"
22 | #include "coreapi.h"
23 |
24 | #include "utils.h"
25 | #include "factoryapi.h"
26 |
27 | namespace LinphoneWeb {
28 |
29 | MSVideoSizeAPI::MSVideoSizeAPI(MSVideoSize vs) :
30 | WrapperAPI(APIDescription(this)), mVideoSize(vs) {
31 | FBLOG_DEBUG("MSVideoSizeAPI::MSVideoSizeAPI", "this=" << this << "\t" << "vs.width=" << vs.width << "\t" << "vs.height=" << vs.height);
32 | }
33 |
34 | void MSVideoSizeAPI::initProxy() {
35 | registerProperty("height", make_property(this, &MSVideoSizeAPI::getHeight, &MSVideoSizeAPI::setHeight));
36 | registerProperty("width", make_property(this, &MSVideoSizeAPI::getWidth, &MSVideoSizeAPI::setWidth));
37 | }
38 |
39 | MSVideoSizeAPI::~MSVideoSizeAPI() {
40 | FBLOG_DEBUG("MSVideoSizeAPI::~MSVideoSizeAPI", "this=" << this);
41 | }
42 |
43 | int MSVideoSizeAPI::getHeight() const {
44 | FBLOG_DEBUG("MSVideoSizeAPI::getHeight", "this=" << this);
45 | return mVideoSize.height;
46 | }
47 |
48 | void MSVideoSizeAPI::setHeight(int height) {
49 | FBLOG_DEBUG("MSVideoSizeAPI::setHeight", "this=" << this << "\t" << "height=" << height);
50 | mVideoSize.height = height;
51 | }
52 |
53 | int MSVideoSizeAPI::getWidth() const {
54 | FBLOG_DEBUG("MSVideoSizeAPI::getWidth", "this=" << this);
55 | return mVideoSize.width;
56 | }
57 |
58 | void MSVideoSizeAPI::setWidth(int width) {
59 | FBLOG_DEBUG("MSVideoSizeAPI::setWidth", "this=" << this << "\t" << "width=" << width);
60 | mVideoSize.width = width;
61 | }
62 |
63 | } // LinphoneWeb
64 |
--------------------------------------------------------------------------------
/Src/msvideosizeapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2014 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 | */
20 |
21 | #ifndef H_MSVIDEOSIZEAPI
22 | #define H_MSVIDEOSIZEAPI
23 |
24 | #include
25 | #include "wrapperapi.h"
26 |
27 | namespace LinphoneWeb {
28 |
29 | FB_FORWARD_PTR(MSVideoSizeAPI)
30 | class MSVideoSizeAPI: public WrapperAPI {
31 | friend class FactoryAPI;
32 | private:
33 | MSVideoSize mVideoSize;
34 |
35 | MSVideoSizeAPI(MSVideoSize vs);
36 |
37 | protected:
38 | virtual void initProxy();
39 |
40 | public:
41 | virtual ~MSVideoSizeAPI();
42 |
43 | int getHeight() const;
44 | void setHeight(int height);
45 | int getWidth() const;
46 | void setWidth(int width);
47 | };
48 |
49 | } // LinphoneWeb
50 |
51 | #endif //H_MSVIDEOSIZEAPI
52 |
--------------------------------------------------------------------------------
/Src/payloadtypeapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #ifndef H_PAYLOADTYPEAPI
26 | #define H_PAYLOADTYPEAPI
27 |
28 | #include
29 | #include "wrapperapi.h"
30 |
31 | namespace LinphoneWeb {
32 |
33 | FB_FORWARD_PTR(CoreAPI)
34 |
35 | FB_FORWARD_PTR(PayloadTypeAPI)
36 | class PayloadTypeAPI: public WrapperAPI {
37 | friend class FactoryAPI;
38 | private:
39 | PayloadType *mPayloadType;
40 |
41 | PayloadTypeAPI(PayloadType *payloadType);
42 | PayloadTypeAPI(const PayloadType *payloadType);
43 |
44 | protected:
45 | virtual void initProxy();
46 |
47 | public:
48 | virtual ~PayloadTypeAPI();
49 |
50 | PayloadTypeAPIPtr clone() const;
51 | StringPtr getRtpmap() const;
52 |
53 | int getType() const;
54 | void setType(int type);
55 |
56 | int getClockRate() const;
57 | void setClockRate(int rate);
58 |
59 | int getBitsPerSample() const;
60 | void setBitsPerSample(int bps);
61 |
62 | int getNormalBitrate() const;
63 | void setNormalBitrate(int bitrate);
64 |
65 | StringPtr getMimeType() const;
66 | void setMimeType(StringPtr const &mime);
67 |
68 | int getChannels() const;
69 | void setChannels(int channels);
70 |
71 | StringPtr getRecvFmtp() const;
72 | void setRecvFmtp(StringPtr const &rfmtp);
73 |
74 | StringPtr getSendFmtp() const;
75 | void setSendFmtp(StringPtr const &sfmtp);
76 |
77 | int getFlags() const;
78 | void setFlags(int flags);
79 |
80 | inline PayloadType *getRef() const {
81 | return mPayloadType;
82 | }
83 | };
84 |
85 | } // LinphoneWeb
86 |
87 | #endif //H_PAYLOADTYPEAPI
88 |
--------------------------------------------------------------------------------
/Src/proxyconfigapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #ifndef H_PROXYCONFIGAPI
26 | #define H_PROXYCONFIGAPI
27 |
28 | #include
29 | #include "wrapperapi.h"
30 |
31 | namespace LinphoneWeb {
32 |
33 | FB_FORWARD_PTR(CoreAPI)
34 | FB_FORWARD_PTR(ErrorInfoAPI)
35 |
36 | FB_FORWARD_PTR(ProxyConfigAPI)
37 | class ProxyConfigAPI: public WrapperAPI {
38 | friend class FactoryAPI;
39 | private:
40 | LinphoneProxyConfig *mProxyConfig;
41 |
42 | ProxyConfigAPI(LinphoneProxyConfig *proxyConfig);
43 | ProxyConfigAPI();
44 |
45 | protected:
46 | virtual void initProxy();
47 |
48 | public:
49 | virtual ~ProxyConfigAPI();
50 |
51 | int getAvpfMode() const;
52 | void setAvpfMode(int mode);
53 | int getAvpfRrInterval() const;
54 | void setAvpfRrInterval(int interval);
55 |
56 | CoreAPIPtr getCore() const;
57 |
58 | StringPtr getContactParameters() const;
59 | void setContactParameters(StringPtr const ¶meter);
60 |
61 | bool getDialEscapePlus() const;
62 | void setDialEscapePlus(bool escape);
63 |
64 | StringPtr getDialPrefix() const;
65 | void setDialPrefix(StringPtr const &prefix);
66 |
67 | StringPtr getDomain() const;
68 | int getError() const;
69 | ErrorInfoAPIPtr getErrorInfo() const;
70 |
71 | bool publishEnabled() const;
72 | void enablePublish(bool enable);
73 |
74 | StringPtr getSipSetup() const;
75 | void setSipSetup(StringPtr const &sip_setup);
76 |
77 | void setServerAddr(StringPtr const &server_addr);
78 | StringPtr getServerAddr() const;
79 |
80 | void setIdentity(StringPtr const &identity);
81 | StringPtr getIdentity() const;
82 |
83 | void setRoute(StringPtr const &route);
84 | StringPtr getRoute() const;
85 |
86 | void setExpires(int expires);
87 | int getExpires() const;
88 | void setPublishExpires(int expires);
89 | int getPublishExpires() const;
90 |
91 | void enableRegister(bool val);
92 | bool registerEnabled() const;
93 |
94 | int getState() const;
95 |
96 | void edit();
97 | int done();
98 |
99 | StringPtr normalizeNumber(StringPtr const &username) const;
100 | void refreshRegister();
101 |
102 | inline LinphoneProxyConfig *getRef() {
103 | return mProxyConfig;
104 | }
105 | };
106 |
107 | } // LinphoneWeb
108 |
109 | #endif //H_PROXYCONFIGAPI
110 |
--------------------------------------------------------------------------------
/Src/siptransportsapi.cpp:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #include "siptransportsapi.h"
26 |
27 | namespace LinphoneWeb {
28 |
29 | SipTransportsAPI::SipTransportsAPI():
30 | WrapperAPI(APIDescription(this)) {
31 | FBLOG_DEBUG("SipTransportsAPI::SipTransportsAPI", "this=" << this);
32 | mSipTransports.udp_port = -1;
33 | mSipTransports.tcp_port = -1;
34 | mSipTransports.dtls_port = -1;
35 | mSipTransports.tls_port = -1;
36 | }
37 |
38 | void SipTransportsAPI::initProxy() {
39 | registerProperty("udpPort", make_property(this, &SipTransportsAPI::getUdpPort, &SipTransportsAPI::setUdpPort));
40 | registerProperty("tcpPort", make_property(this, &SipTransportsAPI::getTcpPort, &SipTransportsAPI::setTcpPort));
41 | registerProperty("dtlsPort", make_property(this, &SipTransportsAPI::getDtlsPort, &SipTransportsAPI::setDtlsPort));
42 | registerProperty("tlsPort", make_property(this, &SipTransportsAPI::getTlsPort, &SipTransportsAPI::setTlsPort));
43 | }
44 |
45 | SipTransportsAPI::~SipTransportsAPI() {
46 | FBLOG_DEBUG("SipTransportsAPI::~SipTransportsAPI", "this=" << this);
47 | }
48 |
49 | void SipTransportsAPI::setUdpPort(int port) {
50 | FBLOG_DEBUG("SipTransportsAPI::setUdpPort", "this=" << this << "\t" << "port=" << port);
51 | mSipTransports.udp_port = port;
52 | }
53 |
54 | int SipTransportsAPI::getUdpPort() const {
55 | FBLOG_DEBUG("SipTransportsAPI::getUdpPort", "this=" << this);
56 | return mSipTransports.udp_port;
57 | }
58 |
59 | void SipTransportsAPI::setTcpPort(int port) {
60 | FBLOG_DEBUG("SipTransportsAPI::setTcpPort", "this=" << this << "\t" << "port=" << port);
61 | mSipTransports.tcp_port = port;
62 | }
63 |
64 | int SipTransportsAPI::getTcpPort() const {
65 | FBLOG_DEBUG("SipTransportsAPI::getUdpPort", "this=" << this);
66 | return mSipTransports.tcp_port;
67 | }
68 |
69 | void SipTransportsAPI::setDtlsPort(int port) {
70 | FBLOG_DEBUG("SipTransportsAPI::setDtls", "this=" << this << "\t" << "port=" << port);
71 | mSipTransports.dtls_port = port;
72 | }
73 |
74 | int SipTransportsAPI::getDtlsPort() const {
75 | FBLOG_DEBUG("SipTransportsAPI::getUdpPort", "this=" << this);
76 | return mSipTransports.dtls_port;
77 | }
78 |
79 | void SipTransportsAPI::setTlsPort(int port) {
80 | FBLOG_DEBUG("SipTransportsAPI::setTlsPort", "this=" << this << "\t" << "port=" << port);
81 | mSipTransports.tls_port = port;
82 | }
83 |
84 | int SipTransportsAPI::getTlsPort() const {
85 | FBLOG_DEBUG("SipTransportsAPI::getUdpPort", "this=" << this);
86 | return mSipTransports.tls_port;
87 | }
88 |
89 | } // LinphoneWeb
--------------------------------------------------------------------------------
/Src/siptransportsapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #ifndef H_SIPTRANSPORTSAPI
26 | #define H_SIPTRANSPORTSAPI
27 |
28 | #include
29 | #include "wrapperapi.h"
30 |
31 | namespace LinphoneWeb {
32 |
33 | FB_FORWARD_PTR(SipTransportsAPI)
34 | class SipTransportsAPI: public WrapperAPI {
35 | friend class FactoryAPI;
36 | private:
37 | LCSipTransports mSipTransports;
38 |
39 | SipTransportsAPI();
40 |
41 | protected:
42 | virtual void initProxy();
43 |
44 | public:
45 | virtual ~SipTransportsAPI();
46 |
47 | inline const LCSipTransports *getRef() const {
48 | return &mSipTransports;
49 | }
50 |
51 | inline LCSipTransports *getRef() {
52 | return &mSipTransports;
53 | }
54 |
55 | void setUdpPort(int port);
56 | int getUdpPort() const;
57 | void setTcpPort(int port);
58 | int getTcpPort() const;
59 | void setDtlsPort(int port);
60 | int getDtlsPort() const;
61 | void setTlsPort(int port);
62 | int getTlsPort() const;
63 | };
64 |
65 | } // LinphoneWeb
66 |
67 | #endif //H_SIPTRANSPORTSAPI
--------------------------------------------------------------------------------
/Src/tunnelapi.cpp:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 | */
19 |
20 | #include "tunnelapi.h"
21 | #include "tunnelconfigapi.h"
22 | #include "coreapi.h"
23 |
24 | #include "utils.h"
25 | #include "factoryapi.h"
26 |
27 | #include
28 |
29 | namespace LinphoneWeb {
30 |
31 | TunnelAPI::TunnelAPI(LinphoneTunnel *tunnel) :
32 | WrapperAPI(APIDescription(this)), mTunnel(tunnel) {
33 | FBLOG_DEBUG("TunnelAPI::TunnelAPI", "this=" << this << ", tunnel=" << tunnel);
34 | }
35 |
36 | void TunnelAPI::initProxy() {
37 | registerProperty("connected", make_property(this, &TunnelAPI::connected));
38 | registerProperty("mode", make_property(this, &TunnelAPI::getMode, &TunnelAPI::setMode));
39 | registerProperty("servers", make_property(this, &TunnelAPI::getServers));
40 | registerProperty("sipEnabled", make_property(this, &TunnelAPI::sipEnabled, &TunnelAPI::enableSip));
41 |
42 | registerMethod("addServer", make_method(this, &TunnelAPI::addServer));
43 | registerMethod("cleanServers", make_method(this, &TunnelAPI::cleanServers));
44 | registerMethod("reconnect", make_method(this, &TunnelAPI::reconnect));
45 | registerMethod("removeServer", make_method(this, &TunnelAPI::removeServer));
46 | }
47 |
48 | TunnelAPI::~TunnelAPI() {
49 | FBLOG_DEBUG("TunnelAPI::~TunnelAPI", "this=" << this);
50 | }
51 |
52 | bool TunnelAPI::connected() const {
53 | CORE_MUTEX
54 |
55 | FBLOG_DEBUG("TunnelAPI::connected", "this=" << this);
56 | return linphone_tunnel_connected(mTunnel) == TRUE ? true : false;
57 | }
58 |
59 | int TunnelAPI::getMode() const {
60 | CORE_MUTEX
61 |
62 | FBLOG_DEBUG("TunnelAPI::getMode", "this=" << this);
63 | return linphone_tunnel_get_mode(mTunnel);
64 | }
65 |
66 | void TunnelAPI::setMode(int mode) {
67 | CORE_MUTEX
68 |
69 | FBLOG_DEBUG("TunnelAPI::setMode", "this=" << this << "\t" << "mode=" << mode);
70 | linphone_tunnel_set_mode(mTunnel, (LinphoneTunnelMode)mode);
71 | }
72 |
73 | std::vector TunnelAPI::getServers() const {
74 | CORE_MUTEX
75 |
76 | FBLOG_DEBUG("TunnelAPI::getServers", "this=" << this);
77 | std::vector list;
78 | for (const MSList *node = linphone_tunnel_get_servers(mTunnel); node != NULL; node = ms_list_next(node)) {
79 | list.push_back(getFactory()->getTunnelConfig(reinterpret_cast(node->data)));
80 | }
81 | return list;
82 | }
83 |
84 | void TunnelAPI::enableSip(bool enable) {
85 | CORE_MUTEX
86 |
87 | FBLOG_DEBUG("TunnelAPI::enableSip", "this=" << this << "\t" << "enable=" << enable);
88 | linphone_tunnel_enable_sip(mTunnel, enable ? TRUE : FALSE);
89 | }
90 |
91 | bool TunnelAPI::sipEnabled() const {
92 | CORE_MUTEX
93 |
94 | FBLOG_DEBUG("TunnelAPI::sipEnabled", "this=" << this);
95 | return linphone_tunnel_sip_enabled(mTunnel) == TRUE ? true : false;
96 | }
97 |
98 | void TunnelAPI::addServer(TunnelConfigAPIPtr const &server) {
99 | CORE_MUTEX
100 |
101 | FBLOG_DEBUG("TunnelAPI::addServer", "this=" << this << "\t" << "server=" << server);
102 | linphone_tunnel_add_server(mTunnel, server->getRef());
103 | server->disOwn();
104 | }
105 |
106 | void TunnelAPI::cleanServers() {
107 | CORE_MUTEX
108 |
109 | FBLOG_DEBUG("TunnelAPI::cleanServers", "this=" << this);
110 | linphone_tunnel_clean_servers(mTunnel);
111 | }
112 |
113 | void TunnelAPI::reconnect() {
114 | CORE_MUTEX
115 |
116 | FBLOG_DEBUG("TunnelAPI::reconnect", "this=" << this);
117 | linphone_tunnel_reconnect(mTunnel);
118 | }
119 |
120 | void TunnelAPI::removeServer(TunnelConfigAPIPtr const &server) {
121 | CORE_MUTEX
122 |
123 | FBLOG_DEBUG("TunnelAPI::removeServer", "this=" << this << "\t" << "server=" << server);
124 | linphone_tunnel_remove_server(mTunnel, server->getRef());
125 | }
126 |
127 | } // LinphoneWeb
128 |
--------------------------------------------------------------------------------
/Src/tunnelapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 | */
19 |
20 | #ifndef H_TUNNELAPI
21 | #define H_TUNNELAPI
22 |
23 | #include
24 | #include "wrapperapi.h"
25 |
26 | namespace LinphoneWeb {
27 |
28 | FB_FORWARD_PTR(CoreAPI)
29 |
30 | FB_FORWARD_PTR(TunnelAPI)
31 | FB_FORWARD_PTR(TunnelConfigAPI)
32 | class TunnelAPI: public WrapperAPI {
33 | friend class FactoryAPI;
34 | private:
35 | LinphoneTunnel *mTunnel;
36 |
37 | TunnelAPI(LinphoneTunnel *tunnel);
38 |
39 | protected:
40 | virtual void initProxy();
41 |
42 | public:
43 | virtual ~TunnelAPI();
44 |
45 | bool connected() const;
46 | int getMode() const;
47 | void setMode(int mode);
48 | std::vector getServers() const;
49 | void enableSip(bool enable);
50 | bool sipEnabled() const;
51 |
52 | void addServer(TunnelConfigAPIPtr const &server);
53 | void cleanServers();
54 | void reconnect();
55 | void removeServer(TunnelConfigAPIPtr const &server);
56 |
57 | inline LinphoneTunnel *getRef() const {
58 | return mTunnel;
59 | }
60 | };
61 |
62 | } // LinphoneWeb
63 |
64 | #endif //H_TUNNELAPI
65 |
--------------------------------------------------------------------------------
/Src/tunnelconfigapi.cpp:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 | */
19 |
20 | #include "tunnelconfigapi.h"
21 | #include "coreapi.h"
22 |
23 | #include "utils.h"
24 | #include "factoryapi.h"
25 |
26 | #include
27 |
28 | namespace LinphoneWeb {
29 |
30 | TunnelConfigAPI::TunnelConfigAPI(LinphoneTunnelConfig *tunnelConfig) :
31 | WrapperAPI(APIDescription(this)), mTunnelConfig(tunnelConfig) {
32 | FBLOG_DEBUG("TunnelConfigAPI::TunnelConfigAPI", "this=" << this << ", tunnelConfig=" << tunnelConfig);
33 | }
34 |
35 | TunnelConfigAPI::TunnelConfigAPI() :
36 | WrapperAPI(APIDescription(this)) {
37 | FBLOG_DEBUG("TunnelConfigAPI::TunnelConfigAPI", "this=" << this);
38 | mTunnelConfig = linphone_tunnel_config_new();
39 | if(mTunnelConfig == NULL) {
40 | throw std::invalid_argument("one/many parameters is/are invalid");
41 | }
42 | }
43 |
44 | void TunnelConfigAPI::initProxy() {
45 | registerProperty("delay", make_property(this, &TunnelConfigAPI::getDelay, &TunnelConfigAPI::setDelay));
46 | registerProperty("host", make_property(this, &TunnelConfigAPI::getHost, &TunnelConfigAPI::setHost));
47 | registerProperty("port", make_property(this, &TunnelConfigAPI::getPort, &TunnelConfigAPI::setPort));
48 | registerProperty("remoteUdpMirrorPort", make_property(this, &TunnelConfigAPI::getRemoteUdpMirrorPort, &TunnelConfigAPI::setRemoteUdpMirrorPort));
49 | }
50 |
51 | TunnelConfigAPI::~TunnelConfigAPI() {
52 | FBLOG_DEBUG("TunnelConfigAPI::~TunnelConfigAPI", "this=" << this);
53 | if (isOwned()) {
54 | if(mTunnelConfig != NULL) {
55 | linphone_tunnel_config_destroy(mTunnelConfig);
56 | }
57 | }
58 | }
59 |
60 | int TunnelConfigAPI::getDelay() const {
61 | CORE_MUTEX
62 |
63 | FBLOG_DEBUG("TunnelConfigAPI::getDelay", "this=" << this);
64 | return linphone_tunnel_config_get_delay(mTunnelConfig);
65 | }
66 |
67 | void TunnelConfigAPI::setDelay(int delay) {
68 | CORE_MUTEX
69 |
70 | FBLOG_DEBUG("TunnelConfigAPI::setDelay", "this=" << this << "\t" << "delay=" << delay);
71 | linphone_tunnel_config_set_delay(mTunnelConfig, delay);
72 | }
73 |
74 | StringPtr TunnelConfigAPI::getHost() const {
75 | CORE_MUTEX
76 |
77 | FBLOG_DEBUG("TunnelConfigAPI::getHost", "this=" << this);
78 | return CHARPTR_TO_STRING(linphone_tunnel_config_get_host(mTunnelConfig));
79 | }
80 |
81 | void TunnelConfigAPI::setHost(StringPtr const &host) {
82 | CORE_MUTEX
83 |
84 | FBLOG_DEBUG("TunnelConfigAPI::setHost", "this=" << this << "\t" << "host=" << host);
85 | linphone_tunnel_config_set_host(mTunnelConfig, STRING_TO_CHARPTR(host));
86 | }
87 |
88 | int TunnelConfigAPI::getPort() const {
89 | CORE_MUTEX
90 |
91 | FBLOG_DEBUG("TunnelConfigAPI::getPort", "this=" << this);
92 | return linphone_tunnel_config_get_port(mTunnelConfig);
93 | }
94 |
95 | void TunnelConfigAPI::setPort(int port) {
96 | CORE_MUTEX
97 |
98 | FBLOG_DEBUG("TunnelConfigAPI::setPort", "this=" << this << "\t" << "port=" << port);
99 | linphone_tunnel_config_set_port(mTunnelConfig, port);
100 | }
101 |
102 | int TunnelConfigAPI::getRemoteUdpMirrorPort() const {
103 | CORE_MUTEX
104 |
105 | FBLOG_DEBUG("TunnelConfigAPI::getRemoteUdpMirrorPort", "this=" << this);
106 | return linphone_tunnel_config_get_remote_udp_mirror_port(mTunnelConfig);
107 | }
108 |
109 | void TunnelConfigAPI::setRemoteUdpMirrorPort(int port) {
110 | CORE_MUTEX
111 |
112 | FBLOG_DEBUG("TunnelConfigAPI::setRemoteUdpMirrorPort", "this=" << this << "\t" << "port=" << port);
113 | linphone_tunnel_config_set_remote_udp_mirror_port(mTunnelConfig, port);
114 | }
115 |
116 | } // LinphoneWeb
117 |
--------------------------------------------------------------------------------
/Src/tunnelconfigapi.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 | */
19 |
20 | #ifndef H_TUNNELCONFIGAPI
21 | #define H_TUNNELCONFIGAPI
22 |
23 | #include
24 | #include
25 | #include "wrapperapi.h"
26 |
27 | namespace LinphoneWeb {
28 |
29 | FB_FORWARD_PTR(CoreAPI)
30 |
31 | FB_FORWARD_PTR(TunnelConfigAPI)
32 | class TunnelConfigAPI: public WrapperAPI {
33 | friend class FactoryAPI;
34 | private:
35 | LinphoneTunnelConfig *mTunnelConfig;
36 |
37 | TunnelConfigAPI(LinphoneTunnelConfig *tunnelConfig);
38 | TunnelConfigAPI();
39 |
40 | protected:
41 | virtual void initProxy();
42 |
43 | public:
44 | virtual ~TunnelConfigAPI();
45 |
46 | int getDelay() const;
47 | void setDelay(int delay);
48 | StringPtr getHost() const;
49 | void setHost(StringPtr const &host);
50 | int getPort() const;
51 | void setPort(int port);
52 | int getRemoteUdpMirrorPort() const;
53 | void setRemoteUdpMirrorPort(int port);
54 |
55 | inline LinphoneTunnelConfig *getRef() const {
56 | return mTunnelConfig;
57 | }
58 | };
59 |
60 | } // LinphoneWeb
61 |
62 | #endif //H_TUNNELCONFIGAPI
63 |
--------------------------------------------------------------------------------
/Src/utils.cpp:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #include "utils.h"
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 | namespace LinphoneWeb {
34 |
35 | std::ostream& operator<<(std::ostream &out, StringPtr const &string) {
36 | if(string) {
37 | out << "\"" << string->c_str() << "\"";
38 | } else {
39 | out << "(NULL)";
40 | }
41 | return out;
42 | }
43 |
44 | StringPtr CHARPTR_TO_STRING(const char *cstr) {
45 | if(cstr != NULL) {
46 | std::string str(cstr);
47 | std::string filteredStr;
48 |
49 | // Replace invalid utf8 chars
50 | utf8::replace_invalid(str.begin(), str.end(), std::back_inserter(filteredStr));
51 | return StringPtr(filteredStr);
52 | }
53 | return StringPtr();
54 | }
55 |
56 | const char *STRING_TO_CHARPTR(StringPtr const &str) {
57 | return (str)? str->c_str() : NULL;
58 | }
59 |
60 | std::string PRINT_STRING(StringPtr const &str) {
61 | return (str)? str->c_str() : "(NULL)";
62 | }
63 |
64 | } // LinphoneWeb
65 |
--------------------------------------------------------------------------------
/Src/utils.h:
--------------------------------------------------------------------------------
1 | /*!
2 | Linphone Web - Web plugin of Linphone an audio/video SIP phone
3 | Copyright (C) 2012-2013 Belledonne Communications
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 |
19 |
20 | Authors:
21 | - Yann Diorcet
22 |
23 | */
24 |
25 | #ifndef H_UTILS
26 | #define H_UTILS
27 |
28 | #include