ごちゃごちゃ多いので、DTMFの番号だけ選んで表示させます。
phpで関数使います。久しぶり。。。。
これがデータ・・・・・・・
[Jun 18 19:43:17] DTMF[28817][C-0000000f] channel.c: DTMF end ‘5’ received on SIP/5001-00000009, duration 250 ms
[Jun 18 19:43:17] DTMF[28817][C-0000000f] channel.c: DTMF begin emulation of ‘5’ with duration 250 queued on SIP/5001-00000009
[Jun 18 19:43:17] DTMF[28817][C-0000000f] channel.c: DTMF begin ‘5’ received on SIP/5001-00000009
[Jun 18 19:43:17] DTMF[28817][C-0000000f] channel.c: DTMF begin ignored ‘5’ on SIP/5001-00000009
[Jun 18 19:43:17] DTMF[28817][C-0000000f] channel.c: DTMF end ‘5’ received on SIP/5001-00000009, duration 100 ms
[Jun 18 19:43:18] DTMF[28817][C-0000000f] channel.c: DTMF end emulation of ‘5’ queued on SIP/5001-00000009
[Jun 18 19:43:18] DTMF[28817][C-0000000f] channel.c: DTMF end ‘5’ received on SIP/5001-00000009, duration 100 ms
[Jun 18 19:43:18] DTMF[28817][C-0000000f] channel.c: DTMF begin emulation of ‘5’ with duration 100 queued on SIP/5001-00000009
[Jun 18 19:43:18] DTMF[28817][C-0000000f] channel.c: DTMF end emulation of ‘5’ queued on SIP/5001-00000009
[Jun 18 19:43:17] DTMF[28817][C-0000000f] channel.c: DTMF begin emulation of ‘5’ with duration 250 queued on SIP/5001-00000009
[Jun 18 19:43:17] DTMF[28817][C-0000000f] channel.c: DTMF begin ‘5’ received on SIP/5001-00000009
[Jun 18 19:43:17] DTMF[28817][C-0000000f] channel.c: DTMF begin ignored ‘5’ on SIP/5001-00000009
[Jun 18 19:43:17] DTMF[28817][C-0000000f] channel.c: DTMF end ‘5’ received on SIP/5001-00000009, duration 100 ms
[Jun 18 19:43:18] DTMF[28817][C-0000000f] channel.c: DTMF end emulation of ‘5’ queued on SIP/5001-00000009
[Jun 18 19:43:18] DTMF[28817][C-0000000f] channel.c: DTMF end ‘5’ received on SIP/5001-00000009, duration 100 ms
[Jun 18 19:43:18] DTMF[28817][C-0000000f] channel.c: DTMF begin emulation of ‘5’ with duration 100 queued on SIP/5001-00000009
[Jun 18 19:43:18] DTMF[28817][C-0000000f] channel.c: DTMF end emulation of ‘5’ queued on SIP/5001-00000009
今は、まま表示。下記で。
<?php
$contents = @file(‘/var/log/asterisk/dtmf’);
foreach($contents as $line){
echo $line.”<br />”;
}
?>
$contents = @file(‘/var/log/asterisk/dtmf’);
foreach($contents as $line){
echo $line.”<br />”;
}
?>
これを・・・・・
これを更に、文字列を指定した区切り文字で分割して配列で返す explode()。
http://www.phpbook.jp/func/file/index3.html
を参照
これを更に、文字列を指定した区切り文字で分割して配列で返す explode()。
http://www.phpbook.jp/func/file/index3.html
を参照
データは、
⓪[Jun
①18
②19:43:17]
③DTMF[28817][C-0000000f]
④channel.c:
⑤DTMF
⑥end
⑦‘5’ <———————これを取りたい!!
⑧received
⑨on
⑩SIP/5001-00000009,
⑪duration
⑫250
⑬ms
①18
②19:43:17]
③DTMF[28817][C-0000000f]
④channel.c:
⑤DTMF
⑥end
⑦‘5’ <———————これを取りたい!!
⑧received
⑨on
⑩SIP/5001-00000009,
⑪duration
⑫250
⑬ms
・・・・・で、こうなりました!!!
************************************
ディレクトリ
/var/www/html/asterisk_log
ファイル名
dtmf_log3.php <—一応関連の情報も一緒に
dtmf_log4.php <—正味番号だけ
************************************
<?php
$contents = @file(‘/var/log/asterisk/dtmf’);
ディレクトリ
/var/www/html/asterisk_log
ファイル名
dtmf_log3.php <—一応関連の情報も一緒に
dtmf_log4.php <—正味番号だけ
************************************
<?php
$contents = @file(‘/var/log/asterisk/dtmf’);
$cnt = 0;
foreach($contents as $line){
// スペース区切りで配列に格納、項目単位でとる
$array = explode(‘ ‘, $line);
$array = explode(‘ ‘, $line);
if($array[5]==”DTMF”){
if(($cnt%9)==0){
echo $array[0].”-“.$array[1].”-“.$array[2].”-“.$array[3].”——->”;
echo $array[7].”<br />”;
print “————-<br />”;
}
print “————-<br />”;
}
$cnt++;
}
}
?>
************************************
}
?>
************************************
以上