From fd023e2fb1ad243c438ffa3e13859e1933e624e0 Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Fri, 6 Nov 2009 20:27:16 +0000 Subject: [PATCH] just another example git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1613 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- apps/dsm/doc/examples/183_early_establish.dsm | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 apps/dsm/doc/examples/183_early_establish.dsm diff --git a/apps/dsm/doc/examples/183_early_establish.dsm b/apps/dsm/doc/examples/183_early_establish.dsm new file mode 100644 index 00000000..19d38247 --- /dev/null +++ b/apps/dsm/doc/examples/183_early_establish.dsm @@ -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;