Problem is script?

Questions, problems, and other issues for Ascendis Caller ID that aren't covered by the other forums.
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Problem is script?

Post by samsungpower »

Hi there:

First of all great program, I have a couple of scripts I need help to solve with. I am very new beginner in the scripting world and these 2 I am stuck. I am trying to open firefox and paste a web address.

Code: Select all

//LANGUAGE=DWS

RunWait('C:\Program Files\Mozilla Firefox\firefox.exe"  +  ' http://www.bing.com/maps/?v=2&cp= ' +  CallInfo.County + ' &lvl=17&dir=0&sty=h&sp=&where1= ' +  CallInfo.SpeakName); 
To answer some of yours question before you may ask.
I have a dual monitors setup up. 1) is running google (default ) and firefox goes to 2 one. The reason I use "Callinfo.County and Callinfo.SpeakName actions because they are gps coordinates I have enter into my customer field area. A feature request would be enter some more action field area's under name edit contact window that my be like "Misc." and or "Extra" field's, that would transfer the information in the preassign field to the web pages that you have set up all ready with the "Number" "Name " "County" and so on.

So a working example address is http://www.bing.com/maps/?v=2&cp=28.419 ... -81.580272 and it goes to Disney World.

I have try this code Run "C:\Program Files\Mozilla Firefox\firefox.exe",
"http://www.bing.com/maps/?v=2&cp={Count ... {SpeakName}";

and when I don't use //LANGUAGE=DWS and it works, but when I convert it over the other language ( DWS ) it's not working. Help ?

2 Problem

I understand ( I think ) in the area of where the //LANGUAGE=DWS is each line has it own line number for an example is

Code: Select all

//LANGUAGE=DWS  (line 1 ) 
( space ) (line 2 )
runwait ('myprogram.exe) (line 3 )
So I have answer machine the picks up on the 3 ring when I am not there, I would like a script to bypass the remainder script action and go the a certian "line" or end.

Code: Select all

//LANGUAGE=DWS  

SendMail('Joe', 'xxxxxxxxxx@gmail.com', 'Call from ' + CallInfo.Name + ' at ' + CallInfo.Number, ' This is a Call from ' + CallInfo.Name + ' @ ' + CallInfo.Number + ' located at ' + CallInfo.Address + ' in ' + CallInfo.City + ' Http://www.xxxxxxxxxxx:8080'); 

if CallInfo.Rings = 3 then 
begin 
HangUp; 
end; 

SpeakWait('One Moment Please,');

if &#40;Time > StrToTime&#40;'1 am'&#41;&#41; and &#40;Time <StrToTime> StrToTime&#40;'12 pm'&#41;&#41; and &#40;Time < StrToTime&#40;'5 pm'&#41;&#41; then

begin

  Speakwait&#40;'Good afternoon'&#41;;

end

else

begin

  Speakwait&#40;'Good evening'&#41;;

end;

and I have more runWait commands that follow , so how do you tell this script ( below ) to bypass which commands of line not to "run" and go to a certain line number of just quit and have all the programs prior to this script "run" then stop if the rings = 3.

Code: Select all

if CallInfo.Rings = 3 then 
begin 
HangUp; 
goto line #28 &#40; or whatever line number &#41;
then
end; 
( ?? )
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: Problem is script?

Post by Bill Root »

Hi samsungpower,
//LANGUAGE=DWS

RunWait('C:\Program Files\Mozilla Firefox\firefox.exe" + ' http://www.bing.com/maps/?v=2&cp= ' + CallInfo.County + ' &lvl=17&dir=0&sty=h&sp=&where1= ' + CallInfo.SpeakName);

[snip]

I have try this code Run "C:\Program Files\Mozilla Firefox\firefox.exe",
"http://www.bing.com/maps/?v=2&cp={Count ... {SpeakName}";

and when I don't use //LANGUAGE=DWS and it works, but when I convert it over the other language ( DWS ) it's not working. Help ?
I copied your first bit of code from above and fixed some minor errors and it works. Here is the final code:

Code: Select all

//LANGUAGE=DWS

const FIREFOX='C&#58;\Program Files\Mozilla Firefox\firefox.exe';

RunWait&#40;FIREFOX, 'http&#58;//www.bing.com/maps/?v=2&cp=' + CallInfo.County + '&lvl=17&dir=0&sty=h&sp=&where1=' + CallInfo.SpeakName&#41;; 
(I used a constant for the location of the Firefox executable because it's in a different location on my computer.) You had a double quote instead of a single quote at the end of the Firefox pathname. I also removed some extraneous spaces that may or may not have caused problems in the URL.


Next question:
so how do you tell this script ( below ) to bypass which commands of line not to "run" and go to a certain line number of just quit and have all the programs prior to this script "run" then stop if the rings = 3.

if CallInfo.Rings = 3 then
begin
HangUp;
goto line #28 ( or whatever line number )
then
end;
Neither DWS nor the original script language support GOTO. GOTO is an obsolete construct.

The usual alternatives are if/then statements, the Exit command, or subroutines.

If you don't want your script to do anything after hanging up on the third ring, you could add an "Exit;" after the Hangup command:

Code: Select all

//LANGUAGE=DWS

SendMail&#40;'Joe', 'xxxxxxxxxx@gmail.com', 'Call from ' + CallInfo.Name + ' at ' + CallInfo.Number, ' This is a Call from ' + CallInfo.Name + ' @ ' + CallInfo.Number + ' located at ' + CallInfo.Address + ' in ' + CallInfo.City + ' Http&#58;//www.xxxxxxxxxxx&#58;8080'&#41;;

if CallInfo.Rings = 3 then
begin
  HangUp;
  Exit;
end;

SpeakWait&#40;'One Moment Please,'&#41;;

if &#40;Time > StrToTime&#40;'1 am'&#41;&#41; and &#40;Time < StrToTime&#40;'12 pm'&#41;&#41; and &#40;Time < StrToTime&#40;'5 pm'&#41;&#41; then
begin
  Speakwait&#40;'Good afternoon'&#41;;
end
else
begin
  Speakwait&#40;'Good evening'&#41;;
end;
Does that work as desired?



As to your suggestion:
A feature request would be enter some more action field area's under name edit contact window that my be like "Misc." and or "Extra" field's, that would transfer the information in the preassign field to the web pages that you have set up all ready with the "Number" "Name " "County" and so on.
Have you seen the "Custom1" - "Custom4" fields on the "Extra" page of the Contact window? These don't automatically get transferred anywhere, but you can access them from scripts:

Code: Select all

//LANGUAGE=DWS

var msg&#58; String;
const CRLF = #$0d#$0a;

msg &#58;= 
  'Custom1&#58; ' + CallInfo.Custom1 + CRLF +
  'Custom2&#58; ' + CallInfo.Custom2 + CRLF +
  'Custom3&#58; ' + CallInfo.Custom3 + CRLF +
  'Custom4&#58; ' + CallInfo.Custom4 + CRLF +
  'Extra&#58;   ' + CallInfo.Extra;

ShowMessage&#40;msg&#41;;
Finest regards,
Bill Root
Ascendis Software LLC
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

codes

Post by samsungpower »

Thank's Bill, the codes fixes all my problems, works perfect. I sometimes look for a hard solution, when the answer is just in front of my face, putting an Exit; at the end :roll: . Being honest I seen the extra section in the contact area but didn't know how to use it, to transfer that information to the webroot folder for the html pages, like I said before I am trying learn how to type and understand the script codes, Again Thank You.
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: codes

Post by Bill Root »

Scripting is an advanced feature, and will be not easy for non-programmers, so don't feel bad! :) I'm happy to help with scripting questions.

Being honest I seen the extra section in the contact area but didn't know how to use it, to transfer that information to the webroot folder for the html pages
The information that can be displayed in Ascendis Caller ID web pages is more limited. In fact, it looks like County and SpeakName are not supported, let alone Custom1-4.

The web pages (which use the HTML files in the WebRoot folder) are not the same as the display panel, however. If you're trying to display other contact fields in HTML web pages, it would help to know what you're trying to accomplish. For example, are you trying to make one web page with all information about a contact, or a table of contacts that include specific fields?

Finest regards,
Bill Root
Ascendis Software LLC
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Post by samsungpower »

I have been using this code and has been working fine so far, but if there going to be updates in the future that would stop me from displaying my information or their is a better way of doing thinks I will change. I have been using this code under the webroot folder ( one_call ). Thats why I was using County and SpeakName.

<HTML>
<HEADER>
<TITLE>
Ascendis Caller ID - Call
</TITLE>
</HEADER>
<BODY>


<!-- data -->
<TABLE BORDER="1" style="empty-cells: show" cellpadding="45">
<TBODY>
<TR bgcolor="#000099">
<TD align="center">
<font color="#ffffff">
<h1>###Name###</h1>
<h1>###Number###</h1>
<h1>###Address###</h1>
<h1>###City###</h1>
<br>
<h2>###TimeStamp### - ###Rings### Rings<br></h2>
<h3><a href="http://www.bing.com/maps/?v=2&cp=###Cou ... ank"><font color="#ffffff">Location Map Of Caller</font></a><h3>
<h3><a href="http://www.bing.com/maps/?v=2&cp=###Cou ... ank"><font color="#ffffff">Location Map Of Caller ( Mobile Users )</font></a><h3>

</font>
</TR>

</TBODY>
</TABLE>
</BODY>
</HTML>
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: HTML

Post by Bill Root »

samsungpower wrote:I have been using this code and has been working fine so far, but if there going to be updates in the future that would stop me from displaying my information or their is a better way of doing thinks I will change. I have been using this code under the webroot folder ( one_call ). Thats why I was using County and SpeakName.
Ok, I see. I checked the program source code and learned that the HTML template engine attempts to use unknown directives as field names. That's why County and SpeakName work even though no directives for those were explicitly created.

Here is a sample that includes the meaningful fields for a call:

Code: Select all

<HTML>
 <HEADER>
	<!-- shows fields available for a call -->
  <TITLE>
   Ascendis Caller ID - Call &#40;Detailed&#41;
  </TITLE>
 </HEADER>
 <BODY>

  <!-- data -->
  <TABLE BORDER="1" style="empty-cells&#58; show" cellpadding="0">
   <TBODY>
    <TR>
      <TD>Name</TD>
      <TD>###Name###</TD>
    </TR>

    <TR>
      <TD>DisplayName</TD>
      <TD>###DisplayName###</TD>
    </TR>

    <TR>
      <TD>SpeakName</TD>
      <TD>###SpeakName###</TD>
    </TR>

    <TR>
      <TD>FirstName</TD>
      <TD>###FirstName###</TD>
    </TR>

    <TR>
      <TD>LastName</TD>
      <TD>###LastName###</TD>
    </TR>

    <TR>
      <TD>RawName</TD>
      <TD>###RawName###</TD>
    </TR>

    <TR>
      <TD>Number</TD>
      <TD>###Number###</TD>
    </TR>

    <TR>
     <TD>DisplayNumber</TD>
     <TD>###DisplayNumber###</TD>
    </TR>

    <TR>
     <TD>TimeStamp</TD>
     <TD>###TimeStamp###</TD>
    </TR>

    <TR>
     <TD>CallBegan</TD>
     <TD>###CallBegan###</TD>
    </TR>

    <TR>
     <TD>CallEnded</TD>
     <TD>###CallEnded###</TD>
    </TR>

    <TR>
     <TD>Rings</TD>
     <TD>###Rings###</TD>
    </TR>

    <TR>
     <TD>New</TD>
     <TD>###New###</TD>
    </TR>

    <TR>
     <TD>IncomingCall</TD>
     <TD>###IncomingCall###</TD>
    </TR>

    <TR>
     <TD>RingType</TD>
     <TD>###RingType###</TD>
    </TR>

    <TR>
     <TD>Line</TD>
     <TD>###Line###</TD>
    </TR>

    <TR>
     <TD>DisplayLine</TD>
     <TD>###DisplayLine###</TD>
    </TR>

    <TR>
     <TD>RawLine</TD>
     <TD>###RawLine###</TD>
    </TR>

    <TR>
     <TD>DeviceName</TD>
     <TD>###DeviceName###</TD>
    </TR>

    <TR>
     <TD>ActionName</TD>
     <TD>###ActionName###</TD>
    </TR>

    <TR>
     <TD>City</TD>
     <TD>###City###</TD>
    </TR>

    <TR>
     <TD>County</TD>
     <TD>###County###</TD>
    </TR>

    <TR>
     <TD>State</TD>
     <TD>###State###</TD>
    </TR>

    <TR>
     <TD>PostalCode</TD>
     <TD>###PostalCode###</TD>
    </TR>

    <!-- NOTE&#58; this is the CALL label -->
    <TR>
     <TD>Label</TD>
     <TD>###Label###</TD>
    </TR>

    <!-- NOTE&#58; this is the CALL notes -->
    <TR>
     <TD>Notes</TD>
     <TD>###Notes###</TD>
    </TR>

   </TBODY>
  </TABLE>
 </BODY>
</HTML>
(Please note that some of the field names are aliases, so not all the field names above represent unique fields).

The template engine doesn't pull in all the contact fields because to do so for multiple calls (which the template engine supports) would slow it down notably. That's why the custom fields aren't available. County (and other location fields) and SpeakName are copied into the call table for performance reasons. So, we can't easily add support for the custom fields in the web engine in the context of a call. I suggest you keep using your workaround!


Finest regards,
Bill Root
Ascendis Software LLC
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Post by samsungpower »

Still have a problem with the code below. The script works perfect when you manually Right click and test action under the call tab area when a call has 3 rings, but when a real call comes in and has 3 rings link to that number it still continues the script below and speaks out "'One Moment Please" and so on to the end of the script. The code seems not to work when recv. the call ( Real Time ) only after the call has ended. Is there a way to enable it while receiving the call ?

Code: Select all

//LANGUAGE=DWS 

SendMail&#40;'Joe', 'xxxxxxxxxx@gmail.com', 'Call from ' + CallInfo.Name + ' at ' + CallInfo.Number, ' This is a Call from ' + CallInfo.Name + ' @ ' + CallInfo.Number + ' located at ' + CallInfo.Address + ' in ' + CallInfo.City + ' Http&#58;//www.xxxxxxxxxxx&#58;8080'&#41;; 

if CallInfo.Rings = 3 then 
begin 
  HangUp; 
  Exit; 
end; 

SpeakWait&#40;'One Moment Please,'&#41;; 

if &#40;Time > StrToTime&#40;'1 am'&#41;&#41; and &#40;Time < StrToTime&#40;'12 pm'&#41;&#41; and &#40;Time < StrToTime&#40;'5 pm'&#41;&#41; then 
begin 
  Speakwait&#40;'Good afternoon'&#41;; 
end 
else 
begin 
  Speakwait&#40;'Good evening'&#41;; 
end;
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Post by Bill Root »

Hi again,

(When you paste a script into a message, using the [ code] and [/code] tags makes it easier to read.)
The code seems not to work when recv. the call ( Real Time ) only after the call has ended. Is there a way to enable it while receiving the call ?
Do you mean that the script doesn't work properly when the call has ended? What part doesn't happen or happens inappropriately?

Are you using Ascendis Caller ID networking? (You mentioned "Real Time".)

To clarify:
1) What do you want to happen on ring #3?
2) What do you want to happen the rest of the time?
3) In the Options window, on the "Advanced" page, what is "Perform Action" set to?

Finest regards,
Bill Root
Ascendis Software LLC
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Post by samsungpower »

When a call is answer on the 3 ring ( by my answer machine ) I would like the program to send and email then hangup the call and finish.

The other times I have SpeakWait & RunWait commands.

"Perform Action" is set to "When caller info is recv."


When a call comes in it doesn't matter how many rings the program always runs the "SpeakWait & RunWait scripts" I would like the program to send an email and then hangup and finish ( stop ) when trigger by a 3 ring log.

I hope that clarify thinks.
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Post by Bill Root »

Thank you; your clarifications help. However, (with a modem) Ascendis Caller ID doesn't know when the call is answered. It only knows how many rings it had. In addition, with the default (and your current) settings, the action is only run once for each call, as soon as the caller information is available. Thus, for a normal call, the action will never be run when the number of rings is 3.

I made a new script that sends an email and announces the call once for each call. It also hangs up on the third ring, although this isn't necessary if you're using an answering machine. In fact, it could hang up the phone before the answering machine gets a chance to answer. (And if it wasn't for the hangup, this script would be a lot simpler.)

Your last script didn't include the RunWait command, so neither does this.

In order to use this script in the manner you described, you will have to enable all the options in "Perform Action" on the "Advanced" page of the Options window.

If you dropped your hangup requirement, the script would be simpler than the one you last provided, and you wouldn't have to change any settings. You may be over thinking this, or you may be making assumptions about what Ascendis Caller ID does that are not accurate.

Code: Select all

/////////////////////////////////////////////////////////////////////////////
// This script hangs up the phone on the third ring
// It sends an email and announces the call as soon as caller information is 
//  available.
//
// To use this script, you must enable&#58;
// - "When caller info is received", 
// - "On each ring", and 
// - "When call ends" 
// for "Perform Action" on the "Advanced" page of the Options window.
/////////////////////////////////////////////////////////////////////////////

//LANGUAGE=DWS


LogActivity&#40;'Rings=' + IntToStr&#40;CallInfo.Rings&#41;&#41;;
LogActivity&#40;'FoundCaller=' + BoolToStr&#40;CallInfo.FoundCaller&#41;&#41;;
LogActivity&#40;'CallDone=' + BoolToStr&#40;CallInfo.CallDone&#41;&#41;;


// we will usually be called multiple times for the same phone call
// since we don't want to repeat the commands each time we're called, we have
// to determine whether we've already done them

var iniFilename&#58; String = GetDataFolder + '\Action-Custom.ini';
LogActivity&#40;'iniFilename=' + iniFilename&#41;;
var iniFile&#58; TIniFile = TIniFile.Create&#40;iniFilename&#41;;

const SECTION         = 'Main';
const LAST_RAW_NUMBER = 'LastRawNumber';
const LAST_CALL_ENDED = 'LastCallEnded';
const PERFORMED_TASKS = 'PerformedTasks';


try
  // lastRawNumber stores the last raw number received by this script
  var lastRawNumber&#58; String = iniFile.ReadString&#40;SECTION, LAST_RAW_NUMBER, ''&#41;;
  // lastCallEnded stores True if the last time we were called was for an EndCall message
  var lastCallEnded&#58; Boolean = iniFile.ReadBool&#40;SECTION, LAST_CALL_ENDED, TRUE&#41;;
  // performedTasks stores True if we already performed the tasks for the current call
  var performedTasks&#58; Boolean = iniFile.ReadBool&#40;SECTION, PERFORMED_TASKS, FALSE&#41;;

  if lastCallEnded or &#40;CallInfo.Rings < 2&#41; then
    performedTasks &#58;= False;


  if CallInfo.FoundCaller and not performedTasks then
  begin
    SendMail&#40;'Joe', 
             'xxxxxxxxxx@gmail.com', 
             'Call from ' + CallInfo.Name + ' at ' + CallInfo.Number, 
             'This is a Call from ' + CallInfo.Name + 
                ' @ ' + CallInfo.Number + 
                ' located at ' + CallInfo.Address + 
                ' in ' + CallInfo.City + 
                ' Http&#58;//www.xxxxxxxxxxx&#58;8080'&#41;;

    SpeakWait&#40;'One Moment Please,'&#41;;

    //if &#40;Time > StrToTime&#40;'1 am'&#41;&#41; and &#40;Time < StrToTime&#40;'12 pm'&#41;&#41; and &#40;Time < StrToTime&#40;'5 pm'&#41;&#41; then
    if &#40;Time > StrToTime&#40;'12 am'&#41;&#41; and &#40;Time < StrToTime&#40;'12 pm'&#41;&#41; then
      Speakwait&#40;'Good morning'&#41;
    else if Time < StrToTime&#40;'5 pm'&#41; then
      Speakwait&#40;'Good afternoon'&#41;
    else
      Speakwait&#40;'Good evening'&#41;;

    performedTasks &#58;= True;
  end;


  if CallInfo.Rings = 3 then
    HangUp;


  // save current values for next time
  iniFile.WriteString&#40;SECTION, LAST_RAW_NUMBER, CallInfo.RawNumber&#41;;
  iniFile.WriteBool&#40;SECTION, LAST_CALL_ENDED, CallInfo.CallDone&#41;;
  iniFile.WriteBool&#40;SECTION, PERFORMED_TASKS, performedTasks&#41;;
finally
  iniFile &#58;= nil;
end;
Finest regards,
Bill Root
Ascendis Software LLC
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Post by samsungpower »

Bill:

Ok I have to start from the begining, and first to say is I am sorry if it seems I have waisted your time so far :oops: . I am a person that likes to try to solve my own problems, and learn on the way and not have everything just handed to me. So that been said we are using your software to help us in our Ambulance Service, and at first we only used it to display the Name and Number of the caller because of time of emerency people forget to leave that kind of info.

Our service is located in a remote area and we do not have a dispatch service we use a answer machine/pagers system. As we look into all your software could do, our PCP started dream of things that would help us to respond to a call faster and more.

Ok enough of the background now the script.

When a call comes in the answer machine/pager pickup on the 2 ring but if we are already out on a call, then on the 3 ring it gets tranfser to our ambulance cell # and if we don't anwser it and get forward to an other service up the coast.

Code: Select all

//LANGUAGE=DWS

RunWait&#40;'C&#58;/Documents and Settings/Owner/My Documents/Heartbeat/Recv.Call.php'&#41;; // #1  

//if CallInfo.Rings = 2 then    // # 2
//begin 
// SendMail&#40;'911', 'xxxxx.com', 'Call  from ' + CallInfo.Name + ' at ' + CallInfo.Number, ' Their was an Emerency Call while you were already out on a call from ' + CallInfo.Name + ' @ ' + CallInfo.Number + ' located at ' + CallInfo.Address + ' in ' + CallInfo.City + ' Http&#58;//www.xxxxx&#58;8080'&#41;;                                                                                                                                                                                                                                                                                                                                                                                                                                                      
// SendMail&#40;'911', 'xxxxx.com',   //  we have other staff members with their personal messages to their phone as a text also.

//end

//else 

if CallInfo.Rings = 3 then   // # 3
begin 
 SendMail&#40;'911', 'xxxxxx.com', 'Missed a call ?  from ' + CallInfo.Name + ' at ' + CallInfo.Number, ' Their was an Emerency Call while you were already out on a call from ' + CallInfo.Name + ' @ ' + CallInfo.Number + ' located at ' + CallInfo.Address + ' in ' + CallInfo.City + ' Http&#58;//www.xxxxxx&#58;8080'&#41;; 
 SendMail&#40;'Joe', 'xxxxx.com', 'You have a call coming in  from ' + CallInfo.Name + ' at ' + CallInfo.Number, ' Their was an Emerency Call while you were already out on a call from ' + CallInfo.Name + ' @ ' + CallInfo.Number + ' located at ' + CallInfo.Address + ' in ' + CallInfo.City + ' Http&#58;//www.xxxxx&#58;8080'&#41;;
 Exit; 
end;

SendMail&#40;'911', 'xxxxxxx.com', 'Call from ' + CallInfo.Name + ' at ' + CallInfo.Number, ' This is a Emerency Call from ' + CallInfo.Name + ' @ ' + CallInfo.Number + ' located at ' + CallInfo.Address + ' in ' + CallInfo.City + ' Http&#58;//www.xxxxxx&#58;8080'&#41;; // # 4


RunWait&#40;'modem call back script.exe'&#41;; // # 5

SpeakWait&#40;'One Moment Please,'&#41;; // # 6

Sleep&#40;2800&#41;;

SpeakWait&#40;'Thank You for waiting, This is a message from xxxxx Ambulance Service'&#41;;

if &#40;Time > StrToTime&#40;'1 am'&#41;&#41; and &#40;Time <StrToTime> StrToTime&#40;'12 pm'&#41;&#41; and &#40;Time < StrToTime&#40;'5 pm'&#41;&#41; then

begin

  Speakwait&#40;'Good afternoon'&#41;;

end

else

begin

  Speakwait&#40;'Good evening'&#41;;

end;


//if CallInfo.FoundCaller or 
//  AnsiSameText&#40;Trim&#40;CallInfo.SpeakName&#41;, Trim&#40;CallInfo.Number&#41;&#41; then

Speakwait&#40;'we have received your call of needing Medical Care, and have notify our staff, Thank you and Good Bye'&#41;;

RunWait&#40;'C&#58;\Program Files\Windows NT\Modem Hangup Local.exe'&#41;; // # 7

const FIREFOX='C&#58;\Program Files\Mozilla Firefox\firefox.exe'; // # 8

RunWait&#40;FIREFOX, 'http&#58;//www.bing.com/maps/?v=2&cp=' + CallInfo.County + '&lvl=17&dir=0&sty=h&sp=&where1=' + CallInfo.SpeakName&#41;; 

RunWait&#40;'c&#58;\reboot\reboot.bat'&#41;;  // # 9

Exit;  // # 10
I have number the beginning of each line script to try to make things easier to explain.

Line # 1 sends message to our screen located in our bay.

I did try line # 2 script , when a call has 2 ring do line #1,2,5,6,7,8,9 and 10 and yes I did remove the // in front of it. But it didn't work.

So then I remove line # 2 script and when a call came in with 2 rings it did line #1,4,5,6,7,8,9 and 10 and work perfect. The problem is when recv. a call with 3 rings it wouldn't just do Line # 1,3 and 10, it ran from line # 1,4 to 10.

I still don't understand why the line # 3 script doesn't work when a call comes in with only 3 rings but does work when you right click and select "test action" under the call tab of the main windows program that has 3 ring log assign to it, also I have remove the Hangup; like you say to do.

Code: Select all

if CallInfo.Rings = 3 then   // # 3
begin 
 SendMail&#40;'911', 'xxxxxx.com', 'Missed a call ?  from ' + CallInfo.Name + ' at ' + CallInfo.Number, ' Their was an Emerency Call while you were already out on a call from ' + CallInfo.Name + ' @ ' + CallInfo.Number + ' located at ' + CallInfo.Address + ' in ' + CallInfo.City + ' Http&#58;//www.xxxxxx&#58;8080'&#41;; 
 SendMail&#40;'Joe', 'xxxxx.com', 'You have a call coming in  from ' + CallInfo.Name + ' at ' + CallInfo.Number, ' Their was an Emerency Call while you were already out on a call from ' + CallInfo.Name + ' @ ' + CallInfo.Number + ' located at ' + CallInfo.Address + ' in ' + CallInfo.City + ' Http&#58;//www.xxxxx&#58;8080'&#41;;
 Exit; 
end;
So this would be the perfect sitution ,when a call comes in with 2 rings it would do line # 1,2,5,6,7,8,9 and 10 and a call with 3 rings do line # 1,3,8,9 and 10. Second best would be on a call with 3 rings do line # 1,3,9 and 10.

A big reason why ( and there is so many ) we like this program, it fast when a call comes in we have recv. a text message of the callers info. even before they have hang up and would not like to sacrifice that speed with a script that requires waiting to long .

Maybe you shouldn't have said:
Scripting is an advanced feature, and will be not easy for non-programmers, so don't feel bad! I'm happy to help with scripting questions.
P.S Line # 5 and 7 runs our second modem attached to another phone to run a call back service and is separated from your software.
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Post by Bill Root »

No time wasted; we're both learning! I'm learning about an interesting application of Ascendis Caller ID, and you're learning about Ascendis Caller ID scripting! :-)
When a call comes in the answer machine/pager pickup on the 2 ring but if we are already out on a call, then on the 3 ring it gets tranfser to our ambulance cell # and if we don't anwser it and get forward to an other service up the coast.
I'm going to assume that when you're in the bay you set the answering machine/pager to pick up on 2 rings but you disable it when you leave so the call can be forwarded on the third ring.

The reason checking for CallInfo.Rings to be 2 or 3 doesn't normally work is that in the default configuration (which you were using at least until my last response) Ascendis Caller ID runs the script once, when the caller information is received. Normally this means CallInfo.Rings should always be 1, unless no caller information is received.

When you right-click a call and choose "Test Action", the script is run with the call information as it exists at the time. When you test the action on a call with 3 rings, CallInfo.Rings is 3. When you test the action on a call with 2 rings, CallInfo.Rings is 2.

Since you want the script to run multiple times, once for each ring, you must enable "When caller info is received" and "On each ring" for "Perform Action" on the "Advanced" page of the Option window. Then, for a call with one ring and caller information, your script will be run once. For a call with two rings and caller information, your script will be run twice. For a call with three rings and caller information, your script will be run three times.

Now your script can properly use CallInfo.Rings to change it's behavior. I suggest either
1) Put "if CallInfo.Rings = 2 then" or "if CallInfo.Rings = 3 then" before each line as appropriate, or
2) Group your commands into blocks needed when CallInfo.Rings is 2, CallInfo.Rings is 3, or CallInfo.Rings is 2 or 3, and add "if CallInfo.Rings = 2 then", "if CallInfo.Rings = 3 then", and "if (CallInfo.Rings = 2) or (CallInfo.Rings = 3) then" before them.

In either case, remember to use begin..end around the code below the if statement if multiple statements are used.


Example:

Code: Select all

//LANGUAGE=DWS


if CallInfo.Rings = 2 then
begin
  // add statements to be executed ONLY on 2 rings
end;


if CallInfo.Rings = 3 then
begin
  // add statements to be executed ONLY on 3 rings
end;


if &#40;CallInfo.Rings = 2&#41; or &#40;CallInfo.Rings = 3&#41; then
begin
  // add statements to be executed for 2 OR 3 rings
end;
The advantage of the structure used in the example is that commands used by both 2 and 3 rings are not duplicated.


I must also point out that #6:

Code: Select all

SpeakWait&#40;'One Moment Please,'&#41;; // # 6 
will speak the text aloud on the computer running Ascendis Caller ID, and not over the phone. There's a separate command to play sound over the modem, but it doesn't do speech. But most importantly, if you do this, Ascendis Caller ID will pick up the phone and it won't ring anymore! So doing this for the second ring will prevent a third ring from occurring. Also, when the script is done, Ascendis Caller ID will automatically hang up the phone.


Finest regards,
Bill Root
Ascendis Software LLC
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Post by samsungpower »

I like the idea of grouping statements together. So when I check syntax a box came up showing "End of block expected"

Code: Select all

//LANGUAGE=DWS

if CallInfo.Rings = 2 then 
begin 
        SendMail&#40;'911', 'xxxx.com', 'Call  from ' + CallInfo.Name + ' at ' + CallInfo.Number, ' Their was an Emerency Call while you were already out on a call from ' + CallInfo.Name + ' @ ' + CallInfo.Number + ' located at ' + CallInfo.Address + ' in ' + CallInfo.City + ' Http&#58;//www.xxxx&#58;8080'&#41;;

        RunWait&#40;'modem call back script.exe'&#41;; // Start Modem Script

        SpeakWait&#40;'One Moment Please,'&#41;; // Speak

        Sleep&#40;2800&#41;; // Sleeping

        SpeakWait&#40;'Thank You for waiting, This is a message from xxxx Ambulance Service'&#41;;

        if &#40;Time > StrToTime&#40;'1 am'&#41;&#41; and &#40;Time <StrToTime> StrToTime&#40;'12 pm'&#41;&#41; and &#40;Time < StrToTime&#40;'5 pm'&#41;&#41; then

begin

  Speakwait&#40;'Good afternoon'&#41;;

end

else

begin

  Speakwait&#40;'Good evening'&#41;;

end;

if CallInfo.Rings = 2 then 
begin 

  Speakwait&#40;'we have received your call of needing Medical Care, and have notify our staff, Thank you and Good Bye'&#41;;

  RunWait&#40;'C&#58;\Program Files\Windows NT\Modem Hangup Local.exe'&#41;; // Making sure Modem is disconnected 

  
end; 


if CallInfo.Rings = 3 then 
begin 

   SendMail&#40;'911', 'xxx.com', 'Missed a call ?  from ' + CallInfo.Name + ' at ' + CallInfo.Number, ' Their was an Emerency Call while you were already out on a call from ' + CallInfo.Name + ' @ ' + CallInfo.Number + ' located at ' + CallInfo.Address + ' in ' + CallInfo.City + ' Http&#58;//www.xxxx&#58;8080'&#41;; 
  


if &#40;CallInfo.Rings = 2&#41; or &#40;CallInfo.Rings = 3&#41; then 
begin 

  RunWait&#40;'C&#58;/Documents and Settings/Owner/My Documents/Heartbeat/Recv.Call.php'&#41;; // Red Alert screen  

  const FIREFOX='C&#58;\Program Files\Mozilla Firefox\firefox.exe'; // Open FireFox

  RunWait&#40;FIREFOX, 'http&#58;//www.bing.com/maps/?v=2&cp=' + CallInfo.County + '&lvl=17&dir=0&sty=h&sp=&where1=' + CallInfo.SpeakName&#41;;

  RunWait&#40;'c&#58;\reboot\reboot.bat'&#41;;  // Reboot


  
 end;

Exit;
I thought maybe I didn't need to put the Exit; at the end but still came up with same error message.
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Post by Bill Root »

It looks like there were two "end"s missing, and a problem with this statement:

Code: Select all

if &#40;Time > StrToTime&#40;'1 am'&#41;&#41; and &#40;Time <StrToTime> StrToTime&#40;'12 pm'&#41;&#41; and &#40;Time < StrToTime&#40;'5 pm'&#41;&#41; then
Here is the corrected script:

Code: Select all

//LANGUAGE=DWS

if CallInfo.Rings = 2 then
begin
  SendMail&#40;'911', 'xxxx.com', 'Call  from ' + CallInfo.Name + ' at ' + CallInfo.Number, ' Their was an Emerency Call while you were already out on a call from ' + CallInfo.Name + ' @ ' + CallInfo.Number + ' located at ' + CallInfo.Address + ' in ' + CallInfo.City + ' Http&#58;//www.xxxx&#58;8080'&#41;;

  RunWait&#40;'modem call back script.exe'&#41;; // Start Modem Script

  SpeakWait&#40;'One Moment Please,'&#41;; // Speak

  Sleep&#40;2800&#41;; // Sleeping

  SpeakWait&#40;'Thank You for waiting, This is a message from xxxx Ambulance Service'&#41;;

  if &#40;Time > StrToTime&#40;'1 am'&#41;&#41; and &#40;Time < StrToTime&#40;'12 pm'&#41;&#41; and &#40;Time < StrToTime&#40;'5 pm'&#41;&#41; then
  begin
    Speakwait&#40;'Good afternoon'&#41;;
  end
  else
  begin
    Speakwait&#40;'Good evening'&#41;;
  end;
end;


if CallInfo.Rings = 2 then
begin
  Speakwait&#40;'we have received your call of needing Medical Care, and have notify our staff, Thank you and Good Bye'&#41;;

  RunWait&#40;'C&#58;\Program Files\Windows NT\Modem Hangup Local.exe'&#41;; // Making sure Modem is disconnected
end;


if CallInfo.Rings = 3 then
begin
   SendMail&#40;'911', 'xxx.com', 'Missed a call ?  from ' + CallInfo.Name + ' at ' + CallInfo.Number, ' Their was an Emerency Call while you were already out on a call from ' + CallInfo.Name + ' @ ' + CallInfo.Number + ' located at ' + CallInfo.Address + ' in ' + CallInfo.City + ' Http&#58;//www.xxxx&#58;8080'&#41;;
end; 


if &#40;CallInfo.Rings = 2&#41; or &#40;CallInfo.Rings = 3&#41; then
begin
  RunWait&#40;'C&#58;/Documents and Settings/Owner/My Documents/Heartbeat/Recv.Call.php'&#41;; // Red Alert screen 

  const FIREFOX='C&#58;\Program Files\Mozilla Firefox\firefox.exe'; // Open FireFox

  RunWait&#40;FIREFOX, 'http&#58;//www.bing.com/maps/?v=2&cp=' + CallInfo.County + '&lvl=17&dir=0&sty=h&sp=&where1=' + CallInfo.SpeakName&#41;;

  RunWait&#40;'c&#58;\reboot\reboot.bat'&#41;;  // Reboot
end;
(As you can see, you don't need the "Exit" at the end, but it wasn't causing a problem.)


Finest regards,
Bill Root
Ascendis Software LLC
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Post by samsungpower »

First I want to say thank You for helping with the matter in the P.M.

Ok when I got you reply last night it was like a kid in a candy store, but I waited to next morning to try everthing out. I saw an error on my part when copying the script into the forum, Forgot to add the Good morning statement.

Code: Select all

if &#40;Time > StrToTime&#40;'1 am'&#41;&#41; and &#40;Time < StrToTime&#40;'12 pm'&#41;&#41; then

begin

  Speakwait&#40;'Good morning'&#41;;

end


The code below still has a problem it is duplicated any thing that is on the 2 ring

Code: Select all

if CallInfo.Rings = 2 then 
begin 
  // add statements to be executed ONLY on 2 rings 
end; 
when it does not pickup untill a 3 ring event.

Under the heading
"When caller info is received" and "On each ring" for "Perform Action" on the "Advanced" page of the Option window
If I uncheck the "On each Ring" but have check marks on "When caller info ..... and also "when call ends" the script statements work perfect for 2 ring and also 3 ring ( but you already know that ) and having it to work that way I am sacrifice that speed because the duration of a call is between 36 to 46 sec before the script starts. So my question is it possible to put a script statement at the beginning line that may hangup the modem after a certain time of sec. that is trigger by "when caller info is recv. only" to shorten the duration to value of = 4 rings? Or did I just hit a brick wall.
Post Reply