Php 单击以从应用程序调用OpenVBX

Php 单击以从应用程序调用OpenVBX,php,jquery,codeigniter,twilio,openvbx,Php,Jquery,Codeigniter,Twilio,Openvbx,我正在尝试将两条数据从外部webapp发布到OpenVBX calltonum:(phone number in format +12345678902) callfromnum:(phone number in format +12345678902) 一旦数据进入应用程序,我将尝试使用此功能: 我已经通过插件验证了这个Javascript函数的有效性,但是还没有成功地将数据发布到插件中。我最初担心会遇到身份验证问题,但很快发现我是否已经有一个打开的会话,并将数据直接发布到自定义控制器中的

我正在尝试将两条数据从外部webapp发布到OpenVBX

calltonum:(phone number in format +12345678902)
callfromnum:(phone number in format +12345678902)
一旦数据进入应用程序,我将尝试使用此功能:

我已经通过插件验证了这个Javascript函数的有效性,但是还没有成功地将数据发布到插件中。我最初担心会遇到身份验证问题,但很快发现我是否已经有一个打开的会话,并将数据直接发布到自定义控制器中的函数,该自定义控制器具有扩展
User\u controller
。。。它接收post数据并将其传递给视图

现在,我的问题是,当我加载视图时,它会在屏幕上填充所有CSS、Javascript和数据视图,但页面请求加载“/”,从而将浏览器重定向到/messages/inbox。我还收到一个js错误:

Uncaught ReferenceError: $ is not defined(anonymous function) @ dosomethingplease:116
当尝试使用browserphone api时,我认为jquery没有加载到模板中

以下是我目前拥有的代码:

dialbrowser.php在/controllers中创建

<?php 

class dialbrowserException extends Exception {}

class dialbrowser extends User_Controller {
public function __construct()
{
    parent::__construct();  
}
public function index()
{
    return $this->dosomethingplease();
}
public function dosomethingplease()
{
    $data = $this->init_view_data();
    $this->template->add_js('assets/j/plugins/call-and-sms-dialogs.js');
    $this->template->add_js('assets/j/frameworks/jquery-1.6.2.min.js');
    $data = array('calltonum' => $this->input->post('calltonum'), 'callfromnum' => $this->input->post('callfromnum'));

    $this->respond('title','dialnow', $data);
}    
}

?>
<div class="vbx-content-main">

<div class="vbx-content-menu vbx-content-menu-top">
    <h2 class="vbx-content-heading">Test-a-roo</h2>
</div><!-- .vbx-content-menu -->

<div class="vbx-content-container">
    <div class="vbx-content-section">
        <div class="vbx-form">
            <h3>Receipt of Number passed:</h3>
                <div>
                    And here we made it the whole way.... didnt think we could do it huh? 
                    <?php 
                    echo "lets do this for sanity's sake... to: ".$calltonum." and from: ".$callfromnum." ...see no issues with the data!";
                    $html = "<script> $('document').ready(function(){OpenVBX.clientDial({'to': '".$calltonum."', 'callerid': '".$callfromnum."'});}); </script>";
                    echo $html;
                    ?>
                </div>
        </div>
    </div><!-- .vbx-content-section -->
</div><!-- .vbx-content-container -->

</div><!-- .vbx-content-main -->

dialnow.php在/views中创建

<?php 

class dialbrowserException extends Exception {}

class dialbrowser extends User_Controller {
public function __construct()
{
    parent::__construct();  
}
public function index()
{
    return $this->dosomethingplease();
}
public function dosomethingplease()
{
    $data = $this->init_view_data();
    $this->template->add_js('assets/j/plugins/call-and-sms-dialogs.js');
    $this->template->add_js('assets/j/frameworks/jquery-1.6.2.min.js');
    $data = array('calltonum' => $this->input->post('calltonum'), 'callfromnum' => $this->input->post('callfromnum'));

    $this->respond('title','dialnow', $data);
}    
}

?>
<div class="vbx-content-main">

<div class="vbx-content-menu vbx-content-menu-top">
    <h2 class="vbx-content-heading">Test-a-roo</h2>
</div><!-- .vbx-content-menu -->

<div class="vbx-content-container">
    <div class="vbx-content-section">
        <div class="vbx-form">
            <h3>Receipt of Number passed:</h3>
                <div>
                    And here we made it the whole way.... didnt think we could do it huh? 
                    <?php 
                    echo "lets do this for sanity's sake... to: ".$calltonum." and from: ".$callfromnum." ...see no issues with the data!";
                    $html = "<script> $('document').ready(function(){OpenVBX.clientDial({'to': '".$calltonum."', 'callerid': '".$callfromnum."'});}); </script>";
                    echo $html;
                    ?>
                </div>
        </div>
    </div><!-- .vbx-content-section -->
</div><!-- .vbx-content-container -->

</div><!-- .vbx-content-main -->

测试车
收到通过的号码:
在这里,我们一路走来。。。。没想到我们能做到,嗯?

这就是你要找的吗?有一个概念插件可以添加对Openvbx的点击调用,但您需要修改几行,以禁用未经授权发布到插件的安全性

不知何故,插件页面中的文档准备工作不正常。您应该尝试window.onload而不是$('document')。就绪 因此,路线将是:

$html = "<script> window.onload=function(){OpenVBX.clientDial({'to': '".$calltonum."', 'callerid': '".$callfromnum."'});}; </script>";
$html=“window.onload=function(){OpenVBX.clientDial({'to':'“$calltonum.”,'callerid':'“$callfromnum.”});};

OpenVBX是用Codeigniter编写的。。我花了很长时间自己修改它,直到我学会了CI。。如果你打算用它做很多开发,那么做一个关于CI的教程可能是值得的。是的,我在这篇文章中标记了codeigniter,因为我希望一些codeigniter的粉丝能告诉我我是否遗漏了什么。我看了一些视频,但没有时间或兴趣了解CI的所有内容,尤其是因为它的版本是v.1.7,我相信这就是OpenVBX@Pamblam如果你想为我在这篇文章中添加OpenVBX标签,那你就太好了