fix: only send call reject event when needed
This is fixes rejects by missed calls, which should only reject a new call locally and not send a event if they are already in a call
This commit is contained in:
		
							parent
							
								
									07b0c3fe4d
								
							
						
					
					
						commit
						ce0bdd9dc6
					
				|  | @ -133,6 +133,8 @@ newCall.answer(); | ||||||
| newCall.reject(); | newCall.reject(); | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
|  | To reject a call locally but not send a event, use `newCall.reject(shouldEmit: false)` | ||||||
|  | 
 | ||||||
| ### 5.Render media stream | ### 5.Render media stream | ||||||
| 
 | 
 | ||||||
| The basic process of rendering a video stream is as follow code. | The basic process of rendering a video stream is as follow code. | ||||||
|  |  | ||||||
|  | @ -1022,8 +1022,10 @@ class CallSession { | ||||||
|     } |     } | ||||||
|     Logs().d('[VOIP] Rejecting call: $callId'); |     Logs().d('[VOIP] Rejecting call: $callId'); | ||||||
|     await terminate(CallParty.kLocal, CallErrorCode.UserHangup, shouldEmit); |     await terminate(CallParty.kLocal, CallErrorCode.UserHangup, shouldEmit); | ||||||
|     await sendCallReject( |     if (shouldEmit) { | ||||||
|         room, callId, Timeouts.lifetimeMs, localPartyId, reason); |       await sendCallReject( | ||||||
|  |           room, callId, Timeouts.lifetimeMs, localPartyId, reason); | ||||||
|  |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   Future<void> hangup([String? reason, bool suppressEvent = false]) async { |   Future<void> hangup([String? reason, bool suppressEvent = false]) async { | ||||||
|  |  | ||||||
|  | @ -224,8 +224,8 @@ class VoIP { | ||||||
|     if (!delegate.canHandleNewCall && |     if (!delegate.canHandleNewCall && | ||||||
|         (confId == null || confId != currentGroupCID)) { |         (confId == null || confId != currentGroupCID)) { | ||||||
|       Logs().v( |       Logs().v( | ||||||
|           '[glare] [VOIP] onCallInvite: Unable to handle new calls, maybe user is busy.'); |           '[VOIP] onCallInvite: Unable to handle new calls, maybe user is busy.'); | ||||||
|       await newCall.reject(reason: 'busy', shouldEmit: false); |       await newCall.reject(reason: CallErrorCode.UserBusy, shouldEmit: false); | ||||||
|       delegate.handleMissedCall(newCall); |       delegate.handleMissedCall(newCall); | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue