Skip to content

Commit 8d00b5d

Browse files
VolsavrVolsavr
andauthored
Uri configuration for call operation (#448)
* call options with ability to change from_uri & from_display_name * call options with ability to change from_uri & from_display_name --------- Co-authored-by: Volsavr <[email protected]>
1 parent a6e97cc commit 8d00b5d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/sip_ua.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ export 'src/enum_helper.dart';
22
export 'src/sip_message.dart';
33
export 'src/sip_ua_helper.dart';
44
export 'src/transport_type.dart';
5+
export 'src/uri.dart';
6+
7+

lib/src/rtc_session.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,16 @@ class RTCSession extends EventManager implements Owner {
307307
_ua.contact!.outbound = true;
308308
_contact = _ua.contact.toString();
309309

310+
bool isFromUriOptionPresent = options['from_uri'] != null;
311+
312+
//set from_uri and from_display_name if present
313+
if (isFromUriOptionPresent) {
314+
requestParams['from_display_name'] = options['from_display_name'] ?? '';
315+
requestParams['from_uri'] = URI.parse(options['from_uri']);
316+
extraHeaders
317+
.add('P-Preferred-Identity: ${_ua.configuration.uri.toString()}');
318+
}
319+
310320
if (anonymous) {
311321
requestParams['from_display_name'] = 'Anonymous';
312322
requestParams['from_uri'] = URI('sip', 'anonymous', 'anonymous.invalid');

0 commit comments

Comments
 (0)