1

I am creating a voip call based project with Linphone and I have also successfully build and run the Linphone project and successfully run audio and video call. Now I am integrating Linphone in my own project and I am facing many problems and issues with this. I have used some following links for help but nowhere are complete instructions. Can anyone provide me the complete running steps for this-

http://shallwelearn.com/blog/build-linphone-for-iphone-and-ipad/

Integrate Linphone app to my iOS app

How to integrate Linphone into an existing project (SIP in IOS)

http://www.linphone.org/technical-corner/linphone/overview

How to integrate Linphone into an existing project (SIP in IOS)

http://lists.gnu.org/archive/html/linphone-developers/2014-09/msg00109.html

http://www.successmonkey.co.nz/blog/building-linphone-for-ios

Community
  • 1
  • 1
Ravi Gautam
  • 960
  • 2
  • 9
  • 20

2 Answers2

6
  • Download Liblinphone iPhone SDK from the link: http://www.linphone.org/releases/ios choose latest one.
  • Move two folders (include and lib) to your project folder
  • Add paths to these folders in your project Build settings - INCLUDE folder goes to headers and LIB folder goes to libraries.
  • In General tab in Linked frameworks add all files from LIB folder
  • Download/clone the repo https://github.com/BelledonneCommunications/linphone-iphone
  • Find 4 files: LinphoneManager.h/.m and Utils.h/.m , include them in your project folder and add them to the left pane to other class files also
  • Try to compile your project - xCode will spam you with errors - this is ok.
  • You need to inspect errors and just delete all file imports causing errors (Some Linphone Address book files/ some config store files and some helpers classes that you do not need for basic use in your project (because most likely you already implemented this features in your existing project))
  • Then compile again and inspect all errors in methods. Comment delete any problematic chunks of code (there will be about 10-15 of them).

LinphoneManager class already include many useful features - like good watch and use of linphone core with good logging and etc and etc, but not all of them (unfortunately).

Andrei Konstantinov
  • 6,971
  • 4
  • 41
  • 57
  • Download Liblinphone iPhone SDK from the link: http://www.linphone.org/releases/ios/ and choose latest one. – Dharmendra Kumar Rajan Mar 16 '16 at 10:50
  • @AndreyKonstantinov - I have clone the repo, In Linphone app, liblinphone sdk was missing then i have downloaded Liblinphone sdk as mentioned you above and run then libbelcard.a,libbelr.a library showing missing(in redcolor), I have deleted that library and run it. It is finally run on simulator 6 and 6+, But when i run on device it is running successfully but during login it is crashing on device but not on simulator, Please Advice, Thanks, Crashing log: [_NSInlineData bytes]: message sent to deallocated instance – Dharmendra Kumar Rajan Mar 16 '16 at 11:32
  • @DharmendraKumarRajan Looks like some object being deallocated while you still need it. Looks like you've created variable inside some method and it have been deallocated after method has finished its tasks. Try to make instance variables. It's really hard to point in the right direction here. – Andrei Konstantinov Mar 28 '16 at 09:41
  • @NikolaLukic it's not folder - it's inside of one of the project Tabs in XCode. Go to project (top blue icon among projects file - then choose General tab then scroll down to Frameworks section). – Andrei Konstantinov Nov 01 '17 at 18:17
  • I am not able to find these two folders (include and lib). and also this link is not working. http://www.linphone.org/releases/ios/liblinphone-iphone-sdk-latest.zip – Rushabh Shah Sep 05 '19 at 06:16
  • Hi @AndreiKonstantinov, Please let me know where we can get the linphone session. – Narasimha Nallamsetty Sep 19 '22 at 08:26
5

With Xcode 11 using macos 10.15.6 Catalina

Linphone SDK 4.4.0 Using Cocoapod

https://github.com/BelledonneCommunications/linphone-sdk/blob/master/README.md

Using a local linphone SDK Clone the linphone-sdk repository from out gitlab:

$ git clone https://gitlab.linphone.org/BC/public/linphone-sdk.git --recursive 
$ git submodule update --init --recursive

Or

$ git clone --recurse-submodules https://gitlab.linphone.org/BC/public/linphone-sdk.git

Rebuild the project:

PODFILE_PATH= pod install where is your build directory of the linphone-sdk project, containing the linphone-sdk.podspec file and a linphone-sdk ouptut directory comprising built frameworks and resources.

Pod file looks like


source "https://gitlab.linphone.org/BC/public/podspec.git"
source "https://github.com/CocoaPods/Specs.git"

def common_pods
    use_frameworks!

    pod 'linphone-sdk', '4.4.0'
end

Then open linphone.xcworkspace with Xcode to build and run the app.

Linphone SDK 4.4.0 Using Compile

$ git clone https://gitlab.linphone.org/BC/public/linphone-sdk.git -- recursive
$ git submodule update --init --recursive

Or

$ git clone --recurse-submodules https://gitlab.linphone.org/BC/public/linphone-sdk.git

Goto the build directory

$ mkdir build && cd build

———————————

https://gitlab.linphone.org/BC/public/linphone-cmake-builder/blob/ios-3.13.19/README.python.md

first, install brew

$ brew install cmake
$ brew install yasm
$ brew install pkg-config

Install pip ->

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.py

$ python -m pip install pystache //Check by $ python -m pip list

$ brew install doxygen

———————————

$ cmake .. -G Xcode -DLINPHONESDK_PLATFORM=IOS -DENABLE_G729=YES -DENABLE_G729B_CNG=YES -DENABLE_VCARD=OFF -DENABLE_ILBC=OFF -DENABLE_SILK=OFF -DENABLE_ISAC=OFF -DENABLE_MKV=OFF -DENABLE_GSM=OFF -DENABLE_DOC=OFF -DENABLE_UNIT_TESTS=OFF -DENABLE_LIME=OFF -DENABLE_GPL_THIRD_PARTIES=OFF -DENABLE_NON_FREE_CODECS=OFF

Note - in this step we will also enable G729 dedec support in our linphone sdk.

$ cmake --build . --config RelWithDebInfo

The compilation process is done now need to integrate with Xcode

Compiled Linphone SDK integrates into Xcode.

Find compiled sdk in below directory linphone-sdk -> build -> linphone-sdk -> apple-darwin

  1. Frameworks and share folder add into xcode project, Frameworks have multiple universal architectures.
  2. Frameworks path add into framework search in build settings
  3. Every framework of Frameworks folder, should be type "embed and sign" (means embed framework.) instead of "do not embed" as default while adding into Xcode Framework setting. it's the most very important part.
  4. apple-darwin -> Tools folder have deply.sh script, copy its contents and create a new run script in "build settings" and paste in it"
  5. the tricky part is where to place the 4th point's script for upload app using archive with strip and slice. Edit Scheme -> Archive -> open dropdown -> post actions -> + to add new script -> copy and paste.

6 (Optional). If experience script causes application crash due to fat library used our project, There is a minor change in the script, I found a solution from this URL - Errors building Xcode Project after adding in Run Script fatal error: lipo: input file

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
    FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
    FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
    echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

# Start of Script modify - identify if the framework is FAT. If it is, then it skips it.
    if [ ! -f "${FRAMEWORK_EXECUTABLE_PATH}" ]; then
        continue
    fi

    if xcrun lipo -info "${FRAMEWORK_EXECUTABLE_PATH}" | grep --silent "Non-fat"; then
        echo "Framework non-fat, skipping: $FRAMEWORK_EXECUTABLE_NAME"
        continue
    fi

    echo "Thinning framework $FRAMEWORK_EXECUTABLE_NAME"
# end of Script modify

    EXTRACTED_ARCHS=()

    for ARCH in $ARCHS
    do
        echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
        lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
        EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
    done

    echo "Merging extracted architectures: ${ARCHS}"
    lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
    rm "${EXTRACTED_ARCHS[@]}"

    echo "Replacing original executable with thinned version"
    rm "$FRAMEWORK_EXECUTABLE_PATH"
    mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done
  1. If you are using pod then de integrate pod using terminal command "pod deintegrate" on your pod directory. also delete .xcworkspace file from the project.
  2. Now install pod using terminal command "pod install"

Note: If your case was Adding script causes app crash as I mentioned in 6th point but every time adding the script, have to pod de integrate help me avoid it.

:) Now enjoy using linphone sdk in your project.

end of linphone sdk

Linphone SDK Configuration in our projects.

  1. Enable Codec - To enable audio codec first enable defaultValue of g729_preference in the Audio.plist file and last step In Project -> Target -> Build Settings find "Preprocessor macros" and include HAVE_G729, it prints in sip log like Adding G729/8000 for compatibility, just in case.

#Update - add 5th point fo compile for upload the app to the app store and G729 codec configuration.

Ravi Kumar
  • 1,356
  • 14
  • 22
  • 1
    i tried to compile using above steps but getting below error "The following build commands failed: PhaseScriptExecution CMake\ Rules build/linphone-sdk.build/Debug/ios-armv7.build/Script-8B6947E693B44EA0845EC051.sh" So can you help me to resolve this error? – shraddha k vaishanani Sep 21 '20 at 11:39
  • @shraddhakvaishanani two probability can be submodule not get fetch in a git repo or not install CMake please check dependency in https://github.com/BelledonneCommunications/linphone-sdk/blob/master/README.md. can you tell in which step of compilation you got stuck? – Ravi Kumar Sep 21 '20 at 13:49
  • i am stuck using below command $ cmake --build . --config RelWithDebInfo – shraddha k vaishanani Sep 22 '20 at 14:05
  • @RaviKumar Can you tell how can I use linphone sdk to call to a phone number? What configuration may be needed? We already have PBX server ready. – Master AgentX Oct 04 '20 at 15:59
  • @MasterAgentX as per my understanding, call to mobile number instead of sip user, is server side configuration, we just have to call using mobile number instead of sip user id (as per linphone code). the server should understand "mobile number" is not sip user id so they make it an outbound call to carrier mobile number. other than I don't have idea. if you find it, please share with us, we will appreciate. – Ravi Kumar Oct 06 '20 at 11:23
  • @RaviKumar have you got any solution? – dheeru Oct 09 '20 at 14:36
  • @RaviKumar (1 failure) make: *** [/Users/mac/Documents/shraddha_linphoone/linphone-sdk/build/ios-armv7-prefix/src/ios-armv7-stamp/Debug-iphonesimulator/ios-armv7-build] Error 65 Command /bin/sh failed with exit code 2 Facing this error at the time of build.So can you please hemp me? – shraddha k vaishanani Oct 12 '20 at 06:43
  • @RaviKumar complied linphone successfully but which place set PODFILE_PATH? can you please help me? – shraddha k vaishanani Oct 13 '20 at 05:12
  • @shraddhakvaishanani we complied because few features did not have in linphone sdk using cocoa pod. so after you did compile you don't need to use pod items for linphone sdk. if you are troubling cocoa pod related issue in that case this question is not appropriate. – Ravi Kumar Oct 21 '20 at 11:01
  • @RaviKumar linephone sdk compiled added in code but in audio codec list not display G729 codec but in linphone sdk build folder checked g729 codec .a file genrated. so can you please help me for how to display the G729 codec in codec list and used for call? – shraddha k vaishanani Oct 23 '20 at 07:18
  • @shraddhakvaishanani I update the answer with the configuration of enabling codec. hope it helps you. – Ravi Kumar Oct 27 '20 at 07:30
  • @RaviKumar Thank you for update answer but still not display g729 in codec list.In log we are getting below linphone[9168:172722] [Message] Codec G729/8000 fmtp=[annexb=yes] number=18, default enablement: 16) added to the list of possible codecs. Could not find encoder for G729 so can you please help me. – shraddha k vaishanani Oct 27 '20 at 11:02
  • @RaviKumar i want used only compile sdk not used pod of linphone so can you please suggest me how to used linphone sdk only? – shraddha k vaishanani Oct 27 '20 at 12:22
  • @shraddhakvaishanani please understand the above-mentioned step is only for compiled sdk, not for cocoapod. I mentioned the 7th and 8th steps make you confused, i will remove it. your g729 is not enabled just because of linphone using pod. – Ravi Kumar Oct 27 '20 at 12:34
  • @RaviKumarremoved pod and now only used compiled sdk but getting error like. "No such module 'linphonesw'". linphonesw folder create in apple-darwinare---->share-->linphonesw.So how to add in project? – shraddha k vaishanani Oct 28 '20 at 12:07
  • @shraddhakvaishanani please remove import linphonesw because you are not using pod's import and linphonesw.swift class into your project as you can find in complied sdk folders. you will also got error in override mathod so you need to use as per used in its base classes. – Ravi Kumar Nov 01 '20 at 07:38
  • @RaviKumar I'm using linphone-sdk pod in my project. In Finder, the pod's size is approx 305 MB only. Can we use this to get a compiled version? I want to reduce my app size. – Master AgentX Nov 19 '20 at 03:15
  • On this Step "cmake --build . --config RelWithDebInfo", i am getting this error, The following build commands failed: PhaseScriptExecution Generate\ ios-armv7-prefix/src/ios-armv7-stamp/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/ios-armv7-build /Users/haseebjaved/Desktop/recursive/build/linphone-sdk.build/RelWithDebInfo-iphonesimulator/ios-armv7.build/Script-9303CE8FA6A148D2AA771A8E.sh – Haseeb Javed Jan 18 '21 at 05:18