|
Внимание! Это работает только для FireFox!
Загрузите расширение Greasemonkey, это расширение для Firefox, позволяющее создавать свои сценарии (так называемые "user scripts"), изменяющие загружаемые браузером веб-страницы путем внедрения в HTML-код пользовательских скриптов.
https://addons.mozilla.org/ru/firefox/addon/748

После установки в правом нижнем углу появиться следующий значок 
кликните на нее правой кнопкой мыши и выберите «Новый скрипт»


После заполнения полей нажмите «ОК».
При первом запуске приложения, FireFox попросит выбрать редактор, как правило, это Notepad. В отрывшемся окне Notepad введите следующий код.
// Sip: Linkify (for 3CX)
// Author: Boris Yim (modified by Vladimir Afanasiev, www.icepartners.ru)
// License: GNU GPL v2 or later
// Modified from: Skype Linkify (http://www.questar.it/blog/developer/skypelinkify.user.js)
// which was inspired by SunRocket VoIP Dial Linkify (http://www.muehlen.com/projects/voip/voip_dial.user.js)
// which in turn was inspired by UPS Tracking Linkify (http://plutor.org/files/upslinkify.user.js)
//
// Match these patterns:
// 800-555-1212
// (800) 555-1212
// (800)555-1212
// 800-555-1212
// 800-555-1212
// 800 555 1212
// 800.555.1212
// 800/555/1212
// 8005551212
// +1 (number)
// + (international number)
//
// Link to "http:<formated number>" ("3CX VoIP Client:" also OK)
//
// ==UserScript==
// @name sip: Linkify (for 3CX VoIP Client)
// @namespace http://userscripts.org/scripts/show/5935 (original Skype source)
// @description Looks for phone numbers in pages and makes hyperlinks out of them. When clicking on the link, your 3CX Voip Client will ring and be dialing the number / link you clicked on.
// @include *
// ==/UserScript==
//default country prefix
const defaultPrefix= '9';
(function () {
const trackRegex = /(\+\d\d?)?[\-\s\/\.]?[\(]?(\d){2,4}[\)]?[\-\s\/\.]?\d\d\d[\-\s\/\.]?(\d){3,5}\b/ig;
function trackUrl(t) {
if (String(t).charAt(0)!= '+') t= defaultPrefix + String(t);
return "http://<АДРЕС 3CX СЕРВЕРА>:5484/PbxAPI.aspx?func=make_call&from=<ВНУТРЕННИЙ
НОМЕР С КОТОРОГО ЗВОНИТЬ>&pin=<ПИН>&to=" + (String(t).replace(/[\-\s\/\(\)\.]/g, ""));
}
// tags we will scan looking for un-hyperlinked urls
var allowedParents = [
"abbr", "acronym", "address", "applet", "b", "bdo", "big", "blockquote", "body",
"caption", "center", "cite", "code", "dd", "del", "div", "dfn", "dt", "em",
"fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", "i", "iframe",
"ins", "kdb", "li", "nobr", "object", "pre", "p", "q", "samp", "small", "span", "strike",
"s", "strong", "sub", "sup", "td", "th", "tt", "u", "var"
];
var xpath = "//text()[(parent::" + allowedParents.join(" or parent::") + ")" + "]";
var candidates = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var cand = null, i = 0; (cand = candidates.snapshotItem(i)); i++) {
if (trackRegex.test(cand.nodeValue)) {
var span = document.createElement("span");
var source = cand.nodeValue;
cand.parentNode.replaceChild(span, cand);
trackRegex.lastIndex = 0;
for (var match = null, lastLastIndex = 0; (match = trackRegex.exec(source)); ) {
span.appendChild(document.createTextNode(source.substring(lastLastIndex, match.index)));
var a = document.createElement("a");
a.setAttribute("href", trackUrl(match[0]));
a.appendChild(document.createTextNode(match[0]));
span.appendChild(a);
lastLastIndex = trackRegex.lastIndex;
}
span.appendChild(document.createTextNode(source.substring(lastLastIndex)));
span.normalize();
}
}
})();
Укажите:
Сохраните файл. После этого все телефонные будут выглядеть как ссылки. При нажатии сначала звонит внутренний телефон, при поднятии трубки будет установлено соединение с удаленным абонентом.
|