<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Just a thought...<br>
<br>
Is there any way I can have Javascript/mod_spidermonkey call the Erlang
event interface?&nbsp; Maybe my solution here is "glue"...<br>
<br>
Mark Sobkow wrote:
<blockquote cite="mid:4B8D2967.7010403@marketelsystems.com" type="cite">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
Andrew Thompson wrote:
  <blockquote cite="mid:20100301221524.GB1751@hijacked.us" type="cite">
    <pre wrap="">On Mon, Mar 01, 2010 at 03:34:15PM -0600, Mark Sobkow wrote:
  </pre>
    <blockquote type="cite">
      <pre wrap="">I'm using the originate command from Erlang, specifying a timeout of 30 
seconds.  It is properly giving up on dialing, but it's still returning 
a call UUID instead of an error/timed out status.

    </pre>
    </blockquote>
    <pre wrap=""><!---->How are you doing an originate, and what 'UUID' are you getting back?

The way I do it is I do an bgapi originate with origination_uuid set and
I poll for that UUID 10 times every 100 milliseconds to see if its up.
Even if you originate a channel that's going to ring out the channel
will be up for that period and so you can connect to it and receive the
HANGUP event with the cause code to see what happened.

See the init() function in

<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="http://github.com/Vagabond/OpenACD/blob/master/src/freeswitch_ring.erl">http://github.com/Vagabond/OpenACD/blob/master/src/freeswitch_ring.erl</a>

for an example. Its ugly but effective.

Andrew

_______________________________________________
FreeSWITCH-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="http://www.freeswitch.org">http://www.freeswitch.org</a>

  </pre>
  </blockquote>
I was in the midst of trying something when I got your email, so I kept
trying. :)<br>
  <br>
What I found in the docs for originate is that you can invoke a
language link using the &amp; syntax, so I tried it with Erlang.&nbsp;
Unfortunately, Freeswitch ends up reporting an error.&nbsp; I've tried
different ways of passing the Erlang arguments -- no quotes, single
quotes, and double quotes -- all end up reporting the same error.&nbsp; The
source code for mod_erlang_event.c indicates that the error means it's
not getting the arguments at all (it's checking for 2).<br>
  <br>
Is this type of interfacing doable?&nbsp; I really need to get the event
hooks working for the call rather than using polling logic, because I
need to know when the call is hung up so I can transfer the A leg
(operator) to an IVR where they can enter the call results, then put
the operator back in queue to answer another call without hanging up on
the operator.<br>
  <br>
2010-03-02 08:55:01.796840 [ERR] mod_erlang_event.c:1333 Parse Error -
need registered name and node!<br>
  <br>
  <br>
callCustomer( PhoneNumber, CustomerName ) -&gt;<br>
&nbsp;&nbsp;&nbsp; { ok, DialerPrefix } = mnesia_sofia:getSofiaConfigValue(
dialerPrefix ),<br>
&nbsp;&nbsp;&nbsp; { ok, DialerSuffix } = mnesia_sofia:getSofiaConfigValue(
dialerSuffix ),<br>
&nbsp;&nbsp;&nbsp; { ok, DialerTimeout } = mnesia_sofia:getSofiaConfigValue(
dialerTimeout ),<br>
&nbsp;&nbsp;&nbsp; OriginateCmd = DialerPrefix ++ PhoneNumber ++ DialerSuffix ++ "
&amp;erlang( \"pbx_called_cust\", \"pursuit@testsrv\" ) " ++
DialerTimeout,<br>
&nbsp;&nbsp;&nbsp; syslog:debug( "pbx:callCustomer() OriginateCmd is \"~s\"~n",
[OriginateCmd] ),<br>
&nbsp;&nbsp;&nbsp; case api( originate, OriginateCmd ) of<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { ok, ResultStrA } -&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; LenA = string:len( ResultStrA ),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; UuidA = string:substr( ResultStrA, 5, LenA - 5 ),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; syslog:debug( "pbx:callCustomer() UUID A is \"~s\"~n", [
UuidA ] ),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { ok, PbxCustomerId } = pbx_mnesia:queueCalledCustomer(
UuidA,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PhoneNumber,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CustomerName ),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { ok, PbxCustomerId };<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { error, "-ERR NORMAL_TEMPORARY_FAILURE\n" } -&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; syslog:error( "pbx:callCustomer() Error dialing ~s --
Normal temporary failure~n", [PhoneNumber] ),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { error, normal_temporary_failure };<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ErrorA -&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; UuidA = "UUIDA",<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; syslog:error( "pbx:callCustomer() Error dialing ~s --
~p~n", [PhoneNumber, ErrorA] ),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { error, untrapped_error }<br>
&nbsp;&nbsp;&nbsp; end.<br>
  <br>
  <br>
  <pre class="moz-signature" cols="72">-- 
Mark Sobkow
Senior Developer
MarkeTel Multi-Line Dialing Systems LTD.
428 Victoria Ave
Regina, SK S4N-0P6
Toll-Free: 800-289-8616-X533
Local: 306-359-6893-X533
Fax: 306-359-6879
Email: <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="mailto:m.sobkow@marketelsystems.com">m.sobkow@marketelsystems.com</a>
Web: <a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="http://www.marketelsystems.com">http://www.marketelsystems.com</a> </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Mark Sobkow
Senior Developer
MarkeTel Multi-Line Dialing Systems LTD.
428 Victoria Ave
Regina, SK S4N-0P6
Toll-Free: 800-289-8616-X533
Local: 306-359-6893-X533
Fax: 306-359-6879
Email: <a class="moz-txt-link-abbreviated" href="mailto:m.sobkow@marketelsystems.com">m.sobkow@marketelsystems.com</a>
Web: <a class="moz-txt-link-freetext" href="http://www.marketelsystems.com">http://www.marketelsystems.com</a> </pre>
</body>
</html>