Number of queued calls

You need your AfricasTalking username and APIKey for any request to our API. If you don't have an APIKey, please click here to get one.

The VB.NET code snippet below shows how you can get number of queued calls of your Africas Talking phone number using our API.

The code uses VB gateway class: AfricasTalkingGateway.vb [ Download]

The code encodes and decodes data using Javascript serializer so you will need to add System.Web.Extensions to your referenced libraries


Imports System.IO
Imports System.Collections
Imports System.Collections.Generic

Public Class Application
	Public Shared Sub Main()
		
			' Specify your login credentials
			
			Dim username As String = "myAfricasTalkingUsername"
			Dim apikey As String   = "myAPIKey"
			
			' Create a new instance of our awesome gateway class
			Dim gateway As New AfricasTalkingGateway(username, apikey)
			
			' Specify your AfricasTalking phone number in international format.
			' Comma-separate them if they are more than one
			Dim phoneNumber As String = "+254711082XXX"
			
			' Wrap the call in a try-catch block.
			' Any gateway error will be captured by our custom Exception class below
			
			Try
			
				Dim results As Object() = gateway.getNumQueuedCalls(phoneNumber)
				
				# For a specific queue, specify the queue name eg:
				# Dim queueName As String = "myQueueName"
				# Dim results As Object() = gateway.getNumQueuedCalls(phoneNumber, queueName);
				
				Dim result As Object
				
				for each result in results
				 	Dim numQueuedCalls As Integer = result("numCalls")
					System.Console.WriteLine ("Phone number: " + result("phoneNumber"))
					System.Console.WriteLine ("Queue name: " + result("queueName"))
					System.Console.WriteLine ("Phone number: " + CType(numQueuedCalls, String))
				next
				
			catch ex As AfricasTalkingGatewayException
				System.Console.WriteLine(ex.Message())
				
			End Try 
	End Sub
End Class
}

Our REST resource for getting the number of queued calls is located at: https://voice.africastalking.com/queueStatus. In order to get the number of queued calls, you will need to pass in the following parameters within a POST request:
Variable Name Location Description
apikey Header Your API Key, which you can generate from your dashboard
username Body Your Africa's Talking account username
phoneNumbers Body Your AfricasTalking phone number mapped to your account

You can check the HTTP Response Code to determine whether the request was successful. Any response code other than 201 (Created) indicates that the call was not initiated

Example using CURL client
curl -H "Accept: application/xml" -H "Apikey: fb752d3417021812f0961y6c9464832dd1adb1e555c73f1e7c32bcc006488674" -d "username=myUsername&phoneNumbers=+254711082XXX" https://voice.africastalking.com/queueStatus