]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip_stir_shaken: Fix JSON field ordering and disallowed TN characters.
authorNaveen Albert <asterisk@phreaknet.org>
Fri, 17 Feb 2023 13:45:16 +0000 (13:45 +0000)
committerAsterisk Development Team <asteriskteam@digium.com>
Mon, 8 May 2023 18:13:35 +0000 (18:13 +0000)
commit59c9e4531e830155cd6c3a3c84b68fb964a0f7a5
tree1b46f90d4493c8cc52e7bf709b1d4fa2b6ec3d92
parent99d17db963bc37040b0b1507d5b4086dbbd786e0
res_pjsip_stir_shaken: Fix JSON field ordering and disallowed TN characters.

The current STIR/SHAKEN signing process is inconsistent with the
RFCs in a couple ways that can cause interoperability issues.

RFC8225 specifies that the keys must be ordered lexicographically, but
currently the fields are simply ordered according to the order
in which they were added to the JSON object, which is not
compliant with the RFC and can cause issues with some carriers.

To fix this, we now leverage libjansson's ability to dump a JSON
object sorted by key value, yielding the correct field ordering.

Additionally, telephone numbers must have any leading + prefix removed
and must not contain characters outside of 0-9, *, and # in order
to comply with the RFCs. Numbers are now properly formatted as such.

ASTERISK-30407 #close

Change-Id: Iab76d39447c4b8cf133de85657dba02fda07f9a2
(cherry picked from commit 66a7cff57ecc4514c28071981037afa72ef0d4b9)
include/asterisk/json.h
main/json.c
res/ari/cli.c
res/res_pjsip_stir_shaken.c
res/res_stir_shaken.c