Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flexydial
/
hdfc
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
96065cd6
authored
2017-11-09 12:30:47 +0530
by
Yashwant
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Channel Log cron file
1 parent
4a9f4561
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
ChannelLog.php
ChannelLog.php
0 → 100644
View file @
96065cd
#!/usr/bin/php
<?php
exec
(
"/usr/sbin/asterisk -rx 'sip show channels'"
,
$runCalls
);
$asteriskChannels
=
print_r
(
$runCalls
,
true
);
$channels
=
0
;
$peer
=
""
;
foreach
(
$runCalls
as
$runCall
){
$runCallArr
=
explode
(
" "
,
$runCall
);
$numRunCallArr
=
end
(
$runCallArr
);
if
(
is_Numeric
(
$numRunCallArr
)){
$channels
++
;
}
$peer
.=
"'"
.
$numRunCallArr
.
"',"
;
}
$channels
=
$channels
;
$db
=
new
mysqli
(
"localhost"
,
"root"
,
"yb9738z"
,
"fullerton"
);
$activeUsers
=
$db
->
query
(
"select * from sipids where status=1"
);
$db
->
close
();
$users
=
0
;
$sip
=
""
;
$usersOutput
=
[];
while
(
$row
=
$activeUsers
->
fetch_assoc
()){
$users
++
;
$sip
.=
$row
[
"id"
]
.
","
;
$usersOutput
[]
=
$row
;
}
$applicationUsers
=
print_r
(
$usersOutput
,
true
);
$input
=
date
(
'y-m-d h:m:s'
)
.
" Total Asterisk Channels - "
.
$channels
.
" , Total Application Users - "
.
$users
.
"
\n\n
"
;
$input
.=
$peer
.
"
\n\n
"
;
$input
.=
$sip
.
"
\n\n
"
;
$input
.=
$asteriskChannels
.
"
\n
"
;
$input
.=
$applicationUsers
.
"
\n
"
;
$logFile
=
fopen
(
"/home/192.168.3.252/ChannelLog.txt"
,
"a+"
);
fwrite
(
$logFile
,
$input
);
fclose
(
$logFile
);
?>
\ No newline at end of file
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment