Ejemplo n.º 1
0
 Map<String, String> prompt(String id, PromptStruct prompt)
     throws TropoException, SystemException {
   setLogContext(null);
   Call call = getCall(id);
   try {
     Map<String, String> result =
         call.prompt(
             prompt.getTtsOrUrl(),
             prompt.isBargein(),
             prompt.getGrammar(),
             prompt.getConfidence(),
             prompt.getMode(),
             prompt.getWait());
     // System.out.println(result);
     if (LOG.isDebugEnabled()) {
       LOG.debug(result.toString());
     }
     return result;
   } catch (ErrorException e) {
     System.out.println(e.toString());
     throw new TropoException(e.toString());
   } catch (FatalException e) {
     throw new SystemException(e.toString());
   }
 }
Ejemplo n.º 2
0
 void block(String id, int timeout) throws TropoException, SystemException {
   setLogContext(null);
   Call call = getCall(id);
   try {
     call.block(timeout);
   } catch (ErrorException e) {
     throw new TropoException(e.toString());
   } catch (FatalException e) {
     throw new SystemException(e.toString());
   }
 }
Ejemplo n.º 3
0
 void log(String id, String msg) throws TropoException, SystemException {
   setLogContext(null);
   Call call = getCall(id);
   try {
     call.log(msg);
   } catch (ErrorException e) {
     throw new TropoException(e.toString());
   } catch (FatalException e) {
     throw new SystemException(e.toString());
   }
 }
Ejemplo n.º 4
0
 HangupStruct hangup(String id) throws TropoException, SystemException {
   setLogContext(null);
   Call call = getCall(id);
   try {
     call.hangup();
     return new HangupStruct(); // TODO:
   } catch (ErrorException e) {
     throw new TropoException(e.toString());
   } catch (FatalException e) {
     throw new SystemException(e.toString());
   }
 }
Ejemplo n.º 5
0
 CallImpl transfer(String id, TransferStruct t) throws TropoException, SystemException {
   setLogContext(null);
   Call call = getCall(id);
   try {
     return (CallImpl)
         call.transfer(
             t.getTo(),
             t.getFrom(),
             t.isAnswerOnMedia(),
             t.getTimeout(),
             t.getTtsOrUrl(),
             t.getRepeat(),
             t.getGrammar());
   } catch (ErrorException e) {
     throw new TropoException(e.toString());
   } catch (FatalException e) {
     throw new SystemException(e.toString());
   }
 }
Ejemplo n.º 6
0
 public synchronized void dispose() {
   if (_calls != null) {
     for (Call call : _calls.values()) {
       call.hangup();
       if (_notifier != null) {
         try {
           _notifier.hangup(_token, ((CallImpl) call).getId(), new HangupStruct());
         } catch (Exception e) {
           // ignore
         }
       }
     }
     _calls = null;
   }
   if (_transport != null && _notifier != null) {
     try {
       _notifier.unbind(_token);
     } catch (Throwable t) {
       // ignore
     }
     _notifier = null;
     _transport.close();
   }
 }