Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flexydial
/
hdfc-beu-v2
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
a02abcee
authored
2019-06-27 21:25:11 +0530
by
Manish Mihsra
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added New Monitoring Report
1 parent
c5a7b341
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
186 additions
and
33 deletions
application/app/Http/Controllers/ReportController.php
application/app/Jobs/KPAMIListen.php
application/app/Models/User.php
application/resources/views/layout/module/reports/liveusers.blade.php
application/app/Http/Controllers/ReportController.php
View file @
a02abce
...
...
@@ -21,6 +21,7 @@ use App\Models\Cutoff;
use
App\Jobs\KHRMSLib
;
use
App\Models\Sipid
;
use
App\Models\Dialline
;
use
App\Models\User
;
use
App\Models\UserLog
;
use
App\Models\Kqueue
;
use
DB
;
...
...
@@ -37,64 +38,152 @@ class ReportController extends Controller
public
function
show
(
$id
)
{
$data
=
array
();
$wakka
=
new
KHRMSLib
();
$dashboarduser
=
Auth
::
user
();
$timeoffset
=
$dashboarduser
->
timezone
;
//-330; //$dashboarduser->timezone;
$timeoffset
=
$timeoffset
*
60
;
if
(
$id
==
"reports"
)
{
return
view
(
"layout.module.reports.reports"
,
array
()
);
return
view
(
"layout.module.reports.reports"
);
}
if
(
$id
==
"campaigns"
)
$logtime
=
(
isset
(
$_GET
[
'logtime'
]))
?
$_GET
[
'logtime'
]
:
9
;
$logtimeto
=
(
isset
(
$_GET
[
'logtimeto'
]))
?
$_GET
[
'logtimeto'
]
:
20
;
$logdate
=
(
isset
(
$_GET
[
'logdate'
]))
?
strtotime
(
$_GET
[
'logdate'
]
.
" "
.
$logtime
.
":00:00"
)
:
strtotime
(
date
(
"Y-m-d"
)
.
" 09:00:00"
);
$logdateto
=
(
isset
(
$_GET
[
'logdateto'
]))
?
strtotime
(
$_GET
[
'logdateto'
]
.
" "
.
$logtimeto
.
":00:00"
)
:
strtotime
(
date
(
"Y-m-d"
)
.
" 20:00:00"
);
$campaign
=
(
isset
(
$_GET
[
'campaign'
]))
?
$_GET
[
'campaign'
]
:
"Select"
;
$oclientlst
=
$wakka
->
clientsReadAccess
();
sort
(
$oclientlst
);
$oclientlst
[
0
]
=
'Select'
;
$data
[
'wakka'
]
=
$wakka
;
$data
[
'dashboarduser'
]
=
$dashboarduser
;
$data
[
'timeoffset'
]
=
$timeoffset
;
$data
[
'logtime'
]
=
$logtime
;
$data
[
'logtimeto'
]
=
$logtimeto
;
$data
[
'logdate'
]
=
$logdate
;
$data
[
'logdateto'
]
=
$logdateto
;
$data
[
'campaign'
]
=
$campaign
;
$data
[
'oclientlst'
]
=
$oclientlst
;
if
(
$id
==
"liveusers"
)
{
return
view
(
"layout.module.reports.campaigns"
,
array
());
$campStr
=
""
;
$ratio
=
0
;
$totalCall
=
0
;
$dialedCall
=
0
;
$waitCall
=
0
;
$inCall
=
0
;
$availChnl
=
0
;
$usrIdArr
=
array
();
$tabHeadStr
=
""
;
$tabBodyStr
=
""
;
foreach
(
$oclientlst
as
$c
)
{
$s
=
""
;
if
(
$c
==
$campaign
)
$s
=
'selected'
;
$campStr
.=
"<option value='
$c
'
$s
>
$c
</option>"
;
}
if
(
$id
==
"calllog"
)
{
return
view
(
"layout.module.reports.calllog"
,
array
());
if
(
$campaign
!=
"Select"
)
{
$mastersdata
=
$wakka
->
getCompanyMaster
(
$campaign
);
if
(
!
empty
(
$mastersdata
[
"autodialercampaign"
]))
$ratio
=
$mastersdata
[
"autodialercampaign"
];
$userArr
=
User
::
where
(
'presence'
,
'='
,
"1"
)
->
where
(
'sel_campaign'
,
'='
,
$campaign
)
->
select
(
'id'
,
'username'
,
'fullname'
,
'current_dialmode'
)
->
get
();
$diallineArr
=
Dialline
::
where
(
"enabled"
,
"="
,
"1"
)
->
get
();
$totalChnl
=
$diallineArr
->
count
();
foreach
(
$diallineArr
as
$dialline
)
{
if
(
$dialline
->
status
!=
'Free'
)
$totalCall
++
;
if
(
$dialline
->
status
!=
'Free'
&&
$dialline
->
src_channel
!=
''
&&
$dialline
->
channel
==
''
)
$dialedCall
++
;
if
(
$dialline
->
status
==
'Auto'
&&
$dialline
->
conf
==
''
&&
$dialline
->
src_channel
!=
''
&&
$dialline
->
channel
!=
''
)
$waitCall
++
;
if
(
$dialline
->
status
!=
'Free'
&&
$dialline
->
conf
!=
''
)
$inCall
++
;
}
if
(
$id
==
"agentreport"
)
{
return
view
(
"layout.module.reports.agentreport"
,
array
());
$availChnl
=
$totalChnl
-
$totalCall
;
$tabHeadStr
.=
"<tr>
<th>User</th>
<th>Campaign</th>
<th>Mode</th>
<th>Status</th>
</tr>"
;
foreach
(
$userArr
as
$usr
)
{
$usrIdArr
[]
=
$usr
->
id
;
$statusStr
=
"<span class='btn btn-sm btn-warning'>Free</span>"
;
$sipIdArr
=
Sipid
::
where
(
'user'
,
"="
,
$usr
->
id
)
->
where
(
'status'
,
'='
,
1
)
->
select
(
'id'
,
'status'
,
'ready'
,
'patched'
)
->
first
();
if
(
$sipIdArr
->
ready
==
1
)
$statusStr
=
"<span class='btn btn-sm btn-success'>Available</span>"
;
if
(
$sipIdArr
->
patched
==
1
)
$statusStr
=
"<span class='btn btn-sm btn-info'>OnCall</span>"
;
if
(
$sipIdArr
->
prepare_call
==
1
&&
$sipIdArr
->
patched
==
0
)
$statusStr
=
"<span class='btn btn-sm btn-info'>Wrap-Up</span>"
;
$tabBodyStr
.=
"<tr><td>"
.
$usr
->
fullname
.
"</td>"
;
$tabBodyStr
.=
"<td>"
.
$campaign
.
"</td>"
;
$tabBodyStr
.=
"<td>"
.
$usr
->
current_dialmode
.
"</td>"
;
$tabBodyStr
.=
"<td>"
.
$statusStr
.
"</td></tr>"
;
}
if
(
$id
==
"campreport"
)
{
return
view
(
"layout.module.reports.campreport"
,
array
());
$freeUsr
=
Sipid
::
whereIn
(
'user'
,
$usrIdArr
)
->
where
(
'status'
,
'='
,
1
)
->
where
(
'ready'
,
'='
,
1
)
->
where
(
'patched'
,
'='
,
0
)
->
count
();
$data
[
'ratio'
]
=
$ratio
;
$data
[
'totalUsr'
]
=
$userArr
->
count
();
$data
[
'totalChnl'
]
=
$totalChnl
;
$data
[
'availChnl'
]
=
$availChnl
;
$data
[
'dialedCall'
]
=
$dialedCall
;
$data
[
'waitCall'
]
=
$waitCall
;
$data
[
'inCall'
]
=
$inCall
;
$data
[
'freeUsr'
]
=
$totalChnl
;
$data
[
'tabHeadStr'
]
=
$tabHeadStr
;
$data
[
'tabBodyStr'
]
=
$tabBodyStr
;
}
if
(
$id
==
"statusreport"
)
{
return
view
(
"layout.module.reports.
statusreport"
,
array
()
);
$data
[
'campStr'
]
=
$campStr
;
return
view
(
"layout.module.reports.
liveusers"
,
$data
);
}
if
(
$id
==
"
questionnaire
"
)
if
(
$id
==
"
calllog
"
)
{
return
view
(
"layout.module.reports.
questairereport
"
,
array
());
return
view
(
"layout.module.reports.
calllog
"
,
array
());
}
if
(
$id
==
"
callmanagement
"
)
if
(
$id
==
"
agenttime
"
)
{
return
view
(
"layout.module.reports.callmanagementreport
"
,
array
());
return
view
(
"layout.module.reports.agenttime
"
,
array
());
}
if
(
$id
==
"
supmessages
"
)
if
(
$id
==
"
agenttimeAverage
"
)
{
return
view
(
"layout.module.reports.supmessagesreport
"
,
array
());
return
view
(
"layout.module.reports.agenttimeAverage
"
,
array
());
}
if
(
$id
==
"liveusers
"
)
if
(
$id
==
"campreport
"
)
{
return
view
(
"layout.module.reports.
liveusers
"
,
array
());
return
view
(
"layout.module.reports.
campreport
"
,
array
());
}
if
(
$id
==
"
recarchive
"
)
if
(
$id
==
"
statusreport
"
)
{
return
view
(
"layout.module.reports.
recarchive
"
,
array
());
return
view
(
"layout.module.reports.
statusreport
"
,
array
());
}
if
(
$id
==
"re
cqc
"
)
if
(
$id
==
"re
lationshipreport
"
)
{
return
view
(
"layout.module.reports.re
cqc
"
,
array
());
return
view
(
"layout.module.reports.re
lationshipreport
"
,
array
());
}
}
}
...
...
application/app/Jobs/KPAMIListen.php
View file @
a02abce
...
...
@@ -478,6 +478,12 @@ class KPAMIListen implements IEventListener
$tsip
=
Sipid
::
find
(
$crmcall
->
sipid_id
);
if
(
!
empty
(
$tsip
))
{
$tsip
->
patched
=
0
;
$tsip
->
save
();
}
//$newqueue=new Kqueue();
//$newqueue->playhangupfile($dialline->channel,$dialline->server);
...
...
@@ -733,6 +739,7 @@ class KPAMIListen implements IEventListener
$dialline
=
Dialline
::
find
(
$crmcall
->
dialline_id
);
if
(
$dialline
)
{
$dialline
->
src_channel
=
$dchannel
;
$dialline
->
channel
=
$dchannel
;
$dialline
->
save
();
}
...
...
@@ -745,6 +752,29 @@ class KPAMIListen implements IEventListener
$crmcall
->
save
();
}
}
else
if
(
$accountcodearr
[
1
]
==
"a"
)
{
$crmcall
=
CRMCall
::
find
(
$accountcodearr
[
2
]);
if
(
$crmcall
)
{
$nowts
=
microtime
(
true
)
*
1000
;
$crmcall
->
setTs
(
'ts_Call'
,
$nowts
);
$crmcall
->
state
=
$eventname
;
$dialline
=
Dialline
::
find
(
$crmcall
->
dialline_id
);
if
(
$dialline
)
{
$dialline
->
src_channel
=
$dchannel
;
$dialline
->
save
();
}
$crmcall
->
addEventLog
(
$nowts
,
"
$accountcode
:Unknown :
$eventname
$dchannelstate
:
$dchannelstatedesc
$duniqueid
$dexten
:
$dpriority
$channel
$dialstring
"
);
$crmcall
->
save
();
}
}
}
...
...
@@ -806,17 +836,21 @@ class KPAMIListen implements IEventListener
$crmcall
->
state
=
$eventname
;
$crmcall
->
status
=
$dialstatus
;
$tsip
=
Sipid
::
find
(
$crmcall
->
sipid_id
);
$tsip
->
patched
=
1
;
$tsip
->
save
();
$dialline
=
Dialline
::
find
(
$crmcall
->
dialline_id
);
if
(
$dialline
)
{
$dialline
->
conf
=
"1000"
.
$tsip
->
id
;
$dialline
->
channel
=
$channel
;
$dialline
->
save
();
}
$recfile
=
$crmcall
->
newRecFilePath
();
$tsip
=
Sipid
::
find
(
$crmcall
->
sipid_id
);
//start recording
$newqueue
=
new
Kqueue
();
$newqueue
->
recordChannel
(
$tsip
->
server
,
$dchannel
,
$recfile
);
...
...
@@ -957,6 +991,7 @@ class KPAMIListen implements IEventListener
$dialline
=
Dialline
::
find
(
$crmcall
->
dialline_id
);
if
(
$dialline
)
{
$dialline
->
src_channel
=
$dchannel
;
$dialline
->
channel
=
$dchannel
;
$dialline
->
save
();
}
...
...
@@ -969,6 +1004,29 @@ class KPAMIListen implements IEventListener
$crmcall
->
save
();
}
}
else
if
(
$accountcodearr
[
1
]
==
"a"
)
{
$crmcall
=
CRMCall
::
find
(
$accountcodearr
[
2
]);
if
(
$crmcall
)
{
$nowts
=
microtime
(
true
)
*
1000
;
$crmcall
->
setTs
(
'ts_Call'
,
$nowts
);
$crmcall
->
state
=
$eventname
;
$dialline
=
Dialline
::
find
(
$crmcall
->
dialline_id
);
if
(
$dialline
)
{
$dialline
->
src_channel
=
$dchannel
;
$dialline
->
save
();
}
$crmcall
->
addEventLog
(
$nowts
,
"
$accountcode
:Unknown :
$eventname
$dchannelstate
:
$dchannelstatedesc
$duniqueid
$dexten
:
$dpriority
$channel
$dialstring
"
);
$crmcall
->
save
();
}
}
}
...
...
@@ -1034,17 +1092,21 @@ class KPAMIListen implements IEventListener
$crmcall
->
state
=
$eventname
;
$crmcall
->
status
=
$dialstatus
;
$tsip
=
Sipid
::
find
(
$crmcall
->
sipid_id
);
$tsip
->
patched
=
1
;
$tsip
->
save
();
$dialline
=
Dialline
::
find
(
$crmcall
->
dialline_id
);
if
(
$dialline
)
{
$dialline
->
conf
=
"1000"
.
$tsip
->
id
;
$dialline
->
channel
=
$channel
;
$dialline
->
save
();
}
$recfile
=
$crmcall
->
newRecFilePath
();
$tsip
=
Sipid
::
find
(
$crmcall
->
sipid_id
);
//start recording
$newqueue
=
new
Kqueue
();
$newqueue
->
recordChannel
(
$tsip
->
server
,
$dchannel
,
$recfile
);
...
...
@@ -1534,8 +1596,10 @@ class KPAMIListen implements IEventListener
$crmcall
->
save
();
$dialline
->
conf
=
"1000"
.
$found
->
id
;
$dialline
->
user_id
=
$found
->
user
;
$dialline
->
conf
=
"1000"
.
$found
->
id
;
$dialline
->
save
();
if
(
$crmcall
->
crm_id
>
0
){
DB
::
table
(
'records'
)
->
where
(
'id'
,
$crmcall
->
crm_id
)
->
update
([
'filter_condition'
=>
'3'
,
'usr_id'
=>
$found
->
user
]);
...
...
application/app/Models/User.php
View file @
a02abce
...
...
@@ -14,7 +14,7 @@ class User extends Authenticatable
protected
$table
=
'users'
;
protected
$hidden
=
array
(
'password'
);
protected
$fillable
=
array
(
'username'
,
'password'
,
'email'
,
'status'
,
'organization'
,
'group'
,
'data'
);
protected
$fillable
=
array
(
'username'
,
'password'
,
'email'
,
'status'
,
'organization'
,
'group'
,
'data'
,
'sel_campaign'
,
'current_dialmode'
);
private
$dataarr
=
array
();
...
...
application/resources/views/layout/module/reports/liveusers.blade.php
View file @
a02abce
This diff is collapsed.
Click to expand it.
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