{
RequestEvent req_event = requestEvent.getRequestEvent();
Request req_msg = req_event.getRequest();
SipProvider provider = (SipProvider) req_event.getSource();
JipletSession session = null;
if (req_msg.getMethod().equals(Request.INVITE) == true)
{
session = requestEvent.getSession(true);
synchronized (callIdLock)
{
callId++;
info ("SIP session " + callId + " created.");
session.setAttribute("callId", new Integer(callId));
ListeningPoint lp = provider.getListeningPoints()[0];
session.setAttribute("requestSourceIp", new String(lp.getIPAddress()));
session.setAttribute("requestSourcePort", new Integer(lp.getPort()));
}
}
else
{
session = requestEvent.getSession(false);
if (session != null)
{
Integer c = (Integer) session.getAttribute("callId");
if (c != null)
{
info("SIP request message received for session " + c);
}
}
if (req_msg.getMethod().equals(Request.BYE) == true)
{
if (session != null)
{
session.invalidate();
}
}
}
// Act as a stateless proxy. Forward the message to the phone.