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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 26 15:42:44 CDT 2013


Author: mmichelson
Date: Mon Aug 26 15:42:42 2013
New Revision: 397670

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397670
Log:
Alter the method for setting mailboxes for endpoints/aors.

Rather than relying on the 'subscribemwi' option, use the 'mailbox'
setting directly. The 'subscribemwi' option can then be used to
determine whether the listed mailboxes should go on the endpoint
and aor.

Also, the logic was reversed from what it should have been.

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=397670&r1=397669&r2=397670
==============================================================================
--- 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 Mon Aug 26 15:42:42 2013
@@ -178,14 +178,21 @@
     else:
         set_value('max_contacts', 1, section, pjsip, nmapped, 'aor')
 
-def from_subscribemwi(key, val, section, pjsip, nmapped):
-    """Checks the subscribemwi value in sip.conf.  If yes places the
-       mailbox value in mailboxes within the endpoint, otherwise puts
-       it in the aor.
-    """
-    mailboxes = sip.get('mailbox', section, pjsip)
-    type = 'endpoint' if val == 'yes' else 'aor'
-    set_value('mailboxes', mailboxes, section, pjsip, nmapped, type)
+def from_mailbox(key, val, section, pjsip, nmapped):
+    """Determines whether a mailbox configured in sip.conf should map to
+       an endpoint or aor in pjsip.conf. If subscribemwi is true, then the
+       mailboxes are set on an aor. Otherwise the mailboxes are set on the
+       endpoint.
+    """
+
+    try:
+        subscribemwi = sip.get('subscribemwi', section)
+    except LookupError:
+        # No subscribemwi option means default it to 'no'
+        subscribemwi = 'no'
+
+    set_value('mailboxes', val, section, pjsip, nmapped, 'aor' if subscribemwi ==
+            'yes' else 'endpoint')
 
 ###############################################################################
 
@@ -232,12 +239,12 @@
     ['pickupgroup',        set_value],
     ['namedcallgroup',     set_value],
     ['namedpickupgroup',   set_value],
+    ['mailbox',            from_mailbox],
     ['busylevel',          set_value('devicestate_busy_at')],
 
 ############################ maps to an aor ###################################
 
     ['host',               from_host],           # contact, max_contacts
-    ['subscribemwi',       from_subscribemwi],   # mailboxes
     ['qualifyfreq',        set_value('qualify_frequency', type='aor')],
 
 ############################# maps to auth#####################################




More information about the asterisk-commits mailing list