[Freeswitch-users] Javascript: inconsistent session.ready() result when originating a call
Marc Kellem
mkellem at vontoo.com
Fri Jun 25 09:12:56 PDT 2010
I'm using Javascript to originate a new outbound call. The Session ready()
method returns inconsistent results when the call is answered. When it
returns false, the session's causecode value is 0. Am I doing something
wrong here, or could it be a bug?
A simple test script and log output is below. I'm executing the script from
the console using jsrun. I've noticed that switch_core_state_machine.c logs
a state change when ready() returns true. I'm not sure if this is
significant, but it might indicate a race condition.
---- test script ----
new_session = new Session(
"{ignore_early_media=true}sofia/internal/1000%192.168.1.10" );
if ( new_session.ready() ) {
console_log( "info", "Call connected.\n" );
// play audio....
}
else {
// the causecode is 0 when this fails on a successful call attempt
console_log("err", "Call not connected. Cause: " + new_session.cause + "["
+ new_session.causecode + "]\n" );
}
---- call connected log ----
[NOTICE] sofia.c:4851 Channel [sofia/internal/1000] has been answered
[DEBUG] switch_ivr_originate.c:3273 Originate Resulted in Success:
[sofia/internal/1000]
[DEBUG] mod_spidermonkey.c:2866 (sofia/internal/1000) State Change
CS_CONSUME_MEDIA -> CS_SOFT_EXECUTE
[DEBUG] switch_core_session.c:1027 Send signal sofia/internal/1000 [BREAK]
[DEBUG] switch_core_state_machine.c:314 (sofia/internal/1000) Running State
Change CS_SOFT_EXECUTE
[INFO] originate.js:1 Call connected.
[DEBUG] switch_core_state_machine.c:354 (sofia/internal/1000) State
SOFT_EXECUTE
[DEBUG] mod_sofia.c:544 SOFIA SOFT_EXECUTE
[DEBUG] switch_core_state_machine.c:200 sofia/internal/1000 Standard
SOFT_EXECUTE
[DEBUG] switch_core_state_machine.c:354 (sofia/internal/1000) State
SOFT_EXECUTE going to sleep
---- call not connected log ----
[NOTICE] sofia.c:4851 Channel [sofia/internal/1000] has been answered
[DEBUG] switch_ivr_originate.c:3273 Originate Resulted in Success:
[sofia/internal/1000]
[DEBUG] mod_spidermonkey.c:2866 (sofia/internal/1000) State Change
CS_CONSUME_MEDIA -> CS_SOFT_EXECUTE
[DEBUG] switch_core_session.c:1027 Send signal sofia/internal/1000 [BREAK]
[ERR] originate.js:1 Call not connected. Cause: NONE(0)
[DEBUG] switch_channel.c:2261 (sofia/internal/1000) Callstate Change ACTIVE
-> HANGUP
[NOTICE] mod_spidermonkey.c:3066 Hangup sofia/internal/1000
[CS_SOFT_EXECUTE] [NORMAL_CLEARING]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100625/1e90a0ee/attachment.html
More information about the FreeSWITCH-users
mailing list