01 / 04
1. Pick the active session
The idle workspace below is a real demo capture; it does not show a live call.
- Sign in to the Agent interface with the test station and test user, and select the test campaign.
- Confirm the session is idle and note the exact agent user ID. Do not use a customer session.
- In Users → Show Users, inspect Agent API Access and API Allowed Functions for the approved API user. Compare its permissions and the desired function with the Agent API reference shipped with your installed revision.
Agent API Access
Open to enlargeCapture details
Account identity and other fields are excluded. Values shown do not establish successful API access.You should seeAn Agent API request targets an agent session; successful authentication alone does not prove a station is registered or a call works.
02 / 04
2. Form one request
Create a new local private exercise directory and save only form credentials there. The Python prompts use the terminal, not a shell argument; urlencode serializes punctuation safely. The config contains no URL, redirect or additional operation.
This step writes a local credential file only. Keep this shell open so API_EXERCISE_DIR still names it, and never publish the file. The actual API read is the following section.
- In the private workstation terminal, run the protected-file block below. It creates a new mode 0700 directory and a mode 0600 config with exclusive creation.
- At the hidden prompts enter the approved API username and password. Do not use the agent phone-login password or paste credentials into a URL.
- Read the printed owner/mode check. Keep the config only as long as the credential policy permits; removing a local file does not revoke the server account.
- Before you use it
- Run in an interactive private Linux terminal. On macOS use stat -f "%Su %Lp %N" for the final metadata check. No network request is sent.
API_EXERCISE_DIR=$(mktemp -d "${TMPDIR:-/tmp}/vicigeek-api.XXXXXXXX")if [ -n "$API_EXERCISE_DIR" ] && [ -d "$API_EXERCISE_DIR" ]; then chmod 700 "$API_EXERCISE_DIR" python3 - "$API_EXERCISE_DIR/api.curl" <<'PYCONFIG'import getpass,os,pathlib,sys,urllib.parsepath=pathlib.Path(sys.argv[1])user=getpass.getpass('Approved API username (hidden): ')password=getpass.getpass('Approved API password (hidden): ')if not user or not password or any(c in user+password for c in '\r\n\0'): raise SystemExit('STOP: empty or unsupported credential input')body=urllib.parse.urlencode({'user':user,'pass':password})fd=os.open(path,os.O_WRONLY|os.O_CREAT|os.O_EXCL,0o600)with os.fdopen(fd,'w',encoding='ascii') as config: config.write('data = "'+body+'"\n')print('Private config created; no credentials printed.')PYCONFIG stat -c '%U %a %n' "$API_EXERCISE_DIR/api.curl"else printf '%s\n' 'STOP: private directory creation failed.' >&2fiThis example has no recorded result here. Follow its preparation, expected result and stop conditions before using it.
- Success looks like
- The new config is owned by the workstation user with mode600, inside the new700 directory. Its user/pass form values were URL-encoded, not placed in command history.
- Stop if
- A prompt, file-creation or permission error means no read request yet. Do not reuse an unexplained file or broaden its mode to make curl work.
You should seeThe authenticated request now has a concrete protected-file prerequisite; no API permission has been proven.
03 / 04
3. Send one idle-session queue-count read
Replace the hostname and TESTUSER below with the approved HTTPS endpoint and exact idle synthetic agent. The curl config supplies user/pass; the command supplies only the documented function parameters. No retry or redirect following is enabled.
The documented success example is SUCCESS: calls_in_queue_count - 0. Zero is a valid count, not a failed call. Compare the full returned contract with the installed reference; eligible queued calls are not the outbound hopper population.
- Before you use it
- Use the same local private shell, approved hostname and idle agent. The subshell contains failure exits; credentials remain in the protected config.
( test -n "${API_EXERCISE_DIR:-}" && test -r "$API_EXERCISE_DIR/api.curl" || exit 1 response=$(curl --fail --silent --show-error --connect-timeout 10 --max-time 20 \ --config "$API_EXERCISE_DIR/api.curl" \ --data-urlencode 'source=lab' --data-urlencode 'function=calls_in_queue_count' \ --data-urlencode 'value=DISPLAY' --data-urlencode 'agent_user=TESTUSER' \ 'https://YOUR_HOSTNAME/agc/api.php') || exit 1 if [[ "$response" =~ ^SUCCESS:\ calls_in_queue_count\ -\ [0-9]+$ ]]; then printf '%s\n' "$response" else printf '%s\n' 'STOP: no accepted queue-count contract; inspect the private response with the owner.' >&2 exit 1 fi)This example has no recorded result here. Follow its preparation, expected result and stop conditions before using it.
- Success looks like
- One exact numeric success response is accepted. Record time, function and count privately; this does not establish station registration or audio.
- Stop if
- Network/TLS/HTTP errors or ERROR/unexpected bodies remain failures. Check permissions and idle session with the owner; do not substitute a call-control write to test connectivity.
You should seeYou have one accepted bounded queue read or a specific unresolved transport/access/session/contract failure.
04 / 04
4. Resolve the failure and retire the local credential safely
- If authentication fails, check API access and the API user's permissions with the administrator; never paste secrets into a ticket.
- If the agent is unavailable, verify the exact user, campaign and current session in the Agent UI.
- If a function is unsupported or the response is ambiguous, stop and compare the installed API version and function documentation before retrying.
You should seeOnly run call-control actions after an operator has explicitly prepared a test call and documented the expected effect.
Checks and sources
What was checked
- The official Agent API documents the request fields and calls_in_queue_count DISPLAY success/error contract. This page no longer claims to be a full31-function reference.
- The new credential-file and request commands were not executed against the demo for this repair. The retained permission/idle captures establish only their dated UI state.
- One accepted queue-count read does not verify call-control authorization, a registered station or a completed call.
Primary references
Sources
- VICIdial Agent API referenceVICIdial Group · accessed November 4, 2026
- VICIdial demonstrationVICIdial Group · accessed November 4, 2026
- Agent API function and queue-count contractVICIdial Group · accessed November 7, 2026
- curl config and form optionscurl project · accessed November 7, 2026
