View previous topic :: View next topic |
Author |
Message |
zhaoxxqq at 163.com Guest
|
Posted: Mon Jun 29, 2009 9:43 pm Post subject: [Freeswitch-users] Question about outband event use java |
|
|
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@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 |
|
Back to top |
|
|
jason at jasonjgw.net Guest
|
Posted: Mon Jun 29, 2009 9:50 pm Post subject: [Freeswitch-users] Question about outband event use java |
|
|
zhaoxxqq <zhaoxxqq@163.com> wrote:
Quote: | 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.*;
|
Shouldn't you be using the Java event socket libraries that were discussed on
the list recently? There's also one in the FreeSWITCH source tree now.
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org |
|
Back to top |
|
|
|