- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 02-04-2024 11:59 AM
Often we have scenarios where we need to start a conference call when a Trigger condition is met and we don't want to wait for someone to start a conference call manually.
The use case could be as simple as starting a conference call and inviting a group of people to join a conference call when an P1 incident is assigned to their group. This action need not be carried out manually but can be invoked programmatically via a Business Rule or Script Action as per your custom requirement.
Requirements :
Notify Plugin.
MS Teams Setup - Notify Connector for MS Teams.
One can use existing Core Notify internal APIs to achieve their use case. One can also refer to Product Documentation links below for more use cases.
Script snippet that can be referred. Here we have assumed that the below snippet gets added in NotifyUtil Script Include.
prepareDataForPayload: function(confProvider, table, sourceId, partipantIdsArr, groupIds, /* optional */ fromNumber) {
var confUtils = new global.NotifyConferenceUtils();
var data = confUtils.getConferenceInputDataTemplate();
data.table = table;
data.sysId = sourceId;
data.allowMulticonference = true;
data.siProcessor = 'global.NotifyOnTaskAjaxProcessor_V2';
if(!partipantIdsArr && !groupIds)
gs.info("No Group or Particpants data passed. ")
if (confProvider == 'Telephony') {
data.serviceProvider = 'Telephony';
data.fromNumber = fromNumber;
} else if (confProvider) {
data.serviceProvider = confProvider;
}
if(groupIds)
this._addGroupToData(data, groupIds, table, sourceId);
if (partipantIdsArr)
this._addUserToData(data, partipantIdsArr);
return data;
},
_addUserToData: function(data, partipantIdsArr) {
var partipantIdsStr = partipantIdsArr ? partipantIdsArr.join(",") : null;
var userGR = this._getUserGR(partipantIdsStr);
if (!userGR)
return;
while (userGR.next()) {
var item = {};
item.id = userGR.sys_id + '';
item.email = userGR.getValue('email');
item.name = userGR.getValue('name');
item.phoneNumber = userGR.getValue('phone');
data.items.push(item);
}
},
_getUserGR: function(partipantIds) {
if (!partipantIds)
return null;
var userGR = new GlideRecord('sys_user');
userGR.addEncodedQuery("sys_idIN" + partipantIds);
userGR.query();
return userGR;
},
_addGroupToData: function(data, groupIds, tableRec, sourceId) {
if (!groupIds || !sourceId)
return;
groupIds.forEach(function(grpId) {
var entry = {
table: tableRec,
sysId: sourceId,
groupId: grpId,
isSMS : false,
};
var notifyOnTaskAjaxProcessor = new NotifyOnTaskAjaxProcessor_V2(undefined, undefined, undefined, entry);
var groupAndUserDetails = notifyOnTaskAjaxProcessor.validateAndGetParticipants();
if (!groupAndUserDetails)
return;
var grpDetails = JSON.parse(groupAndUserDetails);
grpDetails.forEach(function(grpItem){
data.items.push(grpItem);
});
});
},
startConferenceCall: function(payload) {
new global.NotifyConferenceUtils().doConferenceAction('start', payload);
}
Invocation Script with examples.
prepareDataForPayload: function(confProvider, table, sourceId, partipantIdsArr, /* optional */ groupIds, fromNumber) {
startConferenceCall(payload)
- confProvider: The provider with which the conference needs to start. "Microsoft Teams" or "Telephony" or "Zoom"
- table : Source table name.
- sourceId : Sys Id of the source table.
- partipantIdsArr: SysId of the Users who are to be invited in Array format.
- groupIds: sysIds of the Groups which are to be invited in Array format.
-
fromNumber: From number to start the conference (Valid only for Twilio or other Telephony providers)
1. Using MS teams as the provider
var nUtil = new NotifyUtil();
var data = nUtil.prepareDataForPayload('Microsoft Teams','incident','3e4445c047723d106d90a852736d4362',['eeac5c328759259096c0ebd73cbb3527','46d44a23a9fe19810012d100cca80666'],'','');
nUtil.startConferenceCall(data);
Note: The above script should be run in the context of a user who has a valid Teams account to start a teams meeting. The other way to achieve this requirement is to impersonate as one such user and then end impersonation once the meeting is over.
2. Using Twilio or any other Telephony Provider.
var nUtil = new NotifyUtil();
var data = nUtil.prepareDataForPayload('Telephony','incident','3e4445c047723d106d90a852736d4362',['9ee1b13dc6112271007f9d0efdb69cd0','5137153cc611227c000bbd1bd8cd2005'],'','+15855774490');
nUtil.startConferenceCall(data);
- 557 Views