diff --git a/Block Outgoing Calls/README.md b/Block Outgoing Calls/README.md new file mode 100644 index 0000000..657904e --- /dev/null +++ b/Block Outgoing Calls/README.md @@ -0,0 +1,6 @@ +# Block Outgoing Calls + +Block certain numbers in a reject list from being called from the system. Show a message on screen instead. + +Open the macro in the macro editor and add more numbers to the list if you need to. + diff --git a/Block Outgoing Calls/block-outgoing.js b/Block Outgoing Calls/block-outgoing.js new file mode 100644 index 0000000..99c3698 --- /dev/null +++ b/Block Outgoing Calls/block-outgoing.js @@ -0,0 +1,23 @@ +import xapi from 'xapi'; + +// variable that can be changed from settings ui on roomos.cisco.com +const NumberToBlock = 'macro.polo@cisco.com'; + +const denyList = [ + NumberToBlock, + + // add more numbers like this if you need to: + // 'thedude@cisco.com', +]; + +xapi.Status.Call.on(e => { + const reject = denyList.some(number => number.toLowerCase().includes(e.RemoteNumber.toLowerCase())); + const outgoing = e.Direction === 'Outgoing'; + if (outgoing && reject) { + xapi.Command.UserInterface.Message.Alert.Display({ + Text: 'The number you called was not allowed by a user script on the device', + Duration: 10, + }); + xapi.Command.Call.Disconnect(); + } +}); diff --git a/Block Outgoing Calls/manifest.json b/Block Outgoing Calls/manifest.json new file mode 100644 index 0000000..f874150 --- /dev/null +++ b/Block Outgoing Calls/manifest.json @@ -0,0 +1,25 @@ +{ + "version": "1", + "profile": { + "macro": { + "items": [ + { + "payload": "./block-outgoing.js", + "type": "url", + "id": "block-outgoing" + } + ] + }, + "userParams": [ + { + "id": "NumberToBlock", + "name": "Number to block", + "info": "Partial number is also ok", + "type": "string", + "default": "macro.polo@cisco.com", + "domain": "block-outgoing", + "required": true + } + ] + } +} diff --git a/README.md b/README.md index 4d044f0..3251e8a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ Macros available: | AppleTV Control | Add an Apple TV remote control to the touch 10. All communication is done directly via HDMI-CEC. No control system needed. | | Audio Call Dial Pad | Ereate an in-room control application that adds a dedicated audio call dial pad to the Touch 10 | | Audio Safe Guard | Enforce a maximum output volume on the device. Demostrates a simple macro using API statuses and commands | +| Block Outgoing Calls | Block certain numbers in a reject list from being called from the system. | | Big Red Button | Quick action such as muting with a connected USB device | | Camera Control with wide angle view | Your custom camera control page, including creating a wide angle view of two cameras and controlling both simultaneously. | | Conditional Autoanswer with Prompt | Auto answer on incoming calls - but only for a select number of remote sites |