[Freeswitch-users] sessions and CS_INIT events

Anthony Minessale anthony.minessale at gmail.com
Fri Mar 6 23:22:08 MSK 2015


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.


On Thu, Mar 5, 2015 at 12:05 PM, Juan Pablo L. <jpablolorenzetti at hotmail.com
> wrote:

> Hi, yes i had a look at it, and yes the needs are similar, i used it at
> the beginning
> to get started, and i m using as a reference at this point but it seems
> that the use cases
> are different . thanks!
>
>
>
> ------------------------------
> From: mike at jerris.com
> Date: Thu, 5 Mar 2015 12:46:28 -0500
>
> To: freeswitch-users at lists.freeswitch.org
> Subject: Re: [Freeswitch-users] sessions and CS_INIT events
>
> 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.
>
>
> On Mar 5, 2015, at 9:23 AM, Juan Pablo L. <jpablolorenzetti at hotmail.com>
> wrote:
>
> Thank you very much guys for your contributions.
>
> I m doing it as a module for couple of reasons, being the
> most important (i believe) performance, because the module
> i m working on is to do real time charging of voice calls on a switch
> that is already  serving as a RBT service plus a bunch of IVR's to purchase
> services, this is for a ~150K user base on a single machine (cold standby)
> this switch is also scheduled to soon start providing hosted PBX services,
>
> so going the script direction
> i personally dont see that as an option at all. I do use scripts for small
> no so much used
> much simpler stuff though, e.g: a lua script takes care of authenticating
> users
> when doing international calls from company extensions in the hosted PBX
> solution.
>
> The other reason i chose to do
> this as a module because C is the language i feel more comfortable with.
> i hope this clarifies i little bit this.
>
> Moving on, right now i m developing on a test freeswitch that we have and
> yes i noticed
> that subscribing to the CS_INIT event does represent a big problem
> because i get notified for every single of those events that is generated
> on
> freeswitch which would be very inconvenient because as i mentioned, the
> same
> switch does many other things that i m not interested in, so i m going to
> try the advise
> provided and try to do it in the dial plan, i will explore this option.
>
> thank you very much all!
>
>
>
>
>
> > Date: Thu, 5 Mar 2015 14:19:51 +0100
> > From: ssinyagin at gmail.com
> > To: freeswitch-users at lists.freeswitch.org
> > Subject: Re: [Freeswitch-users] sessions and CS_INIT events
> >
> > but for the task that OP has described, writing (and maintaining it in
> > the long term) a module is really an overkill. Plus, he would also
> > need to take care of multithreading within FreeSWITCH, as well as
> > memory management, etc.
> >
> > Also, a module makes sense if it's some common task which can be
> > re-used by others and published as open source. If it's some
> > closed-source module for a specific enterprise task that Juan has, it
> > just doesn't make sense and too much risk for a long-term solution.
> >
> >
> >
> >
> >
> > On Thu, Mar 5, 2015 at 1:56 PM, Vik Killa <vipkilla at gmail.com> wrote:
> > > It all depends on what you are trying to do with your module.
> > > You can use a dialplan handler in your module (see mod_enum for
> example) to
> > > route inbound calls using your custom dialplan.
> > > You can use a state handler in your module and bind to channel states
> (much
> > > like binding to events).
> > > You can create a dialplan app in your module to execute code when the
> app is
> > > called in dialplan
> > > (Example: <application action="mycustom_module" data="${uuid} arg1
> arg2"/>)
> > > You can use an endpoint in your module to originate calls outbound (see
> > > mod_lcr or mod_callcenter for an example)
> > > Also, you can create an API for your module
> > >
> > > IMO creating a module is much more powerful than using a script with
> ESL.
> > > 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.
> > >
> > > Thanks.
> > >
> > >
> > >
> > > On Thu, Mar 5, 2015 at 5:07 AM, Stanislav Sinyagin <
> ssinyagin at gmail.com>
> > > wrote:
> > >>
> > >> why at all do you need it to be a C module inside FreeSWITCH?
> > >>
> > >> Why not writing an ESL program which would subscribe to events and
> > >> perform the needed actions?
> > >>
> > >> How about the following scenario:
> > >>
> > >> 1. In the XML dialplan, you execute "park" application on the incoming
> > >> call.
> > >>
> > >> 2. Your program is listening to events via ESL, and it recognizes that
> > >> a channel has been parked
> > >>
> > >> 3. Your program starts to playback the ringback tone into that channel
> > >>
> > >> 4. Your program performs all the needed lookups and sets needed
> > >> variables on the channel
> > >>
> > >> 5. Your program transfers or bridges the call where needed.
> > >>
> > >> This is quite easy to implement in any programming language of your
> > >> choice, easy to debug, and it's easily scalable. It can be done in a
> > >> multi-threading fashion, like Go or Erlang, or even Java, and perform
> > >> as many parallel calls as required.
> > >>
> > >> quite easy, and you don't have to mess with FreeSWITCH internals :)
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> On Thu, Mar 5, 2015 at 4:07 AM, Juan Pablo L.
> > >> <jpablolorenzetti at hotmail.com> wrote:
> > >> > Hi, i m writing a module in C that needs to check for certain
> > >> > information in
> > >> > a
> > >> > database for the caller and the destination number,
> > >> > for this the module is subscribing to the CS_INIT channel events, so
> > >> > everytime a channel is created
> > >> > the module callback is called and it checks the numbers,
> > >> > the problem is that the callback gets called twice,
> > >> > for the creation of the a-leg of the call and the creation of the
> b-leg.
> > >> > Is there any way to accomplish what i m trying to do ?
> > >> > Am i doing it the wrong way?
> > >> > I have already try getting testing for the flags in the channel but
> it
> > >> > did
> > >> > not work,
> > >> > testing of originator or originating does not yield anything ....
> > >> >
> > >> > i might be doing it wrong maybe ?
> > >> >
> > >> > Thanks!
> > >> >
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services: consulting at 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 at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:
> http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at 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 at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>



-- 
Anthony Minessale II       ♬ @anthmfs  ♬ @FreeSWITCH  ♬

☞ http://freeswitch.org/http://cluecon.com/http://twitter.com/FreeSWITCH
☞ irc.freenode.net #freeswitch ☞ *http://freeswitch.org/g+
<http://freeswitch.org/g+>*

ClueCon Weekly Development Call
☎ sip:888 at conference.freeswitch.org  ☎ +19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20150306/eaa333cc/attachment.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list