[Freeswitch-users] config / scripting questions from voice mail integration attempt
John Wehle
john at feith.com
Wed Jun 25 20:32:45 PDT 2008
The AT&T System 25 sends inband DTMF at the beginning of a call being
transferred to voicemail which identifies the extension that was called
so I'm creating a javascript to parse the DTMF and do the right thing.
Questions:
1) Following the example I found on thelostpacket.org I've created
a script and placed it in /usr/local/freeswitch/scripts. I've
added:
<extension name="system25_vmail">
<condition field="destination_number" expression="^5590$">
<action application="javascript" data="$${basedir}/scripts/system25vmail.js"/>
</condition>
</extension>
to dialplan/default.xml. When I call 5590 freeswitch can't find
the script. If I replace $${basedir} with /usr/local/freeswitch,
then the script is called.
What's the proper way to specify the path to a script in the dialplan?
Is there a way to say that it's in the script directory under the
freeswitch installation point without using a full path?
2) The DTMF looks something like 123#456# . If I use getDigits(3, '#')
followed by another getDigits(3, '#'), then the first call returns
123, however the second call doesn't return 456.
It appears that getDigits returns when it either gets the requested
number of digits * or * it encounters the terminator. Is that correct?
So should I simply do something like getDigits(9, '#') followed by
another getDigits(9, '#')?
3) One thought I had was to do something like:
<extension name="system25_vmail">
<condition field="destination_number" expression="^5590$">
<action application="javascript" data="$${basedir}/scripts/system25vmail.js"/>
<!-- Inside extension checking voicemail -->
<condition field="system25_vmail_mode" expression="00">
<action application="voicemail" data="check default $${domain} ${system25_vmail_caller}"/>
</condition>
<!-- Inside extension bounced to voicemail -->
<condition field="system25_vmail_mode" expression="02">
<action application="voicemail" data="default $${domain} ${system25_vmail_callee}"/>
<action application="send_dtmf" data="#90${system25_vmail_callee}"/>
</condition>
the idea being that when 5590 is dialed the script will be called
to parse the DTMF and set the system25_vmail_XXX variables which
are then used by the later conditions. However the wiki for
Dialplan XML says:
Those accustomed to Asterisk may expect the call to follow the
dialplan by executing the applications as it parses them allowing
data obtained from one action to influence the next action. This
is not the case ...
so it sounds like I can't use an action to set variables to be used
for the next condition / action. However the example on
thelostpacket.org does:
<action application="javascript" data="$${basedir}/scripts/read.js conf-getconfno.wav 5"/>
<action application="conference" data="${res}@default"/>
which appears to do exactly what wiki says you can't so I'm confused.
4) My other thought was to have the javascript call the voicemail
application after parsing the DTMF. I.e.:
switch (mode) {
// Direct Inside Access
case "00":
if (isNaN (parseInt (from))) {
console_log ("err", "Invalid VMAIL calling PDC from PBX\n");
session.flushDigits ();
exit();
}
session.setVariable ("voicemail_authorized", "false");
apiExecute ("voicemail", "check default " + domain + " " + from);
however the apiExecute doesn't seem to invoke voicemail. Probably
because there's a difference between invoking an application and
an api. So, how do you invoke an application from a javascript
called from a dialplan?
-- John
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: john at feith.com |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------
More information about the FreeSWITCH-users
mailing list