Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/3.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmer Loen committed Jun 22, 2018
2 parents 7c2f9ab + c0d0470 commit 3dbe5ae
Show file tree
Hide file tree
Showing 30 changed files with 710 additions and 134 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file.

---

## [3.2.0](https://github.com/VoIPGRID/VialerSIPLib/tree/3.1.2) (06/15/2018)
Released on Friday, June 15, 2018.

### Added
- Configurable codecs through the new VSLCodecConfiguration class. (#133)
- Ability to do a blind transfer of a call (#137)
- Build in a check to see if there is audio for call. When there is no audio in the first 10 seconds a notification is posted. (#138)

### Fixed
- First pass of removing the call referencing from the VSLAccount class in favor of the VSLCallManager (#142)
- Some memory managent for the VSLCall and the VSLRingback classes (#142)

## [3.1.3](https://github.com/VoIPGRID/VialerSIPLib/tree/3.1.2) (04/06/2018)
Released on Friday, April 6, 2018.

Expand Down
24 changes: 12 additions & 12 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
PODS:
- CocoaLumberjack (3.4.1):
- CocoaLumberjack/Default (= 3.4.1)
- CocoaLumberjack/Extensions (= 3.4.1)
- CocoaLumberjack/Default (3.4.1)
- CocoaLumberjack/Extensions (3.4.1):
- CocoaLumberjack (3.4.2):
- CocoaLumberjack/Default (= 3.4.2)
- CocoaLumberjack/Extensions (= 3.4.2)
- CocoaLumberjack/Default (3.4.2)
- CocoaLumberjack/Extensions (3.4.2):
- CocoaLumberjack/Default
- OCMock (3.4.1)
- Reachability (3.2)
- SPLumberjackLogFormatter (0.0.1):
- CocoaLumberjack
- Vialer-pjsip-iOS (3.3.5)
- VialerSIPLib (3.1.3):
- Vialer-pjsip-iOS (3.3.7)
- VialerSIPLib (3.2.0):
- CocoaLumberjack
- Reachability
- Vialer-pjsip-iOS
Expand All @@ -21,7 +21,7 @@ DEPENDENCIES:
- VialerSIPLib (from `../`)

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
https://github.com/cocoapods/specs.git:
- CocoaLumberjack
- OCMock
- Reachability
Expand All @@ -39,13 +39,13 @@ CHECKOUT OPTIONS:
:git: https://github.com/VoIPGRID/SPLumberjackLogFormatter.git

SPEC CHECKSUMS:
CocoaLumberjack: 2e258a064cacc8eb9a2aca318e24d02a0a7fd56d
CocoaLumberjack: db7cc9e464771f12054c22ff6947c5a58d43a0fd
OCMock: 2cd0716969bab32a2283ff3a46fd26a8c8b4c5e3
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
SPLumberjackLogFormatter: a2290c9b880f3166b2d1bace45dc1fc1302b28ab
Vialer-pjsip-iOS: 73572fa0f9cf8791c318580c606d1b95163a4ca4
VialerSIPLib: dfcf0f28bc9e77f9f763a7562bc8db7b6b82477d
Vialer-pjsip-iOS: 3b8bac1bf7e6831379cd0b4763dce1842db0abb4
VialerSIPLib: 2664f71bc819a86399a6ee33877619c15ec1ef4c

PODFILE CHECKSUM: d5d9deca56ac68b69c70ab9a6d89a30c6d4fef32

COCOAPODS: 1.5.0
COCOAPODS: 1.5.3
11 changes: 10 additions & 1 deletion Example/VialerSIPLib/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

endpointConfiguration.ipChangeConfiguration = ipChangeConfiguration;

let codecConfiguration = VSLCodecConfiguration()
codecConfiguration.audioCodecs = [
VSLAudioCodecs(audioCodec: .ILBC, andPriority: 210),
VSLAudioCodecs(audioCodec: .g711a, andPriority: 209)
]
// codecConfiguration.videoCodecs = [
// VSLVideoCodecs(videoCodec: .H264, andPriority: 210)
// ]
endpointConfiguration.codecConfiguration = codecConfiguration;

do {
try VialerSIPLib.sharedInstance().configureLibrary(withEndPointConfiguration: endpointConfiguration)
// Set your incoming call block here.
setupIncomingCallBlock()
VialerSIPLib.sharedInstance().onlyUseIlbc(true)
} catch let error {
DDLogWrapper.logError("Error setting up VialerSIPLib: \(error)")
}
Expand Down
60 changes: 37 additions & 23 deletions Example/VialerSIPLib/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions Example/VialerSIPLib/VSLCallViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class VSLCallViewController: UIViewController, VSLKeypadViewControllerDelegate {
activeCall?.addObserver(self, forKeyPath: "callState", options: .new, context: &myContext)
activeCall?.addObserver(self, forKeyPath: "onHold", options: .new, context: &myContext)
NotificationCenter.default.addObserver(self, selector: #selector(updateUI), name: NSNotification.Name(rawValue: VSLAudioControllerAudioInterrupted), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(noAudioForCall), name: Notification.Name.VSLCallNoAudioForCall, object: nil)
}

override func viewWillDisappear(_ animated: Bool) {
Expand All @@ -63,6 +64,7 @@ class VSLCallViewController: UIViewController, VSLKeypadViewControllerDelegate {
activeCall?.removeObserver(self, forKeyPath: "callState")
activeCall?.removeObserver(self, forKeyPath: "onHold")
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: VSLAudioControllerAudioInterrupted), object: nil)
NotificationCenter.default.removeObserver(self, name: Notification.Name.VSLCallNoAudioForCall, object: nil)
}

// MARK: - Outlets
Expand Down Expand Up @@ -168,6 +170,12 @@ class VSLCallViewController: UIViewController, VSLKeypadViewControllerDelegate {
}
}

@objc func noAudioForCall() {
guard let call = activeCall, call.callState != .disconnected else { return }

call.reinvite()
}

@objc func updateUI() {
guard let call = activeCall else { return }
updateLabels(call: call, statusLabel: statusLabel, numberLabel: numberLabel)
Expand Down
18 changes: 18 additions & 0 deletions Example/VialerSIPLib/VSLTransferCallViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ private var myContext = 0
static let UnwindToMainView = "UnwindToMainViewSegue"
static let ShowKeypad = "ShowKeypadSegue"
static let UnwindToFirstCallInProgress = "UnwindToFirstCallInProgressSegue"
static let TransferInProgress = "TransferInProgressSegue"
}
}

Expand Down Expand Up @@ -58,6 +59,19 @@ private var myContext = 0
}
}

@IBAction func blindButtonPressed(_ sender: UIButton) {
guard let number = numberToDialLabel.text, number != "" else { return }
guard let call = currentCall else { return }

if call.blindTransferCall(withNumber: number) {
callManager.end(call) { (error) in
if error != nil {
self.performSegue(withIdentifier: Configuration.Segues.TransferInProgress, sender: nil)
}
}
}
}

@IBAction override func callButtonPressed(_ sender: UIButton) {
guard let number = numberToDialLabel.text, number != "" else { return }

Expand Down Expand Up @@ -98,6 +112,10 @@ private var myContext = 0
} else if let call = currentCall, call.callState != .null && call.callState != .disconnected {
callVC.activeCall = call
}
} else if let transferInProgressVC = segue.destination as? VSLTransferInProgressViewController {
guard let call = currentCall else { return }
transferInProgressVC.firstCall = call
transferInProgressVC.secondCallBlindNumber = numberToDialLabel.text
}
}

Expand Down
10 changes: 10 additions & 0 deletions Example/VialerSIPLib/VSLTransferInProgressViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class VSLTransferInProgressViewController: UIViewController {
}
}

var secondCallBlindNumber: String? {
didSet {
updateUI()
}
}

// MARK: - Lifecycle

override func viewWillAppear(_ animated: Bool) {
Expand Down Expand Up @@ -79,6 +85,10 @@ class VSLTransferInProgressViewController: UIViewController {
if let call = secondCall, let label = secondCallNumberLabel {
label.text = call.callerNumber!
}

if let phoneNumber = secondCallBlindNumber, let label = secondCallNumberLabel {
label.text = phoneNumber
}
}

fileprivate func prepareForDismissing() {
Expand Down
3 changes: 3 additions & 0 deletions Example/VialerSIPLib/VialerSIPLib_Example-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

#import "DDLogWrapper.h"
#import <VialerSIPLib/VSLAudioController.h>
#import <VialerSIPLib/VSLCall.h>
#import <VialerSIPLib/VialerSIPLib.h>
#import <VialerSIPLib/VSLRingtone.h>
#import <VialerSIPLib/CallKitProviderDelegate.h>
#import <VialerSIPLib/VSLAudioCodecs.h>
#import <VialerSIPLib/VSLVideoCodecs.h>
14 changes: 7 additions & 7 deletions Pod/Classes/CallKitProviderDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ - (void)reportIncomingCall:(VSLCall *)call {
* "native" CallKit interface.
*/
- (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAction *)action NS_AVAILABLE_IOS(10.0) {
VSLCall *call = [self.callManager callWithUUID:action.callUUID];
__weak VSLCall *call = [self.callManager callWithUUID:action.callUUID];
if (call) {
[self.callManager.audioController configureAudioSession];

Expand Down Expand Up @@ -127,7 +127,7 @@ - (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAct
*/
- (void)provider:(CXProvider *)provider performEndCallAction:(CXEndCallAction *)action NS_AVAILABLE_IOS(10.0){
// Find call.
VSLCall *call = [self.callManager callWithUUID:action.callUUID];
__weak VSLCall *call = [self.callManager callWithUUID:action.callUUID];
if (!call) {
VSLLogInfo(@"Error hanging up call(%@). No call found", action.callUUID.UUIDString);
[action fulfill];
Expand Down Expand Up @@ -158,7 +158,7 @@ - (void)provider:(CXProvider *)provider performEndCallAction:(CXEndCallAction *)
* Delegate method called when CallKit approves the apps request to start an outbound call.
*/
- (void)provider:(CXProvider *)provider performStartCallAction:(CXStartCallAction *)action NS_AVAILABLE_IOS(10.0) {
VSLCall *call = [self.callManager callWithUUID:action.callUUID];
__weak VSLCall *call = [self.callManager callWithUUID:action.callUUID];
[self.callManager.audioController configureAudioSession];

[call startWithCompletion:^(NSError *error) {
Expand All @@ -179,7 +179,7 @@ - (void)provider:(CXProvider *)provider performStartCallAction:(CXStartCallActio
}

- (void)provider:(CXProvider *)provider performSetMutedCallAction:(CXSetMutedCallAction *)action NS_AVAILABLE_IOS(10.0) {
VSLCall *call = [self.callManager callWithUUID:action.callUUID];
__weak VSLCall *call = [self.callManager callWithUUID:action.callUUID];
if (!call) {
[action fail];
return;
Expand All @@ -196,7 +196,7 @@ - (void)provider:(CXProvider *)provider performSetMutedCallAction:(CXSetMutedCal
}

- (void)provider:(CXProvider *)provider performSetHeldCallAction:(CXSetHeldCallAction *)action NS_AVAILABLE_IOS(10.0) {
VSLCall *call = [self.callManager callWithUUID:action.callUUID];
__weak VSLCall *call = [self.callManager callWithUUID:action.callUUID];
if (!call) {
[action fail];
return;
Expand All @@ -213,7 +213,7 @@ - (void)provider:(CXProvider *)provider performSetHeldCallAction:(CXSetHeldCallA
}

- (void)provider:(CXProvider *)provider performPlayDTMFCallAction:(CXPlayDTMFCallAction *)action NS_AVAILABLE_IOS(10.0) {
VSLCall *call = [self.callManager callWithUUID:action.callUUID];
__weak VSLCall *call = [self.callManager callWithUUID:action.callUUID];
if (!call) {
[action fail];
return;
Expand Down Expand Up @@ -242,7 +242,7 @@ - (void)providerDidReset:(CXProvider *)provider NS_AVAILABLE_IOS(10.0) {
}

- (void)callStateChanged:(NSNotification *)notification {
VSLCall *call = [[notification userInfo] objectForKey:VSLNotificationUserInfoCallKey];
__weak VSLCall *call = [[notification userInfo] objectForKey:VSLNotificationUserInfoCallKey];
switch (call.callState) {
case VSLCallStateNull:
break;
Expand Down
78 changes: 78 additions & 0 deletions Pod/Classes/Codecs/VSLAudioCodecs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//
// VSLCodecs.h
// Copyright © 2018 Devhouse Spindle. All rights reserved.
//


#import <Foundation/Foundation.h>

#import "VSLCodecConfiguration.h"

/**
* Enum of possible Audio Codecs.
*/
typedef NS_ENUM(NSInteger, VSLAudioCodec) {
// G711a
VSLAudioCodecG711a,
// G722
VSLAudioCodecG722,
// iLBC
VSLAudioCodecILBC,
// G711
VSLAudioCodecG711,
// Speex 8 kHz
VSLAudioCodecSpeex8000,
// Speex 16 kHz
VSLAudioCodecSpeex16000,
// Speex 32 kHz
VSLAudioCodecSpeex32000,
// GSM 8 kHZ
VSLAudioCodecGSM,
// Opus
VSLAudioCodecOpus,
};
#define VSLAudioCodecString(VSLAudioCodec) [VSLAudioCodecArray objectAtIndex:VSLAudioCodec]
#define VSLAudioCodecStringWithIndex(NSInteger) [VSLAudioCodecArray objectAtIndex:NSInteger]
#define VSLAudioCodecArray @[@"PCMA/8000/1", @"G722/16000/1", @"iLBC/8000/1", @"PCMU/8000/1", @"speex/8000/1", @"speex/16000/1", @"speex/32000/1", @"GSM/8000/1", @"opus/48000/2"]


@interface VSLAudioCodecs : NSObject

/**
* The prioritiy of the codec
*/
@property (readonly, nonatomic) NSUInteger priority;

/**
* The used codec.
*/
@property (readonly, nonatomic) VSLAudioCodec codec;

/**
* Make the default init unavaibale.
*/
- (instancetype _Nonnull) init __attribute__((unavailable("init not available. Use initWithAudioCodec instead.")));

/**
* The init to setup the audio codecs.
*
* @param codec Audio codec codec to set the prioritiy for.
* @param priority NSUInteger the priority the codec will have.
*/
- (instancetype _Nonnull)initWithAudioCodec:(VSLAudioCodec)codec andPriority:(NSUInteger)priority;

/**
* Get the codec from the #define VSLCodecConfigurationAudioString with a VSLCodecConfigurationAudio type.
*
* @param codec VSLCodecConfigurationAudio the codec to get the string representation of.
*
* @return NSString the string representation of the VSLCodecConfigurationAudio type.
*/
+ (NSString * _Nonnull)codecString:(VSLAudioCodec)codec;

/**
* Get the codec from the defined VSLCodecConfigurationAudioString with an index.
*/
+ (NSString * _Nonnull)codecStringWithIndex:(NSInteger)index;

@end
30 changes: 30 additions & 0 deletions Pod/Classes/Codecs/VSLAudioCodecs.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// VSLCodecs.m
// Copyright © 2018 Devhouse Spindle. All rights reserved.
//

#import "VSLAudioCodecs.h"

@interface VSLAudioCodecs()
@property (readwrite, nonatomic) NSUInteger priority;
@property (readwrite, nonatomic) VSLAudioCodec codec;
@end

@implementation VSLAudioCodecs
- (instancetype)initWithAudioCodec:(VSLAudioCodec)codec andPriority:(NSUInteger)priority {
if (self = [super init]) {
self.codec = codec;
self.priority = priority;
}

return self;
}

+ (NSString *)codecString:(VSLAudioCodec)codec {
return VSLAudioCodecString(codec);
}

+ (NSString *)codecStringWithIndex:(NSInteger)index {
return VSLAudioCodecStringWithIndex(index);
}
@end
Loading

0 comments on commit 3dbe5ae

Please sign in to comment.