<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi, yes i had a look at it, and yes the needs are similar, i used it at the beginning<br>to get started, and i m using as a reference at this point but it seems that the use cases<br>are different . thanks!<br><br><br><br><div><hr id="stopSpelling">From: mike@jerris.com<br>Date: Thu, 5 Mar 2015 12:46:28 -0500<br>To: freeswitch-users@lists.freeswitch.org<br>Subject: Re: [Freeswitch-users] sessions and CS_INIT events<br><br>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><br></div><div><br><div><blockquote><div>On Mar 5, 2015, at 9:23 AM, Juan Pablo L. <<a href="mailto:jpablolorenzetti@hotmail.com">jpablolorenzetti@hotmail.com</a>> wrote:</div><br class="ecxApple-interchange-newline"><div><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;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;">Thank you very much guys for your contributions.<br><br>I m doing it as a module for couple of reasons, being the<br>most important (i believe) performance, because the module<br>i m working on is to do real time charging of voice calls on a switch<br>that is already serving as a RBT service plus a bunch of IVR's to purchase<br>services, this is for a ~150K user base on a single machine (cold standby)<br>this switch is also scheduled to soon start providing hosted PBX services,<span class="ecxApple-converted-space"> </span><br>so going the script direction<br>i personally dont see that as an option at all. I do use scripts for small no so much used<br>much simpler stuff though, e.g: a lua script takes care of authenticating users<br>when doing international calls from company extensions in the hosted PBX solution.<br><br>The other reason i chose to do<br>this as a module because C is the language i feel more comfortable with.<span class="ecxApple-converted-space"> </span><br>i hope this clarifies i little bit this.<br><br>Moving on, right now i m developing on a test freeswitch that we have and yes i noticed<br>that subscribing to the CS_INIT event does represent a big problem<br>because i get notified for every single of those events that is generated on<br>freeswitch which would be very inconvenient because as i mentioned, the same<br>switch does many other things that i m not interested in, so i m going to try the advise<br>provided and try to do it in the dial plan, i will explore this option.<span class="ecxApple-converted-space"> </span><br><br>thank you very much all!<br><br><br><br><br><br><div>> Date: Thu, 5 Mar 2015 14:19:51 +0100<br>> From:<span class="ecxApple-converted-space"> </span><a href="mailto:ssinyagin@gmail.com">ssinyagin@gmail.com</a><br>> To:<span class="ecxApple-converted-space"> </span><a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a><br>> Subject: Re: [Freeswitch-users] sessions and CS_INIT events<br>><span class="ecxApple-converted-space"> </span><br>> but for the task that OP has described, writing (and maintaining it in<br>> the long term) a module is really an overkill. Plus, he would also<br>> need to take care of multithreading within FreeSWITCH, as well as<br>> memory management, etc.<br>><span class="ecxApple-converted-space"> </span><br>> Also, a module makes sense if it's some common task which can be<br>> re-used by others and published as open source. If it's some<br>> closed-source module for a specific enterprise task that Juan has, it<br>> just doesn't make sense and too much risk for a long-term solution.<br>><span class="ecxApple-converted-space"> </span><br>><span class="ecxApple-converted-space"> </span><br>><span class="ecxApple-converted-space"> </span><br>><span class="ecxApple-converted-space"> </span><br>><span class="ecxApple-converted-space"> </span><br>> On Thu, Mar 5, 2015 at 1:56 PM, Vik Killa <<a href="mailto:vipkilla@gmail.com">vipkilla@gmail.com</a>> wrote:<br>> > It all depends on what you are trying to do with your module.<br>> > You can use a dialplan handler in your module (see mod_enum for example) to<br>> > route inbound calls using your custom dialplan.<br>> > You can use a state handler in your module and bind to channel states (much<br>> > like binding to events).<br>> > You can create a dialplan app in your module to execute code when the app is<br>> > called in dialplan<br>> > (Example: <application action="mycustom_module" data="${uuid} arg1 arg2"/>)<br>> > You can use an endpoint in your module to originate calls outbound (see<br>> > mod_lcr or mod_callcenter for an example)<br>> > Also, you can create an API for your module<br>> ><br>> > IMO creating a module is much more powerful than using a script with ESL.<br>> > But if you are going to create a module, you really don't need to mess with<br>> > events (unless they are very specific events like CUSTOM::) because your<br>> > module has access to much of the freeswitch core.<br>> ><br>> > Thanks.<br>> ><br>> ><br>> ><br>> > On Thu, Mar 5, 2015 at 5:07 AM, Stanislav Sinyagin <<a href="mailto:ssinyagin@gmail.com">ssinyagin@gmail.com</a>><br>> > wrote:<br>> >><br>> >> 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<br>> >> 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>> >><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<br>> >> > 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<br>> >> > 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>> >> ></div></div></div></blockquote></div></div><br>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org</div>                                            </div></body>
</html>