That is probably possible and not too difficult.
I learned what AGI was about 30 minutes after I was finished
with the last revision of app_perl where I added support to
launch a perl function in a thread
(BTW I am suspicious that you
may ironically need perl with no threads compiled for it to work right
in asterisk despite the fact that you gain thread functionality via asterisk)
I have not really carefully looked at AGI yet but from what I remember
It communicates with the ext process via STDIN and looks at the ENV
for information. so what I think you would need would be a fake ENV and a special variable to contain the same info that would have been sent to STDIN created uniquely for each execution. This of course would be limiting the AGI to perl code so another method would be to make
a function via the app_perl or a dedicated C module to run all the agi app
at startup and leave them open speaking back and forth over IO stream.
I do notice I started stepping on the toes of AGI because I never heard of
it while I was coding my module so I think some of the things that AGI does can also be accomplished on app_perl
The 3 things I was dreaming of when I was working on it were:
1) If the module has the power to create extensions then you can use
it to fetch that data from a database on startup or in mid run.
2) If the module can run threads It could implement
an external listener of some sort and communicate with
a partner thread over shared memory and with the world
over sockets, tcpip etc (web server) I had a demo working
where you could go to the asterisk on a web browser an see
a readout like "number is 0" then if you dial into a certain ext
with a phone the number increments and when you reload the
web page it said "number is 1" and so on.
3) Despite the fact that anything I can possibly dream up
can be implemented with ease because of the robustness
of asterisk (adding plug ins is like doing a child's jigsaw puzzle
as you can see because I don't even know how to work it yet can
build a module for it)
By integrating perl I felt more of those ideas could be brought to life
faster (1 module can open several doors) and It would allow me
to bridge the gap between asterisk and a ton of perl stuff I have
made along the years.
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!