Hi,
o Raúl Alexis Betancor Santana [12/07/2009 10:59 AM]:
On Saturday 05 December 2009 02:04:35 Stefan Sayer wrote:
Hi,
Hi Stefan, and thanks a lot for your work.
you can use the last parameter of dialout_auth.
s.dial_auth('test_outgoing', 'sanchii', 'sip:[email protected]',
'sip:[email protected]', 'sipgate.de', '8xxxxxx', 'mypwd',
{'ha':'hups'})
will give you one variable $ha with the value hups (try logVars() to
see all variables.)
It's possible to pass arrays as params ?, let say ... a $variable with more
than one value and accessed as $variable[0], I have done the trick sending a
concatenaed string and spliting it with py ( ... )
yes, it has this; DSM has this pseudo-arrays for some functions, which
are in fact separate variables, like
$varname_size=2
$varname_0="hello"
$varname_1="how's it"
This is used on some functions, but there is not (yet) a generic method
to access these arrays with index (e.g. you can't do
log(1, $variable[$index]);
, you would need:
set($varname=variable);
append($varname, _);
append($varname, $index);
log(1, $varname);) this works as parameter for certain functions which
accept an array. If you want to implement that, add it to
resolveVars(...) function in DSM.cpp:58.
- Launch a call to a MoH server (maybe a DSM script that it's
playing a file
in loop)
easy, as above
How to play a file in loop? ... controlling a noAudioTest transsition and
going back to playing state?, so only will end in a "kick" event that will
fire transition from playing to bye ... well it's not an efficent MoH
server .. but will work :-)
was missing in the documentation:
- playFile(filename)
+ playFile(filename [, loop=true])
+ e.g. playFile($myfile, true); will play the file looped.
Throws "file" exeption with #path if file can not be opened
- playFileFront(filename)
+ playFileFront(filename [, loop=true])
+ e.g. playFileFront($myfile, true); will play the file at first
+ position in the playlist, and looped.
Throws "file" exeption with #path if file can not be opened
[...]
have a look at all the text files in doc/, especially doc/dsm_syntax.txt:
recordFile(filename)
Throws "file" exeption with #path if file can not be opened for
recording
stopRecord()
getRecordLength([dst_varname]) -- only while recording! default
dst var: record_length
getRecordDataSize([dst_varname]) -- only while recording! default
dst var: record_data_size
So this two functions could only be called JUST before calling stopRecord, is
that true?
yes.
e.g. something like this:
s.dial_auth(... {'welcome_prompt':'welcome.wav', 'recfile':'recording'})
------------
import(mod_dlg);
import(mod_py);
initial state BEGIN
enter {
playFile($welcome_prompt);
A question about path's .... where will be looked for $welcome_promt? at DSM
dir? at /etc/sems? at /usr/lib/sems/audio? ... I mean by default.
cwd of the sems process. use absolute file names to be sure its found.
};
transition "uh, error" BEGIN - exception; / stop(true) -> END;
transition "welcome ends" BEGIN - noAudioTest / {
set($rec_fname=$recfile);
append($rec_fname, .wav);
recordFile($rec_fname);
setTimer(1, 120);
Is this a timer of "max length"? so not for been recording forever
yes
} -> RECORDING;
state RECORDING;
transition "timer hit" RECORDING - timerTest(#id==1) / {
getRecordLength(rec_length);
stopRecord();
dlg.bye();
} -> PROCESSING;
transition "bye" RECORDING - hangup / {
getRecordLength(rec_length);
stopRecord();
} -> PROCESSING;
state PROCESSING enter {
-- could better use a sys.exec method than using python here...
py(
import os
os.system(' lame ' + session.var('rec_fname') + ' ' +
session.var('recfile')+'.mp3')
)
-- but maybe use python for sending smtp as well?
-- or add some DI method to voicemail app...
};
transition "ok, done" PROCESSING - / stop(false) -> END;
transition "bye received" BEGIN - hangup / stop(false) -> END;
state END;
----------------------------
note that the "uh, error" transition will also capture exceptions on
recording...
And on playing of prompts and announces ...
A question about "playing" ... playing out something culd only occurs on enter
and exit of states but not on trasitons, is that true ?
no, playFile just adds the file to the playlist. playFile is a normal
action, so you can of course also do something like
transition "mytransition" STATE1 - test($x=y) / playFile(hallo.wav) ->
STATE2;
And last ... just as a curiosity, using lame produce a very bad quality .mp3,
compared with the one produced by the voicemail app with the .mp3 format
pluging.
you need to set the samplerate, channels, and the quality right. mp3
module uses channels=1, samplerate=8000, bitrate=16, mode=3 (mono),
quality=2 (high). hm, does quality=2 override bitrate?
Stefan
Best regards.
--
Stefan Sayer
VoIP Services
[email protected]
www.iptego.com
IPTEGO GmbH
Wittenbergplatz 1
10789 Berlin
Germany
Amtsgericht Charlottenburg, HRB 101010
Geschaeftsfuehrer: Alexander Hoffmann
_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems