Posted: Fri Apr 14, 2000 10:47 am Post subject: [Asterisk] Module unload
It doesn't seem easy to build a library with openh323 so I have
decided to make a gateway process to use with asterisk. I have planed to
write a channel that starts the gw and dialogs with it with pipes (like
the app_mp3 application). If someone has a better solution, you can tell
me.
I have started to write something and I have a problem: when I quit
Asterisk (with the quit command in the console), the unload_module is
not called so the process is still here when Astersk is finished. Is
there a way to solve this problem?
I have started to write something and I have a problem: when I quit
Asterisk (with the quit command in the console), the unload_module is
not called so the process is still here when Astersk is finished. Is
there a way to solve this problem?
If Asterisk dies, it (implicitly) closes the pipe. The gateway process
should then recognize the end-of-file from the pipe, and exit.
If that doesn't work, you might have forgotten to close the "wrong" ends
of the pipe after forking. That's a fairly common mistake.
--
Matthias Urlichs | noris network GmbH | smurf@noris.de | ICQ: 20193661
The quote was selected randomly. Really. | http://www.noris.de/~smurf/
--
Cleverness is not wisdom.
-- Euripides
It doesn't seem easy to build a library with openh323 so I have
decided to make a gateway process to use with asterisk. I have planed to
write a channel that starts the gw and dialogs with it with pipes (like
the app_mp3 application). If someone has a better solution, you can tell
me.
Dialog with it with IAX, via a UDP socket. The big advantage with this is
that you don't have to have the Openh323 gateway on the same machine as
the Asterisk boxes, so it could do load balancing, etc. It also keeps you
from having to write yet another protocol.
If you really really want to do it with a socket or pipe, then use the
ast_frwrite and ast_frread routines to your advantage.
Quote:
I have started to write something and I have a problem: when I quit
Asterisk (with the quit command in the console), the unload_module is
not called so the process is still here when Astersk is finished. Is
there a way to solve this problem?
Hmm... It may be worth it to require asterisk to call unload_module on
each module when asked to quit... However, even if asterisk is
killed, there should be a way to get the child process to die
with it, right? Thoughts?
> It doesn't seem easy to build a library with openh323 so I have
> decided to make a gateway process to use with asterisk. I have planed to
> write a channel that starts the gw and dialogs with it with pipes (like
> the app_mp3 application). If someone has a better solution, you can tell
> me.
Dialog with it with IAX, via a UDP socket. The big advantage with this is
that you don't have to have the Openh323 gateway on the same machine as
the Asterisk boxes, so it could do load balancing, etc. It also keeps you
from having to write yet another protocol.
If you really really want to do it with a socket or pipe, then use the
ast_frwrite and ast_frread routines to your advantage.
Quote:
> I have started to write something and I have a problem: when I quit
> Asterisk (with the quit command in the console), the unload_module is
> not called so the process is still here when Astersk is finished. Is
> there a way to solve this problem?
Quote:
Hmm... It may be worth it to require asterisk to call unload_module on
each module when asked to quit... However, even if asterisk is
killed, there should be a way to get the child process to die
with it, right? Thoughts?
I thought that the child process would be killed with Asterisk, but this is
not what happens; maybe something in pwlib...
I have tried the solution with pipe and it works (ie the process can detect
when Asterisk ends). I would prefer to use IAX so I would need some help
about this protocol:
* are there some documentations about how to use it?
* is it possible to use some of the functions you have already written?
* anything that could help!
* are there some documentations about how to use it?
It's very briefly documented in the documentation directory, but the code
is your best documentation.
Quote:
* is it possible to use some of the functions you have already written?
Yes, you may use anything in chan_iax.c that you find useful for
implementing IAX. Actually, there's something I'd rather do:
Lets abstract the routines of IAX into a library so that we can easier
allow the protocol to evolve. Then we make the IAX library be LGPL and
thus able to link both with Asterisk and with your gateway. Ideas?
Posted: Mon Apr 17, 2000 9:17 am Post subject: [Asterisk] Module unload
Mark Spencer wrote:
Quote:
> * are there some documentations about how to use it?
It's very briefly documented in the documentation directory, but the code
is your best documentation.
> * is it possible to use some of the functions you have already written?
Yes, you may use anything in chan_iax.c that you find useful for
implementing IAX. Actually, there's something I'd rather do:
Lets abstract the routines of IAX into a library so that we can easier
allow the protocol to evolve. Then we make the IAX library be LGPL and
thus able to link both with Asterisk and with your gateway. Ideas?
I am not very familiar with creating libraries (I use the makefiles
provided with Asterisk to build the modules), but then it would be easier
for everyone who want to use the IAX protocol. It looks like you have some
experience with this job, and I would like to know how to build a shared
library and how to link (at compile time) with it.
I'm having a look at chan_iax.c and it uses a lot of external functions
(some are only used by the channel part); I hope these won't be too hard to
find.
Posted: Tue Apr 18, 2000 1:20 am Post subject: [Asterisk] Module unload
Quote:
I'm having a look at chan_iax.c and it uses a lot of external functions
(some are only used by the channel part); I hope these won't be too hard to
find.
Don't worry about this right now. Let's decide what we want the API to
look like. Then I'll munge chan_iax into using that API.
Something like
struct iax_server *iax_create_server(int portno);
/* Create a server structure, using given port number or -1 for deafult */
Posted: Tue Apr 18, 2000 10:34 am Post subject: [Asterisk] Module unload
Mark Spencer wrote:
Quote:
> I'm having a look at chan_iax.c and it uses a lot of external functions
> (some are only used by the channel part); I hope these won't be too hard to
> find.
Don't worry about this right now. Let's decide what we want the API to
look like. Then I'll munge chan_iax into using that API.
Something like
struct iax_server *iax_create_server(int portno);
/* Create a server structure, using given port number or -1 for deafult */
and so on...
Mark
So, here is what I expect from this library:
I must be able to create and manage a server in the gateway. My program must be
informed of new connections, end of communication... so there might be some
callbacks.
As a client, it must also be able to connect to a server and to get some
informations from it.
And both side must be able to send and receive the sound and other informations
(user inputs).
I have read that you are not a C++ fan but it would really be easier to
develop with this langage: callbacks become virtual functions (everything is
managed by the langage itself) and pointers type are more checked (it is always
possible to cheat like with C).
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum