# SECURITY KEYS -- PUT YOURS IN HERE! ################################################################################## ## BeVocal Sample Code # ## (C) Copyright BeVocal, Inc. 2003, All rights reserved. # ## # ## This Sample Code is provided for your reference purposes, and carries no # ## warranty whatsoever. Use of this code is restricted to use in connection # ## with the BeVocal Cafe developer's program. # ## # ## BeVocal disclaims and excludes any and all warranties of merchantability, # ## title and fitness for a particular purpose. BeVocal does not warrant that the # ## software will satisfy your requirements, or that the software is without # ## defect or error. You are using the software at your own risk. # ## # ################################################################################## ################################################################################### # WHAT THIS SCRIPT IS FOR # # You can use this file to contain all of your Cafe and Production keys, so you # don't have to keep pasting them into every single Perl script that accesses # one of the BeVocal Platform Services. # # When you do so, you then reference the keys by "customer" name. Typically, # you might have different keys for different customers, for example, # # one for your QA group for testing on Bevocal Cafe (called "cafe"), and # one for your real customers on Hosting Production (called "production"). # #################################################################################### # WHEN YOU USE IT # # You can immediately use the Key Ring in conjunction with the sample Perl scripts # for the various BeVocal Platform Services. Those scripts are: # http://cafe.bevocal.com/resources/voicexml_samples/getLogsInTimePeriod.pl # http://cafe.bevocal.com/resources/voicexml_samples/svc_geo/phoneToZIP.pl # http://cafe.bevocal.com/resources/voicexml_samples/svc_log/getLog.pl # http://cafe.bevocal.com/resources/voicexml_samples/svc_outnotification/makeCall.pl # http://cafe.bevocal.com/resources/voicexml_samples/svc_outnotification/cancelCall.pl # http://cafe.bevocal.com/resources/voicexml_samples/svc_outnotification/getStatus.pl # # Of course, you can write your own Perl script to access one of these or another # service and use the Key Ring with your own script. # ################################################################################### # HOW YOU PASS A KEY TO ANOTHER SCRIPT # # When you use one of the Perl commands above, specify a key using the -c switch. # If you don't specify a Customer, the name "production" will be assumed. # ################################################################################### # HOW YOU ACCESS THIS SCRIPT FROM ANOTHER SCRIPT # # When you want a key in one of your scripts, you need to load this script with # a line like: # require "keyRing.pl"; # (with an appropriate directory, if necessary) # # Then, later in the script, you can make a call like: # # ($accessSystem, $orgID, $appID, $server, $key) # = getProviderData("cafe"); # # If ($accessSystem eq "NoProviderFound"), then you did something wrong. # # Otherwise, you'll get back the following useful information: # # orgID/appID = the ORG and APP ID's (used for billing/CDR access) # soapServer = use this to construct a URL to talk to a SOAP service # key = your 128 bit access key (to pass into the SOAP services) # ################################################################################### # HOW YOU ADD NEW KEYS TO THIS SCRIPT # # To add a key called "foobar" to the Key Ring, add the following lines # in the appropriate place (search for the text "ADD NEW ENTRIES BELOW": # # {'providerKey' => 'foobar', # 'accessSystem' => 'Foobar Production system', # 'orgId' => 'UNKNOWN', # these are useful for the CDR Access API # 'appId' => 'UNKNOWN', # these are useful for the CDR Access API # 'soapServer' => 'production.services.bevocal.com', # the base URL # 'myAccessKey' => '0123456789ABCDEF0123456789ABCDEF'}, # the 128-bit key value # ################################################################################### #---------------------------------------------------------------# # getProviderData(providerName) # # # # input: String providerName, e.g. "cafe" # # returns: (systemName, orgID, appID, soapServerName, key) # #---------------------------------------------------------------# sub getProviderData { my ($providerKey) = @_; # List of known providers - ADD NEW ENTRIES BELOW - entries are hashes my @providerList = ( {'providerKey' => 'production', 'accessSystem' => 'Hosting Production', 'orgId' => 'MyOrgID_1_assigned_by_Bevocal', 'appId' => 'MyAppID_1_assigned_by_Bevocal', 'soapServer' => 'production.services.bevocal.com', 'myAccessKey' => '0123456789ABCDEF0123456789ABCDEF'}, {'providerKey' => 'cafe', 'accessSystem' => 'Cafe Production', 'orgId' => 'MyOrgID_2_assigned_by_Bevocal', 'appId' => 'MyAppID_2_assigned_by_Bevocal', 'soapServer' => 'cafe.services.bevocal.com', 'myAccessKey' => '0123456789ABCDEF0123456789ABCDEF'}, # Add more here ); while ($#providerList >= 0) { # If this SOAP provider matches the provider key assign values if (${$providerList[0]}{'providerKey'} eq $providerKey) { return (${$providerList[0]}{'accessSystem'}, ${$providerList[0]}{'orgId'}, ${$providerList[0]}{'appId'}, ${$providerList[0]}{'soapServer'}, ${$providerList[0]}{'myAccessKey'} ); } shift(@providerList); } # If nothing matches, return bogus values return ('NoProviderFound', 'NoProvider', 'NoProvider', 'NoProvider', 'NoProvider'); } # return "module loaded correctly"; 1;