FSClient.Call.HandleChannelAnswerEvent C# (CSharp) Méthode

HandleChannelAnswerEvent() private static méthode

private static HandleChannelAnswerEvent ( FSEvent evt, String uuid ) : void
evt FSEvent
uuid String
Résultat void
        private static void HandleChannelAnswerEvent(FSEvent evt, String uuid)
        {
            Call call = (from c in calls where c.leg_b_uuid == uuid && c.call_ended == false select c).SingleOrDefault();
            if (call == null){
                String orig_dest = evt.get_header("Other-Leg-Destination-Number");
                if (orig_dest != "auto_answer")
                    return;
                call = new Call();
                call.SetCallInfoFromEvent(evt);
                String gw_id = (from c in channels where c.Key == call.leg_b_uuid select c.Value.gateway_id).SingleOrDefault();
                call.account = (from a in Account.accounts where a.gateway_id == gw_id select a).SingleOrDefault();
                calls.Add(call);
                call.UpdateCallState(CALL_STATE.Ringing, call);
            }
            if (call.state == CALL_STATE.Answered)
                return;

            if (call.state == CALL_STATE.Ringing || (call.state == CALL_STATE.Hold_Ringing && !call.is_outgoing))
                call.UpdateCallState(CALL_STATE.Answered, (call.is_outgoing || call.is_conference_call) ? active_call : call);
            else if (call.state == CALL_STATE.Hold_Ringing)
                call.UpdateCallState(CALL_STATE.Hold, active_call);
            else
                throw new Exception("Unknown state, call answered but was not in a state of hold_ring or ringing");
        }