I am creating a J2ME streaming audio player with RTP support and through SIP . I am also new to this. I want to deeply study these things. If someone knows a good working code example demonstrating the streaming of an audio player with RTP (this means sending a REGISTER message to the server via SIP to register and send an INVITE message and get a response and playback). Please let me know highly appreciated.
I also looked here
if
My server port is 6060
ip 111.111.111.1
id - password myid 123
Did I use the code correctly? If I am wrong, make me right.
public void doRegister(String username, String password, String realm) { SipClientConnection scc = null; SipConnectionNotifier scn = null; String contact = null; try { scn = (SipConnectionNotifier) Connector.open("sip:5080"); contact = new String("sip:myid: 123@ "+scn.getLocalAddress()+":"+scn.getLocalPort()); scc = (SipClientConnection) Connector.open("sip:111.111.111.1+"transport=tcp") ; scc.initRequest("REGISTER", scn); scc.setHeader("From", "sip:myid: 123@ "+scn.getLocalAddress()+":5080"); scc.setHeader("To", "sip:myid: 123@111.111.111.1 "); scc.setHeader("Contact", contact); scc.send(); boolean handled = false; int scode = 0; while(!handled) { SipHeader sh; scc.receive(30000); scode = scc.getStatusCode(); switch(scode){ case 401: sh = new SipHeader("WWW-Authenticate", scc.getHeader("WWW-Authenticate")); realm = sh.getParameter("realm"); scc.setCredentials(username, password, realm); break; case 407: sh = new SipHeader("Proxy-Authenticate", scc.getHeader("Proxy-Authenticate")); realm = sh.getParameter("realm"); scc.setCredentials(username, password, realm); break; case 200: handled = true; break; default: handled = true; } } scc.close(); } catch(Exception ex) { // handle Exceptions } }
I got a response with 180 Rigging . Also let me know that there is a kingdom . scc.setCredentials(username, password, realm);
source share