• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I wrote a sip Servlet. I need to watch call count continuously

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,

I wrote a Sip Servlet . Sip Clients talks over me. This is OK.
Now i need to calculate call counts between them. May be this is simple but i need much more than this.
For example REMANING_CALL_DURATION between 2 clients is 1 hour or 28 minutes,etc.
My Application have to warn them in their last 1 minute.

To be clear i will tell in the code sample.

XxxSipServlet extends SipServlet implements Servlet {
..
..
public void doAckReceived(SipServletRequest request) {
...
..
//Here in this method i understand the call is established
between two clients.
...
}


public void byeReceived(SipServletRequest request) {
..
..
//Here in this method i understand the call is ended.
..
}
..
}

What can i do ? Any Suggestions or code examples will be appreciated.

Thanks a lot. :roll:

[ November 15, 2008: Message edited by: Bear Bibeault ]
[ November 15, 2008: Message edited by: alp carsikarsi ]
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"a oz", please check your private messages for an important administrative matter.
 
alp carsikarsi
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found a solution but i need help ... Please somebody help me ?
In AlpTimerTask's run method servlet.activeSipCallSessions is null.
But actually activeSipCallSessions can't be null.
Why i see it null in my TimerTask's run method ?
What will i do ?

Here is some part of my code :

AlpSipServlet

public class AlpSipServlet extends SipServlet implements Servlet {
..
public static HashMap activeSipCallSessions = new HashMap();
..
public void init(ServletConfig sc) throws ServletException {
..
timer = new Timer();
timer.schedule(new AlpTimerTask("Listen Remaning Call Count",this), 10000, 50000);
..
}

public void doAckReceived(SipServletRequest request)
{
..
AlpSipServlet.activeSipCallSessions.put(sipAppSession.getId(), sipAppSession);
..
}

public void byeReceived(SipServletRequest request)
{
..
AlpSipServlet.activeSipCallSessions.remove(sipAppSession.getId());
..
}

In my AlpTimerTask.java :

public class AlpTimerTask extends TimerTask {
..
private AlpSipServlet servlet = null;
..
public AlpTimerTask(String name,AlpSipServlet servlet) {
this.name = name;
this.servlet =servlet;
}

public void run() {
logger.debug("<AlpTimerTask.run>Do something!!!");
Collection activeCalls = null;
if (servlet.activeSipCallSessions != null)
activeCalls = servlet.activeSipCallSessions.values();

if (activeCalls != null)
for (Iterator iterator = activeCalls.iterator(); iterator.hasNext() {
SipApplicationSession sipAppSession = (SipApplicationSession) iterator.next();
logger.debug(" Active call session id : " + sipAppSession.getId());
}
if (activeCalls == null || activeCalls.size() == 0)
logger.debug("No active calls.");

}

}
reply
    Bookmark Topic Watch Topic
  • New Topic