private void btn1Call1_Click(object sender, EventArgs e) { if (pbxCall1 != null) { if (pbxCall1.CallStatus == Call.Status.PUT_ON_HOLD) { // Unhold call rainbowTelephony.RetrieveCall(pbxCall1.Id, callback => { if (!callback.Result.Success) { String output = String.Format("Impossible to Unhold call [{0}] - Error:[{1}]", pbxCall1.Id, Util.SerializeSdkError(callback.Result)); AddStateLine(output); log.LogError(output); } }); } else if (pbxCall1.CallStatus == Call.Status.ACTIVE) { // Hold call rainbowTelephony.HoldCall(pbxCall1.Id, callback => { if (!callback.Result.Success) { String output = String.Format("Impossible to hold call [{0}] - Error:[{1}]", pbxCall1.Id, Util.SerializeSdkError(callback.Result)); AddStateLine(output); log.LogError(output); } }); } else if (pbxCall1.CallStatus == Call.Status.RINGING_INCOMING) { // Answer call rainbowTelephony.AnswerCall(pbxCall1.Id, callback => { if (!callback.Result.Success) { String output = String.Format("Impossible to answer call [{0}] - Error:[{1}]", pbxCall1.Id, Util.SerializeSdkError(callback.Result)); AddStateLine(output); log.LogError(output); } }); } } }