To listen for incoming calls, an application must register the handler with RegisterForIncomingCall. When an incoming INVITE is received on an endpoint, the endpoint uses the factory to create the appropriate type of call and raise the event to the application. The application can call BeginAcceptto accept the call, or Declineto decline the call. If the incoming call contains MIME parts, the application must specify the accepted Content-ID values list on the call to BeginAccept.
Copy Code | |
---|---|
//Register the event handler to receive the incoming AudioVideoCall. m_endpoint.RegisterForIncomingCall<AudioVideoCall>(Endpoint_CallReceived); // Handler to receive and accept the incoming AudioVideoCall. private void Endpoint_CallReceived(object sender, CallReceivedEventArgs<AudioVideoCall> e) { m_incomingCall = e.Call; //process MIME parts if interested. Collection<MimePartContentDescription> callMimeParts = e.CustomMimeParts; … //Register call event handlers. m_incomingCall.StateChanged += CallStateChanged; … //Accept the call. //The following code specifies no custom headers or accepted content-ids when accepting the call. m_incomingCall.BeginAccept(null, IncomingCallEstablished, m_incomingCall); } //Call state changed handler. private void CallStateChanged(object o, CallStateChangedEventArgs eArg) { Console.WriteLine("Call state changed: {0} {1}", eArg.PreviousState, eArg.State); } |
An incoming invitation with any MIME part that specifies “handling=required” for a content type will be rejected if the application does not specify the associated content type as a type that is supported by the endpoint. If the parts are in a mime/alternate section, then the application must support at least one of the parts.