Ejemplo n.º 1
0
 public SIPDialogEventSubscription(
     string sessionID,
     SIPURI resourceURI,
     SIPURI canonincalResourceURI,
     string filter,
     SIPDialogue subscriptionDialogue,
     int expiry,
     SIPAssetGetListDelegate <SIPDialogueAsset> getDialogues,
     SIPAssetGetByIdDelegate <SIPDialogueAsset> getDialogue
     )
     : base(sessionID, resourceURI, canonincalResourceURI, filter, subscriptionDialogue, expiry)
 {
     GetDialogues_External = getDialogues;
     GetDialogue_External  = getDialogue;
     DialogInfo            = new SIPEventDialogInfo(0, SIPEventDialogInfoStateEnum.full, resourceURI);
 }
 public SIPDialogEventSubscription(
     SIPMonitorLogDelegate log,
     string sessionID,
     SIPURI resourceURI,
     SIPURI canonincalResourceURI,
     string filter,
     SIPDialogue subscriptionDialogue,
     int expiry,
     SIPAssetGetListDelegate<SIPDialogueAsset> getDialogues,
     SIPAssetGetByIdDelegate<SIPDialogueAsset> getDialogue
     )
     : base(log, sessionID, resourceURI, canonincalResourceURI, filter, subscriptionDialogue, expiry)
 {
     GetDialogues_External = getDialogues;
     GetDialogue_External = getDialogue;
     DialogInfo = new SIPEventDialogInfo(0, SIPEventDialogInfoStateEnum.full, resourceURI);
 }
        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); });
        }
        private Dictionary <string, SIPEventSubscription> m_subscriptions = new Dictionary <string, SIPEventSubscription>(); // [monitor session ID, subscription].

        public NotifierSubscriptionsManager(
            SIPMonitorLogDelegate logDelegate,
            SIPAssetGetListDelegate <SIPDialogueAsset> getDialogues,
            SIPAssetGetByIdDelegate <SIPDialogueAsset> getDialogue,
            SIPAssetPersistor <SIPAccount> sipAssetPersistor,
            SIPAssetCountDelegate <SIPRegistrarBinding> getBindingsCount,
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            ISIPMonitorPublisher publisher)
        {
            MonitorLogEvent_External = logDelegate;
            GetDialogues_External    = getDialogues;
            GetDialogue_External     = getDialogue;
            GetSIPRegistrarBindingsCount_External = getBindingsCount;
            m_sipAssetPersistor            = sipAssetPersistor;
            m_sipTransport                 = sipTransport;
            m_outboundProxy                = outboundProxy;
            m_publisher                    = publisher;
            m_publisher.MonitorEventReady += MonitorEventAvailable;
        }
        private Dictionary<string, SIPEventSubscription> m_subscriptions = new Dictionary<string, SIPEventSubscription>();    // [monitor session ID, subscription].

        public NotifierSubscriptionsManager(
            SIPMonitorLogDelegate logDelegate,
            SIPAssetGetListDelegate<SIPDialogueAsset> getDialogues,
            SIPAssetGetByIdDelegate<SIPDialogueAsset> getDialogue,
            SIPAssetPersistor<SIPAccount> sipAssetPersistor,
            SIPAssetCountDelegate<SIPRegistrarBinding> getBindingsCount,
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            ISIPMonitorPublisher publisher)
        {
            MonitorLogEvent_External = logDelegate;
            GetDialogues_External = getDialogues;
            GetDialogue_External = getDialogue;
            GetSIPRegistrarBindingsCount_External = getBindingsCount;
            m_sipAssetPersistor = sipAssetPersistor;
            m_sipTransport = sipTransport;
            m_outboundProxy = outboundProxy;
            m_publisher = publisher;
            m_publisher.MonitorEventReady += MonitorEventAvailable;
        }
Ejemplo n.º 7
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);
 }
 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 SIPPresenceEventSubscription(
     string sessionID,
     SIPURI resourceURI,
     SIPURI canonincalResourceURI,
     string filter,
     SIPDialogue subscriptionDialogue,
     int expiry,
     //SIPAssetPersistor<SIPAccount> sipAccountPersistor,
     SIPAssetGetListDelegate <SIPAccount> getSipAccountsExternal,
     SIPAssetGetPropertyByIdDelegate <SIPAccount> getSipAccountPropertyExternal,
     SIPAssetCountDelegate <SIPRegistrarBinding> getBindingsCount,
     bool switchboardSIPAccountsOnly
     )
     : base(sessionID, resourceURI, canonincalResourceURI, filter, subscriptionDialogue, expiry)
 {
     //m_sipAccountPersistor = sipAccountPersistor;
     GetSIPAccounts_External               = getSipAccountsExternal;
     GetSipAccountProperty_External        = getSipAccountPropertyExternal;
     GetSIPRegistrarBindingsCount_External = getBindingsCount;
     Presence = new SIPEventPresence(resourceURI);
     m_switchboardSIPAccountsOnly = switchboardSIPAccountsOnly;
 }
 public SIPPresenceEventSubscription(
     SIPMonitorLogDelegate log,
     string sessionID,
     SIPURI resourceURI,
     SIPURI canonincalResourceURI,
     string filter,
     SIPDialogue subscriptionDialogue,
     int expiry,
     //SIPAssetPersistor<SIPAccount> sipAccountPersistor,
     SIPAssetGetListDelegate<SIPAccount> getSipAccountsExternal,
     SIPAssetGetPropertyByIdDelegate<SIPAccount> getSipAccountPropertyExternal,
     SIPAssetCountDelegate<SIPRegistrarBinding> getBindingsCount,
     bool switchboardSIPAccountsOnly
     )
     : base(log, sessionID, resourceURI, canonincalResourceURI, filter, subscriptionDialogue, expiry)
 {
     //m_sipAccountPersistor = sipAccountPersistor;
     GetSIPAccounts_External = getSipAccountsExternal;
     GetSipAccountProperty_External = getSipAccountPropertyExternal;
     GetSIPRegistrarBindingsCount_External = getBindingsCount;
     Presence = new SIPEventPresence(resourceURI);
     m_switchboardSIPAccountsOnly = switchboardSIPAccountsOnly;
 }
Ejemplo n.º 11
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 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;
        }
Ejemplo n.º 13
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;
        }
Ejemplo n.º 14
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"); });
        }
Ejemplo n.º 15
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();
        }
        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,
            SIPEndPoint outboundProxySocket
            )
        {
            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_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_sipAccountPersistor != null)
                {
                    getSIPAccount = m_sipAccountPersistor.Get;
                }
                m_dialStringParser = new DialStringParser(m_sipTransport, m_dialPlanContext.Owner, m_dialPlanContext.SIPAccount, m_sipProviders, getSIPAccount, GetSIPAccountBindings_External, m_getCanonicalDomainDelegate, logDelegate, m_dialPlanContext.SIPDialPlan.DialPlanName);
            }
        }