Esempio n. 1
0
        public OriginateResponse Originate(Guid sourcePersonGuid, string destinationPhone, string callerId = null)
        {
            var response = new OriginateResponse();

            // get the current person
            var currentPerson = GetPerson();

            if (currentPerson == null)
            {
                response.Success = false;
                response.Message = "You must be logged in to originate a call.";
                return(response);
            }

            var pbxComponent = Rock.Pbx.PbxContainer.GetAllowedActiveComponentWithOriginationSupport(currentPerson);

            if (pbxComponent == null)
            {
                response.Success = false;
                response.Message = "An active PBX component supporting call origination is secured to allow access.";
                return(response);
            }

            // get the source person object ( the source could be different from the current person)
            var sourcePerson = new PersonService(new Data.RockContext()).Get(sourcePersonGuid);

            string message = null;

            response.Success = pbxComponent.Originate(sourcePerson, destinationPhone, callerId, out message);
            response.Message = message;

            return(response);
        }
Esempio n. 2
0
        public OriginateResponse Originate(string sourcePhone, string destinationPhone, string callerId = null)
        {
            var response = new OriginateResponse();

            // get the current person
            var currentPerson = GetPerson();

            if (currentPerson == null)
            {
                response.Success = false;
                response.Message = "You must be logged in to originate a call.";
                return(response);
            }

            var pbxComponent = Rock.Pbx.PbxContainer.GetAllowedActiveComponentWithOriginationSupport(currentPerson);

            if (pbxComponent == null)
            {
                response.Success = false;
                response.Message = "An active PBX component supporting call origination is secured to allow access.";
                return(response);
            }

            string message = null;

            response.Success = pbxComponent.Originate(sourcePhone, destinationPhone, callerId, out message);
            response.Message = message;

            return(response);
        }