[Freeswitch-users] ESL Managed IVR and CallControl

Michael Lutz mytemike72 at gmail.com
Fri Jan 13 16:54:12 MSK 2012


Hi Michael,

Thanks for the interjection :) it is not specially for billing, though I
need the hangup to cleanup a lot of database stuff (using stored
procedures). My plan was to finalize my data using the hangup and using
some other mechanism to finalize my billing data (for example using the
mod_xml_cdr to trigger the end of the call).

But as I am also going to dialout and bridge calls I also need it to be
able to detect the aleg hung up and disconnect the bleg? Or are there other
ways to do that?

For example I want to do something like: (example code written for
mod_managed wich I did't get to work: (leg_a and leg_b.bridged return false
after connecting))

            route = "3112345678" // Number to dial
            string obCause = "ERROR";
            FreeSWITCH.Native.Api fsApi = new FreeSWITCH.Native.Api();

            //  Creating the new session...
            ManagedSession leg_b = new
ManagedSession("{ignore_early_media=true,origination_caller_id_number=" +
orig + ",originate_timeout=20}sofia/external/" + route);
            if (leg_b.Ready())
            {
                if (leg_b.answered())
                {
                    MCX.AnswerCall(leg_a);   // answer the incomming call
as it was in 'ring_ready'
                    leg_a.sleep(1000, 0);
                    string apiResult =
fsApi.ExecuteString(string.Format("uuid_bridge {1} {0}", leg_a.GetUuid(),
leg_b.GetUuid()));
                    obCause = "SUCCESS";
                    Debug("As long as both legs are Ready(), we
wait......");
                    while (leg_a.bridged() && leg_b.bridged())  // Returns
false right away (bug?)
                    {
                        leg_a.sleep(1000, 0); // Slow it down...
                    }
                    Debug("There is one leg no longer ready...");
                    if (leg_a.bridged()) { Debug("Session A still
ready..."); } else { Debug("Session A NO LONGER ready..."); }
                    if (leg_b.bridged()) { Debug("Session B still
ready..."); } else { Debug("Session B NO LONGER ready..."); }
                }
                else
                {
                    Debug("A-Leg aborted while dialing...");
                }
                /*
                if (leg_b.Ready())
                {
                    Debug("B-Leg still here, so hanging up B-Leg...");
                    leg_b.Hangup("NORMAL_CALL_CLEARING");
                    leg_b.destroy();
                }
                 * */
            }
            else
            {
                obCause = leg_b.hangupCause();
            }
            Debug("simpleCall() ended with: " + obCause);
            return obCause;
        }
Can you help me on how to do this in managedESL ?

Thanks,
Mike

2012/1/13 Michael Giagnocavo <mgg at giagnocavo.net>

> What do you need to catch hangup for? If it’s for accounting, I’ll repeat
> my general lesson that I painfully learned. Don’t do it. Antony and I spent
> quite some time trying to sort out problems related to doing accounting
> “in-call”, all the while they were telling me to not do it. I ended up with
> a lot of hacky code that sorta worked most of the time. A much better
> approach is to set vars on the channel and collect them when the XML CDR is
> written. If you need real-time accounting, just log the call once it opens
> to a database, and calculate outstanding balance from there.****
>
> ** **
>
> If it’s another thing you’re trying to do on hangup, excuse my
> interjection here J****
>
> -Michael****
>
> ** **
>
> *From:* freeswitch-users-bounces at lists.freeswitch.org [mailto:
> freeswitch-users-bounces at lists.freeswitch.org] *On Behalf Of *Michael Lutz
> *Sent:* Friday, January 13, 2012 6:31 AM
> *To:* FreeSWITCH Users Help
> *Subject:* Re: [Freeswitch-users] ESL Managed IVR and CallControl****
>
> ** **
>
> Hi Hector,****
>
>  ****
>
> Thanks for your reply. I am trying the provided ManagedEsl test project
> now. It seems to do what I want but having much trouble trying to add
> functionality. I hope someone here can help me with a better server example
> with esl in outbound mode.****
>
>  ****
>
> I am also wondering how to set eventhandlers for dtmf or channel hangup
> events? ****
>
> Is there anyone here that can help me with some examples?****
>
>  ****
>
> For example I need to be able to catch the hangup or be able to respond to
> dtmfs.****
>
>  ****
>
> Thanks,****
>
> Mike.****
>
> 2012/1/12 Hector Geraldino <Hector.Geraldino at ip-soft.net>****
>
> I have experience setting up something like that, but in Java.****
>
>  ****
>
> You should use ESL in outbound mode. For every new incoming call, FS will
> open a socket connection to an ip:port where your application should be
> listening to, and you will have complete control over the incoming call.
> So, in theory, you should only need to have a SocketServer listening to an
> specific port, and send commands/receive events from FS to your application
> (you can play a little bit with this in linux using the netcat (nc)
> utility, or maybe in windows by installing Cygwin  and using nc.exe)****
>
>  ****
>
> I’m happy using the Java ESL library, a pure socket-based java application
> (jboss/netty based) with no dependencies on system libs.  Maybe (and this
> is a BIG MAYBE) you can reuse this library from .NET, relying on Mono’s
> IKVM tool, that allows Java-to-NET interoperability by converting Java’s
> JVM bytecode to .NET CLR. I’ve taken this approach before, when I found a
> terrific tool in Java (jPOS, for example) with no counterparts in .NET.***
> *
>
>  ****
>
> This is only one option. There’s always the option of building your own
> application listening on a socket, or using the .NET libraries listed on
> the wiki:****
>
>  ****
>
> http://wiki.freeswitch.org/wiki/Mod_event_socket#.NET_Client_library****
>
>  ****
>
> Good luck! ****
>
>  ****
>
> *From:* freeswitch-users-bounces at lists.freeswitch.org [mailto:
> freeswitch-users-bounces at lists.freeswitch.org] *On Behalf Of *Michael Lutz
> *Sent:* Thursday, January 12, 2012 10:02 AM
> *To:* FreeSWITCH-users at lists.freeswitch.org
> *Subject:* [Freeswitch-users] ESL Managed IVR and CallControl****
>
>  ****
>
> Hi,****
>
>  ****
>
> I have been playing with mod_managed for a while now but nobody realy
> seems to be able to help me out. So now I am trying to go to ESL. (which
> most of the people suggest anyway).****
>
>  ****
>
> What I need is control from .net over the complete call! (so even when
> bridged and returns). ****
>
>  ****
>
> I need to build  a main library where all my generic functions will be put
> in so I can use them in my different scripts.****
>
>  ****
>
> What I''ve figured out is problably the best way is to write a server
> which connects to my FS an listens to all events.****
>
> When a call comes in I need to fire a stored procedure to my sqlserver and
> based on the reply I will decide if the call needsto be answerred, early
> media needs to be played, or the call needs to be rejected.****
>
>  ****
>
> In any case, at the end of every call (answered or not) I need to finalize
> my call with another stored procedure.****
>
>  ****
>
> When teh call is answered based on stored procedure result I need to run a
> script (also managed code) ****
>
> run a script from another dll so I have all my scripts separate but they
> share the corelib I create.****
>
>  ****
>
> I have been searching the web for a long time now to see if I can find
> something simular, but I only see generic examples wich don't actually show
> how to control multiple calls in a scenario like this.****
>
>  ****
>
> Who can help me out point me to the right direction or has experience in
> setting something up like this?****
>
>  ****
>
>  ****
>
> Thanks in advance,****
>
> Michael Lutz.****
>
>  ****
>
>  ****
>
>  ****
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.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://wiki.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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120113/882f19fd/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list