@ -362,7 +362,7 @@ private class SignalCallData: NSObject {
AssertIsOnMainThread ( )
AssertIsOnMainThread ( )
guard self . call = = nil else {
guard self . call = = nil else {
let errorDescription = " \( self . logTag ) call was unexpectedly already set."
let errorDescription = " call was unexpectedly already set."
Logger . error ( errorDescription )
Logger . error ( errorDescription )
call . state = . localFailure
call . state = . localFailure
OWSProdError ( OWSAnalyticsEvents . callServiceCallAlreadySet ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServiceCallAlreadySet ( ) , file : #file , function : #function , line : #line )
@ -384,7 +384,7 @@ private class SignalCallData: NSObject {
}
}
guard callData . peerConnectionClient = = nil else {
guard callData . peerConnectionClient = = nil else {
let errorDescription = " \( self . logTag ) peerconnection was unexpectedly already set."
let errorDescription = " peerconnection was unexpectedly already set."
Logger . error ( errorDescription )
Logger . error ( errorDescription )
OWSProdError ( OWSAnalyticsEvents . callServicePeerConnectionAlreadySet ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServicePeerConnectionAlreadySet ( ) , file : #file , function : #function , line : #line )
throw CallError . assertionError ( description : errorDescription )
throw CallError . assertionError ( description : errorDescription )
@ -440,8 +440,8 @@ private class SignalCallData: NSObject {
return race ( timeout , callData . callConnectedPromise )
return race ( timeout , callData . callConnectedPromise )
} . then {
} . then {
Logger . info ( self . call = = call
Logger . info ( self . call = = call
? " \( self . logTag ) outgoing call connected: \( call . identifiersForLogs ) . "
? " outgoing call connected: \( call . identifiersForLogs ) . "
: " \( self . logTag ) obsolete outgoing call connected: \( call . identifiersForLogs ) . " )
: " obsolete outgoing call connected: \( call . identifiersForLogs ) . " )
} . catch { error in
} . catch { error in
Logger . error ( " placing call \( call . identifiersForLogs ) failed with error: \( error ) " )
Logger . error ( " placing call \( call . identifiersForLogs ) failed with error: \( error ) " )
@ -746,8 +746,8 @@ private class SignalCallData: NSObject {
return race ( callData . callConnectedPromise , timeout )
return race ( callData . callConnectedPromise , timeout )
} . then {
} . then {
Logger . info ( self . call = = newCall
Logger . info ( self . call = = newCall
? " \( self . logTag ) incoming call connected: \( newCall . identifiersForLogs ) . "
? " incoming call connected: \( newCall . identifiersForLogs ) . "
: " \( self . logTag ) obsolete incoming call connected: \( newCall . identifiersForLogs ) . " )
: " obsolete incoming call connected: \( newCall . identifiersForLogs ) . " )
} . catch { error in
} . catch { error in
guard self . call = = newCall else {
guard self . call = = newCall else {
Logger . debug ( " ignoring error: \( error ) for obsolete call: \( newCall . identifiersForLogs ) . " )
Logger . debug ( " ignoring error: \( error ) for obsolete call: \( newCall . identifiersForLogs ) . " )
@ -891,7 +891,7 @@ private class SignalCallData: NSObject {
// T h i s w i l l o n l y b e c a l l e d f o r t h e c u r r e n t p e e r C o n n e c t i o n C l i e n t , s o
// T h i s w i l l o n l y b e c a l l e d f o r t h e c u r r e n t p e e r C o n n e c t i o n C l i e n t , s o
// f a i l t h e c u r r e n t c a l l .
// f a i l t h e c u r r e n t c a l l .
OWSProdError ( OWSAnalyticsEvents . callServiceCallMissing ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServiceCallMissing ( ) , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( self . logTag ) ignoring \( #function ) since there is no current call. " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " ignoring \( #function ) since there is no current call. " ) )
return
return
}
}
@ -921,7 +921,7 @@ private class SignalCallData: NSObject {
// T h i s w i l l o n l y b e c a l l e d f o r t h e c u r r e n t p e e r C o n n e c t i o n C l i e n t , s o
// T h i s w i l l o n l y b e c a l l e d f o r t h e c u r r e n t p e e r C o n n e c t i o n C l i e n t , s o
// f a i l t h e c u r r e n t c a l l .
// f a i l t h e c u r r e n t c a l l .
OWSProdError ( OWSAnalyticsEvents . callServiceCallMissing ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServiceCallMissing ( ) , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( self . logTag ) ignoring \( #function ) since there is no current call. " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " ignoring \( #function ) since there is no current call. " ) )
return
return
}
}
@ -946,7 +946,7 @@ private class SignalCallData: NSObject {
guard let call = self . call else {
guard let call = self . call else {
// T h i s m a y h a p p e n i f w e h a n g u p s l i g h t l y b e f o r e t h e y h a n g u p .
// T h i s m a y h a p p e n i f w e h a n g u p s l i g h t l y b e f o r e t h e y h a n g u p .
handleFailedCurrentCall ( error : . obsoleteCall ( description : " \( self . logTag ) call was unexpectedly nil" ) )
handleFailedCurrentCall ( error : . obsoleteCall ( description : " call was unexpectedly nil" ) )
return
return
}
}
@ -991,7 +991,7 @@ private class SignalCallData: NSObject {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFailDebug ( " call was unexpectedly nil " )
owsFailDebug ( " call was unexpectedly nil " )
OWSProdError ( OWSAnalyticsEvents . callServiceCallMissing ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServiceCallMissing ( ) , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( self . logTag ) call was unexpectedly nil" ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " call was unexpectedly nil" ) )
return
return
}
}
@ -999,7 +999,7 @@ private class SignalCallData: NSObject {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFailDebug ( " callLocalId: \( localId ) doesn't match current calls: \( call . localId ) " )
owsFailDebug ( " callLocalId: \( localId ) doesn't match current calls: \( call . localId ) " )
OWSProdError ( OWSAnalyticsEvents . callServiceCallIdMismatch ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServiceCallIdMismatch ( ) , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( self . logTag ) callLocalId:\( localId ) doesn't match current calls: \( call . localId ) " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " callLocalId:\( localId ) doesn't match current calls: \( call . localId ) " ) )
return
return
}
}
@ -1016,7 +1016,7 @@ private class SignalCallData: NSObject {
guard let currentCallData = self . callData else {
guard let currentCallData = self . callData else {
OWSProdError ( OWSAnalyticsEvents . callServiceCallDataMissing ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServiceCallDataMissing ( ) , file : #file , function : #function , line : #line )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " \( self . logTag ) callData unexpectedly nil" ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " callData unexpectedly nil" ) )
return
return
}
}
@ -1029,7 +1029,7 @@ private class SignalCallData: NSObject {
guard let peerConnectionClient = self . peerConnectionClient else {
guard let peerConnectionClient = self . peerConnectionClient else {
OWSProdError ( OWSAnalyticsEvents . callServicePeerConnectionMissing ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServicePeerConnectionMissing ( ) , file : #file , function : #function , line : #line )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " \( self . logTag ) missing peerconnection client" ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " missing peerconnection client" ) )
return
return
}
}
@ -1046,7 +1046,7 @@ private class SignalCallData: NSObject {
dataBuilder . setConnected ( try connectedBuilder . build ( ) )
dataBuilder . setConnected ( try connectedBuilder . build ( ) )
messageData = try dataBuilder . buildSerializedData ( )
messageData = try dataBuilder . buildSerializedData ( )
} catch {
} catch {
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " \( self . logTag ) couldn't build proto" ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " couldn't build proto" ) )
return
return
}
}
@ -1065,7 +1065,7 @@ private class SignalCallData: NSObject {
guard let peerConnectionClient = callData . peerConnectionClient else {
guard let peerConnectionClient = callData . peerConnectionClient else {
OWSProdError ( OWSAnalyticsEvents . callServicePeerConnectionMissing ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServicePeerConnectionMissing ( ) , file : #file , function : #function , line : #line )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " \( self . logTag ) peerConnectionClient unexpectedly nil" ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " peerConnectionClient unexpectedly nil" ) )
return
return
}
}
@ -1095,7 +1095,7 @@ private class SignalCallData: NSObject {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFailDebug ( " call was unexpectedly nil " )
owsFailDebug ( " call was unexpectedly nil " )
OWSProdError ( OWSAnalyticsEvents . callServiceCallMissing ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServiceCallMissing ( ) , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( self . logTag ) call was unexpectedly nil" ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " call was unexpectedly nil" ) )
return
return
}
}
@ -1103,7 +1103,7 @@ private class SignalCallData: NSObject {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFailDebug ( " callLocalId: \( localId ) doesn't match current calls: \( call . localId ) " )
owsFailDebug ( " callLocalId: \( localId ) doesn't match current calls: \( call . localId ) " )
OWSProdError ( OWSAnalyticsEvents . callServiceCallIdMismatch ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServiceCallIdMismatch ( ) , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( self . logTag ) callLocalId:\( localId ) doesn't match current calls: \( call . localId ) " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " callLocalId:\( localId ) doesn't match current calls: \( call . localId ) " ) )
return
return
}
}
@ -1151,7 +1151,7 @@ private class SignalCallData: NSObject {
guard call = = currentCall else {
guard call = = currentCall else {
OWSProdError ( OWSAnalyticsEvents . callServiceCallMismatch ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServiceCallMismatch ( ) , file : #file , function : #function , line : #line )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " \( self . logTag ) ignoring \( #function ) for call other than current call " ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " ignoring \( #function ) for call other than current call " ) )
return
return
}
}
@ -1184,7 +1184,7 @@ private class SignalCallData: NSObject {
dataBuilder . setHangup ( try hangupBuilder . build ( ) )
dataBuilder . setHangup ( try hangupBuilder . build ( ) )
messageData = try dataBuilder . buildSerializedData ( )
messageData = try dataBuilder . buildSerializedData ( )
} catch {
} catch {
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " \( self . logTag ) couldn't build proto" ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " couldn't build proto" ) )
return
return
}
}
@ -1207,7 +1207,7 @@ private class SignalCallData: NSObject {
terminateCall ( )
terminateCall ( )
} catch {
} catch {
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " \( self . logTag ) couldn't build proto" ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " couldn't build proto" ) )
}
}
}
}
@ -1363,7 +1363,7 @@ private class SignalCallData: NSObject {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFailDebug ( " received data message, but there is no current call. Ignoring. " )
owsFailDebug ( " received data message, but there is no current call. Ignoring. " )
OWSProdError ( OWSAnalyticsEvents . callServiceCallMissing ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServiceCallMissing ( ) , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( self . logTag ) received data message, but there is no current call. Ignoring." ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " received data message, but there is no current call. Ignoring." ) )
return
return
}
}
let call = callData . call
let call = callData . call
@ -1375,7 +1375,7 @@ private class SignalCallData: NSObject {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFailDebug ( " received connected message for call with id: \( connected . id ) but current call has id: \( call . signalingId ) " )
owsFailDebug ( " received connected message for call with id: \( connected . id ) but current call has id: \( call . signalingId ) " )
OWSProdError ( OWSAnalyticsEvents . callServiceCallIdMismatch ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServiceCallIdMismatch ( ) , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( self . logTag ) received connected message for call with id:\( connected . id ) but current call has id: \( call . signalingId ) " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " received connected message for call with id:\( connected . id ) but current call has id: \( call . signalingId ) " ) )
return
return
}
}
@ -1389,7 +1389,7 @@ private class SignalCallData: NSObject {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFailDebug ( " received hangup message for call with id: \( hangup . id ) but current call has id: \( call . signalingId ) " )
owsFailDebug ( " received hangup message for call with id: \( hangup . id ) but current call has id: \( call . signalingId ) " )
OWSProdError ( OWSAnalyticsEvents . callServiceCallIdMismatch ( ) , file : #file , function : #function , line : #line )
OWSProdError ( OWSAnalyticsEvents . callServiceCallIdMismatch ( ) , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( self . logTag ) received hangup message for call with id:\( hangup . id ) but current call has id: \( call . signalingId ) " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " received hangup message for call with id:\( hangup . id ) but current call has id: \( call . signalingId ) " ) )
return
return
}
}