예제 #1
0
        //private SIPNotifyManager m_notifyManager;

        public SIPAppServerCore(
            SIPTransport sipTransport,
            GetCanonicalDomainDelegate getCanonicalDomain,
            SIPAssetGetDelegate <SIPAccount> getSIPAccount,
            SIPMonitorLogDelegate proxyLog,
            SIPCallManager callManager,
            SIPDialogueManager sipDialogueManager,
            //SIPNotifyManager notifyManager,
            SIPAuthenticateRequestDelegate sipAuthenticateRequest,
            SIPEndPoint outboundProxy)
        {
            try
            {
                m_sipTransport       = sipTransport;
                m_callManager        = callManager;
                m_sipDialogueManager = sipDialogueManager;
                //m_notifyManager = notifyManager;

                m_sipTransport.SIPTransportRequestReceived  += GotRequest;
                m_sipTransport.SIPTransportResponseReceived += GotResponse;

                m_outboundProxy = outboundProxy;

                GetCanonicalDomain_External      = getCanonicalDomain;
                GetSIPAccount_External           = getSIPAccount;
                SIPMonitorLogEvent_External      = proxyLog;
                SIPRequestAuthenticator_External = sipAuthenticateRequest;
            }
            catch (Exception excp)
            {
                logger.Error("Exception SIPAppServerCore (ctor). " + excp.Message);
                throw excp;
            }
        }
        //public event Action DialPlanComplete;

        public DialPlanContext(
            SIPMonitorLogDelegate monitorLogDelegate,
            SIPTransport sipTransport,
            DialogueBridgeCreatedDelegate createBridge,
            SIPEndPoint outboundProxy,
            ISIPServerUserAgent sipServerUserAgent,
            SIPDialPlan dialPlan,
            List <SIPProvider> sipProviders,
            string traceDirectory,
            string callersNetworkId,
            Customer customer,
            DialPlanEngine dialPlanEngine,
            GetCanonicalDomainDelegate getCanonicalDomain)
        {
            Log_External          = monitorLogDelegate;
            CreateBridge_External = createBridge;
            m_sipTransport        = sipTransport;
            m_outboundProxy       = outboundProxy;
            m_sipServerUserAgent  = sipServerUserAgent;
            m_dialPlan            = dialPlan;
            m_sipProviders        = sipProviders;
            m_traceDirectory      = traceDirectory;
            CallersNetworkId      = callersNetworkId;
            Customer                    = customer;
            m_dialPlanEngine            = dialPlanEngine;
            GetCanonicalDomain_External = getCanonicalDomain;

            m_sipServerUserAgent.CallCancelled       += ClientCallCancelled;
            m_sipServerUserAgent.NoRingTimeout       += ClientCallNoRingTimeout;
            m_sipServerUserAgent.TransactionComplete += ClientTransactionRemoved;
            m_sipServerUserAgent.SetTraceDelegate(TransactionTraceMessage);
        }
예제 #3
0
 public SipMessageCore(
     SIPTransport sipTransport,
     SIPAssetGetDelegate <SIPAccount> getSIPAccount,
     GetCanonicalDomainDelegate getCanonicalDomain,
     bool mangleUACContact,
     bool strictRealmHandling,
     SIPUserAgentConfigurationManager userAgentConfigs,
     SIPAuthenticateRequestDelegate sipRequestAuthenticator,
     string switchboarduserAgentPrefix,
     List <string> deviceList)
 {
     m_sipTransport                   = sipTransport;
     GetSIPAccount_External           = getSIPAccount;
     GetCanonicalDomain_External      = getCanonicalDomain;
     m_mangleUACContact               = mangleUACContact;
     m_strictRealmHandling            = strictRealmHandling;
     m_userAgentConfigs               = userAgentConfigs;
     SIPRequestAuthenticator_External = sipRequestAuthenticator;
     m_switchboarduserAgentPrefix     = switchboarduserAgentPrefix;
     m_userAgent  = m_userAgentConfigs.DefaultUserAgent ?? SIPConstants.SIP_USER_AGENT;
     MonitorItems = new Dictionary <string, SipMonitorCore>(500);
     foreach (string device in deviceList)
     {
         SipMonitorCore monitor = new SipMonitorCore(this, m_sipTransport, device);
         MonitorItems.Add(device, monitor);
     }
 }
        //private SIPNotifyManager m_notifyManager;

        public SIPAppServerCore(
            SIPTransport sipTransport,
            GetCanonicalDomainDelegate getCanonicalDomain,
            SIPAssetGetDelegate<SIPAccount> getSIPAccount,
            SIPMonitorLogDelegate proxyLog,
            SIPCallManager callManager,
            SIPDialogueManager sipDialogueManager,
            //SIPNotifyManager notifyManager,
            SIPAuthenticateRequestDelegate sipAuthenticateRequest,
            SIPEndPoint outboundProxy)
        {
            try
            {
                m_sipTransport = sipTransport;
                m_callManager = callManager;
                m_sipDialogueManager = sipDialogueManager;
                //m_notifyManager = notifyManager;

                m_sipTransport.SIPTransportRequestReceived += GotRequest;
                m_sipTransport.SIPTransportResponseReceived += GotResponse;

                m_outboundProxy = outboundProxy;

                GetCanonicalDomain_External = getCanonicalDomain;
                GetSIPAccount_External = getSIPAccount;
                SIPMonitorLogEvent_External = proxyLog;
                SIPRequestAuthenticator_External = sipAuthenticateRequest;
            }
            catch (Exception excp)
            {
                logger.Error("Exception SIPAppServerCore (ctor). " + excp.Message);
                throw excp;
            }
        }
예제 #5
0
        public DialPlanEngine(
            SIPTransport sipTransport,
            GetCanonicalDomainDelegate getCanonicalDomain,
            SIPMonitorLogDelegate logDelegate,
            SIPSorceryPersistor sipSorceryPersistor,
            SIPEndPoint outboundProxySocket,
            string rubyScriptCommonPath,
            string impersonationUsername,
            string impersonationPassword,
            int maxExecutionCount)
        {
            m_sipTransport = sipTransport;
            GetCanonicalDomainDelegate_External = getCanonicalDomain;
            LogDelegate_External  = logDelegate;
            m_sipSorceryPersistor = sipSorceryPersistor;
            //m_sipAccountPersistor = sipAssetPersistor;
            //GetSIPAccountBindings_External = getBindings;
            //m_dialPlanPersistor = dialPlanPersistor;
            //m_sipDialoguePersistor = sipDialoguePersistor;
            m_outboundProxySocket   = outboundProxySocket;
            m_rubyScriptCommonPath  = rubyScriptCommonPath;
            m_impersonationUsername = impersonationUsername;
            m_impersonationPassword = impersonationPassword;
            m_maxExecutionCount     = (maxExecutionCount > 0) ? maxExecutionCount : MAX_ALLOWED_SCRIPTSCOPES;

            LoadRubyCommonScript();

            Thread monitorScriptsThread = new Thread(new ThreadStart(MonitorScripts));

            monitorScriptsThread.Name = MONITOR_THREAD_NAME;
            monitorScriptsThread.Start();
        }
예제 #6
0
 public SIPRegistrarDaemon(
     GetCanonicalDomainDelegate getDomain,
     SIPAssetGetDelegate <SIPAccount> getSIPAccount,
     SIPAuthenticateRequestDelegate sipRequestAuthenticator,
     List <string> deviceList)
 {
     GetCanonicalDomain_External     = getDomain;
     GetSIPAccount_External          = getSIPAccount;
     SIPAuthenticateRequest_External = sipRequestAuthenticator;
     _deviceList = deviceList;
     Initialize();
 }
 public SIPRegistrarDaemon(
     GetCanonicalDomainDelegate getDomain,
     SIPAssetGetDelegate<SIPAccount> getSIPAccount,
     //SIPAssetGetFromDirectQueryDelegate<SIPAccount> getSIPAccountFromQuery,
     SIPAssetPersistor<SIPRegistrarBinding> registrarBindingsPersistor,
     SIPAuthenticateRequestDelegate sipRequestAuthenticator
     ) {
     GetCanonicalDomain_External = getDomain;
     GetSIPAccount_External = getSIPAccount;
     //GetSIPAccountFromQuery_External = getSIPAccountFromQuery;
     m_registrarBindingsPersistor = registrarBindingsPersistor;
     SIPAuthenticateRequest_External = sipRequestAuthenticator;
 }
예제 #8
0
 public SIPRegistrarDaemon(
     GetCanonicalDomainDelegate getDomain,
     SIPAssetGetDelegate <SIPAccountAsset> getSIPAccount,
     SIPAssetPersistor <SIPRegistrarBinding> registrarBindingsPersistor,
     SIPAuthenticateRequestDelegate sipRequestAuthenticator,
     SIPAssetPersistor <Customer> customerPersistor)
 {
     GetCanonicalDomain_External     = getDomain;
     GetSIPAccount_External          = getSIPAccount;
     m_registrarBindingsPersistor    = registrarBindingsPersistor;
     SIPAuthenticateRequest_External = sipRequestAuthenticator;
     CustomerPersistor_External      = customerPersistor;
 }
예제 #9
0
 public DialPlanScriptContext(
     SIPMonitorLogDelegate monitorLogDelegate,
     SIPTransport sipTransport,
     DialogueBridgeCreatedDelegate createBridge,
     SIPEndPoint outboundProxy,
     ISIPServerUserAgent sipServerUserAgent,
     SIPDialPlan dialPlan,
     List <SIPProvider> sipProviders,
     string traceDirectory,
     string callersNetworkId,
     Customer customer,
     DialPlanEngine dialPlanEngine,
     GetCanonicalDomainDelegate getCanonicalDomain)
     : base(monitorLogDelegate, sipTransport, createBridge, outboundProxy, sipServerUserAgent, dialPlan, sipProviders, traceDirectory, callersNetworkId, customer, dialPlanEngine, getCanonicalDomain)
 {
     ContextType = DialPlanContextsEnum.Script;
 }
        public SIPNotifyManager(
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            SIPMonitorLogDelegate logDelegate,
            SIPAssetGetDelegate <SIPAccountAsset> getSIPAccount,
            SIPAssetGetListDelegate <SIPRegistrarBinding> getSIPAccountBindings,
            GetCanonicalDomainDelegate getCanonicalDomain)
        {
            m_sipTransport                 = sipTransport;
            m_outboundProxy                = outboundProxy;
            Log_External                   = logDelegate;
            GetSIPAccount_External         = getSIPAccount;
            GetSIPAccountBindings_External = getSIPAccountBindings;
            GetCanonicalDomain_External    = getCanonicalDomain;

            ThreadPool.QueueUserWorkItem(delegate { ProcessNewNotifications(PROCESS_NOTIFICATIONS_THREAD_NAME); });
        }
        public SIPNotifyManager(
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            SIPMonitorLogDelegate logDelegate,
            SIPAssetGetDelegate<SIPAccount> getSIPAccount,
            SIPAssetGetListDelegate<SIPRegistrarBinding> getSIPAccountBindings,
            GetCanonicalDomainDelegate getCanonicalDomain)
        {
            m_sipTransport = sipTransport;
            m_outboundProxy = outboundProxy;
            Log_External = logDelegate;
            GetSIPAccount_External = getSIPAccount;
            GetSIPAccountBindings_External = getSIPAccountBindings;
            GetCanonicalDomain_External = getCanonicalDomain;

            ThreadPool.QueueUserWorkItem(delegate { ProcessNewNotifications(PROCESS_NOTIFICATIONS_THREAD_NAME); });
        }
예제 #12
0
 public DialPlanScriptContext(           
     SIPMonitorLogDelegate monitorLogDelegate,
     SIPTransport sipTransport,
     DialogueBridgeCreatedDelegate createBridge,
     SIPEndPoint outboundProxy,
     ISIPServerUserAgent sipServerUserAgent,
     SIPDialPlan dialPlan,
     List<SIPProvider> sipProviders,
     string traceDirectory,
     string callersNetworkId,
     Customer customer,
     DialPlanEngine dialPlanEngine,
     GetCanonicalDomainDelegate getCanonicalDomain)
     : base(monitorLogDelegate, sipTransport, createBridge, outboundProxy, sipServerUserAgent, dialPlan, sipProviders, traceDirectory, callersNetworkId, customer, dialPlanEngine, getCanonicalDomain)
 {
     ContextType = DialPlanContextsEnum.Script;
 }
        public void Initialize(string switchboarduserAgentPrefix,
                               SIPAuthenticateRequestDelegate sipRequestAuthenticator,
                               GetCanonicalDomainDelegate getCanonicalDomain,
                               SIPAssetGetDelegate <SIPAccount> getSIPAccount,
                               SIPUserAgentConfigurationManager userAgentConfigs,
                               SIPRegistrarBindingsManager registrarBindingsManager,
                               Dictionary <string, string> devList)
        {
            m_registrarCore = new RegistrarCore(Transport, registrarBindingsManager, getSIPAccount, getCanonicalDomain, true, true, userAgentConfigs, sipRequestAuthenticator, switchboarduserAgentPrefix);
            m_registrarCore.Start(1);
            MonitorService = new Dictionary <string, ISIPMonitorService>();

            foreach (var item in devList)
            {
                ISIPMonitorService monitor = new SIPMonitorCore(this, item.Key, item.Value);
                monitor.OnSIPServiceChanged += monitor_OnSIPServiceChanged;
                MonitorService.Add(item.Key, monitor);
            }
        }
 public SIPNotifierDaemon(
     SIPAssetGetDelegate<Customer> getCustomer,
     SIPAssetGetListDelegate<SIPDialogueAsset> getDialogues,
     SIPAssetGetByIdDelegate<SIPDialogueAsset> getDialogue,
     GetCanonicalDomainDelegate getDomain,
     SIPAssetPersistor<SIPAccount> sipAsssetPersistor,
     SIPAssetGetListDelegate<SIPRegistrarBinding> getSIPRegistrarBindings,
     SIPAssetGetListDelegate<SIPAccount> getSIPAccounts,
     SIPAssetCountDelegate<SIPRegistrarBinding> getBindingsCount,
     SIPAuthenticateRequestDelegate sipRequestAuthenticator,
     ISIPMonitorPublisher publisher)
 {
     GetCustomer_External = getCustomer;
     GetDialogues_External = getDialogues;
     GetDialogue_External = getDialogue;
     GetCanonicalDomain_External = getDomain;
     m_sipAssetPersistor = sipAsssetPersistor;
     GetSIPRegistrarBindings_External = getSIPRegistrarBindings;
     GetBindingsCount_External = getBindingsCount;
     SIPAuthenticateRequest_External = sipRequestAuthenticator;
     m_publisher = publisher ?? new SIPMonitorUDPSink(m_udpNotificationReceiverSocket);
 }
        public RegistrarCore(
            SIPTransport sipTransport,
            SIPRegistrarBindingsManager registrarBindingsManager,
            SIPAssetGetDelegate <SIPAccountAsset> getSIPAccount,
            GetCanonicalDomainDelegate getCanonicalDomain,
            bool mangleUACContact,
            bool strictRealmHandling,
            SIPMonitorLogDelegate proxyLogDelegate,
            SIPUserAgentConfigurationManager userAgentConfigs,
            SIPAuthenticateRequestDelegate sipRequestAuthenticator,
            string switchboarduserAgentPrefix,
            SIPAssetPersistor <Customer> customerPersistor)
        {
            m_sipTransport                   = sipTransport;
            m_registrarBindingsManager       = registrarBindingsManager;
            GetSIPAccount_External           = getSIPAccount;
            GetCanonicalDomain_External      = getCanonicalDomain;
            m_mangleUACContact               = mangleUACContact;
            m_strictRealmHandling            = strictRealmHandling;
            m_registrarLogEvent              = proxyLogDelegate;
            m_userAgentConfigs               = userAgentConfigs;
            SIPRequestAuthenticator_External = sipRequestAuthenticator;
            m_switchboarduserAgentPrefix     = switchboarduserAgentPrefix;
            CustomerPersistor_External       = customerPersistor;

            //try
            //{
            //    if (!switchboardCertificateName.IsNullOrBlank())
            //    {
            //        X509Certificate2 switchboardCertificate = AppState.LoadCertificate(StoreLocation.LocalMachine, switchboardCertificateName, false);
            //        m_switchbboardRSAProvider = (RSACryptoServiceProvider)switchboardCertificate.PrivateKey;
            //        logger.Debug("Switchboard RSA provider successfully loaded from " + switchboardCertificateName + " certificate.");
            //    }
            //}
            //catch (Exception excp)
            //{
            //    logger.Error("Exception loading switchboard certificate using " + switchboardCertificateName + ". " + excp.Message);
            //}
        }
예제 #16
0
 public SIPNotifierDaemon(
     SIPAssetGetDelegate <Customer> getCustomer,
     SIPAssetGetListDelegate <SIPDialogueAsset> getDialogues,
     SIPAssetGetByIdDelegate <SIPDialogueAsset> getDialogue,
     GetCanonicalDomainDelegate getDomain,
     SIPAssetPersistor <SIPAccount> sipAsssetPersistor,
     SIPAssetGetListDelegate <SIPRegistrarBinding> getSIPRegistrarBindings,
     SIPAssetGetListDelegate <SIPAccount> getSIPAccounts,
     SIPAssetCountDelegate <SIPRegistrarBinding> getBindingsCount,
     SIPAuthenticateRequestDelegate sipRequestAuthenticator,
     ISIPMonitorPublisher publisher)
 {
     GetCustomer_External             = getCustomer;
     GetDialogues_External            = getDialogues;
     GetDialogue_External             = getDialogue;
     GetCanonicalDomain_External      = getDomain;
     m_sipAssetPersistor              = sipAsssetPersistor;
     GetSIPRegistrarBindings_External = getSIPRegistrarBindings;
     GetBindingsCount_External        = getBindingsCount;
     SIPAuthenticateRequest_External  = sipRequestAuthenticator;
     m_publisher = publisher ?? new SIPMonitorUDPSink(m_udpNotificationReceiverSocket);
 }
예제 #17
0
        public NotifierCore(
            SIPMonitorLogDelegate logDelegate,
            SIPTransport sipTransport,
            SIPAssetGetDelegate <Customer> getCustomer,
            SIPAssetGetListDelegate <SIPDialogueAsset> getDialogues,
            SIPAssetGetByIdDelegate <SIPDialogueAsset> getDialogue,
            GetCanonicalDomainDelegate getCanonicalDomain,
            SIPAssetPersistor <SIPAccount> sipAssetPersistor,
            SIPAssetCountDelegate <SIPRegistrarBinding> getBindingsCount,
            SIPAuthenticateRequestDelegate sipRequestAuthenticator,
            SIPEndPoint outboundProxy,
            ISIPMonitorPublisher publisher)
        {
            MonitorLogEvent_External         = logDelegate;
            m_sipTransport                   = sipTransport;
            GetCustomer_External             = getCustomer;
            m_sipAssetPersistor              = sipAssetPersistor;
            GetCanonicalDomain_External      = getCanonicalDomain;
            SIPRequestAuthenticator_External = sipRequestAuthenticator;
            m_outboundProxy                  = outboundProxy;
            m_subscriptionsManager           = new NotifierSubscriptionsManager(MonitorLogEvent_External, getDialogues, getDialogue, m_sipAssetPersistor, getBindingsCount, m_sipTransport, m_outboundProxy, publisher);

            ThreadPool.QueueUserWorkItem(delegate { ProcessSubscribeRequest(NOTIFIER_THREAD_NAME_PREFIX + "1"); });
        }
        public RegistrarCore(
            SIPTransport sipTransport,
            SIPRegistrarBindingsManager registrarBindingsManager,
            SIPAssetGetDelegate<SIPAccount> getSIPAccount,
            GetCanonicalDomainDelegate getCanonicalDomain,
            bool mangleUACContact,
            bool strictRealmHandling,
            SIPMonitorLogDelegate proxyLogDelegate,
            SIPUserAgentConfigurationManager userAgentConfigs,
            SIPAuthenticateRequestDelegate sipRequestAuthenticator,
            string switchboardCertificateName)
        {
            m_sipTransport = sipTransport;
            m_registrarBindingsManager = registrarBindingsManager;
            GetSIPAccount_External = getSIPAccount;
            GetCanonicalDomain_External = getCanonicalDomain;
            m_mangleUACContact = mangleUACContact;
            m_strictRealmHandling = strictRealmHandling;
            m_registrarLogEvent = proxyLogDelegate;
            m_userAgentConfigs = userAgentConfigs;
            SIPRequestAuthenticator_External = sipRequestAuthenticator;

            try
            {
                if (!switchboardCertificateName.IsNullOrBlank())
                {
                    X509Certificate2 switchboardCertificate = AppState.LoadCertificate(StoreLocation.LocalMachine, switchboardCertificateName, false);
                    m_switchbboardRSAProvider = (RSACryptoServiceProvider)switchboardCertificate.PrivateKey;
                    logger.Debug("Switchboard RSA provider successfully loaded from " + switchboardCertificateName + " certificate.");
                }
            }
            catch (Exception excp)
            {
                logger.Error("Exception loading switchboard certificate using " + switchboardCertificateName + ". " + excp.Message);
            }
        }
        public static IPAddress PublicIPAddress;    // If the app server is behind a NAT then it can set this address to be used in mangled SDP.

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sipTransport"></param>
        /// <param name="owner"></param>
        /// <param name="sipAccount">The SIP account that was called and resulted in the dialplan executing. Will be null if the
        /// execution was not initated by a call to a SIP account call such as if a web callback occurs.</param>
        /// <param name="sipProviders"></param>
        /// <param name="getSIPAccount"></param>
        /// <param name="getRegistrarBindings"></param>
        /// <param name="getCanonicalDomainDelegate"></param>
        /// <param name="logDelegate"></param>
        /// <param name="dialplanName">Used to ensure that a call leg cannot create a B2B call that loops into the same dial plan.</param>
        public DialStringParser(
            SIPTransport sipTransport,
            string owner,
            SIPAccount sipAccount,
            List<SIPProvider> sipProviders,
            SIPAssetGetDelegate<SIPAccount> getSIPAccount,
            SIPAssetGetListDelegate<SIPRegistrarBinding> getRegistrarBindings,
            GetCanonicalDomainDelegate getCanonicalDomainDelegate,
            SIPMonitorLogDelegate logDelegate,
            string dialplanName)
        {
            m_sipTransport = sipTransport;
            m_username = owner;
            m_sipAccount = sipAccount;
            m_sipProviders = sipProviders;
            GetSIPAccount_External = getSIPAccount;
            GetRegistrarBindings_External = getRegistrarBindings;
            GetCanonicalDomain_External = getCanonicalDomainDelegate;
            Log_External = logDelegate;
            m_dialPlanName = dialplanName;
        }
예제 #20
0
        public SIPCallManager(
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            SIPMonitorLogDelegate logDelegate,
            SIPDialogueManager sipDialogueManager,
            SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor,
            SIPAssetPersistor<SIPCDRAsset> sipCDRPersistor,
            DialPlanEngine dialPlanEngine,
            SIPAssetGetDelegate<SIPDialPlan> getDialPlan,
            SIPAssetGetDelegate<SIPAccount> getSIPAccount,
            SIPAssetGetListDelegate<SIPRegistrarBinding> getSIPAccountBindings,
            SIPAssetGetListDelegate<SIPProvider> getSIPProviders,
            GetCanonicalDomainDelegate getCanonicalDomain,
            SIPAssetPersistor<Customer> customerPersistor,
            SIPAssetPersistor<SIPDialPlan> dialPlanPersistor,
            string traceDirectory,
            bool monitorCalls,
            int dailyCallLimit)
        {
            m_sipTransport = sipTransport;
            m_outboundProxy = outboundProxy;
            Log_External = logDelegate;
            m_sipDialogueManager = sipDialogueManager;
            m_sipDialoguePersistor = sipDialoguePersistor;
            m_sipCDRPersistor = sipCDRPersistor;
            m_dialPlanEngine = dialPlanEngine;
            GetDialPlan_External = getDialPlan;
            GetSIPAccount_External = getSIPAccount;
            GetSIPAccountBindings_External = getSIPAccountBindings;
            GetSIPProviders_External = getSIPProviders;
            GetCanonicalDomain_External = getCanonicalDomain;
            m_customerPersistor = customerPersistor;
            m_dialPlanPersistor = dialPlanPersistor;
            m_traceDirectory = traceDirectory;
            m_monitorCalls = monitorCalls;
            m_pid = Process.GetCurrentProcess().Id;
            m_dailyCallLimit = dailyCallLimit;

            m_sipDialogueManager.OnCallHungup += OnCallHungup;
        }
예제 #21
0
        public DialPlanEngine(
            SIPTransport sipTransport,
            GetCanonicalDomainDelegate getCanonicalDomain,
            SIPMonitorLogDelegate logDelegate,
            SIPSorceryPersistor sipSorceryPersistor,
            SIPEndPoint outboundProxySocket,
            string rubyScriptCommonPath,
            string impersonationUsername,
            string impersonationPassword,
            int maxExecutionCount)
        {
            m_sipTransport = sipTransport;
            GetCanonicalDomainDelegate_External = getCanonicalDomain;
            LogDelegate_External = logDelegate;
            m_sipSorceryPersistor = sipSorceryPersistor;
            //m_sipAccountPersistor = sipAssetPersistor;
            //GetSIPAccountBindings_External = getBindings;
            //m_dialPlanPersistor = dialPlanPersistor;
            //m_sipDialoguePersistor = sipDialoguePersistor;
            m_outboundProxySocket = outboundProxySocket;
            m_rubyScriptCommonPath = rubyScriptCommonPath;
            m_impersonationUsername = impersonationUsername;
            m_impersonationPassword = impersonationPassword;
            m_maxExecutionCount = (maxExecutionCount > 0) ? maxExecutionCount : MAX_ALLOWED_SCRIPTSCOPES;

            LoadRubyCommonScript();

            Thread monitorScriptsThread = new Thread(new ThreadStart(MonitorScripts));
            monitorScriptsThread.Name = MONITOR_THREAD_NAME;
            monitorScriptsThread.Start();
        }
예제 #22
0
        public DialPlanEngine(
            SIPTransport sipTransport,
            GetCanonicalDomainDelegate getCanonicalDomain,
            SIPMonitorLogDelegate logDelegate,
            SIPAssetPersistor<SIPAccount> sipAssetPersistor,
            SIPAssetGetListDelegate<SIPRegistrarBinding> getBindings,
            SIPAssetPersistor<SIPDialPlan> dialPlanPersistor,
            SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor,
            SIPEndPoint outboundProxySocket,
            string rubyScriptCommonPath,
            string impersonationUsername,
            string impersonationPassword)
        {
            m_sipTransport = sipTransport;
            GetCanonicalDomainDelegate_External = getCanonicalDomain;
            LogDelegate_External = logDelegate;
            m_sipAccountPersistor = sipAssetPersistor;
            GetSIPAccountBindings_External = getBindings;
            m_dialPlanPersistor = dialPlanPersistor;
            m_sipDialoguePersistor = sipDialoguePersistor;
            m_outboundProxySocket = outboundProxySocket;
            m_rubyScriptCommonPath = rubyScriptCommonPath;
            m_impersonationUsername = impersonationUsername;
            m_impersonationPassword = impersonationPassword;

            LoadRubyCommonScript();

            Thread monitorScriptsThread = new Thread(new ThreadStart(MonitorScripts));
            monitorScriptsThread.Name = MONITOR_THREAD_NAME;
            monitorScriptsThread.Start();
        }
예제 #23
0
        private List<ISIPClientUserAgent> m_uacWaitingForCallDetails = new List<ISIPClientUserAgent>(); // UACs can indicate they would like the call details when available.

        #endregion Fields

        #region Constructors

        //public event Action DialPlanComplete;
        public DialPlanContext(
            SIPMonitorLogDelegate monitorLogDelegate,
            SIPTransport sipTransport,
            DialogueBridgeCreatedDelegate createBridge,
            SIPEndPoint outboundProxy,
            ISIPServerUserAgent sipServerUserAgent,
            SIPDialPlan dialPlan,
            List<SIPProvider> sipProviders,
            string traceDirectory,
            string callersNetworkId,
            Customer customer,
            DialPlanEngine dialPlanEngine,
            GetCanonicalDomainDelegate getCanonicalDomain)
        {
            Log_External = monitorLogDelegate;
            CreateBridge_External = createBridge;
            m_sipTransport = sipTransport;
            m_outboundProxy = outboundProxy;
            m_sipServerUserAgent = sipServerUserAgent;
            m_dialPlan = dialPlan;
            m_sipProviders = sipProviders;
            m_traceDirectory = traceDirectory;
            CallersNetworkId = callersNetworkId;
            Customer = customer;
            m_dialPlanEngine = dialPlanEngine;
            GetCanonicalDomain_External = getCanonicalDomain;

            m_sipServerUserAgent.CallCancelled += ClientCallCancelled;
            m_sipServerUserAgent.NoRingTimeout += ClientCallNoRingTimeout;
            m_sipServerUserAgent.TransactionComplete += ClientTransactionRemoved;
            m_sipServerUserAgent.SetTraceDelegate(TransactionTraceMessage);
        }
예제 #24
0
        public NotifierCore(
            SIPMonitorLogDelegate logDelegate,
            SIPTransport sipTransport,
            SIPAssetGetDelegate<Customer> getCustomer,
            SIPAssetGetListDelegate<SIPDialogueAsset> getDialogues,
            SIPAssetGetByIdDelegate<SIPDialogueAsset> getDialogue,
            GetCanonicalDomainDelegate getCanonicalDomain,
            SIPAssetPersistor<SIPAccount> sipAssetPersistor,
            SIPAssetCountDelegate<SIPRegistrarBinding> getBindingsCount,
            SIPAuthenticateRequestDelegate sipRequestAuthenticator,
            SIPEndPoint outboundProxy,
            ISIPMonitorPublisher publisher)
        {
            MonitorLogEvent_External = logDelegate;
            m_sipTransport = sipTransport;
            GetCustomer_External = getCustomer;
            m_sipAssetPersistor = sipAssetPersistor;
            GetCanonicalDomain_External = getCanonicalDomain;
            SIPRequestAuthenticator_External = sipRequestAuthenticator;
            m_outboundProxy = outboundProxy;
            m_subscriptionsManager = new NotifierSubscriptionsManager(MonitorLogEvent_External, getDialogues, getDialogue, m_sipAssetPersistor, getBindingsCount, m_sipTransport, m_outboundProxy, publisher);

            ThreadPool.QueueUserWorkItem(delegate { ProcessSubscribeRequest(NOTIFIER_THREAD_NAME_PREFIX + "1"); });
        }
예제 #25
0
        public DialPlanScriptFacade(
            SIPTransport sipTransport,
            DialPlanExecutingScript executingScript,
            SIPMonitorLogDelegate logDelegate,
            DialogueBridgeCreatedDelegate createBridge,
            SIPRequest sipRequest,
            SIPCallDirection callDirection,
            DialPlanContext dialPlanContext,
            GetCanonicalDomainDelegate getCanonicalDomain,
            ISIPCallManager callManager,
            //SIPAssetPersistor<SIPAccount> sipAccountPersistor,
            //SIPAssetPersistor<SIPDialPlan> sipDialPlanPersistor,
            //SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor,
            //SIPAssetGetListDelegate<SIPRegistrarBinding> getSIPAccountBindings,
            SIPSorceryPersistor sipSorceryPersistor,
            SIPEndPoint outboundProxySocket,
            DialPlanEngine dialPlanEngine
            )
        {
            m_sipTransport = sipTransport;
            m_executingScript = executingScript;
            m_dialPlanLogDelegate = logDelegate;
            CreateBridge_External = createBridge;
            m_sipRequest = sipRequest;
            m_callDirection = callDirection;
            m_dialPlanContext = dialPlanContext;
            m_getCanonicalDomainDelegate = getCanonicalDomain;
            m_callManager = callManager;
            //m_sipAccountPersistor = sipAccountPersistor;
            //m_sipDialPlanPersistor = sipDialPlanPersistor;
            //m_sipDialoguePersistor = sipDialoguePersistor;
            //GetSIPAccountBindings_External = getSIPAccountBindings;
            m_sipSorceryPersistor = sipSorceryPersistor;
            m_outboundProxySocket = outboundProxySocket;

            m_executingScript.Cleanup = CleanupDialPlanScript;

            if (m_dialPlanContext != null)
            {
                m_username = dialPlanContext.Owner;
                m_adminMemberId = dialPlanContext.AdminMemberId;
                m_sipProviders = dialPlanContext.SIPProviders;

                m_dialPlanContext.TraceLog.AppendLine("DialPlan=> Dialplan trace commenced at " + DateTime.Now.ToString("dd MMM yyyy HH:mm:ss:fff") + ".");
                m_dialPlanContext.CallCancelledByClient += ClientCallTerminated;

                SIPAssetGetDelegate<SIPAccount> getSIPAccount = null;
                if (m_sipSorceryPersistor != null && m_sipSorceryPersistor.SIPAccountsPersistor != null)
                {
                    getSIPAccount = m_sipSorceryPersistor.SIPAccountsPersistor.Get;
                }
                m_dialStringParser = new DialStringParser(m_sipTransport, m_dialPlanContext.Owner, m_dialPlanContext.SIPAccount, m_sipProviders, getSIPAccount, m_sipSorceryPersistor.SIPRegistrarBindingPersistor.Get, m_getCanonicalDomainDelegate, logDelegate, m_dialPlanContext.SIPDialPlan.DialPlanName);
            }
        }
 public SIPDialogueManager(
     SIPTransport sipTransport,
     SIPEndPoint outboundProxy,
     SIPMonitorLogDelegate logDelegate,
     SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor,
     SIPAssetPersistor<SIPCDRAsset> sipCDRPersistor,
     SIPAuthenticateRequestDelegate authenticateRequestDelegate,
     SIPAssetGetDelegate<SIPAccount> getSIPAccount,
     GetCanonicalDomainDelegate getCanonicalDomain)
 {
     m_sipTransport = sipTransport;
     m_outboundProxy = outboundProxy;
     Log_External = logDelegate;
     m_sipDialoguePersistor = sipDialoguePersistor;
     m_sipCDRPersistor = sipCDRPersistor;
     SIPAuthenticateRequest_External = authenticateRequestDelegate;
     GetSIPAccount_External = getSIPAccount;
     GetCanonicalDomain_External = getCanonicalDomain;
 }