How to check Stir Shaken TN existence from dialplan?

Hello,

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).

Thoughts ?

Best regards

I think those are reasonable requests. You can submit such a feature request here[1].

[1] GitHub · Where software is built

Since res_stir_shaken uses Sorcery as its config backend, you can use the AST_SORCERY() dialplan function to retrieve the info…

${AST_SORCERY(res_stir_shaken,tn,18005551212,attest_level)}

This is the same mechanism that any STIR_SHAKEN-specific function would use.

STIR_SHAKEN_TN_DETAIL() could still be useful though since AST_SORCERY can only return 1 field at a time.

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.

So AST_SORCERY is perfect for me.

Thank you for replying

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.