我从Asterisk CLI这样的字符串。
从星号获得信息的代码
字符串没有结果,等
格式化字符串搜索等
如何可以解析接收到的字符串得到一个关联数组这样吗?
字符串作为无格式文本:
Event: FullyBooted Privilege: system,all Status: Fully Booted Response: Follows Privilege: Command Channel Context Extension Prio State Application Data CallerID Duration Accountcode PeerAccount BridgedTo SIP/4955855400-00008 incoming 84955437636 9 Up Queue digitik,tT 89162871970 10756:44 SIP/853-000088a2 SIP/861-00038869 incoming-office 9384957830082 2 Up Dial SIP/4955437636/8495783008 861 6320:32: SIP/4955437636-00038 SIP/853-000088a2 incoming-office 84955437636 1 Up AppQueue (Outgoing Line) 10756:43 SIP/4955855400-00008 SIP/4955855400-0008f incoming 84955437636 3 Up Playback /var/lib/asterisk/sounds/ 89268855862 00:00:02 (None) SIP/4955437636-00038 incoming-new 1 Up AppDial (Outgoing Line) 9384957830082 6320:32: SIP/861-00038869 5 active channels 3 active calls 185346 calls processed
为了解析有命令的简单变种
core show channels concise
它做的CSV状,除了逗号用它“!”标志