public SIPSorceryWebServicePersistor(string serverURL, string authid) { BasicHttpSecurityMode securitymode = (serverURL.StartsWith("https")) ? BasicHttpSecurityMode.Transport : BasicHttpSecurityMode.None; SIPSorcerySecurityHeader securityHeader = new SIPSorcerySecurityHeader(authid); SIPSorceryCustomHeader sipSorceryHeader = new SIPSorceryCustomHeader(new List<MessageHeader>(){securityHeader}); BasicHttpCustomHeaderBinding binding = new BasicHttpCustomHeaderBinding(sipSorceryHeader, securitymode); binding.MaxReceivedMessageSize = MAX_WCF_MESSAGE_SIZE; EndpointAddress address = new EndpointAddress(serverURL); m_provisioningServiceProxy = new ProvisioningServiceClient(binding, address); // Provisioning web service delegates. m_provisioningServiceProxy.IsAliveCompleted += IsAliveCompleted; m_provisioningServiceProxy.TestExceptionCompleted += TestExceptionCompleted; m_provisioningServiceProxy.AreNewAccountsEnabledCompleted += AreNewAccountsEnabledCompleted; m_provisioningServiceProxy.CheckInviteCodeCompleted += CheckInviteCodeCompleted; m_provisioningServiceProxy.LoginCompleted += LoginCompleted; m_provisioningServiceProxy.LogoutCompleted += LogoutCompleted; m_provisioningServiceProxy.GetCustomerCompleted += GetCustomerCompleted; m_provisioningServiceProxy.UpdateCustomerCompleted += UpdateCustomerCompleted; m_provisioningServiceProxy.UpdateCustomerPasswordCompleted += UpdateCustomerPasswordCompleted; m_provisioningServiceProxy.GetSIPAccountsCompleted += GetSIPAccountsCompleted; m_provisioningServiceProxy.GetSIPAccountsCountCompleted += GetSIPAccountsCountCompleted; m_provisioningServiceProxy.AddSIPAccountCompleted += AddSIPAccountCompleted; m_provisioningServiceProxy.UpdateSIPAccountCompleted += UpdateSIPAccountCompleted; m_provisioningServiceProxy.DeleteSIPAccountCompleted += DeleteSIPAccountCompleted; m_provisioningServiceProxy.GetDialPlansCountCompleted += GetDialPlansCountCompleted; m_provisioningServiceProxy.GetDialPlansCompleted += GetDialPlansCompleted; m_provisioningServiceProxy.UpdateDialPlanCompleted += UpdateDialPlanCompleted; m_provisioningServiceProxy.AddDialPlanCompleted += AddDialPlanCompleted; m_provisioningServiceProxy.DeleteDialPlanCompleted += DeleteDialPlanCompleted; m_provisioningServiceProxy.GetSIPProvidersCountCompleted += GetSIPProvidersCountCompleted; m_provisioningServiceProxy.GetSIPProvidersCompleted += GetSIPProvidersCompleted; m_provisioningServiceProxy.AddSIPProviderCompleted += AddSIPProviderCompleted; m_provisioningServiceProxy.UpdateSIPProviderCompleted += UpdateSIPProviderCompleted; m_provisioningServiceProxy.DeleteSIPProviderCompleted += DeleteSIPProviderCompleted; m_provisioningServiceProxy.GetSIPDomainsCompleted += GetSIPDomainsCompleted; m_provisioningServiceProxy.GetSIPRegistrarBindingsCompleted += GetSIPRegistrarBindingsCompleted; m_provisioningServiceProxy.GetSIPRegistrarBindingsCountCompleted += GetSIPRegistrarBindingsCountCompleted; m_provisioningServiceProxy.GetSIPProviderBindingsCompleted += GetSIPProviderBindingsCompleted; m_provisioningServiceProxy.GetSIPProviderBindingsCountCompleted += GetSIPProviderBindingsCountCompleted; m_provisioningServiceProxy.GetCallsCountCompleted += m_provisioningServiceProxy_GetCallsCountCompleted; m_provisioningServiceProxy.GetCallsCompleted += m_provisioningServiceProxy_GetCallsCompleted; m_provisioningServiceProxy.GetCDRsCountCompleted += GetCDRsCountCompleted; m_provisioningServiceProxy.GetCDRsCompleted += GetCDRsCompleted; m_provisioningServiceProxy.CreateCustomerCompleted += CreateCustomerCompleted; m_provisioningServiceProxy.DeleteCustomerCompleted += DeleteCustomerCompleted; m_provisioningServiceProxy.GetTimeZoneOffsetMinutesCompleted += GetTimeZoneOffsetMinutesCompleted; m_provisioningServiceProxy.ExtendSessionCompleted += ExtendSessionCompleted; }
public SIPSorceryNotificationClient(ActivityMessageDelegate logActivityMessage, string serverURL, string authid) { LogActivityMessage_External = logActivityMessage; m_address = Guid.NewGuid().ToString(); BasicHttpSecurityMode securitymode = (serverURL.StartsWith("https")) ? BasicHttpSecurityMode.Transport : BasicHttpSecurityMode.None; SIPSorcerySecurityHeader securityHeader = new SIPSorcerySecurityHeader(authid); PullNotificationHeader notificationHeader = new PullNotificationHeader(m_address); SIPSorceryCustomHeader sipSorceryHeader = new SIPSorceryCustomHeader(new List<MessageHeader>() { securityHeader, notificationHeader }); BasicHttpCustomHeaderBinding binding = new BasicHttpCustomHeaderBinding(sipSorceryHeader, securitymode); EndpointAddress address = new EndpointAddress(serverURL); m_notificationClient = new NotificationsClient(binding, address); m_notificationClient.IsAliveCompleted += IsAliveCompleted; m_notificationClient.GetPollPeriodCompleted += GetPollPeriodCompleted; m_notificationClient.SubscribeCompleted += SubscribeCompleted; m_notificationClient.GetNotificationsCompleted += GetNotificationsCompleted; }
public void Subscribe(string subject, string filter) { PollingDuplexHttpSecurityMode securitymode = (m_serverURL.StartsWith("https")) ? PollingDuplexHttpSecurityMode.Transport : PollingDuplexHttpSecurityMode.None; SIPSorcerySecurityHeader securityHeader = new SIPSorcerySecurityHeader(m_authID); PullNotificationHeader notificationsHeader = new PullNotificationHeader(m_address.ToString()); SIPSorceryCustomHeader sipSorceryHeader = new SIPSorceryCustomHeader(new List<MessageHeader>() { securityHeader, notificationsHeader }); PollingDuplexCustomHeaderBinding notifierBinding = new PollingDuplexCustomHeaderBinding(sipSorceryHeader, securitymode) { UseTextEncoding = true }; m_client = new PubSubClient(notifierBinding, new EndpointAddress(new Uri(m_serverURL))); m_client.InnerChannel.Faulted += ChannelFaulted; m_client.InnerChannel.Closed += ChannelClosed; m_client.NotifyReceived += NotifyReceived; m_client.CloseSessionReceived += CloseSessionReceived; //DebugMessage_External("Polling Duplex client created, sessionID=" + m_client.InnerChannel.SessionId + ", timeout=" + m_client.InnerChannel.OperationTimeout.TotalSeconds + "s."); m_subject = subject; m_filter = filter; m_client.SubscribeAsync(m_subject, m_filter); }