Thanks MC and Chris for the help.
Reading the list old posts, and searching the wiki and google. I saw that a few  people were having problems using javascrpit to originate and control a call with .session in high volume calls.
And the suggestion was to use the XML-RPC to originate the calls and use the dialplan or a javascript to handle the response.
So that's what I am doing.
I have started to use the freeswitch this weekend and I am very happy with it until now.
Leonardo

From: Chris Danielson
Sent: Monday, March 24, 2008 3:01 PM
To: freeswitch-users@lists.freeswitch.org
Subject: Re: [Freeswitch-users] Help with ignore_early_media

Here is how to handle a new session, though this is used as an example that shows bridging after a successful originate call is made.  You can remove the bridging code if need be.

//the str variable contains where we are calling and how to go about it.
    var str = "{ignore_early_media=true}sofia/gateway/blahBlahProvider/15551231234@sip.blahprovider.com"; 
    session.setVariable("ringback", "%(2000, 4000, 440.0, 480.0)");  //only if necessary... may not need this line.
    var s = new Session();
    s.setCallerData("caller_id_name", "My Name Is");
    s.setCallerData("caller_id_number", "16661112222");
    if (s.originate(session, str, timeout)) {
        s.waitForMedia();
        s.setAutoHangup(true);
        bridge(session, s);
    }

//Callback reference:   http://wiki.freeswitch.org/wiki/Javascript_DTMF_Callback_Function 

Hope this helps,
-Chris


Michael Collins wrote:

Interestingly, even though JavaScript is the most developed of the control languages, there is a dearth of sample scripts in SVN. Try here for help:

http://wiki.freeswitch.org/wiki/Category:Javascript

 

I don’t see any examples that explicitly use new.Session() so possibly you could try mimicking the examples available and see if there’s a quirk in how your script is attempting to work…

 

-MC