Just a thought...
Is there any way I can have Javascript/mod_spidermonkey call the Erlang event interface? Maybe my solution here is "glue"...
Mark Sobkow wrote:Andrew Thompson wrote: I was in the midst of trying something when I got your email, so I kept trying. :)On Mon, Mar 01, 2010 at 03:34:15PM -0600, Mark Sobkow wrote: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.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 http://github.com/Vagabond/OpenACD/blob/master/src/freeswitch_ring.erl for an example. Its ugly but effective. Andrew _______________________________________________ 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
What I found in the docs for originate is that you can invoke a language link using the & syntax, so I tried it with Erlang. Unfortunately, Freeswitch ends up reporting an error. I've tried different ways of passing the Erlang arguments -- no quotes, single quotes, and double quotes -- all end up reporting the same error. 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).
Is this type of interfacing doable? 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.
2010-03-02 08:55:01.796840 [ERR] mod_erlang_event.c:1333 Parse Error - need registered name and node!
callCustomer( PhoneNumber, CustomerName ) ->
{ ok, DialerPrefix } = mnesia_sofia:getSofiaConfigValue( dialerPrefix ),
{ ok, DialerSuffix } = mnesia_sofia:getSofiaConfigValue( dialerSuffix ),
{ ok, DialerTimeout } = mnesia_sofia:getSofiaConfigValue( dialerTimeout ),
OriginateCmd = DialerPrefix ++ PhoneNumber ++ DialerSuffix ++ " &erlang( \"pbx_called_cust\", \"pursuit@testsrv\" ) " ++ DialerTimeout,
syslog:debug( "pbx:callCustomer() OriginateCmd is \"~s\"~n", [OriginateCmd] ),
case api( originate, OriginateCmd ) of
{ ok, ResultStrA } ->
LenA = string:len( ResultStrA ),
UuidA = string:substr( ResultStrA, 5, LenA - 5 ),
syslog:debug( "pbx:callCustomer() UUID A is \"~s\"~n", [ UuidA ] ),
{ ok, PbxCustomerId } = pbx_mnesia:queueCalledCustomer( UuidA,
PhoneNumber,
CustomerName ),
{ ok, PbxCustomerId };
{ error, "-ERR NORMAL_TEMPORARY_FAILURE\n" } ->
syslog:error( "pbx:callCustomer() Error dialing ~s -- Normal temporary failure~n", [PhoneNumber] ),
{ error, normal_temporary_failure };
ErrorA ->
UuidA = "UUIDA",
syslog:error( "pbx:callCustomer() Error dialing ~s -- ~p~n", [PhoneNumber, ErrorA] ),
{ error, untrapped_error }
end.
-- 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: m.sobkow@marketelsystems.com Web: http://www.marketelsystems.com
-- 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: m.sobkow@marketelsystems.com Web: http://www.marketelsystems.com
-- 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: m.sobkow@marketelsystems.com Web: http://www.marketelsystems.com