Swiftpack.co - CleverTap/CTSoftPhone as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by CleverTap.
CleverTap/CTSoftPhone 0.0.6-alpha
Basic PJSUA/PJSIP wrapper supporting VOIP calling on iOS devices and simulators
⭐️ 1
🕓 1 year ago
iOS
.package(url: "https://github.com/CleverTap/CTSoftPhone.git", from: "0.0.6-alpha")

CTSoftPhone

Basic PJSUA/PJSIP wrapper supporting VOIP calling on iOS devices and simulators

Usage

import CTSoftPhone

// set logging level
CTSoftPhone.setDebugLevel(CTSoftPhoneLogLevel.debug)
// CTSoftPhone.setDebugLevel(CTSoftPhoneLogLevel.info)
// CTSoftPhone.setDebugLevel(CTSoftPhoneLogLevel.off)

... 

// implement CTSoftPhoneDelegate
@objc func onRegistrationState(_ state: CTSoftPhoneRegistrationState) {...}
@objc func onCallState(_ state: CTSoftPhoneCallState) {...}

// create config with port and transport type
let pjsipConfig = CTSoftPhoneConfig.init(port: 7503, transport: .TCP)

// init sharedInstance with your delegate and config
pjsipInstance = CTSoftPhone.sharedInstance(with: self, config: pjsipConfig)

...

// register account
pjsipInstance.register(withNumber: <sip account number>, withHost: <sip host>, withCredentials: <sip account credentials>)
 
...
 
// unregister account 
pjsipInstance.destroy()

// end call 
pjsipInstance.hangup()
 
// mute/unmute
pjsipInstance.mute()
pjsipInstance.unmute()
 
// speaker
pjsipInstance.speakeron()
pjsipInstance.speakeroff()
 

Install

Swift Package Manager

Add the https://github.com/CleverTap/CTSoftPhone.git url to your project's Swift packages

CocoaPods

 target 'YOUR_TARGET_NAME' do  
      pod 'CTSoftPhone'  
  end 

Manual

Download the CTSoftPhone.xcframework included in this repository, drag it into your project and add it as an embedded framework in your build settings

Caveats

Usage with transports other than TCP has not been tested. Asterisk v18.9.0 is the only SIP server this has been tested with so far. This is a basic wrapper around pjsua and does not implement all functionality.
The current version requires an external trigger to your SIP server to generate an invite once the client is registered with the SIP server. There is no general plan to implement all available functionality although happyt to consider PRs.

GitHub

link
Stars: 1
Last commit: 21 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

0.0.6-alpha
1 year ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics