/// <summary> /// Begin outgoing call /// </summary> /// <param name="conference"></param> /// <param name="to"></param> /// <param name="callback"></param> public void Call(FM.IceLink.Conference conference, string to, Action <string> callback) { To = to; Messaging.Log.Info(">Call " + to); Conference = conference; // when IceLink generates an Offer or a Candidate, raise event Conference.OnLinkOfferAnswer += SendSessionInitiate; Conference.OnLinkCandidate += SendCandidate; Conference.OnUnhandledException += Conference_OnUnhandledException; // Icelink generate candidates Conference.Link(to); }
public void Attach(FM.IceLink.Conference conference, string sessionId, Action <string> callback) { Conference = conference; SessionId = sessionId; if (UseWebSyncExtension) { // Manage the conference automatically using a WebSync // channel. P2P links will be created automatically to // peers that join the same channel. WebSyncClient.JoinConference(new JoinConferenceArgs("/" + SessionId, conference) { OnFailure = (e) => { callback(string.Format("Could not join conference {0}. {1}", e.ConferenceChannel, e.Exception.Message)); }, OnSuccess = (e) => { callback(null); } }); } else { // When the conference generates an offer/answer or candidate, // we want to send it to the remote peer immediately. Conference.OnLinkOfferAnswer += SendOfferAnswer; Conference.OnLinkCandidate += SendCandidate; // When we receive an offer/answer or candidate, we want to // inform the conference immediately. WebSyncClient.OnNotify += ReceiveOfferAnswerOrCandidate; // Subscribe to a WebSync channel. When another client joins the same // channel, create a P2P link. When a client leaves, destroy it. WebSyncClient.Subscribe(new SubscribeArgs("/" + SessionId) { OnFailure = (e) => { callback(string.Format("Could not attach signalling to conference {0}. {1}", SessionId, e.Exception.Message)); }, OnReceive = (e) => { }, OnSuccess = (e) => { callback(null); } } .SetOnClientSubscribe((e) => { // Kick off a P2P link. var peerId = e.SubscribedClient.ClientId.ToString(); var peerState = e.SubscribedClient.BoundRecords; Conference.Link(peerId, peerState); }) .SetOnClientUnsubscribe((e) => { // Tear down a P2P link. var peerId = e.UnsubscribedClient.ClientId.ToString(); Conference.Unlink(peerId); })); } }
/// <summary> /// Link this instance to conference. /// </summary> public bool Link(string peerId) { this.receiversId.Add(peerId); return(conference.Link(peerId)); }
public void Attach(FM.IceLink.Conference conference, string sessionId, Action<string> callback) { Conference = conference; SessionId = sessionId; // IceLink includes a WebSync client extension that will // automatically manage session negotiation for you. If // you are not using WebSync, see the 'else' block for a // session negotiation template. if (UseWebSyncExtension) { // Manage the conference automatically using a WebSync // channel. P2P links will be created automatically to // peers that join the same channel. WebSyncClient.JoinConference(new JoinConferenceArgs("/" + SessionId, conference) { OnFailure = (e) => { callback(string.Format("Could not attach signalling to conference {0}. {1}", SessionId, e.Exception.Message)); }, OnSuccess = (e) => { callback(null); } }); } else { // When the conference generates an offer/answer or candidate, // we want to send it to the remote peer immediately. Conference.OnLinkOfferAnswer += SendOfferAnswer; Conference.OnLinkCandidate += SendCandidate; // When we receive an offer/answer or candidate, we want to // inform the conference immediately. WebSyncClient.OnNotify += ReceiveOfferAnswerOrCandidate; // Subscribe to a WebSync channel. When another client joins the same // channel, create a P2P link. When a client leaves, destroy it. WebSyncClient.Subscribe(new SubscribeArgs("/" + SessionId) { OnFailure = (e) => { callback(string.Format("Could not attach signalling to conference {0}. {1}", SessionId, e.Exception.Message)); }, OnReceive = (e) => { }, OnSuccess = (e) => { callback(null); } } .SetOnClientSubscribe((e) => { // Kick off a P2P link. var peerId = e.SubscribedClient.ClientId.ToString(); var peerState = e.SubscribedClient.BoundRecords; Conference.Link(peerId, peerState); }) .SetOnClientUnsubscribe((e) => { // Tear down a P2P link. var peerId = e.UnsubscribedClient.ClientId.ToString(); Conference.Unlink(peerId); })); } }