Skip to content

Commit 1b6395c

Browse files
committed
Add correct transport param to contact uri. close #161, close #160.
1 parent 5f82cec commit 1b6395c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

lib/src/registrator.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ class Registrator {
117117
}
118118

119119
NameAddrHeader contact = Grammar.parse(_contact, 'Contact')[0]['parsed'];
120-
contact.uri.clearParams();
121120

122121
extraContactUriParams.forEach((String param_key, dynamic param_value) {
123122
contact.uri.setParam(param_key, param_value);

lib/src/ua.dart

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,12 @@ class UA extends EventManager {
748748
throw Exceptions.ConfigurationError('sockets', _configuration.sockets);
749749
}
750750

751+
String transport = 'ws';
752+
753+
if (_configuration.sockets.isNotEmpty) {
754+
transport = _configuration.sockets.first.via_transport.toLowerCase();
755+
}
756+
751757
// Remove sockets instance from configuration object.
752758
// TODO(cloudwebrtc): need dispose??
753759
_configuration.sockets = null;
@@ -775,8 +781,12 @@ class UA extends EventManager {
775781
}
776782
// Contact URI.
777783
else {
778-
_configuration.contact_uri = URI('sip', Utils.createRandomToken(8),
779-
_configuration.via_host, null, <dynamic, dynamic>{'transport': 'ws'});
784+
_configuration.contact_uri = URI(
785+
'sip',
786+
Utils.createRandomToken(8),
787+
_configuration.via_host,
788+
null,
789+
<dynamic, dynamic>{'transport': transport});
780790
}
781791
_contact = Contact(_configuration.contact_uri);
782792
return;

0 commit comments

Comments
 (0)