After remote user closed his Lync chat window, the state of conversation is Terminated. how can i re-establish them?
what is wrong with my doing?( it throws "The operation is invalid in the current object state (Terminated)")
void conversation_StateChanged(object sender, StateChangedEventArgs<ConversationState> e)
{
if (e.State == ConversationState.Terminated)
{
_terminated = true;
}
if (e.State == ConversationState.Established)
{
_terminated = false;
}
}
if (_terminated)
{
imCall.BeginEstablish(null, null, (ar) =>
{
flow = imCall.Flow;
_callEstablishComplete.Set();
}, null);
_callEstablishComplete.WaitOne();
}
through dozens times of trials, i found it is very easy to solve. what i should do is to create a new IM call object:
conversation = new Conversation(endPoint, settings);
imCall = new InstantMessagingCall(conversation);
imCall.BeginEstablish("sip:xxx@abc.com", null, (ar) =>
{
imCall.EndEstablish(ar);
flow = imCall.Flow;
_callEstablishComplete.Set();
}, null);
that is enough!