Skip to content

Instantly share code, notes, and snippets.

@daothanh
Created July 6, 2016 08:27
Show Gist options
  • Save daothanh/e97a0b3025f4d313a71baa95ff47d2c6 to your computer and use it in GitHub Desktop.
Save daothanh/e97a0b3025f4d313a71baa95ff47d2c6 to your computer and use it in GitHub Desktop.
Cach gui signal cuoc goi
//Gui signal begin call
session.signal({
type: "begincall",
to: _stream.connection,
data: {
streamId: _selfstream.streamId + "|" + _selfstream.name
}
}, function(error) {
if (error) {
console.log("signal error: " + error.reason);
} else {
console.log("signal sent: begincall:");
}
});
// GUi signal accept call
session.signal({
type: "acceptcall",
to: _streams[_streamId].connection,
data: {
callaccepted: _selfstream.streamId + "|" + _selfstream.name + "|yes"
}
},
function(error) {
if (error) {
console.log("signal error: " + error.reason);
} else {
console.log("signal sent");
}
}
);
//GUi signal khi reject call
session.signal({
type: "acceptcall",
to: _streams[_streamId].connection,
data: {
callaccepted: _selfstream.streamId + "|" + _selfstream.name + "|no"
}
},
function(error) {
if (error) {
console.log("signal error: " + error.reason);
} else {
console.log("signal sent");
}
}
);
//Gui signal khi end call
session.signal({
type: "endcall",
to: _stream.connection,
data: {
streamId: _selfstream.streamId + "|" + _selfstream.name
}
}, function(error) {
if (error) {
console.log("signal error: " + error.reason);
} else {
console.log("signal sent");
disconnect();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment