I got it working (after some modifications in the Makefiles...)
but now i want to develop new Applications for it and here i stuck ;-(
I startet from the MonkeyPlayerExample. The diffence is that I will anaylse the callEvent() and if I get an "Application" i will try to start it. So far so good... This works.
But:
If i try to execute an unkown Application (JVerbose) asterisk says:
No application 'JVerbose' for extension (sip, 123, 1)
if i try to "override" Verbose with my one application it works twice. One time my Verbose app the other time the Asterisk build-in one.
So here are my questions:
1. Is it possible to register an Java Application to Asterisk ??
if Yes: how ??
2. Is it possible to supress the execution of a "build-in" Application, doing the work inside the callEvent() and skip to the next priority ?
if Yes: how ??
Thanks in advance !!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Wow! You got it installed! You're already further along than anyone else I've heard from. What modifications did you have to make?
If JVerbose is your own application, you'll have to add that to the ASTERISK_OBS variable in SwigAsteriskConfig in order for it to be linked. There's probably a way to grab the contents of the /usr/lib/asterisk/modules/ directory dynamically at compile time so all the apps are linked automatically but, until then..
Once you do that, you should be able to call your app just like the "Playback" app is called in MonkeyPlayerExample.
>1. Is it possible to register an Java Application to Asterisk >?? if Yes: how ??
Not directly. However, it would be simple enough to make an asterisk app that would take a Java classname and args as parameters and execute that Java application in the JVM:
>Is it possible to supress the execution of a "build-in" >Application, doing the work inside the callEvent() and skip to >the next priority ?if Yes: how ??
The overall goal of Jasterisk is to provide a framework on which to build *alternative* call control structures, not necessarily to enhance the existing call control capabilities of Asterisk (dial plan). That said, I think you can do what you're trying to do but it might require some tweaking of your extensions.conf. For example, you can "grab" an incoming channel (like the MonkeyPlayerExample) and do whatever you want to it (play music, transfer, async_goto, disconnect, etc.). When you're done, you can always explicitly hang-up the channel so it won't continue executing through other priorites. Or you can use pbx.ast_async_goto() to change how your channel will be routed.
There's really no limit to what you can do to a channel using Jasterisk and I'm not really sure what the best approach is. One approach is to start with an empty extensions.conf file and build the file programmatically from Java (from MonkeyPlayerEx: app_safi.safi_add_extension("default", 1, "_.", 1, null, "Safi", "1", null); ).
I hope that helps some.
Zac
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
>What modifications did you have to make?
I changed a lot in the Makefiles /SwigMakefiles because I have different versions of asterisk installed on my system, each in a different directory so I had to modify some directories. I can send you the changed files if you want to have them ....
what I want to have:
exten => jVerbose(This is a test)I
how to archive this ??
I am working on a res_java wich provides the JVM and a java_exec(struct ast_channel *chan, void *data)
In load_module of res_java i want to register different JavaApps to this java_exec() (for example: jVerbose should go to java_exec and then execute "de.brainwork.apps.jVerbose)
Now I have some Questions: (because i am NOT a C guru ;-( )
1. How do I get the application name which was called inside java_exec ?? (jVerbose)
2. In my jVerbose JavaApp i want a function exec(app_channel chanel, String data). How do I call this function from C ?? To be more exactly: How do i get a JavaObject app_channel which represents the actual channel on the C side ?
After that I can use all the stuff you are providing inside this Application --> perfect environment fpr JAVA programmers !!!
I know that is a different approach then yours, but bringing these two things together brings a lot of freedom to this environment. (Maybe you can use the res_java ??)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Check out version 0.7.0a. I've added app_java.c which allows you to call static void methods from the Asterisk dial plan. Look at the installation guide for instructions. Theres also an example app.
It's very limited right now -- you can only call static void methods that take a single string array argument. We can add more flexibility to the app later but at least it shows what is possible.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I got it working (after some modifications in the Makefiles...)
but now i want to develop new Applications for it and here i stuck ;-(
I startet from the MonkeyPlayerExample. The diffence is that I will anaylse the callEvent() and if I get an "Application" i will try to start it. So far so good... This works.
But:
If i try to execute an unkown Application (JVerbose) asterisk says:
No application 'JVerbose' for extension (sip, 123, 1)
if i try to "override" Verbose with my one application it works twice. One time my Verbose app the other time the Asterisk build-in one.
So here are my questions:
1. Is it possible to register an Java Application to Asterisk ??
if Yes: how ??
2. Is it possible to supress the execution of a "build-in" Application, doing the work inside the callEvent() and skip to the next priority ?
if Yes: how ??
Thanks in advance !!
Wow! You got it installed! You're already further along than anyone else I've heard from. What modifications did you have to make?
If JVerbose is your own application, you'll have to add that to the ASTERISK_OBS variable in SwigAsteriskConfig in order for it to be linked. There's probably a way to grab the contents of the /usr/lib/asterisk/modules/ directory dynamically at compile time so all the apps are linked automatically but, until then..
Once you do that, you should be able to call your app just like the "Playback" app is called in MonkeyPlayerExample.
>1. Is it possible to register an Java Application to Asterisk >?? if Yes: how ??
Not directly. However, it would be simple enough to make an asterisk app that would take a Java classname and args as parameters and execute that Java application in the JVM:
exten => 1010,1,JavaExec,com/safi/asterisk/Test, arg1,arg2
>Is it possible to supress the execution of a "build-in" >Application, doing the work inside the callEvent() and skip to >the next priority ?if Yes: how ??
The overall goal of Jasterisk is to provide a framework on which to build *alternative* call control structures, not necessarily to enhance the existing call control capabilities of Asterisk (dial plan). That said, I think you can do what you're trying to do but it might require some tweaking of your extensions.conf. For example, you can "grab" an incoming channel (like the MonkeyPlayerExample) and do whatever you want to it (play music, transfer, async_goto, disconnect, etc.). When you're done, you can always explicitly hang-up the channel so it won't continue executing through other priorites. Or you can use pbx.ast_async_goto() to change how your channel will be routed.
There's really no limit to what you can do to a channel using Jasterisk and I'm not really sure what the best approach is. One approach is to start with an empty extensions.conf file and build the file programmatically from Java (from MonkeyPlayerEx: app_safi.safi_add_extension("default", 1, "_.", 1, null, "Safi", "1", null); ).
I hope that helps some.
Zac
>What modifications did you have to make?
I changed a lot in the Makefiles /SwigMakefiles because I have different versions of asterisk installed on my system, each in a different directory so I had to modify some directories. I can send you the changed files if you want to have them ....
what I want to have:
exten => jVerbose(This is a test)I
how to archive this ??
I am working on a res_java wich provides the JVM and a java_exec(struct ast_channel *chan, void *data)
In load_module of res_java i want to register different JavaApps to this java_exec() (for example: jVerbose should go to java_exec and then execute "de.brainwork.apps.jVerbose)
Now I have some Questions: (because i am NOT a C guru ;-( )
1. How do I get the application name which was called inside java_exec ?? (jVerbose)
2. In my jVerbose JavaApp i want a function exec(app_channel chanel, String data). How do I call this function from C ?? To be more exactly: How do i get a JavaObject app_channel which represents the actual channel on the C side ?
After that I can use all the stuff you are providing inside this Application --> perfect environment fpr JAVA programmers !!!
I know that is a different approach then yours, but bringing these two things together brings a lot of freedom to this environment. (Maybe you can use the res_java ??)
Joerg,
Check out version 0.7.0a. I've added app_java.c which allows you to call static void methods from the Asterisk dial plan. Look at the installation guide for instructions. Theres also an example app.
It's very limited right now -- you can only call static void methods that take a single string array argument. We can add more flexibility to the app later but at least it shows what is possible.