Overview
Provisioning is the process of getting servers and phones ready to be put into service. Historically this process has been driven with the provision.pl script. For the unbound product, we started with Inphonex as our provider. Now that we have a new market in Australia, we also have a new provider, Symbio. The provision process for Symbio is not identical to the provision process for Inphonex. Thus the spawn of provision_symbio.pl which driver the Symbio provisioning process.
Merge Inphonex and Symbio Provision Scripts
We’d like to merge these two scripts into one and abstract the differences into some common high level API.
Symbio Specifics
F::Symbio::Utils
This module contains symbio specific code for the provisioning process.
allocate_dids()
if ($unbound_device) { my $cinfo = F::Customer::get_customer_info($dbh, $hr->{'customer_id'}); my @exts = F::Order::get_extension_interview($dbh, $order->{order_header_id}); my $ret = F::Symbio::Utils::allocate_dids( exts => \@exts, edition => determine_software($order), num_slots => scalar(@exts), server_info => $hr, customer_info => $cinfo, ); _add_ip_devices($dbh, $order->{server_id}, $pass, $term, $order, 1); } else { _add_ip_devices($dbh, $server_id, $pass, $term, $order, 0); }
TODO
Need to make this check work for Symbio and a general unbound provider
if (ref($order) eq "HASH") { $customer_id = $order->{customer_id}; print "Customer ID: $customer_id\n"; # if the customer already has an Unbound server (has inphonex id), then fail. # We don't want customers to have more than 1 Unbound server # TODO: Need to make this check work for Symbio and a general unbound provider if ($order->{order_type} eq 'unbound' && F::Unbound::is_unbound_customer($dbh, $order->{customer_id})) { print "ERROR:\n"; print "Cannot provision another Unbound server to this customer " . "because they already have an Unbound server.\n"; # exit(0); } }
provision()
sub _provision_symbio { my $dbh = shift; my %opt = ref($_[0]) eq 'HASH' ? %{ +shift } : @_; my $order = $opt{'order'}; # we need an extension interview my @exts = F::Order::get_extension_interview($dbh, $order->{order_header_id}); my ($pbxtratype) = grep { $_->{group_name} eq "Connect Australia User Licenses" } @{ $order->{items} }; # provision this customer with Symbio print "Provisioning ...\n"; my $success = F::Symbio::Utils::provision($dbh, $opt{'server_id'}, $opt{'customer_id'}, $pbxtratype->{name}, \@exts); if (!$success) { print "Failure to provision Symbio customer! Contact Mateu or Felix before trying again.\n"; exit; } return; }
update_mapping
Within *pair_device_with_did:
if (($provider eq 'symbio') && $device_id) { print "About to update the unbound_map table...\n"; my $server_info = F::Server::get_server_info($dbh, $server_id); my $unbound_host = $server_info->{mosted}; F::Symbio::Utils::update_mapping( $dbh, { 'unbound_virtual_number' => $did->{value}, 'server_id' => $server_id, 'phone_number' => $did->{value}, 'host' => $unbound_host, 'device_id' => $device_id, } ); }
Compare provision.pl and provision_symbio.pl
Showing changes from previous revision. Removed | Added
