Пример #1
0
        /// <summary>
        /// Initiates a Google Voice callback by sending 3 HTTP requests and then waiting for the incoming SIP call.
        /// </summary>
        /// <param name="emailAddress">The Google Voice email address to login with.</param>
        /// <param name="password">The Google Voice password to login with.</param>
        /// <param name="forwardingNumber">The number to request Google Voice to do the intial callback on.</param>
        /// <param name="destinationNumber">The number to request Google Voice to dial out on. This is what Google will attempt to
        /// call once the callback on the forwardingNumber is answered.</param>
        /// <param name="fromUserToMatch">The FromURI user to match to recognise the incoming call. If null it will be assumed that
        /// Gizmo is being used and the X-GoogleVoice header will be used.</param>
        /// <param name="contentType">The content type of the SIP call into sipsorcery that created the Google Voice call. It is
        /// what will be sent in the Ok response to the initial incoming callback.</param>
        /// <param name="body">The content of the SIP call into sipsorcery that created the Google Voice call. It is
        /// what will be sent in the Ok response to the initial incoming callback.</param>
        /// <returns>If successful the dialogue of the established call otherwsie null.</returns>
        public SIPDialogue InitiateCall(string emailAddress, string password, string forwardingNumber, string destinationNumber, string fromUserRegexMatch, int phoneType, int waitForCallbackTimeout, string contentType, string body)
        {
            try
            {
                m_forwardingNumber      = forwardingNumber;
                m_destinationNumber     = destinationNumber;
                m_fromURIUserRegexMatch = fromUserRegexMatch;

                CallProgress?.Invoke(SIPResponseStatusCodesEnum.Ringing, null, null, null, null, null);

                m_cookies = new CookieContainer();
                m_rnrKey  = Login(emailAddress, password);

                if (!m_rnrKey.IsNullOrBlank())
                {
                    Log_External(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.AppServer, SIPMonitorEventTypesEnum.DialPlan, "Call key " + m_rnrKey + " successfully retrieved for " + emailAddress + ", proceeding with callback.", m_username));
                    return(SendCallRequest(forwardingNumber, destinationNumber, phoneType, waitForCallbackTimeout, contentType, body));
                }
                else
                {
                    Log_External(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.AppServer, SIPMonitorEventTypesEnum.DialPlan, "Call key was not retrieved for " + emailAddress + " callback cannot proceed.", m_username));
                    return(null);
                }
            }
            catch (Exception excp)
            {
                logger.Error("Exception GoogleVoiceCall InitiateCall. " + excp.Message);
                throw;
            }
        }
        public ActionResult AddCallProgressStep(
            int Call_template_Id,
            string UID
            )
        {
            CallProgress p = new CallProgress()
            {
            };

            CallProgressRep.AddOrUpdate(p);
            return(new EmptyResult());
        }