Stefan Sayer writes: > sorry you have so many issues using this.
no problem. it is mostly my fault (slow learner). thanks for your help. > maybe you need to clear the ltag before calling dlg.dialout, otherwise > it may be reused (that feature is so that you can generate the ltag > before you already make the call). that was it. now i got dsm version of di_dialer app working (below for the records in case someone else tries the same). the only open issue is how to figure out that the message played by conference.playMixIn($message_file); to the callee has ended so that the call can be properly terminated. i already asked this before and got a hint to use addSeparator: http://lists.iptel.org/pipermail/sems/2013-June/004221.html i added addSeparator(100, false) call after conference.playMixIn($message_file), but don't see in debug any event fired. i therefore terminate the call by a timer. there is also the 183 followed by 200 issue remaining, but that is not dsm related. -- juha ------------------------------------------------------------------------ -- SystemDSM that includes "call" command for playing message to callee import(mod_dlg); import(mod_utils); initial state RUNNING; transition "startup" RUNNING - startup / { log(2, "Starting system_dsm ..."); logAll(2); registerEventQueue("system_dsm"); setTimer(1, 30); } -> RUNNING; transition "timer hit" RUNNING - timer / log(2, "still alive!"); setTimer(1, 30); -> RUNNING; transition "shutdown" RUNNING - system / unregisterEventQueue(system_dsm); stop(false) -> END; transition "stop cmd" RUNNING - eventTest(#cmd=="stop") / logAll(2); unregisterEventQueue(system_dsm); stop(false) -> END; state END; transition "reload cmd" RUNNING - eventTest(#cmd=="reload") / log(2, "got refresh"); logParams(2); -> RUNNING; transition "new call requested" RUNNING - eventTest(#cmd=="call") / { log(2, "system_dsm: got call request with params"); logParams(2); -- Message set(b_leg_message=#message) -- Caller set(b_leg_caller=#caller); sets(b_leg_from="sip:#(caller)@#(caller_domain)"); -- Callee set(b_leg_callee=#callee); set(b_leg_domain=#callee_domain); -- Headers set(hdrs="P-App-Name: extensions\r\n"); append(hdrs, "P-Asserted-Identity: "); append(hdrs, $b_leg_from); append(hdrs, "\r\n"); set(b_leg_hdrs=$hdrs); sets(b_leg_r_uri="sip:#callee@#callee_domain"); set(b_leg_app=ann_callee); set(b_leg_var.status_sink="system_dsm"); set(b_leg_var.caller=#caller); set(b_leg_var.callee=#callee); set(b_leg_var.message=#message); dlg.dialout(b_leg); sets($msg="system_dsm: call b_leg_ltag $b_leg_ltag"); log(2, $msg); clear($b_leg_ltag); } -> RUNNING; transition "failure from callee" RUNNING - event(#b_status==FAILED) / { log(2, "system_dsm: got failure from callee"); } -> RUNNING; transition "callee answered" RUNNING - test(#b_status==CONNECTED) / { log(2, "system_dsm: ann_callee answered"); } -> RUNNING; transition "disconnect from callee" RUNNING - event(#b_status==DISCONNECT) / { log(2, "system_dsm: got disconnect from callee"); } -> RUNNING; transition "some other event" RUNNING - event / log(2, "got some other event"); logParams(2); -> RUNNING; transition "hangup" (RUNNING, END) - hangup / { log(2, "Got hangup in RUNNING or END state (suppress warning)"); } -> END; ------------------------------------------------------------------------- -- callee leg DSM for playing message to the callee import(mod_conference); initial state START enter { sets($msg="ann_callee: entering"); log(2, $msg); }; -- post state to other leg transition "early in callee leg" START - early / { log(2, "aas_callee: got early reply (ignoring)"); } -> START; transition "ringing in callee leg" START - ringing / { log(2, "aas_callee: got ringing reply (ignoring)") } -> START; transition "failed callee leg" START - failed / { log(2, "aas_callee: got failure reply"); set($b_status=FAILED); set($code=#code); set($reason=#reason); postEvent($status_sink, b_status;code;reason); stop(false); } -> END; state END; transition "session starts in callee leg" START - sessionStart / { log(2, "aas_callee: session starts"); set($connect_session=0); setInOutPlaylist(); conference.setPlayoutType(adaptive); sets($msg="aas_callee: callee joins conference room @local_tag"); log(2, $msg); conference.join(@local_tag); conference.setupMixIn(1.0); sets($message_file="/var/lib/sems/audio/extensions/$(message).wav"); setTimer(2, 30); conference.playMixIn($message_file); addSeparator(100, true); sets($msg="aas_callee: posting event $b_status to $status_sink"); log(2, $msg); set($b_status=CONNECTED); postEvent($status_sink, b_status); } -> CONNECTED; -- audio is connected state CONNECTED; transition "timer hit" CONNECTED - timer / { log(2, "hangup on timer"); flushPlaylist(); conference.leave(); set($b_status=DISCONNECT); postEvent($status_sink, b_status); stop(false); } -> END; transition "disconnect" CONNECTED - hangup / { log(2, "aas_callee: got hangup"); flushPlaylist(); conference.leave(); set($b_status=DISCONNECT); postEvent($status_sink, b_status); stop(false); } -> END; transition "suppress warnings" (START, END) - hangup / { log(2, "Got hangup in START or END state (suppress warnings)"); } -> END; _______________________________________________ Sems mailing list [email protected] http://lists.iptel.org/mailman/listinfo/sems
