Setting up a subaccount for each user
Before we can do anything else, we have to allow users to sign up.
To do this, we're going to build a joining form for users to join your PBX system. This form will also create their subaccount under your main Twilio account. Subaccounts make it easier to track a user's usage.
Getting ready
The complete source code for this recipe can be found in the Chapter9/Recipe2
folder in the source code for this book.
How to do it...
Now that we've set up our basic framework, let's build a form to allow users to sign up and have Twilio create subaccounts for them.
Upload the following
index.php
file to your website:<?php include 'Services/Twilio.php'; require("config.php"); require("system/jolt.php"); require("system/pdo.class.php"); require("system/functions.php"); $_GET['route'] = isset($_GET['route']) ? '/'.$_GET['route'] : '/'; $app = new Jolt('site',false); $app->option('source', 'config.ini'); #$pdo = Db::singleton(); $mysiteURL = $app->option('site.url...