Skip to content

fix: accept sips: URIs when extracting caller info - #241

Open
darwvin-dev wants to merge 1 commit into
VoiSmart:developfrom
darwvin-dev:fix/sips-caller-info
Open

fix: accept sips: URIs when extracting caller info#241
darwvin-dev wants to merge 1 commit into
VoiSmart:developfrom
darwvin-dev:fix/sips-caller-info

Conversation

@darwvin-dev

Copy link
Copy Markdown

Problem

CallerInfo extracts the display name and remote URI from CallInfo.getRemoteUri() using two patterns, and both require a literal sip::

Pattern.compile("^\"([^\"]+).*?sip:(.*?)>$");
Pattern.compile("^.*?sip:(.*?)>$");

The string sips: does not contain the substring sip: — the characters are s, i, p, s, : — so a remote party using a SIPS URI matches neither pattern and falls into the final branch, where both displayName and remoteUri become "Unknown".

For an app registered over SIPS this means incoming calls arrive with no caller ID, and because remoteUri is also "Unknown" there is no address left to call back with. The information is lost inside the library, so consumers cannot recover it from the broadcast.

Fix

Accept either scheme with sips?:. Two characters, no behaviour change for sip: URIs.

Checked against both schemes, with and without a display name:

input displayName remoteUri
"Alice" <sip:1001@pbx.example.com> Alice 1001@pbx.example.com
"Alice" <sips:1001@pbx.example.com> Alice 1001@pbx.example.com
<sip:1001@pbx.example.com> 1001@pbx.example.com 1001@pbx.example.com
<sips:1001@pbx.example.com> 1001@pbx.example.com 1001@pbx.example.com

The first two rows and last two rows previously differed: the sips: cases returned "Unknown".

Branched from current develop.

The two remote-URI patterns required a literal "sip:". The string
"sips:" does not contain "sip:", so a SIPS remote party matched
neither pattern and both the display name and the remote URI fell back
to "Unknown" -- losing caller ID and the number needed to call back.

Accept both schemes with sips?:. Behaviour for sip: URIs is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant