Hi,
i am just trying to make a sip client with jsr180.
i send register request to server and get response 200. I follow this with ethereal.
But in the code i cannot handle the response.
I receive "Received Response: 0" on the console which is the initilazed value.
Would you see what is wrong with the code.
does scc.receive() listening on wrong port or something?
Thanks..
Mustafa
Here is the related code part:
scc.send(); // i send the register request successfully
boolean handled = false;
int scode = 0;
while(!handled) {
SipHeader sh;
// wait max 3 secs for response
scc.receive(3000);
scode = scc.getStatusCode();
System.out.println( "Received Response: " + scode );
switch(scode)
{
case 401:
sh = new SipHeader("WWW-Authenticate",
scc.getHeader("WWW-Authenticate"));
realm = sh.getParameter("realm");
// here for example, prompt user for password for this realm
// set credentials to initiate re-REGISTER
scc.setCredentials(username, password, realm);
break;
case 407:
sh = new SipHeader("Proxy-Authenticate",
scc.getHeader("Proxy-Authenticate"));
realm = sh.getParameter("realm");
// here for example, prompt user for password for this realm
// set credentials to initiate re-REGISTER
scc.setCredentials(username, password, realm);
break;
case 200:
// handle OK response
handled = true;
break;
default:
// do NOT handle other responses
handled = false;
}
}
scc.close();
}
Edit/Delete Message

Reply With Quote


