When routing incoming calls according local regulation, it may be useful to check if a caller ID currently has a corresponding TN value in tns.stir_shaken.conf file.
One way to implement this check is to query the database with which tns.stir_shaken.conf file.content is built but this method ignores inconsistencies between Asterisk config and database content.
An alternative is to use AST_CONFIG but it has some downsides with potential inconsistencies between file content and in memory values.
What about adding a STIR_SHAKEN_TN_EXISTS() function that would either return 0 or 1 when being passed an E164 value as argument ?
Maybe a STIR_SHAKEN_TN_DETAIL function returning details (attestation level, cert, …) currently attached to a TN could serve both purposes (replying if an E164 value is a known TN and returning some detail about a given TN).
AST_SORCERY is very interesting as it retrieves “live” data.
On an Asterisk 20.8 era instance I’m testing with, using the above example, I see that if 18005551212 is missing from tns.strir_shaken.conf, then AST_SORCERY returns an empty string.
Is it still the same with latest Asterisk versions ?
Said differently, if AST_SORCERY always return an empty string when given E164 value is missing from tns.strir_shaken.conf, then AST_SORCERY is fine for me.
AST_SORCERY will return an empty string if the object(tn), id(18005551212) or field(attest_level) aren’t found. If the module(res_stir_shaken) can’t be found, an ERROR message will be generated but the others are silent.