dahdi_tools 分析 (六)fxstest
usage
Usage: fxstest <dahdi device> <cmd>
where cmd is one of:
stats - reports voltages
regdump - dumps ProSLIC registers
tones - plays a series of tones
polarity - tests polarity reversal
ring - rings phone
vmwi - toggles VMWI LED lamp
hvdc - toggles VMWI HV lamp
neon - toggles VMWI NEON lamp
dtmf <sequence> [<duration>]- Send a sequence of dtmf tones ("-" denotes no tone)
dtmfcid - create a dtmf cid spill without polarity reversal
实测
-
fxstest 1 stats 查看线路电压
root@localhost:/# ./fxstest 1 stats TIP: 49.0000 Volts RING: 0.0000 Volts VBAT: 49.0000 Volts
-
fxstest 1 regdump
# ./fxstest 1 regdump Direct registers: 0. 60 1. d5 2. 35 3. c0 4. b8 5. ea 6. f9 7. c6 8. 02 9. 00 10. 00 11. 00 12. 50 13. f2 14. ee 15. c6 16. 38 17. ec 18. 41 19. c7 20. 81 21. 00 22. 00 23. 00 24. b8 25. ea 26. f9 27. c6 28. 00 29. 00 30. 00 31. 00 32. 80 33. b9 34. 35 35. c0 36. 5d 37. 41 38. 87 39. 9a 40. ff 41. fe 42. fe 43. fe 44. a4 45. 87 46. 07 47. bf 48. 2c 49. 63 50. c9 51. c0 52. 00 53. f4 54. 97 55. c6 56. f8 57. ef 58. f9 59. c6 60. 00 61. 70 62. 44 63. 07 64. b0 65. d9 66. 33 67. c0 68. 30 69. 0c 70. b0 71. c6 72. 00 73. 04 74. 00 75. 00 76. 02 77. 00 78. 00 79. 00 80. 00 81. 08 82. 00 83. 00 84. 00 85. 00 86. 00 87. 00 88. 00 89. c8 90. 92 91. c6 92. 36 93. 00 94. 00 95. 00 96. a0 97. 93 98. 06 99. bf 100. 00 101. e0 102. 4b 103. c6 104. d0 105. 8c 106. 06 107. bf 108. 30 Indirect registers: 0. c6b0 1. 0000 2. 0000 3. 0000 4. c648 5. 808c 6. bf16 7. 0000 8. 0000 9. ac10 10. bf06 11. 0000 12. 0000 13. e49c 14. c035 15. 0000 16. 0000 17. 0000 18. 0000 19. 0000 20. 0000 21. 00fe 22. 0000 23. 0000 24. c648 25. fafc 26. beda 27. da26 28. 4004 29. 0000 30. 0000 31. 0000 32. c656 33. 0036 34. 0000 35. 0000 36. 0000 37. 17f4 38. bf07 39. 0000 40. 0000 41. aa54 42. c050 43. 9000 44. c799 45. 0002 46. 0000 47. eff8 48. c6f9 49. f250 50. c6ee 51. da3d 52. 8140 53. 0c30 54. c6b0 55. fb7c 56. beda 57. 0000 58. c648 59. 0000 60. c648 61. 0000 62. c656 63. 0036 64. 0000 65. f100 66. bf06 67. f000 68. ffff 69. 1204 70. c020 71. 0000 72. c656 73. 0142 74. 0000 75. 0000 76. 0000 77. 0ed8 78. c036 79. f250 80. c6ee 81. e990 82. c741 83. 0f34 84. 102b 85. 0007 86. 0000 87. 901b 88. c799 89. 0ff0 90. 0000 91. 0000 92. 0000 93. 2bb0 94. c757 95. eff8 96. c6f9 97. 0101 98. 0000 99. 0002 100. 0000 101. 02f2 102. 0000 103. 0000 104. 0000
显示所有寄存器的值
-
fxs 1 tones
plays a series of tones
播放一组信号音----拨号音,忙音等。
-
fxs 1 ring
-
fxs 1 dtmfcid
./fxstest 8 dtmfcid Going to send a set of DTMF tones >A5551212C<[156775.876836] ioctl: Start OnHookTrans, card 7 Phone is ringing Ringing Done
发送振铃和DTMF 格式的CID
分析
主要分析 dtmfcid ,代码如下
-
发送的CID 为5551212, 须先用 A C 包裹起来,即 A5551212C ,参考 https://what-when-how.com/voip/dtmf-based-caller-id-voip/
-
将字符转成 DTMF 音频发送出去
-
以 50ms , 50ms 的间隔频率发送
-
发完 DTMF CID 后再开始振铃
Tips:
CID 主要有两种格式发送,FSK 和 DTMF 。
在asterisk 中 ,发送的始终是 FSK 格式 CID , 但可以接收不同格式的CID。
一般 FSK 格式 CID 是在第一声振铃后发送的。从 fxstest 代码来看,DTMF 格式CID 是在第一声振铃之气前发送。
小结
fxstest 可以快速验证 fxs 驱动的基本功能,而不用开启 asterisk 。是dahdi 驱动开发中的实用工具。