[Freeswitch-users] Question about outband event use java

zhaoxxqq zhaoxxqq at 163.com
Mon Jun 29 19:42:21 PDT 2009


Hi folks,
I'm really newbee to touch outband event. I write socket below
   
 <extension name="nb_conferences">
      <condition field="destination_number" expression="^(30\d{2})$">
        <action application="socket" data="127.0.0.1:8023 full"/>
        <action application="answer"/>
        <action application="conference" data="$1-${domain_name}@default"/>
      </condition>
 </extension>

and I write java server code like below:

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.regex.*;
public class ServerCode {
        /**
         * @param args
         */
    public static int portNo = 8023;
        public static void main(String[] args) throws IOException
        {
        // TODO code application logic here
        ServerSocket s= new ServerSocket(portNo);
        System.out.println("The Server is start:" + s);
        Socket socket=s.accept();
        try{
             System.out.println("Accept the Client:"+ socket);
             BufferedReader in =new BufferedReader(new InputStreamReader(socket.getInputStream()));
             PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);
             while(true){
                String str = in.readLine();
                if(str.equals("byebye")){
                    break;
                }

                System.out.println("In Server recieved the info:" + str);
                out.println("connect\n\n"); 
             }
        }
           finally
            {
                System.out.println("close the server socket and the io.");
                socket.close();
                s.close();
            }
        }
}

When I use extension 1001 to dial 3001, the cli display below:

2009-06-30 18:35:27 [NOTICE] switch_channel.c:567 switch_channel_set_name() New Channel sofia/internal/1001 at 61.55.140.138:5060 [b9c80e50-6561-11de-8972-f3830035270b]
2009-06-30 18:35:27 [INFO] mod_dialplan_xml.c:233 dialplan_hunt() Processing 1001->3001 in context default

I have send "connect\n\n" to FS, but  no response to outband server. Can anyone help me?


2009-06-30 



zhaoxxqq 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20090630/d7cc94f5/attachment-0002.html 


More information about the FreeSWITCH-users mailing list