Use $AGI->exec($app, $options) more than 1 option allowe


#1

Hello
I’m trying to use $AGI->exec($app, $options) in in EAGI perl scripts
with the following
$app = system
$options = usr/bin/java -jar file.jar parm1

I have problem to pass more than one option to the command system
only the first is taken in account

may be it is impossible to do this with Asterisk.

I have also tried in the perl EAGI script
to insert the following

#system ("/usr/bin/java -jar file. jar param1");

there is no error on Asterisk console while execution but I don’t know how to collect the result of java execution

Thanks in advance for the answers


#2

When using exec you must separate the options by | instead of a space, e.g. $options="/usr/bin/java|-jar|file.jar|parm1".

Besides that booting a whole Java Virtual Machine each time does not look like a good idea. If you are doing Java stuff give Asterisk-Java and FastAGI a try. See asteriskjava.org/latest/tutorial.html
That way you only have one JVM running that serves all your channels.

=Stefan


#3

Thanks for the answer

actually since my post, I have decided to try the AGI Asterisk-java library
I have dowloaded the package and now I am trying to set up the AGIServer as mentionned in the web page
asteriskjava.org/latest/tutorial.html

I have some problems

  1. I seems impossible to compile the example with the BaseAGIScript class instead AbstractAGIScript
  2. With the AbstractAGIScript, When trying launching the AGI Server
    I got the following message

[root@smith1 mjro-example]# javac -cp asterisk-java-0.2.jar HelloAGIScript.java
Note: HelloAGIScript.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
[root@smith1 mjro-example]# java -cp asterisk-java.jar:. net.sf.asterisk.fastagi.DefaultAGIServer
Exception in thread “main” java.lang.NoClassDefFoundError: net/sf/asterisk/fastagi/DefaultAGIServer
[root@smith1 mjro-example]#

usually it is a pb with the $CLASSPATH variable but even with this variable defined on the directory where I have the following files

[root@smith1 mjro-example]# ls -al
total 248
drwxr-xr-x 2 root root 4096 jun 6 09:52 ./
drwxr-xr-x 5 root root 4096 jun 6 09:57 …/
-rw-r–r-- 1 root root 225401 jun 6 09:29 asterisk-java-0.2.jar
-rw-r–r-- 1 root root 27 jun 6 09:20 fastagi-mapping.properties
-rw-r–r-- 1 root root 624 jun 6 09:56 HelloAGIScript.class
-rw-r–r-- 1 root root 631 jun 6 09:52 HelloAGIScript.java
[root@smith1 mjro-example]#

It does no work


#4

Hoops!!!
sorry for the previous mail
Now it is ok now when the CLASSPATH is defined on
…/asterisk-java-0.2/target/classes
so now the AGI Server is running


#5

Ok, if you encounter any other problems or have further questions feel free to join our mailing list.

=Stefan