Module: sems Branch: master Commit: 0073b83c033965986f41365c74c822911c49ac98 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=0073b83c033965986f41365c74c822911c49ac98
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Fri Jul 8 16:50:04 2011 +0200 added DSM example: B2B call connected through audio --- doc/dsm/examples/b2b_connect_audio/aas_callee.dsm | 51 +++++++++++++++ doc/dsm/examples/b2b_connect_audio/aas_caller.dsm | 71 +++++++++++++++++++++ 2 files changed, 122 insertions(+), 0 deletions(-) diff --git a/doc/dsm/examples/b2b_connect_audio/aas_callee.dsm b/doc/dsm/examples/b2b_connect_audio/aas_callee.dsm new file mode 100644 index 0000000..8093566 --- /dev/null +++ b/doc/dsm/examples/b2b_connect_audio/aas_callee.dsm @@ -0,0 +1,51 @@ +-- callee leg of a B2B call connected through audio +import(mod_conference); + +initial state START; + +-- post state to other leg +transition "early in callee leg" START - early / { + set($b_status=EARLY); + postEvent($b_leg_var.a_ltag, b_status); +} -> START; + +transition "ringing in callee leg" START - ringing / { + set($b_status=RINGING); + postEvent($b_leg_var.a_ltag, b_status); +} -> START; + +transition "failed callee leg" START - failed / { + set($b_status=FAILED); + -- copy code and reason to other leg so it can be used as reply code + set($code=#code); + set($reason=#reason); + postEvent($b_leg_var.a_ltag, b_status;code;reason); + + stop(false); +} -> END; + +transition "session starts in callee leg" START - sessionStart / { + set($b_status=CONNECTED); + postEvent($b_leg_var.a_ltag, b_status); + + -- join conference room with A leg ltag + log(1, $b_leg_var.a_ltag); + conference.join($b_leg_var.a_ltag); +} -> CONNECTED; + +-- audio is connected +state CONNECTED; + +transition "disconnect" CONNECTED - hangup / { + set($b_status=DISCONNECT); + postEvent($b_leg_var.a_ltag, b_status); + -- stop the call + stop(false); +} -> END; + +transition "disconnect on other side" (START, CONNECTED) - event(#a_status==DISCONNECT) / { + -- send BYE and stop call + stop(true); +} -> END; + +state END; \ No newline at end of file diff --git a/doc/dsm/examples/b2b_connect_audio/aas_caller.dsm b/doc/dsm/examples/b2b_connect_audio/aas_caller.dsm new file mode 100644 index 0000000..4635279 --- /dev/null +++ b/doc/dsm/examples/b2b_connect_audio/aas_caller.dsm @@ -0,0 +1,71 @@ +-- example for a B2B call connected through audio. On SIP level it is two +-- separate calls to SEMS. mod_conference is used to connect audio through +-- the same conference room. The B leg is authenticated (SIP auth). +-- +-- Important: set run_invite_event=yes in dsm.conf and register_apps=aas_callee,aas_caller + +import(mod_dlg); +import(mod_conference); + +initial state START; +transition "got INVITE in caller leg" START - invite -> RUN_INVITE; + +state RUN_INVITE enter { + set($connect_session=0); + dlg.acceptInvite(183, Session Progress); + + setInOutPlaylist(); + -- caller (from) in + set(b_leg_caller=outgoinguser); + set(b_leg_auth_user=outgoinguser); + set(b_leg_auth_pwd=outgoingpwd); + -- callee + set(b_leg_callee=music); + + -- caller and callee domain + set(b_leg_domain=iptel.org); + -- from aas_callee.dsm + set(b_leg_app=aas_callee); + + + set(b_leg_var.a_ltag=@local_tag); + dlg.dialout(b_leg); + + log(2,$b_leg_ltag); + setTimer(1, 10); +}; + +transition "cancel" (START, RUN_INVITE) - hangup / { + set($a_status=DISCONNECT); + postEvent($b_leg_ltag, a_status); + + dlg.reply(487, Canceled); + stop(false); +} -> END; + +transition "Callee Answered" (START, RUN_INVITE) - test(#b_status==CONNECTED) / { + closePlaylist(false); + dlg.acceptInvite(200, OK); + log(1, @local_tag); + conference.join(@local_tag); +} -> CONNECTED; + +transition "Callee failed" (START, RUN_INVITE) - test(#b_status==FAILED) / { + dlg.reply(#code, #reason); + stop(false); +} -> END; + +state CONNECTED; + +transition "hangup" CONNECTED - hangup / { + set($a_status=DISCONNECT); + postEvent($b_leg_ltag, a_status); + stop(false); +} -> END; + +transition "disconnect on other side" CONNECTED - event(#b_status==DISCONNECT) / { + -- send BYE and stop call + stop(true); +} -> END; + +state END; \ No newline at end of file _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
