Skip to content

Commit

Permalink
Client Logs CleanUp
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacakakpo1 committed Aug 26, 2024
1 parent 97c8829 commit 830dd73
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 41 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,15 @@ lib/generated_plugin_registrant.dart
android/app/google-services.json
.idea/libraries/Dart_SDK.xml
.idea/libraries/Flutter_Plugins.xml
.idea/other.xml
.idea/libraries/Flutter_Plugins.xml
android/.idea/appInsightsSettings.xml
android/.idea/compiler.xml
android/.idea/deploymentTargetSelector.xml
android/.idea/gradle.xml
android/.idea/kotlinc.xml
android/.idea/migrations.xml
android/.idea/misc.xml
android/.idea/other.xml
android/.idea/vcs.xml
android/app/lint-baseline.xml
52 changes: 26 additions & 26 deletions .idea/libraries/Flutter_Plugins.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions android/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Future _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
case SocketMethod.BYE:
{
//make sure to disconnect the telnyxclient on Bye for Decline
// Only disconnect the socket when the call was ended from push notifications
print("telnyxClient disconnected");
telnyxClient.disconnect();
break;
Expand Down
2 changes: 0 additions & 2 deletions lib/main_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ class MainViewModel with ChangeNotifier {
}

void call(String destination) {
_telnyxClient.txSocket.close();
if (!_telnyxClient.isConnected()) {}
_currentCall = _telnyxClient.newInvite(
_localName, _localNumber, destination, "Fake State",
customHeaders: {"X-Header-1": "Value1", "X-Header-2": "Value2"});
Expand Down
10 changes: 5 additions & 5 deletions packages/telnyx_webrtc/lib/call.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CallHandler {
/// The Call class which is used for call related methods such as hold/mute or
/// creating invitations, declining calls, etc.
class Call {
Call(this._txSocket, this._txClient, this.sessid, this.ringToneFile,
Call(this.txSocket, this._txClient, this.sessid, this.ringToneFile,
this.ringBackFile, this.callHandler, this.callEnded);

late CallHandler callHandler;
Expand All @@ -48,7 +48,7 @@ class Call {
final audioService = AudioService();
final mobileAudioPlayer = AssetsAudioPlayer.newPlayer();
final Function callEnded;
final TxSocket _txSocket;
final TxSocket txSocket;
final TelnyxClient _txClient;
final String sessid;
final String ringBackFile;
Expand Down Expand Up @@ -123,7 +123,7 @@ class Call {
_logger.d("Session end peer connection null");
}

_txSocket.send(jsonByeMessage);
txSocket.send(jsonByeMessage);
if (peerConnection != null) {
peerConnection?.closeSession();
} else {
Expand Down Expand Up @@ -167,7 +167,7 @@ class Call {
params: infoParams);

String jsonDtmfMessage = jsonEncode(dtmfMessageBody);
_txSocket.send(jsonDtmfMessage);
txSocket.send(jsonDtmfMessage);
}

/// Either mutes or unmutes local audio based on the current mute state
Expand Down Expand Up @@ -219,7 +219,7 @@ class Call {
jsonrpc: JsonRPCConstant.jsonrpc);

String jsonModifyMessage = jsonEncode(modifyMessage);
_txSocket.send(jsonModifyMessage);
txSocket.send(jsonModifyMessage);
}

// Example file path for 'web/assets/audio/sound.wav'
Expand Down
11 changes: 5 additions & 6 deletions packages/telnyx_webrtc/lib/telnyx_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class TelnyxClient {
try {
if (_pushMetaData != null) {
txSocket.hostAddress =
"$_storedHostAddress?voice_sdk_id=${_pushMetaData?.voice_sdk_id}";
"$_storedHostAddress?voice_sdk_id=${_pushMetaData?.voice_sdk_id}";
_logger.i(
'Connecting to WebSocket with voice_sdk_id :: ${_pushMetaData?.voice_sdk_id}');
print("Connecting to WebSocket :: ${txSocket.hostAddress}");
Expand Down Expand Up @@ -288,11 +288,10 @@ class TelnyxClient {

void connectWithCredential(CredentialConfig credentialConfig) {
_logger.i('connect()');
_logger.i('connecting to WebSocket $_storedHostAddress');
try {
if (_pushMetaData != null) {
txSocket.hostAddress =
"$_storedHostAddress?voice_sdk_id=${_pushMetaData?.voice_sdk_id}";
"$_storedHostAddress?voice_sdk_id=${_pushMetaData?.voice_sdk_id}";
_logger.i(
'Connecting to WebSocket with voice_sdk_id :: ${_pushMetaData?.voice_sdk_id}');
print("Connecting to WebSocket :: ${txSocket.hostAddress}");
Expand Down Expand Up @@ -326,8 +325,8 @@ class TelnyxClient {
}
}


@Deprecated("Use connect with token or credential login i.e connectWithCredential(..) or connectWithToken(..)")
@Deprecated(
"Use connect with token or credential login i.e connectWithCredential(..) or connectWithToken(..)")
void connect() {
_logger.i('connect()');
if (isConnected()) {
Expand Down Expand Up @@ -528,7 +527,7 @@ class TelnyxClient {
var base64State = base64.encode(utf8.encode(clientState));
updateCall(inviteCall);

inviteCall.peerConnection = Peer(txSocket);
inviteCall.peerConnection = Peer(inviteCall.txSocket);
inviteCall.peerConnection?.invite(
callerName,
callerNumber,
Expand Down
2 changes: 1 addition & 1 deletion packages/telnyx_webrtc/lib/tx_socket.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class TxSocket {
void connect() async {
try {
print("TxSocket :: connect : $hostAddress");

_socket = await WebSocket.connect(hostAddress);
_logger.i('Connecting to $hostAddress');
_socket.pingInterval = const Duration(seconds: 10);
_socket.timeout(const Duration(seconds: 30));
onOpen.call();
Expand Down
2 changes: 1 addition & 1 deletion packages/telnyx_webrtc/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Enable real-time communication with WebRTC and Telnyx. Create and r
homepage: https://telnyx.com/
repository: https://github.com/team-telnyx/flutter-voice-sdk
issue_tracker: https://github.com/team-telnyx/flutter-voice-sdk/issues?q=is%3Aopen+is%3Aissue
version: 0.0.16
version: 0.0.17

environment:
sdk: ">=3.0.0 <3.22.3"
Expand Down

0 comments on commit 830dd73

Please sign in to comment.