def please_call(user, session_id=None): # call the user and bridge to a sales person menu_text = "END Please wait while we place your call.\n" # make a call caller = "+254703554404" recepient = user.phone_number # create a new instance of our awesome gateway gateway = AfricasTalkingGateway(current_app.config["AT_USERNAME"], current_app.config["AT_APIKEY"]) try: gateway.call(caller, recepient) except AfricasTalkingGateway as e: menu_text = "Encountered an error when calling: {}".format(str(e)) # print the response on to the page so that our gateway can read it return respond(menu_text)
def _makeCallImpl(self, phoneNumbers): username = "******"; apikey = "APIKey"; callFrom = "+254711082903"; # Create a new instance of our awesome gateway class gateway = AfricasTalkingGateway(username, apikey) try: yield gateway.call(callFrom, phoneNumbers) log.msg("Calls have been initiated. Time for song and dance!\n") except AfricasTalkingGatewayException, e: log.msg('Encountered an error while making the call: %s' % str(e))
def _makeCallImpl(self, phoneNumbers): username = "******" apikey = "APIKey" callFrom = "+254711082903" # Create a new instance of our awesome gateway class gateway = AfricasTalkingGateway(username, apikey) try: yield gateway.call(callFrom, phoneNumbers) log.msg("Calls have been initiated. Time for song and dance!\n") except AfricasTalkingGatewayException, e: log.msg('Encountered an error while making the call: %s' % str(e))
def call(self): gateway = AfricasTalkingGateway(self.APP_USERNAME, self.API_KEY) # Specify your Africa's Talking phone number in international format callFrom = "+254711082XXX" # Specify the numbers that you want to call to in a comma-separated list # Please ensure you include the country code (+254 for Kenya in this case) callTo = "+254711XXXYYY,+254733YYYZZZ" try: results = gateway.call(callFrom, callTo) for result in results: # Only status "Queued" means the call was successfully placed print "Status : %s; phoneNumber : %s " % ( result['status'], result['phoneNumber']) except AfricasTalkingGatewayException, e: print 'Encountered an error while making the call: %s' % str(e)
from reminder.models import Reminder reminder_contacts = Reminder.objects.values_list('patient_id', 'patient__patient_contact') # Specify your login credentials username = "******" apikey = "07984423a278ead54fee35d3daf956598deb51405b27fe70f1e2dfe964be5c04" # Specify your Africa's Talking phone number in international format callFrom = "+254711082079" # Specify the numbers that you want to call to in a comma-separated list # Please ensure you include the country code (+254 for Kenya in this case) callTo = "+254700050144,+254720955704" # Create a new instance of our awesome gateway class gateway = AfricasTalkingGateway(username, apikey) try: # Make the call results = gateway.call(callFrom, callTo) for result in results: # Only status "Queued" means the call was successfully placed print "Status : %s; phoneNumber : %s " % (result['status'], result['phoneNumber']) except AfricasTalkingGatewayException, e: print 'Encountered an error while making the call: %s' % str(e)
#! /usr/bin/python # Be sure to import helper gateway class from AfricasTalkingGateway import AfricasTalkingGateway, AfricasTalkingGatewayException # Specify your login credentials username = "******" apikey = "MyAfricasTalking_APIKey" # Specify your Africa's Talking phone number in international format callFrom = "+254711082XYZ" # Specify the numbers that you want to call to in a comma-separated list # Please ensure you include the country code (+254 for Kenya in this case) callTo = "+254711XXXYYY,+254733YYYZZZ" # Create a new instance of our awesome gateway class gateway = AfricasTalkingGateway(username, apikey) # Any gateway errors will be captured by our custom Exception class below, # so wrap the call in a try-catch block try: # Make the call gateway.call(callFrom, callTo) print "Calls have been initiated. Time for song and dance!\n" # Our API will now contact your callback URL once recipient answers the call! except AfricasTalkingGatewayException, e: print 'Encountered an error while making the call: %s' % str(e)