Thanks Aaron. It is TcpView (formerly Sysinternals, now Microsoft):
http://download.sysinternals.com/Files/TCPView.zip
I compiled the server using the latest SVN with vs2010 (Framework 4) under Windows 7(x64) for x86 environment. The server runs under Windows server 2003(x86) R2 SP2. The only change I made to the SVN is:
Posted earlier:
viewtopic.php?f=14&t=2722
Code: Select all
as (36:56:671 70788): Using dialplan out for Out call to sip:xxxxx@metasip.internal:5060.
as (36:56:796 70788): Executing script dial plan for call to xxxxx.
as (36:56:875 70788): Error executing script dialplan for xxxxx. Invalid argument value
[color=#FF0000]Parameter name: ScriptRuntimeSetup must have at least one LanguageSetup[/color]
as (36:56:921 70788): UAS call failed with a response status of 500 and Dial plan exception starting script.
DialPlanExecutingScript.cs
Code: Select all
[color=#FF0000]public string rubyPath = @"d:\\sip-compiled-svn\\sip\\app.config";[/color]
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([color=#FF0000]rubyPath[/color]);
var scriptRuntime = Ruby.CreateRuntime(setup);
DialPlanScriptEngine = Ruby.GetEngine(scriptRuntime);
//DialPlanScriptEngine = Ruby.CreateEngine();
DialPlanScriptScope = DialPlanScriptEngine.CreateScope();
LogDelegate = logDelegate;
}
sipsorcery-appsvr.exe.config
Code: Select all
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
<section name="sipappserver" type="SIPSorcery.Sys.AppState, SIPSorcery.Sys"/>
<section name="sipregistrar" type="SIPSorcery.Sys.AppState, SIPSorcery.Sys"/>
<section name="sipregistrationagent" type="SIPSorcery.Sys.AppState, SIPSorcery.Sys"/>
<section name="sipnotifier" type="SIPSorcery.Sys.AppState, SIPSorcery.Sys"/>
<section name="sipproxy" type="SIPSorcery.Sys.AppState, SIPSorcery.Sys"/>
<section name="sipmonitor" type="SIPSorcery.Sys.AppState, SIPSorcery.Sys"/>
<section name="sshserver" type="SIPSorcery.Sys.AppState, SIPSorcery.Sys"/>
</configSections>
<log4net>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%n"/>
</layout>
</appender>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="D:\SIP-Compiled-SVN\SIP-Operational\logs\root.log"/>
<param name="AppendToFile" value="true"/>
<param name="MaxSizeRollBackups" value="10"/>
<param name="MaximumFileSize" value="50MB"/>
<param name="RollingStyle" value="Size"/>
<param name="StaticLogFileName" value="true"/>
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="ALL"/>
<levelMax value="FATAL"/>
</filter>
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>
</layout>
</appender>
<appender name="DialPlanLogFileAppender" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="D:\SIP-Compiled-SVN\SIP-Operational\logs\dialplan.log"/>
<param name="AppendToFile" value="true"/>
<param name="MaxSizeRollBackups" value="10"/>
<param name="MaximumFileSize" value="50MB"/>
<param name="RollingStyle" value="Size"/>
<param name="StaticLogFileName" value="true"/>
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>
</layout>
</appender>
<appender name="ErrorRollingLogFileAppender" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="D:\SIP-Compiled-SVN\SIP-Operational\logs\error.log"/>
<param name="AppendToFile" value="true"/>
<param name="MaxSizeRollBackups" value="10"/>
<param name="MaximumFileSize" value="50MB"/>
<param name="RollingStyle" value="Size"/>
<param name="StaticLogFileName" value="true"/>
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="ERROR"/>
<levelMax value="FATAL"/>
</filter>
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>
</layout>
</appender>
<appender name="DispatcherRollingLogFileAppender" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="D:\SIP-Compiled-SVN\SIP-Operational\logs\dispatcher.log"/>
<param name="AppendToFile" value="true"/>
<param name="MaxSizeRollBackups" value="10"/>
<param name="MaximumFileSize" value="50MB"/>
<param name="RollingStyle" value="Size"/>
<param name="StaticLogFileName" value="true"/>
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>
</layout>
</appender>
<logger name="sipcalldispatcher">
<appender-ref ref="DispatcherRollingLogFileAppender"/>
</logger>
<logger name="dialplan">
<appender-ref ref="DialPlanLogFileAppender"/>
</logger>
<root>
<priority value="DEBUG"/>
<appender-ref ref="ConsoleAppender"/>
<appender-ref ref="RollingLogFileAppender"/>
<appender-ref ref="ErrorRollingLogFileAppender"/>
</root>
</log4net>
<system.serviceModel>
<services>
<service name="SIPSorcery.Web.Services.CrossDomainService">
<host>
<baseAddresses>
<add baseAddress="http://*:8080/"/>
</baseAddresses>
</host>
<endpoint address="" binding="webHttpBinding" contract="SIPSorcery.Web.Services.ICrossDomain" behaviorConfiguration="HttpEnableBehavior"/>
</service>
<service name="SIPSorcery.Web.Services.SIPProvisioningWebService" behaviorConfiguration="PersistorTypeBehaviors">
<host>
<baseAddresses>
<add baseAddress="http://*:8080/provisioning.svc"/>
</baseAddresses>
</host>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint address="" binding="basicHttpBinding" contract="SIPSorcery.Web.Services.IProvisioningService" bindingConfiguration="LargeMessagesBindingConfiguration"/>
</service>
<service name="SIPSorcery.Web.Services.CallManagerServices" behaviorConfiguration="GetServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://*:8080/callmanager.svc"/>
</baseAddresses>
</host>
<endpoint address="" behaviorConfiguration="HttpEnableBehavior" binding="webHttpBinding" contract="SIPSorcery.Web.Services.ICallManagerServices"/>
</service>
<service name="SIPSorcery.Web.Services.SIPNotifierService" behaviorConfiguration="PubSubServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://*:8080/notificationspull.svc"/>
</baseAddresses>
</host>
<endpoint binding="basicHttpBinding" contract="SIPSorcery.Web.Services.INotifications"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
<service name="SIPSorcery.Web.Services.SIPMonitorClientManagerHost" behaviorConfiguration="InternalNotificationsBehaviour">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8091/notifications"/>
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeMessagesBindingConfiguration" contract="SIPSorcery.SIP.App.ISIPMonitorPublisher"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="LargeMessagesBindingConfiguration">
<readerQuotas maxStringContentLength="40000"/>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="PersistorTypeBehaviors">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior name="GetServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior name="PubSubServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceThrottling maxConcurrentSessions="1"/>
</behavior>
<behavior name="InternalNotificationsBehaviour">
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="HttpEnableBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
<appSettings>
<add key="PersistenceStorageType" value="SQLLinqMySQL"/>
<add key="UserDataDBType" value="MySQL"/>
<add key="PersistenceConnStr" value="Database=sipsorcery;Data Source=metasip;User Id=root;Password=xxxxx"/>
</appSettings>
<!-- SIP Proxy configuration. -->
<sipproxy>
<MonitorLoopbackPort value="10001"/>
<ProxyScriptPath value="proxyscript.py"/>
<NATKeepAliveSocket value="192.168.0.5:9001"/>
<!-- <PublicIPAddress value="xxx.xxx.xxx.xxx" /> -->
<STUNServerHostname value="stun.voipplanet.nl"/>
<AppServerEndPointsPath value="appservers.txt"/>
<sipsockets>
<socket>192.168.0.5:5060</socket>
<socket>192.168.0.5:2060</socket>
<socket protocol="tcp">192.168.0.5:5060</socket>
<socket protocol="tcp">192.168.0.5:2060</socket>
</sipsockets>
</sipproxy>
<!--<socket protocol="tls" certificatepath="10.1.1.2.pfx">*:5061</socket>-->
<!-- SIP Monitor configuration. -->
<sipmonitor>
<MonitorLoopbackPort value="10001"/>
</sipmonitor>
<!-- SIP Registrar configuration. -->
<sipregistrar>
<MonitorLoopbackPort value="10001"/>
<MaximumAccountBindings value="100"/>
<NATKeepAliveRelaySocket value="192.168.0.5:9001"/>
<sipsockets>
<sipsocket>192.168.0.5:5001</sipsocket>
</sipsockets>
<useragentconfigs>
<useragent expiry="3600" contactlists="true">fring</useragent>
<useragent expiry="3600" contactlists="false">Nokia</useragent>
<useragent expiry="60" contactlists="false">Cisco-CP7960G/8.0</useragent>
<useragent expiry="600" contactlists="true">Speedtouch 780</useragent>
<useragent expiry="113">.*</useragent>
</useragentconfigs>
</sipregistrar>
<!-- SIP Registration Agent configuration. -->
<sipregistrationagent>
<MonitorLoopbackPort value="10001"/>
<OutboundProxy value=""/>
<!-- <OutboundProxy value="192.168.0.5:5060"/> -->
<sipsockets>
<sipsocket>192.168.0.5:5002</sipsocket>
</sipsockets>
</sipregistrationagent>
<!-- SIP Notifier Server configuration. -->
<sipnotifier>
<MonitorLoopbackPort value="10001"/>
<OutboundProxy value=""/>
<!-- <OutboundProxy value="192.168.0.5:5060"/> -->
<sipsockets>
<sipsocket>192.168.0.5:5003</sipsocket>
</sipsockets>
</sipnotifier>
<!-- SIP Application Server configuration. -->
<sipappserver>
<MonitorLoopbackPort value="10001"/>
<!-- <TraceDirectory value="D:\SIP-Compiled-SVN\SIP-Test Environment\logs\siptraces"/> -->
<TraceDirectory value="D:\SIP-Compiled-SVN\SIP-Operational\logs\siptraces"/>
<RubyScriptCommonPath value="dialplan-common.rby"/>
<OutboundProxy value=""/>
<!-- <OutboundProxy value="192.168.0.5:5060"/> -->
<DialPlanEngineImpersonationUsername value="xxxxxxxxxx" />
<DialPlanEngineImpersonationPassword value="xxxxxxxxxx" />
<sipsockets>
<socket>192.168.0.5:5065</socket>
</sipsockets>
</sipappserver>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
proxyscript.py
Code: Select all
import clr
clr.AddReference('SIPSorcery.SIP.Core')
from SIPSorcery.SIP import *
m_registrarSocket = "udp:192.168.0.5:5001"
m_regAgentSocket = "udp:192.168.0.5:5002"
m_notifierSocket = "udp:192.168.0.5:5003"
m_appServerSocket = "udp:192.168.0.5:5065"
m_proxySocketInternal = "udp:192.168.0.5:5060"
m_proxySocketLoopback = "udp:192.168.0.5:5060"
#===== Utility functions to customise depending on deployment, such as single or mutliple server and private or public network. =====
def GetAppServer():
return m_appServerSocket
def IsFromApplicationServer():
return remoteEndPoint.ToString() == m_appServerSocket
def IsFromNotifierServer():
return remoteEndPoint.ToString() == m_notifierSocket
# Determines if a destination IP address is on the same local subnet or whether it's
# on an external network.
#def IsLocalNetDestination(SIPEndPoint destinationAddress) :
def IsLocalNetDestination(destinationEP) :
if destinationEP.Address.ToString().StartsWith("192."):
return True
else:
return False
#===== End of customisable utility functions =====
#===== General utility functions =====
# Attempts to send a SIP request to an external user agent by first resolving the destination for the
# request and then checking whether it is on the same subnet.
#def SendExternalRequest(SIPEndPoint receivedOn, SIPRequest req, String proxyBranch, IPAddress publicIP, bool sendTransparently):
def SendExternalRequest(receivedOn, req, proxyBranch, publicIP, sendTransparently):
lookupResult = sys.Resolve(req)
if lookupResult.Pending:
# Do nothing.
sys.Log("DNS lookup pending for " + req.URI.Host + ".")
elif lookupResult.LookupError != None or lookupResult.EndPointResults == None or lookupResult.EndPointResults.Count == 0:
if req.Method.ToString() != "ACK":
sys.Respond(req, SIPResponseStatusCodesEnum.DoesNotExistAnywhere, "Host " + req.URI.Host + " unresolvable")
else:
dest = lookupResult.EndPointResults[0].LookupEndPoint
if IsLocalNetDestination(dest):
#sys.Log("Request destination " + dest.ToString() + " determined as local network.")
if sendTransparently:
sys.SendTransparent(dest, req, None)
else:
sys.SendExternal(receivedOn, dest, req, proxyBranch, None)
else:
#sys.Log("Request destination " + dest.ToString() + " determined as external network.")
if sendTransparently:
sys.SendTransparent(dest, req, publicIP)
else:
sys.SendExternal(receivedOn, dest, req, proxyBranch, publicIP)
#def SendExternalResponse(SIPResponse resp, SIPEndPoint sendFromSIPEndPoint, IPAddress publicIP):
def SendExternalResponse(resp, sendFromSIPEndPoint, publicIP):
dest = sys.Resolve(resp)
#sys.Log("SendExternalResponse desination resolved to " + dest.ToString() + ".")
if dest == None:
sys.Log("The destination could not be resolved for a SIP response.")
sys.Log(resp.ToString())
elif IsLocalNetDestination(dest):
sys.SendExternal(resp, sendFromSIPEndPoint, None)
else:
sys.SendExternal(resp, sendFromSIPEndPoint, publicIP)
#===== End of general utility functions =====
if isreq:
#===== SIP Request Processing =====
#sys.Log("req " + summary)
req.Header.MaxForwards = req.Header.MaxForwards - 1
if req.Header.UserAgent == "Cisco-CP7965G/8.5.3" or req.Header.UserAgent == "Cisco-CP7911G/8.5.3":
req.Header.Vias.TopViaHeader.ViaParameters.Remove("rport")
if sipMethod == "REGISTER":
if remoteEndPoint.ToString() == m_regAgentSocket:
# The registration agent has indicated where it wants the REGISTER request sent to by adding a Route header.
# Remove the header in case it confuses the SIP Registrar the REGISTER is being sent to.
route = req.Header.Routes.PopRoute()
if route == None:
sys.Log("Registration agent request was missing Route header.\n" + req.ToString())
else:
destRegistrar = route.ToSIPEndPoint()
req.Header.Routes = None
sys.SendTransparent(destRegistrar, req, publicip)
else:
sys.SendInternal(remoteEndPoint, localEndPoint, m_registrarSocket, req, proxyBranch, m_proxySocketLoopback)
elif sipMethod == "SUBSCRIBE":
sys.SendInternal(remoteEndPoint, localEndPoint, m_notifierSocket, req, proxyBranch, m_proxySocketLoopback)
elif sipMethod == "NOTIFY":
if IsFromApplicationServer() or IsFromNotifierServer():
# Request from a SIP Application or Notification server for an external user agent.
SendExternalRequest(localEndPoint, req, proxyBranch, publicip, False)
else:
if req.Header.Event != None and req.Header.Event.StartsWith("refer"):
# REFER notification for app server.
sys.SendInternal(remoteEndPoint, localEndPoint, GetAppServer().ToString(), req, proxyBranch, m_proxySocketInternal)
else:
# A notification from an external notification server.
sys.SendInternal(remoteEndPoint, localEndPoint, m_notifierSocket, req, proxyBranch, m_proxySocketLoopback)
else:
# All other requests are processed by the Application Server.
if IsFromApplicationServer():
# Request from a SIP Application Server for an external user agent.
if req.Method.ToString() == "ACK" or req.Method.ToString() == "CANCEL" or req.Method.ToString() == "INVITE":
SendExternalRequest(None, req, None, publicip, True)
else:
SendExternalRequest(localEndPoint, req, proxyBranch, publicip, False)
else:
# Request from an external user agent for an Application Server.
dispatcherEndPoint = sys.DispatcherLookup(req)
if dispatcherEndPoint != None:
sys.SendInternal(remoteEndPoint, localEndPoint, dispatcherEndPoint.ToString(), req, proxyBranch, m_proxySocketInternal)
else:
appServer = GetAppServer()
if appServer != None:
sys.SendInternal(remoteEndPoint, localEndPoint, appServer.ToString(), req, proxyBranch, m_proxySocketInternal)
else:
sys.Respond(req, SIPResponseStatusCodesEnum.BadGateway, "No sipsorcery app servers available")
#===== End SIP Request Processing =====
else:
#===== SIP Response Processing =====
#sys.Log("resp " + summary)
if sipMethod == "REGISTER" and remoteEndPoint.ToString() == m_registrarSocket:
# REGISTER response from SIP Registrar.
sys.SendExternal(resp, outSocket)
elif sipMethod == "REGISTER":
# REGISTER response for SIP Registration Agent.
sys.SendTransparent(remoteEndPoint, localEndPoint, resp, SIPEndPoint.ParseSIPEndPoint(m_proxySocketLoopback), m_regAgentSocket, topVia.Branch)
elif sipMethod == "NOTIFY" or sipMethod == "SUBSCRIBE":
if not IsFromNotifierServer() and not IsFromApplicationServer():
# Responses for SIP Notifier Server.
sys.SendInternal(remoteEndPoint, localEndPoint, resp, outSocket)
else:
# Subscribe and notify responses for external user agents.
SendExternalResponse(resp, outSocket, publicip)
else:
if IsFromApplicationServer():
# Response from an Application Server for an external UA.
SendExternalResponse(resp, outSocket, publicip)
else:
# Responses from external UAs for SIP Application Servers.
if resp.Header.CSeqMethod.ToString() == "ACK" or resp.Header.CSeqMethod.ToString() == "CANCEL" or resp.Header.CSeqMethod.ToString() == "INVITE":
dispatcherEndPoint = sys.DispatcherLookup(resp)
if dispatcherEndPoint == None:
dispatcherEndPoint = GetAppServer()
sys.SendTransparent(remoteEndPoint, localEndPoint, resp, SIPEndPoint.ParseSIPEndPoint(m_proxySocketInternal), dispatcherEndPoint, topVia.Branch)
else:
sys.SendInternal(remoteEndPoint, localEndPoint, resp, SIPEndPoint.ParseSIPEndPoint(m_proxySocketInternal))
#===== End SIP Response Processing =====
Wireshark is running around the clock, but no traffic to those ports.
If you need any other info, please let me know.