Asterisk-Java can't find fastagi-mapping.properties

1k Views Asked by At

I'm using Asterisk and I'd like to emit a call from my Java app and then use an AGI script to control what happens. So I've got a first class that contacts the Asterisk server and uses an OriginateAction to start the call (this works well) and an AGI server that runs and should serve AGI requests. Though, it doesn't work because it can't find the fastagi-mapping.properties file.

Here is my fastagi-mapping.properties:

alertcall.agi = AlertCallScript

(It only has one case.)

In the same folder, I have AlertCallScript.java (and asterisk-java.jar) that I compile like this:

javac -cp asterisk-java.jar:. AlertCallScript.java ExamplesAsteriskSettings.java

And then I start my AGI server using this (found in the doc):

java -cp asterisk-java.jar:. -jar asterisk-java.jar

When I emit my call, I get the following error in the AGI server output:

Jun 13, 2018 6:28:12 AM org.asteriskjava.fastagi.ResourceBundleMappingStrategy loadResourceBundle
INFO: Resource bundle 'fastagi-mapping' not found.
Jun 13, 2018 6:28:12 AM org.asteriskjava.fastagi.internal.AgiConnectionHandler run
SEVERE: No script configured for URL 'agi://localhost/alertcall.agi' (script 'alertcall.agi')

And I don't know why... I've been looking into this for more than an hour and I probably made a stupid mistake, though I can't find it.

Notes :

  • I use my classpath java-asterisk.jar:. to be able to have asterisk-java and the current folder, which contains the fastagi-mapping.properties file, so the file should be found without any problem within the class path.
  • I have already try to delete and recreate the file, it didn't change anything.

Please suggest.

1

There are 1 best solutions below

1
On BEST ANSWER

Part of the problem is probably trying to use -cp and -jar in the same java command, this is not supported and there are a number of questions on Stackoverflow about that (here is one).

You can use something like

java -cp asterisk-java.jar:. DefaultAgiServer

to start asterisk-java's DefaultAgiServer specifically (which is what specifying -jar asterisk-java.jar is going to do anyways, if I remember the entry in the manifest correctly).