Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[BUG] Sip.Builder(String) drops SIP destinations with an explicit port when the scheme is omitted

Open
#982 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java
Domain
api

Research direction

Start at the Sip.Builder(String) constructor in the twiml voice package and trace how the string is parsed into a URI before toXml() serializes it. Reproduce with [email protected]:5060 and confirm the output is <Sip/>. Done when that value serializes as <Sip>[email protected]:5060</Sip> and the existing sip: cases still pass. Ask the maintainers whether a scheme-less address should be prefixed with sip: or kept as given, since the issue leaves that open.

Written by the indexing model from the issue text.

Description

type: bug
Describe the bug

Our call-routing integration accepts a SIP destination in the form user@host:port, without a sip: scheme. When this value is passed to Sip.Builder(String), the Twilio Java SDK silently drops it during TwiML serialization. The generated <Sip> element is empty, so the destination is lost before Twilio receives the request.

Code snippet
import com.twilio.twiml.TwiMLException;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Dial;
import com.twilio.twiml.voice.Sip;

public class Main {
    public static void main(String[] args) throws TwiMLException {
        Sip sip = new Sip.Builder("[email protected]:5060").build();
        Dial dial = new Dial.Builder().sip(sip).build();
        VoiceResponse response = new VoiceResponse.Builder().dial(dial).build();

        System.out.println(response.toXml());
    }
}
Actual behavior

The generated TwiML contains an empty SIP noun:

<Response><Dial><Sip/></Dial></Response>

No SDK error is reported.

Expected behavior

The SDK should preserve this supported destination in the TwiML body:

<Sip>[email protected]:5060</Sip>
twilio-java version

13.0.2

Java version

OpenJDK 21.0.7

Logs or error messages

The SDK does not report an error.

Additional context

The Twilio SDK appears to parse the value as a generic Java URI. The explicit port causes the parser to treat the preceding text as a URI scheme; it rejects the @ and the SDK serializes a null URI as <Sip/>.

Adding sip: makes the SDK preserve the destination, but our integration accepts the address without that prefix.

Dominant language
Java
Stars
529
Forks
453
Avg merge
1h 14m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from twilio/twilio-java

All issues in twilio/twilio-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.