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
5ee2c380
authored
2019-08-21 23:02:06 +0530
by
Manish Mihsra
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added new code for Incoming pop alert and registering campaign when inbound call comes up
1 parent
c286f211
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
19 deletions
application/app/Jobs/KPAMIListen.php
application/app/Jobs/KPAMIListen.php
View file @
5ee2c38
...
...
@@ -277,7 +277,6 @@ class KPAMIListen implements IEventListener
$dialline
=
Dialline
::
where
(
'server'
,
'='
,
$this
->
sipip
)
->
where
(
"dialstr"
,
"="
,
env
(
"sip_dialstr"
))
->
where
(
"status"
,
"="
,
"Free"
)
->
first
();
if
(
$dialline
)
{
$nowts
=
microtime
(
true
)
*
1000
;
//start the call log
...
...
@@ -288,9 +287,7 @@ class KPAMIListen implements IEventListener
$crmcall
->
did
=
$exten
;
$crmcall
->
crm_id
=
0
;
$crmcall
->
client
=
"."
;
$crmcall
->
department
=
""
;
$this
->
checkMobileNumberExist
(
$crmcall
);
$crmcall
->
state
=
'Inbound'
;
$crmcall
->
type
=
"Inbound"
;
...
...
@@ -299,6 +296,7 @@ class KPAMIListen implements IEventListener
$crmcall
->
dialline_id
=
$dialline
->
id
;
$crmcall
->
setTs
(
'ts_Wait'
,
$nowts
);
$crmcall
->
setTs
(
'ts_cTalk'
,
$nowts
);
$crmcall
->
group
=
$dialline
->
group
;
...
...
@@ -313,7 +311,9 @@ class KPAMIListen implements IEventListener
$dialline
->
status
=
'Inbound'
;
$dialline
->
uniqueid
=
$uniqueid
;
$dialline
->
number
=
$phonenumber
;
$dialline
->
src_channel
=
$channel
;
$dialline
->
channel
=
$channel
;
$dialline
->
regexstr
=
$crmcall
->
client
;
$dialline
->
save
();
/*$userStatus=User::where("updated_at",">",date("Y-m-d"))->where("exten","like","%".substr($exten,-4)."%")->where("usertype","!=","Admin")->where('presence', '=', '1')->select('*')->get();
...
...
@@ -687,11 +687,15 @@ class KPAMIListen implements IEventListener
$dialline
=
Dialline
::
find
(
$crmcall
->
dialline_id
);
if
(
$dialline
)
{
$dialline
->
call_id
=
0
;
$dialline
->
user_id
=
0
;
$dialline
->
status
=
"Free"
;
$dialline
->
conf
=
""
;
$dialline
->
number
=
""
;
$dialline
->
uniqueid
=
""
;
$dialline
->
src_channel
=
""
;
$dialline
->
channel
=
""
;
$dialline
->
did
=
""
;
$dialline
->
save
();
}
...
...
@@ -1176,7 +1180,6 @@ class KPAMIListen implements IEventListener
$crmcall
->
addEventLog
(
$nowts
,
"
$accountcode
:
$accountcodearr[1]
:
$eventname
$dchannelstate
:
$dchannelstatedesc
$duniqueid
$dexten
:
$dpriority
$dchannel
$dialstatus
"
);
$crmcall
->
save
();
}
...
...
@@ -1445,6 +1448,7 @@ class KPAMIListen implements IEventListener
//TODO: Need to create static values for modes
$status
=
array
(
'Auto'
,
'Inbound'
);
//NOTE: Be Careful before changing indexes
$mode
=
""
;
$campaignUserIds
=
[];
$diallines
=
Dialline
::
where
(
'server'
,
'='
,
$this
->
sipip
)
->
whereIn
(
"status"
,
$status
)
->
where
(
"conf"
,
"="
,
""
)
->
get
();
if
(
$diallines
)
...
...
@@ -1464,9 +1468,7 @@ class KPAMIListen implements IEventListener
{
$mode
=
"Predictive"
;
$campaignUserIds
=
User
::
where
(
'presence'
,
'='
,
"1"
)
->
where
(
'sel_campaign'
,
'='
,
$dialline
->
regexstr
)
->
select
(
'id'
)
->
get
()
->
toArray
();
$campaignUserIds
=
$this
->
getUsersAvailableInCampaign
(
$dialline
->
regexstr
);
$sipid
=
Sipid
::
where
(
'server'
,
'='
,
$this
->
sipip
)
->
whereIn
(
"user"
,
$campaignUserIds
)
...
...
@@ -1480,14 +1482,7 @@ class KPAMIListen implements IEventListener
{
$mode
=
"Incoming"
;
$this
->
checkMobileNumberExist
(
$crmcall
);
$sipid
=
Sipid
::
where
(
'server'
,
'='
,
$this
->
sipip
)
->
where
(
"user"
,
"!="
,
"0"
)
->
where
(
"status"
,
"="
,
"1"
)
->
where
(
"ready"
,
"="
,
"1"
)
->
orderBy
(
"updated_at"
,
"ssc"
)
->
first
();
$sipid
=
$this
->
getSipid
(
$dialline
->
regexstr
);
}
if
(
!
empty
(
$sipid
))
...
...
@@ -1498,17 +1493,94 @@ class KPAMIListen implements IEventListener
}
else
if
(
$mode
==
"Incoming"
)
{
$this
->
showIncomingPopupAlert
(
$dialline
->
regexstr
,
$crmcall
);
}
}
}
}
}
private
function
showIncomingPopupAlert
(
$client
,
$crmcall
)
{
$flag
=
"alert"
;
$sipids
=
$this
->
getSipid
(
$client
,
$flag
);
foreach
(
$sipids
as
$sipid
)
{
$newqueue
=
new
Kqueue
();
$newqueue
->
sipNotify
(
$sipid
,
"popupalert"
,
" Incoming Calls"
,
$crmcall
->
number
.
"|"
.
$crmcall
->
client
,
$crmcall
->
did
);
}
}
private
function
getSipid
(
$client
,
$flag
=
null
)
{
$data
=
[];
$campaignUserIds
=
[];
if
(
$client
!=
""
)
$campaignUserIds
=
$this
->
getUsersAvailableInCampaign
(
$client
);
if
(
$flag
==
null
)
{
if
(
!
empty
(
$campaignUserIds
))
{
$sipid
=
Sipid
::
where
(
'server'
,
'='
,
$this
->
sipip
)
->
whereIn
(
"user"
,
$campaignUserIds
)
->
where
(
"status"
,
"="
,
"1"
)
->
where
(
"ready"
,
"="
,
"1"
)
->
orderBy
(
"updated_at"
,
"asc"
)
->
first
();
}
else
{
$sipid
=
Sipid
::
where
(
'server'
,
'='
,
$this
->
sipip
)
->
where
(
"user"
,
"!="
,
"0"
)
->
where
(
"status"
,
"="
,
"1"
)
->
where
(
"ready"
,
"="
,
"1"
)
->
orderBy
(
"updated_at"
,
"asc"
)
->
first
();
}
$data
=
$sipid
;
}
else
{
if
(
!
empty
(
$campaignUserIds
))
{
$sipids
=
Sipid
::
where
(
'server'
,
'='
,
$this
->
sipip
)
->
whereIn
(
"user"
,
$campaignUserIds
)
->
where
(
"status"
,
"="
,
"1"
)
->
orderBy
(
"updated_at"
,
"asc"
)
->
get
();
}
else
{
$sipids
=
Sipid
::
where
(
'server'
,
'='
,
$this
->
sipip
)
->
where
(
"user"
,
"!="
,
"0"
)
->
where
(
"status"
,
"="
,
"1"
)
->
orderBy
(
"updated_at"
,
"asc"
)
->
get
();
}
$data
=
$sipids
;
}
return
$data
;
}
private
function
checkMobileNumberExist
(
$crmcall
)
private
function
getUsersAvailableInCampaign
(
$client
)
{
if
(
$crmcall
->
client
==
"."
)
$data
=
[];
$data
=
User
::
where
(
'presence'
,
'='
,
"1"
)
->
where
(
'sel_campaign'
,
'='
,
$client
)
->
select
(
'id'
)
->
get
()
->
toArray
();
return
$data
;
}
private
function
checkMobileNumberExist
(
$crmcall
)
{
$wakka
=
new
KHRMSLib
();
$users
=
$wakka
->
searchPhone
(
"mobile"
,
$crmcall
->
number
,
""
);
...
...
@@ -1536,7 +1608,6 @@ class KPAMIListen implements IEventListener
return
;
}
}
private
function
connectToAvailableSip
(
$sipid
,
$dialline
,
$crmcall
,
$mode
)
{
...
...
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