<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Given the similarity in purpose, I would look closely at how mod_nibblebill interfaces with freeswitch. It sounds like your interface needs are nearly identical.<div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 5, 2015, at 9:23 AM, Juan Pablo L. <<a href="mailto:jpablolorenzetti@hotmail.com" class="">jpablolorenzetti@hotmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Thank you very much guys for your contributions.<br class=""><br class="">I m doing it as a module for couple of reasons, being the<br class="">most important (i believe) performance, because the module<br class="">i m working on is to do real time charging of voice calls on a switch<br class="">that is already serving as a RBT service plus a bunch of IVR's to purchase<br class="">services, this is for a ~150K user base on a single machine (cold standby)<br class="">this switch is also scheduled to soon start providing hosted PBX services,<span class="Apple-converted-space"> </span><br class="">so going the script direction<br class="">i personally dont see that as an option at all. I do use scripts for small no so much used<br class="">much simpler stuff though, e.g: a lua script takes care of authenticating users<br class="">when doing international calls from company extensions in the hosted PBX solution.<br class=""><br class="">The other reason i chose to do<br class="">this as a module because C is the language i feel more comfortable with.<span class="Apple-converted-space"> </span><br class="">i hope this clarifies i little bit this.<br class=""><br class="">Moving on, right now i m developing on a test freeswitch that we have and yes i noticed<br class="">that subscribing to the CS_INIT event does represent a big problem<br class="">because i get notified for every single of those events that is generated on<br class="">freeswitch which would be very inconvenient because as i mentioned, the same<br class="">switch does many other things that i m not interested in, so i m going to try the advise<br class="">provided and try to do it in the dial plan, i will explore this option.<span class="Apple-converted-space"> </span><br class=""><br class="">thank you very much all!<br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><div class="">> Date: Thu, 5 Mar 2015 14:19:51 +0100<br class="">> From:<span class="Apple-converted-space"> </span><a href="mailto:ssinyagin@gmail.com" class="">ssinyagin@gmail.com</a><br class="">> To:<span class="Apple-converted-space"> </span><a href="mailto:freeswitch-users@lists.freeswitch.org" class="">freeswitch-users@lists.freeswitch.org</a><br class="">> Subject: Re: [Freeswitch-users] sessions and CS_INIT events<br class="">><span class="Apple-converted-space"> </span><br class="">> but for the task that OP has described, writing (and maintaining it in<br class="">> the long term) a module is really an overkill. Plus, he would also<br class="">> need to take care of multithreading within FreeSWITCH, as well as<br class="">> memory management, etc.<br class="">><span class="Apple-converted-space"> </span><br class="">> Also, a module makes sense if it's some common task which can be<br class="">> re-used by others and published as open source. If it's some<br class="">> closed-source module for a specific enterprise task that Juan has, it<br class="">> just doesn't make sense and too much risk for a long-term solution.<br class="">><span class="Apple-converted-space"> </span><br class="">><span class="Apple-converted-space"> </span><br class="">><span class="Apple-converted-space"> </span><br class="">><span class="Apple-converted-space"> </span><br class="">><span class="Apple-converted-space"> </span><br class="">> On Thu, Mar 5, 2015 at 1:56 PM, Vik Killa <<a href="mailto:vipkilla@gmail.com" class="">vipkilla@gmail.com</a>> wrote:<br class="">> > It all depends on what you are trying to do with your module.<br class="">> > You can use a dialplan handler in your module (see mod_enum for example) to<br class="">> > route inbound calls using your custom dialplan.<br class="">> > You can use a state handler in your module and bind to channel states (much<br class="">> > like binding to events).<br class="">> > You can create a dialplan app in your module to execute code when the app is<br class="">> > called in dialplan<br class="">> > (Example: <application action="mycustom_module" data="${uuid} arg1 arg2"/>)<br class="">> > You can use an endpoint in your module to originate calls outbound (see<br class="">> > mod_lcr or mod_callcenter for an example)<br class="">> > Also, you can create an API for your module<br class="">> ><br class="">> > IMO creating a module is much more powerful than using a script with ESL.<br class="">> > But if you are going to create a module, you really don't need to mess with<br class="">> > events (unless they are very specific events like CUSTOM::) because your<br class="">> > module has access to much of the freeswitch core.<br class="">> ><br class="">> > Thanks.<br class="">> ><br class="">> ><br class="">> ><br class="">> > On Thu, Mar 5, 2015 at 5:07 AM, Stanislav Sinyagin <<a href="mailto:ssinyagin@gmail.com" class="">ssinyagin@gmail.com</a>><br class="">> > wrote:<br class="">> >><br class="">> >> why at all do you need it to be a C module inside FreeSWITCH?<br class="">> >><br class="">> >> Why not writing an ESL program which would subscribe to events and<br class="">> >> perform the needed actions?<br class="">> >><br class="">> >> How about the following scenario:<br class="">> >><br class="">> >> 1. In the XML dialplan, you execute "park" application on the incoming<br class="">> >> call.<br class="">> >><br class="">> >> 2. Your program is listening to events via ESL, and it recognizes that<br class="">> >> a channel has been parked<br class="">> >><br class="">> >> 3. Your program starts to playback the ringback tone into that channel<br class="">> >><br class="">> >> 4. Your program performs all the needed lookups and sets needed<br class="">> >> variables on the channel<br class="">> >><br class="">> >> 5. Your program transfers or bridges the call where needed.<br class="">> >><br class="">> >> This is quite easy to implement in any programming language of your<br class="">> >> choice, easy to debug, and it's easily scalable. It can be done in a<br class="">> >> multi-threading fashion, like Go or Erlang, or even Java, and perform<br class="">> >> as many parallel calls as required.<br class="">> >><br class="">> >> quite easy, and you don't have to mess with FreeSWITCH internals :)<br class="">> >><br class="">> >><br class="">> >><br class="">> >><br class="">> >><br class="">> >><br class="">> >> On Thu, Mar 5, 2015 at 4:07 AM, Juan Pablo L.<br class="">> >> <<a href="mailto:jpablolorenzetti@hotmail.com" class="">jpablolorenzetti@hotmail.com</a>> wrote:<br class="">> >> > Hi, i m writing a module in C that needs to check for certain<br class="">> >> > information in<br class="">> >> > a<br class="">> >> > database for the caller and the destination number,<br class="">> >> > for this the module is subscribing to the CS_INIT channel events, so<br class="">> >> > everytime a channel is created<br class="">> >> > the module callback is called and it checks the numbers,<br class="">> >> > the problem is that the callback gets called twice,<br class="">> >> > for the creation of the a-leg of the call and the creation of the b-leg.<br class="">> >> > Is there any way to accomplish what i m trying to do ?<br class="">> >> > Am i doing it the wrong way?<br class="">> >> > I have already try getting testing for the flags in the channel but it<br class="">> >> > did<br class="">> >> > not work,<br class="">> >> > testing of originator or originating does not yield anything ....<br class="">> >> ><br class="">> >> > i might be doing it wrong maybe ?<br class="">> >> ><br class="">> >> > Thanks!<br class="">> >> ></div></div></div></blockquote></div></div></body></html>