Module: sems
Branch: master
Commit: c1f34bdc610164e3ff616d7672d7e7a3af0a8bc5
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=c1f34bdc610164e3ff616d7672d7e7a3af0a8bc5

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Tue Mar 11 19:30:22 2014 +0100

dsm:sbc: sample application

---

 doc/dsm/examples/sbc/sbc_test_app/howto.txt        |   18 ++++++
 .../profile/sbc_test_app_profile.sbcprofile.conf   |   27 ++++++++
 .../examples/sbc/sbc_test_app/sbc_test_app.conf    |   16 +++++
 doc/dsm/examples/sbc/sbc_test_app/test_sbc.dsm     |   63 ++++++++++++++++++++
 4 files changed, 124 insertions(+), 0 deletions(-)

diff --git a/doc/dsm/examples/sbc/sbc_test_app/howto.txt 
b/doc/dsm/examples/sbc/sbc_test_app/howto.txt
new file mode 100644
index 0000000..57f5436
--- /dev/null
+++ b/doc/dsm/examples/sbc/sbc_test_app/howto.txt
@@ -0,0 +1,18 @@
+ simple DSM SBC test app  -  disconnect B leg after a timer, play a file in 
the A leg after that
+
+ how to use (running from within source dir, in core/):
+  cd core/etc
+  ln -s 
../../doc/dsm/examples/sbc/sbc_test_app/profile/sbc_test_app_profile.sbcprofile.conf
 .
+  mkdir sbc ; cd sbc
+  ln -s ../../doc/dsm/examples/sbc/sbc_test_app/sbc_test_app.conf .
+  
+ corresponding sbc.conf section - load cc_dsm cc plugin:
+   load_cc_plugins=cc_dsm
+   profiles=sbc_test_app_profile
+   active_profile=sbc_test_app_profile
+
+ corresponding dsm.conf :
+   conf_dir=etc/sbc
+
+
+
diff --git 
a/doc/dsm/examples/sbc/sbc_test_app/profile/sbc_test_app_profile.sbcprofile.conf
 
b/doc/dsm/examples/sbc/sbc_test_app/profile/sbc_test_app_profile.sbcprofile.conf
new file mode 100644
index 0000000..8395296
--- /dev/null
+++ 
b/doc/dsm/examples/sbc/sbc_test_app/profile/sbc_test_app_profile.sbcprofile.conf
@@ -0,0 +1,27 @@
+#
+# DSM SBC test app profile
+#
+#
+# how to use (from source dir):
+#  cd core/etc
+#  ln -s 
../../doc/dsm/examples/sbc/sbc_test_app/profile/sbc_test_app_profile.sbcprofile.conf
 .
+#  mkdir sbc ; cd sbc
+#  ln -s ../../doc/dsm/examples/sbc/sbc_test_app/sbc_test_app.conf .
+#  
+# corresponding sbc.conf section - load cc_dsm cc plugin:
+#   load_cc_plugins=cc_dsm
+#   profiles=sbc_test_app_profile
+#   active_profile=sbc_test_app_profile
+#
+# corresponding dsm.conf :
+#   conf_dir=etc/sbc
+
+
+RURI=sip:[email protected]:5088
+
+call_control=cc_dsm
+cc_dsm_module=cc_dsm
+cc_dsm_app_bundle=sbc_test_app
+cc_dsm_start_diag=test_sbc
+
+enable_rtprelay=yes
diff --git a/doc/dsm/examples/sbc/sbc_test_app/sbc_test_app.conf 
b/doc/dsm/examples/sbc/sbc_test_app/sbc_test_app.conf
new file mode 100644
index 0000000..eb794e3
--- /dev/null
+++ b/doc/dsm/examples/sbc/sbc_test_app/sbc_test_app.conf
@@ -0,0 +1,16 @@
+
+# configuration for SBC DSM app
+
+# DSM configuration
+diag_path=../doc/dsm/examples/sbc/sbc_test_app
+load_diags=test_sbc
+register_apps=test_sbc
+
+mod_path=../apps/dsm/mods/lib/
+run_invite_event=yes
+set_param_variables=yes
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- --- ----
+# application configuration:
+
+my_config_var=val
diff --git a/doc/dsm/examples/sbc/sbc_test_app/test_sbc.dsm 
b/doc/dsm/examples/sbc/sbc_test_app/test_sbc.dsm
new file mode 100644
index 0000000..e34d627
--- /dev/null
+++ b/doc/dsm/examples/sbc/sbc_test_app/test_sbc.dsm
@@ -0,0 +1,63 @@
+--
+-- simple DSM/SBC example: disconnect B leg after a timer, play a file in the 
A leg after that
+--
+
+import(mod_dlg);
+import(mod_sbc);
+import(mod_utils);
+
+initial state START enter {
+  log(3, "entering START state");
+};
+
+transition "init event" START - start / {
+  log(3, "initializing");
+  logAll(3);
+
+  if sbc.isALeg() {
+    log(3, "this is an A leg");
+    setTimer(1, 10);
+  } else {
+    log(3, "this is a B leg");
+  }
+} -> RUN;
+
+state RUN;
+
+transition "state changed" RUN - legStateChange / logParams(3) -> RUN;
+
+transition "timer hit" RUN - timer(#id == 1) / {
+  -- save other leg's ltag
+  dlg.getOtherId($b_ltag);
+
+  -- don't send hold, keep media session
+  sbc.disconnect(false, true);
+  
+  -- instruct other leg to hang up
+  set($cmd="hangup");
+  set($call_id=@local_tag);
+  postEvent($b_ltag, cmd;call_id);
+
+  setInputPlaylist();
+  connectMedia();
+  playFile("wav/default_en.wav");
+  sbc.streamsSetReceiving(false, false);
+
+} -> PLAYING_FILE;
+
+state PLAYING_FILE;
+
+transition "file ended" PLAYING_FILE - noAudio / {
+  -- use sbc.stopCall, otherwise RTP relay may still be active
+  sbc.stopCall("normal-call-clearance");
+} -> END;
+
+-- B leg side 
+transition "got disconnect cmd" RUN - event(#cmd=="hangup") / {
+  -- disconnect our leg from the other, too
+  sbc.disconnect(false, true);
+  -- stop our call leg
+  sbc.stopCall("normal-call-clearance");
+} -> END;
+
+state END;
\ No newline at end of file

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to