Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(w2cCallMe): Add header to call session #2

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/src/rtc_session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class RTCSession extends EventManager implements Owner {

// Session info.
String? _direction;
String? _w2cC2CId;
NameAddrHeader? _local_identity;
NameAddrHeader? _remote_identity;
DateTime? _start_time;
Expand Down Expand Up @@ -173,6 +174,8 @@ class RTCSession extends EventManager implements Owner {

String? get direction => _direction;

String? get w2cC2CId => _w2cC2CId;

NameAddrHeader? get local_identity => _local_identity;

NameAddrHeader? get remote_identity => _remote_identity;
Expand Down Expand Up @@ -342,6 +345,7 @@ class RTCSession extends EventManager implements Owner {
[Function(RTCSession)? initCallback]) {
logger.d('init_incoming()');

_w2cC2CId = request.getHeader('X-w2c-call-me');
int? expires;
String? contentType = request.getHeader('Content-Type');

Expand Down
27 changes: 27 additions & 0 deletions lib/src/sip_ua_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,33 @@ class Call {
return peerHasMediaLine;
}

Map<String, dynamic> toJson() {
var isMuted = _session.isMuted();
var isOnHold = _session.isOnHold();
return {
'id': id
, 'sessionId': _session.id
, 'sessionStatus': _session.status
, 'sessionContact': _session.contact
, 'sessionDirection': _session.direction
, 'sessionW2cC2CId': _session.w2cC2CId ?? ''
, 'sessionLocalIdentity': local_identity
, 'sessionRemoteIdentity': remote_identity
, 'sessionRemoteDisplayName': remote_display_name
, 'sessionRemoteHasAudio': remote_has_audio
, 'sessionRemoteHasVideo': remote_has_video
, 'sessionStartTime': _session.start_time.toString()
, 'sessionEndTime': _session.end_time.toString()
, 'sessionIsInProgress': _session.isInProgress()
, 'sessionIsEstablished': _session.isEstablished()
, 'sessionIsEnded': _session.isEnded()
, 'sessionIsAudioMuted': isMuted['audio']
, 'sessionIsVideoMuted': isMuted['video']
, 'sessionIsLocalOnHold': isOnHold['local']
, 'sessionIsRemoteOnHold': isOnHold['remote']
};
}

Future<List<StatsReport>>? getStats([MediaStreamTrack? track]) {
return peerConnection?.getStats(track);
}
Expand Down