code: protected AgiChannel getChannel()
      {
          AgiChannel threadBoundChannel;
  
          if (channel != null)
          {
              return channel;
          }
  
          threadBoundChannel = AgiConnectionHandler.getChannel();
          if (threadBoundChannel == null)
          {
              throw new IllegalStateException("Trying to send command from an invalid thread");
          }
  
          return threadBoundChannel;
      }
docs: Returns the channel to operate on.
  
  @return the channel to operate on.
  @throws IllegalStateException if no {@link AgiChannel} is bound to the
  current channel and no channel has been passed to the
  constructor.