Beispiel #1
0
function saveEvent($type, $vendor_id, $inquiry_id)
{
    require_once "service/SimplePdoLeadConnectService.php";
    require_once "entity/Event.php";
    $service = new SimplePdoLeadConnectService();
    $e = new Event();
    $e->event = $type;
    $e->vendor_id = $vendor_id;
    $e->inquiry_id = $inquiry_id;
    $service->saveEvent($e);
}
<?php

require_once "service/SimplePdoLeadConnectService.php";
require_once "entity/Account.php";
$service = new SimplePdoLeadConnectService();
if (array_key_exists('id', $_POST) && $_POST['id']) {
    $account = $service->loadAccount($_POST['id']);
} else {
    $account = new Account();
}
$a = new Account();
if (array_key_exists('id', $_POST) && $_POST['id']) {
    $a->id = $_POST['id'];
}
$a->name = $_POST['name'];
$a->host = $_POST['host'];
$a->phone = $_POST['phone'];
$a->api_key = $_POST['api_key'];
$a->number_sid = $_POST['number_sid'];
$a->greeting = $_POST['greeting'];
if ($service->saveAccount($a)) {
    header("Location: accounts.php?message=Saved");
} else {
    header("Location: error.php");
}
Beispiel #3
0
<?php

require_once "service/SimplePdoLeadConnectService.php";
$service = new SimplePdoLeadConnectService();
$account = $service->loadAccountFromPhone(substr($_REQUEST['To'], -10));
$to = urlencode($_REQUEST['To']);
$from = urlencode($_REQUEST['From']);
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
    <Say><?php 
echo $account->greeting;
?>
</Say>
    <Gather numDigits="1" action="inbound-inquiry.php&#63;To=<?php 
echo $to;
?>
&amp;From=<?php 
echo $from;
?>
" method="POST">
        <Say>Press 1 to speak with an associate.</Say>
    </Gather>
</Response>
<?php

header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
require_once "service/SimplePdoLeadConnectService.php";
require_once "entity/Inquiry.php";
require_once "entity/Event.php";
require_once "functions.php";
$sid = $_GET['sid'];
$live = $_GET['live'];
$phone = $_GET['phone'];
$name = $_GET['name'];
$inquiry_key = $_GET['inquiry-key'];
$vendor_id = $_GET['vendor-id'];
$params = "phone={$phone}&amp;vendor-id={$vendor_id}&amp;inquiry-key={$inquiry_key}&amp;sid={$sid}&amp;live={$live}";
$service = new SimplePdoLeadConnectService();
$vendor = $service->loadVendor($vendor_id);
$account = $service->loadAccount($vendor->account_id);
$inquiry = $service->loadInquiry($inquiry_key);
$events = $service->loadEvents($inquiry->id);
?>

<Response>
    <?php 
if (count($events) > 0) {
    $vendor_events = groupEventsByVendor($events);
    $call_in_process = detectCallInProcess($vendor_events);
    if ($call_in_process == 1) {
        if ($live == "true") {
            ?>
                <Say>Hello. Someone just called from <?php 
Beispiel #5
0
<?php

header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
require_once "service/SimplePdoLeadConnectService.php";
require_once "entity/Event.php";
require_once "functions.php";
$service = new SimplePdoLeadConnectService();
$inquiry = $service->loadInquiry($_GET['inquiry-key']);
saveEvent($_POST['DialCallStatus'], $_GET['vendor-id'], $inquiry->id);
$events = $service->loadEvents($inquiry->id);
$vendor_events = groupEventsByVendor($events);
initiateCallbacks($vendor_events);
?>
<Response>
    <Hangup />
</Response>
Beispiel #6
0
<?php

require_once "service/SimplePdoLeadConnectService.php";
$service = new SimplePdoLeadConnectService();
$inquiry_key = $_GET['inquiry_key'];
$inquiry = $service->loadInquiry($inquiry_key);
echo $inquiry->note;
Beispiel #7
0
<?php

require_once "service/SimplePdoLeadConnectService.php";
require_once "entity/Account.php";
require_once "entity/Vendor.php";
if (array_key_exists('id', $_GET) && $_GET['id']) {
    $service = new SimplePdoLeadConnectService();
    $account = $service->loadAccount($_GET['id']);
    $vendors = $service->loadAccountVendors($_GET['id']);
}
?>


<html>
<head>
<title>Account</title>
</head>
<body>
    <h1>Account</h1>
<form method="post" action="_saveAccount.php">
    <p>
    Name:<br />
    <input type="text" name="name" <?php 
if (array_key_exists('id', $_GET) && $_GET['id']) {
    ?>
value="<?php 
    echo $account->name;
}
?>
"/>
    </p>
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
require_once "service/SimplePdoLeadConnectService.php";
require_once "entity/Event.php";
require_once "functions.php";
// if the caller pressed anything but 1 send them back
if ($_REQUEST['Digits'] != '1') {
    header("Location: vendor-connect.php");
    die;
}
$live = $_GET['live'];
$sid = $_GET['sid'];
$phone = $_GET['phone'];
$inquiry_key = $_GET['inquiry-key'];
$vendor_id = $_GET['vendor-id'];
$params = "phone={$phone}&amp;vendor-id={$vendor_id}&amp;inquiry-key={$inquiry_key}&amp;sid={$sid}&amp;live={$live}";
$service = new SimplePdoLeadConnectService();
$inquiry = $service->loadInquiry($inquiry_key);
$events = $service->loadEvents($inquiry->id);
?>

<Response>
    <?php 
if (count($events) > 0) {
    $vendor_events = groupEventsByVendor($events);
    $call_in_process = detectCallInProcess($vendor_events);
    if ($call_in_process == 1) {
        ?>
            <Say>Sorry. Another vendor has just connected a call to the prospect.</Say>
            <?php 
        scheduleCallback($params);
    } else {
<?php

header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
require_once "service/SimplePdoLeadConnectService.php";
require_once "entity/Account.php";
require_once "entity/Vendor.php";
require_once "entity/Prospect.php";
require_once "entity/Inquiry.php";
$service = new SimplePdoLeadConnectService();
if (isset($_REQUEST['To'])) {
    $sid = $_REQUEST['CallSid'];
    $live = "true";
    $phone = substr($_REQUEST['From'], -10);
    $name = NULL;
    $email = NULL;
    $note = NULL;
    $account = $service->loadAccountFromPhone(substr($_REQUEST['To'], -10));
} else {
    $live = "false";
    $number_sid = $_POST['number_sid'];
    $phone = $_POST['phone'];
    $name = $_POST['name'];
    $email = $_POST['email'];
    $note = $_POST['note'];
    $account = $service->loadAccountFromNumberSid($number_sid);
}
$vendors = $service->loadAccountVendors($account->id);
if (!$service->loadProspectByPhone($phone, $account->id)) {
    $p = new Prospect();
    $p->account_id = $account->id;
Beispiel #10
0
<?php

require_once "service/SimplePdoLeadConnectService.php";
$service = new SimplePdoLeadConnectService();
$prospects = $service->loadAccountProspects($_GET['account_id']);
$vendors = $service->loadAccountVendors($_GET['account_id']);
?>
<html>
    <head>
        <title>Inquiries</title>
    </head>
    <body>
        <h1>Inquiries</h1>
        <table>
            <th>Date</th>
            <th>Phone</th>
            <th>Accepted</th>
            <th>Callback</th>
            <th>Completed</th>
            <th>Name</th>
            <th>Note</th>
            <?php 
foreach ($prospects as $prospect) {
    $inquiries = $service->loadProspectInquiries($prospect->id);
    foreach ($inquiries as $inquiry) {
        ?>
                    <tr>
                        <td><?php 
        echo $inquiry->timestamp;
        ?>
</td>
<?php

require_once "service/SimplePdoLeadConnectService.php";
require_once "entity/Prospect.php";
$service = new SimplePdoLeadConnectService();
if (array_key_exists('id', $_POST) && $_POST['id']) {
    $prospect = $service->loadProspect($_POST['id']);
} else {
    $prospect = new Prospect();
}
$p = new Prospect();
if (array_key_exists('id', $_POST) && $_POST['id']) {
    $p->id = $_POST['id'];
}
$p->name = $_POST['name'];
$p->email = $_POST['email'];
$p->phone = $_POST['phone'];
if ($service->saveProspect($p)) {
    header("Location: accounts.php?message=Saved");
} else {
    header("Location: error.php");
}
Beispiel #12
0
<?php

require_once "service/SimplePdoLeadConnectService.php";
require_once "entity/Account.php";
$service = new SimplePdoLeadConnectService();
$accounts = $service->loadAccounts();
?>

<html>
    <head>
        <title></title>
    </head>
    <body>
        <?php 
if (array_key_exists('message', $_GET) && $_GET['message']) {
    echo "<p>" . $_GET['message'] . "</p>";
}
?>
        <h1>Accounts</h1>
        <a href="account.php">Create Account</a>
        <?php 
if (count($accounts) > 0) {
    ?>
    
            <table>
                <th>Name</th>
                <th>Host</th>
                <th>Phone</th>
                <th>Number Sid</th>
                <th>Prospects</th>
                <th>Action</th>
Beispiel #13
0
<?php

require_once "service/SimplePdoLeadConnectService.php";
require_once "entity/Vendor.php";
if (array_key_exists('id', $_GET) && $_GET['id']) {
    $service = new SimplePdoLeadConnectService();
    $vendor = $service->loadVendor($_GET['id']);
}
?>


<html>
<head>
<title>Vendor</title>
</head>
<body>
    <h1>Vendor</h1>
<form method="post" action="_saveVendor.php">
    <p>
    Name:<br />
    <input type="text" name="name" <?php 
if (array_key_exists('id', $_GET) && $_GET['id']) {
    ?>
value="<?php 
    echo $vendor->name;
}
?>
"/>
    </p>
    Phone:<br />
    <input type="text" name="phone" <?php 
<?php

require_once "service/SimplePdoLeadConnectService.php";
require_once "entity/Account.php";
if (array_key_exists('id', $_GET) && $_GET['id']) {
    $service = new SimplePdoLeadConnectService();
    if ($service->deleteAccount($_GET['id'])) {
        header("Location: accounts.php?message=Deleted");
    } else {
        header("Location: error.php");
    }
}
Beispiel #15
0
<?php

require_once "service/SimplePdoLeadConnectService.php";
require_once "entity/Vendor.php";
$service = new SimplePdoLeadConnectService();
if (array_key_exists('id', $_POST) && $_POST['id']) {
    $vendor = $service->loadVendor($_POST['id']);
} else {
    $vendor = new Vendor();
}
$v = new Vendor();
if (array_key_exists('id', $_POST) && $_POST['id']) {
    $v->id = $_POST['id'];
}
$v->account_id = $_POST['account_id'];
$v->name = $_POST['name'];
$v->phone = $_POST['phone'];
$v->email = $_POST['email'];
if ($service->saveVendor($v)) {
    header("Location: account.php?id=" . $_POST['account_id'] . "&message=Saved");
} else {
    header("Location: error.php");
}
<?php

require_once "service/SimplePdoLeadConnectService.php";
require_once "entity/Vendor.php";
if (array_key_exists('id', $_GET) && $_GET['id']) {
    $service = new SimplePdoLeadConnectService();
    if ($service->deleteVendor($_GET['id'])) {
        header("Location: account.php?id=" . $_GET['account_id'] . "&message=Deleted");
    } else {
        header("Location: error.php");
    }
}