summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2016-08-18 11:50:11 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-08-18 11:50:11 -0500
commit43254c2db7b2ae95f158e00676aff5b4a3bb51c8 (patch)
treef591c0e4ef24bffa8baf96270b682696aa2e70d7 /contrib
parente3d72c7aee2ca610c062650369ceabb09ee5256c (diff)
parent60275359bc6646a6000dbaf1e262763f409fb6fe (diff)
Merge "sip_to_pjsip: Parse register even with transport." into 13
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/scripts/sip_to_pjsip/sip_to_pjsip.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/contrib/scripts/sip_to_pjsip/sip_to_pjsip.py b/contrib/scripts/sip_to_pjsip/sip_to_pjsip.py
index a4f03b508..4a6004ae1 100755
--- a/contrib/scripts/sip_to_pjsip/sip_to_pjsip.py
+++ b/contrib/scripts/sip_to_pjsip/sip_to_pjsip.py
@@ -926,6 +926,17 @@ class Registration:
the right of the user, then finish by using rpartition calls to remove
everything to the left of the user.
"""
+ self.peer = ''
+ self.protocol = 'udp'
+ protocols = ['udp', 'tcp', 'tls']
+ for protocol in protocols:
+ position = user_part.find(protocol + '://')
+ if -1 < position:
+ post_transport = user_part[position + 6:]
+ self.peer, sep, self.protocol = user_part[:position + 3].rpartition('?')
+ user_part = post_transport
+ break
+
colons = user_part.count(':')
if (colons == 3):
# :domainport:secret:authuser
@@ -946,11 +957,7 @@ class Registration:
# Invalid setting
raise
- pre_domain, sep, self.domain = pre_auth.partition('@')
- self.peer, sep, post_peer = pre_domain.rpartition('?')
- transport, sep, self.user = post_peer.rpartition('://')
-
- self.protocol = transport if transport else 'udp'
+ self.user, sep, self.domain = pre_auth.partition('@')
def write(self, pjsip, nmapped):
"""