[Asterisk-Dev] java agi. Help me!
Ben Hencke
brainstar at gmail.com
Fri May 20 12:30:31 MST 2005
Does the AGI need /r/n or just /n ?
Java's println does different things for different systems, and IIRC
some of *'s protocols expect the lines to end with /r/n
So you might try it with print + "/r/n"
Also, consider using asterisk-java instead. It takes care of all of
this stuff for you and will be much faster.
http://asterisk-java.sourceforge.net/
- Ben
On 5/20/05, saad <saad at palmchip.com> wrote:
>
>
> hello,
>
> i have been trying to get agi's working with java. the code is:
>
> import java.io.*;
> class TestAGI {
> public static void main( String[] args ) {
> try {
> String linea;
> LineNumberReader in = new LineNumberReader( new
> InputStreamReader( System.in ) );
> do { //read AGI environmet
> linea = in.readLine();
> } while ( linea.length() > 0 );
> System.out.println( "SAY NUMBER 123 \"*#\"" );
> linea = in.readLine();
> System.err.println("Received "+linea);
> System.exit( 0 );
> } catch( Exception ex ) {
> System.err.println("Error: "+ex.getMessage());
> }
> }
> }
>
> this is the only example code for java i could find on the net and this wont
> work. i get the following output:
>
> AGI("SIP/222-ca1b", "test-java.agi") in new stack
> -- Launched AGI Script /var/lib/asterisk/agi-bin/test-java.agi
> AGI Tx >> agi_request: test-java.agi
> AGI Tx >> agi_channel: SIP/222-ca1b
> AGI Tx >> agi_language: en
> AGI Tx >> agi_type: SIP
> AGI Tx >> agi_uniqueid: 1116586348.1
> AGI Tx >> agi_callerid: 222
> AGI Tx >> agi_calleridname: saad
> AGI Tx >> agi_dnid: 7300
> AGI Tx >> agi_rdnis: unknown
> AGI Tx >> agi_context: sipcall
> AGI Tx >> agi_extension: 7300
> AGI Tx >> agi_priority: 1
> AGI Tx >> agi_enhanced: 0.0
> AGI Tx >> agi_accountcode:
> AGI Tx >> CLI>
> -- AGI Script test-java.agi completed, returning 0
>
> the agi is a bash script that makes a simple gij TestAGI but apparently that
> doesnt get called. however the perl script gets executed perfectly and i
> hear the sounds etc. somebody mentioned that it works with changing the
> println to print, but that didnt work either.if anybody has any idea please
> help me out. also if anybody has some more sample codes i would really
> appreciate it if i can take a look at it.
>
> --saad
> _______________________________________________
> Asterisk-Dev mailing list
> Asterisk-Dev at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-dev
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
>
>
More information about the asterisk-dev
mailing list