Question

I am just starting to look at Jain Sip and I was wondering how to create a SipUri that only contains the ip address and does not contain the user and the @ symbol.

So currently I get sip:user@192.xxx.x.xxx and I want to get sip:192.xxx.x.xxx

My code is below but, I can remove the User but I cant seem to get rid of the @ symbol, has anyone any ideas how to do this?

 SipURI toAddress = addressFactory
            .createSipURI(toUser, toSipAddress);
    toAddress.removeParameter(toUser);
    Address toNameAddress = addressFactory.createAddress(toAddress);
    toNameAddress.setDisplayName(toDisplayName);
    ToHeader toHeader = headerFactory.createToHeader(toNameAddress,
            null);
Was it helpful?

Solution 2

I used a normal Uri address rather than a SipUri

OTHER TIPS

you can create sip type address without @ and user name like the following one:

SipUri ProxyUri = new SipUri();
    ProxyUri.setHost(Profile.getProxyIp());
    ProxyUri.setPort(Profile.getProxyPort());
    Address proxyAddress = SipUA.addressFactory.createAddress(ProxyUri);
    RouteHeader RouteProxy = SipUA.headerFactory
            .createRouteHeader(proxyAddress);
    ClonedResponse.addHeader(RouteProxy);

moreover you can try to set touser="";

SipURI toAddress = addressFactory
        .createSipURI("", toSipAddress);

Address toNameAddress = addressFactory.createAddress(toAddress);

ToHeader toHeader = headerFactory.createToHeader(toNameAddress,
        null);
SipURI toAddress = addressFactory
            .createSipURI(null, toSipAddress);

will work

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top