Hi,

do you mind if we discuss this on-list?

David J. wrote:
 Hi Stefan,

I am trying to accomplish a script that parallel forks to many callers and then the one who enters the right DTMF code gets the call.

In order to do this, I am guessing, I need b2b_mode which sends RINGING back to the Caller, does the forking plays a WAV/MP3 announcement to the Callee's and some sort of DTMF detection that captures the dialed digits and verify's them via script, database or whatever.

actually, in order to be able to prompt the callees and collect the DTMF from them, you will have to establish separate calls to them - so that b2b mode is not really suitable. Once the right callee leg is identified, though, you can connect audio from the caller and the callee leg by joining the same conference room. You can interact between the two legs (e.g. when one hangs up) by sending events back and forth, the only thing you need is to know in both legs is the id of the other leg (local-tag).

But, to start from the beginning. We will need two DSM scripts, one for the caller, one for the callee leg. We call that application quizconnect, and we tell dsm to load DSM application configurations by setting in dsm.conf:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
conf_dir=/usr/local/etc/sems/dsm/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Then we can create /usr/local/etc/sems/dsm/quizconnect.conf which loads the scripts and sets the settings for the quizconnect application:
/usr/local/etc/sems/dsm/quizconnect.conf:
-----------------------------------
diag_path=/usr/local/lib/sems/dsm/quizconnect/
load_diags=quizconnect_caller,quizconnect_callee
register_apps=quizconnect_caller,quizconnect_callee
mod_path=/usr/local/lib/sems/dsm/
preload_mods=mod_mysql
run_invite_event=yes
set_param_variables=yes
#run_system_dsms=

# some configuration parameters
#  - can be used with e.g. $config.prompt_path
prompt_path=/usr/local/lib/sems/dsm/quizconnect/prompts/
-----------------------------------

We have preloaded the mysql module, which needs this to be initialized and read its configuration (which contains the DB connection, for example). We also set run_invite_event=yes in the dsm config, that way we get an 'invite' event into the DSM scripts. Now we create two scripts, /usr/local/lib/sems/dsm/quizconnect/quizconnect_caller.dsm and /usr/local/lib/sems/dsm/quizconnect/quizconnect_callee.dsm .

When that invite event comes, we tell dsm to not connect the session (i.e. reply with 200 and connect audio), but to reply 183 (early media) and play a file:

/usr/local/lib/sems/dsm/quizconnect/quizconnect_caller.dsm:
-------------------------------------------------------
import(mod_dlg);
initial state START;
transition "got INVITE in caller leg" START - invite -> RUN_INVITE;

initial state RUN_INVITE enter {
  log(2, "got invite!");
  set($connect_session=0);
  -- reply with 183 and parse SDP
  dlg.acceptInvite(183, Session Progress);
  -- set input and output of the session (we have $connect_session=0)
  setInOutPlaylist();
  -- play some welcome message
  sets($prompt_name=$(config.prompt_path)/welcome_caller.wav)
  playFile($prompt_name);
};
-------------------------------------------------------

To run this, in sems.conf set application=quizconnect_caller .

so, that's the first part. in the next part, we will see how we can read callee numbers from mysql DB, create some callee legs, and interact between caller and callee legs.


In your experience do you think SEMS would be a good tool to do this?
definitely. You need to use the git master version of SEMS; some of the needed functionality is not in sems 1.2.


If so could you point me to examples or documentation on how to accomplish my task?
as you can see above, the easiest is to implement this in DSM. here are some links to examples and documentation:
doc/dsm
apps/dsm/mods/*/Readme.*

http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sems;a=tree;f=doc/dsm
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sems;a=blob_plain;f=doc/dsm/dsm_syntax.txt;hb=HEAD
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sems;a=tree;f=doc/dsm/examples/dsm_di_monit;hb=HEAD
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sems;a=blob_plain;f=apps/dsm/mods/mod_dlg/Readme.mod_dlg.txt;hb=HEAD
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sems;a=blob_plain;f=apps/dsm/mods/mod_mysql/Readme.mod_mysqlpp.txt;hb=HEAD
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sems;a=blob_plain;f=apps/dsm/mods/mod_conference/Readme.mod_conference.txt;hb=HEAD
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sems;a=blob_plain;f=apps/dsm/mods/mod_utils/Readme.mod_utils.txt;hb=HEAD

Best Regards
Stefan


Thanks in advance for any guidance.

David.





--
Stefan Sayer
VoIP Services Consulting and Development

Warschauer Str. 24
10243 Berlin

tel:+491621366449
sip:[email protected]
email/xmpp:[email protected]


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

Reply via email to