7.3 Setting Up Text Paging
7.3.7 Sending Text Pages via Modem without TAP (Protocol=Chat)
Some European text paging services, including Orange GSM/SMS Cellular Phone & Hutchinson Paging, VodaPage Premier Text Paging Service, and Vodaphone GSM/SMS Cellular Phone do not support TAP. Their modem interfaces are designed to interact with an actual human being using a terminal-emulation program.
To send pages to such a system, use TelAlert’s Chat protocol, which is a variation on the protocol used in UUCP chat scripts. The keywords
ChatLogon
,ChatScript
, andChatLogoff
allow you to define simple scripts that watch for the host to send certain strings, such as “Please enter pager number” or “Send a message,” and send other strings, such as “5551212” or “node 5213 is down,”in return.
The Chat keywords’ values are “chat scripts,” strings containing pairs of “expect” and “send”
parameters. An expect parameter defines a string that the paging system will send to TelAlert (such as “pager number”); the send parameter that follows defines the string that TelAlert will send in response (such as the pager number associated with the destination or passed with the
–pin
option at the command line).In addition to text, the expect and send parameters may contain the following codes:
Codes used in both expect and send parameters
Codes used in send parameters only
\W##
set timeout to ## seconds\E
echo check on\
- (hyphen)\e
echo check off\b
bell\c
suppress carriage return at end of send\n
line feed\d
pause 1 second\r
carriage return\p
pause .25 seconds\s
space\P
the pager number (from PIN keyword or –pin option)\t
tab\A
the password (from Access keyword)\\
backslash\M
the message text\x##
hex character number ##\###
octal character number ###If you do not set a timeout with
\W##
, TelAlert uses the one set by theTextPagerWait
keyword, which has a default value of 10 seconds. Turning on echo check in a send parameter will cause the chat script to fail if the paging service does not echo back all of the sent text.
Chat Protocol Example #1: VodaPage
Chat scripts are most easily explained by analyzing a real-world example, such as the VodaPage Premier Text Paging Service. When a user dials in with a terminal emulation program, it prompts for the pager number as follows:
Please Enter Required Pager Number -
After the user enters the pager number, VodaPage prompts for the message:
Please Enter Alpha-numeric Message (up to 80 characters) -
After the user enters the message, VodaPage returns to the first prompt, where the user may either enter another pager number or simply hang up to complete the session.
An appropriate set of [
Configurations
] keywords for this service would include:[Configurations]
...
{VodaPagePremierTextPager}
Type=TextPager Parity=None Protocol=Chat
ChatLogon=’Number\s\-\s’
ChatScript=’"" \P characters)\s\-\r\n \M Number\s\-\s’
ChatLogoff=’’
MaxMessagesPerCall=10 MaxMessageLength=80
After the call is connected, TelAlert executes the chat script defined by
ChatLogon
. First it waits to see the string “Number -
” (Number\ s\-\s
). If the paging service sends that string within the timeout, since there is no send parameter, TelAlert simply moves on to the script defined byChatScript
; otherwise, it fails and goes on toChatLogoff
.If TelAlert gets to the
ChatScript
string at all, the first thing it needs to do is send the pager number. This script contains three expect/send pairs:1. The script starts with an empty expect parameter ("") followed by \P, which tells TelAlert to send the value of the ${PIN} variable (that is, the pager number associated with this destination by the PIN keyword or passed at the command line by the -pin option) immediately.
2. After sending the pager number, TelAlert waits for the string “characters) -” followed by a carriage return (\r) and line feed (\n). If it receives the string before the timeout, it sends the value of the ${Message} variable (that is, the message text); otherwise, it fails and goes on to ChatLogoff.
3. If TelAlert sends the message successfully, it waits for the string “Number -” (just as it did in the ChatLogon script). If TelAlert (1) receives that string before the timeout, (2) has another message to send to this service, and (3) has not yet sent the maximum number of messages indicated by the MaxMessagesPerCall keyword, TelAlert starts ChatScript over at step 1. Otherwise—that is, if If TelAlert has no more messages to send, or it does not receive the string within the timeout—it goes on to ChatLogoff.
One way or another, TelAlert will eventually get to the
ChatLogoff
script. Since in this case it is empty (""
), TelAlert continues processing the event, normally by hanging up and putting the message(s) in the sent state.Detecting Invalid PIN Numbers
The example configuration above does not take into account the possibility that you may send VodaPage the wrong pager number, in which case the service will return the error message,
“
Invalid Pager Number
.” You can handle that possibility by adding theChatRejected
keyword:
[Configurations]
...
{VodaPagePremierTextPager}
...
ChatRejected=’Invalid’
With this setting, if the paging service sends the word “Invalid” while
ChatScript
is active, TelAlert will assume the PIN number is bad, hang up, and put the message into the “message rejected” state. If it has other messages to send the service, it will redial the service and continue with the next message.Chat Protocol Example #2: Orange
For another example, consider the Orange GSM/SMS Cellular Phone & Hutchinson Paging Terminal Interface. This service presents a user dialing in with a terminal emulation program with the following menu:
Please choose an option (do not press return) : S :- Send a message
H :- Help E :- Exit
If the user presses “
s
,” this prompt appears:Enter destination Orange or Hutchison Pager number and press return:
After entering the pager number after the colon, the user sees this prompt:
Type your message (160 characters max) and press return to send:
After the user enters the message after the colon, the system again displays the send/help/exit menu. An appropriate set of [
Configurations
] keywords for this service would be:Type=TextPager Parity=None Protocol=Chat
ChatLogon=’Exit\r\n’
ChatScript=’"" S\c return\r\n\r\n: \E\P send\r\n\r\n: \M Exit\r\n’
ChatLogoff=’"" E\c’
MaxMessagesPerCall=10 MaxMessageLength=160
ChatLogon
waits for the last part of the menu (the string “Exit
” followed by a carriage return and line feed). Since the send parameter is missing, TelAlert goes directly toChatScript
when it detects the string, or directly toChatLogoff
if the timeout expires first.ChatScript
contains four expect/send parameter pairs:1. This pair has a blank expect, so it immediately sends an
S
followed by a carriage return.2. Waits for the colon after the pager-number prompt, then sends the
${PIN}
value. The\E
means that TelAlert will check to make sure the paging service echoes back the
PIN
correctly.
3. Waits for the colon after the message prompt, then sends the
${Message}
value.4. Waits for the menu to appear again, then starts
ChatScript
over or moves on toChatLogoff
, as discussed in the previous example.If the timeout expires on any of the expect parameters, TelAlert moves on to
ChatLogoff
. SinceChatLogoff
has a blank expect parameter, TelAlert immediately sends anE
followed by a carriage return, telling the paging system that it is exiting. TelAlert then continues processing the event, normally by hanging up and putting the message(s) in the sent state.Summary and Additional Information on Chat Scripts
To summarize, when you use the Chat protocol, TelAlert performs the following steps:
1. Connects to text paging service by modem.
2. Runs
ChatLogon
. If the script fails, TelAlert goes to step 4.3. Runs
ChatScript
repeatedly, once for each message. If the script fails or TelAlert hits the limit set byMaxMessagesPerCall
, it goes to step 4. If TelAlert receives theChatRejected
string, it hangs up, puts the current message into the “message rejected”state, and goes to step 5.
4. Runs
ChatLogoff
.5. If TelAlert has additional messages for the service, it starts over with step 1.
TelAlert’s chat scripts take the form of pairs of expect and send parameters, separated by spaces.
For example, here are four pairs:
If an expect parameter is not followed by a send parameter, as in the last of the sections outlined above, when TelAlert detects the expect string it goes on to the next expect parameter or, if as in this case it is at the end of the script, considers the script complete.