Hello,
I wrote a simple Midlet with eclipseMe on Debian, implementing a SIP client.
I used WTK2.5 as the SIP server.
I saw that the registration msg was received by the SIP server and the authentication request was also generated by the SIP server. Unfortunately, the msg was not received by notifyResponse() although it appeared in wireshark.
Any hint ?
Thanks in advance,
Fabien
public class TestSipClient implements SipClientConnectionListener
{
public void
test(
String msg)
{
try
{
// state->CREATED
SipClientConnection sc = (SipClientConnection) Connector.open("sip:fabien@localhost:5060");
sc.setListener(this);
// state->INTIALIZED
SipConnectionNotifier scn=null;
sc.initRequest("REGISTER", scn);
// Builds the URI for REGISTER
sc.setHeader("To", "sip:fabien@pc-debian");
sc.setHeader("From", "sip:fabien@pc-debian");
sc.setHeader("Contact", "sip:fabien@pc-debian:5060");
// state->PROCEEDING
sc.send();
}
catch (IllegalArgumentException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (SipException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* @param arg0
*/
public void notifyResponse(SipClientConnection sc)
{
// TODO Auto-generated method stub
// wait maximum 15 seconds for response
try
{
System.out.println("Client:notifyResponse");
boolean ok = sc.receive(15000);
if(ok) { // response received
int l_rsp = sc.getStatusCode();
switch(l_rsp)
{
case 100: System.out.println("Client:Essai");
break;
case 180: System.out.println("Client:Sonnerie en cours");
break;
case 181: System.out.println("Client:Appel en cours de transmission");
break;
case 182: System.out.println("Client:En file d'attente");
break;
case 183: System.out.println("Client:Avancement de la session");
break;
case 200: System.out.println("Client:200 OK");
break;
default: System.out.println("Client:status non trait�"+Integer.toString(l_rsp));
}
}
//sc.close();
}
catch (SipException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}