Skip to content

Commit

Permalink
Implement Reconnection Logic for Network Roaming
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacakakpo1 committed Nov 5, 2024
1 parent c8a9e26 commit 37778ba
Show file tree
Hide file tree
Showing 15 changed files with 215 additions and 22 deletions.
18 changes: 18 additions & 0 deletions .lh/packages/telnyx_webrtc/lib/model/push_notification.dart.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"sourceFile": "packages/telnyx_webrtc/lib/model/push_notification.dart",
"activeCommit": 0,
"commits": [
{
"activePatchIndex": 0,
"patches": [
{
"date": 1730799598150,
"content": "Index: \n===================================================================\n--- \n+++ \n"
}
],
"date": 1730799598150,
"name": "Commit-0",
"content": "class PushNotification {\n PushNotification({\n required this.metadata,\n required this.message,\n });\n\n PushMetaData metadata;\n String message;\n}\n\nclass PushMetaData {\n PushMetaData(\n {this.caller_name, this.caller_number, this.call_id, this.voice_sdk_id});\n \n String? caller_name;\n String? caller_number;\n String? call_id;\n String? voice_sdk_id;\n bool? isAnswer;\n bool? isDecline;\n\n PushMetaData.fromJson(Map<dynamic, dynamic> json) {\n caller_name = json['caller_name'];\n caller_number = json['caller_number'];\n call_id = json['call_id'];\n voice_sdk_id = json['voice_sdk_id'];\n isAnswer = json['isAnswer'];\n isDecline = json['isDecline'];\n }\n\n Map<String, dynamic> toJson() {\n final Map<String, dynamic> data = <String, dynamic>{};\n data['caller_name'] = caller_name;\n data['caller_number'] = caller_number;\n data['call_id'] = call_id;\n data['voice_sdk_id'] = voice_sdk_id;\n data['isAnswer'] = isAnswer;\n data['isDecline'] = isDecline;\n return data;\n }\n}\n"
}
]
}
18 changes: 18 additions & 0 deletions .lh/packages/telnyx_webrtc/lib/model/socket_method.dart.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"sourceFile": "packages/telnyx_webrtc/lib/model/socket_method.dart",
"activeCommit": 0,
"commits": [
{
"activePatchIndex": 0,
"patches": [
{
"date": 1730809640028,
"content": "Index: \n===================================================================\n--- \n+++ \n"
}
],
"date": 1730809640028,
"name": "Commit-0",
"content": "class SocketMethod {\n static const ANSWER = \"telnyx_rtc.answer\";\n static const INVITE = \"telnyx_rtc.invite\";\n static const BYE = \"telnyx_rtc.bye\";\n static const MODIFY = \"telnyx_rtc.modify\";\n static const MEDIA = \"telnyx_rtc.media\";\n static const INFO = \"telnyx_rtc.info\";\n static const RINGING = \"telnyx_rtc.ringing\";\n static const CLIENT_READY = \"telnyx_rtc.clientReady\";\n static const GATEWAY_STATE = \"telnyx_rtc.gatewayState\";\n static const PING = \"telnyx_rtc.ping\";\n static const LOGIN = \"login\";\n static const ATTACH_CALL = \"telnyx_rtc.attachCalls\";\n static const ATTACH = \"telnyx_rtc.attach\";\n}\n"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"sourceFile": "packages/telnyx_webrtc/lib/model/verto/receive/received_message_body.dart",
"activeCommit": 0,
"commits": [
{
"activePatchIndex": 2,
"patches": [
{
"date": 1730798011877,
"content": "Index: \n===================================================================\n--- \n+++ \n"
},
{
"date": 1730798025300,
"content": "Index: \n===================================================================\n--- \n+++ \n@@ -37,10 +37,10 @@\n : null;\n if (json['params']['dialogParams'] != null) {\n dialogParams = DialogParams.fromJson(json['params']['dialogParams']);\n }\n- if (json['params']['voice_sdk_id'] != null) {\n- voiceSdkId = json['params']['voice_sdk_id'];\n+ if (json['voice_sdk_id'] != null) {\n+ voiceSdkId = json['voice_sdk_id'];\n Logger().i('Voice SDK ID: $voiceSdkId');\n }\n }\n \n"
},
{
"date": 1730808273018,
"content": "Index: \n===================================================================\n--- \n+++ \n@@ -113,9 +113,9 @@\n ReattachedParams({this.reattachedSessions});\n \n ReattachedParams.fromJson(Map<String, dynamic> json) {\n if (json['reattached_sessions'] != null) {\n- reattachedSessions = <Null>[];\n+ reattachedSessions = <dynamic>[];\n json['reattached_sessions'].forEach((v) {\n reattachedSessions!.add(v);\n });\n }\n"
}
],
"date": 1730798011877,
"name": "Commit-0",
"content": "import 'package:logger/logger.dart';\nimport '../send/invite_answer_message_body.dart';\nimport 'package:telnyx_webrtc/model/telnyx_socket_error.dart';\n\nclass ReceivedMessage {\n String? jsonrpc;\n int? id;\n String? method;\n ReattachedParams? reattachedParams;\n StateParams? stateParams;\n IncomingInviteParams? inviteParams;\n DialogParams? dialogParams;\n\n String? voiceSdkId;\n\n ReceivedMessage(\n {this.jsonrpc,\n this.id,\n this.method,\n this.reattachedParams,\n this.stateParams,\n this.inviteParams,\n this.dialogParams,\n this.voiceSdkId});\n\n ReceivedMessage.fromJson(Map<String, dynamic> json) {\n jsonrpc = json['jsonrpc'];\n id = json['id'];\n method = json['method'];\n reattachedParams = json['params'] != null\n ? ReattachedParams.fromJson(json['params'])\n : null;\n stateParams =\n json['params'] != null ? StateParams.fromJson(json['params']) : null;\n inviteParams = json['params'] != null\n ? IncomingInviteParams.fromJson(json['params'])\n : null;\n if (json['params']['dialogParams'] != null) {\n dialogParams = DialogParams.fromJson(json['params']['dialogParams']);\n }\n if (json['params']['voice_sdk_id'] != null) {\n voiceSdkId = json['params']['voice_sdk_id'];\n Logger().i('Voice SDK ID: $voiceSdkId');\n }\n }\n\n Map<String, dynamic> toJson() {\n final Map<String, dynamic> data = <String, dynamic>{};\n data['jsonrpc'] = jsonrpc;\n data['id'] = id;\n data['method'] = method;\n if (reattachedParams != null) {\n data['params'] = reattachedParams!.toJson();\n }\n if (stateParams != null) {\n data['params'] = stateParams!.toJson();\n }\n if (inviteParams != null) {\n data['params'] = inviteParams!.toJson();\n }\n if (dialogParams != null) {\n data['dialogParams'] = dialogParams!.toJson();\n }\n return data;\n }\n\n @override\n String toString() {\n return 'Received Message: {jsonrpc: $jsonrpc, id: $id method: $method, reattachedParams: $reattachedParams, stateParams: $stateParams}';\n }\n}\n\nclass ReceivedResult {\n String? jsonrpc;\n String? id;\n ResultParams? resultParams;\n String? sessId;\n TelnyxSocketError? error;\n\n ReceivedResult({this.jsonrpc, this.id, this.resultParams});\n\n ReceivedResult.fromJson(Map<String, dynamic> json) {\n jsonrpc = json['jsonrpc'];\n id = json['id'];\n resultParams =\n json['result'] != null ? ResultParams.fromJson(json['result']) : null;\n sessId = json['sessid'];\n error = json['error'] != null\n ? TelnyxSocketError.fromJson(json['error'])\n : null;\n }\n\n Map<String, dynamic> toJson() {\n final Map<String, dynamic> data = <String, dynamic>{};\n data['jsonrpc'] = jsonrpc;\n data['id'] = id;\n\n if (resultParams != null) {\n data['params'] = resultParams!.toJson();\n }\n return data;\n }\n\n @override\n String toString() {\n return 'Received Message: {jsonrpc: $jsonrpc, id: $id, stateParams: ${resultParams?.toJson()}}';\n }\n}\n\nclass ReattachedParams {\n List<dynamic>? reattachedSessions;\n\n ReattachedParams({this.reattachedSessions});\n\n ReattachedParams.fromJson(Map<String, dynamic> json) {\n if (json['reattached_sessions'] != null) {\n reattachedSessions = <Null>[];\n json['reattached_sessions'].forEach((v) {\n reattachedSessions!.add(v);\n });\n }\n }\n\n Map<String, dynamic> toJson() {\n final Map<String, dynamic> data = <String, dynamic>{};\n if (reattachedSessions != null) {\n data['reattached_sessions'] = reattachedSessions!.map((v) => v).toList();\n }\n return data;\n }\n\n @override\n String toString() {\n return 'Reattached Params : $reattachedSessions';\n }\n}\n\nclass ResultParams {\n StateParams? stateParams;\n\n ResultParams({this.stateParams});\n\n ResultParams.fromJson(Map<String, dynamic> json) {\n stateParams =\n json['params'] != null ? StateParams.fromJson(json['params']) : null;\n }\n\n Map<String, dynamic> toJson() {\n final Map<String, dynamic> data = <String, dynamic>{};\n if (stateParams != null) {\n data['params'] = stateParams!.toJson();\n }\n return data;\n }\n}\n\nclass StateParams {\n String? state;\n\n StateParams({this.state});\n\n StateParams.fromJson(Map<String, dynamic> json) {\n state = json['state'];\n }\n\n Map<String, dynamic> toJson() {\n final Map<String, dynamic> data = <String, dynamic>{};\n data['state'] = state;\n return data;\n }\n\n @override\n String toString() {\n return 'State Params : $state';\n }\n}\n\nclass IncomingInviteParams {\n String? callID;\n Variables? variables;\n String? sdp;\n String? callerIdName;\n String? callerIdNumber;\n String? calleeIdName;\n String? calleeIdNumber;\n String? telnyxSessionId;\n String? telnyxLegId;\n String? displayDirection;\n\n IncomingInviteParams(\n {this.callID,\n this.variables,\n this.sdp,\n this.callerIdName,\n this.callerIdNumber,\n this.calleeIdName,\n this.calleeIdNumber,\n this.telnyxSessionId,\n this.telnyxLegId,\n this.displayDirection});\n\n IncomingInviteParams.fromJson(Map<String, dynamic> json) {\n callID = json['callID'];\n variables = json['variables'] != null\n ? Variables.fromJson(json['variables'])\n : null;\n sdp = json['sdp'];\n callerIdName = json['caller_id_name'];\n callerIdNumber = json['caller_id_number'];\n calleeIdName = json['callee_id_name'];\n calleeIdNumber = json['callee_id_number'];\n telnyxSessionId = json['telnyx_session_id'];\n telnyxLegId = json['telnyx_leg_id'];\n displayDirection = json['display_direction'];\n }\n\n Map<String, dynamic> toJson() {\n final Map<String, dynamic> data = <String, dynamic>{};\n data['callID'] = callID;\n if (variables != null) {\n data['variables'] = variables!.toJson();\n }\n data['sdp'] = sdp;\n data['caller_id_name'] = callerIdName;\n data['caller_id_number'] = callerIdNumber;\n data['callee_id_name'] = calleeIdName;\n data['callee_id_number'] = calleeIdNumber;\n data['telnyx_session_id'] = telnyxSessionId;\n data['telnyx_leg_id'] = telnyxLegId;\n data['display_direction'] = displayDirection;\n return data;\n }\n}\n\nclass Variables {\n String? eventName;\n String? coreUUID;\n String? freeSWITCHHostname;\n String? freeSWITCHSwitchname;\n String? freeSWITCHIPv4;\n String? freeSWITCHIPv6;\n String? eventDateLocal;\n String? eventDateGMT;\n String? eventDateTimestamp;\n String? eventCallingFile;\n String? eventCallingFunction;\n String? eventCallingLineNumber;\n String? eventSequence;\n\n Variables(\n {this.eventName,\n this.coreUUID,\n this.freeSWITCHHostname,\n this.freeSWITCHSwitchname,\n this.freeSWITCHIPv4,\n this.freeSWITCHIPv6,\n this.eventDateLocal,\n this.eventDateGMT,\n this.eventDateTimestamp,\n this.eventCallingFile,\n this.eventCallingFunction,\n this.eventCallingLineNumber,\n this.eventSequence});\n\n Variables.fromJson(Map<String, dynamic> json) {\n eventName = json['Event-Name'];\n coreUUID = json['Core-UUID'];\n freeSWITCHHostname = json['FreeSWITCH-Hostname'];\n freeSWITCHSwitchname = json['FreeSWITCH-Switchname'];\n freeSWITCHIPv4 = json['FreeSWITCH-IPv4'];\n freeSWITCHIPv6 = json['FreeSWITCH-IPv6'];\n eventDateLocal = json['Event-Date-Local'];\n eventDateGMT = json['Event-Date-GMT'];\n eventDateTimestamp = json['Event-Date-Timestamp'];\n eventCallingFile = json['Event-Calling-File'];\n eventCallingFunction = json['Event-Calling-Function'];\n eventCallingLineNumber = json['Event-Calling-Line-Number'];\n eventSequence = json['Event-Sequence'];\n }\n\n Map<String, dynamic> toJson() {\n final Map<String, dynamic> data = <String, dynamic>{};\n data['Event-Name'] = eventName;\n data['Core-UUID'] = coreUUID;\n data['FreeSWITCH-Hostname'] = freeSWITCHHostname;\n data['FreeSWITCH-Switchname'] = freeSWITCHSwitchname;\n data['FreeSWITCH-IPv4'] = freeSWITCHIPv4;\n data['FreeSWITCH-IPv6'] = freeSWITCHIPv6;\n data['Event-Date-Local'] = eventDateLocal;\n data['Event-Date-GMT'] = eventDateGMT;\n data['Event-Date-Timestamp'] = eventDateTimestamp;\n data['Event-Calling-File'] = eventCallingFile;\n data['Event-Calling-Function'] = eventCallingFunction;\n data['Event-Calling-Line-Number'] = eventCallingLineNumber;\n data['Event-Sequence'] = eventSequence;\n return data;\n }\n}\n"
}
]
}
Loading

0 comments on commit 37778ba

Please sign in to comment.