mirror of
https://github.com/balzack/databag.git
synced 2025-04-22 09:35:16 +00:00
fixing create permission handling
This commit is contained in:
parent
e2b33bccfe
commit
7299d63711
@ -241,6 +241,7 @@ export function useRingContext() {
|
||||
// connect signal socket
|
||||
connected.current = false;
|
||||
candidates.current = [];
|
||||
pc.current = null;
|
||||
updateState({ remoteVideo: false, remoteAudio: false, remoteStream: null, localVideo: false, localAudio: false, localStream: null });
|
||||
|
||||
videoTrack.current = false;
|
||||
@ -288,7 +289,9 @@ export function useRingContext() {
|
||||
}
|
||||
ws.current.onclose = (e) => {
|
||||
// update state to disconnected
|
||||
pc.current.close();
|
||||
if (pc.current) {
|
||||
pc.current.close();
|
||||
}
|
||||
clearRing();
|
||||
clearAlive();
|
||||
calling.current = null;
|
||||
|
@ -120,11 +120,31 @@ func (s *Sturn) handleMessage(buf []byte, addr net.Addr) {
|
||||
}
|
||||
|
||||
func (s *Sturn) handleCreatePermissionRequest(msg *SturnMessage, addr net.Addr) {
|
||||
fmt.Println(addr.String(), msg);
|
||||
fmt.Println(addr.String(), msg);
|
||||
|
||||
var attributes []SturnAttribute
|
||||
attributes = append(attributes, SturnAttribute{
|
||||
atrType: ATRMessageIntegrity,
|
||||
});
|
||||
|
||||
response := &SturnMessage{
|
||||
class: CLSResponse,
|
||||
method: MEHCreatePermission,
|
||||
transaction: msg.transaction,
|
||||
attributes: attributes,
|
||||
};
|
||||
err, n := writeMessage(response, s.buf);
|
||||
if err != nil {
|
||||
fmt.Printf("failed to write stun response");
|
||||
} else {
|
||||
(*s.conn).WriteTo(s.buf[:n], addr);
|
||||
fmt.Println("PERM>", s.buf[:n]);
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Sturn) handleSendIndication(msg *SturnMessage, addr net.Addr) {
|
||||
fmt.Println(addr.String(), msg);
|
||||
//fmt.Println(addr.String(), msg);
|
||||
}
|
||||
|
||||
func (s *Sturn) handleBindingRequest(msg *SturnMessage, addr net.Addr) {
|
||||
@ -222,7 +242,8 @@ func (s *Sturn) handleAllocateRequest(msg *SturnMessage, addr net.Addr) {
|
||||
atrType: ATRXorRelayedAddress,
|
||||
byteValue: FAMIPv4,
|
||||
intValue: int32(relayPort),
|
||||
strValue: "98.234.232.221",
|
||||
strValue: "192.168.13.233",
|
||||
//strValue: "98.234.232.221",
|
||||
});
|
||||
attributes = append(attributes, SturnAttribute{
|
||||
atrType: ATRLifetime,
|
||||
|
@ -138,6 +138,12 @@ func setMessageType(class int, method int) (byte, byte) {
|
||||
if class == CLSError && method == MEHAllocate {
|
||||
return 0x01, 0x13
|
||||
}
|
||||
if class == CLSResponse && method == MEHCreatePermission {
|
||||
return 0x01, 0x08
|
||||
}
|
||||
if class == CLSError && method == MEHCreatePermission {
|
||||
return 0x01, 0x18
|
||||
}
|
||||
return 0x00, 0x00
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user