Overview
Rainbow Desktop for Windows can run an external program when an incoming PBX call arrives. You can use this to copy the caller's phone number to the Windows clipboard automatically, so you can paste it into a CRM, a ticketing tool or a search field. Two options are available: copy the number automatically when the call rings, or add a Copy number button to the incoming-call popup.
The setup uses two files: a small script that copies the number to the clipboard, and a Rainbow customization file (custo-manifest.json) that tells Rainbow when to run it.
Prerequisites
- Rainbow Desktop for Windows. Rainbow Web can only open URLs and cannot run local scripts.
- A Rainbow account connected to a PBX.
- A Rainbow Essentials licence or higher for option 1, or a Business or Enterprise licence for option 2.
Step 1: Create the script
- Create the folder
C:\RainbowTools. - In this folder, create a text file named
copy-number.vbswith the following content:
Option Explicit
Dim raw, clean, i, c, sh
If WScript.Arguments.Count = 0 Then WScript.Quit 1
raw = ""
For i = 0 To WScript.Arguments.Count - 1
raw = raw & WScript.Arguments(i)
Next
clean = ""
For i = 1 To Len(raw)
c = Mid(raw, i, 1)
If (c >= "0" And c <= "9") Or (c = "+" And clean = "") Then clean = clean & c
Next
If clean = "" Then WScript.Quit 2
Set sh = CreateObject("WScript.Shell")
sh.Run "cmd /c ""<nul set /p =" & clean & "|clip""", 0, FalseThe script keeps only the digits and a leading + of the number, copies the result to the clipboard without a trailing line break, and runs without opening any window. If the caller's number is hidden, it does nothing.
To test the script, open a command prompt, run the command below, then paste (Ctrl+V) into any text field:
wscript C:\RainbowTools\copy-number.vbs +33123456789
Step 2: Choose an option and create the customization file
Choose one of the two options below, then create a file named custo-manifest.json with the matching content.
Option 1: Copy the number automatically
The number is copied to the clipboard as soon as the call rings, with no action from the user. This option requires a Rainbow Essentials licence or higher.
{
"version": "2",
"extension-points": {
"on-incoming-pbx-call-actions": [
{
"name": "Copy caller number",
"command": {
"url": "C:\\Windows\\System32\\wscript.exe",
"params": "C:\\RainbowTools\\copy-number.vbs ${caller.phoneNumber}"
}
}
]
}
}Option 2: Add a Copy number button
A Copy number button is added to the incoming-call popup. The number is copied only when the user clicks it. With "AnswerOnClick": false, clicking the button does not answer the call. This option requires a Business or Enterprise licence.
{
"version": "2",
"extension-points": {
"on-incoming-pbx-call-button-actions": [
{
"name": "Copy number",
"AnswerOnClick": false,
"command": {
"url": "C:\\Windows\\System32\\wscript.exe",
"params": "C:\\RainbowTools\\copy-number.vbs ${caller.phoneNumber}"
}
}
]
}
}Note: Backslashes in paths must be doubled in this file. If you use a different folder, update the paths accordingly.
Step 3: Load the customization file in Rainbow
- In Rainbow Desktop, go to Settings > Telephony > Customization.
- Click Import and select
custo-manifest.json. - Restart Rainbow Desktop.
- Place an external test call to your number. With option 2, click Copy number in the incoming-call popup. Then paste (Ctrl+V) to check that the number was copied.
Administrators can also deploy the file to several users with the installer option Rainbow_Installer.exe /Custom=<path>, or from the Rainbow administration.
Good to know
- The number is copied in the format sent by the PBX (international or national format, depending on your configuration).
- Each incoming call replaces the current content of the clipboard.
- Calls with a hidden number are ignored.
Related articles
For more information, see Rainbow Extensions and Customization.