您好,我正在尝试制作一个模块,该模块在接到电话时将在Sugarcrm内部弹出窗口。我已经看到其他一些人已经完成了这项工作(昂贵的付费模块),我希望能对实际的弹出触发零件有所了解..
。我们的电话系统有一个API,该API在我们有传入的电话时将HTTP帖子发送到URL。
在Sugarcrm的内部,在我的模块代码中,我不确定如何使用手机中的HTTP帖子进行弹出窗口,原因是我看不到它如何快速,如果我要设置它每1分钟检查一个页面,这仍然太慢了。
那么,有人有什么想法是否有其他类似的电话集成模块正在执行此操作,并且在电话打入电话时几乎立即发生弹出式?
关于如何完成这样的任务的任何想法?我打算执行仅位于托盘中并等待帖子的桌面应用程序,但是看到其他人在没有单独程序的情况下能够在Sugarcrm内获得相同的结果。
我在一家创建了一个昂贵的付费模块来实现这一目标的公司中,但是我可以为您提供两种实现方法的提示;--)
1)用慷慨在自定义/模块中创建logic_hooks.php和yourchoicehere.php
在逻辑钩中创建一个UI钩
$hook_array['after_ui_frame'] = Array();
$hook_array['after_ui_frame'][] = Array(1, 'Display Javascript for Telephone','custom/modules/YOURCHOICEHERE.php','GenericHooks', 'displayTelephoneJS');
和yourchoicehere.php
class GenericHooks {
function displayTelephoneJS() {
if(!$_REQUEST['to_pdf']) echo '<div id="telephone_div"></div>
<script type="text/javascript" src="custom/somewherewhereyouwant/Telephone.js"/></script>';
// you yould also add a stylesheet here
}
}
在电话中,您可以做任何想做的事情:
function Telephone_poll() {
$.post("some.php?poll=1,function(data){
if(data != 0)
{
var result= JSON.parse(data);
//HERE you can do manipulate your telephone_div and populate it with response data "result" from the call to some.php
$('#telephone_div').html("<span>HELLO<span>");
$('#telephone_div').show();
//Here you can also add styles and so on
}
setTimeout("Telephone_poll()", 1000); //restart the function every 1000ms
});
}
Telephone_poll(); //initial start of script
2)另一种方法是从重新运行的PHP文件中创建恶魔/服务。在这里,您需要某种方法来识别用户和电话,以确保显示正确的用户/电话的弹出窗口。