sip_to_pjsip: Map (session-)timers correctly.
authorAlexander Traud <pabstraud@compuserve.com>
Thu, 18 Aug 2016 13:16:45 +0000 (15:16 +0200)
committerAlexander Traud <pabstraud@compuserve.com>
Thu, 18 Aug 2016 13:16:45 +0000 (15:16 +0200)
When using the migration script sip_to_pjsip.py, session-timers=accept and
session-timers=refuse were mapped to wrong values.

ASTERISK-22374

Change-Id: Ie4e90d5f6a29aff07837b7fe5bc8aea5fb6fc092

contrib/scripts/sip_to_pjsip/sip_to_pjsip.py

index 8909216..444f4db 100755 (executable)
@@ -133,11 +133,14 @@ def set_timers(key, val, section, pjsip, nmapped):
     found in sip.conf.
     """
     # pjsip.conf values can be yes/no, required, always
+    # 'required' is a new feature of chan_pjsip, which rejects
+    #            all SIP clients not supporting Session Timers
+    # 'Accept' is the default value of chan_sip and maps to 'yes'
+    # chan_sip ignores the case, for example 'session-timers=Refuse'
+    val = val.lower()
     if val == 'originate':
         set_value('timers', 'always', section, pjsip, nmapped)
-    elif val == 'accept':
-        set_value('timers', 'required', section, pjsip, nmapped)
-    elif val == 'never':
+    elif val == 'refuse':
         set_value('timers', 'no', section, pjsip, nmapped)
     else:
         set_value('timers', 'yes', section, pjsip, nmapped)