Revision
16149
Author
dvarnes
Date
2010-01-05 05:32:20 -0600 (Tue, 05 Jan 2010)

Log Message

Implement SendMsg for inbound client

Modified Paths

Diff

Modified: freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/Client.java (16148 => 16149)


--- freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/Client.java	2010-01-05 11:31:24 UTC (rev 16148)
+++ freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/Client.java	2010-01-05 11:32:20 UTC (rev 16149)
@@ -28,6 +28,7 @@
 import org.freeswitch.esl.client.IEslEventListener;
 import org.freeswitch.esl.client.internal.IEslProtocolListener;
 import org.freeswitch.esl.client.transport.CommandResponse;
+import org.freeswitch.esl.client.transport.SendMsg;
 import org.freeswitch.esl.client.transport.event.EslEvent;
 import org.freeswitch.esl.client.transport.message.EslMessage;
 import org.jboss.netty.bootstrap.ClientBootstrap;
@@ -345,6 +346,22 @@
     }
 
     /**
+     * Send a {@link SendMsg} command to FreeSWITCH.  This client requires that the {@link SendMsg}
+     * has a call UUID parameter.
+     *  
+     * @param sendMsg a {@link SendMsg} with call UUID
+     * @return a {@link CommandResponse} with the server's response.
+     */
+    public CommandResponse sendMessage( SendMsg sendMsg )
+    {
+        checkConnected();
+        InboundClientHandler handler = (InboundClientHandler)channel.getPipeline().getLast();
+        EslMessage response = handler.sendSyncMultiLineCommand( channel, sendMsg.getMsgLines() );
+        
+        return new CommandResponse( sendMsg.toString(), response );
+    }
+    
+    /**
      * Enable log output.
      * 
      * @param level using the same values as in console.conf