Hello,
I'm working at a project for my study. Since I'm not very experienced in
Java and networking programming, I experience diffculties and would like to
ask for some help. I've been reading about SIP Servlets and trying to do
what I want for the last few days.

My goal is to implement an SMSC-like functionality using SIP and the MESSAGE
method. My SMSC equivalent is a SIP Servlet acting as proxy. I am testing
the app using Twinkle where I entered the Sailfin local SIP address as
Outbound Proxy. Now the application logic:
A user sends a MESSAGE method with the "To" field filled in, then it is
handled by the servlet. The servlet stores the message in its internal
data_base_ and then it should try to send it directly to the recipient. It
should also send a confirmation to the sender as another MESSAGE method. The
specification of the project says:
The SMSC tries to connect directly to the recipient - in case of SIP we
assume that it means sending a MESSAGE method to the proxy determined by the
domain part of the receiver's address. If it doesn't succeed, it is repeated
x times. After success, the application sends a confirmation to the sender.
Now I have problems with understanding the proxying mechanism in SIP
servlets. I followed one of the examples and wrote a method like this:


 @Override
    protected void doMessage(SipServletRequest req)
    throws ServletException, IOException
    {
        SmsMessage msg = new SmsMessage(req.getTo().toString(),
                  (String)req.getContent());
        ExtendedSmsMessage emsg = saveMessage(msg, req.getFrom());
        // saves in internal db and appends some data

        try {
            if (req.isInitial()) {
                Proxy p = req.getProxy();
                p.proxyTo(req.getRequestURI());
                req.createResponse(SipServletResponse.SC_OK).send();
            }
            System.out.println("OK");
        }
        catch (Exception e) {
            req.createResponse(SipServletResponse.SC_OK).send();
            localdb.remove(emsg.getId());
            e.printStackTrace();
            System.out.println("ERR");
        }
        printDatabaseInfo();
    }


To be honest, I just don't get what the two "proxy" lines of code actually
do and what it means to deliver the message to the domain proxy. Could you
please give me some hints how I can know the delivery status - it is the
crucial element for me. I should have no problems with the other parts,
timers and so on. I really hope you can help me :)
Cheers
Darek
_______________________________________________
Sip-implementors mailing list
[email protected]
https://lists.cs.columbia.edu/cucslists/listinfo/sip-implementors

Reply via email to