本文整理汇总了Java中org.jivesoftware.openfire.sip.calllog.CallLogExtension类的典型用法代码示例。如果您正苦于以下问题:Java CallLogExtension类的具体用法?Java CallLogExtension怎么用?Java CallLogExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CallLogExtension类属于org.jivesoftware.openfire.sip.calllog包,在下文中一共展示了CallLogExtension类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: logReceived
点赞 2
import org.jivesoftware.openfire.sip.calllog.CallLogExtension; //导入依赖的package包/类
public IQ logReceived(IQ iq) {
String username = iq.getTo().toBareJID().split("@")[0];
if (username != null) {
CallLog callLog = new CallLog(username);
Element pe = iq.getChildElement().element("callLog");
if (pe != null) {
Element numA = pe.element("numA");
Element numB = pe.element("numB");
Element duration = pe.element("duration");
Element type = pe.element("type");
callLog.setNumA((numA != null) ? numA.getTextTrim() : "");
callLog.setNumB((numB != null) ? numB.getTextTrim() : "");
callLog.setDateTime(new Date().getTime());
callLog.setDuration((duration != null) ? Integer.parseInt(duration.getText()) : 0);
if (type != null && "loss".equals(type.getTextTrim())) {
// Backwards compatibility change
type.setText("missed");
}
callLog.setType((type != null) ? CallLog.Type.valueOf(type.getTextTrim()) : CallLog.Type.dialed);
try {
CallLogDAO.insert(callLog);
} catch (SQLException e) {
Log.error(e.getMessage(), e);
}
}
}
iq.setType(IQ.Type.result);
iq.deleteExtension(CallLogExtension.ELEMENT_NAME, CallLogExtension.NAMESPACE);
Element childElement = iq.getChildElement();
if (childElement != null) {
Element childElementCopy = childElement.createCopy();
iq.setChildElement(childElementCopy);
}
return iq;
}
开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:45,
代码来源:LogListenerImpl.java