本文整理汇总了C#中SIPSorcery.SIP.SIPTransport.AddSIPChannel方法的典型用法代码示例。如果您正苦于以下问题:C# SIPTransport.AddSIPChannel方法的具体用法?C# SIPTransport.AddSIPChannel怎么用?C# SIPTransport.AddSIPChannel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIPSorcery.SIP.SIPTransport
的用法示例。
在下文中一共展示了SIPTransport.AddSIPChannel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public void Start()
{
try
{
logger.Debug("WatchTowerDaemon starting...");
// Send events from this process to the monitoring socket.
if (m_monitorEventLoopbackPort != 0)
{
m_monitorEventWriter = new SIPMonitorEventWriter(m_monitorEventLoopbackPort);
}
List<SIPChannel> sipChannels = SIPTransportConfig.ParseSIPChannelsNode(m_transportNode);
m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine());
m_sipTransport.AddSIPChannel(sipChannels);
if (m_sipAppServerWorkersNode != null)
{
m_appServerManager = new SIPAppServerManager(
FireSIPMonitorEvent,
m_sipTransport,
m_sipAppServerWorkersNode,
m_proxyAppServerEndPointsPath);
}
//m_sipTransport.SIPTransportRequestReceived += GotRequest;
//m_sipTransport.SIPTransportResponseReceived += GotResponse;
}
catch (Exception excp)
{
logger.Error("Exception WatchTowerDaemon Start. " + excp.Message);
}
}
示例2: Start
public void Start()
{
try
{
logger.Debug("RTCC Daemon starting...");
// Pre-flight checks.
if (m_rtccSIPSocketsNode == null || m_rtccSIPSocketsNode.ChildNodes.Count == 0)
{
throw new ApplicationException("The RTCC server cannot start without a SIP socket, please check config file.");
}
// Send events from this process to the monitoring socket.
if (m_monitorLoopbackPort != 0)
{
// Events will be sent by the monitor channel to the loopback interface and this port.
m_monitorEventWriter = new SIPMonitorEventWriter(m_monitorLoopbackPort);
logger.Debug("Monitor channel initialised for 127.0.0.1:" + m_monitorLoopbackPort + ".");
}
// Configure the SIP transport layer.
m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine(), false);
List<SIPChannel> sipChannels = SIPTransportConfig.ParseSIPChannelsNode(m_rtccSIPSocketsNode);
m_sipTransport.AddSIPChannel(sipChannels);
if (m_cdrDataLayer != null)
{
SIPCDR.CDRCreated += m_cdrDataLayer.Add;
SIPCDR.CDRAnswered += m_cdrDataLayer.Update;
SIPCDR.CDRHungup += m_cdrDataLayer.Update;
SIPCDR.CDRUpdated += m_cdrDataLayer.Update;
}
m_sipDialogueManager = new SIPDialogueManager(
m_sipTransport,
m_outboundProxy,
FireSIPMonitorEvent,
m_sipSorceryPersistor.SIPDialoguePersistor,
m_sipSorceryPersistor.SIPCDRPersistor,
SIPRequestAuthenticator.AuthenticateSIPRequest,
m_sipSorceryPersistor.SIPAccountsPersistor.Get,
m_sipSorceryPersistor.SIPDomainManager.GetDomain);
m_rtccCore = new RTCCCore(
FireSIPMonitorEvent,
m_sipDialogueManager,
m_sipSorceryPersistor.SIPDialoguePersistor);
m_rtccCore.Start();
m_rateUpdater = new RateBulkUpdater(FireSIPMonitorEvent);
m_rateUpdater.Start();
logger.Debug("RTCC Daemon successfully started.");
}
catch (Exception excp)
{
logger.Error("Exception RTCCDaemon Start. " + excp.Message);
}
}
示例3: Main
static void Main(string[] args)
{
try
{
// Configure the SIP transport layer.
_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine());
if (_sipSocketsNode != null)
{
// Set up the SIP channels based on the app.config file.
List<SIPChannel> sipChannels = SIPTransportConfig.ParseSIPChannelsNode(_sipSocketsNode);
_sipTransport.AddSIPChannel(sipChannels);
}
else
{
// Use default options to set up a SIP channel.
int port = FreePort.FindNextAvailableUDPPort(_defaultSIPUdpPort);
var sipChannel = new SIPUDPChannel(new IPEndPoint(_defaultLocalAddress, port));
_sipTransport.AddSIPChannel(sipChannel);
}
// Wire up the transport layer so SIP requests and responses have somewhere to go.
_sipTransport.SIPTransportRequestReceived += SIPTransportRequestReceived;
_sipTransport.SIPTransportResponseReceived += SIPTransportResponseReceived;
// If you want to see ALL the nitty gritty SIP traffic wire up the events below.
//_sipTransport.SIPBadRequestInTraceEvent += SIPBadRequestInTraceEvent;
//_sipTransport.SIPBadResponseInTraceEvent += SIPBadResponseInTraceEvent;
//_sipTransport.SIPRequestInTraceEvent += SIPRequestInTraceEvent;
//_sipTransport.SIPRequestOutTraceEvent += SIPRequestOutTraceEvent;
//_sipTransport.SIPResponseInTraceEvent += SIPResponseInTraceEvent;
//_sipTransport.SIPResponseOutTraceEvent += SIPResponseOutTraceEvent;
ManualResetEvent mre = new ManualResetEvent(false);
mre.WaitOne();
}
catch (Exception excp)
{
Console.WriteLine("Exception Main. " + excp);
}
finally
{
Console.WriteLine("Press any key to exit...");
Console.ReadLine();
}
}
示例4: B2BOptionsStatefulProxyTest
public void B2BOptionsStatefulProxyTest()
{
SIPTransactionEngine transactionEngine1 = new SIPTransactionEngine();
SIPTransport sipTransport1 = new SIPTransport(SIPDNSManager.Resolve, transactionEngine1, true, false);
sipTransport1.AddSIPChannel(new SIPUDPChannel(new IPEndPoint(IPAddress.Loopback, 3000)));
SIPAppServerCore appServerCore1 = new SIPAppServerCore(sipTransport1, null, statefulProxyCore1_StatefulProxyLogEvent, null, null, null);
SIPTransactionEngine transactionEngine2 = new SIPTransactionEngine();
SIPTransport sipTransport2 = new SIPTransport(SIPDNSManager.Resolve, transactionEngine2, true, false);
sipTransport2.AddSIPChannel(new SIPUDPChannel(new IPEndPoint(IPAddress.Loopback, 3001)));
SIPAppServerCore appServerCore2 = new SIPAppServerCore(sipTransport2, null, statefulProxyCore2_StatefulProxyLogEvent, null, null, null);
sipTransport1.SIPRequestOutTraceEvent += sipTransport1_SIPRequestOutTraceEvent;
sipTransport1.SIPResponseInTraceEvent += sipTransport1_SIPResponseInTraceEvent;
sipTransport2.SIPRequestInTraceEvent += sipTransport2_SIPRequestInTraceEvent;
SIPRequest optionsRequest = GetOptionsRequest(SIPURI.ParseSIPURI("sip:127.0.0.1:3001"), 1, sipTransport1.GetDefaultTransportContact(SIPProtocolsEnum.udp).SocketEndPoint);
sipTransport1.SendRequest(optionsRequest);
Thread.Sleep(200);
// Check the NUnit Console.Out to make sure there are SIP requests and responses being displayed.
sipTransport1.Shutdown();
sipTransport2.Shutdown();
}
示例5: B2BInviteTransactionUserFoundStatefulProxyTest
public void B2BInviteTransactionUserFoundStatefulProxyTest()
{
SIPTransactionEngine transactionEngine1 = new SIPTransactionEngine();
SIPTransport sipTransport1 = new SIPTransport(SIPDNSManager.Resolve, transactionEngine1, true, false);
IPEndPoint sipTransport1EndPoint = new IPEndPoint(IPAddress.Loopback, 3000);
sipTransport1.AddSIPChannel(new SIPUDPChannel(sipTransport1EndPoint));
SIPAppServerCore statefulProxyCore1 = new SIPAppServerCore(sipTransport1, null, statefulProxyCore1_StatefulProxyLogEvent, null, null, null);
SIPTransactionEngine transactionEngine2 = new SIPTransactionEngine();
SIPTransport sipTransport2 = new SIPTransport(SIPDNSManager.Resolve, transactionEngine2, true, false);
IPEndPoint sipTransport2EndPoint = new IPEndPoint(IPAddress.Loopback, 3001);
sipTransport2.AddSIPChannel(new SIPUDPChannel(sipTransport2EndPoint));
SIPAppServerCore statefulProxyCore2 = new SIPAppServerCore(
sipTransport2,
statefulProxyCore2_GetCanonicalDomain,
statefulProxyCore2_StatefulProxyLogEvent,
null,
null,
null);
//statefulProxyCore2.GetExtensionOwner += new GetExtensionOwnerDelegate(statefulProxyCore2_GetExtensionOwner);
sipTransport1.SIPRequestOutTraceEvent += sipTransport1_SIPRequestOutTraceEvent;
sipTransport1.SIPResponseInTraceEvent += sipTransport1_SIPResponseInTraceEvent;
sipTransport2.SIPRequestInTraceEvent += sipTransport2_SIPRequestInTraceEvent;
sipTransport2.SIPResponseOutTraceEvent += sipTransport2_SIPResponseOutTraceEvent;
//statefulProxyCore2.LoadDialPlan += new LoadDialPlanDelegate(statefulProxyCore2_LoadDialPlan);
SIPRequest inviteRequest = GetInviteRequest(sipTransport1EndPoint, null, sipTransport2EndPoint);
UACInviteTransaction uacInvite = sipTransport1.CreateUACTransaction(inviteRequest, new SIPEndPoint(SIPProtocolsEnum.udp, sipTransport2EndPoint), new SIPEndPoint(SIPProtocolsEnum.udp, sipTransport1EndPoint), null);
uacInvite.SendInviteRequest(new SIPEndPoint(SIPProtocolsEnum.udp, sipTransport2EndPoint), inviteRequest);
Thread.Sleep(1000);
// Check the NUnit Console.Out to make sure there are SIP requests and responses being displayed.
sipTransport1.Shutdown();
sipTransport2.Shutdown();
}
示例6: B2BInviteStatefulProxyTest
public void B2BInviteStatefulProxyTest()
{
SIPTransactionEngine transactionEngine1 = new SIPTransactionEngine();
SIPTransport sipTransport1 = new SIPTransport(SIPDNSManager.Resolve, transactionEngine1, true, false);
IPEndPoint sipTransport1EndPoint = new IPEndPoint(IPAddress.Loopback, 3000);
sipTransport1.AddSIPChannel(new SIPUDPChannel(sipTransport1EndPoint));
SIPAppServerCore statefulProxyCore1 = new SIPAppServerCore(sipTransport1, null, statefulProxyCore1_StatefulProxyLogEvent, null, null, null);
SIPTransactionEngine transactionEngine2 = new SIPTransactionEngine();
SIPTransport sipTransport2 = new SIPTransport(SIPDNSManager.Resolve, transactionEngine2, true, false);
IPEndPoint sipTransport2EndPoint = new IPEndPoint(IPAddress.Loopback, 3001);
sipTransport2.AddSIPChannel(new SIPUDPChannel(sipTransport2EndPoint));
SIPAppServerCore statefulProxyCore2 = new SIPAppServerCore(sipTransport2, statefulProxyCore2_GetCanonicalDomain, statefulProxyCore2_StatefulProxyLogEvent, null, null, null);
sipTransport1.SIPRequestOutTraceEvent += sipTransport1_SIPRequestOutTraceEvent;
sipTransport1.SIPResponseInTraceEvent += sipTransport1_SIPResponseInTraceEvent;
sipTransport2.SIPRequestInTraceEvent += sipTransport2_SIPRequestInTraceEvent;
sipTransport2.SIPResponseOutTraceEvent += sipTransport2_SIPResponseOutTraceEvent;
SIPRequest inviteRequest = GetInviteRequest(sipTransport1EndPoint, null, sipTransport2EndPoint);
sipTransport1.SendRequest(inviteRequest);
Thread.Sleep(200);
// Check the NUnit Console.Out to make sure there are SIP requests and responses being displayed.
sipTransport1.Shutdown();
sipTransport2.Shutdown();
}
示例7: InitialiseSIP
private static void InitialiseSIP(XmlNode sipSocketsNode, IPAddress publicIPAddress)
{
m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine(), true);
m_sipTransport.ContactIPAddress = publicIPAddress;
SIPDNSManager.SIPMonitorLogEvent = LogTraceMessage;
List<SIPChannel> sipChannels = SIPTransportConfig.ParseSIPChannelsNode(sipSocketsNode);
m_sipTransport.AddSIPChannel(sipChannels);
m_sipTransport.SIPTransportRequestReceived += SIPTransportRequestReceived;
//m_sipTransport.SIPRequestInTraceEvent += (localSIPEndPoint, endPoint, sipRequest) => { Console.WriteLine("Request Received : " + localSIPEndPoint + "<-" + endPoint + "\r\n" + sipRequest.ToString()); };
//m_sipTransport.SIPRequestOutTraceEvent += (localSIPEndPoint, endPoint, sipRequest) => { Console.WriteLine("Request Sent: " + localSIPEndPoint + "->" + endPoint + "\r\n" + sipRequest.ToString()); };
//m_sipTransport.SIPResponseInTraceEvent += (localSIPEndPoint, endPoint, sipResponse) => { Console.WriteLine("Response Received: " + localSIPEndPoint + "<-" + endPoint + "\r\n" + sipResponse.ToString()); };
//m_sipTransport.SIPResponseOutTraceEvent += (localSIPEndPoint, endPoint, sipResponse) => { Console.WriteLine("Response Sent: " + localSIPEndPoint + "->" + endPoint + "\r\n" + sipResponse.ToString()); };
}
示例8: InitialiseSIP
/// <summary>
/// Initialises the SIP transport layer.
/// </summary>
private void InitialiseSIP()
{
// Configure the SIP transport layer.
m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine());
if (m_sipSocketsNode != null)
{
// Set up the SIP channels based on the app.config file.
List<SIPChannel> sipChannels = SIPTransportConfig.ParseSIPChannelsNode(m_sipSocketsNode);
m_sipTransport.AddSIPChannel(sipChannels);
}
else
{
// Use default options to set up a SIP channel.
int port = FreePort.FindNextAvailableUDPPort(_defaultSIPUdpPort);
var sipChannel = new SIPUDPChannel(new IPEndPoint(_defaultLocalAddress, port));
m_sipTransport.AddSIPChannel(sipChannel);
}
// Wire up the transport layer so incoming SIP requests have somewhere to go.
m_sipTransport.SIPTransportRequestReceived += SIPTransportRequestReceived;
// Log all SIP packets received to a log file.
m_sipTransport.SIPRequestInTraceEvent += (localSIPEndPoint, endPoint, sipRequest) => { _sipTraceLogger.Debug("Request Received : " + localSIPEndPoint + "<-" + endPoint + "\r\n" + sipRequest.ToString()); };
m_sipTransport.SIPRequestOutTraceEvent += (localSIPEndPoint, endPoint, sipRequest) => { _sipTraceLogger.Debug("Request Sent: " + localSIPEndPoint + "->" + endPoint + "\r\n" + sipRequest.ToString()); };
m_sipTransport.SIPResponseInTraceEvent += (localSIPEndPoint, endPoint, sipResponse) => { _sipTraceLogger.Debug("Response Received: " + localSIPEndPoint + "<-" + endPoint + "\r\n" + sipResponse.ToString()); };
m_sipTransport.SIPResponseOutTraceEvent += (localSIPEndPoint, endPoint, sipResponse) => { _sipTraceLogger.Debug("Response Sent: " + localSIPEndPoint + "->" + endPoint + "\r\n" + sipResponse.ToString()); };
}
示例9: InitialiseSIP
private void InitialiseSIP(object state)
{
// Configure the SIP transport layer.
m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine());
List<SIPChannel> sipChannels = SIPTransportConfig.ParseSIPChannelsNode(m_sipSocketsNode);
m_sipTransport.AddSIPChannel(sipChannels);
m_sipTransport.SIPTransportRequestReceived += SIPTransportRequestReceived;
m_sipTransport.SIPRequestInTraceEvent += (localSIPEndPoint, endPoint, sipRequest) => { AppendSIPTransportTraceMessage("Request Received : " + localSIPEndPoint + "<-" + endPoint + "\r\n" + sipRequest.ToString()); };
m_sipTransport.SIPRequestOutTraceEvent += (localSIPEndPoint, endPoint, sipRequest) => { AppendSIPTransportTraceMessage("Request Sent: " + localSIPEndPoint + "->" + endPoint + "\r\n" + sipRequest.ToString()); };
m_sipTransport.SIPResponseInTraceEvent += (localSIPEndPoint, endPoint, sipResponse) => { AppendSIPTransportTraceMessage("Response Received: " + localSIPEndPoint + "<-" + endPoint + "\r\n" + sipResponse.ToString()); };
m_sipTransport.SIPResponseOutTraceEvent += (localSIPEndPoint, endPoint, sipResponse) => { AppendSIPTransportTraceMessage("Response Sent: " + localSIPEndPoint + "->" + endPoint + "\r\n" + sipResponse.ToString()); };
}
示例10: StrictRoutePriorToProxyUnitTest
public void StrictRoutePriorToProxyUnitTest()
{
Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);
string sipMsg =
"INVITE sip:82.195.148.216:5062;lr SIP/2.0" + m_CRLF +
"Via: SIP/2.0/UDP 192.168.1.2:5065;rport;branch=z9hG4bKFBB7EAC06934405182D13950BD51F001" + m_CRLF +
"Route: <sip:89.100.92.186:45270;lr>,<sip:[email protected]>" + m_CRLF +
"From: SER Test X <sip:[email protected]:5065>;tag=196468136" + m_CRLF +
"To: <sip:[email protected]>" + m_CRLF +
"Contact: <sip:[email protected]:5065>" + m_CRLF +
"Call-ID: [email protected]" + m_CRLF +
"CSeq: 49429 INVITE" + m_CRLF +
"Max-Forwards: 70" + m_CRLF +
"Content-Type: application/sdp" + m_CRLF +
"User-Agent: X-PRO release 1103v" + m_CRLF +
m_CRLF;
SIPMessage sipMessage = SIPMessage.ParseSIPMessage(Encoding.UTF8.GetBytes(sipMsg), null, null);
SIPRequest inviteReq = SIPRequest.ParseSIPRequest(sipMessage);
SIPTransport mockSIPTransport = new SIPTransport(MockSIPDNSManager.Resolve, null, false);
mockSIPTransport.AddSIPChannel(new MockSIPChannel(IPSocket.ParseSocketString("82.195.148.216:5062")));
mockSIPTransport.PreProcessRouteInfo(inviteReq);
Console.WriteLine(inviteReq.ToString());
Console.WriteLine("Next Route=" + inviteReq.Header.Routes.TopRoute.ToString());
Console.WriteLine("Request URI=" + inviteReq.URI.ToString());
Assert.IsTrue(inviteReq.Header.Routes.TopRoute.ToString() == "<sip:89.100.92.186:45270;lr>", "Top route was not correct.");
Assert.IsTrue(inviteReq.URI.ToString() == "sip:[email protected]", "The request URI was incorrectly adjusted.");
Assert.IsTrue(inviteReq.Header.Routes.Length == 1, "The route set was not correct.");
}
示例11: AvayaInviteUnitTest
public void AvayaInviteUnitTest()
{
Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);
string sipMsg =
"INVITE sip:194.213.29.100:5060 SIP/2.0" + m_CRLF +
"Via: SIP/2.0/UDP 10.1.1.241;branch=z9hG4bK94fc63626" + m_CRLF +
"To: UNKNOWN <sip:[email protected]>" + m_CRLF +
"From: 'Joe Bloggs' <sip:[email protected]>;tag=cc16d34c122e5fe" + m_CRLF +
"Call-ID: [email protected]" + m_CRLF +
"CSeq: 2009546910 INVITE" + m_CRLF +
"Contact: 'Val Gavin' <sip:[email protected]>" + m_CRLF +
"Max-Forwards: 70" + m_CRLF +
"Route: <sip:[email protected]>" + m_CRLF + // Strict Route header (this header is actually a fault but it ends up being a strict route).
"User-Agent: NeuralX MxSF/v3.2.6.26" + m_CRLF +
"Content-Type: application/sdp" + m_CRLF +
"Content-Length: 318" + m_CRLF +
"P-Asserted-Identity: 'Joe Bloggs' <sip:[email protected]>" + m_CRLF +
"Allow: INVITE" + m_CRLF +
"Allow: CANCEL" + m_CRLF +
"Allow: OPTIONS" + m_CRLF +
"Allow: BYE" + m_CRLF +
"Allow: REFER" + m_CRLF +
"Allow: INFO" + m_CRLF +
"Allow: UPDATE" + m_CRLF +
"Supported: replaces" + m_CRLF +
m_CRLF +
"v=0" + m_CRLF +
"o=xxxxx 1174909600 1174909601 IN IP4 10.1.1.241" + m_CRLF +
"s=-" + m_CRLF +
"c=IN IP4 10.1.1.241" + m_CRLF +
"t=0 0" + m_CRLF +
"a=sendrecv" + m_CRLF +
"m=audio 20026 RTP/AVP 8 0 18 101" + m_CRLF +
"a=rtpmap:8 PCMA/8000" + m_CRLF +
"a=rtpmap:0 PCMU/8000" + m_CRLF +
"a=rtpmap:18 G729/8000" + m_CRLF +
"a=rtpmap:101 telephone-event/8000" + m_CRLF +
"a=fmtp:18 annexb=no" + m_CRLF +
"a=fmtp:101 0-15" + m_CRLF +
"a=ptime:20" + m_CRLF +
"a=rtcp:20027 IN IP4 10.1.1.241";
SIPMessage sipMessage = SIPMessage.ParseSIPMessage(Encoding.UTF8.GetBytes(sipMsg), null, null);
SIPRequest inviteReq = SIPRequest.ParseSIPRequest(sipMessage);
SIPTransport mockSIPTransport = new SIPTransport(MockSIPDNSManager.Resolve, null, false);
mockSIPTransport.AddSIPChannel(new MockSIPChannel(IPSocket.ParseSocketString("194.213.29.100:5060")));
mockSIPTransport.PreProcessRouteInfo(inviteReq);
Console.WriteLine(inviteReq.ToString());
Assert.IsTrue(inviteReq.URI.ToString() == "sip:[email protected]", "The request URI was not updated to the strict route.");
Assert.IsTrue(inviteReq.Header.Routes.TopRoute.URI.ToString() == "sip:194.213.29.100:5060", "The route set was not correctly updated.");
Console.WriteLine("-----------------------------------------");
}
示例12: Start
public void Start()
{
try
{
logger.Debug("SIP Registration Agent daemon starting...");
if (m_sipRegAgentSocketsNode == null)
{
throw new ApplicationException("The SIP Registration Agent could not be started, no SIP transport sockets node could be found.");
}
// Pre-flight checks.
if (m_sipRegAgentSocketsNode == null || m_sipRegAgentSocketsNode.ChildNodes.Count == 0)
{
throw new ApplicationException("The SIP Registration Agent cannot start without at least one socket specified to listen on, please check config file.");
}
// Send events from this process to the monitoring socket.
if (m_monitorLoopbackPort != 0)
{
// Events will be sent by the monitor channel to the loopback interface and this port.
m_monitorEventWriter = new SIPMonitorEventWriter(m_monitorLoopbackPort);
logger.Debug("Monitor channel initialised for 127.0.0.1:" + m_monitorLoopbackPort + ".");
}
// Configure the SIP transport layer.
m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine(), true);
m_sipTransport.PerformanceMonitorPrefix = SIPSorceryPerformanceMonitor.REGISTRATION_AGENT_PREFIX;
List<SIPChannel> sipChannels = SIPTransportConfig.ParseSIPChannelsNode(m_sipRegAgentSocketsNode);
m_sipTransport.AddSIPChannel(sipChannels);
m_sipRegAgentCore = new SIPRegistrationAgentCore(
FireSIPMonitorEvent,
m_sipTransport,
m_outboundProxy,
m_providerPersistor.Get,
m_providerPersistor.Update,
m_providerPersistor.UpdateProperty,
m_bindingPersistor,
m_disallowPrivateIPRegistrars);
m_sipRegAgentCore.Start(m_threadCount);
logger.Debug("SIP Registration Agent successfully started.");
}
catch (Exception excp)
{
logger.Error("Exception SIPRegAgentDaemon Start. " + excp.Message);
}
}
示例13: Main
static void Main(string[] args)
{
try
{
if (args == null || args.Count() == 0)
{
Console.WriteLine(USAGE_STRING);
}
else
{
bool validArgs = ParseArgs(args);
if (validArgs)
{
Console.WriteLine("XMPP Test Console:");
m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine());
SIPUDPChannel udpChannel = new SIPUDPChannel(new IPEndPoint(m_ipAddress, m_port));
m_sipTransport.AddSIPChannel(udpChannel);
m_sipTransport.SIPTransportRequestReceived += SIPTransportRequestReceived;
Console.WriteLine("Waiting for SIP INVITE...");
ManualResetEvent mre = new ManualResetEvent(false);
mre.WaitOne();
}
}
}
catch (Exception excp)
{
Console.WriteLine("Exception Main. " + excp.Message);
}
}
示例14: Start
public void Start() {
try {
logger.Debug("SIP Registrar daemon starting...");
// Pre-flight checks.
if (m_sipRegistrarSocketsNode == null || m_sipRegistrarSocketsNode.ChildNodes.Count == 0) {
throw new ApplicationException("The SIP Registrar cannot start without at least one socket specified to listen on, please check config file.");
}
// Send events from this process to the monitoring socket.
if (m_monitorLoopbackPort != 0) {
// Events will be sent by the monitor channel to the loopback interface and this port.
m_monitorEventWriter = new SIPMonitorEventWriter(m_monitorLoopbackPort);
logger.Debug("Monitor channel initialised for 127.0.0.1:" + m_monitorLoopbackPort + ".");
}
// Configure the SIP transport layer.
m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine(), false);
m_sipTransport.PerformanceMonitorPrefix = SIPSorceryPerformanceMonitor.REGISTRAR_PREFIX;
List<SIPChannel> sipChannels = SIPTransportConfig.ParseSIPChannelsNode(m_sipRegistrarSocketsNode);
m_sipTransport.AddSIPChannel(sipChannels);
// Create and configure the SIP Registrar core.
if (m_natKeepAliveRelaySocket != null) {
m_natKeepAliveSender = new UdpClient();
}
SIPUserAgentConfigurationManager userAgentConfigManager = new SIPUserAgentConfigurationManager(m_userAgentsConfigNode);
if (m_userAgentsConfigNode == null) {
logger.Warn("The UserAgent config's node was missing.");
}
m_registrarBindingsManager = new SIPRegistrarBindingsManager(FireSIPMonitorEvent, m_registrarBindingsPersistor, SendNATKeepAlive, m_maximumAccountBindings, userAgentConfigManager);
m_registrarBindingsManager.Start();
m_registrarCore = new RegistrarCore(m_sipTransport, m_registrarBindingsManager, GetSIPAccount_External, GetCanonicalDomain_External, true, true, FireSIPMonitorEvent, userAgentConfigManager, SIPAuthenticateRequest_External, m_switchboardCertificateName);
m_registrarCore.Start(m_threadCount);
m_sipTransport.SIPTransportRequestReceived += m_registrarCore.AddRegisterRequest;
logger.Debug("SIP Registrar successfully started.");
}
catch (Exception excp) {
logger.Error("Exception SIPRegistrarDaemon Start. " + excp.Message);
}
}
示例15: Start
public void Start()
{
try
{
logger.Debug("SIP Notifier Daemon starting...");
// Pre-flight checks.
if (m_sipNotifierSocketsNode == null || m_sipNotifierSocketsNode.ChildNodes.Count == 0)
{
throw new ApplicationException("The SIP Notifier cannot start without at least one socket specified to listen on, please check config file.");
}
// Send events from this process to the monitoring socket.
if (m_monitorLoopbackPort != 0)
{
// Events will be sent by the monitor channel to the loopback interface and this port.
m_monitorEventWriter = new SIPMonitorEventWriter(m_monitorLoopbackPort);
logger.Debug("Monitor channel initialised for 127.0.0.1:" + m_monitorLoopbackPort + ".");
}
// Configure the SIP transport layer.
m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine(), false);
List<SIPChannel> sipChannels = SIPTransportConfig.ParseSIPChannelsNode(m_sipNotifierSocketsNode);
m_sipTransport.AddSIPChannel(sipChannels);
m_notifierCore = new NotifierCore(
FireSIPMonitorEvent,
m_sipTransport,
GetCustomer_External,
GetDialogues_External,
GetDialogue_External,
GetCanonicalDomain_External,
m_sipAssetPersistor,
GetBindingsCount_External,
SIPAuthenticateRequest_External,
m_outboundProxy,
m_publisher);
m_notifyManager = new SIPNotifyManager(
m_sipTransport,
m_outboundProxy,
FireSIPMonitorEvent,
m_sipAssetPersistor.Get,
GetSIPRegistrarBindings_External,
GetCanonicalDomain_External);
m_sipTransport.SIPTransportRequestReceived += GotRequest;
logger.Debug("SIP Notifier Daemon successfully started.");
}
catch (Exception excp)
{
logger.Error("Exception SIPNotifierDaemon Start. " + excp.Message);
}
}