Returns version string of the active 24U Phone Companion, formatted as requested by the parameter.
versionFormat | Defines the format of the returned version. |
"short" | To get just the version number. Default value. |
"long" | To get the plug-in name followed by its version number. |
"platform" | To get the platform of the code currently running. |
"autoupdate" | To get autoupdate compatible (comparable) version number. |
This function is very important and it has the same output format in all 24U Plug-Ins. You should call this function every time you need to check if the plug-in is properly installed to the FileMaker. Even if the plug-in is not registered (or badly registered) this function should work. Calling this function in the startup script of your solution is recommended.
Returns requested version format or platform. If this function returns "?" than the plug-in is not properly installed or FileMaker cannot load and activate it for some reason.
Phone_Version( "long" )
This will return the plug-in name and its version. In this case it is 24U Phone Companion 2.0
Phone_Version( "platform" )
Returns "Mac OS X" or "Windows" depending on the platform the plug-in is currently running.
Phone_Version( "autoupdate" )
Returns 04020600 for version 4.2.6 of the plug-in.
Attempts to unlock (register) your copy of 24U Phone Companion with the specified code.
serialNumber | The code to unlock the plug-in. |
If the code(s) is valid, 24U Phone Companion gets unlocked and stays in this state until you quit the FileMaker Pro application, deactivate the plug-in, or the registration code expires. While unlocked, 24U Phone Companion is fully functional and does not bother the user with a shareware reminder.
Returns a non-zero error code when the serial numbers are wrong if the numbers cannot be used. Returns 0 if the plug-in was successfully registered.
Phone_Register( "PHC10J-CM244H-U4UGBN" )
This function will register the plug-in with serial number PHC10J-CM244H-U4UGBN. This method is useful when you register the plug-in with developer license but it can be used for end-user licenses as well.
Note: All serial numbers here are only for demonstration purposes. They will not work in real plug-in.
Connect to STLI server.
serverIP | The IP address of the server. |
serverPort | The port of the server. |
timeout | The timeout for connection. Use float number in seconds. The default value is 3s. |
Call this function establish TCP connection to STLI server. This server is needed to control the line. All phone functions will work only if the plug-in is properly connected.
Function returns 0 id connection was successfully established. Otherwise it returns negative error code.
Phone_Connect( "10.0.0.2" ; 26535 )
The plug-in will attempt to connect to server with IP 10.0.0.2 on port 26535.
Phone_Connect( "132.65.28.17" ; 25001 ; 9.5 )
The plug-in will attempt to connect to server with IP 132.65.28.17 on port 25001 with 9.5 seconds timeout.
Disconnect from STLI server.
This function will cause that TCP connection to STLI server will be terminated. Use this function when you no longer need phone services.
Function returns 0 if the connection was terminated. It returns 0 even if there was no previous connection. Error code is returned when the connection was not terminated in the standard way (abnormal termination).
Phone_Disconnect
Function has no parameters. This will allways terminate the connection and return status code.
Dials a specified telephone number on the specified calling device.
localDevice | The phone number of device from which the call originates. The device must be local. |
calledDirectoryNumber | Indicates the device to which the call should be directed. The number should direct to local or extranl device. |
This function will dial the number on the local phone. The format should be FileMaker text. It can contain all numbers, "*", "#" and "+".
Function returns 0 if the number was successfully dialed. It doesn't matter if the other side accepted the call or not. If some error occured (line is not ready, server is not ready, line was forcefully disconnected or similar) the status number is returned.
Phone_Dial( "11" ; "17" )
This will dial the number 17 on the device with number 11.
Phone_Dial( "103" ; "05555925" )
You can use any number for outside calls. This will dial 05555925 number on the device with local number 103.
Answers (off-hook) an incoming call.
localDevice | The local device which should answer the call. |
The called local device shoud be able to accept incoming call. It should be either speakerphone or headset equipped phone. The local device should be monitored for incoming calls. Use Phone_SetScriptEvent function to monitor incoming calls.
Function returns 0 if the call was successfully accepted. It the device cannot accept call or another problem occured than the status code is returned.
Phone_Answer( "19" )
This will accept the call on the local device with number 19.
Hang up a call.
localDevice | The phone number of the local device which should hang up. |
This function will hang up a call on the local phone. The call should be properly established and local device should be monitored with some event. Use Phone_SetScriptEvent to start monitoring events.
Function returns 0 if the phone was properly hanged up. In case of error the function returns negative error code.
Phone_HangUp( "19" )
This will hang up a call on the phone with number 19.
Sends the unmodified command to the server.
commandString | The command string. The string will be encoded using UTF-8 encoding and sent to the server without waiting for answer. |
This function can be used to send low level commands directly to the server. This is useful for communication with non-standard server or to send commands which plug-in does not implement yet.
Function returns 0 if the command was successfully sent. It doesn't matter if the other side accepted the command.
This function does not wait for response. Use Phone_SetScriptRawEvent in cojunction with raw commands to catch server responses
Phone_RawCommand( "HoldCall 199348" )
Send command "HoldCall" with number 199348 to the server. Do not wait for reply. What the server will do is undefined.
Tell the plug-in to launch the script when specified event is triggered from outside.
localDevice | The phone number of the device for which the event will be triggered. |
event | The type of the event which should be installed. See table below for possible types. |
scriptName | The name of the script which should be triggered. |
"onIncomingCall" | Run the script on incoming call from outside. |
"onAnswerCall" | Run the script when incoming call is answered. |
"onHangUp" | Run the script on hang up. |
"onCalling" | Run the script when when the call is made from the phone. |
The function will call the specified script when the event of the specified type occurs. The script will receive a parameter which contains the number of controlled phone on the first line and the phone number of the second side on the second line.
To remove event for some number call Phone_SetScriptEvent( localDevice ; event ; "" ).
To remove all events for some number call Phone_SetScriptEvent( localDevice ; "" ; "" ).
To remove all events for all numbers call Phone_SetScriptEvent( "" ; "" ; "" ).
Function returns 0 if event is sucessfully installed or uninstalled. In case of error the function returns negative error code.
Each triggered script from plug-in receives script parameter which can be read by Get( ScriptParameter ) script step. The parameter consists of several lines of text. See the notes below to learn what each line of script parameter means (parameters are sorted from the first line) :
localDevice | The local device which registered incoming call. |
callerID | The number of the caller. |
calledID | The number of line which received the call. This parameter is optional. It is filled only on PBXs where it is supported |
localDevice | The local device which just answered call. |
callerID | The number of the caller. |
calledID | The number of line which received the call. This parameter is optional. It is filled only on PBXs where it is supported |
localDevice | The local device which where the event happened. |
localDevice | The local device which is used right now for outgoing call. |
calledID | The number where the call directs. |
Phone_SetScriptEvent( "19" ; "onAnswerCall" ; "Save answered call" )
This will install the script named "Save answered call" for the local device with number 19
Phone_SetScriptEvent( "105" ; "onCalling" ; "Show announcment" )
The script "Show announcment" will be called every time the user makes a call from the phone with number 105.
Tell the plug-in to launch the script when it receives a message from monitored device which corrsponds to regular expression.
pattern | Regular expression pattern. If incoming message matches this pattern, the script is triggered. To disable the filter set this parameter to "". |
scriptName | The name of the script which should be triggered. |
This function is similar to Phone_SetScriptEvent. It does not recognize the meaning of events. It just filters them using regular expressions and triggers the script on match.
It is recommended to always use some kind of filter. Using this function without filter can slowdown FileMaker application.
To remove triggers for some pattern Phone_SetScriptRawEvent( pattern ; "" ).
To remove triggers with some script name call Phone_SetScriptRawEvent( "" ; scriptName ).
To remove all triggers use Phone_SetScriptRawEvent( "" ; "" ).
Function returns 0 if script trigger is sucessfully installed or uninstalled. In case of error the function returns negative error code.
Function returns 0 if script trigger is sucessfully installed or uninstalled. In case of error the function returns negative error code.
Each triggered script from plug-in receives script parameter which can be read by Get( ScriptParameter ) script step. The parameter contains the message which triggered the script. The message is read into the FileMaker using UTF-8 encoding.
Phone_SetScriptRawEvent( "^[Ff]ailed .*" ; "Handle Failed Call" )
Call the script "Handle Failed Call" when incoming message contains word Failed or failed on the start.
Phone_SetScriptRawEvent( "^[Dd]evice[Ii]nformation 34 .*" ; "Read Phone Information" )
The script "Read Phone Information" will be called every time something happens on phone with number 34.
Phone_SetScriptRawEvent( "" ; "Read Phone Information" )
The script "Read Phone Information" will not be triggered in the future. It will be removed from all pattern queues.
Phone_SetScriptRawEvent( "^[Ff]ailed .*" ; "" )
All scripts triggered by "^[Ff]ailed .*" regular expression will be removed from the queue. No such script will be called in the future.
Function to get plug-in or phone server settings and other useful data.
what | Which data shoud be get. |
"lastError" | Returns the error code of the last error. If no error occured 0 is returned. |
"lastErrorMessage" | Returns the error message string of the last error. If no error occured "" is returned. |
"serverStatus" | Returs eiter "connected" or "disconnected". |
"monitoredDevices" | Returns a value list of the devices which are currently monitored for events. See functions Phone_SetScriptEvent and Phone_SetScriptRawEvent to see how to install the event handler script. The value list is delimited by line break. |
"serverResponseTimeout" | Default 3 s. How long Phone Companion waits for reply from the middleware. |
"serverCommunicationDelay" | If Phone Companion sends more than one message it waits very short time between each message. Use this parameter to obtain this value in seconds. |
Use this function to get important parameters.
Function returns data if everything is OK. In case of error the function returns "?". You can use Phone_Get("lastError") for more detailed error description.
Phone_Get( "lastError" )
Returns the error code of the last command. For example -50.
Set plug-in or phone server settings and other useful parameters.
what | Which data shoud be get. |
newValue | The new value for data. |
"serverResponseTimeout" | Sets how long Phone Companion waits for reply from TeamCall Server or Express. The time is in seconds and the default value is 3 s. |
"serverCommunicationDelay" | If Phone Companion sends more than one message it waits very short time between each message. The default value is 0.1 s. Use longer delays if the middleware is not able to react to fast communication. |
Use this function to set important parameters. Default communication delays and timeouts are set to work on local area networs. You can set longer values on slower networks (slow wireless networks) but the plug-in reactions will be also slower. Try to keep serverCommunicationDelay parameter as low as possible. Setting it too high (>1s) will essentially delay plug-in responses and probably will not help on broken link.
Function returns the real value of parameter if everything is OK. In case of error the function returns "?". You can use Phone_Get("lastError") for more detailed error description.
Phone_Set( "serverResponseTimeout" ; 4.5 )
The plug-in will wait for each answer from TeamCall up to 4.5 seconds. This also means that FileMaker will frozen for 4.5 seconds if TeamCall does not respond - do not set it too high.
Here is the list of all error codes which can be returned from the plug-in. The error codes are derived from MacErrors.h header file from Mac OS. Plug-In's custom error codes are positive numbers in range between 2400 and 9999. If function fails it either returns "?" signaling error or it directly returns the error code. If it returns "?" you can use Phone_Get("lastError") to obtain the code.
Code | Description | |
---|---|---|
-4 | Not implemented | If you see this error please report the error and steps to reproduce it to 24U Support. This error should never be invoked in the release version of the plug-in. |
2400 | Unknown error | An unknown error occurred. If you see this error please report the error and steps to reproduce it to 24U Support. We will try to identify error conditions and add the new error code to this list. |
2450 | Middleware Error | Error on middleware communication occured. Read "lastErrorMessage" to get exact error string. |