8 Replies - 579 Views - Last Post: 17 December 2013 - 10:58 AM

#1 vamsi1234  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 03-October 13

SipSessionsUtil cannot be resolved a type

Posted 16 December 2013 - 04:16 AM

<%@ page import="java.util.HashMap"%>
<%@ page import="org.mobicents.servlet.sip.example.*"%>
<%@ page import="javax.servlet.sip.*"%> 
<html>
<title>Click To Call Demo</title>
<head>
<style>
body { font-family: Tahoma, Geneva, 'Trebuchet MS', Arial, Helvetica, sans-serif; }

.calltable, a {
	border: 1px solid #D4E0EE;
	border-collapse: collapse;
	font-family: "Trebuchet MS", Arial, sans-serif;
	color: #555;
}

.headtable {
	border: none;
	width: 100%;
}

td.calltable, tr {
	padding: 4px;
border: 1px dotted black;
}
</style>
</head>
<body>
<table class="headtable"><tr>
<td style="vertical-align:middle"><img alt="Mobicents" src="images/mobicents.logo.jpeg"/>
<a style="font-size: 30px;margin-left:100px"><b>Click-to-Call Sample Application</b></a></td>
</tr></table>
<hr/>
<%
SipSessionsUtil sessionsUtil = (SipSessionsUtil) getServletContext().getAttribute("javax.servlet.sip.SipSessionsUtil");
SipApplicationSession sipApplicationSession = sessionsUtil.getApplicationSessionByKey("registeredUsersMapAppSession", false);
HashMap<String, String> users = null;
if(sipApplicationSession != null) {
	users = (HashMap<String, String>) sipApplicationSession.getAttribute("registeredUsersMap");
}
if(users == null) {
	out.println("<a>No registered users. Please register at least two SIP User Agents.</a><br/>");
} else {
	String[] userArray = new String[0];
	userArray = users.keySet().toArray(userArray);

	 // Create app session and request
    SipApplicationSession appSession = 
    	((ConvergedHttpSession)request.getSession()).getApplicationSession();
    
    CallStatusContainer calls = (CallStatusContainer) appSession.getAttribute("activeCalls");
	
	out.println("<table class=\"calltable\">");
	out.println("<tr><td bgcolor=\"#DDDDDD\">From \\ To</td>");
	for(String col:userArray) out.println("<td class=\"calltable\" bgcolor=\"#EEEEEE\"><b>" + col + "</b></td>");
	out.println("</tr>");
	for(String fromAddr:userArray) {
		out.println("<tr><td bgcolor=\"#EEEEEE\"><b>"+fromAddr +"</b></td>");
		String fromAddrV = users.get(fromAddr);
		for(String toAddr:userArray) {
			if(!toAddr.equals(fromAddr)) {
				String toAddrV = users.get(toAddr);
				String status = calls==null? null:calls.getStatus(fromAddrV, toAddrV);
				if(status == null) status = "FFFFFF"; // This is hex RGB color
				if(status.equals("FFFFFF"))
					out.println("<td class=\"calltable\" bgcolor=\"#" + status 
						+ "\" align=\"center\"><a href=\"call?to="
						+ users.get(toAddr) + "&from="
						+ users.get(fromAddr) +"\"\">call</a></td>");
				else
					out.println("<td class=\"calltable\" bgcolor=\"#" + status 
							+ "\" align=\"center\"><a>call in progress </a><a href=\"call?to="
							+ users.get(toAddr) + "&bye=true&from="
							+ users.get(fromAddr) +"\"\">end</a></td>");
				
			} else {
				out.println("<td class=\"calltable\" ></td>");
			}
		}
		out.println("<tr>");
	}
	out.println("</table>");
	out.println("<br/><a href=\"call?bye=all\">Close all calls</a>");
}

%>
</body>
</html>



im getting these errors please any help me in this is error
SipSessionsUtil CallStatusContainer cannot be resolved to a type

This post has been edited by Atli: 16 December 2013 - 04:51 AM
Reason for edit:: Fixed the [code] tags.


Is This A Good Question/Topic? 0
  • +

Replies To: SipSessionsUtil cannot be resolved a type

#2 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1152
  • View blog
  • Posts: 2,530
  • Joined: 05-May 05

Re: SipSessionsUtil cannot be resolved a type

Posted 16 December 2013 - 03:05 PM

Is the library on the classpath?
Was This Post Helpful? 0
  • +
  • -

#3 vamsi1234  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 03-October 13

Re: SipSessionsUtil cannot be resolved a type

Posted 16 December 2013 - 09:19 PM

how to import that library
i have already imported but its showing cannot be resolved
<%@ page import="javax.servlet.sip.*"%>
Was This Post Helpful? 0
  • +
  • -

#4 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1152
  • View blog
  • Posts: 2,530
  • Joined: 05-May 05

Re: SipSessionsUtil cannot be resolved a type

Posted 16 December 2013 - 09:23 PM

Yes, importing the library and adding the library to your classpath are different things. Have you downloaded the library (a JAR file) and added its path to the server (JBoss I'm assuming) CLASSPATH?

This post has been edited by blackcompe: 16 December 2013 - 09:23 PM

Was This Post Helpful? 0
  • +
  • -

#5 vamsi1234  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 03-October 13

Re: SipSessionsUtil cannot be resolved a type

Posted 16 December 2013 - 09:24 PM

ill try it
thanking you
Was This Post Helpful? 0
  • +
  • -

#6 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1152
  • View blog
  • Posts: 2,530
  • Joined: 05-May 05

Re: SipSessionsUtil cannot be resolved a type

Posted 16 December 2013 - 09:34 PM

No problem. You can start by browsing through the JBoss AS docs. Also have a look at this. If you're deploying your application as a WAR, the JARs can go in WEB-INF\lib, but there are other ways of recognizing 3rd party libs depending on your operating mode.
Was This Post Helpful? 0
  • +
  • -

#7 vamsi1234  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 03-October 13

Re: SipSessionsUtil cannot be resolved a type

Posted 16 December 2013 - 09:58 PM

i have downloaded sip-servlet.jar,sip-api.jar,javax.servlet.jar,log4j.jar,commom-loggings.jar and added to the class path but same error getting
Was This Post Helpful? 0
  • +
  • -

#8 vamsi1234  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 03-October 13

Re: SipSessionsUtil cannot be resolved a type

Posted 16 December 2013 - 10:10 PM

thankink you very much now working

but i am getting some warning
(HashMap<String, String>) sipApplicationSession.getAttribute("registeredUsersMap")
Type safety: Unchecked cast from Object to HashMap<String,String>
Was This Post Helpful? 0
  • +
  • -

#9 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1152
  • View blog
  • Posts: 2,530
  • Joined: 05-May 05

Re: SipSessionsUtil cannot be resolved a type

Posted 17 December 2013 - 10:58 AM

You're using all these advanced programming libraries and servers, yet you don't know how to fix a simple type safety warning? Seems like you need to go back to the basics and start reviewing fundamental Java resources. Futhermore, a simple Google search would help you to solve this error quickly.

Anyway, the only option is to supress the warning. I'm guessing that API is pre-generics, so things like that typically occur.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1