×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    8

    SIP MESSAGE initResponse problem

    Hi,

    I'm facing problems sending SIP MESSAGEs on my S60 3rd edition handsets.
    My code is largely based on the SIP examples that came along with 3rd edition SDK. What it does is it sends a SIP MESSAGE to a SIP server (which is the SIP registrar as well) which forwards it to the receiving handset. The receiving handset on receiving the SIP MESSAGE then returns a response to the sending handset, through the SIP server as well.

    However I am having problems generating the 200 response on the handset. When I view the server logs, I am unable to see the response reaching the server at all.

    Here is the code:
    Here I am trying to send a MESSAGE in a class that implements SipClientConnectionListener.

    Code:
    private void sendMessage() {
          //Add code for sendMessage here..
          SipClientConnection sc = null;
          
          try{
    
        	  sc = (SipClientConnection) Connector.open(address.getString());
        	  sc.setListener(this);
        	  String text = message.getString();
        	  sc.initRequest("MESSAGE", scn_reg);
          	  sc.setHeader("From", 
    "sip:" + username_send.getString()+"@xxsoftware.com");
        	  sc.setHeader("Subject", subject.getString());
        	   sc.setHeader("Content-Type", MIME_TYPE);
        	  sc.setHeader("Content-Length", ""+text.length());
        	  //sc.setHeader("Expires", "300");
        	  sc.setHeader("Accept-Contact", "*;type=\"text/plain\"");
        	  sc.setHeader("Contact", contact_reg);
        	  OutputStream os = sc.openContentOutputStream();
        	  os.write(text.getBytes());
        	  os.close(); //close and send out
          } catch (Exception e) {
        	  System.out.print("SendMessage: ");
        	  e.printStackTrace();
          }
        }
    My notifyResponse method just appends the response code to a form and displays it.

    Here is the code for the receiving handset in a class implementing SipServerConnectionListener:


    Code:
    public void receiveMessage() {
        //Add code for receiveMessage here...
    	  try {
    
    		  if (scn_recv != null) scn_recv.close();
    
    		  scn_recv = (SipConnectionNotifier)  Connector.open("sip:*;type=\"text/plain\"");
    		  scn_recv.setListener(this);
    
    	  } catch (Exception e) {
    		  e.printStackTrace();
    	  }
    }
    And this is the notifyRequest method:

    Code:
    public void notifyRequest(SipConnectionNotifier scn) {
      
    	  try {
    		
    		ssc = scn.acceptAndOpen();
    	
    		System.out.println("Call-ID: " + ssc.getHeader("Call-ID")); 
                    //ssc.getHeader("Call-ID") returns null even though
                    //the server logs show that the message contains Call-ID header
    		System.out.println("CSeq: " + ssc.getHeader("CSeq"));
    		//same as getHeader for Call-ID
    		if (ssc.getMethod().equals("MESSAGE")){
    
    			processMessage();
    			
    			ssc.initResponse(200); //send 200 OK
    			ssc.send();
    			
    		}
    	} catch (Exception e){
    		form_recv.append("notifyRequest exception: "+e);
    	}
    
      }
    Both the sending and receiving handsets are S60 3rd edition phones (testing was done on N73, N91, N93) and registration was done successfully on the SIP registrar before sending and receiving was initiated.

    Like I said I am unable to see the 200 OK response being sent to the SIP server at all. But the phone returns no Exception when the initResponse and send methods are executed. But the code works fine when I send from emulator to emulator

    And does anyone know why the SipServerConnection would return null when I getHeader for Call-ID and CSeq even though the request contains these 2 headers?

    Could anyone help? Thanks
    Last edited by badquek; 2006-11-03 at 07:35.

  2. #2
    Regular Contributor
    Join Date
    Jan 2007
    Location
    Bangalore, India
    Posts
    100

    Re: SIP MESSAGE initResponse problem

    Even iam facing the same problem of sending 200 OK response using the initResponse method of SipServerConnection class. If you have got the solution please let me know as even iam stuck at the same place as you were.
    Please let me know how did you solve this problem please.
    Thanks in advance

Similar Threads

  1. Missing Contact attribute in SIP 200 OK Message
    By relliott97 in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2005-01-18, 04:21
  2. problem to send Service Loading push message over 8310
    By alinesimon in forum Mobile Web Site Development
    Replies: 3
    Last Post: 2002-10-23, 07:08
  3. problem to send a service loading message push for 8310
    By alinesimon in forum General Messaging
    Replies: 1
    Last Post: 2002-05-06, 12:39
  4. Problem to send a service loading push message for 8310
    By alinesimon in forum General Messaging
    Replies: 1
    Last Post: 2002-05-06, 11:19
  5. Problem to send a service loadinfd push message for 8310
    By alinesimon in forum Smart Messaging
    Replies: 1
    Last Post: 2002-05-03, 10:49

Posting Permissions

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