To block all incoming calls except some based on a prefix, you can do:
dconf write /sailfish/voicecall/filter/ignored-numbers ["*"]
dconf write /sailfish/voicecall/filter/whitelist ["^+3956"]
The logic for the filtering is based on :
// Give priority to exact matching.
if (m_whitelist.exactMatch(recipient.remoteUid())) {
return FILTER_APPROVE;
} else if (m_rejected.exactMatch(recipient.remoteUid())) {
return FILTER_REJECT;
} else if (m_ignored.exactMatch(recipient.remoteUid())) {
return FILTER_IGNORE;
} else if (m_whitelist.match(recipient)) {
return FILTER_APPROVE;
} else if (m_rejected.match(recipient)) {
return FILTER_REJECT;
} else if (m_ignored.match(recipient)) {
return FILTER_IGNORE;
} else {
return FILTER_NO_MATCH;
}
And the matching function for each list is :
for (const QString &filter : list()) {
if (filter.startsWith('+') || filter[0].isDigit()) {
// Exact number matching
if (recipient.matchesRemoteUid(filter)) {
return true;
}
} else if (filter.startsWith('^')) {
// Prefix matching
if (recipient.remoteUid().startsWith(filter.mid(1))) {
return true;
}
} else if (filter == QStringLiteral("*")) {
// All
return true;
} else {
qCWarning(voicecall) << "unknown filter" << filter;
}
}
return false;
These are taken from voicecall/plugins/filter/lib at master · sailfishos/voicecall · GitHub for those interested in modifying or improving the code. Note also that this plugin is exporting a library, that can be used in application to change the lists programmatically.