Merge branch 'master' into udp-reuseaddr

This commit is contained in:
Nanang Izzuddin 2023-01-22 16:45:35 +07:00
commit ed288defd9
27 changed files with 198 additions and 1448 deletions

View File

@ -1,48 +0,0 @@
[Last update: 2007/02/18]
-= INTRO=-
This top level projects:
- pjlib: portability and basic framework library
- pjlib-util: lexical scanner, XML, STUN, MD5, DNS, etc.
- pjmedia: media framework and codecs
- pjsip: SIP stacks (core, UA layer, SIMPLE, etc.)
- pjsip-apps: SIP apps (pjsua, pjsip-perf)
-= COMPILING =-
On Windows:
- Visual Studio 6: open pjproject.dsw
- Visual Studio 8/2005: open pjproject-vs8.sln
- Embedded VisualC 4: open open pjsip-apps\build\wince-evc4\wince_demos.vcw
- Build pjsua
With Makefile:
- on top level dir (e.g. ~/pjproject)
- ./configure && make dep && make clean && make
Binaries will be in pjsip-apps/bin.
-= PYTHON MODULE =-
On Windows:
- Visual Studio 6: open pjsip-apps\build\pjsip_apps.dsw
- Build py_pjsua module
With GNU and Python:
- cd pjsip-apps/src/py_pjsua
- python setup.py install
One Python sample application is provided:
pjsip-apps/src/py_pjsua/pjsua_app.py
-= PORTING =-
- Just need to port pjlib.
- PJLIB doc has detailed info how to do this.
- Must pass pjlib-test!

View File

@ -1,87 +0,0 @@
Build Instructions for PJLIB/PJMEDIA/PJSIP RTEMS Port
The RTEMS port uses the POSIX abstraction layer at the moment, and has been
tested with RTEMS 4.6 on i386 target.
Building RTEMS
---------------
I use RTEMS 4.6 on a cygwin host with i386/pc386 as target, but I think it
should work with different RTEMS versions/hosts/targets.
RTEMS was built with the following commands:
$ /opt/src/rtems-4.6.6/configure --enable-cxx --enable-posix --enable-networking --enable-rdbg --enable-tests --enable-rtemsbsp=pc386 --target=i386-rtems
$ make
$ make install
Supported Targets
-----------------
At the moment, pjlib supports i386 and mpc860 CPU target. For other targets,
you would need to create/tweak the appropriate "m-xxx.mak" in "build" directory
and the corresponding "m_xxx.h" header file in "pj/compat" directory.
Please refer to pjlib porting guide about how to port PJLIB to new CPU target.
Building PJLIB/PJMEDIA/PJSIP
----------------------------
Use the following steps to build the libraries:
1. Set RTEMS_LIBRARY_PATH environment variable to point to your BSP directory
(which is <RTEMS INSTALLATION POINT>/<BOARD SUPPORT PACKAGE>).
For example (with sh):
$ export RTEMS_LIBRARY_PATH=/opt/rtems-4.6/i386-rtems/pc386
2. Unfortunately pjproject's configure script is unable to create "build.mak"
for cross compilation (but this may change in the future), so we need to
create "build.mak" manually.
The file "README-configure" has some info about the variables in "build.mak".
For example, the "build.mak" for i386 target:
export MACHINE_NAME := i386
export OS_NAME := rtems
export HOST_NAME := mingw
export CC_NAME := gcc
export TARGET_NAME := i386-rtems
export CROSS_COMPILE := i386-rtems-
3. Put additional CFLAGS or LDFLAGS that are specific to your target in
"user.mak".
For example, my "user.mak" looks like this:
export CFLAGS +=
export LDFLAGS += -Wl,-Ttext,0x00100000 -Wl,--defsym -Wl,HeapSize=0x400000
4. Build the libraries:
$ make dep && make distclean && make
5. That should be it. The libraries should be in "lib" directory and
applications in "bin" directory.
Acknowledgements
----------------
Many thanks for Phil Torre <ptorre at zetron dot com>, who did most of the
initial porting and testing with pjlib etc. All credits go to him.

60
README.md Normal file
View File

@ -0,0 +1,60 @@
[![C/C++ CI](https://github.com/pjsip/pjproject/actions/workflows/ccpp.yml/badge.svg)](https://github.com/pjsip/pjproject/actions/workflows/ccpp.yml)
[![CodeQL](https://github.com/pjsip/pjproject/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/pjsip/pjproject/actions/workflows/codeql-analysis.yml)
# PJSIP
PJSIP is a free and open source multimedia communication library written in C with high level API in C, C++, Java, C#, and Python languages. It implements standard based protocols such as SIP, SDP, RTP, STUN, TURN, and ICE. It combines signaling protocol (SIP) with rich multimedia framework and NAT traversal functionality into high level API that is portable and suitable for almost any type of systems ranging from desktops, embedded systems, to mobile handsets.
## Getting PJSIP
- Main repository: https://github.com/pjsip/pjproject
- Releases: https://github.com/pjsip/pjproject/releases
## Documentation
Main documentation site: https://docs.pjsip.org
Table of contents:
- Overview
- [Overview](https://docs.pjsip.org/en/latest/overview/intro.html)
- [Features (Datasheet)](https://docs.pjsip.org/en/latest/overview/features.html)
- [License](https://docs.pjsip.org/en/latest/overview/license.html)
- **Getting started**
- [Getting PJSIP](https://docs.pjsip.org/en/latest/get-started/getting.html)
- [General Guidelines](https://docs.pjsip.org/en/latest/get-started/general_guidelines.html)
- [Android](https://docs.pjsip.org/en/latest/get-started/android/index.html)
- [iPhone](https://docs.pjsip.org/en/latest/get-started/ios/index.html)
- [Mac/Linux/Unix](https://docs.pjsip.org/en/latest/get-started/posix/index.html)
- [Windows](https://docs.pjsip.org/en/latest/get-started/windows/index.html)
- [Windows Phone](https://docs.pjsip.org/en/latest/get-started/windows-phone/index.html)
- PJSUA2 - High level API guide
- [Introduction](https://docs.pjsip.org/en/latest/pjsua2/intro.html)
- [Building PJSUA2](https://docs.pjsip.org/en/latest/pjsua2/building.html)
- [General concepts](https://docs.pjsip.org/en/latest/pjsua2/general_concept.html)
- [Hello world!](https://docs.pjsip.org/en/latest/pjsua2/building.html)
- [Using PJSUA2](https://docs.pjsip.org/en/latest/pjsua2/using/index.html)
- [Sample applications](https://docs.pjsip.org/en/latest/pjsua2/samples.html)
- Specific guides
- [Audio](https://docs.pjsip.org/en/latest/specific-guides/index.html#audio)
- [Build and integration](https://docs.pjsip.org/en/latest/specific-guides/index.html#build-integration)
- [Development and programming](https://docs.pjsip.org/en/latest/specific-guides/index.html#development-programming)
- [Media](https://docs.pjsip.org/en/latest/specific-guides/index.html#media)
- [Network and NAT](https://docs.pjsip.org/en/latest/specific-guides/index.html#network-nat)
- [Performance and footprint](https://docs.pjsip.org/en/latest/specific-guides/index.html#performance-footprint)
- [Security](https://docs.pjsip.org/en/latest/specific-guides/index.html#security)
- [SIP](https://docs.pjsip.org/en/latest/specific-guides/index.html#sip)
- [Video](https://docs.pjsip.org/en/latest/specific-guides/index.html#video)
- [Other](https://docs.pjsip.org/en/latest/specific-guides/index.html#other)
- API reference
- [PJSUA2](https://docs.pjsip.org/en/latest/api/pjsua2/index.html) - high level API (Java/C#/Python/C++/swig)
- [PJSUA-LIB](https://docs.pjsip.org/en/latest/api/pjsua-lib/index.html) - high level API (C)
- [PJSIP](https://docs.pjsip.org/en/latest/api/pjsip/index.html) - SIP stack
- [PJMEDIA](https://docs.pjsip.org/en/latest/api/pjmedia/index.html) - media framework
- [PJNATH](https://docs.pjsip.org/en/latest/api/pjnath/index.html) - NAT traversal helper
- [PJLIB-UTIL](https://docs.pjsip.org/en/latest/api/pjlib-util/index.html) - utilities
- [PJLIB](https://docs.pjsip.org/en/latest/api/pjlib/index.html) - portable library

View File

@ -1,968 +0,0 @@
Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see http://www.gnu.org/licenses/.
Getting Started: Building and Using PJSIP and PJMEDIA
[Last Update: $Date: 2007-02-02 20:42:44 +0000 (Fri, 02 Feb 2007) $]
Print Friendly Page
_________________________________________________________________
This article describes how to download, customize, build, and use the open
source PJSIP and PJMEDIA SIP and media stack. The online (and HTML) version
of this file can be downloaded from http://www.pjsip.org/using.htm
Quick Info
_________________________________________________________________
Building with GNU tools (Linux, *BSD, MacOS X, mingw, etc.)
Generally these should be all that are needed to build the libraries,
applications, and samples:
$ ./configure
$ make dep && make clean && make
Building Win32 Target with Microsoft Visual Studio
Generally we can just do these steps:
1. Visual Studio 6: open pjproject.dsw workspace,
2. Visual Studio 2005: open pjproject-vs8.sln solution,
3. Create an empty pjlib/include/pj/config_site.h, and
4. build the pjsua application.
Building for Windows Mobile
Generally these are all that are needed:
1. Open pjsip-apps/build/wince-evc4/wince_demos.vcw EVC4 workspace,
2. Create an empty pjlib/include/pj/config_site.h, and
3. build the pjsua_wince application.
Invoking Older Build System (e.g. for RTEMS)
Generally these should be all that are needed to build the libraries,
applications, and samples:
$ ./configure-legacy
$ make dep && make clean && make
Locating Output Binaries/Libraries
Libraries will be put in lib directory, and binaries will be put in
bin directory, under each projects.
Running the Applications
After successful build, you can try running pjsua application on
pjsip-apps/bin directory. PJSUA manual can be found in
http://www.pjsip.org/pjsua.htm page.
Table of Contents:
_________________________________________________________________
1. Getting the Source Distribution
1.1 Getting the Release tarball
1.2 Getting from Subversion trunk
1.3 Source Directories Layout
2. Build Preparation
2.1 config_site.h file
2.2 Disk Space Requirements
3. Building Linux, *nix, *BSD, and MacOS X Targets with GNU Build
Systems
3.1 Supported Targets
3.2 Requirements
3.3 Running configure
3.4 Running make
3.5 Cross Compilation
3.6 Build Customizations
4. Building for Windows Targets with Microsoft Visual Studio
4.1 Requirements
4.2 Building the Projects
4.3 Debugging the Sample Application
5. Building for Windows Mobile Targets (Windows CE/WinCE/PDA/SmartPhone)
5.1 Requirements
5.2 Building the Projects
6. Older PJLIB Build System for Non-Autoconf Targets (e.g. RTEMS)
6.1 Supported Targets
6.2 Invoking the Build System
7. Running the Applications
7.1 pjsua
7.2 Sample Applications
7.3 pjlib-test
7.4 pjsip-test
8. Using PJPROJECT with Applications
Appendix I: Common Problems/Frequently Asked Question (FAQ)
I.1 fatal error C1083: Cannot open include file: 'pj/config_site.h':
No such file or directory
1. Getting the Source Code Distribution
_________________________________________________________________
All libraries (PJLIB, PJLIB-UTIL, PJSIP, PJMEDIA, and PJMEDIA-CODEC) are
currently distributed under a single source tree, collectively named as
PJPROJECT or just PJ libraries. These libraries can be obtained by either
downloading the release tarball or getting them from the Subversion trunk.
1.1 Getting the Release tarball
_________________________________________________________________
Getting the released tarball is a convenient way to obtain stable version of
PJPROJECT. The tarball may not contain the latest features or bug-fixes, but
normally it is considered more stable as each will be tested more rigorously
before released.
The latest released tarball can be downloaded from the
http://www.pjsip.org/download.htm.
1.2 Getting from Subversion trunk
_________________________________________________________________
PJPROJECT Subversion repository will always contain the latest/most
up-to-date version of the sources. Normally the Subversion repository is
always kept in a "good" state. However, there's always a chance that things
break and the tree doesn't build correctly (particularly for the
"not-so-popular" targets), so please consult the mailing list should there
be any problems.
Using Subversion also has benefits of keeping the local copy of the source
up to date with the main PJ source tree and to easily track the changes made
to the local copy, if any.
What is Subversion
Subversion (SVN) is Open Source version control system similar to CVS.
Subversion homepage is in http://subversion.tigris.org/
Getting Subversion Client
A Subversion (SVN) client is needed to download the PJ source files from
pjsip.org SVN tree. SVN client binaries can be downloaded from
http://subversion.tigris.org/, and the program should be available for
Windows, Linux, MacOS X, and many more platforms.
Getting the Source for The First Time
Once Subversion client is installed, we can use these commands to initially
retrieve the latest sources from the Subversion trunk:
$ svn co http://svn.pjproject.net/repos/pjproject/trunk pjproject
$ cd pjproject
Keeping The Local Copy Up-to-Date
Once sources have been downloaded, we can keep the local copy up to date by
periodically synchronizing the local source with the latest revision from
the PJ's Subversion trunk. The mailing list provides best source of
information about the availability of new updates in the trunk.
To update the local copy with the latest changes in the main PJ's
repository:
$ cd pjproject
$ svn update
Tracking Local and Remote Changes
To see what files have been changed locally:
$ cd pjproject
$ svn status
The above command only compares local file against the original local copy,
so it doesn't require Internet connection while performing the check.
To see both what files have been changed locally and what files have been
updated in the PJ's Subversion repository:
$ cd pjproject
$ svn status -u
Note that this command requires active Internet connection to query the
status of PJPROJECT's source repository.
1.3 Source Directories Layout
_________________________________________________________________
Top-Level Directory Layout
The top-level directories (denoted as $TOP here) in the source distribution
contains the following sub-directories:
$TOP/build
Contains makefiles that are common for all projects.
$TOP/pjlib
Contains header and source files of PJLIB. PJLIB is the base
portability and framework library which is used by all other
libraries
$TOP/pjlib-util
Contains PJLIB-UTIL header and source files. PJLIB-UTIL is an
auxiliary library that contains utility functions such as scanner,
XML, STUN, MD5 algorithm, getopt() implementation, etc.
$TOP/pjmedia
Contains PJMEDIA and PJMEDIA-CODEC header and source files. The
sources of various codecs (such as GSM, Speex, and iLBC) can be found
under this directory.
$TOP/pjsip
Contains PJSIP header and source files.
$TOP/pjsip-apps
Contains source code for PJSUA and various sample applications.
Individual Directory Inside Each Project
Each library directory further contains these sub-directories:
bin
Contains binaries produced by the build process.
build
Contains build scripts/makefiles, project files, project workspace,
etc. to build the project. In particular, it contains one Makefile
file to build the project with GNU build systems, and a *.dsw
workspace file to build the library with Microsoft Visual Studio 6 or
later.
build/output
The build/output directory contains the object files and other files
generated by the build process. To support building multiple targets
with a single source tree, each build target will occupy a different
subdirectory under this directory.
build/wince-evc4
This directory contains the project/workspace files to build Windows
CE/WinCE version of the project using Microsoft Embedded Visual C++
4.
build/wince-evc4/output
This directory contains the library, executable, and object files
generated by Windows Mobile build process.
docs
Contains Doxygen configuration file (doxygen.cfg) to generate online
documentation from the source files. The output documentation will be
put in this directory as well (for example, docs/html directory for
the HTML files).
(to generate Doxygen documentation from the source tree, just run
"doxygen docs/doxygen.cfg" in the individual project directory. The
generated files will reside in docs directory).
include
Contains the header files for the project.
lib
Contains libraries produced by the build process.
src
Contains the source files of the project.
2. Build Preparation
_________________________________________________________________
2.1 Create config_site.h file
_________________________________________________________________
Before source files can be built, the pjlib/include/pj/config_site.h file
must be created (it can just be an empty file).
Note:
When the Makefile based build system is used, this process is taken
care by the Makefiles. But when non-Makefile based build system (such
as Visual Studio) is used, the config_site.h file must be created
manually.
What is config_site.h File
The pjlib/include/pj/config_site.h contains local customizations to the
libraries.
All customizations should be put in this file instead of modifying PJ's
files, because if PJ's files get modified, then those modified files will
not be updated the next time the source is synchronized. Or in other case,
the local modification may be overwritten with the fresh copy from the SVN.
Putting the local customization to the config_site.h solves this problem,
because this file is not included in the version control, so it will never
be overwritten by "svn update" command.
Please find list of configuration macros that can be overriden from these
files:
* PJLIB Configuration (the pjlib/config.h file)
* PJLIB-UTIL Configuration (the pjlib-util/config.h file)
* PJMEDIA Configuration (the pjmedia/config.h file)
* PJSIP Configuration (the pjsip/sip_config.h file)
A sample config_site.h file is also available in
pjlib/include/pj/config_site_sample.h.
Creating config_site.h file
The simplest way is just to create an empty file, to use whetever default
values set by the libraries.
Another way to create the config_site.h file is to write something like the
following:
// Uncomment to get minimum footprint (suitable for 1-2 concurrent calls
only)
//#define PJ_CONFIG_MINIMAL_SIZE
// Uncomment to get maximum performance
//#define PJ_CONFIG_MAXIMUM_SPEED
#include <pj/config_site_sample.h>
2.2 Disk Space Requirements
_________________________________________________________________
The building process needs:
about 50-60 MB of disk space to store the uncompressed source files, and
* about 30-50 MB of additional space for building each target
(Visual Studio Debug and Release are considered as separate targets)
3. Building Linux, *nix, *BSD, and MacOS X Targets with GNU Build Systems
_________________________________________________________________
3.1 Supported Targets
_________________________________________________________________
The new, autoconf based GNU build system can be used to build the
libraries/applications for the following targets:
* Linux/uC-Linux (i386, Opteron, Itanium, MIPS, PowerPC, etc.),
* MacOS X (PowerPC),
* mingw (i386),
* FreeBSD and maybe other BSD's (i386, Opteron, etc.),
* RTEMS with cross compilation (ARM, powerpc),
* Embox RTOS (i386, ARM including STM32),
* etc.
3.2 Requirements
_________________________________________________________________
In order to use PJ's GNU build system, these typical GNU tools are needed:
* GNU make (other make will not work),
* GNU binutils for the target, and
* GNU gcc for the target.
* OpenSSL header files/libraries (optional) if TLS support is wanted.
In addition, the appropriate "SDK" must be installed for the particular
target (this could just be a libc and the appropriate system abstraction
library such as Posix).
The build system is known to work on the following hosts:
* Linux, many types of distributions.
* MacOS X 10.2
* mingw (Win2K, XP)
* FreeBSD (must use gmake instead of make)
Building Win32 applications with Cygwin is currently not supported by the
autoconf script (there is some Windows header conflicts), but one can still
use the old configure script by calling ./configure-legacy. More over,
cross-compilations might also work with Cygwin.
3.3 Running configure
_________________________________________________________________
Using Default Settings
Run "./configure" without any options to let the script detect the
appropriate settings for the host:
$ cd pjproject
$ ./configure
...
Notes:
The default settings build the libraries in "debug" mode
(active assert()), with default CFLAGS set to "-O2". To change
the default CFLAGS, we can use the usual "./configure CFLAGS='-g'"
construct. To build in "release" mode, and deactivate assert(),
we can use "./configure CFLAGS='-DNDEBUG'".
Features Customization
With the new autoconf based build system, most configuration/customization
can be specified as configure arguments. The list of customizable features
can be viewed by running "./configure --help" command:
$ cd pjproject
$ ./configure --help
...
Optional Features:
--enable-epoll Use epoll on Linux instead of select
--disable-floating-point Disable floating point where possible
--disable-sound Exclude sound (i.e. use null sound)
--disable-small-filter Exclude small filter in resampling
--disable-large-filter Exclude large filter in resampling
--disable-g711-plc Exclude G.711 Annex A PLC
--disable-speex-aec Exclude Speex Acoustic Echo Canceller/AEC
--disable-g711-codec Exclude G.711 codecs from the build
--disable-l16-codec Exclude Linear/L16 codec family from the build
--disable-gsm-codec Exclude GSM codec in the build
--disable-speex-codec Exclude Speex codecs in the build
--disable-ilbc-codec Exclude iLBC codec in the build
--disable-tls Force excluding TLS support (default is autodetected based on
OpenSSL availability)
...
Configuring Debug Version and Other Customizations
The configure script accepts standard customization, which details can be
obtained by executing ./configure --help.
Below is an example of specifying CFLAGS in configure:
$ ./configure CFLAGS="-O3 -DNDEBUG -msoft-float -fno-builtin"
...
Configuring TLS Support
By default, TLS support is configured based on the availability of OpenSSL
header files and libraries. If OpenSSL is available at the default include
and library path locations, TLS will be enabled by the configure script.
You can explicitly disable TLS support by giving the configure script
--disable-tls option.
3.4 Cross Compilation
_________________________________________________________________
Cross compilation should be supported, using the usual autoconf syntax:
$ ./configure --host=arm-elf-linux
...
Since cross-compilation is not tested as often as the "normal" build, please
watch for the ./configure output for incorrect settings (well ideally this
should be done for normal build too).
Please refer to Porting Guide for further information about porting PJ
software.
3.5 Running make
_________________________________________________________________
Once the configure script completes successfully, start the build process by
invoking these commands:
$ cd pjproject
$ make dep
$ make
Note:
gmake may need to be specified instead of make for some hosts, to
invoke GNU make instead of the native make.
Description of all make targets supported by the Makefile's:
all
The default (or first) target to build the libraries/binaries.
dep, depend
Build dependencies rule from the source files.
clean
Clean the object files for current target, but keep the output
library/binary files intact.
distclean, realclean
Remove all generated files (object, libraries, binaries, and
dependency files) for current target.
Note:
make can be invoked either in the top-level PJ directory or in build
directory under each project to build only the particular project.
3.6 Build Customizations
_________________________________________________________________
Build features can be customized by specifying the options when running
./configure as described in Running Configure above.
In addition, additional CFLAGS and LDFLAGS options can be put in user.mak
file in PJ root directory (this file may need to be created if it doesn't
exist). Below is a sample of user.mak file contents:
export CFLAGS += -msoft-float -fno-builtin
export LDFLAGS +=
4. Building for Windows Targets with Microsoft Visual Studio
_________________________________________________________________
4.1 Requirements
_________________________________________________________________
The Microsoft Visual Studio based project files can be used with one of the
following:
* Microsoft Visual Studio 6,
* Microsoft Visual Studio .NET 2002,
* Microsoft Visual Studio .NET 2003,
* Microsoft Visual C++ 2005 (including Express edition),
In addition, the following SDK's are needed:
* Platform SDK, if you're using Visual Studio 2005 Express (tested with
Platform SDK for Windows Server 2003 SP1),
* DirectX SDK (tested with DirectX version 8 and 9),
* OpenSSL development kit would be needed if TLS support is wanted, or
otherwise this is optional.
For the host, the following are required:
* Windows NT, 2000, XP, 2003, or later ,
* Windows 95/98 should work too, but this has not been tested,
* Sufficient amount of RAM for the build process (at least 256MB).
Enabling TLS Support with OpenSSL
If TLS support is wanted, then OpenSSL SDK must be installed in the
development host.
To install OpenSSL SDK from the Win32 binary distribution:
1. Install OpenSSL SDK to any folder (e.g. C:\OpenSSL)
2. Add OpenSSL DLL location to the system PATH.
3. Add OpenSSL include path to Visual Studio includes search directory.
Make sure that OpenSSL header files can be accessed from the program
with #include <openssl/ssl.h> construct.
4. Add OpenSSL library path to Visual Studio library search directory. Make
sure the following libraries are accessible:
+ For Debug build: libeay32MTd and ssleay32MTd.
+ For Release build: libeay32MT and ssleay32MT.
Then to enable TLS transport support in PJSIP, just add
#define PJSIP_HAS_TLS_TRANSPORT 1
in your pj/config_site.h. When this macro is defined, OpenSSL libraries will
be automatically linked to the application via the #pragma construct in
sip_transport_tls_ossl.c file.
4.2 Building the Projects
_________________________________________________________________
Follow the steps below to build the libraries/application using Visual
Studio:
1. For Visual Studio 6: open pjproject.dsw workspace file.
2. For Visual Studio 8 (VS 2005): open pjproject-vs8.sln solution file.
3. Set pjsua as Active Project.
4. Select Debug or Release build as appropriate.
5. Build the project. This will build pjsua application and all libraries
needed by pjsua.
6. After successful build, the pjsua application will be placed in
pjsip-apps/bin directory, and the libraries in lib directory under each
projects.
To build the samples:
1. (Still using the same workspace)
2. Set samples project as Active Project
3. Select Debug or Release build as appropriate.
4. Build the project. This will build all sample applications and all
libraries needed.
5. After successful build, the sample applications will be placed in
pjsip-apps/bin/samples directory, and the libraries in lib directory
under each projects.
4.3 Debugging the Sample Application
_________________________________________________________________
The sample applications are build using Samples.mak makefile, therefore it
is difficult to setup debugging session in Visual Studio for these
applications. To solve this issue, the pjsip_apps workspace contain one
project called sample_debug which can be used to debug the sample
application.
To setup debugging using sample_debug project:
1. (Still using pjsip_apps workspace)
2. Set sample_debug project as Active Project
3. Edit debug.c file inside this project.
4. Modify the #include line to include the particular sample application to
debug
5. Select Debug build.
6. Build and debug the project.
5. Building for Windows Mobile Targets (Windows CE/WinCE/PDA/SmartPhone)
_________________________________________________________________
PJ supports building SIP and media stacks and applications for Windows
Mobile targets. A very simple WinCE SIP user agent (with media) application
is provided just as proof of concept that the port works.
5.1 Requirements
_________________________________________________________________
One of the following development tools is needed to build SIP and media
components for Windows Mobile:
* Microsoft Embedded Visual C++ 4 with appropriate SDKs, or
* Microsoft Visual Studio 2005 for Windows Mobile with appropriate SDKs.
Note that VS2005 is not directly supported (as I don't have the tools), but
it is reported to work (I assumed that VS2005 for Windows Mobile can import
EVC4 workspace file).
5.2 Building the Projects
_________________________________________________________________
The Windows Mobile port is included in the main source distribution. Please
follow the following steps to build the WinCE libraries and sample
application:
1. Open pjsip-apps/build/wince-evc4/wince_demos.vcw workspace file. If
later version of EVC4 is being used, this may cause the workspace file
to be converted to the appropriate format.
2. Select pjsua_wince project as the Active Project.
3. Select the appropriate SDK (for example Pocket PC 2003 SDK or SmartPhone
2003 SDK)
4. Select the appropriate configuration (for example, Win32 (WCE Emulator
Debug) to debug the program in emulator, or other configurations such as
ARMV4, MIPS, SH3, SH4, or whatever suitable for the device)
5. Select the appropriate device (Emulator or the actual Device).
6. Build the project. This will build the sample WinCE application and all
libraries (SIP, Media, etc.) needed by this application.
Notes
+ If the config_site.h includes config_site_sample.h file, then
there are certain configuration in config_site_sample.h that get
activated for Windows CE targets. Please make sure that these
configurations are suitable for the application.
+ The libraries, binaries and object files produced by the build
process are located under build/wince-evc4/output directory of each
projects.
6. Older PJLIB Build System for Non-Autoconf Targets (e.g. RTEMS)
_________________________________________________________________
The old PJLIB build system can still be used for building PJ libraries, for
example for RTEMS target. Please see the Porting PJLIB page in PJLIB
Reference documentation for information on how to support new target using
this build system.
6.1 Supported Targets
_________________________________________________________________
The older build system supports building PJ libraries for the following
operating systems:
* RTEMS
* Linux
* MacOS X
* Cygwin and Mingw
And it supports the following target architectures:
* i386, x86_64, itanium
* ARM
* mips
* powerpc
* mpc860
* etc.
For other targets, specific files need to be added to the build system,
please see the Porting PJLIB page in PJLIB Reference documentation for
details.
6.2 Invoking the Build System
_________________________________________________________________
To invoke the older build system, run the following:
$ cd pjproject
$ ./configure-legacy
$ make dep && make clean && make
7. Running the Applications
_________________________________________________________________
Upon successful build, the output libraries (PJLIB, PJLIB-UTIL, PJMEDIA,
PJSIP, etc.) are put under ./lib sub-directory under each project directory.
In addition, some applications may also be built, and such applications will
be put in ./bin sub-directory under each project directory.
7.1 pjsua
_________________________________________________________________
pjsua is the reference implementation for both PJSIP and PJMEDIA stack, and
is the main target of the build system. Upon successful build, pjsua
application will be put in pjsip-apps/bin directory.
pjsua manual can be found in pjsua Manual Page.
7.2 Sample Applications
_________________________________________________________________
Sample applications will be built with the Makefile build system. For Visual
Studio, you have to build the samples manually by selecting and building the
Samples project inside pjsip-apps/build/pjsip_apps.dsw project workspace.
Upon successful build, the sample applications are put in
pjsip-apps/bin/samples directory.
The sample applications are described in PJMEDIA Samples Page and
PJSIP Samples Page in the website.
7.3 pjlib-test
_________________________________________________________________
pjlib-test contains comprehensive tests for testing PJLIB functionality.
This application will only be built when the Makefile build system is used;
with Visual Studio, one has to open pjlib.dsw project in pjlib/build
directory to build this application.
If you're porting PJLIB to new target, it is recommended to run this
application to make sure that all functionalities works as expected.
7.4 pjsip-test
_________________________________________________________________
pjsip-test contains codes for testing various SIP functionalities in PJSIP
and also to benchmark static performance metrics such as message parsing per
second.
8. Using PJPROJECT with Applications
_________________________________________________________________
Regardless of the build system being used, the following tasks are normally
needed to be done in order to build application to use PJSIP and PJMEDIA:
1. Put these include directories in the include search path:
+ pjlib/include
+ pjlib-util/include
+ pjmedia/include
+ pjsip/include
2. Put these library directories in the library search path:
+ pjlib/lib
+ pjlib-util/lib
+ pjmedia/lib
+ pjsip/lib
3. Include the relevant PJ header files in the application source file. For
example, using these would include ALL APIs exported by PJ:
#include <pjlib.h>
#include <pjlib-util.h>
#include <pjsip.h>
#include <pjsip_ua.h>
#include <pjsip_simple.h>
#include <pjsua.h>
#include <pjmedia.h>
#include <pjmedia-codec.h>
(Note: the documentation of the relevant libraries should say which
header files should be included to get the declaration of the APIs).
4. Declare the OS macros.
+ For Windows applications built with Visual Studio, we need to
declare PJ_WIN32=1 macro in the project settings (declaring the
macro in the source file may not be sufficient).
+ For Windows Mobile applications build with Visual C++, we need to
declare PJ_WIN32_WINCE=1 macro in the project settings.
+ For GNU build system/autoconf based build system, we need to
declare PJ_AUTOCONF=1 macro when compiling the applications.
(Note: the old PJ build system requires declaring the target processor
with PJ_M_XXX=1 macro, but this has been made obsolete. The target
processor will be detected from compiler's predefined macro by
pjlib/config.h file).
5. Link with the appropriate PJ libraries. The following libraries will
need to be included in the library link specifications:
pjlib
Base library used by all libraries.
pjlib-util
Auxiliary library containing scanner, XML, STUN, MD5, getopt,
etc, used by the SIP and media stack.
pjsip
SIP core stack library.
pjsip-ua
SIP user agent library containing INVITE session, call
transfer, client registration, etc.
pjsip-simple
SIP SIMPLE library for base event framework, presence, instant
messaging, etc.
pjsua
High level SIP UA library, combining SIP and media stack into
high-level easy to use API.
pjmedia
The media framework.
pjmedia-codec
Container library for various codecs such as GSM, Speex, and
iLBC.
Note: the actual library names will be appended with the target name and the
build configuration. For example:
For Visual Studio builds
The actual library names will look like
pjlib-i386-win32-vc6-debug.lib,
pjlib-i386-win32-vc6-release.lib, etc., depending on whether we
are building the Debug or Release version of the library.
An easier way to link with the libraries is to include PJ
project files in the workspace, and to configure project
dependencies so that the application depends on the PJ
libraries. This way, we don't need to manually add each PJ
libraries to the input library file specification, since VS
will automatically link the dependency libraries with the
application.
For Windows Mobile builds
Unfortunately the PJ libraries built for Windows Mobile will
not be placed in the usual lib directory, but rather under the
output directory under build/wince-evc4 project directory.
An easier way to link with the libraries is to include PJ
project files in the workspace, and to configure project
dependencies so that the application depends on the PJ
libraries. This way, we don't need to manually add each PJ
libraries to the input library file specification, since VS
will automatically link the dependency libraries with the
application.
For GNU builds
Application's Makefile can get the PJ library suffix by
including PJ's build.mak file from the root PJ directory (the
suffix is contained in TARGET_NAME variable). For example, to
link with PJLIB and PJMEDIA, we can use this syntax in the
LDFLAGS: "-lpj-$(TARGET_NAME) -lpjmedia-$(TARGET_NAME)"
6. Link with system spesific libraries:
Windows
Add (among other things): wsock32.lib, ws2_32.lib, ole32.lib,
dsound.lib
Linux, *nix, *BSD
Add (among other things): '-lpthread -lm' (at least).
MacOS X
Add (among other things): '-framework CoreAudio -lpthread -lm'.
Appendix I: Common Problems/Frequently Asked Question (FAQ)
_________________________________________________________________
I.1 fatal error C1083: Cannot open include file: 'pj/config_site.h': No such
file or directory
This error normally occurs when the config_site.h file has not been created.
This file needs to be created manually (an empty file is sufficient). Please
follow the Build Preparation instructions above to create this file.
_________________________________________________________________
Feedback:
Thanks for using PJ libraries and for reading this document. Please
send feedbacks or general comments to <bennylp at pjsip dot org>.

View File

@ -8136,7 +8136,7 @@ printf %s "checking ffmpeg packages... " >&6; }
av_pkg="$av_pkg libavutil"
fi
if test "x$av_pkg" == "x"; then
if test "x$av_pkg" = "x"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none detected (check the prefix)! **" >&5
printf "%s\n" "none detected (check the prefix)! **" >&6; }
else

View File

@ -1379,7 +1379,7 @@ AC_ARG_ENABLE(ffmpeg,
av_pkg="$av_pkg libavutil"
fi
if test "x$av_pkg" == "x"; then
if test "x$av_pkg" = "x"; then
AC_MSG_RESULT([none detected (check the prefix)! **])
else
AC_MSG_RESULT([$av_pkg])

View File

@ -1,44 +0,0 @@
#
# This is a utility make file that is used to generate BB10 config settings
# from current build settings. The stdout output of this make file can be
# saved to a .pri file which then can be included in app's .pro file.
#
# This make file is invoked by configure-bb10 script to generate pjsip.pri
# file.
#
include build.mak
# Generate library list (the "-lxxx" options) from list of linked libraries.
PJ_BB_LIBS = $(filter-out -lm -lsocket, $(APP_LDLIBS))
# This used to generate the library path list (the "-Lxxx" options)
# We replace the path with "$$PJ_DIR"
PJ_BB_LDFLAGS = $(subst $(PJDIR),\$$\$$PJ_DIR,$(APP_LDFLAGS))
all:
@echo PJ_DIR = $(PJDIR)
@echo
@echo 'DEFINES += PJ_AUTOCONF'
@echo
@echo 'PJ_INCLUDEPATH += $$$$quote($$$$PJ_DIR/pjlib/include)'
@echo 'PJ_INCLUDEPATH += $$$$quote($$$$PJ_DIR/pjmedia/include)'
@echo 'PJ_INCLUDEPATH += $$$$quote($$$$PJ_DIR/pjnath/include)'
@echo 'PJ_INCLUDEPATH += $$$$quote($$$$PJ_DIR/pjlib-util/include)'
@echo 'PJ_INCLUDEPATH += $$$$quote($$$$PJ_DIR/pjsip/include)'
@echo
@for token in $(PJ_BB_LDFLAGS); do \
if echo $$token | grep -- '-L' >> /dev/null; then \
echo "PJ_LIBPATH += \$$\$$quote($$token)"; \
fi; \
done
@echo
@for token in $(PJ_BB_LIBS); do \
echo PJ_LIBS += $$token; \
done
@echo
@echo 'INCLUDEPATH += $$$$PJ_INCLUDEPATH'
@echo 'LIBS += $$$$PJ_LIBPATH'
@echo 'LIBS += $$$$PJ_LIBS'
@echo 'LIBS += -lOpenAL -lalut -laudio_manager -lsocket -lasound -lbbsystem -lm'

View File

@ -1,67 +0,0 @@
#!/bin/sh
#
F="configure-bb10"
if test "$*" = "--help" -o "$*" = "-h"; then
echo "$F [--simulator] [OPTIONS]"
echo ""
echo "where:"
echo " --simulator Optional parameter to specify that the compilation"
echo " target is a simulator."
echo " OPTIONS Other options that will be passed directly to"
echo " ./configure script. Run ./configure --help"
echo " for more info."
exit 0
fi
# Find simulator argument
args=""
simulator="no"
for arg in "$@"; do
if test "$arg" = "--simulator"; then
simulator="yes"
else
args="$args $arg"
fi
done
if test "$simulator" = "yes"; then
TARGET_ARCH="x86"
TARGET_ARCHEND=${TARGET_ARCH}
LIBDIR=${TARGET_ARCH}
TARGET_HOST="i486-pc-nto-qnx8.0.0"
else
TARGET_ARCH="armv7"
TARGET_ARCHEND="${TARGET_ARCH}le"
LIBDIR="armle-v7"
TARGET_HOST="arm-unknown-nto-qnx8.0.0eabi"
fi
RANLIB="${QNX_HOST}/usr/bin/nto${TARGET_ARCH}-ranlib "
CPP="${QNX_HOST}/usr/bin/qcc -V4.6.3,gcc_nto${TARGET_ARCHEND}_cpp -E "
CC="${QNX_HOST}/usr/bin/qcc -V4.6.3,gcc_nto${TARGET_ARCHEND}_cpp "
LD="${QNX_HOST}/usr/bin/nto${TARGET_ARCH}-ld "
export LDFLAGS="$LDFLAGS -L${QNX_TARGET}/${LIBDIR}/usr/lib -L${QNX_TARGET}/${LIBDIR}/lib -L${QNX_HOST}/usr/lib/gcc/${TARGET_HOST}/4.6.3 -lgcc -lasound -laudio_manager"
if test "$CFLAGS" = ""; then
# Default if no CFLAGS is set in env
export CFLAGS=" -g -O2"
fi
export CFLAGS="$CFLAGS -fPIC -DPJ_CONFIG_BB10=1 -DPJMEDIA_AUDIO_DEV_HAS_BB10=1"
# Invoke configure
./configure --host=${TARGET_HOST} --disable-oss $args
RETVAL=$?
# Write to pjsip.pri only if configure was successful
if test $RETVAL -eq 0; then
echo "# Config file to be included in app's .pro file" > pjsip.pri
echo "# Auto-generated by 'configure-bb10 $*'" >> pjsip.pri
make -f bb10-config.mak >> pjsip.pri
echo PJSIP config file for BB10 has been written to \'pjsip.pri\'. You can include this file from your application\'s .pro file.
echo
fi

View File

@ -1,148 +0,0 @@
#!/bin/sh
PJDIR=`pwd`
#
# Detect machine, unless the choice has been made already.
#
if [ "$MACHINE" = "" ]; then
MACHINE=`uname -m`
fi
if echo $MACHINE | grep sun4u > /dev/null; then
MACHINE_NAME=sparc
elif echo $MACHINE | grep i.86 > /dev/null; then
MACHINE_NAME=i386
elif echo $MACHINE | grep x86_64 > /dev/null; then
MACHINE_NAME=x86_64
elif echo $MACHINE | grep alpha > /dev/null; then
MACHINE_NAME=alpha
elif echo $MACHINE | grep Mac > /dev/null; then
MACHINE_NAME=powerpc
else
echo "Unable to detect processor type ('uname -m' == '$MACHINE')"
exit 1
fi
#
# Detect OS and host, unless the choice has been made already
#
if [ "$SYSTEM" = "" ]; then
SYSTEM=`uname -s`
fi
if echo $SYSTEM | grep -i sunos > /dev/null; then
OS_NAME=sunos
HOST_NAME=unix
elif echo $SYSTEM | grep -i linux > /dev/null; then
OS_NAME=linux
HOST_NAME=unix
# More on linux version
KERNEL_VER=`uname -r`
if echo $KERNEL_VER | grep '^2\.4' > /dev/null; then
LINUX_POLL=select
elif echo $KERNEL_VER | grep '^2\.2' > /dev/null; then
LINUX_POLL=select
elif echo $KERNEL_VER | grep '^2\.0' > /dev/null; then
LINUX_EPOLL=select
else
# LINUX_POLL=epoll
LINUX_POLL=select
fi
elif echo $SYSTEM | grep -i mingw > /dev/null; then
OS_NAME=win32
HOST_NAME=mingw
elif echo $SYSTEM | grep -i cygwin > /dev/null; then
OS_NAME=win32
HOST_NAME=mingw
elif echo $SYSTEM | grep -i darwin > /dev/null; then
OS_NAME=darwinos
HOST_NAME=unix
elif echo $SYSTEM | grep -i rtems > /dev/null; then
OS_NAME=rtems
HOST_NAME=unix
else
echo "Unable to detect system type ('uname -s' == '$SYSTEM')"
exit 1
fi
#
# Detect gcc, unless it has been chosen already
#
if [ "$CC_NAME" = "" ]; then
if gcc --version 2>&1 > /dev/null; then
CC_NAME=gcc
else
echo "Unable to find gcc"
exit 1
fi
fi
#
# Specify TARGET_NAME, if not already choosen.
#
if [ "$TARGET_NAME" = "" ]; then
TARGET_NAME=$MACHINE_NAME-$OS_NAME-$CC_NAME
fi
if test -f build.mak; then
echo 'Saving build.mak --> build.mak.old'
cp -f build.mak build.mak.old
fi
echo 'build.mak configurations are set as follows:'
echo " PJDIR = $PJDIR"
echo " MACHINE_NAME = $MACHINE_NAME"
echo " OS_NAME = $OS_NAME"
echo " HOST_NAME = $HOST_NAME"
echo " CC_NAME = $CC_NAME"
echo " TARGET_NAME = $TARGET_NAME"
echo " CROSS_COMPILE = $CROSS_COMPILE"
echo " LINUX_POLL = $LINUX_POLL"
echo "# Auto-generated build.mak" > build.mak
echo "export PJDIR := $PJDIR" >> build.mak
echo "export MACHINE_NAME := $MACHINE_NAME" >> build.mak
echo "export OS_NAME := $OS_NAME" >> build.mak
echo "export HOST_NAME := $HOST_NAME" >> build.mak
echo "export CC_NAME := $CC_NAME" >> build.mak
echo "export TARGET_NAME := $TARGET_NAME" >> build.mak
echo "export CROSS_COMPILE := $CROSS_COMPILE" >> build.mak
echo "export LINUX_POLL := $LINUX_POLL" >> build.mak
echo >> build.mak
cat << EOF >> build.mak
export APP_CC = \$(CROSS_COMPILE)\$(CC_NAME)
export APP_CFLAGS = \$(CC_CFLAGS) \$(OS_CFLAGS) \$(HOST_CFLAGS) \$(M_CFLAGS) \$(CFLAGS) -I\$(PJDIR)/pjlib/include -I\$(PJDIR)/pjlib-util/include -I\$(PJDIR)/pjnath/include -I\$(PJDIR)/pjmedia/include -I\$(PJDIR)/pjsip/include
export APP_CXXFLAGS = \$(APP_CFLAGS)
export APP_LDFLAGS = -L\$(PJDIR)/pjlib/lib -L\$(PJDIR)/pjlib-util/lib -L\$(PJDIR)/pjnath/lib -L\$(PJDIR)/pjmedia/lib -L\$(PJDIR)/pjsip/lib -L\$(PJDIR)/third_party/lib
export APP_LDLIBS = -lpjsua-\$(TARGET_NAME) -lpjsip-ua-\$(TARGET_NAME) -lpjsip-simple-\$(TARGET_NAME) -lpjsip-\$(TARGET_NAME) -lpjmedia-codec-\$(TARGET_NAME) -lpjmedia-\$(TARGET_NAME) -lpjnath-\$(TARGET_NAME) -lpjlib-util-\$(TARGET_NAME) \$(APP_THIRD_PARTY_LIBS) \$(APP_THIRD_PARTY_EXT) -lpj-\$(TARGET_NAME) \$(CC_LDFLAGS) \$(OS_LDFLAGS) \$(M_LDFLAGS) \$(HOST_LDFLAGS) \$(LDFLAGS)
export PJ_DIR = \$(PJDIR)
export PJ_CC = \$(APP_CC)
export PJ_CFLAGS = \$(APP_CFLAGS)
export PJ_CXXFLAGS = \$(APP_CXXFLAGS)
export PJ_LDFLAGS = \$(APP_LDFLAGS)
export PJ_LDLIBS = \$(APP_LDLIBS)
EOF
touch user.mak
echo
echo "The configuration for current host has been written to 'build.mak'."
echo "Customizations can be put in:"
echo " - 'user.mak'"
echo " - 'pjlib/include/pj/config_site.h'"
echo
echo "Next, run 'make dep && make clean && make'"

View File

@ -255,6 +255,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_create(
/* Create own pool */
pool = pj_pool_create(parent_pool->factory, "vidconf", 500, 500, NULL);
if (!pool) {
PJ_PERROR(1, (THIS_FILE, PJ_ENOMEM, "Create failed in alloc"));
return PJ_ENOMEM;
}
@ -275,6 +276,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_create(
pj_pool_zalloc(pool, vid_conf->opt.max_slot_cnt *
sizeof(vconf_port*));
if (!vid_conf->ports) {
PJ_PERROR(1, (THIS_FILE, PJ_ENOMEM, "Create failed in alloc ports"));
pjmedia_vid_conf_destroy(vid_conf);
return PJ_ENOMEM;
}
@ -282,6 +284,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_create(
/* Create mutex */
status = pj_mutex_create_recursive(pool, CONF_NAME, &vid_conf->mutex);
if (status != PJ_SUCCESS) {
PJ_PERROR(1, (THIS_FILE, status, "Create failed in create mutex"));
pjmedia_vid_conf_destroy(vid_conf);
return status;
}
@ -293,6 +296,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_create(
status = pjmedia_clock_create2(pool, &clock_param, 0, &on_clock_tick,
vid_conf, &vid_conf->clock);
if (status != PJ_SUCCESS) {
PJ_PERROR(1, (THIS_FILE, status, "Create failed in create clock"));
pjmedia_vid_conf_destroy(vid_conf);
return status;
}
@ -301,6 +305,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_create(
vid_conf->op_queue = PJ_POOL_ZALLOC_T(pool, op_entry);
vid_conf->op_queue_free = PJ_POOL_ZALLOC_T(pool, op_entry);
if (!vid_conf->op_queue || !vid_conf->op_queue_free) {
PJ_PERROR(1, (THIS_FILE, PJ_ENOMEM, "Create failed in create queues"));
pjmedia_vid_conf_destroy(vid_conf);
return PJ_ENOMEM;
}
@ -310,7 +315,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_create(
/* Done */
*p_vid_conf = vid_conf;
PJ_LOG(5,(THIS_FILE, "Created video conference bridge with %d ports",
PJ_LOG(4,(THIS_FILE, "Created video conference bridge with %d ports",
vid_conf->opt.max_slot_cnt));
return PJ_SUCCESS;
@ -354,7 +359,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_destroy(pjmedia_vid_conf *vid_conf)
pj_pool_safe_release(&vid_conf->pool);
}
PJ_LOG(5,(THIS_FILE, "Video conference bridge destroyed"));
PJ_LOG(4,(THIS_FILE, "Video conference bridge destroyed"));
return PJ_SUCCESS;
}
@ -375,6 +380,8 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_add_port( pjmedia_vid_conf *vid_conf,
unsigned index;
pj_status_t status = PJ_SUCCESS;
PJ_LOG(5,(THIS_FILE, "Add port %s requested", port->info.name.ptr));
PJ_ASSERT_RETURN(vid_conf && parent_pool && port, PJ_EINVAL);
PJ_ASSERT_RETURN(port->info.fmt.type==PJMEDIA_TYPE_VIDEO &&
port->info.fmt.detail_type==PJMEDIA_FORMAT_DETAIL_VIDEO,
@ -388,6 +395,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_add_port( pjmedia_vid_conf *vid_conf,
pj_mutex_lock(vid_conf->mutex);
if (vid_conf->port_cnt >= vid_conf->opt.max_slot_cnt) {
PJ_PERROR(3,(THIS_FILE, PJ_ETOOMANY, "Add port %s failed", name->ptr));
pj_assert(!"Too many ports");
pj_mutex_unlock(vid_conf->mutex);
return PJ_ETOOMANY;
@ -457,7 +465,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_add_port( pjmedia_vid_conf *vid_conf,
vfi = pjmedia_get_video_format_info(NULL, port->info.fmt.id);
if (!vfi) {
PJ_LOG(4,(THIS_FILE, "pjmedia_vid_conf_add_port(): "
PJ_LOG(3,(THIS_FILE, "pjmedia_vid_conf_add_port(): "
"unrecognized format %04X",
port->info.fmt.id));
status = PJMEDIA_EBADFMT;
@ -468,7 +476,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_add_port( pjmedia_vid_conf *vid_conf,
vafp.size = port->info.fmt.det.vid.size;
status = (*vfi->apply_fmt)(vfi, &vafp);
if (status != PJ_SUCCESS) {
PJ_LOG(4,(THIS_FILE, "pjmedia_vid_conf_add_port(): "
PJ_LOG(3,(THIS_FILE, "pjmedia_vid_conf_add_port(): "
"Failed to apply format %04X",
port->info.fmt.id));
goto on_error;
@ -482,7 +490,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_add_port( pjmedia_vid_conf *vid_conf,
cport->put_buf,
cport->put_buf_size);
if (status != PJ_SUCCESS) {
PJ_PERROR(4,(THIS_FILE, status,
PJ_PERROR(3,(THIS_FILE, status,
"Warning: failed to init sink buffer "
" with black"));
}
@ -496,7 +504,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_add_port( pjmedia_vid_conf *vid_conf,
cport->get_buf,
cport->get_buf_size);
if (status != PJ_SUCCESS) {
PJ_PERROR(4,(THIS_FILE, status,
PJ_PERROR(3,(THIS_FILE, status,
"Warning: failed to init source buffer "
"with black"));
}
@ -564,6 +572,8 @@ on_error:
if (pool)
pj_pool_release(pool);
PJ_PERROR(3, (THIS_FILE, status, "Add port %s failed", name->ptr));
pj_mutex_unlock(vid_conf->mutex);
return status;
}
@ -578,6 +588,8 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_remove_port( pjmedia_vid_conf *vid_conf,
vconf_port *cport;
op_entry *ope;
PJ_LOG(5,(THIS_FILE, "Port %d remove requested", slot));
PJ_ASSERT_RETURN(vid_conf && slot<vid_conf->opt.max_slot_cnt, PJ_EINVAL);
pj_mutex_lock(vid_conf->mutex);
@ -585,11 +597,12 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_remove_port( pjmedia_vid_conf *vid_conf,
/* Port must be valid. */
cport = vid_conf->ports[slot];
if (cport == NULL) {
PJ_PERROR(3, (THIS_FILE, PJ_EINVAL, "Remove port failed"));
pj_mutex_unlock(vid_conf->mutex);
return PJ_EINVAL;
}
PJ_LOG(5,(THIS_FILE, "Video port %d remove requested", slot));
PJ_LOG(4,(THIS_FILE, "Video port %d remove queued", slot));
/* Queue the operation */
ope = get_free_op_entry(vid_conf);
@ -646,7 +659,7 @@ static void op_remove_port(pjmedia_vid_conf *vid_conf,
/* Warning: will stuck if this is called from the clock thread */
status = pjmedia_clock_stop(vid_conf->clock);
if (status != PJ_SUCCESS) {
PJ_PERROR(4, (THIS_FILE, status, "Failed to stop clock"));
PJ_PERROR(3, (THIS_FILE, status, "Failed to stop clock"));
}
}
}
@ -741,6 +754,9 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_connect_port(
vconf_port *src_port, *dst_port;
unsigned i;
PJ_LOG(5,(THIS_FILE, "Connect ports %d->%d requested",
src_slot, sink_slot));
/* Check arguments */
PJ_ASSERT_RETURN(vid_conf &&
src_slot<vid_conf->opt.max_slot_cnt &&
@ -755,7 +771,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_connect_port(
if (!src_port || !src_port->port->get_frame ||
!dst_port || !dst_port->port->put_frame)
{
PJ_LOG(4,(THIS_FILE,"Failed connecting video ports, make sure that "
PJ_LOG(3,(THIS_FILE,"Failed connecting video ports, make sure that "
"source has get_frame() & sink has put_frame()"));
pj_mutex_unlock(vid_conf->mutex);
return PJ_EINVAL;
@ -771,7 +787,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_connect_port(
if (i == src_port->listener_cnt) {
op_entry *ope;
PJ_LOG(5,(THIS_FILE, "Video connect ports %d->%d requested",
PJ_LOG(4,(THIS_FILE, "Video connect ports %d->%d queued",
src_slot, sink_slot));
ope = get_free_op_entry(vid_conf);
@ -786,7 +802,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_connect_port(
pj_status_t status;
status = pjmedia_clock_start(vid_conf->clock);
if (status != PJ_SUCCESS) {
PJ_PERROR(4, (THIS_FILE, status, "Failed to start clock"));
PJ_PERROR(2, (THIS_FILE, status, "Failed to start clock"));
pj_mutex_unlock(vid_conf->mutex);
return status;
}
@ -848,6 +864,9 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_disconnect_port(
vconf_port *src_port, *dst_port;
unsigned i, j;
PJ_LOG(5,(THIS_FILE, "Disconnect ports %d->%d requested",
src_slot, sink_slot));
/* Check arguments */
PJ_ASSERT_RETURN(vid_conf &&
src_slot<vid_conf->opt.max_slot_cnt &&
@ -859,6 +878,9 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_disconnect_port(
src_port = vid_conf->ports[src_slot];
dst_port = vid_conf->ports[sink_slot];
if (!src_port || !dst_port) {
PJ_PERROR(3,(THIS_FILE, PJ_EINVAL,
"Disconnect ports failed, src=0x%p dst=0x%p",
src_port, dst_port));
pj_mutex_unlock(vid_conf->mutex);
return PJ_EINVAL;
}
@ -874,24 +896,26 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_disconnect_port(
}
if (i != src_port->listener_cnt && j != dst_port->transmitter_cnt) {
op_entry *ope;
pj_assert(src_port->listener_cnt > 0 &&
src_port->listener_cnt < vid_conf->opt.max_slot_cnt);
pj_assert(dst_port->transmitter_cnt > 0 &&
dst_port->transmitter_cnt < vid_conf->opt.max_slot_cnt);
/* Queue the operation */
if (i == src_port->listener_cnt) {
op_entry *ope;
PJ_LOG(4,(THIS_FILE, "Video disconnect ports %d->%d queued",
src_slot, sink_slot));
PJ_LOG(5,(THIS_FILE, "Video disconnect ports %d->%d requested",
src_slot, sink_slot));
ope = get_free_op_entry(vid_conf);
ope->type = OP_DISCONNECT_PORTS;
ope->param.disconnect_ports.src = src_slot;
ope->param.disconnect_ports.sink = sink_slot;
pj_list_push_back(vid_conf->op_queue, ope);
}
ope = get_free_op_entry(vid_conf);
ope->type = OP_DISCONNECT_PORTS;
ope->param.disconnect_ports.src = src_slot;
ope->param.disconnect_ports.sink = sink_slot;
pj_list_push_back(vid_conf->op_queue, ope);
} else {
PJ_PERROR(3,(THIS_FILE, PJ_EINVAL,
"Disconnect ports failed, src=0x%p dst=0x%p",
src_port, dst_port));
}
pj_mutex_unlock(vid_conf->mutex);
@ -1467,6 +1491,8 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_update_port( pjmedia_vid_conf *vid_conf,
vconf_port *cport;
op_entry *ope;
PJ_LOG(5,(THIS_FILE, "Update port %d requested", slot));
PJ_ASSERT_RETURN(vid_conf && slot<vid_conf->opt.max_slot_cnt, PJ_EINVAL);
pj_mutex_lock(vid_conf->mutex);
@ -1474,6 +1500,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_update_port( pjmedia_vid_conf *vid_conf,
/* Port must be valid. */
cport = vid_conf->ports[slot];
if (cport == NULL) {
PJ_PERROR(3,(THIS_FILE, PJ_EINVAL, "Update port failed"));
pj_mutex_unlock(vid_conf->mutex);
return PJ_EINVAL;
}
@ -1484,6 +1511,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_update_port( pjmedia_vid_conf *vid_conf,
ope->param.update_port.port = slot;
pj_list_push_back(vid_conf->op_queue, ope);
PJ_LOG(4,(THIS_FILE, "Update port %d queued", slot));
pj_mutex_unlock(vid_conf->mutex);
return PJ_SUCCESS;
@ -1602,6 +1630,7 @@ static void op_update_port(pjmedia_vid_conf *vid_conf,
/* Update cport format info */
cport->format = *new_fmt;
PJ_LOG(4,(THIS_FILE, "Port %d updated", slot));
}

View File

@ -111,9 +111,9 @@ typedef struct pjsip_cfg_t
pj_bool_t disable_tcp_switch;
/**
* Disable automatic switching to TLS if target-URI does not use
* "sips" scheme nor TLS transport, even when request-URI uses
* "sips" scheme.
* Disable automatic switching to secure transport (such as TLS)
* if target-URI does not use "sips" scheme nor secure transport,
* even when request-URI uses "sips" scheme.
*
* Default is PJSIP_DONT_SWITCH_TO_TLS.
*/
@ -397,9 +397,13 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
* As specified RFC 3261 section 8.1.2, when request-URI uses "sips" scheme,
* TLS must always be used regardless of the target-URI scheme or transport
* type.
* Update: Newer RFCs, such as RFC 5630 and 7118, expands this by allowing
* the use of other transports as long as the SIP resource designated by
* the target SIPS URI is contacted securely.
*
* This option will specify whether the behavior of automatic switching to TLS
* should be disabled, i.e: regard the target-URI scheme or transport type.
* This option will specify whether the behavior of automatic switching to secure
* transport (such as TLS) should be disabled, i.e: regard the target-URI scheme
* or transport type.
*
* This option can also be controlled at run-time by the \a disable_tls_switch
* setting in pjsip_cfg_t.

View File

@ -164,7 +164,8 @@ struct pjsip_dialog
pjsip_route_hdr route_set; /**< Route set. */
pj_bool_t route_set_frozen; /**< Route set has been set. */
pjsip_auth_clt_sess auth_sess; /**< Client authentication session. */
pj_str_t initial_dest;/**< Initial destination host. */
pj_str_t initial_dest;/**< Initial destination host (used for
verifying remote TLS cert). */
/** Session counter. */
int sess_count; /**< Number of sessions. */

View File

@ -124,7 +124,7 @@ PJ_DECL(pjsip_transport_type_e)
pjsip_transport_get_type_from_name(const pj_str_t *name);
/**
* Get the transport type for the specified flags.
* Get the first transport type that has the specified flags.
*
* @param flag The transport flag.
*

View File

@ -2402,6 +2402,13 @@ struct pjsua_msg_data
*/
pj_str_t target_uri;
/**
* Optional local URI (i.e. From header). If NULL, the account ID
* \a pjsua_acc_config.id is used for the From header. This field is
* currently used only by pjsua_call_make_call() and pjsua_im_send().
*/
pj_str_t local_uri;
/**
* Additional message headers as linked list. Application can add
* headers to the list by creating the header, either from the heap/pool

View File

@ -837,6 +837,13 @@ struct SipTxOption
*/
string targetUri;
/**
* Optional local URI (i.e. From header). If empty (""), the
* \a AccountConfig::idUri is used for the From header. At the moment this
* field is only used when sending initial INVITE and MESSAGE requests.
*/
string localUri;
/**
* Additional message headers to be included in the outgoing message.
*/

View File

@ -468,9 +468,10 @@ pj_status_t create_uas_dialog( pjsip_user_agent *ua,
pj_strdup(dlg->pool, &dlg->remote.info_str, &tmp);
/* Save initial destination host from transport's info */
pj_strdup(dlg->pool, &dlg->initial_dest,
&rdata->tp_info.transport->remote_name.host);
if (rdata->tp_info.transport->dir == PJSIP_TP_DIR_OUTGOING) {
pj_strdup(dlg->pool, &dlg->initial_dest,
&rdata->tp_info.transport->remote_name.host);
}
/* Init remote's contact from Contact header.
* Iterate the Contact URI until we find sip: or sips: scheme.
@ -1831,8 +1832,9 @@ static void dlg_update_routeset(pjsip_dialog *dlg, const pjsip_rx_data *rdata)
* transaction as the initial transaction that establishes dialog.
*/
if (dlg->role == PJSIP_ROLE_UAC) {
/* Save initial destination host from transport's info. */
if (!dlg->initial_dest.slen) {
/* Update initial destination host from transport's info. */
if (rdata->tp_info.transport->dir == PJSIP_TP_DIR_OUTGOING)
{
pj_strdup(dlg->pool, &dlg->initial_dest,
&rdata->tp_info.transport->remote_name.host);
}

View File

@ -372,7 +372,7 @@ PJ_DEF(pjsip_transport_type_e) pjsip_transport_get_type_from_flag(unsigned flag)
/* Get the transport type for the specified flags. */
for (i=0; i<PJ_ARRAY_SIZE(transport_names); ++i) {
if (transport_names[i].flag == flag) {
if ((transport_names[i].flag & flag) == flag) {
return transport_names[i].type;
}
}

View File

@ -810,7 +810,8 @@ PJ_DEF(pj_status_t) pjsip_get_dest_info(const pjsip_uri *target_uri,
*/
pj_bzero(dest_info, sizeof(*dest_info));
/* When request URI uses sips scheme, TLS must always be used regardless
/* When request URI uses sips scheme, secure transport
* (the default is TLS) must always be used regardless
* of the target scheme or transport type (see ticket #1740).
*/
if (PJSIP_URI_SCHEME_IS_SIPS(target_uri) ||
@ -819,14 +820,13 @@ PJ_DEF(pj_status_t) pjsip_get_dest_info(const pjsip_uri *target_uri,
{
pjsip_uri *uri = (pjsip_uri*) target_uri;
const pjsip_sip_uri *url=(const pjsip_sip_uri*)pjsip_uri_get_uri(uri);
unsigned flag;
unsigned flag, tp_flag;
if (!PJSIP_URI_SCHEME_IS_SIPS(target_uri)) {
PJ_LOG(4,(THIS_FILE, "Automatic switch to TLS transport as "
PJ_LOG(4,(THIS_FILE, "Automatic switch to secure transport as "
"request-URI uses ""sips"" scheme."));
}
dest_info->flag |= (PJSIP_TRANSPORT_SECURE | PJSIP_TRANSPORT_RELIABLE);
if (url->maddr_param.slen)
pj_strdup(pool, &dest_info->addr.host, &url->maddr_param);
else
@ -834,19 +834,28 @@ PJ_DEF(pj_status_t) pjsip_get_dest_info(const pjsip_uri *target_uri,
dest_info->addr.port = url->port;
dest_info->type =
pjsip_transport_get_type_from_name(&url->transport_param);
/* Double-check that the transport parameter match.
* Sample case: sips:host;transport=tcp
* See https://github.com/pjsip/pjproject/issues/1319
*/
flag = pjsip_transport_get_flag_from_type(dest_info->type);
if ((flag & dest_info->flag) != dest_info->flag) {
tp_flag = PJSIP_TRANSPORT_SECURE;
/* There doesn't seem to be any requirement for SIPS to use
* reliable transport, so we disable this.
*/
// tp_flag |= PJSIP_TRANSPORT_RELIABLE;
if ((flag & tp_flag) != tp_flag) {
pjsip_transport_type_e t;
t = pjsip_transport_get_type_from_flag(dest_info->flag);
t = pjsip_transport_get_type_from_flag(tp_flag);
if (t != PJSIP_TRANSPORT_UNSPECIFIED)
dest_info->type = t;
}
dest_info->flag =
pjsip_transport_get_flag_from_type(dest_info->type);
} else if (PJSIP_URI_SCHEME_IS_SIP(target_uri)) {
pjsip_uri *uri = (pjsip_uri*) target_uri;
const pjsip_sip_uri *url=(const pjsip_sip_uri*)pjsip_uri_get_uri(uri);

View File

@ -3425,13 +3425,22 @@ pj_status_t pjsua_acc_get_uac_addr(pjsua_acc_id acc_id,
}
/* Get transport type of the URI */
if (PJSIP_URI_SCHEME_IS_SIPS(sip_uri))
tp_type = PJSIP_TRANSPORT_TLS;
else if (sip_uri->transport_param.slen == 0) {
if (sip_uri->transport_param.slen == 0) {
tp_type = PJSIP_TRANSPORT_UDP;
} else
tp_type = pjsip_transport_get_type_from_name(&sip_uri->transport_param);
/* If the URI uses sips scheme, make sure we use secure transport. */
if (PJSIP_URI_SCHEME_IS_SIPS(sip_uri)) {
unsigned flag, tp_flag;
tp_flag = PJSIP_TRANSPORT_SECURE;
flag = pjsip_transport_get_flag_from_type(tp_type);
if ((flag & tp_flag) != tp_flag) {
tp_type = pjsip_transport_get_type_from_flag(tp_flag);
}
}
if (tp_type == PJSIP_TRANSPORT_UNSPECIFIED)
return PJSIP_EUNSUPTRANSPORT;
@ -3799,13 +3808,22 @@ PJ_DEF(pj_status_t) pjsua_acc_create_uas_contact( pj_pool_t *pool,
}
/* Get transport type of the URI */
if (PJSIP_URI_SCHEME_IS_SIPS(sip_uri))
tp_type = PJSIP_TRANSPORT_TLS;
else if (sip_uri->transport_param.slen == 0) {
if (sip_uri->transport_param.slen == 0) {
tp_type = PJSIP_TRANSPORT_UDP;
} else
tp_type = pjsip_transport_get_type_from_name(&sip_uri->transport_param);
/* If the URI uses sips scheme, make sure we use secure transport. */
if (PJSIP_URI_SCHEME_IS_SIPS(sip_uri)) {
unsigned flag, tp_flag;
tp_flag = PJSIP_TRANSPORT_SECURE;
flag = pjsip_transport_get_flag_from_type(tp_type);
if ((flag & tp_flag) != tp_flag) {
tp_type = pjsip_transport_get_type_from_flag(tp_flag);
}
}
if (tp_type == PJSIP_TRANSPORT_UNSPECIFIED)
return PJSIP_EUNSUPTRANSPORT;

View File

@ -948,7 +948,9 @@ PJ_DEF(pj_status_t) pjsua_call_make_call(pjsua_acc_id acc_id,
/* Create outgoing dialog: */
status = pjsip_dlg_create_uac( pjsip_ua_instance(),
&acc->cfg.id, &contact,
(msg_data && msg_data->local_uri.slen?
&msg_data->local_uri: &acc->cfg.id),
&contact,
dest_uri,
(msg_data && msg_data->target_uri.slen?
&msg_data->target_uri: dest_uri),

View File

@ -167,6 +167,7 @@ PJ_DEF(pjsua_msg_data*) pjsua_msg_data_clone(pj_pool_t *pool,
PJ_ASSERT_RETURN(msg_data != NULL, NULL);
pj_strdup(pool, &msg_data->target_uri, &rhs->target_uri);
pj_strdup(pool, &msg_data->local_uri, &rhs->local_uri);
pj_list_init(&msg_data->hdr_list);
hdr = rhs->hdr_list.next;

View File

@ -560,7 +560,8 @@ PJ_DEF(pj_status_t) pjsua_im_send( pjsua_acc_id acc_id,
&pjsip_message_method,
(msg_data && msg_data->target_uri.slen?
&msg_data->target_uri: to),
&acc->cfg.id,
(msg_data && msg_data->local_uri.slen?
&msg_data->local_uri: &acc->cfg.id),
to, NULL, NULL, -1, NULL, &tdata);
if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE, "Unable to create request", status);

View File

@ -600,8 +600,8 @@ TsxStateEvent::TsxStateEvent()
bool SipTxOption::isEmpty() const
{
return (targetUri == "" && headers.size() == 0 && contentType == "" &&
msgBody == "" && multipartContentType.type == "" &&
return (targetUri == "" && localUri == "" && headers.size() == 0 &&
contentType == "" && msgBody == "" && multipartContentType.type == "" &&
multipartContentType.subType == "" && multipartParts.size() == 0);
}
@ -609,6 +609,8 @@ void SipTxOption::fromPj(const pjsua_msg_data &prm) PJSUA2_THROW(Error)
{
targetUri = pj2Str(prm.target_uri);
localUri = pj2Str(prm.local_uri);
headers.clear();
pjsip_hdr* pj_hdr = prm.hdr_list.next;
while (pj_hdr != &prm.hdr_list) {
@ -640,6 +642,8 @@ void SipTxOption::toPj(pjsua_msg_data &msg_data) const
msg_data.target_uri = str2Pj(targetUri);
msg_data.local_uri = str2Pj(localUri);
pj_list_init(&msg_data.hdr_list);
for (i = 0; i < headers.size(); i++) {
pjsip_generic_string_hdr& pj_hdr = headers[i].toPj();

View File

@ -1,6 +0,0 @@
#!/bin/sh
svn add $*
./svn_pset $*

View File

@ -1,12 +0,0 @@
@echo off
if "%*" EQU "" (
echo Usage: svn_add.bat FILE1 ...
goto end
)
svn add %*
svn_pset.bat %*
:end

View File

@ -1,4 +0,0 @@
#!/bin/sh
svn pset svn:keywords id $*
svn pset svn:eol-style native $*

View File

@ -1,11 +0,0 @@
@echo off
if "%*" EQU "" (
echo Usage: svn_pset.bat FILE1 ...
goto end
)
svn pset svn:keywords id %*
svn pset svn:eol-style native %*
:end