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
9913f5dd
authored
2019-07-29 07:30:54 +0000
by
Manish Mihsra
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Removed loop while picking up sipids
1 parent
08d92f35
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
45 deletions
application/app/Jobs/KPAMIListen.php
application/app/Jobs/KPAMIListen.php
View file @
9913f5d
...
...
@@ -523,7 +523,7 @@ class KPAMIListen implements IEventListener
$affectedRows
=
Dialline
::
where
(
'id'
,
$accountcodearr
[
3
])
->
where
(
function
(
$query
)
use
(
$channel
)
{
$query
->
where
(
'channel'
,
'='
,
$channel
)
->
orWhere
(
'status'
,
'='
,
'AutoCall'
);
->
orWhere
In
(
'status'
,
[
'AutoCall'
,
'InHangUp'
]
);
})
->
update
([
'call_id'
=>
0
,
...
...
@@ -662,33 +662,33 @@ class KPAMIListen implements IEventListener
foreach
(
$userslist
as
$ulist
)
{
$crmcall
->
user_id
=
$ulist
->
id
;
}
if
(
$crmcall
->
client
==
"."
)
{
$wakka
=
new
KHRMSLib
();
$users
=
$wakka
->
searchPhone
(
"mobile"
,
$crmcall
->
number
);
if
(
!
empty
(
$users
))
{
$ppldata
=
unserialize
(
$users
[
0
][
'peopledata'
]);
$crmcall
->
crm_id
=
$users
[
0
][
'id'
];
$crmcall
->
number
=
$users
[
0
][
'mobile'
];
$crmcall
->
client
=
(
$ppldata
[
'client'
]
?
$ppldata
[
'client'
]
:
""
);
$crmcall
->
department
=
(
$ppldata
[
'department'
]
?
$ppldata
[
'department'
]
:
""
);
$wakka
->
setPersonKey
(
$crmcall
->
crm_id
,
"dialer_lastcall"
,
date
(
"Y-m-d H:i:s"
));
echo
$users
[
0
][
'id'
]
.
" -- ID Found
\n
"
;
}
else
{
$crmcall
->
crm_id
=
0
;
$crmcall
->
client
=
""
;
$crmcall
->
department
=
""
;
echo
"User Not Found!!
\n
"
;
}
$crmcall
->
save
();
}
//
if($crmcall->client==".")
//
{
//
$wakka = new KHRMSLib();
//
$users=$wakka->searchPhone("mobile",$crmcall->number);
//
if(!empty($users))
//
{
//
$ppldata=unserialize($users[0]['peopledata']);
//
$crmcall->crm_id=$users[0]['id'];
//
$crmcall->number=$users[0]['mobile'];
//
$crmcall->client=($ppldata['client']?$ppldata['client']:"");
//
$crmcall->department=($ppldata['department']?$ppldata['department']:"");
//
$wakka->setPersonKey($crmcall->crm_id,"dialer_lastcall",date("Y-m-d H:i:s"));
//
echo $users[0]['id']." -- ID Found\n";
//
}
//
else
//
{
//
$crmcall->crm_id=0;
//
$crmcall->client="";
//
$crmcall->department="";
//
echo "User Not Found!!\n";
//
}
//
$crmcall->save();
//
}
$crmcall
->
userstatus
=
"InboundDROP"
;
$crmcall
->
usersubstatus
=
"InboundDROP"
;
$crmcall
->
call_flag
=
"Z"
;
...
...
@@ -1472,14 +1472,14 @@ class KPAMIListen implements IEventListener
{
foreach
(
$diallines
as
$dialline
)
{
$crmcall
=
CRMCall
::
where
(
"uniqueid"
,
"like"
,
"%"
.
$dialline
->
uniqueid
.
"%"
)
->
first
(
);
$crmcall
=
CRMCall
::
find
(
$dialline
->
call_id
);
if
(
$crmcall
)
{
$crmcalldata
=
json_decode
(
$crmcall
->
data
,
true
);
if
(
!
isset
(
$crmcalldata
[
"userbusyfile"
]))
$crmcalldata
[
"userbusyfile"
]
=
0
;
if
(
$dialline
->
status
==
$status
[
1
])
$this
->
checkMobileNumberExist
(
$crmcall
);
//
if($dialline->status == $status[1])$this->checkMobileNumberExist($crmcall);
$sipids
=
array
();
...
...
@@ -1487,36 +1487,33 @@ class KPAMIListen implements IEventListener
{
$mode
=
"Predictive"
;
$sipid
s
=
Sipid
::
where
(
'server'
,
'='
,
$this
->
sipip
)
$sipid
=
Sipid
::
where
(
'server'
,
'='
,
$this
->
sipip
)
->
where
(
"status"
,
"="
,
"1"
)
->
where
(
"ready"
,
"="
,
"1"
)
->
where
(
"prepare_call"
,
"="
,
"1"
)
->
orderBy
(
"updated_at"
,
"desc"
)
->
ge
t
();
->
firs
t
();
}
else
if
(
$dialline
->
status
==
$status
[
1
])
{
$mode
=
"Incoming"
;
$sipid
s
=
Sipid
::
where
(
'server'
,
'='
,
$this
->
sipip
)
$sipid
=
Sipid
::
where
(
'server'
,
'='
,
$this
->
sipip
)
->
where
(
"status"
,
"="
,
"1"
)
->
where
(
"ready"
,
"="
,
"1"
)
->
where
(
"prepare_call"
,
"="
,
"1"
)
->
orderBy
(
"updated_at"
,
"desc"
)
->
ge
t
();
->
firs
t
();
}
if
(
!
empty
(
$sipid
s
))
if
(
!
empty
(
$sipid
))
{
echo
"sipids found "
;
foreach
(
$sipids
as
$sipid
)
{
$userEntry
=
User
::
find
(
$sipid
->
user
);
if
(
!
empty
(
$userEntry
)){
if
(
$userEntry
->
current_dialmode
!=
$mode
||
$sipid
->
ready
!=
1
)
return
;
if
(
$userEntry
->
current_dialmode
!=
$mode
||
$sipid
->
ready
!=
1
)
continue
;
}
$this
->
connectToAvailableSip
(
$sipid
,
$dialline
,
$crmcall
,
$mode
);
...
...
@@ -1525,7 +1522,6 @@ class KPAMIListen implements IEventListener
}
}
}
}
private
function
checkMobileNumberExist
(
$crmcall
)
{
...
...
@@ -1542,7 +1538,7 @@ class KPAMIListen implements IEventListener
$crmcall
->
client
=
(
$ppldata
[
'client'
]
?
$ppldata
[
'client'
]
:
""
);
$crmcall
->
department
=
(
$ppldata
[
'department'
]
?
$ppldata
[
'department'
]
:
""
);
$crmcall
->
call_flag
=
"C"
;
$wakka
->
setPersonKey
(
$crmcall
->
crm_id
,
"dialer_lastcall"
,
date
(
"Y-m-d H:i:s"
)
);
$wakka
->
setPersonKey
(
$crmcall
->
crm_id
,
"dialer_lastcall"
,
date
(
"Y-m-d H:i:s"
),
""
,
$ppldata
[
'client'
]
);
echo
$users
[
0
][
'id'
]
.
" -- ID Found
\n
"
;
}
else
...
...
@@ -1579,11 +1575,13 @@ class KPAMIListen implements IEventListener
exec
(
"/usr/sbin/asterisk -rx 'core show channel
$dialline->channel
'"
,
$channelArr
);
if
(
count
(
$channelArr
)
==
1
)
if
(
count
(
$channelArr
)
<=
2
)
{
Log
::
useFiles
(
storage_path
()
.
"/logs/Predictive/predictive_"
.
date
(
"Y_m_d"
)
.
".log"
);
Log
::
info
(
$crmcall
->
id
);
Log
::
info
(
$dialline
);
$dialline
->
call_id
=
"0"
;
$dialline
->
user_id
=
"0"
;
$dialline
->
status
=
"Free"
;
$dialline
->
conf
=
""
;
$dialline
->
number
=
""
;
...
...
@@ -1593,7 +1591,7 @@ class KPAMIListen implements IEventListener
$dialline
->
regexstr
=
""
;
$dialline
->
save
();
continue
;
return
;
}
$recfile
=
$crmcall
->
newRecFilePath
();
...
...
@@ -1638,12 +1636,13 @@ class KPAMIListen implements IEventListener
$crmcall
->
setTs
(
'ts_Recstart'
,
$nowts
);
$crmcall
->
save
();
$newqueue
=
new
Kqueue
();
$newqueue
->
sipNotify
(
$sipid
,
"incomingCall"
,
$crmcall
->
id
,
$crmcall
->
crm_id
,
$crmcall
->
number
.
"@"
.
$dialline
->
channel
);
if
(
$crmcall
->
crm_id
>
0
){
DB
::
table
(
'records'
)
->
where
(
'id'
,
$crmcall
->
crm_id
)
->
update
([
'filter_condition'
=>
'3'
,
'usr_id'
=>
$sipid
->
user
]);
}
$newqueue
=
new
Kqueue
();
$newqueue
->
sipNotify
(
$sipid
,
"incomingCall"
,
$crmcall
->
id
,
$crmcall
->
crm_id
,
$crmcall
->
number
.
"@"
.
$dialline
->
channel
);
}
}
...
...
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