Comments inline. On Tue, Feb 23, 2010 at 03:00:46PM -0600, Mark Sobkow wrote:It's become clear that I need to use Erlang event processing to do what I need to do with Freeswitch, but I can't even get the most basic of tasks working yet. (i.e. Answer the call and collect the PIN code from the operator.) The dialplan version of what I'm trying to do is: <extension name=\"OpCallsIn\"> <condition field=\"destination_number\" expression=\"^6100$\"> <action application=\"answer\" /> <action application=\"play_and_get_digits\" data=\"4 4 1 5000 # /opt/freeswitch/sounds/en/us/callie/conference/8000/conf-pin.wav /opt/freeswitch/sounds/en/us/callie/conference/8000/conf-bad-pin.wav operator_pin \\d+\" /> <action application=\"log\" data=\"INFO operator_pin is ${operator_pin}\" /> <action application=\"log\" data=\"INFO Queueing operator to fifo\" /> <action application=\"fifo\" data=\"6100@${domain_name} in\" /> </condition> </extension> Attached is the Erlang that's attempting to do the same thing. The Erlang is invoked by the following dialplan fragment: <extension name=\"ErlangCallback\"> <condition field=\"destination_number\" expression=\"^6200$\"> <action application=\"erlang\" data=\"pbx_callback pursuit@testsrv\" /> </condition> </extension> Any suggestions?Why not request the pin in the dialplan and then yield call control to erlang? That's what I do most of the time.%% Author: mark %% Created: Feb 23, 2010 %% Description: TODO: Add description to pbx_callback -module(pbx_callback). %% %% Include files %% %% %% Exported Functions %% -export([start/0, run/0, launch/1]). start() -> Pid = spawn( ?MODULE, run, [] ), register( ?MODULE, Pid ), { ok, Pid }. run() -> receive { call, Data } -> { event, [UUID | Rest]} = Data, syslog:debug( "pbx_callback:run() New call received, UUID=~p, Rest=~p~n", [UUID, Rest] ), AnswerResults = pbx:api( eval, "uuid:" ++ UUID ++ " answer" ), syslog:debug( "pbx_callback:run() AnswerResults=~p~n", [AnswerResults] ), GetPinResults = pbx:api( eval, "uuid:" ++ UUID ++ " play_and_get_digits 4 4 1 5000 # /opt/freeswitch/sounds/en/us/callie/conference/8000/conf-pin.wav /opt/freeswitch/sounds/en/us/callie/conference/8000/conf-bad-pin.wav operator_pin \\d+" ), syslog:debug( "pbx_callback:run() GetPinResults=~p~n", [GetPinResults] ), GetPinVarResults = pbx:api( uuid_getvar, UUID ++ " operator_pin" ), syslog:debug( "pbx_callback:run() GetPinVarResults=~p~n", [GetPinVarResults] ), run(); {call_event, Data} -> { event, [UUID | Rest]} = Data, Name = proplists:get_value( "Event-Name", Rest ), syslog:debug( "pbx_callback:run() call_event UUID=~p, Name=~p, Rest=~p~n", [UUID, Name, Rest] ), run(); {get_pid, UUID, Ref, Pid} -> NewPid = spawn( ?MODULE, run, [] ), syslog:debug( "pbx_callback:run() Request to spawn new handler process, returning PID ~p~n", [NewPid] ), Pid ! { Ref, NewPid }, run() end. launch( Ref ) -> NewPid = spawn( ?MODULE, run, [] ), syslog:debug( "pbx_callback:launch() Returning new PID ~p~n", [NewPid] ), {Ref, NewPid}.I don't know what your 'pbx' module is doing so I can't really help you there. Are you doing a sendmsg for play_and_get_digits or what? You should be using a uuid_getvar to get the result of the play_and_get_digits in any case. How far does this code get before failing? Andrew
-- 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