/// <summary>
/// An outgoing call was successfully answered.
/// </summary>
/// <param name="uac">The local SIP user agent client that initiated the call.</param>
/// <param name="sipResponse">The SIP answer response received from the remote party.</param>
private void CallAnswered(ISIPClientUserAgent uac, SIPResponse sipResponse)
{
StatusMessage("Call answered: " + sipResponse.StatusCode + " " + sipResponse.ReasonPhrase + ".");
if (sipResponse.StatusCode >= 200 && sipResponse.StatusCode <= 299)
{
if (sipResponse.Header.ContentType != _sdpMimeContentType)
{
// Payload not SDP, I don't understand :(.
StatusMessage("Call was hungup as the answer response content type was not recognised: " + sipResponse.Header.ContentType + ". :(");
Hangup();
}
else if (sipResponse.Body.IsNullOrBlank())
{
// They said SDP but didn't give me any :(.
StatusMessage("Call was hungup as the answer response had an empty SDP payload. :(");
Hangup();
}
SDP sdpAnswer = SDP.ParseSDPDescription(sipResponse.Body);
System.Diagnostics.Debug.WriteLine(sipResponse.Body);
_mediaManager.SetRemoteSDP(sdpAnswer);
CallAnswer();
}
else
{
CallFinished();
}
}