<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue style='word-wrap: break-word;-webkit-nbsp-mode: space;
-webkit-line-break: after-white-space'>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>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:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><a
href="http://wiki.freeswitch.org/wiki/Category:Javascript">http://wiki.freeswitch.org/wiki/Category:Javascript</a><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I don&#8217;t see any examples that explicitly
use new.Session() so possibly you could try mimicking the examples available
and see if there&#8217;s a quirk in how your script is attempting to work&#8230;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>-MC<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
freeswitch-users-bounces@lists.freeswitch.org
[mailto:freeswitch-users-bounces@lists.freeswitch.org] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Michael Jerris<br>
<b><span style='font-weight:bold'>Sent:</span></b> Monday, March 24, 2008 7:01
AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">freeswitch-users@lists.freeswitch.org</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [Freeswitch-users]
Help with ignore_early_media</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div>

<p class=MsoNormal><span class=apple-style-span><font size=1 face=Arial><span
style='font-size:7.5pt;font-family:Arial'>2008-03-23 10:22:02 [ERR]
HelloWorld.js:7 mod_spidermonkey()&nbsp; TypeError: callBack is not a function</span></font></span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><span class=apple-style-span><font size=1 face=Arial><span
style='font-size:7.5pt;font-family:Arial'>You have an error in your script, so
the call is aborting.</span></font></span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><span class=apple-style-span><font size=1 face=Arial><span
style='font-size:7.5pt;font-family:Arial'>Mike</span></font></span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Mar 23, 2008, at 1:14 PM, Leonardo Alves wrote:<o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
<br>
<o:p></o:p></span></font></p>

<div bgcolor="#ffffff" leftmargin=0 topmargin=0 canvastabstop=true
name="Compose message area" id=MailContainerBody>

<div>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I need some help using the ignore_early_media.</span></font><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I am using a javascript file to dial a number from a
asterisk server and play a file to the person who answers the phone.</span></font><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>The problem I am having is relatated to the early_media. I
think I am doing something wrong. But I cannot discover what it is.</span></font><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>here is my .js file:</span></font><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>----------------------------------------------------------------------------------------------------------------------------------------------------</span></font><font
size=1><span style='font-size:7.5pt'><o:p></o:p></span></font></p>

<p><font size=1 face="Times New Roman"><span style='font-size:7.5pt'>var
languageCode = &quot;en&quot;;<br>
var soundDir = &quot;sound</span></font><font size=1 face="Courier New"><span
style='font-size:7.5pt;font-family:"Courier New"'>s</span></font><font size=1><span
style='font-size:7.5pt'>/&quot;;<br>
function playFile(fileName, callBack, callBackArgs)<br>
{<br>
</span></font><font size=1 face="Courier New"><span style='font-size:7.5pt;
font-family:"Courier New"'>new_session.</span></font><font size=1><span
style='font-size:7.5pt'>streamFile(soundDir + languageCode + &quot;/&quot; +
fileName, callBack, callBackArgs);<br>
}<br>
</span></font><font size=1 face="Courier New"><span style='font-size:7.5pt;
font-family:"Courier New"'>new_session = new Session();<br>
new_session.setCallerData(&quot;caller_id_name&quot;, &quot;6130356060&quot;);<br>
new_session.originate(session,
&quot;{ignore_early_media=true}sofia/gateway/asterisk/9133803764&quot;);<br>
new_session.waitForAnswer();<br>
if(new_session.ready()){<br>
playFile(&quot;HelloWorld.wav&quot;);<br>
}<br>
</span></font><font size=1><span style='font-size:7.5pt'>exit();</span></font><o:p></o:p></p>

<p><font size=1 face="Times New Roman"><span style='font-size:7.5pt'>------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Here
is the Freeswitch output:</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>jsrun
HelloWorld.js<br>
API CALL [jsrun(HelloWorld.js)] output:<br>
OK</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>2008-03-23
10:21:08 [NOTICE] switch_channel.c:531 switch_channel_set_name() New Channel
sofia/default/9133803764 [ff67046e-f8db-11dc-ad03-7f3820494c31]<br>
<a href="mailto:freeswitch@debianfs01"
title="mailto:freeswitch@debianfs01&#13;&#10;CTRL + Clique para seguir o link">freeswitch@debianfs01</a>&gt;
2008-03-23 10:21:08 [NOTICE] switch_channel.c:1380
switch_channel_perform_mark_pre_answered() Ring-Ready sofia/default/9133803764!<br>
2008-03-23 10:21:08 [NOTICE] sofia_glue.c:1760 sofia_glue_tech_media()
Pre-Answer sofia/default/9133803764!<br>
2008-03-23 10:21:19 [NOTICE] sofia.c:1848 sofia_handle_sip_i_state() Channel
[sofia/default/9133803764] has been answered<br>
2008-03-23 10:22:02 [NOTICE] sofia.c:1946 sofia_handle_sip_i_state() Hangup
sofia/default/9133803764 [CS_HOLD] [NORMAL_CLEARING]<br>
2008-03-23 10:22:02 [ERR] HelloWorld.js:7 mod_spidermonkey()&nbsp; TypeError:
callBack is not a function<br>
2008-03-23 10:22:02 [NOTICE] switch_core_session.c:748
switch_core_session_thread() Session 24 (sofia/default/9133803764) Ended<br>
2008-03-23 10:22:02 [NOTICE] switch_core_session.c:750
switch_core_session_thread() Close Channel sofia/default/9133803764 [CS_HANGUP]</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>The
problem is:</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>If
in the originate command I use the {ignore_early_media=true} option. The script
to play the file is executed when the call is answered. But the person who
answers the phone cannot hear the .wav file. </span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>If
I do not use the {ignore_early_media=true} option. The script to play the file
starts when the call is preAnswered. And when the person in the phone answer
the call, can hear the sound of the .wav file, but the audio has already
started (when the preanswer is executed). </span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>ps:
the computer that is making the call is a asterisk server, connected with the
FS by sip, and the call is made by zaptel whe pri isdn signalling.</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>I
would like to know if I am doing something wrong or this is a bug in the
system.</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Thanks
for the help.</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Leonardo
Alves</span></font><o:p></o:p></p>

<div>

<p class=MsoNormal><font size=1 face="Times New Roman"><span style='font-size:
7.5pt'>&nbsp;</span></font><o:p></o:p></p>

</div>

</div>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br>
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br>
http://www.freeswitch.org<o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</div>

</body>

</html>