[svn-commits] mmichelson: branch mmichelson/conversion_script r398501 - /team/mmichelson/co...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Sep 5 16:56:46 CDT 2013


Author: mmichelson
Date: Thu Sep  5 16:56:45 2013
New Revision: 398501

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=398501
Log:
Set up incoming authentication on endpoints.


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=398501&r1=398500&r2=398501
==============================================================================
--- 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 Thu Sep  5 16:56:45 2013
@@ -252,6 +252,24 @@
 
     set_value('mailboxes', val, section, pjsip, nmapped, 'aor' if subscribemwi ==
             'yes' else 'endpoint')
+
+def setup_auth(key, val, section, pjsip, nmapped):
+    """
+    Sets up authentication information for a specific endpoint based on the
+    'secret' setting on a peer in sip.conf
+    """
+    set_value('username', section, section, pjsip, nmapped, 'auth')
+    # In chan_sip, if a secret and an md5secret are both specified on a peer,
+    # then in practice, only the md5secret is used. If both are encountered then
+    # we build an auth section that has both an md5_cred and password. However,
+    # the auth_type will indicate to authenticators to use the md5_cred, so like
+    # with sip.conf, the password will be there but have no purpose.
+    if key == 'secret':
+        set_value('password', val, section, pjsip, nmapped, 'auth')
+    else:
+        set_value('md5_cred', val, section, pjsip, nmapped, 'auth')
+        set_value('auth_type', 'md5', section, pjsip, nmapped, 'auth')
+    set_value('auth', section, section, pjsip)
 
 ###############################################################################
 
@@ -300,6 +318,8 @@
     ['namedpickupgroup',   set_value],
     ['mailbox',            from_mailbox],
     ['busylevel',          set_value('devicestate_busy_at')],
+    ['secret',             setup_auth],
+    ['md5secret',          setup_auth],
 
 ############################ maps to an aor ###################################
 




More information about the svn-commits mailing list