File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes J2ME Audio Streaming through SIP Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "J2ME Audio Streaming through SIP Connection" Watch "J2ME Audio Streaming through SIP Connection" New topic
Author

J2ME Audio Streaming through SIP Connection

Dhanushka Nayanananda
Greenhorn

Joined: Jan 16, 2011
Posts: 14
I am creating a J2ME real time streaming audio player with RTP and through SIP connection.Also I am new for these things.I want to take look deeply those things.If any one know a good working sample code demonstrating an audio audio player streaming with RTP (That means how to send a REGISTER message to the server through SIP to get registered and send an INVITE message and get the response & play) please let me knowhighly appreciated.

Also I looked (http://mobilezoo.biz/jsr/180/javax/microedition/sip/SipClientConnection.html#setCredentials(java.lang.String, java.lang.String, java.lang.String) )

if
My server port is 6060
ip 111.111.111.1
id is myid password 123

Have I used the code correctly?If I am wrong,please make me correct.

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@"+scn.getLocalAddress()+":"+scn.getLocalPort());
scc = (SipClientConnection) Connector.open("sip:111.111.111.1") ;
scc.initRequest("REGISTER", scn);
scc.setHeader("From", "sip:myid@sample.com");
scc.setHeader("To", "sip:myid@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 respond with 401 Unauthorized message. Also let me know what is realm here. scc.setCredentials(username, password, realm);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: J2ME Audio Streaming through SIP Connection
 
Similar Threads
realm-name
HELP
Msg not received by SIP client
With BASIC authentication, how get reauthentication?
Tomcat 6.0.26: Manager with DIGEST authentication