Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
When an application establishes an outgoing call, it can specify custom signaling headers to be sent out with the outgoing INVITE, and optionally, custom MIME parts to be included in any offer.
The following code demonstrates creating a new audio/video conversation, implementing and registering a call event handler, and establishing the call. The code for an instant message call is similar.
Note
Applications must register for call events before the call is established.
string destUri = “sip:alice@contoso.com”;
Conversation conv = new Conversation(m_localEndpoint);
m_outgoingCall = new AudioVideoCall(conv);
…
//Create a delegate.
AsyncCallback callback = new AsyncCallback(OutgoingCallEstablished);
//Register a call event handler.
m_outgoingCall.StateChanged += CallStateChanged;
//Establish the call.
//The following code assumes that no custom headers or mime parts are being sent with the INVITE.
m_outgoingCall.BeginEstablish(destUri, OutgoingCallEstablished, m_outgoingCall);
//Handler for Call state change.
private void CallStateChanged(object o, CallStateChangedEventArgs eArg)
{
Console.WriteLine("Call state changed: {0} {1}", eArg.PreviousState, eArg.State);
}
…
//Define an AsyncCallback method named OutgoingCallEstablished.
static void OutgoingCallEstablished(IAsyncResult ar)
{
try
{ // Do something.
m_outgoingCall.EndEstablish(ar);
}
catch
{
// Report or handle error.
…
}
}