From 758a32723df0dd6b1abb68010686f55b27060333 Mon Sep 17 00:00:00 2001 From: Christopher Silva <131322948+ChrisFsilva@users.noreply.github.com> Date: Thu, 30 Oct 2025 17:35:58 -0300 Subject: [PATCH 1/4] Create test.txt --- Shortcut_SIP_ID/test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 Shortcut_SIP_ID/test.txt diff --git a/Shortcut_SIP_ID/test.txt b/Shortcut_SIP_ID/test.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Shortcut_SIP_ID/test.txt @@ -0,0 +1 @@ + From 64b20505ec0827ded43910001742899d1e31394d Mon Sep 17 00:00:00 2001 From: Christopher Silva <131322948+ChrisFsilva@users.noreply.github.com> Date: Thu, 30 Oct 2025 17:39:07 -0300 Subject: [PATCH 2/4] Add files via upload --- Shortcut_SIP_ID/LICENSE | 21 +++++++ Shortcut_SIP_ID/README.md | 2 + Shortcut_SIP_ID/index.js | 116 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 139 insertions(+) create mode 100644 Shortcut_SIP_ID/LICENSE create mode 100644 Shortcut_SIP_ID/README.md create mode 100644 Shortcut_SIP_ID/index.js diff --git a/Shortcut_SIP_ID/LICENSE b/Shortcut_SIP_ID/LICENSE new file mode 100644 index 0000000..b6cf229 --- /dev/null +++ b/Shortcut_SIP_ID/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Christopher Silva + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Shortcut_SIP_ID/README.md b/Shortcut_SIP_ID/README.md new file mode 100644 index 0000000..29b5b78 --- /dev/null +++ b/Shortcut_SIP_ID/README.md @@ -0,0 +1,2 @@ +# Cisco_Macro_Atalho_Comunica-o +Crie um atalho personalizado para comunicação com um SIP NAME especifico, o usuário não precisará mais digitar o SIP do contato toda vez que precisar entrar em contato, somente o ID da reunião diff --git a/Shortcut_SIP_ID/index.js b/Shortcut_SIP_ID/index.js new file mode 100644 index 0000000..f7dd850 --- /dev/null +++ b/Shortcut_SIP_ID/index.js @@ -0,0 +1,116 @@ +/* Criado por Christopher Alves Ferreira da Silva */ +/* Registro e documentação - https://github.com/ChrisFsilva/Cisco_Macro_Atalho_Comunica-o */ +/* Versão criada em 09/2022*/ + +const xapi = require('xapi'); + +const KEYBOARD_TYPES = { + NUMERIC : 'Numeric' + , SINGLELINE : 'SingleLine' + , PASSWORD : 'Password' + , PIN : 'PIN' +} +const CALL_TYPES = { + AUDIO : 'Audio' + , VIDEO : 'Video' +} + +const DIALPAD_ID = 'teamsdialpad'; +const DIALHOSTPIN_ID = 'teamshostpin'; + +/* Crie aqui o ID do botão, para que você possa associar ao UI extension*/ +const INROOMCONTROL_WEBEXCONTROL_PANELID = 'teamsdialer'; + +/* Use these to check that its a valid number (depending on what you want to allow users to call */ +const REGEXP_URLDIALER = /([a-zA-Z0-9@_\-\.]+)/; /* . Use this one if you want to allow URL dialling */ +const REGEXP_NUMERICDIALER = /^([0-9]{3,10})$/; /* Use this one if you want to limit calls to numeric only. In this example, require number to be between 3 and 10 digits. */ + +const DIALPREFIX_AUDIO_GATEWAY = '0'; +const DIALPOSTFIX_WEBEXURL = '@m.webex.com'; +/* Digite aqui o SIPName da empresa contatada*/ +const DIALID_WEBEXURL = '.SIP'; + +var teamsnumbertodial = ''; +var hostpin = ''; +var isInTeamsCall = 0; + +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +xapi.event.on('CallDisconnect', (event) => { + isInTeamsCall = 0; + }); + + + +function showDialPad(text){ + + xapi.command("UserInterface Message TextInput Display", { + InputType: KEYBOARD_TYPES.NUMERIC + , Placeholder: 'ID de Vídeo Conferência' + , Title: "Teams Meeting Vtal" + , Text: text + , SubmitText: "Call" + , FeedbackId: DIALPAD_ID + }).catch((error) => { console.error(error); }); +} + +/* This is the listener for the in-room control panel button that will trigger the dial panel to appear */ +xapi.event.on('UserInterface Extensions Panel Clicked', (event) => { + if(event.PanelId === INROOMCONTROL_WEBEXCONTROL_PANELID){ + showDialPad("Digite o ID de Vídeo Conferência:" ); + } +}); + + + +xapi.event.on('UserInterface Message TextInput Response', (event) => { + switch(event.FeedbackId){ + case DIALPAD_ID: + let regex =REGEXP_URLDIALER; // First check, is it a valid number to dial + let match = regex.exec(event.Text); + if (match !== null) { + let contains_at_regex = /@/; + let contains_at_in_dialstring = contains_at_regex.exec(event.Text); + if (contains_at_in_dialstring !== null) { + teamsnumbertodial = match[1]; + } + else{ + teamsnumbertodial = match[1]; + teamsnumbertodial = teamsnumbertodial + DIALID_WEBEXURL + DIALPOSTFIX_WEBEXURL ; // Here we add the default hostname to the SIP number + xapi.command("dial", {Number: teamsnumbertodial}).catch((error) => { console.error(error); }); + } + sleep(200).then(() => { //this is a necessary trick to get it working with multiple touch panels to not mess up event-clears from other panels + + }); + + } + else{ + showDialPad("You typed in an invalid number. Please try again. Format is blablabla..." ); + } + break; + + } +}); + + + +xapi.status.on('Call RemoteNumber', (remoteNumber) => { + if(remoteNumber.includes('m.webex.com')){ + isInTeamsCall = 1; + sleep(5000).then(() => { + if(isInTeamsCall){ // need to check again in case call has dropped within the last 5 seconds + if(hostpin.length>0){ + xapi.command("Call DTMFSend", {DTMFString: hostpin}); + if(!hostpin.includes('#')){ + xapi.command("Call DTMFSend", {DTMFString: '#'}); + } + } + else{ + xapi.command("Call DTMFSend", {DTMFString: '#'}); + } + } + }); + } + }); From 319eb6e8708bfb88605727e9e885a95f19261c47 Mon Sep 17 00:00:00 2001 From: Christopher Silva <131322948+ChrisFsilva@users.noreply.github.com> Date: Thu, 30 Oct 2025 17:54:57 -0300 Subject: [PATCH 3/4] Create help_me --- help_me | 1 + 1 file changed, 1 insertion(+) create mode 100644 help_me diff --git a/help_me b/help_me new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/help_me @@ -0,0 +1 @@ + From b487bc02681402fdbf9f8bf5440f65411cf79466 Mon Sep 17 00:00:00 2001 From: Christopher Silva <131322948+ChrisFsilva@users.noreply.github.com> Date: Fri, 31 Oct 2025 09:19:02 -0300 Subject: [PATCH 4/4] Delete help_me --- help_me | 1 - 1 file changed, 1 deletion(-) delete mode 100644 help_me diff --git a/help_me b/help_me deleted file mode 100644 index 8b13789..0000000 --- a/help_me +++ /dev/null @@ -1 +0,0 @@ -