Skip to content

Conversation

@iu2frl
Copy link
Contributor

@iu2frl iu2frl commented Dec 9, 2025

This MR implements a very simple callbook failover logic.

Summary

  • If the $config['callbook'] is set to a single string (default), nothing is changed in the logic, a single query is performed and result is evaluated accordingly
  • If the $config['callbook'] is set to an array, then the different providers are sequentially tested to see if a valid response is returned

Testing

I tested the following scenarios:

Back compatibility

I let the default config.php config (or with any single providers set):

$config['callbook'] = 'qrz';

And the following sequence was returned (single callbook -> single request). The single provider was tested, nothing different from existing behavior.

DEBUG - 2025-12-09 16:32:56 --> Callbook lookup for R2VA using qrz: Not found: R2VA

New behavior

I set the config.php config to an array of providers, and the following sequence was returned (providers are tested in the same sequence as defined in the config):

// $config['callbook'] = ['qrz', 'qrzcq'];
DEBUG - 2025-12-09 16:37:49 --> Callbook lookup for R2VA using qrz: Not found: R2VA
DEBUG - 2025-12-09 16:37:50 --> Callbook lookup for R2VA using qrzcq: Errore QRZCQ: Premium Required
// $config['callbook'] = ['qrz', 'qrzcq', 'hamqth'];
DEBUG - 2025-12-09 16:38:30 --> Callbook lookup for R2VA using qrz: Not found: R2VA
DEBUG - 2025-12-09 16:38:31 --> Callbook lookup for R2VA using qrzcq: Errore QRZCQ: Premium Required
DEBUG - 2025-12-09 16:38:32 --> Callbook lookup for R2VA using hamqth: Callsign not found
// $config['callbook'] = ['hamqth', 'qrzcq', 'qrz'];
DEBUG - 2025-12-09 16:51:40 --> Callbook lookup for R2VA using hamqth: Callsign not found
DEBUG - 2025-12-09 16:51:40 --> Callbook lookup for R2VA using qrzcq: Errore QRZCQ: Premium Required
DEBUG - 2025-12-09 16:51:44 --> Callbook lookup for R2VA using qrz: Not found: R2VA

@HB9HIL
Copy link
Contributor

HB9HIL commented Dec 9, 2025

Before we are going to check this PR:

Really well done Pull Request! Simple, Short, Single Feature, Necessary Changes only

Really Really good!

Copy link
Contributor

@phl0 phl0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The basic functionality works for me. But hamqth lib returns error being empty so the check for success will always fail for hamtqth. Added two suggestions to change this behavior.

iu2frl and others added 2 commits December 11, 2025 17:41
Co-authored-by: Florian (DF2ET) <github@florian-wolters.de>
@iu2frl
Copy link
Contributor Author

iu2frl commented Dec 11, 2025

@phl0 I implemented your suggestions

@phl0
Copy link
Contributor

phl0 commented Dec 11, 2025

@phl0 I implemented your suggestions

Seen that. Will re-check.

Copy link
Contributor

@phl0 phl0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for me. We should put an example and some description into config.sample.php (if not in this PR I can add it separately).

@iu2frl
Copy link
Contributor Author

iu2frl commented Dec 12, 2025

@phl0 ok, I will update the wiki later tonight

@AndreasK79
Copy link
Contributor

Tested working here :)

@AndreasK79 AndreasK79 merged commit 39d16d6 into wavelog:dev Dec 13, 2025
@iu2frl
Copy link
Contributor Author

iu2frl commented Dec 14, 2025

I started documenting the config file, with some notes on this feature: Config.php

@phl0
Copy link
Contributor

phl0 commented Dec 14, 2025

I started documenting the config file, with some notes on this feature: Config.php

And I added some description to config.sample.php 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants