×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    4

    Post SIP Registration

    i hava problem with my midlet i need this midlet so i can register to our Sip server:192.168.100.1 ; username and password 7777

    the problem this midlet can't register to Sip server and return the exception I made by declaring a Flag can get the request result from sip server , if not getting return false and thats always happend return false and directly return the exception

    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */
    import javax.microedition.midlet.*;
    import javax.microedition.sip.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    /**
    * @author Java&C
    */
    public class sip_reg4 extends MIDlet implements CommandListener {
    private SipClientConnection sc = null;
    private Display display;
    private Form iForm;
    private Command exitCommand;
    private String realm;
    private SipHeader sh;
    int refreshID = 0 ;
    int refreshStatus =0 ;
    String contact = null;
    SipRefreshHelper refHelper = null;
    public sip_reg4()
    {
    display = Display.getDisplay(this);
    iForm = new Form("sip_reg");
    exitCommand = new Command("Exit",Command.EXIT,2);
    iForm.addCommand(exitCommand);
    iForm.setCommandListener(this);
    doRegister(7777, 7777, null);
    }
    public void startApp() {
    display.setCurrent(iForm);
    }
    public void pauseApp() {
    }
    public void destroyApp(boolean unconditional) {}
    public void commandAction(Command c, Displayable d) {
    if (c== exitCommand )
    {
    notifyDestroyed();
    }
    }

    public void doRegister(int username, int password, String realm) {
    SipClientConnection scc = null;
    SipConnectionNotifier scn = null;
    try {
    scn = (SipConnectionNotifier) Connector.open("sip:5060");
    scc = (SipClientConnection) Connector.open("sip:192.168.100.1:5060");
    contact = new String("sip:7777@"+scn.getLocalAddress()+":"+scn.getLocalPort());
    scc.initRequest("REGISTER", scn);
    scc.setHeader("From", "sip:7777@192.168.100.1");
    scc.setHeader("To", "sip:7777@192.168.100.1");
    scc.setHeader("Contact", contact);
    scc.setCredentials(Integer.toString(username), Integer.toString(password), "192.168.100.1");
    scc.send();
    boolean flag = scc.receive(5000);
    if(false == flag)
    throw new RuntimeException("Response not arrived1");
    if(scc.getStatusCode()!= 200)
    throw new RuntimeException("status code "+ scc.getStatusCode());
    scc.close();
    } catch(Exception ex) {
    iForm.append("exception"+" "+ ex.getMessage());

    }
    }
    }

  2. #2
    Nokia Developer Champion
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,192

    Re: SIP Registration

    What exception do you get?
    The IP address seems to be a private IP address... does the MIDlet have access to that computer?
    What device are you testing this on?

    Hartti

Similar Threads

  1. Replies: 4
    Last Post: 2009-07-12, 12:31
  2. Sip Registration
    By apus29 in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2008-04-07, 20:01
  3. SIP: BYE/ 481 (No Dialog Found)!!!!!!!!!!
    By Mini Pillai in forum Symbian Networking & Messaging (Closed)
    Replies: 13
    Last Post: 2007-02-09, 04:52
  4. SIP Registration error
    By gamma8 in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2006-11-29, 09:31
  5. SIP registration
    By map123 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2006-09-09, 12:37

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •