mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 03:59:01 +00:00
sip_to_pjsip: Enable python3 compatibility.
The script remains compatible with Python 2.7 but now also works with Python 3.3 and newer; to ease the migration from chan_sip to chan_pjsip. ASTERISK-27811 Change-Id: I59cc6b52a1a89777eebcf25b3023bdf93babf835
This commit is contained in:
committed by
Corey Farrell
parent
9f1e1d153a
commit
2d81709ab1
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
|
||||
from sip_to_pjsip import cli_options
|
||||
from sip_to_pjsip import convert
|
||||
import sip_to_pjsip
|
||||
import optparse
|
||||
@@ -18,7 +17,7 @@ def write_pjsip(filename, pjsip, non_mappings):
|
||||
pjsip.write(fp)
|
||||
|
||||
except IOError:
|
||||
print "Could not open file ", filename, " for writing"
|
||||
print("Could not open file " + filename + " for writing")
|
||||
|
||||
def cli_options():
|
||||
"""
|
||||
@@ -70,12 +69,12 @@ if __name__ == "__main__":
|
||||
sip = sqlconfigparser.SqlConfigParser(table)
|
||||
sip_to_pjsip.sip = sip
|
||||
sip.connect(user,password,host,port,database)
|
||||
print 'Please, report any issue at:'
|
||||
print ' https://issues.asterisk.org/'
|
||||
print 'Reading', sip_filename
|
||||
print('Please, report any issue at:')
|
||||
print(' https://issues.asterisk.org/')
|
||||
print('Reading ' + sip_filename)
|
||||
sip.read(sip_filename)
|
||||
print 'Converting to PJSIP realtime sql...'
|
||||
print('Converting to PJSIP realtime sql...')
|
||||
pjsip, non_mappings = convert(sip, pjsip_filename, dict(), False)
|
||||
print 'Writing', pjsip_filename
|
||||
print('Writing ' + pjsip_filename)
|
||||
write_pjsip(pjsip_filename, pjsip, non_mappings)
|
||||
|
||||
|
Reference in New Issue
Block a user