#!/usr/bin/python # # The MIT License # # Copyright (c) 2008 Silas Sewell # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. __author__ = 'silas@sewell.ch (Silas Sewell)' from pf.pf_auth import PfAuth call_status = {0: 'No message.', 1: 'A PIN is Entered', 2: 'No PIN Entered', 3: '# Not Pressed After Entry', 4: 'No Phone Input - Timed Out ', 5: 'PIN Expired and Not Changed', 6: 'Used Cache', 7: 'Bypassed Auth', 10: 'Call Disconnected', 11: 'Call Timed Out ', 12: 'Invalid Phone Input', 13: 'Got Voicemail', 14: 'User is Blocked', 100: 'Invalid Phone Number', 101: 'Phone Busy', 102: 'Configuration Issue', 103: 'International Calls Not Allowed', 104: 'PIN Mode Not Allowed', 105: 'Account Locked', 106: 'Invalid Message', 107: 'Invalid Phone Number Format', 108: 'User Hung Up the Phone', 109: 'Insufficient Balance', 110: 'Phone Extensions Not Allowed', 111: 'Invalid Extension', 112: 'Fraud Code Entered'} # Authenicate number response = PfAuth.pf_authenticate(phone_number='3035551234') # Get response authenicated = response.get('authenticated', False) call_status_code = response.get('call_status', 0) error_id = response.get('error_id', 0) # Print results print '-'*80 print 'Authenicated:\t', authenicated print 'Call Status:\t', '%s [%s]' % (call_status[call_status_code], call_status_code) print 'Error ID:\t', error_id print '-'*80