예제 #1
0
  @Override
  public IQ createServiceRequest(Object object, String fromNode, String toNode) {
    if (object instanceof JingleIQ) {
      final IQ request = new IQ(IQ.Type.set);
      if (toNode.indexOf("00") == 0) {
        toNode = "+" + toNode.substring(2);
      }
      final JID to = JIDFactory.getInstance().getJID(null, creditService, null);
      final JID from =
          JIDFactory.getInstance().getJID(fromNode, this.getComponentJID().getDomain(), null);
      final JingleIQ jingleIQ = (JingleIQ) object;
      request.setTo(to);
      request.setFrom(from);
      request.setChildElement(requestElement.createCopy());
      final String toBareJid =
          JIDFactory.getInstance().getJID(toNode, creditService, null).toBareJID();

      final Element e = request.getChildElement();
      e.addAttribute("initiator", from.toBareJID());
      e.addAttribute("responder", toBareJid);
      e.addAttribute("sid", jingleIQ.getJingle().getSid());
      log.debug("createCreditRequest: " + request.toXML());
      return request;
    }
    return null;
  }
예제 #2
0
 @Override
 protected String getRequestId(Object obj) {
   if (obj instanceof JingleIQ) {
     final JingleIQ iq = (JingleIQ) obj;
     return iq.getJingle().getSid();
   }
   return null;
 }
예제 #3
0
 @Override
 public boolean proceedInitiate(JingleIQ iq, final CallSession session) {
   JID initiator = JIDFactory.getInstance().getJID(iq.getJingle().getInitiator());
   if (sipToJingleBind != null) {
     final JID sipFrom = sipToJingleBind.getSipFrom(initiator);
     if (sipFrom != null) {
       iq.getJingle().setInitiator(sipFrom.toString());
     }
   }
   return true;
 }
예제 #4
0
 @Override
 public boolean prepareInitiate(JingleIQ iq, final CallSession session) {
   JID initiator = JIDFactory.getInstance().getJID(iq.getJingle().getInitiator());
   if (sipToJingleBind != null) {
     final JID sipFrom = sipToJingleBind.getSipFrom(initiator);
     if (sipFrom != null) {
       return true;
     } else {
       try {
         accountServiceProcessor.queryService(iq, null, initiator.getNode(), this);
       } catch (ServiceException e) {
         log.error("Failed Querying Account Service.", e);
       }
     }
   }
   return false;
 }