{"action":"opened","issue":{"url":"https://api.github.com/repos/Metaswitch/sprout/issues/1267","labels_url":"https://api.github.com/repos/Metaswitch/sprout/issues/1267/labels{/name}","comments_url":"https://api.github.com/repos/Metaswitch/sprout/issues/1267/comments","events_url":"https://api.github.com/repos/Metaswitch/sprout/issues/1267/events","html_url":"https://github.com/Metaswitch/sprout/issues/1267","id":117830014,"number":1267,"title":"Adding a second P-Asserted-Identity isn't quite right","user":{"login":"eleanor-merry","id":5425325,"avatar_url":"https://avatars.githubusercontent.com/u/5425325?v=3","gravatar_id":"","url":"https://api.github.com/users/eleanor-merry","html_url":"https://github.com/eleanor-merry","followers_url":"https://api.github.com/users/eleanor-merry/followers","following_url":"https://api.github.com/users/eleanor-merry/following{/other_user}","gists_url":"https://api.github.com/users/eleanor-merry/gists{/gist_id}","starred_url":"https://api.github.com/users/eleanor-merry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eleanor-merry/subscriptions","organizations_url":"https://api.github.com/users/eleanor-merry/orgs","repos_url":"https://api.github.com/users/eleanor-merry/repos","events_url":"https://api.github.com/users/eleanor-merry/events{/privacy}","received_events_url":"https://api.github.com/users/eleanor-merry/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-19T14:53:12Z","updated_at":"2015-11-19T14:53:12Z","closed_at":null,"body":"We add a second P-Assserted-Identity header if:\r\n* There's a single P-Asserted-Identity header that's a SIP URI\r\n* The SIP URI has a Tel URI alias (determined at https://github.com/Metaswitch/sprout/blob/dev/src/scscfsproutlet.cpp#L1798).\r\n\r\nThis logic means that we only add the second header if the Tel URI exactly matches the SIP URI (including any +'s). This isn't right - the aliases don't have to exactly match. \r\n\r\nInstead we should:\r\n* Do comparisons on pj_strs, not strings (so we can use the URIclassifier and get the global enforce flag for free)\r\n* Check if there's an exact match in the alias list, and use that Tel URI if so\r\n* If not, use the first Tel URI in the aliases list.\r\n\r\n(We also add a SIP URI header if there's a single Tel URI P-Asserted-Identity header - this function doesn't need to change)"}}