just another example

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1613 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 17 years ago
parent 435bd315db
commit fd023e2fb1

@ -0,0 +1,54 @@
-- this is an example of an early media application, that
-- has to do some possibly blocking operation on start of processing,
-- so session processing is delayed (here with timer 1)
-- later 183 is sent, and after playing a message, 200 OK is sent,
-- and 10 seconds are recorded to a file.
import(mod_dlg);
initial state START ;
transition "on invite" START - invite -> runinvite;
transition "on sess start" START - sessionStart -> runstart;
state runinvite
enter {
log(2, run invite!);
dlg.reply(100, trying...);
-- we don't want to have the default 200 OK reply
set(connect_session=0);
};
state runstart
enter {
log(2, run start!);
-- we don't want to have session connected (RTP sent) yet
set(connect_session=0);
setTimer(1, 2);
};
transition "go early" runstart - timerTest(#id==1) /
dlg.acceptInvite(183, progress);
connectMedia();
playFile(wav/default_en.wav);
-> playing_early_msg;
transition "playing file failed" runstart - exception; test(#type==file) / {
log(1, Error playing file!);
dlg.reply(500, server error);
stop
} -> FIN;
state playing_early_msg;
transition "early message ended" playing_early_msg - noAudioTest /
dlg.acceptInvite(200, ok);
recordFile(/tmp/test.wav);
setTimer(3,10);
-> recording;
transition "recording failed" playing_early_msg - exception; /
log(1, Error recording!); stop(true) -> FIN;
state recording;
transition "recording timer" recording - timerTest(#id==3) / stop(true) -> FIN;
transition bye (playing_early_msg, recording) - hangup / stop -> FIN;
state FIN;
Loading…
Cancel
Save