Example #1
0
        /// <summary>
        /// Add call to call handlers.
        /// </summary>
        /// <param name="call">The call to be added.</param>
        /// <param name="callType">The type of call.</param>
        private void AddCallToHandlers(ICall call, string callType)
        {
            CallHandler callHandler;
            InvitationParticipantInfo callee;

            switch (callType)
            {
            case "BotMeeting":
                // Call to meeting.
                callHandler = new MeetingCallHandler(this, call, "classID");
                break;

            case "ResponderNotification":
                // call to an user.
                callee      = call.Resource.Targets.First();
                callHandler = new ResponderCallHandler(this, call, callee.Identity.User.Id, "classID");
                break;

            case "BotIncoming":
                // call from an user.
                callHandler = new IncomingCallHandler(this, call, null /* The app endpoint ID */);
                break;

            case "BotEndpointIncoming":
                // call from an user to an bot endpoint.
                callee      = call.Resource.Targets.First();
                callHandler = new IncomingCallHandler(this, call, callee.Identity.GetApplicationInstance().Id);
                break;

            default:
                throw new NotSupportedException($"Invalid call type in incident call context: {callType}");
            }

            this.CallHandlers[call.Id] = callHandler;
        }
Example #2
0
        /// <summary>
        /// Add call to call handlers.
        /// </summary>
        /// <param name="call">The call to be added.</param>
        /// <param name="incidentCallContext">The incident call context.</param>
        private void AddCallToHandlers(ICall call, IncidentCallContext incidentCallContext)
        {
            Validator.NotNull(incidentCallContext, nameof(incidentCallContext));

            var callHandler = default(CallHandler);

            var statusData = this.IncidentStatusManager.GetIncident(incidentCallContext.IncidentId);

            var callee = default(ParticipantInfo);

            switch (incidentCallContext.CallType)
            {
            case IncidentCallType.BotMeeting:
                // Call to meeting.
                callHandler = new MeetingCallHandler(this, call, statusData);
                break;

            case IncidentCallType.ResponderNotification:
                // call to an user.
                callee      = call.Resource.Targets.First();
                callHandler = new ResponderCallHandler(this, call, callee.Identity.User.Id, statusData);
                break;

            case IncidentCallType.BotIncoming:
                // call from an user.
                callHandler = new IncomingCallHandler(this, call, null /* The app endpoint ID */);
                break;

            case IncidentCallType.BotEndpointIncoming:
                // call from an user to an bot endpoint.
                callee      = call.Resource.Targets.First();
                callHandler = new IncomingCallHandler(this, call, callee.Identity.GetApplicationInstance().Id);
                break;

            default:
                throw new NotSupportedException($"Invalid call type in incident call context: {incidentCallContext.CallType}");
            }

            this.CallHandlers[call.Id] = callHandler;
        }