This block :

    new_session = new Session();
    new_session.originate(session, "sofia/gateway/gizmo/1xxxxxxxxxx");
    console_log("info","Waiting for answer!\n");
    new_session.waitForAnswer(10000);
    console_log("info","***ANSWERED\n");

Can be refactored to:

    new_session = new Session();
    console_log("info","Waiting for answer!\n");
    new_session.originate(session, "{ignore_early_media=true}sofia/gateway/gizmo/1xxxxxxxxxx");
    console_log("info","***ANSWERED\n");

Can be refactored to:

    console_log("info","Waiting for answer!\n");

    new_session = new Session("{ignore_early_media=true}sofia/gateway/gizmo/1xxxxxxxxxx");
    console_log("info","***ANSWERED\n");

You may want to compare the console log with debug level (press f8 on cli) and start FS with TPORT_LOG=1 env var set.
Many voip providers mistakenly answer calls on the inbound SIP leg before bridging it to the PSTN.
You should be able to see the SIP dialog and other console lines telling you if the call was actually answered or not.



On Fri, May 9, 2008 at 12:56 AM, Jonathan Palley <jpalley@idapted.com> wrote:
I think you want:

ignore_early_media=true

JP
On May 9, 2008, at 1:29 PM, Jonas Gauffin wrote:

> Doesn't that just allow media to be sent before a 200 ok? In that
> case, it doesn't solve the waitForAnswer problem?
>
> On Fri, May 9, 2008 at 7:05 AM, Leonardo Alves
> <leoalves@teltec.com.br> wrote:
>> Try using the parameter early_media=true
>> From: Marc Orenberg
>> Sent: Thursday, May 08, 2008 9:39 PM
>> To: freeswitch-users@lists.freeswitch.org
>> Subject: [Freeswitch-users] waitForAnswer returns too soon
>> Hello everyone. I'm a new FreeSwitch user, and I'm having a
>> problem with
>> waitForAnswer() with SpiderMonkey. I'm using it to make an
>> outbound call as
>> follows:
>>
>>     new_session = new Session();
>>     new_session.originate(session, "sofia/gateway/gizmo/
>> 1xxxxxxxxxx");
>>     console_log("info","Waiting for answer!\n");
>>     new_session.waitForAnswer(10000);
>>     console_log("info","***ANSWERED\n");
>>     do {
>>       console_log("info","***Playing file . . . \n");
>>       playFile("we_are_trying_to_reach.wav");
>>     } while(1);
>>
>> When I run this code, the call is answered and it starts playing
>> the file
>> before my phone even starts ringing.
>> I'm not sure if it's a bug with waitForAnswer, or a configuration
>> issue on
>> my side.
>>
>> For the SIP provider, I'm using Gizmo Phone with the following
>> settings in
>> sip_profiles/outbound/gizmo.xml:
>>
>>     <include>
>>       <gateway name="gizmo">
>>         <param name="username" value="1747xxxxxxx"/>
>>         <param name="password" value="xxxxxxx"/>
>>         <param name="realm" value="proxy01.sipphone.com"/>
>>         <param name="proxy" value="proxy01.sipphone.com"/>
>>         <param name="register" value="true"/>
>>       </gateway>
>>     </include>
>>
>> I'd really appreciate any help.
>>
>> Thanks,
>> Marc
>>
>>
>> ________________________________
>>
>> _______________________________________________
>> 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
>>
>> _______________________________________________
>> 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
>>
>>
>
> _______________________________________________
> 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


_______________________________________________
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



--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org
pstn:213-799-1400