sip_to_pjsip: Write username even without authname.
authorAlexander Traud <pabstraud@compuserve.com>
Thu, 18 Aug 2016 13:15:38 +0000 (15:15 +0200)
committerAlexander Traud <pabstraud@compuserve.com>
Thu, 18 Aug 2016 13:15:38 +0000 (15:15 +0200)
When using the migration script sip_to_pjsip.py, now the (mandatory) username is
written to pjsip.conf, even if there was no (optional) authname in the register
string in sip.conf.

ASTERISK-22374

Change-Id: Ie53e1997104cd2674821688b8a8247249f5e156f

contrib/scripts/sip_to_pjsip/sip_to_pjsip.py

index 8909216..64bb492 100755 (executable)
@@ -981,9 +981,8 @@ class Registration:
         if hasattr(self, 'secret') and self.secret:
             set_value('password', self.secret, auth_section, pjsip, nmapped,
                       'auth')
-            if hasattr(self, 'authuser'):
-                set_value('username', self.authuser or self.user, auth_section,
-                          pjsip, nmapped, 'auth')
+            set_value('username', self.authuser if hasattr(self, 'authuser')
+                      else self.user, auth_section, pjsip, nmapped, 'auth')
             set_value('outbound_auth', auth_section, section, pjsip, nmapped,
                       'registration')