Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Gitlab Maintenance 28.03.2025 | 20:00 - 23:00 MEZ
Show more breadcrumbs
xrm
basic
Commits
c632ecad
Commit
c632ecad
authored
5 years ago
by
Johannes Goderbauer
Browse files
Options
Downloads
Patches
Plain Diff
cti: improved recognition of the correct CTILOG-entry
parent
e2f0b241
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
process/IncomingCallExecutor_lib/process.js
+11
-4
11 additions, 4 deletions
process/IncomingCallExecutor_lib/process.js
process/ctiServerEvents/process.js
+29
-9
29 additions, 9 deletions
process/ctiServerEvents/process.js
with
40 additions
and
13 deletions
process/IncomingCallExecutor_lib/process.js
+
11
−
4
View file @
c632ecad
...
...
@@ -55,8 +55,9 @@ function IncomingCallExecutor(pCallData)
//key-value pairs of states-functions
this
.
_handlerFunctions
=
{};
this
.
notificationContentId
=
null
;
}
IncomingCallExecutor
.
prototype
.
toString
=
function
()
{
return
JSON
.
stringify
(
this
,
null
,
"
"
);
...
...
@@ -118,19 +119,25 @@ IncomingCallExecutor.prototype.logData = function()
logging
.
log
(
"
contactsCall>>
"
+
JSON
.
stringify
(
this
.
contactsCall
));
};
/**
* helper function that will log different callData and collected data to standard-output
* The function does not specify any module, importance or else
* Needed for live-analytics of problems and errors.
*
* @return undefined
*/
IncomingCallExecutor
.
prototype
.
getNotificationBaseConfig
=
function
(
pUserName
)
{
if
(
!
pUserName
)
if
(
!
pUserName
||
!
this
.
notificationContentId
)
return
null
;
var
notificationConfig
=
notification
.
createConfig
()
.
addUserWithId
(
pUserName
)
.
contentId
(
this
.
callData
.
call
Id
)
//group all notifications of one call together
.
contentId
(
this
.
notificationContent
Id
)
//group all notifications of one call together
.
notificationType
(
"
_____SYSTEM_NOTIFICATION_PHONECALL
"
);
return
notificationConfig
;
};
IncomingCallExecutor
.
prototype
.
_setHandlerFn
=
function
(
pCallState
,
pFunction
)
{
this
.
_handlerFunctions
[
pCallState
]
=
pFunction
;
...
...
This diff is collapsed.
Click to expand it.
process/ctiServerEvents/process.js
+
29
−
9
View file @
c632ecad
...
...
@@ -32,7 +32,7 @@ var ringingHandlerFn = function()
vals
.
push
(
affectedContactId
);
}
db
.
insertData
(
"
AB_CTILOG
"
,
cols
,
null
,
vals
);
this
.
notificationContentId
=
vals
[
0
];
if
(
this
.
callData
.
isIncomingCall
)
{
...
...
@@ -75,10 +75,14 @@ var talkingHandlerFn = function()
{
var
cols
=
[
"
DATE_EDIT
"
,
"
ANSWERMODE
"
];
var
vals
=
[
datetime
.
date
(),
$KeywordRegistry
.
callAnswerMode
$accepted
()];
newWhereIfSet
(
"
AB_CTILOG.CALLID
"
,
this
.
callData
.
callId
)
.
updateData
(
true
,
"
AB_CTILOG
"
,
cols
,
null
,
vals
);
var
newestCtiLogId
=
_getNewestCtiLogId
(
this
.
callData
.
callId
);
if
(
newestCtiLogId
)
{
this
.
notificationContentId
=
newestCtiLogId
;
//currently not used but you never know
newWhereIfSet
(
"
AB_CTILOG.AB_CTILOGID
"
,
newestCtiLogId
)
.
updateData
(
true
,
"
AB_CTILOG
"
,
cols
,
null
,
vals
);
}
//do not notify here since the user _should_ know when he accepts a call
};
...
...
@@ -102,8 +106,13 @@ var disconnectingHandlerFn = function()
cols
.
push
(
"
ANSWERMODE
"
);
vals
.
push
(
$KeywordRegistry
.
callAnswerMode
$missed
());
}
db
.
updateData
(
"
AB_CTILOG
"
,
cols
,
null
,
vals
,
sqlCond
.
build
());
var
newestCtiLogId
=
_getNewestCtiLogId
(
this
.
callData
.
callId
);
if
(
newestCtiLogId
)
{
this
.
notificationContentId
=
newestCtiLogId
;
db
.
updateData
(
"
AB_CTILOG
"
,
cols
,
null
,
vals
,
newWhere
(
"
AB_CTILOG.AB_CTILOGID
"
,
newestCtiLogId
).
buildCondition
());
}
//do not notify the user when the call is outgoing since the user knows when he/she does initiate a call
if
(
!
this
.
callData
.
isIncomingCall
)
return
null
;
...
...
@@ -164,6 +173,17 @@ var disconnectingHandlerFn = function()
return
null
;
};
function
_getNewestCtiLogId
(
pCallid
)
{
//get the newewst ctilogid for a given callid since the callid may not be unique in a telephon systems
//therefor sort descending by DATE_NEW and return that value
var
ctiLogId
=
newSelect
(
"
AB_CTILOG.AB_CTILOGID
"
)
.
from
(
"
AB_CTILOG
"
)
.
where
(
"
AB_CTILOG.CALLID
"
,
pCallid
)
.
orderBy
(
"
AB_CTILOG.DATE_NEW desc
"
)
.
cell
();
return
ctiLogId
;
}
//collect all data from the various call information
var
callData
=
{
action
:
vars
.
get
(
"
$local.action
"
)
...
...
@@ -183,7 +203,7 @@ var callData = {
var
ic
=
new
IncomingCallExecutor
(
callData
);
//ic.logData();
ic
.
setHandlerRinging
(
ringingHandlerFn
);
ic
.
logData
(
);
ic
.
setHandlerTalking
(
talkingHandlerFn
);
ic
.
setHandlerDisconnect
(
disconnectingHandlerFn
);
ic
.
execute
();
//actually doin' something
\ No newline at end of file
ic
.
execute
();
//actually doin' something
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment