public SIPPresenceEventSubscription(
     SIPMonitorLogDelegate log,
     string sessionID,
     SIPURI resourceURI,
     SIPURI canonincalResourceURI,
     string filter,
     SIPDialogue subscriptionDialogue,
     int expiry,
     //SIPAssetPersistor<SIPAccount> sipAccountPersistor,
     //GetSIPAccountListDelegate getSipAccountsExternal,
     GetSIPAccountsForUserDelegate getSIPAccountsForUser,
     GetSIPAccountsForOwnerDelegate getSIPAccountsForOwner,
     SIPAssetGetPropertyByIdDelegate <SIPAccount> getSipAccountPropertyExternal,
     SIPRegistrarBindingsCountDelegate getBindingsCount,
     bool switchboardSIPAccountsOnly
     )
     : base(log, sessionID, resourceURI, canonincalResourceURI, filter, subscriptionDialogue, expiry)
 {
     GetSIPAccountsForUser_External        = getSIPAccountsForUser;
     GetSIPAccountsForOwner_External       = getSIPAccountsForOwner;
     GetSipAccountProperty_External        = getSipAccountPropertyExternal;
     GetSIPRegistrarBindingsCount_External = getBindingsCount;
     Presence = new SIPEventPresence(resourceURI);
     m_switchboardSIPAccountsOnly = switchboardSIPAccountsOnly;
 }
 public SIPProvisioningWebService(
     SIPAssetPersistor <SIPAccount> sipAccountPersistor,
     SIPAssetPersistor <SIPDialPlan> sipDialPlanPersistor,
     SIPAssetPersistor <SIPProvider> sipProviderPersistor,
     SIPAssetPersistor <SIPProviderBinding> sipProviderBindingsPersistor,
     SIPAssetPersistor <SIPRegistrarBinding> sipRegistrarBindingsPersistor,
     SIPAssetPersistor <SIPDialogueAsset> sipDialoguePersistor,
     SIPAssetPersistor <SIPCDRAsset> sipCDRPersistor,
     CustomerSessionManager crmSessionManager,
     SIPDomainManager sipDomainManager,
     SIPMonitorLogDelegate log,
     int newCustomersAllowedLimit)
 {
     SIPAccountPersistor           = sipAccountPersistor;
     DialPlanPersistor             = sipDialPlanPersistor;
     SIPProviderPersistor          = sipProviderPersistor;
     SIPProviderBindingsPersistor  = sipProviderBindingsPersistor;
     SIPRegistrarBindingsPersistor = sipRegistrarBindingsPersistor;
     SIPDialoguePersistor          = sipDialoguePersistor;
     SIPCDRPersistor            = sipCDRPersistor;
     CRMCustomerPersistor       = crmSessionManager.CustomerPersistor;
     CRMSessionManager          = crmSessionManager;
     SIPDomainManager           = sipDomainManager;
     LogDelegate_External       = log;
     m_newCustomersAllowedLimit = newCustomersAllowedLimit;
 }
Example #3
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();
        }
        public SIPReferServerUserAgent(SIPTransport sipTransport, SIPMonitorLogDelegate logDelegate, SIPNonInviteTransaction sipTransaction)
        {
            m_sipTransport = sipTransport;
            Log_External = logDelegate;
            m_sipTransaction = sipTransaction;

            m_sipTransaction.TransactionTraceMessage += TransactionTraceMessage;
            m_sipTransaction.NonInviteTransactionTimedOut += ClientTimedOut;

            // If external logging is not required assign an empty handler to stop null reference exceptions.
            if (Log_External == null)
            {
                Log_External = (e) => { };
            }

            var referTo = SIPURI.ParseSIPURI(m_sipTransaction.TransactionRequest.Header.ReferTo);
            var replacesParameter = SIPReplacesParameter.Parse(referTo.Headers.Get("Replaces"));

            ReplacedCall = new ReplacesCallDescriptor();
            ReplacedCall.CallId = replacesParameter.CallID;
            ReplacedCall.FromTag = replacesParameter.FromTag;
            ReplacedCall.ToTag = replacesParameter.ToTag;

            ReferToUri = referTo.CopyOf();
            ReferToUri.Headers.RemoveAll();
        }
 public ProvisioningServiceInstanceProvider(
     SIPAssetPersistor <SIPAccount> sipAccountPersistor,
     SIPAssetPersistor <SIPDialPlan> sipDialPlanPersistor,
     SIPAssetPersistor <SIPProvider> sipProviderPersistor,
     SIPAssetPersistor <SIPProviderBinding> sipProviderBindingsPersistor,
     SIPAssetPersistor <SIPRegistrarBinding> sipRegistrarBindingsPersistor,
     SIPAssetPersistor <SIPDialogueAsset> sipDialoguePersistor,
     SIPAssetPersistor <SIPCDRAsset> sipCDRPersistor,
     CustomerSessionManager crmSessionManager,
     SIPDomainManager sipDomainManager,
     SIPMonitorLogDelegate log,
     int newCustomersAllowedLimit,
     bool inviteCodeRequired)
 {
     m_sipAccountPersistor           = sipAccountPersistor;
     m_sipDialPlanPersistor          = sipDialPlanPersistor;
     m_sipProviderPersistor          = sipProviderPersistor;
     m_sipProviderBindingsPersistor  = sipProviderBindingsPersistor;
     m_sipRegistrarBindingsPersistor = sipRegistrarBindingsPersistor;
     m_sipDialoguePersistor          = sipDialoguePersistor;
     m_sipCDRPersistor          = sipCDRPersistor;
     m_crmCustomerPersistor     = crmSessionManager.CustomerPersistor;
     m_crmSessionManager        = crmSessionManager;
     m_sipDomainManager         = sipDomainManager;
     m_logDelegate              = log;
     m_newCustomersAllowedLimit = newCustomersAllowedLimit;
     m_inviteCodeRequired       = inviteCodeRequired;
 }
        public SIPRegistrationUserAgent(
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            SIPEndPoint localEndPoint,
            SIPURI sipAccountAOR,
            string authUsername,
            string password,
            string realm,
            string registrarHost,
            SIPURI contactURI,
            int expiry,
            string owner,
            string adminMemberID,
            SIPMonitorLogDelegate logDelegate)
        {
            m_sipTransport  = sipTransport;
            m_outboundProxy = outboundProxy;
            m_localEndPoint = localEndPoint;
            m_sipAccountAOR = sipAccountAOR;
            m_authUsername  = authUsername;
            m_password      = password;
            m_realm         = realm;
            m_registrarHost = registrarHost;
            m_contactURI    = contactURI;
            m_expiry        = (expiry >= REGISTER_MINIMUM_EXPIRY && expiry <= MAX_EXPIRY) ? expiry : DEFAULT_REGISTER_EXPIRY;
            m_owner         = owner;
            m_callID        = Guid.NewGuid().ToString();

            Log_External = logDelegate;
        }
Example #7
0
        /// <summary>
        /// Creates a new SIP registration agent that will attempt to register with a SIP Registrar server.
        /// If the registration fails the agent will retry up to a hard coded maximum number of 3 attempts.
        /// If successful the agent will periodically refresh the registration based on the Expiry time
        /// returned by the server.
        /// </summary>
        /// <param name="sipTransport">The SIP transport layer to use to send the register request.</param>
        /// <param name="username">The username to use if the server requests authorisation.</param>
        /// <param name="password">The password to use if the server requests authorisation.</param>
        /// <param name="server">The hostname or socket address for the registration server. Can be in a format of
        /// hostname:port or ipaddress:port, e.g. sipsorcery.com or 67.222.131.147:5060.</param>
        /// <param name="expiry">The expiry value to request for the contact. This value can be rejected or overridden
        /// by the server.</param>
        public SIPRegistrationUserAgent(
            SIPTransport sipTransport,
            string username,
            string password,
            string server,
            int expiry,
            int maxRegistrationAttemptTimeout = DEFAULT_MAX_REGISTRATION_ATTEMPT_TIMEOUT,
            int registerFailureRetryInterval  = DEFAULT_REGISTER_FAILURE_RETRY_INTERVAL,
            int maxRegisterAttempts           = DEFAULT_MAX_REGISTER_ATTEMPTS)
        {
            m_sipTransport   = sipTransport;
            m_sipAccountAOR  = new SIPURI(username, server, null, SIPSchemesEnum.sip, SIPProtocolsEnum.udp);
            m_authUsername   = username;
            m_password       = password;
            m_registrarHost  = server;
            m_expiry         = (expiry >= REGISTER_MINIMUM_EXPIRY && expiry <= MAX_EXPIRY) ? expiry : DEFAULT_REGISTER_EXPIRY;
            m_originalExpiry = m_expiry;
            m_callID         = Guid.NewGuid().ToString();
            m_maxRegistrationAttemptTimeout = maxRegistrationAttemptTimeout;
            m_registerFailureRetryInterval  = registerFailureRetryInterval;
            m_maxRegisterAttempts           = maxRegisterAttempts;

            // Setting the contact to "0.0.0.0" tells the transport layer to populate it at send time.
            m_contactURI = new SIPURI(m_sipAccountAOR.Scheme, IPAddress.Any, 0);

            Log_External = (ev) => logger.LogDebug(ev?.Message);
        }
Example #8
0
        public SIPRegistrationUserAgent(
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            SIPURI sipAccountAOR,
            string authUsername,
            string password,
            string realm,
            string registrarHost,
            SIPURI contactURI,
            int expiry,
            SIPMonitorLogDelegate logDelegate)
        {
            m_sipTransport  = sipTransport;
            m_outboundProxy = outboundProxy;
            m_sipAccountAOR = sipAccountAOR;
            m_authUsername  = authUsername;
            m_password      = password;
            m_realm         = realm;
            m_registrarHost = registrarHost;
            m_contactURI    = contactURI;
            m_expiry        = (expiry >= REGISTER_MINIMUM_EXPIRY && expiry <= MAX_EXPIRY) ? expiry : DEFAULT_REGISTER_EXPIRY;
            m_callID        = CallProperties.CreateNewCallId();

            if (logDelegate != null)
            {
                Log_External = logDelegate;
            }
            else
            {
                Log_External = (ev) => logger.LogDebug(ev?.Message);
            }
        }
        public SIPProvisioningWebService(
            SIPAssetPersistor <SIPAccount> sipAccountPersistor,
            SIPAssetPersistor <SIPDialPlan> sipDialPlanPersistor,
            SIPAssetPersistor <SIPProvider> sipProviderPersistor,
            SIPAssetPersistor <SIPProviderBinding> sipProviderBindingsPersistor,
            SIPAssetPersistor <SIPRegistrarBinding> sipRegistrarBindingsPersistor,
            SIPAssetPersistor <SIPDialogueAsset> sipDialoguePersistor,
            SIPAssetPersistor <SIPCDRAsset> sipCDRPersistor,
            CustomerSessionManager crmSessionManager,
            SIPDomainManager sipDomainManager,
            SIPMonitorLogDelegate log,
            int newCustomersAllowedLimit,
            bool inviteCodeRequired) :
            base(crmSessionManager)
        {
            SIPAccountPersistor           = sipAccountPersistor;
            DialPlanPersistor             = sipDialPlanPersistor;
            SIPProviderPersistor          = sipProviderPersistor;
            SIPProviderBindingsPersistor  = sipProviderBindingsPersistor;
            SIPRegistrarBindingsPersistor = sipRegistrarBindingsPersistor;
            SIPDialoguePersistor          = sipDialoguePersistor;
            SIPCDRPersistor            = sipCDRPersistor;
            SIPDomainManager           = sipDomainManager;
            LogDelegate_External       = log;
            m_newCustomersAllowedLimit = newCustomersAllowedLimit;
            m_inviteCodeRequired       = inviteCodeRequired;

            if (!String.IsNullOrEmpty(m_providerRegistrationsDisabled))
            {
                Boolean.TryParse(m_providerRegistrationsDisabled, out m_providerRegDisabled);
            }

            //SIPSorcery.Entities.Services.SIPEntitiesDomainService domainSvc = new Entities.Services.SIPEntitiesDomainService();
        }
Example #10
0
        public ScriptLoader(
            SIPMonitorLogDelegate monitorLogger,
            string scriptPath)
        {
            try
            {
                m_monitorLogger = monitorLogger ?? m_monitorLogger;
                m_scriptPath = scriptPath;

                // File system watcher needs a fully qualified path.
                if (!m_scriptPath.Contains(Path.DirectorySeparatorChar.ToString()))
                {
                    m_scriptPath = Environment.CurrentDirectory + Path.DirectorySeparatorChar + m_scriptPath;
                }

                if (!File.Exists(m_scriptPath))
                {
                    throw new ApplicationException("Cannot load script file was not found at " + m_scriptPath + ".");
                }

                FileSystemWatcher runtimeWatcher = new FileSystemWatcher(Path.GetDirectoryName(m_scriptPath), Path.GetFileName(m_scriptPath));
                runtimeWatcher.Changed += new FileSystemEventHandler(ScriptChanged);
                runtimeWatcher.EnableRaisingEvents = true;
            }
            catch (Exception excp)
            {
                logger.Error("Exception ScriptLoader (ctor). " + excp.Message);
                throw excp;
            }
        }
        //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 SIPNotifierClient(
     SIPMonitorLogDelegate logDelegate,
     SIPTransport sipTransport,
     SIPEndPoint outboundProxy,
     SIPEventPackage sipEventPackage,
     SIPURI resourceURI,
     string authUsername,
     string authDomain,
     string authPassword,
     int expiry,
     string filter)
 {
     Log_External          = logDelegate;
     m_sipTransport        = sipTransport;
     m_outboundProxy       = outboundProxy;
     m_sipEventPackage     = sipEventPackage;
     m_authUsername        = authUsername;
     m_authDomain          = authDomain;
     m_authPassword        = authPassword;
     m_expiry              = (expiry > 0) ? expiry : DEFAULT_SUBSCRIBE_EXPIRY;
     m_filter              = filter;
     m_resourceURI         = resourceURI.CopyOf();
     m_subscribeCallID     = CallProperties.CreateNewCallId();
     m_subscriptionFromTag = CallProperties.CreateNewTag();
 }
Example #13
0
        public SIPNonInviteServerUserAgent(
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            string sipUsername,
            string sipDomain,
            SIPCallDirection callDirection,
            SIPAssetGetDelegate <SIPAccount> getSIPAccount,
            SIPAuthenticateRequestDelegate sipAuthenticateRequest,
            SIPMonitorLogDelegate logDelegate,
            SIPNonInviteTransaction transaction)
        {
            m_sipTransport                  = sipTransport;
            m_outboundProxy                 = outboundProxy;
            m_sipUsername                   = sipUsername;
            m_sipDomain                     = sipDomain;
            m_sipCallDirection              = callDirection;
            GetSIPAccount_External          = getSIPAccount;
            SIPAuthenticateRequest_External = sipAuthenticateRequest;
            Log_External                    = logDelegate ?? Log_External;
            m_transaction                   = transaction;

            m_transaction.TransactionTraceMessage += TransactionTraceMessage;
            //m_uasTransaction.UASInviteTransactionTimedOut += ClientTimedOut;
            //m_uasTransaction.UASInviteTransactionCancelled += UASTransactionCancelled;
            //m_uasTransaction.TransactionRemoved += new SIPTransactionRemovedDelegate(UASTransaction_TransactionRemoved);
            //m_uasTransaction.TransactionStateChanged += (t) => { logger.Debug("Transaction state change to " + t.TransactionState + ", uri=" + t.TransactionRequestURI.ToString() + "."); };
        }
        public SIPServerUserAgent(
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            string sipUsername,
            string sipDomain,
            SIPCallDirection callDirection,
            GetSIPAccountDelegate getSIPAccount,
            SIPAuthenticateRequestDelegate sipAuthenticateRequest,
            SIPMonitorLogDelegate logDelegate,
            UASInviteTransaction uasTransaction)
        {
            m_sipTransport                  = sipTransport;
            m_outboundProxy                 = outboundProxy;
            m_sipUsername                   = sipUsername;
            m_sipDomain                     = sipDomain;
            CallDirection                   = callDirection;
            GetSIPAccount_External          = getSIPAccount;
            SIPAuthenticateRequest_External = sipAuthenticateRequest;
            Log_External                    = logDelegate ?? Log_External;
            m_uasTransaction                = uasTransaction;

            m_uasTransaction.TransactionTraceMessage       += TransactionTraceMessage;
            m_uasTransaction.UASInviteTransactionTimedOut  += ClientTimedOut;
            m_uasTransaction.UASInviteTransactionCancelled += UASTransactionCancelled;
            m_uasTransaction.TransactionRemoved            += new SIPTransactionRemovedDelegate(UASTransaction_TransactionRemoved);
        }
        public SIPNonInviteServerUserAgent(
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            string sipUsername,
            string sipDomain,
            SIPCallDirection callDirection,
            SIPAssetGetDelegate<SIPAccount> getSIPAccount,
            SIPAuthenticateRequestDelegate sipAuthenticateRequest,
            SIPMonitorLogDelegate logDelegate,
            SIPNonInviteTransaction transaction)
        {
            m_sipTransport = sipTransport;
            m_outboundProxy = outboundProxy;
            m_sipUsername = sipUsername;
            m_sipDomain = sipDomain;
            m_sipCallDirection = callDirection;
            GetSIPAccount_External = getSIPAccount;
            SIPAuthenticateRequest_External = sipAuthenticateRequest;
            Log_External = logDelegate ?? Log_External;
            m_transaction = transaction;

            m_transaction.TransactionTraceMessage += TransactionTraceMessage;
            //m_uasTransaction.UASInviteTransactionTimedOut += ClientTimedOut;
            //m_uasTransaction.UASInviteTransactionCancelled += UASTransactionCancelled;
            //m_uasTransaction.TransactionRemoved += new SIPTransactionRemovedDelegate(UASTransaction_TransactionRemoved);
            //m_uasTransaction.TransactionStateChanged += (t) => { logger.Debug("Transaction state change to " + t.TransactionState + ", uri=" + t.TransactionRequestURI.ToString() + "."); };
        }
        //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);
        }
Example #17
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;
            }
        }
Example #18
0
        public ScriptLoader(
            SIPMonitorLogDelegate monitorLogger,
            string scriptPath)
        {
            try
            {
                m_monitorLogger = monitorLogger ?? m_monitorLogger;
                m_scriptPath    = scriptPath;

                // File system watcher needs a fully qualified path.
                if (!m_scriptPath.Contains(Path.DirectorySeparatorChar.ToString()))
                {
                    m_scriptPath = Environment.CurrentDirectory + Path.DirectorySeparatorChar + m_scriptPath;
                }

                if (!File.Exists(m_scriptPath))
                {
                    throw new ApplicationException("Cannot load script file was not found at " + m_scriptPath + ".");
                }

                FileSystemWatcher runtimeWatcher = new FileSystemWatcher(Path.GetDirectoryName(m_scriptPath), Path.GetFileName(m_scriptPath));
                runtimeWatcher.Changed            += new FileSystemEventHandler(ScriptChanged);
                runtimeWatcher.EnableRaisingEvents = true;
            }
            catch (Exception excp)
            {
                logger.Error("Exception ScriptLoader (ctor). " + excp.Message);
                throw excp;
            }
        }
Example #19
0
 public RTCCCore(
     SIPMonitorLogDelegate logDelegate,
     SIPDialogueManager sipDialogueManager,
     SIPAssetPersistor <SIPDialogueAsset> sipDialoguePersistor)
 {
     Log_External           = logDelegate;
     m_sipDialogueManager   = sipDialogueManager;
     m_sipDialoguePersistor = sipDialoguePersistor;
 }
Example #20
0
 public RTCCCore(
     SIPMonitorLogDelegate logDelegate,
     SIPDialogueManager sipDialogueManager,
     SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor)
 {
     Log_External = logDelegate;
     m_sipDialogueManager = sipDialogueManager;
     m_sipDialoguePersistor = sipDialoguePersistor;
 }
 public GoogleVoiceSMS(
     SIPMonitorLogDelegate logDelegate,
     string username,
     string adminMemberId)
 {
     Log_External    = logDelegate;
     m_username      = username;
     m_adminMemberId = adminMemberId;
 }
Example #22
0
        private byte[] m_sendBuffer = new byte[] { 0x0, 0x0, 0x0, 0x0 };    // Doesn't matter what is sent since it's just to keep the NAT connection alive.

        /// <param name="listenerSocket">Socket to listen for NAT keepalive relay requests on.</param>
        public NATKeepAliveRelay(SIPTransport sipTransport, IPEndPoint listenerSocket, SIPMonitorLogDelegate sipMonitorLogDelegate)
        {
            m_sipTransport        = sipTransport;
            m_natKeepAliveChannel = new SIPUDPChannel(listenerSocket);
            m_natKeepAliveChannel.SIPMessageReceived += NatKeepAliveChannelMessageReceived;
            SIPMonitorLog_External = sipMonitorLogDelegate;

            logger.Debug("NATKeepAlive Relay instantiated on " + listenerSocket + ".");
        }
Example #23
0
 public GoogleVoiceSMS(
     SIPMonitorLogDelegate logDelegate,
     string username,
     string adminMemberId)
 {
     Log_External = logDelegate;
     m_username = username;
     m_adminMemberId = adminMemberId;
 }
 public SIPProxyScriptFacade(
     SIPMonitorLogDelegate proxyLogger,
     SIPTransport sipTransport,
     SIPProxyDispatcher dispatcher,
     GetAppServerDelegate getAppServer)
 {
     m_proxyLogger         = proxyLogger;
     m_sipTransport        = sipTransport;
     m_dispatcher          = dispatcher;
     GetAppServer_External = getAppServer;
 }
 public SIPProxyScriptFacade(
     SIPMonitorLogDelegate proxyLogger,
     SIPTransport sipTransport,
     SIPProxyDispatcher dispatcher,
     GetAppServerDelegate getAppServer)
 {
     m_proxyLogger = proxyLogger;
     m_sipTransport = sipTransport;
     m_dispatcher = dispatcher;
     GetAppServer_External = getAppServer;
 }
 public GoogleVoiceUserAgent(
     SIPTransport sipTransport,
     ISIPCallManager callManager,
     SIPMonitorLogDelegate logDelegate,
     string username,
     string adminMemberId,
     SIPEndPoint outboundProxy)
 {
     Owner = username;
     AdminMemberId = adminMemberId;
     m_googleVoiceCall = new GoogleVoiceCall(sipTransport, callManager, logDelegate, username, adminMemberId, outboundProxy);
     m_googleVoiceCall.CallProgress += new CallProgressDelegate(CallProgress);
 }
Example #27
0
 public SIPRegistrarBindingsManager(
     SIPMonitorLogDelegate sipMonitorEventLog,
     SIPAssetPersistor <SIPRegistrarBinding> bindingsPersistor,
     SendNATKeepAliveDelegate sendNATKeepAlive,
     int maxBindingsPerAccount,
     SIPUserAgentConfigurationManager userAgentConfigs)
 {
     SIPMonitorEventLog_External = sipMonitorEventLog;
     m_bindingsPersistor         = bindingsPersistor;
     SendNATKeepAlive_External   = sendNATKeepAlive;
     m_maxBindingsPerAccount     = (maxBindingsPerAccount != 0) ? maxBindingsPerAccount : DEFAULT_BINDINGS_PER_USER;
     m_userAgentConfigs          = userAgentConfigs;
 }
        private List <string> m_workerSIPEndPoints           = new List <string>();                 // Allow quick lookups to determine whether a remote end point is that of a worker process.

        public SIPAppServerManager(
            SIPMonitorLogDelegate logDelegate,
            SIPTransport sipTransport,
            XmlNode appServerWorkersNode,
            string appServerEndPointsPath)
        {
            if (appServerWorkersNode == null || appServerWorkersNode.ChildNodes.Count == 0)
            {
                throw new ArgumentNullException("A SIPAppServerManager cannot be created with an empty workers node.");
            }

            SIPMonitorLogEvent_External = logDelegate;
            m_sipTransport           = sipTransport;
            m_appServerWorkersNode   = appServerWorkersNode;
            m_appServerEndPointsPath = appServerEndPointsPath;

            if (!appServerEndPointsPath.IsNullOrBlank() && File.Exists(appServerEndPointsPath))
            {
                m_sipCallDispatcherFile = new SIPCallDispatcherFile(logDelegate, appServerEndPointsPath);
            }

            try
            {
                CallManagerPassThruServiceInstanceProvider callManagerPassThruSvcInstanceProvider = new CallManagerPassThruServiceInstanceProvider(this);
                m_callManagerPassThruSvcHost = new ServiceHost(typeof(CallManagerPassThruService));
                m_callManagerPassThruSvcHost.Description.Behaviors.Add(callManagerPassThruSvcInstanceProvider);
                m_callManagerPassThruSvcHost.Open();

                logger.Debug("SIPAppServerManager CallManagerPassThru hosted service successfully started on " + m_callManagerPassThruSvcHost.BaseAddresses[0].AbsoluteUri + ".");
            }
            catch (Exception excp)
            {
                logger.Warn("Exception starting SIPAppServerManager CallManagerPassThru hosted service. " + excp.Message);
            }

            foreach (XmlNode appServerWorkerNode in m_appServerWorkersNode.ChildNodes)
            {
                SIPAppServerWorker appServerWorker = new SIPAppServerWorker(appServerWorkerNode);
                if (m_sipCallDispatcherFile != null)
                {
                    appServerWorker.Healthy   += WorkerIsHealthy;
                    appServerWorker.Unhealthy += WorkerIsUnhealthy;
                }
                m_appServerWorkers.Add(appServerWorker);
                m_workerSIPEndPoints.Add(appServerWorker.AppServerEndpoint.ToString());
                logger.Debug("SIPAppServerManager worker added for " + appServerWorker.AppServerEndpoint.ToString() + " and " + appServerWorker.CallManagerAddress.ToString() + ".");
            }

            ThreadPool.QueueUserWorkItem(delegate { SpawnWorkers(); });
            ThreadPool.QueueUserWorkItem(delegate { ProbeWorkers(); });
        }
Example #29
0
 public GoogleVoiceUserAgent(
     SIPTransport sipTransport,
     ISIPCallManager callManager,
     SIPMonitorLogDelegate logDelegate,
     string username,
     string adminMemberId,
     SIPEndPoint outboundProxy)
 {
     Owner             = username;
     AdminMemberId     = adminMemberId;
     Log_External      = logDelegate;
     m_googleVoiceCall = new GoogleVoiceCall(sipTransport, callManager, logDelegate, username, adminMemberId, outboundProxy);
     m_googleVoiceCall.CallProgress += new CallProgressDelegate(CallProgress);
 }
        /// <summary>
        /// Mangles private IP addresses in a SIP request replacing them with the IP address the packet was received on.
        /// </summary>
        /// <param name="sipRequest">The unmangled SIP request.</param>
        /// <returns>The mangled SIP request</returns>
        public static void MangleSIPRequest(SIPMonitorServerTypesEnum server, SIPRequest sipRequest, string username,
                                            SIPMonitorLogDelegate logDelegate)
        {
            try
            {
                string bottomViaIPAddress = sipRequest.Header.Vias.BottomViaHeader.ReceivedFromIPAddress;

                if (sipRequest.Header.Contact != null && sipRequest.Header.Contact.Count == 1 &&
                    bottomViaIPAddress != null)
                {
                    string contactHost = sipRequest.Header.Contact[0].ContactURI.Host;

                    // Only mangle if the host is a private IP address and there is something to change.
                    // For example the server could be on the same private subnet in which case it can't help.
                    if (IPSocket.IsPrivateAddress(contactHost) && contactHost != bottomViaIPAddress)
                    {
                        string origContact = sipRequest.Header.Contact[0].ContactURI.Host;
                        sipRequest.Header.Contact[0].ContactURI.Host =
                            sipRequest.Header.Vias.BottomViaHeader.ReceivedFromAddress;

                        //logger.LogDebug("Contact URI identified as containing private address for " + sipRequest.Method + " " + origContact + " adjusting to use bottom via " + bottomViaHost + ".");
                        //FireProxyLogEvent(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.Registrar, SIPMonitorServerTypesEnum.ContactRegisterInProgress, "Contact on " + sipRequest.Method + " " + origContact + " had private address adjusted to " + bottomViaHost + ".", username));
                    }
                }

                if (sipRequest.Body != null && bottomViaIPAddress != null)
                {
                    bool   wasMangled = false;
                    string mangledSDP = MangleSDP(sipRequest.Body, bottomViaIPAddress, out wasMangled);

                    if (wasMangled)
                    {
                        sipRequest.Body = mangledSDP;
                        sipRequest.Header.ContentLength = sipRequest.Body.Length;

                        if (logDelegate != null)
                        {
                            logDelegate(new SIPMonitorConsoleEvent(server, SIPMonitorEventTypesEnum.DialPlan,
                                                                   "SDP mangled for " + sipRequest.Method.ToString() + " request from " +
                                                                   sipRequest.RemoteSIPEndPoint.ToString() + ", adjusted address " + bottomViaIPAddress +
                                                                   ".", username));
                        }
                    }
                }
            }
            catch (Exception excp)
            {
                Logger.Logger.Error("Exception MangleSIPRequest. ->" + excp.Message);
            }
        }
Example #31
0
        //private SIPAccount m_destinationSIPAccount;

        public SIPB2BUserAgent(
            SIPMonitorLogDelegate logDelegate,
            QueueNewCallDelegate queueCall,
            SIPTransport sipTranpsort,
            string uacOwner,
            string uacAdminMemberId
            )
        {
            Log_External          = logDelegate;
            QueueNewCall_External = queueCall;
            m_sipTransport        = sipTranpsort;
            m_uacOwner            = uacOwner;
            m_uacAdminMemberId    = uacAdminMemberId;
        }
 public DialPlanScriptContext(
     SIPMonitorLogDelegate monitorLogDelegate,
     SIPTransport sipTransport,
     DialogueBridgeCreatedDelegate createBridge,
     SIPEndPoint outboundProxy,
     ISIPServerUserAgent sipServerUserAgent,
     SIPDialPlan dialPlan,
     List <SIPProvider> sipProviders,
     string traceDirectory,
     string callersNetworkId,
     Guid customerId)
     : base(monitorLogDelegate, sipTransport, createBridge, outboundProxy, sipServerUserAgent, dialPlan, sipProviders, traceDirectory, callersNetworkId, customerId)
 {
     ContextType = DialPlanContextsEnum.Script;
 }
        public Action Cleanup;  // A function delegate that will be called when the script is completed to allow any cleanup actions to take place.

        public DialPlanExecutingScript(SIPMonitorLogDelegate logDelegate)
        {
            ScriptNumber = ++ScriptCounter % Int32.MaxValue;
            Id = Guid.NewGuid();

            var setup = ScriptRuntimeSetup.ReadConfiguration();
            var scriptRuntime = Ruby.CreateRuntime(setup);
            DialPlanScriptEngine = Ruby.GetEngine(scriptRuntime);

            //DialPlanScriptEngine = Ruby.CreateEngine();

            DialPlanScriptScope = DialPlanScriptEngine.CreateScope();

            LogDelegate = logDelegate;
        }
Example #34
0
 /// <summary>
 /// See overload.
 /// </summary>
 /// <param name="switchCallTransactions">An empty list that will be filled with transactions that the ForkCall creates and that each
 /// represent an outgoing call. The calling object can use the list to check response codes to determine the result of each leg in the
 /// ForkCall.</param>
 public ForkCall(
     SIPTransport sipTransport,
     SIPMonitorLogDelegate statefulProxyLogEvent,
     QueueNewCallDelegate queueNewCall,
     DialStringParser dialStringParser,
     string username,
     string adminMemberId,
     SIPEndPoint outboundProxy,
     ISIPCallManager callManager,
     DialPlanContext dialPlanContext,
     out List <SIPTransaction> switchCallTransactions) :
     this(sipTransport, statefulProxyLogEvent, queueNewCall, dialStringParser, username, adminMemberId, outboundProxy, callManager, dialPlanContext)
 {
     switchCallTransactions = m_switchCallTransactions;
 }
Example #35
0
        public JingleUserAgent(
            string owner,
            string adminMemberId,
            SIPMonitorLogDelegate logDelegate)
        {
            Owner         = owner;
            AdminMemberId = adminMemberId;
            Log_External  = logDelegate;

            // If external logging is not required assign an empty handler to stop null reference exceptions.
            if (Log_External == null)
            {
                Log_External = (e) => { };
            }
        }
          public JingleUserAgent(
            string owner,
            string adminMemberId,
            SIPMonitorLogDelegate logDelegate)
        {
            Owner = owner;
            AdminMemberId = adminMemberId;
            Log_External = logDelegate;

            // If external logging is not required assign an empty handler to stop null reference exceptions.
            if (Log_External == null)
            {
                Log_External = (e) => { };
            }
        }
Example #37
0
 public GoogleVoiceCall(
     SIPTransport sipTransport,
     ISIPCallManager callManager,
     SIPMonitorLogDelegate logDelegate,
     string username,
     string adminMemberId,
     SIPEndPoint outboundProxy)
 {
     m_sipTransport  = sipTransport;
     m_callManager   = callManager;
     Log_External    = logDelegate;
     m_username      = username;
     m_adminMemberId = adminMemberId;
     m_outboundProxy = outboundProxy;
 }
 public DialPlanScriptContext(           
     SIPMonitorLogDelegate monitorLogDelegate,
     SIPTransport sipTransport,
     DialogueBridgeCreatedDelegate createBridge,
     SIPEndPoint outboundProxy,
     ISIPServerUserAgent sipServerUserAgent,
     SIPDialPlan dialPlan,
     List<SIPProvider> sipProviders,
     string traceDirectory,
     string callersNetworkId,
     Guid customerId)
     : base(monitorLogDelegate, sipTransport, createBridge, outboundProxy, sipServerUserAgent, dialPlan, sipProviders, traceDirectory, callersNetworkId, customerId)
 {
     ContextType = DialPlanContextsEnum.Script;
 }
        public SIPNonInviteClientUserAgent(
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            SIPCallDescriptor callDescriptor,
            string owner,
            string adminMemberID,
            SIPMonitorLogDelegate logDelegate)
        {
            m_sipTransport   = sipTransport;
            m_outboundProxy  = outboundProxy;
            m_callDescriptor = callDescriptor;
            m_owner          = owner;
            m_adminMemberID  = adminMemberID;

            Log_External = logDelegate;
        }
        public SIPNonInviteClientUserAgent(
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            SIPCallDescriptor callDescriptor,
            string owner,
            string adminMemberID,
            SIPMonitorLogDelegate logDelegate)
        {
            m_sipTransport = sipTransport;
            m_outboundProxy = outboundProxy;
            m_callDescriptor = callDescriptor;
            m_owner = owner;
            m_adminMemberID = adminMemberID;

            Log_External = logDelegate;
        }
        public Action Cleanup;  // A function delegate that will be called when the script is completed to allow any cleanup actions to take place.

        public DialPlanExecutingScript(SIPMonitorLogDelegate logDelegate)
        {
            ScriptNumber = ++ScriptCounter % Int32.MaxValue;
            Id           = Guid.NewGuid();

            var setup         = ScriptRuntimeSetup.ReadConfiguration();
            var scriptRuntime = Ruby.CreateRuntime(setup);

            DialPlanScriptEngine = Ruby.GetEngine(scriptRuntime);

            //DialPlanScriptEngine = Ruby.CreateEngine();

            DialPlanScriptScope = DialPlanScriptEngine.CreateScope();

            LogDelegate = logDelegate;
        }
        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); });
        }
 public CallbackApp(
     SIPTransport sipTransport, 
     ISIPCallManager callManager,
     DialStringParser dialStringParser, 
     SIPMonitorLogDelegate logDelegate, 
     string username,
     string adminMemberId,
     SIPEndPoint outboundProxy)
 {
     m_sipTransport = sipTransport;
     m_callManager = callManager;
     m_dialStringParser = dialStringParser;
     Log_External = logDelegate;
     m_username = username;
     m_adminMemberId = adminMemberId;
     m_outboundProxy = outboundProxy;
 }
 public DialPlanLineContext(
     SIPMonitorLogDelegate monitorLogDelegate,
     SIPTransport sipTransport,
     DialogueBridgeCreatedDelegate createBridge,
     SIPEndPoint outboundProxy,
     ISIPServerUserAgent sipServerUserAgent,
     SIPDialPlan dialPlan,
     List<SIPProvider> sipProviders,
     string traceDirectory,
     string callersNetworkId,
     Customer customer)
     : base(monitorLogDelegate, sipTransport, createBridge, outboundProxy, sipServerUserAgent, dialPlan, sipProviders, traceDirectory, callersNetworkId, customer, null, null)
 {
     ContextType = DialPlanContextsEnum.Line;
      string[] dialPlanEntries = dialPlan.DialPlanScript.Split(new char[] { '\n' });
      ParseDialPlan(dialPlanEntries);
 }
 public SIPEventSubscription(
     SIPMonitorLogDelegate log,
     string sessionID,
     SIPURI resourceURI,
     SIPURI canonicalResourceURI,
     string filter,
     SIPDialogue subscriptionDialogue,
     int expiry)
 {
     MonitorLogEvent_External = log;
     SessionID = sessionID;
     ResourceURI = resourceURI;
     CanonicalResourceURI = canonicalResourceURI;
     Filter = filter;
     SubscriptionDialogue = subscriptionDialogue;
     Expiry = expiry;
 }
 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);
 }
Example #47
0
 public SIPEventSubscription(
     SIPMonitorLogDelegate log,
     string sessionID,
     SIPURI resourceURI,
     SIPURI canonicalResourceURI,
     string filter,
     SIPDialogue subscriptionDialogue,
     int expiry)
 {
     MonitorLogEvent_External = log;
     SessionID            = sessionID;
     ResourceURI          = resourceURI;
     CanonicalResourceURI = canonicalResourceURI;
     Filter = filter;
     SubscriptionDialogue = subscriptionDialogue;
     Expiry = expiry;
 }
        public IPAddress PublicIPAddress;       // Can be set if there is an object somewhere that knows the public IP. The address wil be available in the proxy runtime script.

        public SIPProxyCore(
            SIPMonitorLogDelegate proxyLogger,
            SIPTransport sipTransport,
            string scriptPath,
            string appServerEndPointsPath)
        {
            try
            {
                m_proxyLogger = proxyLogger ?? m_proxyLogger;
                m_scriptPath = scriptPath;
                m_sipTransport = sipTransport;

                if (!appServerEndPointsPath.IsNullOrBlank() && File.Exists(appServerEndPointsPath))
                {
                    m_sipCallDispatcherFile = new SIPCallDispatcherFile(SendMonitorEvent, appServerEndPointsPath);
                    m_sipCallDispatcherFile.LoadAndWatch();
                }
                else
                {
                    logger.Warn("No call dispatcher file specified for SIP Proxy.");
                }

                m_proxyDispatcher = new SIPProxyDispatcher(new SIPMonitorLogDelegate(SendMonitorEvent));
                GetAppServerDelegate getAppServer = (m_sipCallDispatcherFile != null) ? new GetAppServerDelegate(m_sipCallDispatcherFile.GetAppServer) : null;
                m_proxyScriptFacade = new SIPProxyScriptFacade(
                    new SIPMonitorLogDelegate(SendMonitorEvent),         // Don't use the m_proxyLogger delegate directly here as doing so caused stack overflow exceptions in the IronRuby engine.
                    sipTransport,
                    m_proxyDispatcher,
                    getAppServer);

                m_scriptLoader = new ScriptLoader(SendMonitorEvent, m_scriptPath);
                m_scriptLoader.ScriptFileChanged += (s, e) => { m_compiledScript = m_scriptLoader.GetCompiledScript(); };
                m_compiledScript = m_scriptLoader.GetCompiledScript();

                // Events that pass the SIP requests and responses onto the Stateless Proxy Core.
                m_sipTransport.SIPTransportRequestReceived += GotRequest;
                m_sipTransport.SIPTransportResponseReceived += GotResponse;
            }
            catch (Exception excp)
            {
                logger.Error("Exception SIPProxyCore (ctor). " + excp.Message);
                throw excp;
            }
        }
        public SIPReferClientUserAgent(
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            string owner,
            string adminMemberId,
            SIPMonitorLogDelegate logDelegate)
        {
            m_sipTransport = sipTransport;
            m_outboundProxy = (outboundProxy != null) ? SIPEndPoint.ParseSIPEndPoint(outboundProxy.ToString()) : null;
            Owner = owner;
            AdminMemberId = adminMemberId;
            Log_External = logDelegate;

            // If external logging is not required assign an empty handler to stop null reference exceptions.
            if (Log_External == null)
            {
                Log_External = (e) => { };
            }
        }
 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;
 }
 public SIPPresenceEventSubscription(
     SIPMonitorLogDelegate log,
     string sessionID,
     SIPURI resourceURI,
     SIPURI canonincalResourceURI,
     string filter,
     SIPDialogue subscriptionDialogue,
     int expiry,
     SIPAssetPersistor<SIPAccount> sipAccountPersistor,
     SIPAssetCountDelegate<SIPRegistrarBinding> getBindingsCount,
     bool switchboardSIPAccountsOnly
     )
     : base(log, sessionID, resourceURI, canonincalResourceURI, filter, subscriptionDialogue, expiry)
 {
     m_sipAccountPersistor = sipAccountPersistor;
     GetSIPRegistrarBindingsCount_External = getBindingsCount;
     Presence = new SIPEventPresence(resourceURI);
     m_switchboardSIPAccountsOnly = switchboardSIPAccountsOnly;
 }
        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;
        }
 public SIPTransferServerUserAgent(            
     SIPMonitorLogDelegate logDelegate,
     BlindTransferDelegate blindTransfer,
     SIPTransport sipTransport,
     SIPEndPoint outboundProxy,
     SIPDialogue dialogueToReplace,
     SIPDialogue oppositeDialogue,
     string callDestination,
     string owner,
     string adminID)
 {
     Log_External = logDelegate;
     BlindTransfer_External = blindTransfer;
     m_sipTransport = sipTransport;
     m_outboundProxy = outboundProxy;
     m_dialogueToReplace = dialogueToReplace;
     m_oppositeDialogue = oppositeDialogue;
     m_callDestination = callDestination;
     m_owner = owner;
     m_adminID = adminID;
     m_dummyRequest = CreateDummyRequest(m_dialogueToReplace, m_callDestination);
 }
Example #54
0
 public RateBulkUpdater(SIPMonitorLogDelegate logDelegate)
 {
     Log_External = logDelegate;
 }
Example #55
0
 /// <summary>
 /// See overload.
 /// </summary>
 /// <param name="switchCallTransactions">An empty list that will be filled with transactions that the ForkCall creates and that each
 /// represent an outgoing call. The calling object can use the list to check response codes to determine the result of each leg in the
 /// ForkCall.</param>
 public ForkCall(
     SIPTransport sipTransport,
     SIPMonitorLogDelegate statefulProxyLogEvent,
     QueueNewCallDelegate queueNewCall,
     DialStringParser dialStringParser,
     string username,
     string adminMemberId,
     SIPEndPoint outboundProxy,
     ISIPCallManager callManager,
     DialPlanContext dialPlanContext,
     out List<SIPTransaction> switchCallTransactions)
     : this(sipTransport, statefulProxyLogEvent, queueNewCall, dialStringParser, username, adminMemberId, outboundProxy, callManager, dialPlanContext)
 {
     switchCallTransactions = m_switchCallTransactions;
 }
Example #56
0
        private QueueNewCallDelegate QueueNewCall_External; // Function delegate to allow new calls to be placed on the call manager and run through the dialplan logic.

        #endregion Fields

        #region Constructors

        /// <remarks>
        /// The ForkCall allows a SIP call to be forked to multiple destinations. To do this it utilises multiple
        /// simultaneous SIPCallDescriptor objects and consolidates their responses to work out what should and shouldn't
        /// be forwarded onto the client that initiated the call. The ForkCall acts as a classic SIP forking proxy.
        /// 
        /// The ForkCall is capable of both multiple forwards and also of follow on forwarding in the event of a call 
        /// leg of multiple forwards not succeeding. As an example:
        /// 
        ///     Dial(provider1&provider2|provider3&provider4|provider5&provider6)
        ///     
        /// The handling of this call would be:
        /// 1. The call would be simultaneously forwarded to provider1 and provider2,
        /// 2. If the call was not successfully answered in step 1 the  call would be simultaneously forwarded to provider3 and provider4,
        /// 3. If the call was not successfully answered in step 2 the  call would be simultaneously forwarded to provider5 and provider6,
        /// 4. If the call was not successfully answered in step 3 the client call would be sent an error response.
        /// 5. If the client cancels the call at any time during the call all forwarding operations will halt.
        /// </remarks>
        /// <param name="sipTransport">The SIP transport layer that will handle the forked calls.</param>
        /// <param name="statefulProxyLogEvent">A delegate that allows the owning object to receive notifications from the ForkCall.</param>
        /// <param name="queueNewCall">A delegate that can be used to queue a new call with the SIP application server call manager. This
        /// delegate is used when a fork call generates a B2B call that requires the incoming dialplan for a called user to be processed.</param>
        /// <param name="dialStringParser">The dial string parser is used when a redirect response is received on a forked call leg. The
        /// parser can then be applied to the redirect SIP URI to generate new call legs to be added to the ForkCall.</param>
        /// <param name="username">The username of the call owner.</param>
        /// <param name="adminMemberId">The admin ID of the call owner.</param>
        /// <param name="outboundProxy">The outbound proxy to use for all SIP traffic originated. Can be null if an outbound proxy is not 
        /// being used.</param>
        public ForkCall(
            SIPTransport sipTransport,
            SIPMonitorLogDelegate statefulProxyLogEvent,
            QueueNewCallDelegate queueNewCall,
            DialStringParser dialStringParser,
            string username,
            string adminMemberId,
            SIPEndPoint outboundProxy,
            ISIPCallManager callManager,
            DialPlanContext dialPlanContext)
        {
            m_sipTransport = sipTransport;
            m_statefulProxyLogEvent = statefulProxyLogEvent;
            QueueNewCall_External = queueNewCall;
            m_dialStringParser = dialStringParser;
            m_username = username;
            m_adminMemberId = adminMemberId;
            m_outboundProxySocket = outboundProxy;
            m_callManager = callManager;
            m_dialPlanContext = dialPlanContext;
        }
        public ProvisioningServiceInstanceProvider(
            SIPAssetPersistor<SIPAccount> sipAccountPersistor,
            SIPAssetPersistor<SIPDialPlan> sipDialPlanPersistor,
            SIPAssetPersistor<SIPProvider> sipProviderPersistor,
            SIPAssetPersistor<SIPProviderBinding> sipProviderBindingsPersistor,
            SIPAssetPersistor<SIPRegistrarBinding> sipRegistrarBindingsPersistor,
            SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor,
            SIPAssetPersistor<SIPCDRAsset> sipCDRPersistor,
            CustomerSessionManager crmSessionManager,
            SIPDomainManager sipDomainManager,
            SIPMonitorLogDelegate log,
            int newCustomersAllowedLimit) {

            m_sipAccountPersistor = sipAccountPersistor;
            m_sipDialPlanPersistor = sipDialPlanPersistor;
            m_sipProviderPersistor = sipProviderPersistor;
            m_sipProviderBindingsPersistor = sipProviderBindingsPersistor;
            m_sipRegistrarBindingsPersistor = sipRegistrarBindingsPersistor;
            m_sipDialoguePersistor = sipDialoguePersistor;
            m_sipCDRPersistor = sipCDRPersistor;
            m_crmCustomerPersistor = crmSessionManager.CustomerPersistor;
            m_crmSessionManager = crmSessionManager;
            m_sipDomainManager = sipDomainManager;
            m_logDelegate = log;
            m_newCustomersAllowedLimit = newCustomersAllowedLimit;
        }
        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 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 SIPRegistrarBindingsManager(
     SIPMonitorLogDelegate sipMonitorEventLog,
     SIPAssetPersistor<SIPRegistrarBinding> bindingsPersistor,
     SendNATKeepAliveDelegate sendNATKeepAlive,
     int maxBindingsPerAccount,
     SIPUserAgentConfigurationManager userAgentConfigs)
 {
     SIPMonitorEventLog_External = sipMonitorEventLog;
     m_bindingsPersistor = bindingsPersistor;
     SendNATKeepAlive_External = sendNATKeepAlive;
     m_maxBindingsPerAccount = (maxBindingsPerAccount != 0) ? maxBindingsPerAccount : DEFAULT_BINDINGS_PER_USER;
     m_userAgentConfigs = userAgentConfigs;
 }