@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,502 +1,502 @@
1
- import { BehaviorSubject, Observable } from 'rxjs';
2
- import { distinctUntilChanged, map } from 'rxjs/operators';
3
- import { TelnyxCallState, CallStateHelpers } from './call-state';
4
- import { Call as TelnyxCall } from '@telnyx/react-native-voice-sdk';
5
- import { Platform } from 'react-native';
6
-
7
- /**
8
- * Represents a call with reactive state streams.
9
- *
10
- * This class wraps the underlying Telnyx Call object and provides
11
- * reactive streams for all call state changes, making it easy to
12
- * integrate with any state management solution.
13
- */
14
- export class Call {
15
- private readonly _callState = new BehaviorSubject<TelnyxCallState>(TelnyxCallState.RINGING);
16
- private readonly _isMuted = new BehaviorSubject<boolean>(false);
17
- private readonly _isHeld = new BehaviorSubject<boolean>(false);
18
- private readonly _duration = new BehaviorSubject<number>(0);
19
-
20
- private _durationTimer?: NodeJS.Timeout;
21
- private _startTime?: Date;
22
-
23
- constructor(
24
- private readonly _telnyxCall: TelnyxCall,
25
- private readonly _callId: string,
26
- private readonly _destination: string,
27
- private readonly _isIncoming: boolean,
28
- isReattached: boolean = false,
29
- private readonly _originalCallerName?: string,
30
- private readonly _originalCallerNumber?: string
31
- ) {
32
- // Set initial state based on whether this is a reattached call
33
- if (isReattached) {
34
- console.log('Call: Setting initial state to ACTIVE for reattached call');
35
- this._callState.next(TelnyxCallState.ACTIVE);
36
- }
37
-
38
- this._setupCallListeners();
39
- }
40
-
41
- /**
42
- * Unique identifier for this call
43
- */
44
- get callId(): string {
45
- return this._callId;
46
- }
47
-
48
- /**
49
- * The destination number or SIP URI
50
- */
51
- get destination(): string {
52
- return this._destination;
53
- }
54
-
55
- /**
56
- * Whether this is an incoming call
57
- */
58
- get isIncoming(): boolean {
59
- return this._isIncoming;
60
- }
61
-
62
- /**
63
- * Whether this is an outgoing call
64
- */
65
- get isOutgoing(): boolean {
66
- return !this._isIncoming;
67
- }
68
-
69
- /**
70
- * Current call state (synchronous access)
71
- */
72
- get currentState(): TelnyxCallState {
73
- return this._callState.value;
74
- }
75
-
76
- /**
77
- * Current mute state (synchronous access)
78
- */
79
- get currentIsMuted(): boolean {
80
- return this._isMuted.value;
81
- }
82
-
83
- /**
84
- * Current hold state (synchronous access)
85
- */
86
- get currentIsHeld(): boolean {
87
- return this._isHeld.value;
88
- }
89
-
90
- /**
91
- * Current call duration in seconds (synchronous access)
92
- */
93
- get currentDuration(): number {
94
- return this._duration.value;
95
- }
96
-
97
- /**
98
- * Custom headers received from the WebRTC INVITE message.
99
- * These headers are passed during call initiation and can contain application-specific information.
100
- * Format should be [{"name": "X-Header-Name", "value": "Value"}] where header names must start with "X-".
101
- */
102
- get inviteCustomHeaders(): { name: string; value: string }[] | null {
103
- return this._telnyxCall.inviteCustomHeaders;
104
- }
105
-
106
- /**
107
- * Custom headers received from the WebRTC ANSWER message.
108
- * These headers are passed during call acceptance and can contain application-specific information.
109
- * Format should be [{"name": "X-Header-Name", "value": "Value"}] where header names must start with "X-".
110
- */
111
- get answerCustomHeaders(): { name: string; value: string }[] | null {
112
- return this._telnyxCall.answerCustomHeaders;
113
- }
114
-
115
- /**
116
- * Get the underlying Telnyx Call object (for internal use)
117
- * @internal
118
- */
119
- get telnyxCall(): TelnyxCall {
120
- return this._telnyxCall;
121
- }
122
-
123
- /**
124
- * Observable stream of call state changes
125
- */
126
- get callState$(): Observable<TelnyxCallState> {
127
- return this._callState.asObservable().pipe(distinctUntilChanged());
128
- }
129
-
130
- /**
131
- * Observable stream of mute state changes
132
- */
133
- get isMuted$(): Observable<boolean> {
134
- return this._isMuted.asObservable().pipe(distinctUntilChanged());
135
- }
136
-
137
- /**
138
- * Observable stream of hold state changes
139
- */
140
- get isHeld$(): Observable<boolean> {
141
- return this._isHeld.asObservable().pipe(distinctUntilChanged());
142
- }
143
-
144
- /**
145
- * Observable stream of call duration changes (in seconds)
146
- */
147
- get duration$(): Observable<number> {
148
- return this._duration.asObservable().pipe(distinctUntilChanged());
149
- }
150
-
151
- /**
152
- * Observable that emits true when the call can be answered
153
- */
154
- get canAnswer$(): Observable<boolean> {
155
- return this.callState$.pipe(
156
- map((state) => CallStateHelpers.canAnswer(state)),
157
- distinctUntilChanged()
158
- );
159
- }
160
-
161
- /**
162
- * Observable that emits true when the call can be hung up
163
- */
164
- get canHangup$(): Observable<boolean> {
165
- return this.callState$.pipe(
166
- map((state) => CallStateHelpers.canHangup(state)),
167
- distinctUntilChanged()
168
- );
169
- }
170
-
171
- /**
172
- * Observable that emits true when the call can be put on hold
173
- */
174
- get canHold$(): Observable<boolean> {
175
- return this.callState$.pipe(
176
- map((state) => CallStateHelpers.canHold(state)),
177
- distinctUntilChanged()
178
- );
179
- }
180
-
181
- /**
182
- * Observable that emits true when the call can be resumed from hold
183
- */
184
- get canResume$(): Observable<boolean> {
185
- return this.callState$.pipe(
186
- map((state) => CallStateHelpers.canResume(state)),
187
- distinctUntilChanged()
188
- );
189
- }
190
-
191
- /**
192
- * Answer the incoming call
193
- * @param customHeaders Optional custom headers to include with the answer
194
- */
195
- async answer(customHeaders?: { name: string; value: string }[]): Promise<void> {
196
- if (!CallStateHelpers.canAnswer(this.currentState)) {
197
- throw new Error(`Cannot answer call in state: ${this.currentState}`);
198
- }
199
-
200
- try {
201
- // On iOS, use CallKit coordinator for proper audio session handling
202
- if (Platform.OS === 'ios') {
203
- const { callKitCoordinator } = await import('../callkit/callkit-coordinator');
204
- if (callKitCoordinator.isAvailable()) {
205
- console.log('Call: Using CallKit coordinator to answer call (iOS)');
206
- await callKitCoordinator.answerCallFromUI(this._telnyxCall);
207
- return;
208
- }
209
- }
210
-
211
- // Fallback for Android or when CallKit is not available
212
- console.log('Call: Setting state to CONNECTING before answering');
213
- this._callState.next(TelnyxCallState.CONNECTING);
214
-
215
- // Pass custom headers to the underlying Telnyx call
216
- await this._telnyxCall.answer(customHeaders);
217
- } catch (error) {
218
- console.error('Failed to answer call:', error);
219
- throw error;
220
- }
221
- }
222
-
223
- /**
224
- * Hang up the call
225
- * @param customHeaders Optional custom headers to include with the hangup request
226
- */
227
- async hangup(customHeaders?: { name: string; value: string }[]): Promise<void> {
228
- if (!CallStateHelpers.canHangup(this.currentState)) {
229
- throw new Error(`Cannot hang up call in state: ${this.currentState}`);
230
- }
231
-
232
- try {
233
- // On iOS, use CallKit coordinator for proper CallKit cleanup
234
- if (Platform.OS === 'ios') {
235
- const { callKitCoordinator } = await import('../callkit/callkit-coordinator');
236
- if (callKitCoordinator.isAvailable()) {
237
- console.log('Call: Using CallKit coordinator to end call (iOS)');
238
- await callKitCoordinator.endCallFromUI(this._telnyxCall);
239
- return;
240
- }
241
- }
242
-
243
- // Fallback for Android or when CallKit is not available
244
- await this._telnyxCall.hangup(customHeaders);
245
-
246
- // On Android, also notify the native side to hide ongoing notification
247
- if (Platform.OS === 'android') {
248
- try {
249
- const { VoicePnBridge } = await import('../internal/voice-pn-bridge');
250
- await VoicePnBridge.endCall(this._callId);
251
- console.log('Call: Notified Android to hide ongoing notification');
252
- } catch (error) {
253
- console.error('Call: Failed to notify Android about call end:', error);
254
- // Don't fail the hangup if notification hiding fails
255
- }
256
- }
257
- } catch (error) {
258
- console.error('Failed to hang up call:', error);
259
- throw error;
260
- }
261
- }
262
-
263
- /**
264
- * Put the call on hold
265
- */
266
- async hold(): Promise<void> {
267
- if (!CallStateHelpers.canHold(this.currentState)) {
268
- throw new Error(`Cannot hold call in state: ${this.currentState}`);
269
- }
270
-
271
- try {
272
- await this._telnyxCall.hold();
273
- } catch (error) {
274
- console.error('Failed to hold call:', error);
275
- throw error;
276
- }
277
- }
278
-
279
- /**
280
- * Resume the call from hold
281
- */
282
- async resume(): Promise<void> {
283
- if (!CallStateHelpers.canResume(this.currentState)) {
284
- throw new Error(`Cannot resume call in state: ${this.currentState}`);
285
- }
286
-
287
- try {
288
- await this._telnyxCall.unhold();
289
- } catch (error) {
290
- console.error('Failed to resume call:', error);
291
- throw error;
292
- }
293
- }
294
-
295
- /**
296
- * Mute the call
297
- */
298
- async mute(): Promise<void> {
299
- if (!CallStateHelpers.canToggleMute(this.currentState)) {
300
- throw new Error(`Cannot mute call in state: ${this.currentState}`);
301
- }
302
-
303
- try {
304
- this._telnyxCall.mute();
305
- this._isMuted.next(true);
306
- } catch (error) {
307
- console.error('Failed to mute call:', error);
308
- throw error;
309
- }
310
- }
311
-
312
- /**
313
- * Unmute the call
314
- */
315
- async unmute(): Promise<void> {
316
- if (!CallStateHelpers.canToggleMute(this.currentState)) {
317
- throw new Error(`Cannot unmute call in state: ${this.currentState}`);
318
- }
319
-
320
- try {
321
- this._telnyxCall.unmute();
322
- this._isMuted.next(false);
323
- } catch (error) {
324
- console.error('Failed to unmute call:', error);
325
- throw error;
326
- }
327
- }
328
-
329
- /**
330
- * Toggle mute state
331
- */
332
- async toggleMute(): Promise<void> {
333
- if (this.currentIsMuted) {
334
- await this.unmute();
335
- } else {
336
- await this.mute();
337
- }
338
- }
339
-
340
- /**
341
- * Set the call to connecting state (used for push notification calls when answered via CallKit)
342
- * @internal
343
- */
344
- setConnecting(): void {
345
- console.log('Call: Setting state to CONNECTING for push notification answer');
346
- this._callState.next(TelnyxCallState.CONNECTING);
347
- }
348
-
349
- /**
350
- * Clean up resources when the call is disposed
351
- */
352
- dispose(): void {
353
- this._stopDurationTimer();
354
- this._callState.complete();
355
- this._isMuted.complete();
356
- this._isHeld.complete();
357
- this._duration.complete();
358
- }
359
-
360
- /**
361
- * Set up listeners for the underlying Telnyx call
362
- */
363
- private _setupCallListeners(): void {
364
- // Map Telnyx call states to our simplified states
365
- this._telnyxCall.on('telnyx.call.state', (call: any, state: any) => {
366
- const telnyxState = this._mapToTelnyxCallState(state);
367
- this._callState.next(telnyxState);
368
-
369
- // Start duration timer when call becomes active
370
- if (telnyxState === TelnyxCallState.ACTIVE && !this._startTime) {
371
- this._startDurationTimer();
372
-
373
- // Show ongoing call notification on Android when call becomes active
374
- // This covers both locally answered calls and calls that become active from remote side
375
- if (Platform.OS === 'android') {
376
- (async () => {
377
- try {
378
- const { VoicePnBridge } = await import('../internal/voice-pn-bridge');
379
-
380
- // Extract caller information based on call direction
381
- let callerNumber: string | undefined;
382
- let callerName: string | undefined;
383
-
384
- if (this._isIncoming) {
385
- // For incoming calls, use the remote caller ID (who's calling us)
386
- callerNumber = this._telnyxCall.remoteCallerIdNumber;
387
- callerName = this._telnyxCall.remoteCallerIdName;
388
- } else {
389
- // For outgoing calls, use our own caller ID (what we're showing to them)
390
- // These are the values we set when making the call
391
- callerNumber = this._telnyxCall.localCallerIdNumber || this._originalCallerNumber;
392
- callerName = this._telnyxCall.localCallerIdName || this._originalCallerName;
393
- }
394
-
395
- // Fallback logic for better notification display - avoid "Unknown" when possible
396
- let displayName: string;
397
- let displayNumber: string;
398
-
399
- if (this._isIncoming) {
400
- // For incoming calls: use caller name or fall back to caller number, then destination
401
- displayName = callerName || callerNumber || this._destination;
402
- displayNumber = callerNumber || this._destination;
403
- } else {
404
- // For outgoing calls: use our caller ID or descriptive text
405
- displayName = callerName || `${this._destination}`;
406
- displayNumber = callerNumber || this._destination;
407
- }
408
-
409
- await VoicePnBridge.showOngoingCallNotification(
410
- displayName,
411
- displayNumber,
412
- this._callId
413
- );
414
- console.log('Call: Showed ongoing call notification on Android (call active)', {
415
- isIncoming: this._isIncoming,
416
- callerName: displayName,
417
- callerNumber: displayNumber,
418
- });
419
- } catch (error) {
420
- console.error('Call: Failed to show ongoing call notification on active:', error);
421
- }
422
- })();
423
- }
424
- }
425
-
426
- // Stop duration timer when call ends
427
- if (CallStateHelpers.isTerminated(telnyxState)) {
428
- this._stopDurationTimer();
429
-
430
- // Clean up ongoing call notification on Android when call ends
431
- if (Platform.OS === 'android') {
432
- (async () => {
433
- try {
434
- const { VoicePnBridge } = await import('../internal/voice-pn-bridge');
435
- await VoicePnBridge.endCall(this._callId);
436
- console.log('Call: Cleaned up ongoing call notification (call terminated)');
437
- } catch (error) {
438
- console.error(
439
- 'Call: Failed to clean up ongoing call notification on termination:',
440
- error
441
- );
442
- }
443
- })();
444
- }
445
- }
446
- });
447
- }
448
-
449
- /**
450
- * Map Telnyx SDK call states to our simplified call states
451
- */
452
- private _mapToTelnyxCallState(telnyxState: any): TelnyxCallState {
453
- // This mapping will depend on the actual Telnyx SDK call states
454
- // For now, using a basic mapping - this should be updated based on actual SDK
455
- switch (telnyxState) {
456
- case 'ringing':
457
- case 'new':
458
- return TelnyxCallState.RINGING;
459
- case 'connecting':
460
- return TelnyxCallState.CONNECTING;
461
- case 'active':
462
- case 'answered':
463
- return TelnyxCallState.ACTIVE;
464
- case 'held':
465
- return TelnyxCallState.HELD;
466
- case 'ended':
467
- case 'hangup':
468
- return TelnyxCallState.ENDED;
469
- case 'failed':
470
- case 'rejected':
471
- return TelnyxCallState.FAILED;
472
- case 'dropped':
473
- return TelnyxCallState.DROPPED;
474
- default:
475
- console.warn(`Unknown call state: ${telnyxState}`);
476
- return TelnyxCallState.RINGING;
477
- }
478
- }
479
-
480
- /**
481
- * Start the duration timer
482
- */
483
- private _startDurationTimer(): void {
484
- this._startTime = new Date();
485
- this._durationTimer = setInterval(() => {
486
- if (this._startTime) {
487
- const duration = Math.floor((Date.now() - this._startTime.getTime()) / 1000);
488
- this._duration.next(duration);
489
- }
490
- }, 1000);
491
- }
492
-
493
- /**
494
- * Stop the duration timer
495
- */
496
- private _stopDurationTimer(): void {
497
- if (this._durationTimer) {
498
- clearInterval(this._durationTimer);
499
- this._durationTimer = undefined;
500
- }
501
- }
502
- }
1
+ import { BehaviorSubject, Observable } from 'rxjs';
2
+ import { distinctUntilChanged, map } from 'rxjs/operators';
3
+ import { TelnyxCallState, CallStateHelpers } from './call-state';
4
+ import { Call as TelnyxCall } from '@telnyx/react-native-voice-sdk';
5
+ import { Platform } from 'react-native';
6
+
7
+ /**
8
+ * Represents a call with reactive state streams.
9
+ *
10
+ * This class wraps the underlying Telnyx Call object and provides
11
+ * reactive streams for all call state changes, making it easy to
12
+ * integrate with any state management solution.
13
+ */
14
+ export class Call {
15
+ private readonly _callState = new BehaviorSubject<TelnyxCallState>(TelnyxCallState.RINGING);
16
+ private readonly _isMuted = new BehaviorSubject<boolean>(false);
17
+ private readonly _isHeld = new BehaviorSubject<boolean>(false);
18
+ private readonly _duration = new BehaviorSubject<number>(0);
19
+
20
+ private _durationTimer?: NodeJS.Timeout;
21
+ private _startTime?: Date;
22
+
23
+ constructor(
24
+ private readonly _telnyxCall: TelnyxCall,
25
+ private readonly _callId: string,
26
+ private readonly _destination: string,
27
+ private readonly _isIncoming: boolean,
28
+ isReattached: boolean = false,
29
+ private readonly _originalCallerName?: string,
30
+ private readonly _originalCallerNumber?: string
31
+ ) {
32
+ // Set initial state based on whether this is a reattached call
33
+ if (isReattached) {
34
+ console.log('Call: Setting initial state to ACTIVE for reattached call');
35
+ this._callState.next(TelnyxCallState.ACTIVE);
36
+ }
37
+
38
+ this._setupCallListeners();
39
+ }
40
+
41
+ /**
42
+ * Unique identifier for this call
43
+ */
44
+ get callId(): string {
45
+ return this._callId;
46
+ }
47
+
48
+ /**
49
+ * The destination number or SIP URI
50
+ */
51
+ get destination(): string {
52
+ return this._destination;
53
+ }
54
+
55
+ /**
56
+ * Whether this is an incoming call
57
+ */
58
+ get isIncoming(): boolean {
59
+ return this._isIncoming;
60
+ }
61
+
62
+ /**
63
+ * Whether this is an outgoing call
64
+ */
65
+ get isOutgoing(): boolean {
66
+ return !this._isIncoming;
67
+ }
68
+
69
+ /**
70
+ * Current call state (synchronous access)
71
+ */
72
+ get currentState(): TelnyxCallState {
73
+ return this._callState.value;
74
+ }
75
+
76
+ /**
77
+ * Current mute state (synchronous access)
78
+ */
79
+ get currentIsMuted(): boolean {
80
+ return this._isMuted.value;
81
+ }
82
+
83
+ /**
84
+ * Current hold state (synchronous access)
85
+ */
86
+ get currentIsHeld(): boolean {
87
+ return this._isHeld.value;
88
+ }
89
+
90
+ /**
91
+ * Current call duration in seconds (synchronous access)
92
+ */
93
+ get currentDuration(): number {
94
+ return this._duration.value;
95
+ }
96
+
97
+ /**
98
+ * Custom headers received from the WebRTC INVITE message.
99
+ * These headers are passed during call initiation and can contain application-specific information.
100
+ * Format should be [{"name": "X-Header-Name", "value": "Value"}] where header names must start with "X-".
101
+ */
102
+ get inviteCustomHeaders(): { name: string; value: string }[] | null {
103
+ return this._telnyxCall.inviteCustomHeaders;
104
+ }
105
+
106
+ /**
107
+ * Custom headers received from the WebRTC ANSWER message.
108
+ * These headers are passed during call acceptance and can contain application-specific information.
109
+ * Format should be [{"name": "X-Header-Name", "value": "Value"}] where header names must start with "X-".
110
+ */
111
+ get answerCustomHeaders(): { name: string; value: string }[] | null {
112
+ return this._telnyxCall.answerCustomHeaders;
113
+ }
114
+
115
+ /**
116
+ * Get the underlying Telnyx Call object (for internal use)
117
+ * @internal
118
+ */
119
+ get telnyxCall(): TelnyxCall {
120
+ return this._telnyxCall;
121
+ }
122
+
123
+ /**
124
+ * Observable stream of call state changes
125
+ */
126
+ get callState$(): Observable<TelnyxCallState> {
127
+ return this._callState.asObservable().pipe(distinctUntilChanged());
128
+ }
129
+
130
+ /**
131
+ * Observable stream of mute state changes
132
+ */
133
+ get isMuted$(): Observable<boolean> {
134
+ return this._isMuted.asObservable().pipe(distinctUntilChanged());
135
+ }
136
+
137
+ /**
138
+ * Observable stream of hold state changes
139
+ */
140
+ get isHeld$(): Observable<boolean> {
141
+ return this._isHeld.asObservable().pipe(distinctUntilChanged());
142
+ }
143
+
144
+ /**
145
+ * Observable stream of call duration changes (in seconds)
146
+ */
147
+ get duration$(): Observable<number> {
148
+ return this._duration.asObservable().pipe(distinctUntilChanged());
149
+ }
150
+
151
+ /**
152
+ * Observable that emits true when the call can be answered
153
+ */
154
+ get canAnswer$(): Observable<boolean> {
155
+ return this.callState$.pipe(
156
+ map((state) => CallStateHelpers.canAnswer(state)),
157
+ distinctUntilChanged()
158
+ );
159
+ }
160
+
161
+ /**
162
+ * Observable that emits true when the call can be hung up
163
+ */
164
+ get canHangup$(): Observable<boolean> {
165
+ return this.callState$.pipe(
166
+ map((state) => CallStateHelpers.canHangup(state)),
167
+ distinctUntilChanged()
168
+ );
169
+ }
170
+
171
+ /**
172
+ * Observable that emits true when the call can be put on hold
173
+ */
174
+ get canHold$(): Observable<boolean> {
175
+ return this.callState$.pipe(
176
+ map((state) => CallStateHelpers.canHold(state)),
177
+ distinctUntilChanged()
178
+ );
179
+ }
180
+
181
+ /**
182
+ * Observable that emits true when the call can be resumed from hold
183
+ */
184
+ get canResume$(): Observable<boolean> {
185
+ return this.callState$.pipe(
186
+ map((state) => CallStateHelpers.canResume(state)),
187
+ distinctUntilChanged()
188
+ );
189
+ }
190
+
191
+ /**
192
+ * Answer the incoming call
193
+ * @param customHeaders Optional custom headers to include with the answer
194
+ */
195
+ async answer(customHeaders?: { name: string; value: string }[]): Promise<void> {
196
+ if (!CallStateHelpers.canAnswer(this.currentState)) {
197
+ throw new Error(`Cannot answer call in state: ${this.currentState}`);
198
+ }
199
+
200
+ try {
201
+ // On iOS, use CallKit coordinator for proper audio session handling
202
+ if (Platform.OS === 'ios') {
203
+ const { callKitCoordinator } = await import('../callkit/callkit-coordinator');
204
+ if (callKitCoordinator.isAvailable()) {
205
+ console.log('Call: Using CallKit coordinator to answer call (iOS)');
206
+ await callKitCoordinator.answerCallFromUI(this._telnyxCall);
207
+ return;
208
+ }
209
+ }
210
+
211
+ // Fallback for Android or when CallKit is not available
212
+ console.log('Call: Setting state to CONNECTING before answering');
213
+ this._callState.next(TelnyxCallState.CONNECTING);
214
+
215
+ // Pass custom headers to the underlying Telnyx call
216
+ await this._telnyxCall.answer(customHeaders);
217
+ } catch (error) {
218
+ console.error('Failed to answer call:', error);
219
+ throw error;
220
+ }
221
+ }
222
+
223
+ /**
224
+ * Hang up the call
225
+ * @param customHeaders Optional custom headers to include with the hangup request
226
+ */
227
+ async hangup(customHeaders?: { name: string; value: string }[]): Promise<void> {
228
+ if (!CallStateHelpers.canHangup(this.currentState)) {
229
+ throw new Error(`Cannot hang up call in state: ${this.currentState}`);
230
+ }
231
+
232
+ try {
233
+ // On iOS, use CallKit coordinator for proper CallKit cleanup
234
+ if (Platform.OS === 'ios') {
235
+ const { callKitCoordinator } = await import('../callkit/callkit-coordinator');
236
+ if (callKitCoordinator.isAvailable()) {
237
+ console.log('Call: Using CallKit coordinator to end call (iOS)');
238
+ await callKitCoordinator.endCallFromUI(this._telnyxCall);
239
+ return;
240
+ }
241
+ }
242
+
243
+ // Fallback for Android or when CallKit is not available
244
+ await this._telnyxCall.hangup(customHeaders);
245
+
246
+ // On Android, also notify the native side to hide ongoing notification
247
+ if (Platform.OS === 'android') {
248
+ try {
249
+ const { VoicePnBridge } = await import('../internal/voice-pn-bridge');
250
+ await VoicePnBridge.endCall(this._callId);
251
+ console.log('Call: Notified Android to hide ongoing notification');
252
+ } catch (error) {
253
+ console.error('Call: Failed to notify Android about call end:', error);
254
+ // Don't fail the hangup if notification hiding fails
255
+ }
256
+ }
257
+ } catch (error) {
258
+ console.error('Failed to hang up call:', error);
259
+ throw error;
260
+ }
261
+ }
262
+
263
+ /**
264
+ * Put the call on hold
265
+ */
266
+ async hold(): Promise<void> {
267
+ if (!CallStateHelpers.canHold(this.currentState)) {
268
+ throw new Error(`Cannot hold call in state: ${this.currentState}`);
269
+ }
270
+
271
+ try {
272
+ await this._telnyxCall.hold();
273
+ } catch (error) {
274
+ console.error('Failed to hold call:', error);
275
+ throw error;
276
+ }
277
+ }
278
+
279
+ /**
280
+ * Resume the call from hold
281
+ */
282
+ async resume(): Promise<void> {
283
+ if (!CallStateHelpers.canResume(this.currentState)) {
284
+ throw new Error(`Cannot resume call in state: ${this.currentState}`);
285
+ }
286
+
287
+ try {
288
+ await this._telnyxCall.unhold();
289
+ } catch (error) {
290
+ console.error('Failed to resume call:', error);
291
+ throw error;
292
+ }
293
+ }
294
+
295
+ /**
296
+ * Mute the call
297
+ */
298
+ async mute(): Promise<void> {
299
+ if (!CallStateHelpers.canToggleMute(this.currentState)) {
300
+ throw new Error(`Cannot mute call in state: ${this.currentState}`);
301
+ }
302
+
303
+ try {
304
+ this._telnyxCall.mute();
305
+ this._isMuted.next(true);
306
+ } catch (error) {
307
+ console.error('Failed to mute call:', error);
308
+ throw error;
309
+ }
310
+ }
311
+
312
+ /**
313
+ * Unmute the call
314
+ */
315
+ async unmute(): Promise<void> {
316
+ if (!CallStateHelpers.canToggleMute(this.currentState)) {
317
+ throw new Error(`Cannot unmute call in state: ${this.currentState}`);
318
+ }
319
+
320
+ try {
321
+ this._telnyxCall.unmute();
322
+ this._isMuted.next(false);
323
+ } catch (error) {
324
+ console.error('Failed to unmute call:', error);
325
+ throw error;
326
+ }
327
+ }
328
+
329
+ /**
330
+ * Toggle mute state
331
+ */
332
+ async toggleMute(): Promise<void> {
333
+ if (this.currentIsMuted) {
334
+ await this.unmute();
335
+ } else {
336
+ await this.mute();
337
+ }
338
+ }
339
+
340
+ /**
341
+ * Set the call to connecting state (used for push notification calls when answered via CallKit)
342
+ * @internal
343
+ */
344
+ setConnecting(): void {
345
+ console.log('Call: Setting state to CONNECTING for push notification answer');
346
+ this._callState.next(TelnyxCallState.CONNECTING);
347
+ }
348
+
349
+ /**
350
+ * Clean up resources when the call is disposed
351
+ */
352
+ dispose(): void {
353
+ this._stopDurationTimer();
354
+ this._callState.complete();
355
+ this._isMuted.complete();
356
+ this._isHeld.complete();
357
+ this._duration.complete();
358
+ }
359
+
360
+ /**
361
+ * Set up listeners for the underlying Telnyx call
362
+ */
363
+ private _setupCallListeners(): void {
364
+ // Map Telnyx call states to our simplified states
365
+ this._telnyxCall.on('telnyx.call.state', (call: any, state: any) => {
366
+ const telnyxState = this._mapToTelnyxCallState(state);
367
+ this._callState.next(telnyxState);
368
+
369
+ // Start duration timer when call becomes active
370
+ if (telnyxState === TelnyxCallState.ACTIVE && !this._startTime) {
371
+ this._startDurationTimer();
372
+
373
+ // Show ongoing call notification on Android when call becomes active
374
+ // This covers both locally answered calls and calls that become active from remote side
375
+ if (Platform.OS === 'android') {
376
+ (async () => {
377
+ try {
378
+ const { VoicePnBridge } = await import('../internal/voice-pn-bridge');
379
+
380
+ // Extract caller information based on call direction
381
+ let callerNumber: string | undefined;
382
+ let callerName: string | undefined;
383
+
384
+ if (this._isIncoming) {
385
+ // For incoming calls, use the remote caller ID (who's calling us)
386
+ callerNumber = this._telnyxCall.remoteCallerIdNumber;
387
+ callerName = this._telnyxCall.remoteCallerIdName;
388
+ } else {
389
+ // For outgoing calls, use our own caller ID (what we're showing to them)
390
+ // These are the values we set when making the call
391
+ callerNumber = this._telnyxCall.localCallerIdNumber || this._originalCallerNumber;
392
+ callerName = this._telnyxCall.localCallerIdName || this._originalCallerName;
393
+ }
394
+
395
+ // Fallback logic for better notification display - avoid "Unknown" when possible
396
+ let displayName: string;
397
+ let displayNumber: string;
398
+
399
+ if (this._isIncoming) {
400
+ // For incoming calls: use caller name or fall back to caller number, then destination
401
+ displayName = callerName || callerNumber || this._destination;
402
+ displayNumber = callerNumber || this._destination;
403
+ } else {
404
+ // For outgoing calls: use our caller ID or descriptive text
405
+ displayName = callerName || `${this._destination}`;
406
+ displayNumber = callerNumber || this._destination;
407
+ }
408
+
409
+ await VoicePnBridge.showOngoingCallNotification(
410
+ displayName,
411
+ displayNumber,
412
+ this._callId
413
+ );
414
+ console.log('Call: Showed ongoing call notification on Android (call active)', {
415
+ isIncoming: this._isIncoming,
416
+ callerName: displayName,
417
+ callerNumber: displayNumber,
418
+ });
419
+ } catch (error) {
420
+ console.error('Call: Failed to show ongoing call notification on active:', error);
421
+ }
422
+ })();
423
+ }
424
+ }
425
+
426
+ // Stop duration timer when call ends
427
+ if (CallStateHelpers.isTerminated(telnyxState)) {
428
+ this._stopDurationTimer();
429
+
430
+ // Clean up ongoing call notification on Android when call ends
431
+ if (Platform.OS === 'android') {
432
+ (async () => {
433
+ try {
434
+ const { VoicePnBridge } = await import('../internal/voice-pn-bridge');
435
+ await VoicePnBridge.endCall(this._callId);
436
+ console.log('Call: Cleaned up ongoing call notification (call terminated)');
437
+ } catch (error) {
438
+ console.error(
439
+ 'Call: Failed to clean up ongoing call notification on termination:',
440
+ error
441
+ );
442
+ }
443
+ })();
444
+ }
445
+ }
446
+ });
447
+ }
448
+
449
+ /**
450
+ * Map Telnyx SDK call states to our simplified call states
451
+ */
452
+ private _mapToTelnyxCallState(telnyxState: any): TelnyxCallState {
453
+ // This mapping will depend on the actual Telnyx SDK call states
454
+ // For now, using a basic mapping - this should be updated based on actual SDK
455
+ switch (telnyxState) {
456
+ case 'ringing':
457
+ case 'new':
458
+ return TelnyxCallState.RINGING;
459
+ case 'connecting':
460
+ return TelnyxCallState.CONNECTING;
461
+ case 'active':
462
+ case 'answered':
463
+ return TelnyxCallState.ACTIVE;
464
+ case 'held':
465
+ return TelnyxCallState.HELD;
466
+ case 'ended':
467
+ case 'hangup':
468
+ return TelnyxCallState.ENDED;
469
+ case 'failed':
470
+ case 'rejected':
471
+ return TelnyxCallState.FAILED;
472
+ case 'dropped':
473
+ return TelnyxCallState.DROPPED;
474
+ default:
475
+ console.warn(`Unknown call state: ${telnyxState}`);
476
+ return TelnyxCallState.RINGING;
477
+ }
478
+ }
479
+
480
+ /**
481
+ * Start the duration timer
482
+ */
483
+ private _startDurationTimer(): void {
484
+ this._startTime = new Date();
485
+ this._durationTimer = setInterval(() => {
486
+ if (this._startTime) {
487
+ const duration = Math.floor((Date.now() - this._startTime.getTime()) / 1000);
488
+ this._duration.next(duration);
489
+ }
490
+ }, 1000);
491
+ }
492
+
493
+ /**
494
+ * Stop the duration timer
495
+ */
496
+ private _stopDurationTimer(): void {
497
+ if (this._durationTimer) {
498
+ clearInterval(this._durationTimer);
499
+ this._durationTimer = undefined;
500
+ }
501
+ }
502
+ }