can you press f8 for debug and try that apiExecute and post the results?<br><br><div class="gmail_quote">On Wed, Feb 4, 2009 at 8:46 AM, Jacek Sokulski <span dir="ltr">&lt;jsokulski@dotsystems.pl&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks Anthony,<br>
the js snippets are very instructive.<br>
A couple of points:<br>
1. The code with apiExecute does not work (local phone is connected, but<br>
after picking up it hungs up immediately), other examples are working<br>
fine.<br>
<br>
2. It does not show how initiate external call without existing session.<br>
<br>
3. How can one pass the call through dialplan?<br>
<br>
Jacek<br>
<br>
PS.<br>
we got the code probable from wiki or from this mialing list.<br>
<br>
Dnia 04-02-2009, śro o godzinie 08:09 -0600, Anthony Minessale pisze:<br>
<div><div></div><div class="Wj3C7c">&gt; Where did you learn how to use js this way?<br>
&gt; session.originate is being misused here and is depricated and may be<br>
&gt; removed.<br>
&gt;<br>
&gt; the first arg to session.originate is either undefined or a<br>
&gt; *different* session (the a leg)<br>
&gt;<br>
&gt; session1 = new Session();<br>
&gt; session1.originate(undefined,<br>
&gt; &quot;{ignore_early_media=true}user/<a href="mailto:1008@192.168.1.122">1008@192.168.1.122</a>&quot;);<br>
&gt;<br>
&gt; session1.setVariable(&quot;effective_caller_id_number&quot;,&quot;fixed0248b&quot;);<br>
&gt;<br>
&gt; //once you have session1 when you originate session2 you pass session1<br>
&gt; as the arg<br>
&gt; // the effective_caller_id is taken from session1<br>
&gt;<br>
&gt; session2 = new Session();<br>
&gt; session2.originate(session1, &quot;sofia/gateway/halonet/0225490317&quot;);<br>
&gt;<br>
&gt; Anyway this whole code is depricated in favor of this:<br>
&gt;<br>
&gt; session1 = new<br>
&gt; Session(&quot;{ignore_early_media=true}user/<a href="mailto:1008@192.168.1.122">1008@192.168.1.122</a>&quot;);<br>
&gt;<br>
&gt; if (session1.ready()) {<br>
&gt; &nbsp; session1.setVariable(&quot;effective_caller_id_number&quot;,&quot;fixed0248b&quot;);<br>
&gt; &nbsp; session2 = new Session(&quot;sofia/gateway/halonet/0225490317&quot;,<br>
&gt; session1);<br>
&gt; }<br>
&gt;<br>
&gt; and could be further refactored down to this:<br>
&gt;<br>
&gt; session1 = new<br>
&gt; Session(&quot;{ignore_early_media=true}user/<a href="mailto:1008@192.168.1.122">1008@192.168.1.122</a>&quot;);<br>
&gt; if (session1.ready()) {<br>
&gt; &nbsp; session1.setVariable(&quot;effective_caller_id_number&quot;,&quot;fixed0248b&quot;);<br>
&gt; &nbsp; session1.execute(&quot;bridge&quot;, &quot;sofia/gateway/halonet/0225490317&quot;);<br>
&gt; }<br>
&gt;<br>
&gt; or down to this one line of code that will setup the call detached<br>
&gt; from the script and exit.<br>
&gt;<br>
&gt; var result = apiExecute(&quot;originate&quot;,<br>
&gt; &quot;{effective_caller_id_number=fixed0248b,origination_caller_id_number=1000,ignore_early_media=true}user/<a href="mailto:1008@192.168.1.122">1008@192.168.1.122</a> bridge:sofia/gateway/halonet/0225490317 inline&quot;);<br>

&gt;<br>
&gt; if you dont care about the result and want to exit even before the<br>
&gt; call is completed.<br>
&gt;<br>
&gt; var result = apiExecute(&quot;bgapi&quot;, &quot;originate<br>
&gt; {effective_caller_id_number=fixed0248b,origination_caller_id_number=1000,ignore_early_media=true}user/<a href="mailto:1008@192.168.1.122">1008@192.168.1.122</a> bridge:sofia/gateway/halonet/0225490317 inline&quot;);<br>

&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Wed, Feb 4, 2009 at 2:51 AM, Jacek Sokulski<br>
&gt; &lt;jsokulski@dotsystems.pl&gt; wrote:<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; We have tried setting both effective_caller_id_number and<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; origination_caller_id_number:<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; session1.originate(session1,&quot;{origination_caller_id_number=fixed0248b}sofia/gateway/halonet/0225490317&quot;,15);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;but the problem still exists. The solution we have found for<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; the case<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; when we originate two calls, local and external, is as follow:<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; session1 = new Session();<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; session1.originate(session1,&quot;user/<a href="mailto:1003@192.168.1.122">1003@192.168.1.122</a>&quot;,15);//local<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; if(session1.ready()) {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;session1.execute(&quot;execute_extension&quot;,&quot;00930691688627 XML<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; default&quot;);//external<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; so the external call goes through the dialplan.<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; It does not work if both calls are external. One possible<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; solution could be<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; to pass the originating call through dialplan (loopback?) but<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; we have not managed<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; to figure out how to do it.<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; Thanks<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; Jacek<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; Dnia 03-02-2009, wto o godzinie 14:31 -0300, Nicolas Brenner<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; pisze:<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; Oops! Well, fortunately I don&#39;t use that voip provider<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; anymore (nor the script).<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; Thanks Brian.<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; Nicolas<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; On Tue, Feb 3, 2009 at 2:25 PM, Brian West<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;<a href="mailto:brian@freeswitch.org">brian@freeswitch.org</a>&gt; wrote:<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt; YOU should NEVER use this method or call setCallerData at<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; all &nbsp;you<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt; should use the correct methods to override the callerid.<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt; If its a B-Leg born from an A-Leg you use these on the on<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; the A-Leg:<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://wiki.freeswitch.org/wiki/Channel_Variables#effective_caller_id_name" target="_blank">http://wiki.freeswitch.org/wiki/Channel_Variables#effective_caller_id_name</a><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://wiki.freeswitch.org/wiki/Channel_Variables#effective_caller_id_number" target="_blank">http://wiki.freeswitch.org/wiki/Channel_Variables#effective_caller_id_number</a><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt; If you&#39;re originating you use this:<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://wiki.freeswitch.org/wiki/Channel_Variables#origination_caller_id_name" target="_blank">http://wiki.freeswitch.org/wiki/Channel_Variables#origination_caller_id_name</a><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://wiki.freeswitch.org/wiki/Channel_Variables#origination_caller_id_number" target="_blank">http://wiki.freeswitch.org/wiki/Channel_Variables#origination_caller_id_number</a><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; &gt; /b<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; _______________________________________________<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; Freeswitch-users mailing list<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; <a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
&gt;<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; _______________________________________________<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; Freeswitch-users mailing list<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Anthony Minessale II<br>
&gt;<br>
&gt; FreeSWITCH <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>
&gt; ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>
&gt;<br>
&gt; AIM: anthm<br>
&gt; <a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>
&gt; GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
&gt; IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch<br>
&gt;<br>
&gt; FreeSWITCH Developer Conference<br>
&gt; <a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br>
&gt; <a href="http://iax:guest@conference.freeswitch.org/888" target="_blank">iax:guest@conference.freeswitch.org/888</a><br>
&gt; <a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
&gt; pstn:213-799-1400<br>
&gt; _______________________________________________<br>
&gt; Freeswitch-users mailing list<br>
&gt; <a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br>
<br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
<br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400<br>