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.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmer Loen committed Jun 28, 2018
2 parents 3dbe5ae + 4eaacf6 commit fda2a1d
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 19 deletions.
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ 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)
## [3.3.0](https://github.com/VoIPGRID/VialerSIPLib/tree/3.3.0) (06/28/2018)
Released on Thursday, June 28, 2018.

### Added
- Add a notification and state for audio during a call. (#145)
- The call-ID is being set in the SIP message is now added to VSLCall. (#144)

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

### Added
Expand Down Expand Up @@ -44,8 +51,8 @@ Released on Monday, February 19, 2018.
### Added
- Ability to use Stun servers.

###
- Fixes for the previous release secure calling. Extra file for the IP Change configuration for PJSIP.
###
- Fixes for the previous release secure calling. Extra file for the IP Change configuration for PJSIP.

## [3.0.0](https://github.com/VoIPGRID/VialerSIPLib/tree/3.0.0) (01/22/2018)
Released on Monday, Januari 22, 2018.
Expand Down
34 changes: 32 additions & 2 deletions Pod/Classes/VSLCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ typedef NS_ENUM(NSInteger, VSLMediaState) {
};
#define VSLMediaStateString(VSLMediaState) [@[@"VSLMediaStateNone", @"VSLMediaStateActive", @"VSLMediaStateLocalHold", @"VSLMediaStateRemoteHold", @"VSLMediaStateError"] objectAtIndex:VSLMediaState]

typedef NS_ENUM(NSInteger, VSLCallTransferState) {
typedef NS_ENUM(NSInteger, VSLCallTransferState) {
VSLCallTransferStateUnkown,
VSLCallTransferStateInitialized,
VSLCallTransferStateTrying,
Expand All @@ -154,6 +154,26 @@ typedef NS_ENUM(NSInteger, VSLCallTransferState) {
};
#define VSLCallTransferStateString(VSLCallTransferState) [@[@"VSLCallTransferStateUnkown", @"VSLCallTransferStateInitialized", @"VSLCallTransferStateTrying", @"VSLCallTransferStateAccepted", @"VSLCallTransferStateRejected"] objectAtIndex:VSLCallTransferState]

typedef NS_ENUM(NSInteger, VSLCallAudioState) {
/**
* There is audio for the call.
*/
VSLCallAudioStateOK,
/**
* There hasn't been any audio received during the call.
*/
VSLCallAudioStateNoAudioReceiving,
/**
* There wasn't any audio transmitted.
*/
VSLCallAudioStateNoAudioTransmitting,
/**
* There wasn't any audio in both directions.
*/
VSLCallAudioStateNoAudioBothDirections,
};
#define VSLCallAudioStateString(VSLCallAudioState) [@[@"VSLCallAudioStateOK", @"VSLCallAudioStateNoAudioReceiving", @"VSLCallAudioStateNoAudioTransmitting", @"VSLCallAudioStateNoAudioBothDirections"] objectAtIndex:VSLCallAudioState]

typedef NS_ENUM(NSInteger, VSLCallTerminateReason) {
VSLCallTerminateReasonUnknown,
/**
Expand All @@ -173,10 +193,15 @@ typedef NS_ENUM(NSInteger, VSLCallTerminateReason) {
#pragma mark - Properties

/**
* The callId which a incoming call receives from PJSIP when it is created.
* The callId which a call receives from PJSIP when it is created.
*/
@property (readonly, nonatomic) NSInteger callId;

/**
* The Call-ID that is present in the SIP messages.
*/
@property (readonly, nonatomic) NSString * _Nonnull messageCallId;

/**
* All created calls get an unique ID.
*/
Expand All @@ -192,6 +217,11 @@ typedef NS_ENUM(NSInteger, VSLCallTerminateReason) {
*/
@property (readonly, nonatomic) VSLCallState callState;

/**
* There state in which the audio is for the call.
*/
@property (readonly, nonatomic) VSLCallAudioState callAudioState;

/**
* The state text which the call currently has.
*/
Expand Down
35 changes: 25 additions & 10 deletions Pod/Classes/VSLCall.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ @interface VSLCall()
@property (readwrite, nonatomic) NSString *callerName;
@property (readwrite, nonatomic) NSString *callerNumber;
@property (readwrite, nonatomic) NSInteger callId;
@property (readwrite, nonatomic) NSString *messageCallId;
@property (readwrite, nonatomic) NSUUID *uuid;
@property (readwrite, nonatomic) BOOL incoming;
@property (strong, nonatomic) VSLRingback *ringback;
Expand All @@ -54,6 +55,9 @@ @interface VSLCall()
@property (nonatomic) BOOL reinviteCall;
@property (readwrite, nonatomic) NSTimer *audioCheckTimer;
@property (readwrite, nonatomic) int audioCheckTimerFired;
@property (readwrite, nonatomic) VSLCallAudioState callAudioState;
@property (readwrite, nonatomic) int previousRxPkt;
@property (readwrite, nonatomic) int previousTxPkt;
/**
* Stats
*/
Expand Down Expand Up @@ -377,6 +381,10 @@ - (void)updateCallInfo:(pjsua_call_info)callInfo {
self.lastStatus = callInfo.last_status;
self.lastStatusText = [NSString stringWithPJString:callInfo.last_status_text];

if (self.messageCallId == nil) {
self.messageCallId = [NSString stringWithPJString:callInfo.call_id];
}

if (self.callState != VSLCallStateDisconnected) {
self.localURI = [NSString stringWithPJString:callInfo.local_info];
self.remoteURI = [NSString stringWithPJString:callInfo.remote_info];
Expand Down Expand Up @@ -420,12 +428,6 @@ - (void)checkIfAudioPresent {
pjsua_call_info callInfo;
pjsua_call_get_info((pjsua_call_id)self.callId, &callInfo);

if (self.audioCheckTimerFired > 5) {
VSLLogInfo(@"There was audio in the last 10 seconds");
[self.audioCheckTimer invalidate];
self.audioCheckTimerFired = 0;
}

if (callInfo.media_status != PJSUA_CALL_MEDIA_ACTIVE) {
VSLLogDebug(@"Unable to check if audio present no active stream!");
self.audioCheckTimerFired++;
Expand All @@ -440,11 +442,24 @@ - (void)checkIfAudioPresent {
int rxPkt = stream_stat.rtcp.rx.pkt;
int txPkt = stream_stat.rtcp.tx.pkt;

if (rxPkt == 0 || txPkt == 0) {
VSLLogInfo(@"There is NO audio %f: sec into the call. Trying a reinvite", self.lastSeenConnectDuration);
[[NSNotificationCenter defaultCenter] postNotificationName:VSLCallNoAudioForCallNotification object:nil];
[self.audioCheckTimer invalidate];
if ((rxPkt == 0 && txPkt == 0) || (rxPkt == self.previousRxPkt && txPkt == self.previousTxPkt)) {
self.callAudioState = VSLCallAudioStateNoAudioBothDirections;
} else if (txPkt == 0 || txPkt == self.previousTxPkt) {
self.callAudioState = VSLCallAudioStateNoAudioTransmitting;
} else if (rxPkt == 0 || rxPkt == self.previousRxPkt) {
self.callAudioState = VSLCallAudioStateNoAudioReceiving;
} else {
self.callAudioState = VSLCallAudioStateOK;
}

self.previousRxPkt = rxPkt;
self.previousTxPkt = txPkt;

NSDictionary *notificationUserInfo = @{
VSLNotificationUserInfoCallKey : self,
VSLNotificationUserInfoCallAudioStateKey: [NSNumber numberWithInt:self.callAudioState]
};
[[NSNotificationCenter defaultCenter] postNotificationName:VSLCallNoAudioForCallNotification object:notificationUserInfo];
}

self.audioCheckTimerFired++;
Expand Down
4 changes: 2 additions & 2 deletions Pod/Classes/VSLEndpoint.m
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ static void onCallMediaEvent(pjsua_call_id call_id, unsigned med_idx, pjmedia_ev
static void onTxStateChange(pjsua_call_id call_id, pjsip_transaction *tx, pjsip_event *event) {
pjsua_call_info callInfo;
pjsua_call_get_info(call_id, &callInfo);

// When a call is in de early state it is possible to check if
// the call has been completed elsewhere or if the original caller
// has ended the call.
Expand Down Expand Up @@ -866,7 +866,7 @@ static void onIpChangeProgress(pjsua_ip_change_op op, pj_status_t status, const
+ (void)wasCallMissed:(pjsua_call_id)call_id pjsuaCallInfo:(pjsua_call_info)callInfo pjsipEvent:(pjsip_event*)event {
// Get the packet that belongs to RX transaction.
NSString *packet = [NSString stringWithFormat:@"%s", event->body.tsx_state.src.rdata->pkt_info.packet];

if (![packet isEqualToString: @""]) {
NSString *callCompletedElsewhere = @"Call completed elsewhere";
NSString *originatorCancel = @"ORIGINATOR_CANCEL";
Expand Down
7 changes: 6 additions & 1 deletion Pod/Classes/VialerSIPLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ extern NSString * __nonnull const VSLNotificationUserInfoWindowIdKey;
extern NSString * __nonnull const VSLNotificationUserInfoWindowSizeKey;

/**
* Key of be used for retrieving the currentCall state out of the NSSNotification user info dict.
* Key to be used for retrieving the currentCall state out of the NSSNotification user info dict.
*/
extern NSString * __nonnull const VSLNotificationUserInfoCallStateKey;

/**
* Key to be used for retrieving the current audio state for call out of the NSNotificaton user info dict.
*/
extern NSString * __nonnull const VSLNotificationUserInfoCallAudioStateKey;

/**
* Possible errors the VialerSIPLib can return.
*/
Expand Down
1 change: 1 addition & 0 deletions Pod/Classes/VialerSIPLib.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
NSString * const VSLNotificationUserInfoWindowIdKey = @"VSLNotificationUserInfoWindowIdKey";
NSString * const VSLNotificationUserInfoWindowSizeKey = @"VSLNotificationUserInfoWindowSizeKey";
NSString * const VSLNotificationUserInfoCallStateKey = @"VSLNotificationUserInfoCallStateKey";
NSString * const VSLNotificationUserInfoCallAudioStateKey = @"VSLNotificationUserInfoCallAudioStateKey";

@interface VialerSIPLib()
@property (strong, nonatomic) VSLEndpoint *endpoint;
Expand Down
2 changes: 1 addition & 1 deletion VialerSIPLib.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Pod::Spec.new do |s|
s.name = "VialerSIPLib"
s.version = "3.2.0"
s.version = "3.3.0"
s.summary = "Vialer SIP Library for iOS"
s.description = "Objective-C wrapper around PJSIP."
s.homepage = "https://github.com/VoIPGRID/VialerSIPLib"
Expand Down

0 comments on commit fda2a1d

Please sign in to comment.