How to integrate PjSip in Swift project?

Viewed 1800

enter image description hereI want to integrate the PJSIP in my project , I am following the steps give site (https://trac.pjsip.org/repos/wiki/Getting-Started/iPhone). I am able to make a project as they told . but know I want to integrate in my swift project . Can anyone guide me , how to integrate PJSIP library and other code in my Code . Right now ,I am facing a linker errors in my swift object.

1 Answers

This is from my notes of a project that uses PJSIP and should cover everything to set up a new Xcode project:

- Download from https://www.pjsip.org/download.htm

- Info:
    https://trac.pjsip.org/repos/wiki/Getting-Started/iPhone
    https://onmyway133.com/posts/learning-voip-rtp-and-sip-aka-awesome-pjsip/
    
- Create ./pjproject-2.10/pjlib/include/pj/config_site.h:
    #define PJ_CONFIG_IPHONE 1
    #define PJMEDIA_HAS_VIDEO 1
    #define PJMEDIA_HAS_VID_TOOLBOX_CODEC 1

    #define PJ_HAS_SSL_SOCK 1
    #define PJ_SSL_SOCK_IMP PJ_SSL_SOCK_IMP_APPLE

    #include <pj/config_site_sample.h>

- Create ./pjproject-2.10/user.mak:
    export LDFLAGS += -framework Network -framework Security -framework VideoToolbox

- In ./pjproject-2.10 run:
    $ export MIN_IOS="-miphoneos-version-min=13.0"
    $ ./configure-iphone
    $ make dep && make clean && make

- Add Network, Security, and VideoToolbox (for H264) iOS frameworks to Xcode project.

- Create <your app name>-Bridging-Header.h and mark it as Objective-C Bridging Header in Build Settings:
    #import "pjsua.h"
    ...

- Add PJ_AUTOCONF to Build Settings > Preprocessor Macros

- Add/Drag the .a files from the following directories to General > Frameworks, Libraries, and Embedded Content:
    ./pjproject-2.10/pjlib/lib/
    ./pjproject-2.10/pjlib-util/lib/
    ./pjproject-2.10/pjmedia/lib/
    ./pjproject-2.10/pjnath/lib/
    ./pjproject-2.10/pjsip/lib/

- Add the following directories to Build Settings > Header Search Paths (use relative path from app's main directory):
    ./pjproject-2.10/pjlib/include/
    ./pjproject-2.10/pjlib-util/include/
    ./pjproject-2.10/pjmedia/include/
    ./pjproject-2.10/pjnath/include/
    ./pjproject-2.10/pjsip/include/
Related