Add sent voip events to debugger
This commit is contained in:
		
					parent
					
						
							
								4efcc53628
							
						
					
				
			
			
				commit
				
					
						f6c5484d1b
					
				
			
		
					 1 changed files with 21 additions and 0 deletions
				
			
		| 
						 | 
					@ -26,6 +26,7 @@ function getHangupCallState(call) {
 | 
				
			||||||
export function GroupCallInspector({ client, groupCall, show }) {
 | 
					export function GroupCallInspector({ client, groupCall, show }) {
 | 
				
			||||||
  const [roomStateEvents, setRoomStateEvents] = useState([]);
 | 
					  const [roomStateEvents, setRoomStateEvents] = useState([]);
 | 
				
			||||||
  const [toDeviceEvents, setToDeviceEvents] = useState([]);
 | 
					  const [toDeviceEvents, setToDeviceEvents] = useState([]);
 | 
				
			||||||
 | 
					  const [sentVoipEvents, setSentVoipEvents] = useState([]);
 | 
				
			||||||
  const [state, setState] = useState({
 | 
					  const [state, setState] = useState({
 | 
				
			||||||
    userId: client.getUserId(),
 | 
					    userId: client.getUserId(),
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
| 
						 | 
					@ -111,8 +112,13 @@ export function GroupCallInspector({ client, groupCall, show }) {
 | 
				
			||||||
      ]);
 | 
					      ]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function onSendVoipEvent(event) {
 | 
				
			||||||
 | 
					      setSentVoipEvents((prev) => [...prev, event]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    client.on("RoomState.events", onUpdateRoomState);
 | 
					    client.on("RoomState.events", onUpdateRoomState);
 | 
				
			||||||
    groupCall.on("calls_changed", onCallsChanged);
 | 
					    groupCall.on("calls_changed", onCallsChanged);
 | 
				
			||||||
 | 
					    groupCall.on("send_voip_event", onSendVoipEvent);
 | 
				
			||||||
    client.on("state", onCallsChanged);
 | 
					    client.on("state", onCallsChanged);
 | 
				
			||||||
    client.on("hangup", onCallHangup);
 | 
					    client.on("hangup", onCallHangup);
 | 
				
			||||||
    client.on("toDeviceEvent", onToDeviceEvent);
 | 
					    client.on("toDeviceEvent", onToDeviceEvent);
 | 
				
			||||||
| 
						 | 
					@ -133,6 +139,19 @@ export function GroupCallInspector({ client, groupCall, show }) {
 | 
				
			||||||
    return result;
 | 
					    return result;
 | 
				
			||||||
  }, [toDeviceEvents]);
 | 
					  }, [toDeviceEvents]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const sentVoipEventsByCall = useMemo(() => {
 | 
				
			||||||
 | 
					    const result = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (const event of sentVoipEvents) {
 | 
				
			||||||
 | 
					      const callId = event.content.call_id;
 | 
				
			||||||
 | 
					      const key = `${callId} (${event.userId})`;
 | 
				
			||||||
 | 
					      result[key] = result[key] || [];
 | 
				
			||||||
 | 
					      result[key].push(event);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return result;
 | 
				
			||||||
 | 
					  }, [sentVoipEvents]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  useEffect(() => {
 | 
					  useEffect(() => {
 | 
				
			||||||
    let timeout;
 | 
					    let timeout;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -190,6 +209,8 @@ export function GroupCallInspector({ client, groupCall, show }) {
 | 
				
			||||||
          roomStateEvents,
 | 
					          roomStateEvents,
 | 
				
			||||||
          toDeviceEvents,
 | 
					          toDeviceEvents,
 | 
				
			||||||
          toDeviceEventsByCall,
 | 
					          toDeviceEventsByCall,
 | 
				
			||||||
 | 
					          sentVoipEvents,
 | 
				
			||||||
 | 
					          sentVoipEventsByCall,
 | 
				
			||||||
        }}
 | 
					        }}
 | 
				
			||||||
        name={null}
 | 
					        name={null}
 | 
				
			||||||
        indentWidth={2}
 | 
					        indentWidth={2}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue