Skip to content

Commit

Permalink
Updated the fusionpbx ingest process in support of #366.
Browse files Browse the repository at this point in the history
  • Loading branch information
uncheckederror committed Aug 9, 2023
1 parent 7deed82 commit 900e270
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
11 changes: 11 additions & 0 deletions NumberSearch.Ingest/Owned.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,21 @@ public static async Task MatchOwnedNumbersToFusionPBXAsync(string connectionStri
{
var message = await ex.GetResponseStringAsync();
Log.Warning($"[OwnedNumbers] Failed to find destination and domain information for owned number {ownedNumber.DialedNumber} : {message}");

// If we can't find the number remove the existing data.
if (ex.StatusCode is 404)
{
updated = true;
ownedNumber.FPBXDestinationId = null;
ownedNumber.FPBXDomainName = string.Empty;
ownedNumber.FPBXDomainDescription = string.Empty;
ownedNumber.FPBXDomainId = null;
}
}

if (updated)
{
ownedNumber.DateUpdated = DateTime.Now;
_ = await ownedNumber.PutAsync(connectionString);
Log.Information($"[OwnedNumbers] Updated FusionPBX data for Owned Phone number {ownedNumber.DialedNumber}");
}
Expand Down
7 changes: 1 addition & 6 deletions NumberSearch.Ops/Views/OwnedNumbers/OwnedNumbers.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,8 @@
@if (!string.IsNullOrWhiteSpace(number?.Owned?.FPBXDomainName))
{
<p>@number?.Owned.FPBXDomainName</p>
<p>
<a class="btn btn-outline-primary" href="https://@number?.Owned?.FPBXDomainName/app/destinations/destination_edit.php?id=@number?.Owned?.FPBXDestinationId" target="_blank">Destination</a>
</p>
<p>@number?.Owned.FPBXDomainDescription</p>
<p>
<a class="btn btn-outline-secondary" href="https://@number?.Owned?.FPBXDomainName/core/domains/domain_edit.php?id=@number?.Owned?.FPBXDomainId" target="_blank">Domain</a>
</p>
<p>DestinationId: @number?.Owned.FPBXDestinationId</p>
}
else
{
Expand Down

0 comments on commit 900e270

Please sign in to comment.