<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div class="PlainText">Thank you very much for the advise. I accidentally found it to be useful as well.<br>
<br>
--- Original Message ---<br>
<br>
From: "Anthony Minessale" <anthony.minessale@gmail.com><br>
Sent: March 6, 2015 2:23 PM<br>
To: "FreeSWITCH Users Help" <freeswitch-users@lists.freeswitch.org><br>
Subject: Re: [Freeswitch-users] sessions and CS_INIT events<br>
<br>
</div>
<div>
<div dir="ltr">You probably want to look at the dialplan module interface as well. And pay attention to the direction variable to distinguish inbound from out bound Especially at the routing state not init.
<div><br>
</div>
</div>
<div class="x_gmail_extra"><br>
<div class="x_gmail_quote">On Thu, Mar 5, 2015 at 12:05 PM, Juan Pablo L. <span dir="ltr">
<<a href="mailto:jpablolorenzetti@hotmail.com" target="_blank">jpablolorenzetti@hotmail.com</a>></span> wrote:<br>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<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>
From: <a href="mailto:mike@jerris.com" target="_blank">mike@jerris.com</a><br>
Date: Thu, 5 Mar 2015 12:46:28 -0500
<div>
<div class="x_h5"><br>
To: <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><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" target="_blank">jpablolorenzetti@hotmail.com</a>> wrote:</div>
<br>
<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> </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> </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> </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> </span><a href="mailto:ssinyagin@gmail.com" target="_blank">ssinyagin@gmail.com</a><br>
> To:<span> </span><a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><br>
> Subject: Re: [Freeswitch-users] sessions and CS_INIT events<br>
><span> </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> </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> </span><br>
><span> </span><br>
><span> </span><br>
><span> </span><br>
><span> </span><br>
> On Thu, Mar 5, 2015 at 1:56 PM, Vik Killa <<a href="mailto:vipkilla@gmail.com" target="_blank">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" target="_blank">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" target="_blank">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>
</div>
</div>
<span class="">_________________________________________________________________________ Professional FreeSWITCH Consulting Services:
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a> Official FreeSWITCH Sites
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a> FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></span></div>
</div>
</div>
<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>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="x_gmail_signature">
<div dir="ltr">Anthony Minessale II ♬ @anthmfs ♬ @FreeSWITCH ♬
<div><br>
<div>☞ <a href="http://freeswitch.org/" target="_blank">http://freeswitch.org/</a> ☞
<a href="http://cluecon.com/" target="_blank">http://cluecon.com/</a> ☞ <a href="http://twitter.com/FreeSWITCH" target="_blank">
http://twitter.com/FreeSWITCH</a></div>
<div>
<div>☞ <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch ☞
<u><a href="http://freeswitch.org/g+" target="_blank">http://freeswitch.org/g+</a></u><br>
<br>
</div>
<div>ClueCon Weekly Development Call <br>
</div>
<div>☎ <a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a> ☎ +19193869900 </div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>