@ -497,14 +497,26 @@ protocol CallServiceObserver: class {
handleLocalBusyCall ( newCall , thread : thread )
handleLocalBusyCall ( newCall , thread : thread )
if self . call ? . remotePhoneNumber = = newCall . remotePhoneNumber {
if self . call ! . remotePhoneNumber = = newCall . remotePhoneNumber {
// I f w e ' r e r e c e i v i n g a n e w c a l l o f f e r f r o m t h e u s e r w e t h i n k w e h a v e a c a l l w i t h , t e r m i n a t e
Logger . info ( " \( TAG ) handling call from current call user as remote busy.: \( newCall . identifiersForLogs ) but we're already in call: \( call ! . identifiersForLogs ) " )
// o u r c u r r e n t c a l l t o g e t b a c k t o a k n o w n g o o d s t a t e . I f t h e y c a l l b a c k , w e ' l l b e r e a d y .
// I f w e ' r e r e c e i v i n g a n e w c a l l o f f e r f r o m t h e u s e r w e a l r e a d y t h i n k w e h a v e a c a l l w i t h ,
// t e r m i n a t e o u r c u r r e n t c a l l t o g e t b a c k t o a k n o w n g o o d s t a t e . I f t h e y c a l l b a c k , w e ' l l
// b e r e a d y .
//
//
// TODO: A u t o - a c c e p t t h i s i n c o m i n g c a l l i f o u r c u r r e n t c a l l w a s e i t h e r a ) o u t g o i n g o r
// TODO: A u t o - a c c e p t t h i s i n c o m i n g c a l l i f o u r c u r r e n t c a l l w a s e i t h e r a ) o u t g o i n g o r
// b ) e v e r c o n n e c t e d . T h e r e w i l l b e a b i t o f c o m p l e x i t y a r o u n d m a k i n g s u r e t h a t t w o
// b ) n ev e r c o n n e c t e d . T h e r e w i l l b e a b i t o f c o m p l e x i t y a r o u n d m a k i n g s u r e t h a t t w o
// p a r t i e s t h a t c a l l e a c h o t h e r a t t h e s a m e t i m e e n d u p c o n n e c t e d .
// p a r t i e s t h a t c a l l e a c h o t h e r a t t h e s a m e t i m e e n d u p c o n n e c t e d .
terminateCall ( )
switch self . call ! . state {
case . idle , . dialing , . remoteRinging :
// I f b o t h u s e r s a r e t r y i n g t o c a l l e a c h o t h e r a t t h e s a m e t i m e ,
// b o t h s h o u l d s e e b u s y .
handleRemoteBusy ( thread : self . call ! . thread )
case . answering , . localRinging , . connected , . localFailure , . localHangup , . remoteHangup , . remoteBusy :
// I f o n e u s e r c a l l s a n o t h e r w h i l e t h e o t h e r h a s a " v e s t i g i a l " c a l l w i t h
// t h a t s a m e u s e r , f a i l t h e o l d c a l l .
terminateCall ( )
}
}
}
return
return