@telnyx/react-voice-commons-sdk 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/CHANGELOG.md +31 -16
  2. package/README.md +469 -469
  3. package/TelnyxVoiceCommons.podspec +31 -31
  4. package/android/build/.transforms/35d64beab84343a7420320f8057c40b9/results.bin +1 -0
  5. package/android/build/.transforms/35d64beab84343a7420320f8057c40b9/transformed/classes/classes_dex/classes.dex +0 -0
  6. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/results.bin +1 -0
  7. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/BuildConfig.dex +0 -0
  8. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/CallForegroundService$Companion.dex +0 -0
  9. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/CallForegroundService.dex +0 -0
  10. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/TelnyxFirebaseMessagingService.dex +0 -0
  11. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/TelnyxMainActivity$Companion.dex +0 -0
  12. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/TelnyxMainActivity.dex +0 -0
  13. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/TelnyxNotificationActionReceiver.dex +0 -0
  14. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/TelnyxNotificationHelper$Companion.dex +0 -0
  15. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/TelnyxNotificationHelper.dex +0 -0
  16. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/VoicePnBridgeModule$Companion.dex +0 -0
  17. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/VoicePnBridgeModule.dex +0 -0
  18. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/VoicePnBridgePackage.dex +0 -0
  19. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/VoicePnManager.dex +0 -0
  20. package/android/build/.transforms/81896f393ea3c2e44a76283db01ad461/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  21. package/android/build/.transforms/8ebc6907344eccd2b9c23d903854d4fb/results.bin +1 -0
  22. package/android/build/.transforms/8ebc6907344eccd2b9c23d903854d4fb/transformed/classes/classes_dex/classes.dex +0 -0
  23. package/android/build/.transforms/af1ab9e262e91ec4942977987fb9a0ae/results.bin +1 -0
  24. package/android/build/.transforms/af1ab9e262e91ec4942977987fb9a0ae/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/BuildConfig.dex +0 -0
  25. package/android/build/.transforms/af1ab9e262e91ec4942977987fb9a0ae/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/TelnyxFirebaseMessagingService.dex +0 -0
  26. package/android/build/.transforms/af1ab9e262e91ec4942977987fb9a0ae/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/TelnyxMainActivity$Companion.dex +0 -0
  27. package/android/build/.transforms/af1ab9e262e91ec4942977987fb9a0ae/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/TelnyxMainActivity.dex +0 -0
  28. package/android/build/.transforms/af1ab9e262e91ec4942977987fb9a0ae/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/TelnyxNotificationActionReceiver.dex +0 -0
  29. package/android/build/.transforms/af1ab9e262e91ec4942977987fb9a0ae/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/TelnyxNotificationHelper$Companion.dex +0 -0
  30. package/android/build/.transforms/af1ab9e262e91ec4942977987fb9a0ae/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/TelnyxNotificationHelper.dex +0 -0
  31. package/android/build/.transforms/af1ab9e262e91ec4942977987fb9a0ae/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/VoicePnBridgeModule.dex +0 -0
  32. package/android/build/.transforms/af1ab9e262e91ec4942977987fb9a0ae/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/VoicePnBridgePackage.dex +0 -0
  33. package/android/build/.transforms/af1ab9e262e91ec4942977987fb9a0ae/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/telnyx/react_voice_commons/VoicePnManager.dex +0 -0
  34. package/android/build/.transforms/af1ab9e262e91ec4942977987fb9a0ae/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  35. package/android/build/generated/source/buildConfig/debug/com/telnyx/react_voice_commons/BuildConfig.java +10 -0
  36. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +42 -0
  37. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
  38. package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
  39. package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
  40. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  41. package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  42. package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
  43. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
  44. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  45. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  46. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  47. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
  48. package/android/build/intermediates/java_res/debug/processDebugJavaRes/out/META-INF/telnyx_react-voice-commons-sdk_debug.kotlin_module +0 -0
  49. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/telnyx/react_voice_commons/BuildConfig.class +0 -0
  50. package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +2 -0
  51. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +75 -0
  52. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +42 -0
  53. package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
  54. package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
  55. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/META-INF/telnyx_react-voice-commons-sdk_debug.kotlin_module +0 -0
  56. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/telnyx/react_voice_commons/BuildConfig.class +0 -0
  57. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/telnyx/react_voice_commons/CallForegroundService$Companion.class +0 -0
  58. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/telnyx/react_voice_commons/CallForegroundService.class +0 -0
  59. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/telnyx/react_voice_commons/TelnyxFirebaseMessagingService.class +0 -0
  60. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/telnyx/react_voice_commons/TelnyxMainActivity$Companion.class +0 -0
  61. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/telnyx/react_voice_commons/TelnyxMainActivity.class +0 -0
  62. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/telnyx/react_voice_commons/TelnyxNotificationActionReceiver.class +0 -0
  63. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/telnyx/react_voice_commons/TelnyxNotificationHelper$Companion.class +0 -0
  64. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/telnyx/react_voice_commons/TelnyxNotificationHelper.class +0 -0
  65. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/telnyx/react_voice_commons/VoicePnBridgeModule$Companion.class +0 -0
  66. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/telnyx/react_voice_commons/VoicePnBridgeModule.class +0 -0
  67. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/telnyx/react_voice_commons/VoicePnBridgePackage.class +0 -0
  68. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/telnyx/react_voice_commons/VoicePnManager.class +0 -0
  69. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  70. package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +1 -0
  71. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  72. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  73. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  74. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  75. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  76. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  77. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  78. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  79. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  80. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  81. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  82. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  83. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  84. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  85. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  86. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  87. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  88. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  89. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  90. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  91. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  92. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
  93. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
  94. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
  95. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
  96. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
  97. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
  98. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
  99. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  100. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  101. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  102. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  103. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  104. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  105. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  106. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  107. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  108. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  109. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  110. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  111. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  112. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  113. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  114. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  115. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  116. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  117. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  118. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  119. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  120. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  121. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  122. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  123. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  124. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  125. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  126. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  127. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  128. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  129. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  130. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  131. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  132. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  133. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  134. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +2 -0
  135. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  136. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  137. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  138. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  139. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  140. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  141. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  142. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  143. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  144. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  145. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  146. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  147. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  148. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  149. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  150. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  151. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  152. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  153. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  154. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  155. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  156. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  157. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  158. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  159. package/android/build/outputs/logs/manifest-merger-debug-report.txt +82 -0
  160. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  161. package/android/build/tmp/kotlin-classes/debug/META-INF/telnyx_react-voice-commons-sdk_debug.kotlin_module +0 -0
  162. package/android/build/tmp/kotlin-classes/debug/com/telnyx/react_voice_commons/CallForegroundService$Companion.class +0 -0
  163. package/android/build/tmp/kotlin-classes/debug/com/telnyx/react_voice_commons/CallForegroundService.class +0 -0
  164. package/android/build/tmp/kotlin-classes/debug/com/telnyx/react_voice_commons/TelnyxFirebaseMessagingService.class +0 -0
  165. package/android/build/tmp/kotlin-classes/debug/com/telnyx/react_voice_commons/TelnyxMainActivity$Companion.class +0 -0
  166. package/android/build/tmp/kotlin-classes/debug/com/telnyx/react_voice_commons/TelnyxMainActivity.class +0 -0
  167. package/android/build/tmp/kotlin-classes/debug/com/telnyx/react_voice_commons/TelnyxNotificationActionReceiver.class +0 -0
  168. package/android/build/tmp/kotlin-classes/debug/com/telnyx/react_voice_commons/TelnyxNotificationHelper$Companion.class +0 -0
  169. package/android/build/tmp/kotlin-classes/debug/com/telnyx/react_voice_commons/TelnyxNotificationHelper.class +0 -0
  170. package/android/build/tmp/kotlin-classes/debug/com/telnyx/react_voice_commons/VoicePnBridgeModule$Companion.class +0 -0
  171. package/android/build/tmp/kotlin-classes/debug/com/telnyx/react_voice_commons/VoicePnBridgeModule.class +0 -0
  172. package/android/build/tmp/kotlin-classes/debug/com/telnyx/react_voice_commons/VoicePnBridgePackage.class +0 -0
  173. package/android/build/tmp/kotlin-classes/debug/com/telnyx/react_voice_commons/VoicePnManager.class +0 -0
  174. package/android/build.gradle +45 -0
  175. package/android/local.properties +8 -0
  176. package/android/src/main/AndroidManifest.xml +38 -0
  177. package/android/src/main/java/com/telnyx/react_voice_commons/CallForegroundService.kt +83 -0
  178. package/android/src/main/java/com/telnyx/react_voice_commons/TelnyxFirebaseMessagingService.kt +179 -0
  179. package/android/src/main/java/com/telnyx/react_voice_commons/TelnyxMainActivity.kt +216 -0
  180. package/android/src/main/java/com/telnyx/react_voice_commons/TelnyxNotificationActionReceiver.kt +177 -0
  181. package/android/src/main/java/com/telnyx/react_voice_commons/TelnyxNotificationHelper.kt +277 -0
  182. package/android/src/main/java/com/telnyx/react_voice_commons/VoicePnBridgeModule.kt +247 -0
  183. package/android/src/main/java/com/telnyx/react_voice_commons/VoicePnBridgePackage.kt +17 -0
  184. package/android/src/main/java/com/telnyx/react_voice_commons/VoicePnManager.kt +154 -0
  185. package/ios/CallKitBridge.m +43 -43
  186. package/ios/CallKitBridge.swift +874 -874
  187. package/ios/VoicePnBridge.m +30 -30
  188. package/ios/VoicePnBridge.swift +86 -86
  189. package/lib/callkit/callkit-coordinator.d.ts +114 -110
  190. package/lib/callkit/callkit-coordinator.js +706 -664
  191. package/lib/callkit/callkit.d.ts +41 -41
  192. package/lib/callkit/callkit.js +242 -252
  193. package/lib/callkit/index.js +47 -15
  194. package/lib/callkit/use-callkit.d.ts +19 -19
  195. package/lib/callkit/use-callkit.js +310 -270
  196. package/lib/context/TelnyxVoiceContext.d.ts +9 -9
  197. package/lib/context/TelnyxVoiceContext.js +13 -10
  198. package/lib/hooks/use-callkit-coordinator.d.ts +17 -9
  199. package/lib/hooks/use-callkit-coordinator.js +50 -45
  200. package/lib/hooks/useAppReadyNotifier.js +15 -13
  201. package/lib/hooks/useAppStateHandler.d.ts +11 -6
  202. package/lib/hooks/useAppStateHandler.js +110 -95
  203. package/lib/index.d.ts +21 -3
  204. package/lib/index.js +201 -50
  205. package/lib/internal/CallKitHandler.d.ts +6 -6
  206. package/lib/internal/CallKitHandler.js +104 -96
  207. package/lib/internal/callkit-manager.d.ts +57 -57
  208. package/lib/internal/callkit-manager.js +316 -299
  209. package/lib/internal/calls/call-state-controller.d.ts +78 -73
  210. package/lib/internal/calls/call-state-controller.js +326 -265
  211. package/lib/internal/session/session-manager.d.ts +71 -71
  212. package/lib/internal/session/session-manager.js +437 -360
  213. package/lib/internal/user-defaults-helpers.js +39 -49
  214. package/lib/internal/voice-pn-bridge.d.ts +112 -104
  215. package/lib/internal/voice-pn-bridge.js +193 -203
  216. package/lib/models/call-state.d.ts +46 -46
  217. package/lib/models/call-state.js +74 -70
  218. package/lib/models/call.d.ts +173 -157
  219. package/lib/models/call.js +492 -448
  220. package/lib/models/config.d.ts +18 -11
  221. package/lib/models/config.js +35 -37
  222. package/lib/models/connection-state.d.ts +10 -10
  223. package/lib/models/connection-state.js +16 -16
  224. package/lib/telnyx-voice-app.d.ts +28 -28
  225. package/lib/telnyx-voice-app.js +561 -509
  226. package/lib/telnyx-voip-client.d.ts +174 -167
  227. package/lib/telnyx-voip-client.js +397 -385
  228. package/package.json +116 -115
  229. package/src/callkit/callkit-coordinator.ts +830 -830
  230. package/src/internal/calls/call-state-controller.ts +407 -407
  231. package/src/internal/session/session-manager.ts +483 -483
  232. package/src/internal/voice-pn-bridge.ts +266 -266
  233. package/src/models/call-state.ts +105 -105
  234. package/src/models/call.ts +502 -502
  235. package/src/telnyx-voice-app.tsx +787 -788
  236. package/src/telnyx-voip-client.ts +551 -551
  237. package/src/types/telnyx-sdk.d.ts +93 -93
@@ -1,42 +1,61 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
1
+ 'use strict';
2
+ var __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k];
13
+ },
14
+ };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }
18
+ : function (o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ });
22
+ var __setModuleDefault =
23
+ (this && this.__setModuleDefault) ||
24
+ (Object.create
25
+ ? function (o, v) {
26
+ Object.defineProperty(o, 'default', { enumerable: true, value: v });
27
+ }
28
+ : function (o, v) {
29
+ o['default'] = v;
30
+ });
31
+ var __importStar =
32
+ (this && this.__importStar) ||
33
+ (function () {
34
+ var ownKeys = function (o) {
35
+ ownKeys =
36
+ Object.getOwnPropertyNames ||
37
+ function (o) {
38
+ var ar = [];
39
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
40
+ return ar;
24
41
  };
25
- return ownKeys(o);
42
+ return ownKeys(o);
26
43
  };
27
44
  return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
45
+ if (mod && mod.__esModule) return mod;
46
+ var result = {};
47
+ if (mod != null)
48
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
49
+ if (k[i] !== 'default') __createBinding(result, mod, k[i]);
50
+ __setModuleDefault(result, mod);
51
+ return result;
33
52
  };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
53
+ })();
54
+ Object.defineProperty(exports, '__esModule', { value: true });
36
55
  exports.callKitCoordinator = void 0;
37
- const react_native_1 = require("react-native");
38
- const callkit_1 = __importStar(require("./callkit"));
39
- const voice_pn_bridge_1 = require("../internal/voice-pn-bridge");
56
+ const react_native_1 = require('react-native');
57
+ const callkit_1 = __importStar(require('./callkit'));
58
+ const voice_pn_bridge_1 = require('../internal/voice-pn-bridge');
40
59
  /**
41
60
  * CallKit Coordinator - Manages the proper CallKit-first flow for iOS
42
61
  *
@@ -45,665 +64,688 @@ const voice_pn_bridge_1 = require("../internal/voice-pn-bridge");
45
64
  * guidelines for proper CallKit integration.
46
65
  */
47
66
  class CallKitCoordinator {
48
- static getInstance() {
49
- if (!CallKitCoordinator.instance) {
50
- CallKitCoordinator.instance = new CallKitCoordinator();
51
- }
52
- return CallKitCoordinator.instance;
67
+ static getInstance() {
68
+ if (!CallKitCoordinator.instance) {
69
+ CallKitCoordinator.instance = new CallKitCoordinator();
53
70
  }
54
- constructor() {
55
- // Maps CallKit UUIDs to WebRTC calls
56
- this.callMap = new Map();
57
- // Tracks calls that are being processed to prevent duplicates
58
- this.processingCalls = new Set();
59
- // Tracks calls that have already been ended in CallKit to prevent duplicate reports
60
- this.endedCalls = new Set();
61
- // Tracks calls that have already been reported as connected to prevent duplicate reports
62
- this.connectedCalls = new Set();
63
- this.isCallFromPush = false;
64
- // Flag to auto-answer the next incoming call (set when answering push notifications via CallKit)
65
- this.shouldAutoAnswerNextCall = false;
66
- // Reference to the VoIP client for triggering reconnection when needed
67
- this.voipClient = null;
68
- if (react_native_1.Platform.OS === 'ios' && callkit_1.default.isAvailable()) {
69
- this.setupCallKitListeners();
70
- }
71
+ return CallKitCoordinator.instance;
72
+ }
73
+ constructor() {
74
+ // Maps CallKit UUIDs to WebRTC calls
75
+ this.callMap = new Map();
76
+ // Tracks calls that are being processed to prevent duplicates
77
+ this.processingCalls = new Set();
78
+ // Tracks calls that have already been ended in CallKit to prevent duplicate reports
79
+ this.endedCalls = new Set();
80
+ // Tracks calls that have already been reported as connected to prevent duplicate reports
81
+ this.connectedCalls = new Set();
82
+ this.isCallFromPush = false;
83
+ // Flag to auto-answer the next incoming call (set when answering push notifications via CallKit)
84
+ this.shouldAutoAnswerNextCall = false;
85
+ // Reference to the VoIP client for triggering reconnection when needed
86
+ this.voipClient = null;
87
+ if (react_native_1.Platform.OS === 'ios' && callkit_1.default.isAvailable()) {
88
+ this.setupCallKitListeners();
71
89
  }
72
- setupCallKitListeners() {
73
- // Handle CallKit answer actions
74
- callkit_1.default.onAnswerCall((event) => {
75
- this.handleCallKitAnswer(event.callUUID, event);
76
- });
77
- // Handle CallKit end actions
78
- callkit_1.default.onEndCall((event) => {
79
- this.handleCallKitEnd(event.callUUID, event);
80
- });
81
- // Handle CallKit start actions (for outgoing calls)
82
- callkit_1.default.onStartCall((event) => {
83
- this.handleCallKitStart(event.callUUID);
84
- });
85
- // Handle CallKit push received events
86
- callkit_1.default.onReceivePush((event) => {
87
- this.handleCallKitPushReceived(event.callUUID, event);
88
- });
90
+ }
91
+ setupCallKitListeners() {
92
+ // Handle CallKit answer actions
93
+ callkit_1.default.onAnswerCall((event) => {
94
+ this.handleCallKitAnswer(event.callUUID, event);
95
+ });
96
+ // Handle CallKit end actions
97
+ callkit_1.default.onEndCall((event) => {
98
+ this.handleCallKitEnd(event.callUUID, event);
99
+ });
100
+ // Handle CallKit start actions (for outgoing calls)
101
+ callkit_1.default.onStartCall((event) => {
102
+ this.handleCallKitStart(event.callUUID);
103
+ });
104
+ // Handle CallKit push received events
105
+ callkit_1.default.onReceivePush((event) => {
106
+ this.handleCallKitPushReceived(event.callUUID, event);
107
+ });
108
+ }
109
+ /**
110
+ * Report an incoming call to CallKit (from push notification or socket)
111
+ * For push notifications, the call is already reported - we just need to map it
112
+ */
113
+ async reportIncomingCall(call, callerName, callerNumber) {
114
+ if (react_native_1.Platform.OS !== 'ios' || !callkit_1.default.isAvailable()) {
115
+ return null;
89
116
  }
90
- /**
91
- * Report an incoming call to CallKit (from push notification or socket)
92
- * For push notifications, the call is already reported - we just need to map it
93
- */
94
- async reportIncomingCall(call, callerName, callerNumber) {
95
- if (react_native_1.Platform.OS !== 'ios' || !callkit_1.default.isAvailable()) {
96
- return null;
97
- }
98
- // This is a new call - report it to CallKit using the WebRTC call ID as CallKit UUID
99
- const callKitUUID = call.callId;
100
- console.log('CallKitCoordinator: Report Called called', {
101
- callKitUUID,
102
- webrtcCallId: call.callId,
103
- callerName,
104
- callerNumber,
105
- isCallFromPush: this.isCallFromPush,
117
+ // This is a new call - report it to CallKit using the WebRTC call ID as CallKit UUID
118
+ const callKitUUID = call.callId;
119
+ console.log('CallKitCoordinator: Report Called called', {
120
+ callKitUUID,
121
+ webrtcCallId: call.callId,
122
+ callerName,
123
+ callerNumber,
124
+ isCallFromPush: this.isCallFromPush,
125
+ });
126
+ this.setupWebRTCCallListeners(call, callKitUUID);
127
+ this.callMap.set(callKitUUID, call);
128
+ try {
129
+ if (!this.isCallFromPush) {
130
+ console.log('CallKitCoordinator: Reporting new incoming call to CallKit', {
131
+ callKitUUID,
132
+ webrtcCallId: call.callId,
133
+ callerName,
134
+ callerNumber,
135
+ isCallFromPush: this.isCallFromPush,
106
136
  });
107
- this.setupWebRTCCallListeners(call, callKitUUID);
108
- this.callMap.set(callKitUUID, call);
109
- try {
110
- if (!this.isCallFromPush) {
111
- console.log('CallKitCoordinator: Reporting new incoming call to CallKit', {
112
- callKitUUID,
113
- webrtcCallId: call.callId,
114
- callerName,
115
- callerNumber,
116
- isCallFromPush: this.isCallFromPush,
117
- });
118
- const success = await callkit_1.default.reportIncomingCall(callKitUUID, callerNumber, callerName);
119
- if (success) {
120
- return callKitUUID;
121
- }
122
- }
123
- return null;
124
- }
125
- catch (error) {
126
- console.error('CallKitCoordinator: Failed to report incoming call', error);
127
- return null;
128
- }
137
+ const success = await callkit_1.default.reportIncomingCall(
138
+ callKitUUID,
139
+ callerNumber,
140
+ callerName
141
+ );
142
+ if (success) {
143
+ return callKitUUID;
144
+ }
145
+ }
146
+ return null;
147
+ } catch (error) {
148
+ console.error('CallKitCoordinator: Failed to report incoming call', error);
149
+ return null;
129
150
  }
130
- /**
131
- * Start an outgoing call through CallKit
132
- */
133
- async startOutgoingCall(call, destinationNumber, displayName) {
134
- if (react_native_1.Platform.OS !== 'ios' || !callkit_1.default.isAvailable()) {
135
- return null;
136
- }
137
- const callKitUUID = call.callId;
138
- console.log('CallKitCoordinator: Starting outgoing call through CallKit', {
139
- callKitUUID,
140
- webrtcCallId: call.callId,
141
- destinationNumber,
142
- displayName,
143
- });
144
- try {
145
- const success = await callkit_1.default.startOutgoingCall(callKitUUID, destinationNumber, displayName || destinationNumber);
146
- if (success) {
147
- this.callMap.set(callKitUUID, call);
148
- this.setupWebRTCCallListeners(call, callKitUUID);
149
- call._callKitUUID = callKitUUID;
150
- return callKitUUID;
151
- }
152
- return null;
153
- }
154
- catch (error) {
155
- console.error('CallKitCoordinator: Failed to start outgoing call', error);
156
- return null;
157
- }
151
+ }
152
+ /**
153
+ * Start an outgoing call through CallKit
154
+ */
155
+ async startOutgoingCall(call, destinationNumber, displayName) {
156
+ if (react_native_1.Platform.OS !== 'ios' || !callkit_1.default.isAvailable()) {
157
+ return null;
158
158
  }
159
- /**
160
- * Answer a call from the app UI (CallKit-first approach)
161
- */
162
- async answerCallFromUI(call) {
163
- // Use comprehensive UUID lookup that checks both maps and call properties
164
- const callKitUUID = this.getCallKitUUID(call);
165
- console.log('CallKitCoordinator: Answering call from UI using CallKit answer simulation', callKitUUID);
166
- // Mark as processing to prevent duplicate actions
167
- this.processingCalls.add(callKitUUID);
168
- try {
169
- // Simulate the CallKit answer action, which will trigger our answer handler
170
- const success = await callkit_1.default.answerCall(callKitUUID);
171
- if (success) {
172
- // If CallKit answer fails, fallback to direct WebRTC answer
173
- if (this.isCallFromPush) {
174
- call.answer();
175
- this.isCallFromPush = false;
176
- }
177
- console.log('CallKitCoordinator: CallKit answer success');
178
- }
179
- return success;
180
- }
181
- catch (error) {
182
- console.error('CallKitCoordinator: Error answering call from UI', error);
183
- return false;
184
- }
185
- finally {
186
- this.processingCalls.delete(callKitUUID);
187
- }
159
+ const callKitUUID = call.callId;
160
+ console.log('CallKitCoordinator: Starting outgoing call through CallKit', {
161
+ callKitUUID,
162
+ webrtcCallId: call.callId,
163
+ destinationNumber,
164
+ displayName,
165
+ });
166
+ try {
167
+ const success = await callkit_1.default.startOutgoingCall(
168
+ callKitUUID,
169
+ destinationNumber,
170
+ displayName || destinationNumber
171
+ );
172
+ if (success) {
173
+ this.callMap.set(callKitUUID, call);
174
+ this.setupWebRTCCallListeners(call, callKitUUID);
175
+ call._callKitUUID = callKitUUID;
176
+ return callKitUUID;
177
+ }
178
+ return null;
179
+ } catch (error) {
180
+ console.error('CallKitCoordinator: Failed to start outgoing call', error);
181
+ return null;
188
182
  }
189
- /**
190
- * End a call from the app UI (CallKit-first approach)
191
- */
192
- async endCallFromUI(call) {
193
- // Use comprehensive UUID lookup that checks both maps and call properties
194
- const callKitUUID = this.getCallKitUUID(call);
195
- if (!callKitUUID) {
196
- console.warn('CallKitCoordinator: Cannot end call - no CallKit UUID found');
197
- // Fallback to direct WebRTC hangup
198
- call.hangup();
199
- return false;
200
- }
201
- console.log('CallKitCoordinator: Ending call from UI - dismissing CallKit and hanging up WebRTC call', callKitUUID);
202
- // Mark as processing to prevent duplicate actions
203
- this.processingCalls.add(callKitUUID);
204
- try {
205
- // End the call in CallKit and hang up the WebRTC call
206
- await callkit_1.default.endCall(callKitUUID);
207
- call.hangup();
208
- // Clean up the mappings
209
- this.cleanupCall(callKitUUID);
210
- return true;
211
- }
212
- catch (error) {
213
- console.error('CallKitCoordinator: Error ending call from UI', error);
214
- call.hangup(); // Ensure WebRTC call is ended
215
- return false;
216
- }
217
- finally {
218
- this.processingCalls.delete(callKitUUID);
219
- }
183
+ }
184
+ /**
185
+ * Answer a call from the app UI (CallKit-first approach)
186
+ */
187
+ async answerCallFromUI(call) {
188
+ // Use comprehensive UUID lookup that checks both maps and call properties
189
+ const callKitUUID = this.getCallKitUUID(call);
190
+ console.log(
191
+ 'CallKitCoordinator: Answering call from UI using CallKit answer simulation',
192
+ callKitUUID
193
+ );
194
+ // Mark as processing to prevent duplicate actions
195
+ this.processingCalls.add(callKitUUID);
196
+ try {
197
+ // Simulate the CallKit answer action, which will trigger our answer handler
198
+ const success = await callkit_1.default.answerCall(callKitUUID);
199
+ if (success) {
200
+ // If CallKit answer fails, fallback to direct WebRTC answer
201
+ if (this.isCallFromPush) {
202
+ call.answer();
203
+ this.isCallFromPush = false;
204
+ }
205
+ console.log('CallKitCoordinator: CallKit answer success');
206
+ }
207
+ return success;
208
+ } catch (error) {
209
+ console.error('CallKitCoordinator: Error answering call from UI', error);
210
+ return false;
211
+ } finally {
212
+ this.processingCalls.delete(callKitUUID);
220
213
  }
221
- /**
222
- * Handle CallKit answer action (triggered by CallKit)
223
- */
224
- async handleCallKitAnswer(callKitUUID, event) {
225
- if (this.processingCalls.has(callKitUUID)) {
226
- console.log('CallKitCoordinator: Answer action already being processed, skipping duplicate');
227
- return;
228
- }
229
- const call = this.callMap.get(callKitUUID);
230
- if (!call) {
231
- console.warn('CallKitCoordinator: No WebRTC call found for CallKit answer action', {
232
- callKitUUID,
233
- availableCallKitUUIDs: Array.from(this.callMap.keys()),
234
- availableWebRTCCallIds: Array.from(this.callMap.values()).map((c) => c.callId),
235
- });
236
- console.log('CallKitCoordinator: No WebRTC call found, handling as push notification');
237
- await this.handlePushNotificationAnswer(callKitUUID, event);
238
- return;
239
- }
240
- console.log('CallKitCoordinator: Processing CallKit answer action', {
241
- callKitUUID,
242
- webrtcCallId: call.callId,
243
- direction: call.direction,
244
- currentState: call.state,
245
- });
246
- if (call.state === 'active') {
247
- console.log('CallKitCoordinator: Call already active, skipping duplicate answer action');
248
- return;
249
- }
250
- this.processingCalls.add(callKitUUID);
251
- try {
252
- if (call.direction === 'inbound') {
253
- const voipClient = this.getSDKClient();
254
- if (voipClient) {
255
- console.log('CallKitCoordinator: Setting incoming call to CONNECTING state for CallKit answer');
256
- voipClient.setCallConnecting(call.callId);
257
- }
258
- // Report call as connected to CallKit to trigger audio session activation
259
- setTimeout(async () => {
260
- try {
261
- await callkit_1.default.reportCallConnected(callKitUUID);
262
- console.log('CallKitCoordinator: Reported call connected to activate audio session');
263
- this.connectedCalls.add(callKitUUID);
264
- }
265
- catch (error) {
266
- console.error('CallKitCoordinator: Error reporting call connected for audio session:', error);
267
- }
268
- }, 200);
269
- setTimeout(() => {
270
- call.answer();
271
- }, 500);
272
- }
273
- else {
274
- console.log('CallKitCoordinator: Outgoing call, skipping answer and CONNECTING state');
275
- }
276
- }
277
- catch (error) {
278
- console.error('CallKitCoordinator: Error processing CallKit answer', error);
279
- await callkit_1.default.reportCallEnded(callKitUUID, callkit_1.CallEndReason.Failed);
280
- this.cleanupCall(callKitUUID);
281
- }
282
- finally {
283
- this.processingCalls.delete(callKitUUID);
284
- }
214
+ }
215
+ /**
216
+ * End a call from the app UI (CallKit-first approach)
217
+ */
218
+ async endCallFromUI(call) {
219
+ // Use comprehensive UUID lookup that checks both maps and call properties
220
+ const callKitUUID = this.getCallKitUUID(call);
221
+ if (!callKitUUID) {
222
+ console.warn('CallKitCoordinator: Cannot end call - no CallKit UUID found');
223
+ // Fallback to direct WebRTC hangup
224
+ call.hangup();
225
+ return false;
285
226
  }
286
- /**
287
- * Handle CallKit end action (triggered by CallKit)
288
- */
289
- async handleCallKitEnd(callKitUUID, event) {
290
- this.isCallFromPush = false;
291
- if (this.processingCalls.has(callKitUUID)) {
292
- console.log('CallKitCoordinator: End action already being processed, skipping duplicate');
293
- return;
294
- }
295
- const call = this.callMap.get(callKitUUID);
296
- if (!call) {
297
- console.warn('CallKitCoordinator: No WebRTC call found for CallKit end action', {
298
- callKitUUID,
299
- availableCallKitUUIDs: Array.from(this.callMap.keys()),
300
- availableWebRTCCallIds: Array.from(this.callMap.values()).map((c) => c.callId),
301
- });
302
- console.log('CallKitCoordinator: No WebRTC call found, handling as push notification rejection');
303
- await this.handlePushNotificationReject(callKitUUID, event);
304
- this.cleanupCall(callKitUUID);
305
- return;
306
- }
307
- console.log('CallKitCoordinator: Processing CallKit end action', {
308
- callKitUUID,
309
- webrtcCallId: call.callId,
310
- });
311
- this.processingCalls.add(callKitUUID);
312
- try {
313
- call.hangup();
314
- }
315
- catch (error) {
316
- console.error('CallKitCoordinator: Error hanging up WebRTC call', error);
317
- }
318
- finally {
319
- this.processingCalls.delete(callKitUUID);
320
- this.cleanupCall(callKitUUID);
321
- // Check if app is in background and no more calls - disconnect client
322
- await this.checkBackgroundDisconnection();
323
- }
227
+ console.log(
228
+ 'CallKitCoordinator: Ending call from UI - dismissing CallKit and hanging up WebRTC call',
229
+ callKitUUID
230
+ );
231
+ // Mark as processing to prevent duplicate actions
232
+ this.processingCalls.add(callKitUUID);
233
+ try {
234
+ // End the call in CallKit and hang up the WebRTC call
235
+ await callkit_1.default.endCall(callKitUUID);
236
+ call.hangup();
237
+ // Clean up the mappings
238
+ this.cleanupCall(callKitUUID);
239
+ return true;
240
+ } catch (error) {
241
+ console.error('CallKitCoordinator: Error ending call from UI', error);
242
+ call.hangup(); // Ensure WebRTC call is ended
243
+ return false;
244
+ } finally {
245
+ this.processingCalls.delete(callKitUUID);
324
246
  }
325
- /**
326
- * Handle CallKit start action (triggered by CallKit for outgoing calls)
327
- */
328
- async handleCallKitStart(callKitUUID) {
329
- const call = this.callMap.get(callKitUUID);
330
- if (!call) {
331
- console.warn('CallKitCoordinator: No WebRTC call found for CallKit start action', callKitUUID);
332
- return;
333
- }
334
- console.log('CallKitCoordinator: Processing CallKit start action', {
335
- callKitUUID,
336
- webrtcCallId: call.callId,
337
- });
338
- // For outgoing calls, the WebRTC call should already be initiated
339
- // We just need to report when it connects
247
+ }
248
+ /**
249
+ * Handle CallKit answer action (triggered by CallKit)
250
+ */
251
+ async handleCallKitAnswer(callKitUUID, event) {
252
+ if (this.processingCalls.has(callKitUUID)) {
253
+ console.log('CallKitCoordinator: Answer action already being processed, skipping duplicate');
254
+ return;
340
255
  }
341
- /**
342
- * Handle CallKit push received event
343
- * This allows us to coordinate between the push notification and any subsequent WebRTC calls
344
- */
345
- async handleCallKitPushReceived(callKitUUID, event) {
346
- if (this.isCallFromPush) {
347
- this.isCallFromPush = false;
348
- console.log('CallKitCoordinator: Ignoring push received event (already processed)');
349
- return;
350
- }
351
- console.log('CallKitCoordinator: Processing push received event', {
352
- callKitUUID,
353
- source: event?.callData?.source,
354
- });
355
- this.isCallFromPush = true;
356
- console.log('CallKitCoordinator: Processing push received event', {
357
- callKitUUID,
358
- source: event?.callData?.source,
359
- isCallFromPush: this.isCallFromPush,
360
- });
361
- try {
362
- // Get VoIP client instance
363
- const voipClient = this.getSDKClient();
364
- if (!voipClient) {
365
- console.error('CallKitCoordinator: VoIP client not available');
366
- return;
367
- }
368
- // Retrieve pending push data from VoIP bridge
369
- const pendingPushJson = await voice_pn_bridge_1.VoicePnBridge.getPendingVoipPush();
370
- if (!pendingPushJson) {
371
- console.warn('CallKitCoordinator: No pending push data found');
372
- return;
373
- }
374
- const pendingPush = JSON.parse(pendingPushJson);
375
- const realPushData = pendingPush?.payload;
376
- if (!realPushData?.metadata) {
377
- console.warn('CallKitCoordinator: Invalid push data structure');
378
- return;
379
- }
380
- // Prepare push metadata with CallKit flag
381
- const enhancedMetadata = {
382
- ...realPushData.metadata,
383
- from_callkit: true,
384
- };
385
- // Check if auto-answer is set and add from_notification flag
386
- const shouldAddFromNotification = this.shouldAutoAnswerNextCall;
387
- let pushData;
388
- if (shouldAddFromNotification) {
389
- pushData = {
390
- metadata: enhancedMetadata,
391
- from_notification: true,
392
- action: 'answer',
393
- };
394
- voipClient.queueAnswerFromCallKit();
395
- }
396
- else {
397
- pushData = {
398
- metadata: enhancedMetadata,
399
- };
400
- }
401
- // Process the push notification
402
- await voipClient.handlePushNotification(pushData);
403
- console.log('CallKitCoordinator: Push notification processed successfully');
404
- }
405
- catch (error) {
406
- console.error('CallKitCoordinator: Error processing push received event:', error);
407
- }
256
+ const call = this.callMap.get(callKitUUID);
257
+ if (!call) {
258
+ console.warn('CallKitCoordinator: No WebRTC call found for CallKit answer action', {
259
+ callKitUUID,
260
+ availableCallKitUUIDs: Array.from(this.callMap.keys()),
261
+ availableWebRTCCallIds: Array.from(this.callMap.values()).map((c) => c.callId),
262
+ });
263
+ console.log('CallKitCoordinator: No WebRTC call found, handling as push notification');
264
+ await this.handlePushNotificationAnswer(callKitUUID, event);
265
+ return;
408
266
  }
409
- /**
410
- * Handle push notification answer - when user answers from CallKit but we don't have a WebRTC call yet
411
- * This is the iOS equivalent of the Android FCM handler
412
- */
413
- async handlePushNotificationAnswer(callKitUUID, event) {
414
- try {
415
- console.log('CallKitCoordinator: Handling push notification answer for CallKit UUID:', callKitUUID);
416
- if (react_native_1.Platform.OS === 'ios') {
417
- console.log('CallKitCoordinator: Processing iOS push notification answer');
418
- // Set auto-answer flag so when the WebRTC call comes in, it will be answered automatically
419
- this.shouldAutoAnswerNextCall = true;
420
- console.log('CallKitCoordinator: ✅ Set auto-answer flag for next incoming call');
421
- // Get VoIP client and trigger reconnection
422
- const voipClient = this.getSDKClient();
423
- if (!voipClient) {
424
- console.error('CallKitCoordinator: ❌ No VoIP client available - cannot reconnect for push notification');
425
- await callkit_1.default.reportCallEnded(callKitUUID, callkit_1.CallEndReason.Failed);
426
- this.cleanupCall(callKitUUID);
427
- return;
428
- }
429
- // Get the real push data that was stored by the VoIP push handler
430
- console.log('CallKitCoordinator: 🔍 Getting real push data from VoicePnBridge...');
431
- let realPushData = null;
432
- try {
433
- const pendingPushJson = await voice_pn_bridge_1.VoicePnBridge.getPendingVoipPush();
434
- if (pendingPushJson) {
435
- const pendingPush = JSON.parse(pendingPushJson);
436
- if (pendingPush && pendingPush.payload) {
437
- console.log('CallKitCoordinator: ✅ Found real push data');
438
- realPushData = pendingPush.payload;
439
- }
440
- }
441
- }
442
- catch (error) {
443
- console.warn('CallKitCoordinator: Could not get real push data:', error);
444
- }
445
- // Create push notification payload - use real data if available, fallback to placeholder
446
- const pushAction = 'incoming_call';
447
- let pushMetadata;
448
- if (realPushData && realPushData.metadata) {
449
- // Use the real push metadata
450
- console.log('CallKitCoordinator: 🎯 Using REAL push metadata for immediate handling');
451
- pushMetadata = JSON.stringify({
452
- ...realPushData.metadata,
453
- from_callkit: true, // Add flag to indicate this was answered via CallKit
454
- });
455
- }
456
- else {
457
- // Fallback to placeholder (this should rarely happen)
458
- console.warn('CallKitCoordinator: ⚠️ No real push data found, using placeholder');
459
- pushMetadata = JSON.stringify({
460
- call_id: callKitUUID,
461
- caller_name: 'Incoming Call',
462
- caller_number: 'Unknown',
463
- voice_sdk_id: 'unknown',
464
- sent_time: new Date().toISOString(),
465
- from_callkit: true,
466
- });
467
- }
468
- // Set the pending push action to be handled when app comes to foreground
469
- await voice_pn_bridge_1.VoicePnBridge.setPendingPushAction(pushAction, pushMetadata);
470
- console.log('CallKitCoordinator: ✅ Set pending push action');
471
- return;
472
- }
473
- // For other platforms (shouldn't happen on iOS)
474
- console.error('CallKitCoordinator: ❌ Unsupported platform for push notification handling');
475
- await callkit_1.default.reportCallEnded(callKitUUID, callkit_1.CallEndReason.Failed);
476
- }
477
- catch (error) {
478
- console.error('CallKitCoordinator: ❌ Error handling push notification answer:', error);
479
- // Report the call as failed to CallKit
480
- await callkit_1.default.reportCallEnded(callKitUUID, callkit_1.CallEndReason.Failed);
481
- this.cleanupCall(callKitUUID);
482
- }
267
+ console.log('CallKitCoordinator: Processing CallKit answer action', {
268
+ callKitUUID,
269
+ webrtcCallId: call.callId,
270
+ direction: call.direction,
271
+ currentState: call.state,
272
+ });
273
+ if (call.state === 'active') {
274
+ console.log('CallKitCoordinator: Call already active, skipping duplicate answer action');
275
+ return;
483
276
  }
484
- /**
485
- * Handle push notification reject - when user rejects from CallKit but we don't have a WebRTC call yet
486
- * This is the iOS equivalent of the Android FCM handler reject
487
- */
488
- async handlePushNotificationReject(callKitUUID, event) {
489
- try {
490
- console.log('CallKitCoordinator: Handling push notification rejection for CallKit UUID:', callKitUUID);
491
- if (react_native_1.Platform.OS === 'ios') {
492
- console.log('CallKitCoordinator: Processing iOS push notification rejection');
493
- this.voipClient.queueEndFromCallKit();
494
- // Clean up push notification state
495
- await this.cleanupPushNotificationState();
496
- console.log('CallKitCoordinator: 🎯 Push notification rejection handling complete');
497
- return;
498
- }
499
- // For other platforms (shouldn't happen on iOS)
500
- console.error('CallKitCoordinator: Unsupported platform for push notification rejection handling');
501
- }
502
- catch (error) {
503
- console.error('CallKitCoordinator: ❌ Error handling push notification rejection:', error);
504
- }
277
+ this.processingCalls.add(callKitUUID);
278
+ try {
279
+ if (call.direction === 'inbound') {
280
+ const voipClient = this.getSDKClient();
281
+ if (voipClient) {
282
+ console.log(
283
+ 'CallKitCoordinator: Setting incoming call to CONNECTING state for CallKit answer'
284
+ );
285
+ voipClient.setCallConnecting(call.callId);
286
+ }
287
+ // Report call as connected to CallKit to trigger audio session activation
288
+ setTimeout(async () => {
289
+ try {
290
+ await callkit_1.default.reportCallConnected(callKitUUID);
291
+ console.log('CallKitCoordinator: Reported call connected to activate audio session');
292
+ this.connectedCalls.add(callKitUUID);
293
+ } catch (error) {
294
+ console.error(
295
+ 'CallKitCoordinator: Error reporting call connected for audio session:',
296
+ error
297
+ );
298
+ }
299
+ }, 200);
300
+ setTimeout(() => {
301
+ call.answer();
302
+ }, 500);
303
+ } else {
304
+ console.log('CallKitCoordinator: Outgoing call, skipping answer and CONNECTING state');
305
+ }
306
+ } catch (error) {
307
+ console.error('CallKitCoordinator: Error processing CallKit answer', error);
308
+ await callkit_1.default.reportCallEnded(callKitUUID, callkit_1.CallEndReason.Failed);
309
+ this.cleanupCall(callKitUUID);
310
+ } finally {
311
+ this.processingCalls.delete(callKitUUID);
505
312
  }
506
- /**
507
- * Set up listeners for WebRTC call state changes
508
- */
509
- setupWebRTCCallListeners(call, callKitUUID) {
510
- const handleStateChange = async (call, state) => {
511
- console.log('CallKitCoordinator: WebRTC call state changed', {
512
- callKitUUID,
513
- webrtcCallId: call.callId,
514
- state,
515
- });
516
- switch (state) {
517
- case 'active':
518
- // When WebRTC call becomes active, just report as connected
519
- // (CallKit call was already answered in answerCallFromUI)
520
- if (!this.connectedCalls.has(callKitUUID)) {
521
- console.log('CallKitCoordinator: WebRTC call active - reporting connected to CallKit');
522
- try {
523
- // Report as connected (CallKit call already answered in UI flow)
524
- await callkit_1.default.reportCallConnected(callKitUUID);
525
- console.log('CallKitCoordinator: Call reported as connected to CallKit ', callKitUUID);
526
- this.connectedCalls.add(callKitUUID);
527
- }
528
- catch (error) {
529
- console.error('CallKitCoordinator: Error reporting call connected:', error);
530
- }
531
- }
532
- break;
533
- case 'ended':
534
- case 'failed':
535
- // Report call ended to CallKit (if not already ended)
536
- if (!this.endedCalls.has(callKitUUID)) {
537
- console.log('CallKitCoordinator: Reporting call ended to CallKit');
538
- const reason = state === 'failed' ? callkit_1.CallEndReason.Failed : callkit_1.CallEndReason.RemoteEnded;
539
- await callkit_1.default.reportCallEnded(callKitUUID, reason);
540
- this.endedCalls.add(callKitUUID);
541
- }
542
- // Clean up the call mapping
543
- this.cleanupCall(callKitUUID);
544
- break;
545
- case 'ringing':
546
- // For outgoing calls, we might want to update CallKit with additional info
547
- // For incoming calls, CallKit already knows about the call
548
- break;
549
- }
550
- };
551
- call.on('telnyx.call.state', handleStateChange);
552
- // Store the listener cleanup function
553
- call._callKitStateListener = () => {
554
- call.removeListener('telnyx.call.state', handleStateChange);
555
- };
313
+ }
314
+ /**
315
+ * Handle CallKit end action (triggered by CallKit)
316
+ */
317
+ async handleCallKitEnd(callKitUUID, event) {
318
+ this.isCallFromPush = false;
319
+ if (this.processingCalls.has(callKitUUID)) {
320
+ console.log('CallKitCoordinator: End action already being processed, skipping duplicate');
321
+ return;
556
322
  }
557
- /**
558
- * Clean up call mappings and listeners
559
- */
560
- cleanupCall(callKitUUID) {
561
- // Remove from all tracking sets
562
- this.processingCalls.delete(callKitUUID);
563
- this.endedCalls.delete(callKitUUID);
564
- this.connectedCalls.delete(callKitUUID);
565
- // Get the call before removing it
566
- const call = this.callMap.get(callKitUUID);
567
- // Clean up state listeners
568
- if (call && call._callKitStateListener) {
569
- call._callKitStateListener();
570
- delete call._callKitStateListener;
571
- }
572
- // Remove from mapping
573
- this.callMap.delete(callKitUUID);
574
- if (call) {
575
- // Clean up the stored UUID on the call
576
- delete call._callKitUUID;
577
- }
578
- // Reset flags if no more active calls
579
- if (this.callMap.size === 0) {
580
- this.resetFlags();
581
- }
582
- // Clear VoIP push data now that the call is done
583
- if (react_native_1.Platform.OS === 'ios') {
584
- voice_pn_bridge_1.VoicePnBridge.clearPendingVoipPush().catch((error) => {
585
- console.warn('CallKitCoordinator: Error clearing VoIP push data on call cleanup:', error);
586
- });
587
- console.log('CallKitCoordinator: ✅ Cleared VoIP push data after call ended');
588
- }
323
+ const call = this.callMap.get(callKitUUID);
324
+ if (!call) {
325
+ console.warn('CallKitCoordinator: No WebRTC call found for CallKit end action', {
326
+ callKitUUID,
327
+ availableCallKitUUIDs: Array.from(this.callMap.keys()),
328
+ availableWebRTCCallIds: Array.from(this.callMap.values()).map((c) => c.callId),
329
+ });
330
+ console.log(
331
+ 'CallKitCoordinator: No WebRTC call found, handling as push notification rejection'
332
+ );
333
+ await this.handlePushNotificationReject(callKitUUID, event);
334
+ this.cleanupCall(callKitUUID);
335
+ return;
589
336
  }
590
- /**
591
- * Get CallKit UUID for a WebRTC call
592
- */
593
- getCallKitUUID(call) {
594
- // First check if the call has the UUID stored on it
595
- const storedUUID = call._callKitUUID;
596
- if (storedUUID) {
597
- return storedUUID;
598
- }
599
- // Search through all call mappings
600
- for (const [uuid, mappedCall] of this.callMap.entries()) {
601
- if (mappedCall.callId === call.callId) {
602
- // Store UUID on the call for faster future lookups
603
- call._callKitUUID = uuid;
604
- return uuid;
605
- }
606
- }
607
- return null;
337
+ console.log('CallKitCoordinator: Processing CallKit end action', {
338
+ callKitUUID,
339
+ webrtcCallId: call.callId,
340
+ });
341
+ this.processingCalls.add(callKitUUID);
342
+ try {
343
+ call.hangup();
344
+ } catch (error) {
345
+ console.error('CallKitCoordinator: Error hanging up WebRTC call', error);
346
+ } finally {
347
+ this.processingCalls.delete(callKitUUID);
348
+ this.cleanupCall(callKitUUID);
349
+ // Check if app is in background and no more calls - disconnect client
350
+ await this.checkBackgroundDisconnection();
608
351
  }
609
- /**
610
- * Get WebRTC call for a CallKit UUID
611
- */
612
- getWebRTCCall(callKitUUID) {
613
- return this.callMap.get(callKitUUID) || null;
352
+ }
353
+ /**
354
+ * Handle CallKit start action (triggered by CallKit for outgoing calls)
355
+ */
356
+ async handleCallKitStart(callKitUUID) {
357
+ const call = this.callMap.get(callKitUUID);
358
+ if (!call) {
359
+ console.warn(
360
+ 'CallKitCoordinator: No WebRTC call found for CallKit start action',
361
+ callKitUUID
362
+ );
363
+ return;
614
364
  }
615
- /**
616
- * Link an existing CallKit call (from push notification) with a WebRTC call
617
- * This should be called when a WebRTC call arrives that corresponds to an existing CallKit call
618
- */
619
- linkExistingCallKitCall(call, callKitUUID) {
620
- console.log('CallKitCoordinator: Linking existing CallKit call with WebRTC call', {
621
- callKitUUID,
622
- webrtcCallId: call.callId,
623
- });
624
- // Store the mappings
625
- this.callMap.set(callKitUUID, call);
626
- // Store UUID on the call for quick access
627
- call._callKitUUID = callKitUUID;
628
- // Set up state listeners
629
- this.setupWebRTCCallListeners(call, callKitUUID);
365
+ console.log('CallKitCoordinator: Processing CallKit start action', {
366
+ callKitUUID,
367
+ webrtcCallId: call.callId,
368
+ });
369
+ // For outgoing calls, the WebRTC call should already be initiated
370
+ // We just need to report when it connects
371
+ }
372
+ /**
373
+ * Handle CallKit push received event
374
+ * This allows us to coordinate between the push notification and any subsequent WebRTC calls
375
+ */
376
+ async handleCallKitPushReceived(callKitUUID, event) {
377
+ if (this.isCallFromPush) {
378
+ this.isCallFromPush = false;
379
+ console.log('CallKitCoordinator: Ignoring push received event (already processed)');
380
+ return;
630
381
  }
631
- /**
632
- * Set the VoIP client reference for triggering reconnection
633
- */
634
- setVoipClient(voipClient) {
635
- this.voipClient = voipClient;
382
+ console.log('CallKitCoordinator: Processing push received event', {
383
+ callKitUUID,
384
+ source: event?.callData?.source,
385
+ });
386
+ this.isCallFromPush = true;
387
+ console.log('CallKitCoordinator: Processing push received event', {
388
+ callKitUUID,
389
+ source: event?.callData?.source,
390
+ isCallFromPush: this.isCallFromPush,
391
+ });
392
+ try {
393
+ // Get VoIP client instance
394
+ const voipClient = this.getSDKClient();
395
+ if (!voipClient) {
396
+ console.error('CallKitCoordinator: VoIP client not available');
397
+ return;
398
+ }
399
+ // Retrieve pending push data from VoIP bridge
400
+ const pendingPushJson = await voice_pn_bridge_1.VoicePnBridge.getPendingVoipPush();
401
+ if (!pendingPushJson) {
402
+ console.warn('CallKitCoordinator: No pending push data found');
403
+ return;
404
+ }
405
+ const pendingPush = JSON.parse(pendingPushJson);
406
+ const realPushData = pendingPush?.payload;
407
+ if (!realPushData?.metadata) {
408
+ console.warn('CallKitCoordinator: Invalid push data structure');
409
+ return;
410
+ }
411
+ // Prepare push metadata with CallKit flag
412
+ const enhancedMetadata = {
413
+ ...realPushData.metadata,
414
+ from_callkit: true,
415
+ };
416
+ // Check if auto-answer is set and add from_notification flag
417
+ const shouldAddFromNotification = this.shouldAutoAnswerNextCall;
418
+ let pushData;
419
+ if (shouldAddFromNotification) {
420
+ pushData = {
421
+ metadata: enhancedMetadata,
422
+ from_notification: true,
423
+ action: 'answer',
424
+ };
425
+ voipClient.queueAnswerFromCallKit();
426
+ } else {
427
+ pushData = {
428
+ metadata: enhancedMetadata,
429
+ };
430
+ }
431
+ // Process the push notification
432
+ await voipClient.handlePushNotification(pushData);
433
+ console.log('CallKitCoordinator: Push notification processed successfully');
434
+ } catch (error) {
435
+ console.error('CallKitCoordinator: Error processing push received event:', error);
636
436
  }
637
- /**
638
- * Helper method to clean up push notification state
639
- */
640
- async cleanupPushNotificationState() {
641
- console.log('CallKitCoordinator: ✅ Cleared auto-answer flag');
642
- this.shouldAutoAnswerNextCall = false;
437
+ }
438
+ /**
439
+ * Handle push notification answer - when user answers from CallKit but we don't have a WebRTC call yet
440
+ * This is the iOS equivalent of the Android FCM handler
441
+ */
442
+ async handlePushNotificationAnswer(callKitUUID, event) {
443
+ try {
444
+ console.log(
445
+ 'CallKitCoordinator: Handling push notification answer for CallKit UUID:',
446
+ callKitUUID
447
+ );
448
+ if (react_native_1.Platform.OS === 'ios') {
449
+ console.log('CallKitCoordinator: Processing iOS push notification answer');
450
+ // Set auto-answer flag so when the WebRTC call comes in, it will be answered automatically
451
+ this.shouldAutoAnswerNextCall = true;
452
+ console.log('CallKitCoordinator: ✅ Set auto-answer flag for next incoming call');
453
+ // Get VoIP client and trigger reconnection
454
+ const voipClient = this.getSDKClient();
455
+ if (!voipClient) {
456
+ console.error(
457
+ 'CallKitCoordinator: ❌ No VoIP client available - cannot reconnect for push notification'
458
+ );
459
+ await callkit_1.default.reportCallEnded(callKitUUID, callkit_1.CallEndReason.Failed);
460
+ this.cleanupCall(callKitUUID);
461
+ return;
462
+ }
463
+ // Get the real push data that was stored by the VoIP push handler
464
+ console.log('CallKitCoordinator: 🔍 Getting real push data from VoicePnBridge...');
465
+ let realPushData = null;
466
+ try {
467
+ const pendingPushJson = await voice_pn_bridge_1.VoicePnBridge.getPendingVoipPush();
468
+ if (pendingPushJson) {
469
+ const pendingPush = JSON.parse(pendingPushJson);
470
+ if (pendingPush && pendingPush.payload) {
471
+ console.log('CallKitCoordinator: ✅ Found real push data');
472
+ realPushData = pendingPush.payload;
473
+ }
474
+ }
475
+ } catch (error) {
476
+ console.warn('CallKitCoordinator: Could not get real push data:', error);
477
+ }
478
+ // Create push notification payload - use real data if available, fallback to placeholder
479
+ const pushAction = 'incoming_call';
480
+ let pushMetadata;
481
+ if (realPushData && realPushData.metadata) {
482
+ // Use the real push metadata
483
+ console.log('CallKitCoordinator: 🎯 Using REAL push metadata for immediate handling');
484
+ pushMetadata = JSON.stringify({
485
+ ...realPushData.metadata,
486
+ from_callkit: true, // Add flag to indicate this was answered via CallKit
487
+ });
488
+ } else {
489
+ // Fallback to placeholder (this should rarely happen)
490
+ console.warn('CallKitCoordinator: ⚠️ No real push data found, using placeholder');
491
+ pushMetadata = JSON.stringify({
492
+ call_id: callKitUUID,
493
+ caller_name: 'Incoming Call',
494
+ caller_number: 'Unknown',
495
+ voice_sdk_id: 'unknown',
496
+ sent_time: new Date().toISOString(),
497
+ from_callkit: true,
498
+ });
499
+ }
500
+ // Set the pending push action to be handled when app comes to foreground
501
+ await voice_pn_bridge_1.VoicePnBridge.setPendingPushAction(pushAction, pushMetadata);
502
+ console.log('CallKitCoordinator: ✅ Set pending push action');
503
+ return;
504
+ }
505
+ // For other platforms (shouldn't happen on iOS)
506
+ console.error('CallKitCoordinator: ❌ Unsupported platform for push notification handling');
507
+ await callkit_1.default.reportCallEnded(callKitUUID, callkit_1.CallEndReason.Failed);
508
+ } catch (error) {
509
+ console.error('CallKitCoordinator: ❌ Error handling push notification answer:', error);
510
+ // Report the call as failed to CallKit
511
+ await callkit_1.default.reportCallEnded(callKitUUID, callkit_1.CallEndReason.Failed);
512
+ this.cleanupCall(callKitUUID);
643
513
  }
644
- /**
645
- * Get reference to the SDK client (for queuing actions when call doesn't exist yet)
646
- */
647
- getSDKClient() {
648
- return this.voipClient;
514
+ }
515
+ /**
516
+ * Handle push notification reject - when user rejects from CallKit but we don't have a WebRTC call yet
517
+ * This is the iOS equivalent of the Android FCM handler reject
518
+ */
519
+ async handlePushNotificationReject(callKitUUID, event) {
520
+ try {
521
+ console.log(
522
+ 'CallKitCoordinator: Handling push notification rejection for CallKit UUID:',
523
+ callKitUUID
524
+ );
525
+ if (react_native_1.Platform.OS === 'ios') {
526
+ console.log('CallKitCoordinator: Processing iOS push notification rejection');
527
+ this.voipClient.queueEndFromCallKit();
528
+ // Clean up push notification state
529
+ await this.cleanupPushNotificationState();
530
+ console.log('CallKitCoordinator: 🎯 Push notification rejection handling complete');
531
+ return;
532
+ }
533
+ // For other platforms (shouldn't happen on iOS)
534
+ console.error(
535
+ 'CallKitCoordinator: ❌ Unsupported platform for push notification rejection handling'
536
+ );
537
+ } catch (error) {
538
+ console.error('CallKitCoordinator: ❌ Error handling push notification rejection:', error);
649
539
  }
650
- /**
651
- * Check if app is in background and disconnect client if no active calls
652
- */
653
- async checkBackgroundDisconnection() {
654
- const currentAppState = react_native_1.AppState.currentState;
655
- // Only disconnect if app is in background/inactive and no active calls
656
- if ((currentAppState === 'background' || currentAppState === 'inactive') &&
657
- this.callMap.size === 0 &&
658
- this.voipClient) {
659
- console.log('CallKitCoordinator: App in background with no active calls - disconnecting client');
540
+ }
541
+ /**
542
+ * Set up listeners for WebRTC call state changes
543
+ */
544
+ setupWebRTCCallListeners(call, callKitUUID) {
545
+ const handleStateChange = async (call, state) => {
546
+ console.log('CallKitCoordinator: WebRTC call state changed', {
547
+ callKitUUID,
548
+ webrtcCallId: call.callId,
549
+ state,
550
+ });
551
+ switch (state) {
552
+ case 'active':
553
+ // When WebRTC call becomes active, just report as connected
554
+ // (CallKit call was already answered in answerCallFromUI)
555
+ if (!this.connectedCalls.has(callKitUUID)) {
556
+ console.log('CallKitCoordinator: WebRTC call active - reporting connected to CallKit');
660
557
  try {
661
- await this.voipClient.logout();
662
- console.log('CallKitCoordinator: Successfully disconnected client on background');
663
- }
664
- catch (error) {
665
- console.error('CallKitCoordinator: Error disconnecting client on background:', error);
558
+ // Report as connected (CallKit call already answered in UI flow)
559
+ await callkit_1.default.reportCallConnected(callKitUUID);
560
+ console.log(
561
+ 'CallKitCoordinator: Call reported as connected to CallKit ',
562
+ callKitUUID
563
+ );
564
+ this.connectedCalls.add(callKitUUID);
565
+ } catch (error) {
566
+ console.error('CallKitCoordinator: Error reporting call connected:', error);
666
567
  }
667
- }
668
- else {
669
- console.log('CallKitCoordinator: Skipping background disconnection', {
670
- appState: currentAppState,
671
- activeCalls: this.callMap.size,
672
- hasVoipClient: !!this.voipClient,
673
- });
674
- }
568
+ }
569
+ break;
570
+ case 'ended':
571
+ case 'failed':
572
+ // Report call ended to CallKit (if not already ended)
573
+ if (!this.endedCalls.has(callKitUUID)) {
574
+ console.log('CallKitCoordinator: Reporting call ended to CallKit');
575
+ const reason =
576
+ state === 'failed'
577
+ ? callkit_1.CallEndReason.Failed
578
+ : callkit_1.CallEndReason.RemoteEnded;
579
+ await callkit_1.default.reportCallEnded(callKitUUID, reason);
580
+ this.endedCalls.add(callKitUUID);
581
+ }
582
+ // Clean up the call mapping
583
+ this.cleanupCall(callKitUUID);
584
+ break;
585
+ case 'ringing':
586
+ // For outgoing calls, we might want to update CallKit with additional info
587
+ // For incoming calls, CallKit already knows about the call
588
+ break;
589
+ }
590
+ };
591
+ call.on('telnyx.call.state', handleStateChange);
592
+ // Store the listener cleanup function
593
+ call._callKitStateListener = () => {
594
+ call.removeListener('telnyx.call.state', handleStateChange);
595
+ };
596
+ }
597
+ /**
598
+ * Clean up call mappings and listeners
599
+ */
600
+ cleanupCall(callKitUUID) {
601
+ // Remove from all tracking sets
602
+ this.processingCalls.delete(callKitUUID);
603
+ this.endedCalls.delete(callKitUUID);
604
+ this.connectedCalls.delete(callKitUUID);
605
+ // Get the call before removing it
606
+ const call = this.callMap.get(callKitUUID);
607
+ // Clean up state listeners
608
+ if (call && call._callKitStateListener) {
609
+ call._callKitStateListener();
610
+ delete call._callKitStateListener;
611
+ }
612
+ // Remove from mapping
613
+ this.callMap.delete(callKitUUID);
614
+ if (call) {
615
+ // Clean up the stored UUID on the call
616
+ delete call._callKitUUID;
617
+ }
618
+ // Reset flags if no more active calls
619
+ if (this.callMap.size === 0) {
620
+ this.resetFlags();
675
621
  }
676
- /**
677
- * Reset only flags (keeping active call mappings intact)
678
- */
679
- resetFlags() {
680
- console.log('CallKitCoordinator: Resetting coordinator flags');
681
- // Reset push notification flag
682
- this.isCallFromPush = false;
683
- // Reset auto-answer flag
684
- this.shouldAutoAnswerNextCall = false;
685
- console.log('CallKitCoordinator: ✅ Coordinator flags reset');
622
+ // Clear VoIP push data now that the call is done
623
+ if (react_native_1.Platform.OS === 'ios') {
624
+ voice_pn_bridge_1.VoicePnBridge.clearPendingVoipPush().catch((error) => {
625
+ console.warn('CallKitCoordinator: Error clearing VoIP push data on call cleanup:', error);
626
+ });
627
+ console.log('CallKitCoordinator: Cleared VoIP push data after call ended');
686
628
  }
687
- /**
688
- * Check if there are any calls currently being processed by CallKit
689
- * This helps prevent premature flag resets during CallKit operations
690
- */
691
- hasProcessingCalls() {
692
- return this.processingCalls.size > 0;
629
+ }
630
+ /**
631
+ * Get CallKit UUID for a WebRTC call
632
+ */
633
+ getCallKitUUID(call) {
634
+ // First check if the call has the UUID stored on it
635
+ const storedUUID = call._callKitUUID;
636
+ if (storedUUID) {
637
+ return storedUUID;
693
638
  }
694
- /**
695
- * Check if there's currently a call from push notification being processed
696
- * This helps prevent disconnection during push call handling
697
- */
698
- getIsCallFromPush() {
699
- return this.isCallFromPush;
639
+ // Search through all call mappings
640
+ for (const [uuid, mappedCall] of this.callMap.entries()) {
641
+ if (mappedCall.callId === call.callId) {
642
+ // Store UUID on the call for faster future lookups
643
+ call._callKitUUID = uuid;
644
+ return uuid;
645
+ }
700
646
  }
701
- /**
702
- * Check if CallKit is available and coordinator is active
703
- */
704
- isAvailable() {
705
- return react_native_1.Platform.OS === 'ios' && callkit_1.default.isAvailable();
647
+ return null;
648
+ }
649
+ /**
650
+ * Get WebRTC call for a CallKit UUID
651
+ */
652
+ getWebRTCCall(callKitUUID) {
653
+ return this.callMap.get(callKitUUID) || null;
654
+ }
655
+ /**
656
+ * Link an existing CallKit call (from push notification) with a WebRTC call
657
+ * This should be called when a WebRTC call arrives that corresponds to an existing CallKit call
658
+ */
659
+ linkExistingCallKitCall(call, callKitUUID) {
660
+ console.log('CallKitCoordinator: Linking existing CallKit call with WebRTC call', {
661
+ callKitUUID,
662
+ webrtcCallId: call.callId,
663
+ });
664
+ // Store the mappings
665
+ this.callMap.set(callKitUUID, call);
666
+ // Store UUID on the call for quick access
667
+ call._callKitUUID = callKitUUID;
668
+ // Set up state listeners
669
+ this.setupWebRTCCallListeners(call, callKitUUID);
670
+ }
671
+ /**
672
+ * Set the VoIP client reference for triggering reconnection
673
+ */
674
+ setVoipClient(voipClient) {
675
+ this.voipClient = voipClient;
676
+ }
677
+ /**
678
+ * Helper method to clean up push notification state
679
+ */
680
+ async cleanupPushNotificationState() {
681
+ console.log('CallKitCoordinator: ✅ Cleared auto-answer flag');
682
+ this.shouldAutoAnswerNextCall = false;
683
+ }
684
+ /**
685
+ * Get reference to the SDK client (for queuing actions when call doesn't exist yet)
686
+ */
687
+ getSDKClient() {
688
+ return this.voipClient;
689
+ }
690
+ /**
691
+ * Check if app is in background and disconnect client if no active calls
692
+ */
693
+ async checkBackgroundDisconnection() {
694
+ const currentAppState = react_native_1.AppState.currentState;
695
+ // Only disconnect if app is in background/inactive and no active calls
696
+ if (
697
+ (currentAppState === 'background' || currentAppState === 'inactive') &&
698
+ this.callMap.size === 0 &&
699
+ this.voipClient
700
+ ) {
701
+ console.log(
702
+ 'CallKitCoordinator: App in background with no active calls - disconnecting client'
703
+ );
704
+ try {
705
+ await this.voipClient.logout();
706
+ console.log('CallKitCoordinator: Successfully disconnected client on background');
707
+ } catch (error) {
708
+ console.error('CallKitCoordinator: Error disconnecting client on background:', error);
709
+ }
710
+ } else {
711
+ console.log('CallKitCoordinator: Skipping background disconnection', {
712
+ appState: currentAppState,
713
+ activeCalls: this.callMap.size,
714
+ hasVoipClient: !!this.voipClient,
715
+ });
706
716
  }
717
+ }
718
+ /**
719
+ * Reset only flags (keeping active call mappings intact)
720
+ */
721
+ resetFlags() {
722
+ console.log('CallKitCoordinator: Resetting coordinator flags');
723
+ // Reset push notification flag
724
+ this.isCallFromPush = false;
725
+ // Reset auto-answer flag
726
+ this.shouldAutoAnswerNextCall = false;
727
+ console.log('CallKitCoordinator: ✅ Coordinator flags reset');
728
+ }
729
+ /**
730
+ * Check if there are any calls currently being processed by CallKit
731
+ * This helps prevent premature flag resets during CallKit operations
732
+ */
733
+ hasProcessingCalls() {
734
+ return this.processingCalls.size > 0;
735
+ }
736
+ /**
737
+ * Check if there's currently a call from push notification being processed
738
+ * This helps prevent disconnection during push call handling
739
+ */
740
+ getIsCallFromPush() {
741
+ return this.isCallFromPush;
742
+ }
743
+ /**
744
+ * Check if CallKit is available and coordinator is active
745
+ */
746
+ isAvailable() {
747
+ return react_native_1.Platform.OS === 'ios' && callkit_1.default.isAvailable();
748
+ }
707
749
  }
708
750
  CallKitCoordinator.instance = null;
709
751
  // Export singleton instance