how to create SIP uri using java.net.URI class? -


the server or can voip provider ekiga.net. want call contact sip:500@ekiga.net. have created sip headers defined in rfc3261 , want create sip uri using uri class. need with.

the purpose creating uri send udp packet contains sip headers , messages server. don't know address use because datagram class needs destination ip , port. know port 5060 don't know url use.

thanks

java don't have built-in support sip, don't need java sip uri.

optionally first might perform dns lookup this:

inetaddress inetaddress =  inetaddress.getbyname("ekiga.net"); 

(this lookup record only. voip should use srv dns records, requires seprate lib , record fine)

then create udp socket this:

datagramsocket socket = new datagramsocket(); 

then send message (buff must hold valid sip message):

socket.send(new datagrampacket(buf, buf.length,  inetaddress.getbyname("ekigaaddresshere"), 5060)); 

then read answer(s) , send other requests.


Popular posts from this blog