SetCallerDetails() public méthode

public SetCallerDetails ( CRMHeaders crmHeaders ) : void
crmHeaders SIPSorcery.SIP.App.CRMHeaders
Résultat void
Exemple #1
0
        /// <summary>
        /// Attempts to retrieve the CRM Account details for a dial plan.
        /// </summary>
        //public CRMAccount GetCRMAccount(string dialPlanName)
        //{
        //    try
        //    {
        //        using (SIPSorceryEntities entities = new SIPSorceryEntities())
        //        {
        //            return (from crmAcc in entities.CRMAccounts1
        //                    join dialplan in entities.SIPDialPlans on crmAcc.Owner equals dialplan.Owner
        //                    where dialplan.DialPlanName == dialPlanName && crmAcc.Owner == m_context.Owner
        //                    select crmAcc).FirstOrDefault();
        //        }
        //    }
        //    catch (Exception excp)
        //    {
        //        logger.Error("Exception GetCRMAccount. " + excp.Message);
        //        LogToMonitor(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.AppServer, SIPMonitorEventTypesEnum.DialPlan, "Error retrieving CRM Account details for dialplan.", m_context.Owner));
        //        return null;
        //    }
        //}

        /// <summary>
        /// Looks up a person contact in the 37 Signals Highrise application.
        /// </summary>
        /// <param name="url">The URL of the Highrise account to attempt the lookup on.</param>
        /// <param name="authToken">The auth token for the Highrise account to attempt the lookup with.</param>
        /// <param name="from">The SIP from header of the incoming call to attempt to match on.</param>
        /// <param name="addCallNote">If true it indicates a Highrise note should be created if a matching contact is found.</param>
        public CRMHeaders LookupHighriseContact(string url, string authToken, SIPFromHeader from, bool addCallNote, bool async)
        {
            LogToMonitor(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.AppServer, SIPMonitorEventTypesEnum.DialPlan, "Looking up Highrise contact on " + url + ".", m_context.Owner));

            if (async)
            {
                m_context.SetCallerDetails(new CRMHeaders()
                {
                    Pending = true
                });
                ThreadPool.QueueUserWorkItem(delegate { DoLookup(url, authToken, from, addCallNote, (result) => { m_context.SetCallerDetails(result); }); });
                return(null);
            }
            else
            {
                return(DoLookup(url, authToken, from, addCallNote, null));
            }
        }