[asterisk-scf-commits] asterisk-scf/release/sip.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Jan 13 13:53:01 CST 2012


branch "master" has been updated
       via  d674b4ff321ff8eeb2581246115d820c152c7214 (commit)
      from  71d0f466053836c6ffec7a257f4560213a97637a (commit)

Summary of changes:
 config/README.txt         |    1 +
 config/SipConfigurator.py |  120 +++++++++++++++++++++++---------------------
 2 files changed, 64 insertions(+), 57 deletions(-)
 create mode 100644 config/README.txt


- Log -----------------------------------------------------------------
commit d674b4ff321ff8eeb2581246115d820c152c7214
Author: Darren Sessions <dsessions at digium.com>
Date:   Fri Jan 13 13:52:26 2012 -0600

    Updated the SipConfigurator python script to reflect new file paths and naming conventions. Added a quick system path append command for /opt/Ice-3.4/python to make the script work straight from the gitall/sip/config directory. Added a README.txt file with a quick note about needing to set the ASTSCF_HOME env variable which is required within the script to find slice dependancies.

diff --git a/config/README.txt b/config/README.txt
new file mode 100644
index 0000000..2f7d4ac
--- /dev/null
+++ b/config/README.txt
@@ -0,0 +1 @@
+Please set the 'ASTSCF_HOME' environment variable to the Asterisk SCF 'gitall' directory path.
diff --git a/config/SipConfigurator.py b/config/SipConfigurator.py
index c7c9f6f..49cc83f 100755
--- a/config/SipConfigurator.py
+++ b/config/SipConfigurator.py
@@ -16,30 +16,36 @@
 # at the top of the source tree.
 #
 
-# Sip configurator
+# SIP configurator
 
 # Bring in the common configuration infrastructure
-import ConfigParser, Ice, Configurator, sys, os, traceback
+import os, sys
+
+sys.path.append(os.environ["ASTSCF_HOME"] + "/configurator")
+sys.path.append("/opt/Ice-3.4/python")
+
+import ConfigParser, Ice, Configurator, traceback
 
 # Load our component specific configuration definitions
-Ice.loadSlice("--underscore -I\"" + os.environ["ASTSCF_HOME"] + "\"" + " -I" + Ice.getSliceDir() + " --all ../slice/AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice")
-import AsteriskSCF.Configuration.SipSessionManager.V1
+Ice.loadSlice("--underscore -I\"" + os.environ["ASTSCF_HOME"] + "/slice/slice\"" + " -I" + Ice.getSliceDir() + " --all " + os.environ["ASTSCF_HOME"] + "/sip/slice/AsteriskSCF/Configuration/SIPSessionManager/SIPConfigurationIf.ice")
+
+import AsteriskSCF.Configuration.SIPSessionManager.V1
 
 
 # Add our own visitor implementations for the sections we support
-class SipSectionVisitors(Configurator.SectionVisitors):
+class SIPSectionVisitors(Configurator.SectionVisitors):
     def visit_general(self, config, section):
-        group = AsteriskSCF.Configuration.SipSessionManager.V1.SipGeneralGroup()
+        group = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPGeneralGroup()
         group.configurationItems = { }
         self.groups.append(group)
 
     def visit_transport_udp(self, config, section):
-        group = AsteriskSCF.Configuration.SipSessionManager.V1.SipUDPTransportGroup()
+        group = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPUDPTransportGroup()
         group.name = section
         group.configurationItems = { }
 
         mapper = Configurator.OptionMapper()
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipHostItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPHostItem()
         mapper.map('host', item, 'host', 'address', config.get, None)
         mapper.map('port', item, 'port', 'address', config.getint, 5060)
         for option in config.options(section):
@@ -50,12 +56,12 @@ class SipSectionVisitors(Configurator.SectionVisitors):
         self.groups.append(group)
 
     def visit_transport_tcp(self, config, section):
-        group = AsteriskSCF.Configuration.SipSessionManager.V1.SipTCPTransportGroup()
+        group = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPTCPTransportGroup()
         group.name = section
         group.configurationItems = { }
 
         mapper = Configurator.OptionMapper()
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipHostItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPHostItem()
         mapper.map('host', item, 'host', 'address', config.get, None)
         mapper.map('port', item, 'port', 'address', config.getint, 5060)
         for option in config.options(section):
@@ -66,12 +72,12 @@ class SipSectionVisitors(Configurator.SectionVisitors):
         self.groups.append(group)
 
     def visit_transport_tls(self, config, section):
-        group = AsteriskSCF.Configuration.SipSessionManager.V1.SipTLSTransportGroup()
+        group = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPTLSTransportGroup()
         group.name = section
         group.configurationItems = { }
 
         mapper = Configurator.OptionMapper()
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipHostItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPHostItem()
         mapper.map('host', item, 'host', 'address', config.get, None)
         mapper.map('port', item, 'port', 'address', config.getint, 5060)
         for option in config.options(section):
@@ -82,16 +88,16 @@ class SipSectionVisitors(Configurator.SectionVisitors):
         self.groups.append(group)
 
     def visit_transport_stun(self, config, section):
-        group = AsteriskSCF.Configuration.SipSessionManager.V1.SipSTUNTransportGroup()
+        group = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPSTUNTransportGroup()
         group.name = section
         group.configurationItems = {}
         mapper = Configurator.OptionMapper()
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipSignalingSTUNHostItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPSignalingSTUNHostItem()
         mapper.map('stunhost', item, 'address', 'stunServer', config.get, None)
         mapper.map('stunport', item, 'port', 'stunServer', config.getint, 3478)
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipHostItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPHostItem()
         mapper.map('baseaddress', item, 'host', 'baseAddress', config.get, None)
         mapper.map('baseport', item, 'port', 'baseAddress', config.getint, 4512)
 
@@ -114,23 +120,23 @@ class SipSectionVisitors(Configurator.SectionVisitors):
 
                 for contact in contacts:
                     uri, slash, expiration = contact.partition('/')
-                    info = AsteriskSCF.Configuration.SipSessionManager.V1.ContactInfo()
+                    info = AsteriskSCF.Configuration.SIPSessionManager.V1.ContactInfo()
                     info.contactURI = uri
                     info.expiration = int(expiration)
                     ret.append(info)
 
                 return ret
 
-        group = AsteriskSCF.Configuration.SipSessionManager.V1.SipRegistrationGroup()
+        group = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPRegistrationGroup()
         group.name = section
         group.configurationItems = {}
 
         mapper = Configurator.OptionMapper()
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipClientRegistrationItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPClientRegistrationItem()
 
         mapper.map('aor', item, 'aor', 'registration', config.get, None)
-        mapper.map('expiration', item, 'defaultExpiration', 'registration', config.getint, AsteriskSCF.Configuration.SipSessionManager.V1.DefaultRegistrationExpirationSeconds)
+        mapper.map('expiration', item, 'defaultExpiration', 'registration', config.getint, AsteriskSCF.Configuration.SIPSessionManager.V1.DefaultRegistrationExpirationSeconds)
         handler = RegistrationContactHandler(config)
         mapper.map('contacts', item, 'contacts', 'registration', handler.get, None)
 
@@ -142,13 +148,13 @@ class SipSectionVisitors(Configurator.SectionVisitors):
         self.groups.append(group)
 
     def visit_identity(self, config, section):
-        group = AsteriskSCF.Configuration.SipSessionManager.V1.IdentityGroup()
+        group = AsteriskSCF.Configuration.SIPSessionManager.V1.IdentityGroup()
         group.name = section
         group.configurationItems = { }
 
         mapper = Configurator.OptionMapper()
 
-        item =  AsteriskSCF.Configuration.SipSessionManager.V1.IdentityItem()
+        item =  AsteriskSCF.Configuration.SIPSessionManager.V1.IdentityItem()
 	#      map(option, object, item, item_name, method, default)
         mapper.map('name', item, 'name', 'id', config.get, None)
         mapper.map('number', item, 'number', 'id', config.get, None)
@@ -161,15 +167,15 @@ class SipSectionVisitors(Configurator.SectionVisitors):
         self.groups.append(group)
 
     def visit_endpoint(self, config, section):
-        group = AsteriskSCF.Configuration.SipSessionManager.V1.SipEndpointGroup()
+        group = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPEndpointGroup()
         group.name = section
         group.configurationItems = { }
 
         mapper = Configurator.OptionMapper()
 
-        mapper.map('routing', AsteriskSCF.Configuration.SipSessionManager.V1.SipRoutingItem(), 'routingServiceName', 'routingService', config.get, None)
+        mapper.map('routing', AsteriskSCF.Configuration.SIPSessionManager.V1.SIPRoutingItem(), 'routingServiceName', 'routingService', config.get, None)
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.IdentityItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.IdentityItem()
         mapper.map('name', item, 'name', 'identity', config.get, None)
         mapper.map('number', item, 'number', 'identity', config.get, None)
 
@@ -178,29 +184,29 @@ class SipSectionVisitors(Configurator.SectionVisitors):
             ids = config.get(section, 'ids')
             idList = ids.split(',')
             for id in idList:
-                item = AsteriskSCF.Configuration.SipSessionManager.V1.IdentityGroupRef()
+                item = AsteriskSCF.Configuration.SIPSessionManager.V1.IdentityGroupRef()
                 item.identityGroupName = id
                 group.configurationItems[id] = item
 	except ConfigParser.NoOptionError:
 	    # It's legit to omit the ids option from this section.
 	    pass
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipSourceTransportAddressItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPSourceTransportAddressItem()
         mapper.map('sourcehost', item, 'host', 'sourceaddress', config.get, None)
         mapper.map('sourceport', item, 'port', 'sourceaddress', config.getint, 5060)
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipTargetDestinationAddressItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPTargetDestinationAddressItem()
         mapper.map('targethost', item, 'host', 'targetaddress', config.get, None)
         mapper.map('targetport', item, 'port', 'targetaddress', config.getint, 5060)
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipSignalingNATItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPSignalingNATItem()
         mapper.map('enablestun', item, 'stun', 'enableSTUN', config.get, None)
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipMediaNATItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPMediaNATItem()
         mapper.map('enablertpoverice', item, 'enableICE', 'enableRTPICE', config.get, None)
         mapper.map('enableturn', item, 'enableTURN', 'enableRTPICE', config.get, None)
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SRTPCryptoItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SRTPCryptoItem()
                
         class CryptoKeyHandler:
                 def __init__(self, config, keyItem):
@@ -213,7 +219,7 @@ class SipSectionVisitors(Configurator.SectionVisitors):
                 def getKey(self, section, item):
                     self.item.cryptoKey = self.config.get(section, item)
                     
-        item.cryptoKeys = [ AsteriskSCF.Configuration.SipSessionManager.V1.SRTPCryptoKey() ]
+        item.cryptoKeys = [ AsteriskSCF.Configuration.SIPSessionManager.V1.SRTPCryptoKey() ]
         mapper.map('enableauth', item, 'enableAuthentication', 'srtpCryptoSettings', config.get, None)
         mapper.map('enableencryption', item, 'enableEncryption', 'srtpCryptoSettings', config.get, None)
         handler = CryptoKeyHandler(config, item.cryptoKeys[0])
@@ -225,43 +231,43 @@ class SipSectionVisitors(Configurator.SectionVisitors):
                 self.config = config
             def get(self, section, item):
                 if self.config.get(section, item) == 'inbound':
-                    return AsteriskSCF.Configuration.SipSessionManager.V1.SipAllowableCallDirection.Inbound
+                    return AsteriskSCF.Configuration.SIPSessionManager.V1.SIPAllowableCallDirection.Inbound
                 elif self.config.get(section, item) == 'outbound':
-                    return AsteriskSCF.Configuration.SipSessionManager.V1.SipAllowableCallDirection.Outbound
+                    return AsteriskSCF.Configuration.SIPSessionManager.V1.SIPAllowableCallDirection.Outbound
                 elif self.config.get(section, item) == 'both':
-                    return AsteriskSCF.Configuration.SipSessionManager.V1.SipAllowableCallDirection.Both
+                    return AsteriskSCF.Configuration.SIPSessionManager.V1.SIPAllowableCallDirection.Both
                 elif self.config.get(section, item) == 'none':
-                    return AsteriskSCF.Configuration.SipSessionManager.V1.SipAllowableCallDirection.Disabled
+                    return AsteriskSCF.Configuration.SIPSessionManager.V1.SIPAllowableCallDirection.Disabled
 
         transformer = AllowableCallDirectionTransformer(config)
 
-        mapper.map('direction', AsteriskSCF.Configuration.SipSessionManager.V1.SipAllowableCallDirectionItem(), 'callDirection', 'callDirection', transformer.get, None)
+        mapper.map('direction', AsteriskSCF.Configuration.SIPSessionManager.V1.SIPAllowableCallDirectionItem(), 'callDirection', 'callDirection', transformer.get, None)
 
-        mapper.map('securetransport', AsteriskSCF.Configuration.SipSessionManager.V1.SipEndpointTransportItem(), 'secureTransport', 'transport', transformer.get, None)
+        mapper.map('securetransport', AsteriskSCF.Configuration.SIPSessionManager.V1.SIPEndpointTransportItem(), 'secureTransport', 'transport', transformer.get, None)
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipRTPMediaServiceItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPRTPMediaServiceItem()
         mapper.map('rtpoveripv6', item, 'requireIPv6', 'mediaservice', config.getboolean, None)
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.DirectMediaItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.DirectMediaItem()
         mapper.map('directmedia', item, 'enabled', 'directmedia', config.getboolean, None)
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipUDPTLMediaServiceItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPUDPTLMediaServiceItem()
         mapper.map('udptloveripv6', item, 'requireIPv6', 'udptlmediaservice', config.getboolean, None)
         mapper.map('udptloverice', item, 'enableICE', 'udptlmediaservice', config.getboolean, None)
         mapper.map('udptlwithturn', item, 'enableTURN', 'udptlmediaservice', config.getboolean, None)
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipCryptoCertificateItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPCryptoCertificateItem()
         mapper.map('certificateauthorityfile', item, 'certificateAuthority', 'cryptocert', config.get, None)
         mapper.map('certificatefile', item, 'certificate', 'cryptocert', config.get, None)
         mapper.map('privatekeyfile', item, 'privateKey', 'cryptocert', config.get, None)
         mapper.map('privatekeypassword', item, 'privateKeyPassword', 'cryptocert', config.get, None)
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipCryptoRequirementsItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPCryptoRequirementsItem()
         mapper.map('requireverifiedserver', item, 'requireVerifiedServer', 'cryptorequirements', config.getboolean, None)
         mapper.map('requireverifiedclient', item, 'requireVerifiedClient', 'cryptorequirements', config.getboolean, None)
         mapper.map('requireclientcertificate', item, 'requireClientCertificate', 'cryptorequirements', config.getboolean, None)
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipCryptoItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPCryptoItem()
         mapper.map('supportedciphers', item, 'supportedCiphers', 'crypto', config.get, None)
         mapper.map('tlsservername', item, 'serverName', 'crypto', config.get, None)
         mapper.map('tlstimeout', item, 'timeout', 'crypto', config.getint, None)
@@ -271,15 +277,15 @@ class SipSectionVisitors(Configurator.SectionVisitors):
                 self.config = config
             def get(self, section, item):
                 if self.config.get(section, item) == 'unspecified':
-                    return AsteriskSCF.Configuration.SipSessionManager.V1.TLSProtocolMethod.PROTOCOLMETHODUNSPECIFIED
+                    return AsteriskSCF.Configuration.SIPSessionManager.V1.TLSProtocolMethod.PROTOCOLMETHODUNSPECIFIED
                 elif self.config.get(section, item) == 'tlsv1':
-                    return AsteriskSCF.Configuration.SipSessionManager.V1.TLSProtocolMethod.PROTOCOLMETHODTLSV1
+                    return AsteriskSCF.Configuration.SIPSessionManager.V1.TLSProtocolMethod.PROTOCOLMETHODTLSV1
                 elif self.config.get(section, item) == 'sslv2':
-                    return AsteriskSCF.Configuration.SipSessionManager.V1.TLSProtocolMethod.PROTOCOLMETHODTSSLV2
+                    return AsteriskSCF.Configuration.SIPSessionManager.V1.TLSProtocolMethod.PROTOCOLMETHODTSSLV2
                 elif self.config.get(section, item) == 'sslv3':
-                    return AsteriskSCF.Configuration.SipSessionManager.V1.TLSProtocolMethod.PROTOCOLMETHODSSLV3
+                    return AsteriskSCF.Configuration.SIPSessionManager.V1.TLSProtocolMethod.PROTOCOLMETHODSSLV3
                 elif self.config.get(section, item) == 'sslv23':
-                    return AsteriskSCF.Configuration.SipSessionManager.V1.TLSProtocolMethod.PROTOCOLMETHODSSLV23
+                    return AsteriskSCF.Configuration.SIPSessionManager.V1.TLSProtocolMethod.PROTOCOLMETHODSSLV23
 
         transformer = TLSProtocolMethodTransformer(config)
         mapper.map('tlsprotocolmethod', item, 'protocolMethod', 'crypto', transformer.get, None)
@@ -289,15 +295,15 @@ class SipSectionVisitors(Configurator.SectionVisitors):
                 self.config = config
             def get(self, section, item):
                 if self.config.get(section, item) == 'info':
-                    return AsteriskSCF.Configuration.SipSessionManager.V1.SipDTMFOption.INFO
+                    return AsteriskSCF.Configuration.SIPSessionManager.V1.SIPDTMFOption.INFO
                 if self.config.get(section, item) == 'rfc4733' or self.config.get(section.item) == 'rfc2833':
-                    return AsteriskSCF.Configuration.SipSessionManager.V1.SipDTMFOption.RFC4733
+                    return AsteriskSCF.Configuration.SIPSessionManager.V1.SIPDTMFOption.RFC4733
                 if self.config.get(section, item) == 'inband':
-                    return AsteriskSCF.Configuration.SipSessionManager.V1.SipDTMFOption.Inband
+                    return AsteriskSCF.Configuration.SIPSessionManager.V1.SIPDTMFOption.Inband
 
-        item = AsteriskSCF.Configuration.SipSessionManager.V1.SipDTMFItem()
+        item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPDTMFItem()
         dtmfTransformer = DTMFMethodTransformer(config)
-        mapper.map('dtmfmethod', item, 'dtmf', 'dtmfmethod', dtmfTransformer.get, AsteriskSCF.Configuration.SipSessionManager.V1.SipDTMFOption.RFC4733)
+        mapper.map('dtmfmethod', item, 'dtmf', 'dtmfmethod', dtmfTransformer.get, AsteriskSCF.Configuration.SIPSessionManager.V1.SIPDTMFOption.RFC4733)
 
         for option in config.options(section):
             mapper.execute(group, section, option)
@@ -307,7 +313,7 @@ class SipSectionVisitors(Configurator.SectionVisitors):
             formats = config.get(section, 'formats')
             configuredFormats = formats.split(',')
             for format in configuredFormats:
-                item = AsteriskSCF.Configuration.SipSessionManager.V1.SipMediaFormatItem()
+                item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPMediaFormatItem()
 
                 front, found, rest = format.partition('/')
                 if found:
@@ -351,7 +357,7 @@ class SipSectionVisitors(Configurator.SectionVisitors):
             registrations = config.get(section, 'registrations')
             registrationList = registrations.split(',')
             for reg in registrationList:
-                item = AsteriskSCF.Configuration.SipSessionManager.V1.SipRegistrationGroupRef()
+                item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPRegistrationGroupRef()
                 item.registrationGroupName = reg
                 group.configurationItems[reg] = item
         except:
@@ -375,9 +381,9 @@ class SipSectionVisitors(Configurator.SectionVisitors):
 
 # In order to do service locator based lookup we need to pass in a params object
 serviceLocatorParams = AsteriskSCF.Core.Discovery.V1.ServiceLocatorParams()
-serviceLocatorParams.category = AsteriskSCF.Configuration.SipSessionManager.V1.ConfigurationDiscoveryCategory
+serviceLocatorParams.category = AsteriskSCF.Configuration.SIPSessionManager.V1.ConfigurationDiscoveryCategory
 serviceLocatorParams.service = 'default' 
 
 # Make a configurator application and let it run
-app = Configurator.ConfiguratorApp('Sip.config', SipSectionVisitors(), None, serviceLocatorParams)
+app = Configurator.ConfiguratorApp('SIP.config', SIPSectionVisitors(), None, serviceLocatorParams)
 sys.exit(app.main(sys.argv))

-----------------------------------------------------------------------


-- 
asterisk-scf/release/sip.git



More information about the asterisk-scf-commits mailing list