<div dir="ltr">It all depends on what you are trying to do with your module.<div>You can use a dialplan handler in your module (see mod_enum for example) to route inbound calls using your custom dialplan.</div><div>You can use a state handler in your module and bind to channel states (much like binding to events).</div><div>You can create a dialplan app in your module to execute code when the app is called in dialplan<br></div><div>(Example: <application action="mycustom_module" data="${uuid} arg1 arg2"/>)</div><div>You can use an endpoint in your module to originate calls outbound (see mod_lcr or mod_callcenter for an example)</div><div>Also, you can create an API for your module</div><div><br></div><div>IMO creating a module is much more powerful than using a script with ESL.</div><div>But if you are going to create a module, you really don't need to mess with events (unless they are very specific events like CUSTOM::) because your module has access to much of the freeswitch core.</div><div><br></div><div>Thanks.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 5, 2015 at 5:07 AM, Stanislav Sinyagin <span dir="ltr"><<a href="mailto:ssinyagin@gmail.com" target="_blank">ssinyagin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">why at all do you need it to be a C module inside FreeSWITCH?<br>
<br>
Why not writing an ESL program which would subscribe to events and<br>
perform the needed actions?<br>
<br>
How about the following scenario:<br>
<br>
1. In the XML dialplan, you execute "park" application on the incoming call.<br>
<br>
2. Your program is listening to events via ESL, and it recognizes that<br>
a channel has been parked<br>
<br>
3. Your program starts to playback the ringback tone into that channel<br>
<br>
4. Your program performs all the needed lookups and sets needed<br>
variables on the channel<br>
<br>
5. Your program transfers or bridges the call where needed.<br>
<br>
This is quite easy to implement in any programming language of your<br>
choice, easy to debug, and it's easily scalable. It can be done in a<br>
multi-threading fashion, like Go or Erlang, or even Java, and perform<br>
as many parallel calls as required.<br>
<br>
quite easy, and you don't have to mess with FreeSWITCH internals :)<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
On Thu, Mar 5, 2015 at 4:07 AM, Juan Pablo L.<br>
<<a href="mailto:jpablolorenzetti@hotmail.com">jpablolorenzetti@hotmail.com</a>> wrote:<br>
> Hi, i m writing a module in C that needs to check for certain information in<br>
> a<br>
> database for the caller and the destination number,<br>
> for this the module is subscribing to the CS_INIT channel events, so<br>
> everytime a channel is created<br>
> the module callback is called and it checks the numbers,<br>
> the problem is that the callback gets called twice,<br>
> for the creation of the a-leg of the call and the creation of the b-leg.<br>
> Is there any way to accomplish what i m trying to do ?<br>
> Am i doing it the wrong way?<br>
> I have already try getting testing for the flags in the channel but it did<br>
> not work,<br>
> testing of originator or originating does not yield anything ....<br>
><br>
> i might be doing it wrong maybe ?<br>
><br>
> Thanks!<br>
><br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _________________________________________________________________________<br>
> Professional FreeSWITCH Consulting Services:<br>
> <a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
> <a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
><br>
> Official FreeSWITCH Sites<br>
> <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
> <a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
> <a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
><br>
> FreeSWITCH-users mailing list<br>
> <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
> <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br></div>