Skip to content

fix(contacts): avoid errors if empty contacts are retrieved #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ function getSipCredentials($cloudUsername, $cloudPassword, $cloudDomain, $isToke
}

// if step 4 has no endpoints, return false
debug("No endpoints found for {$cloudUsername}@{$cloudDomain}");
return false;
}

Expand Down Expand Up @@ -313,6 +314,12 @@ function handle($data)
// make request
$response = makeRequest($cloudUsername, $token, $url);

if ($response == false) {
debug("ERROR: Failed to get phonebook contacts for {$cloudUsername}@{$cloudDomain}");
header("HTTP/1.0 404 Not Found");
return;
}

// read counter file
$count = 0;
if (file_exists('/tmp/phonebook_counters_' . $cloudDomain)) {
Expand Down