[Asterisk-Dev] java agi. Help me!

saad saad at palmchip.com
Fri May 20 04:50:24 MST 2005


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20050520/fbd65ac5/attachment.htm


More information about the asterisk-dev mailing list