[asterisk-commits] mmichelson: branch mmichelson/conversion_script r398879 - /team/mmichelson/co...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 11 18:02:00 CDT 2013


Author: mmichelson
Date: Wed Sep 11 18:01:58 2013
New Revision: 398879

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=398879
Log:
Avoid duplicating transport and registration configs when processing includes.


Modified:
    team/mmichelson/conversion_script/contrib/scripts/sip_to_pjsip/sip_to_pjsip.py

Modified: team/mmichelson/conversion_script/contrib/scripts/sip_to_pjsip/sip_to_pjsip.py
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/conversion_script/contrib/scripts/sip_to_pjsip/sip_to_pjsip.py?view=diff&rev=398879&r1=398878&r2=398879
==============================================================================
--- team/mmichelson/conversion_script/contrib/scripts/sip_to_pjsip/sip_to_pjsip.py (original)
+++ team/mmichelson/conversion_script/contrib/scripts/sip_to_pjsip/sip_to_pjsip.py Wed Sep 11 18:01:58 2013
@@ -1020,14 +1020,15 @@
         except LookupError:
             pass
 
-def convert(sip, filename, non_mappings):
+def convert(sip, filename, non_mappings, include):
     pjsip = astconfigparser.MultiOrderedConfigParser()
     non_mappings[filename] = astdicts.MultiOrderedDict()
     nmapped = non_mapped(non_mappings[filename])
-    # First thing we need to do is establish transports.
-    map_transports(sip, pjsip, nmapped)
+    if not include:
+        # Don't duplicate transport and registration configs
+        map_transports(sip, pjsip, nmapped)
+        map_registrations(sip, pjsip, nmapped)
     map_auth(sip, pjsip, nmapped)
-    map_registrations(sip, pjsip, nmapped)
     for section in sip.sections():
         if section == 'authentication':
             pass
@@ -1038,7 +1039,8 @@
     find_non_mapped(sip.sections(), nmapped)
 
     for key, val in sip.includes().iteritems():
-        pjsip.add_include(PREFIX + key, convert(val, PREFIX + key, non_mappings)[0])
+        pjsip.add_include(PREFIX + key, convert(val, PREFIX + key, non_mappings,
+                          True)[0])
     return pjsip, non_mappings
 
 def write_pjsip(filename, pjsip, non_mappings):
@@ -1089,5 +1091,5 @@
     # configuration parser for sip.conf
     sip = astconfigparser.MultiOrderedConfigParser()
     sip.read(sip_filename)
-    pjsip, non_mappings = convert(sip, pjsip_filename, dict())
+    pjsip, non_mappings = convert(sip, pjsip_filename, dict(), False)
     write_pjsip(pjsip_filename, pjsip, non_mappings)




More information about the asterisk-commits mailing list