Named Pipe

Info service creates a named pipe server in order to allow external applications to send SMS messages through SMS Studio connections or to update the contacts information in the Address Book.

The contents of this topic:

 

Using named pipe

From the external application's point of view, named pipe is used in the same way as a text file. Application opens the pipe instance, writes a number of commands, and closes the pipe. SMS Studio then performs the required tasks.

Note that each line of text sent through the pipe may contain only one command. Lines that are not recognized are ignored.

Application should create the write-only text file with the name \\.\pipe\Name, where Name is the name of the pipe set in the Info Setup dialog. Optionally, the file can be created using the following syntax \\ComputerName\pipe\Name, where ComputerName is the name of the computer on which SMS Studio is running.

Note that each Info service must have a unique pipe name.

 

Composing messages

Application can use the following commands for composing messages:

 

Managing the Address Book

Application can use the following commands to update the Address Book contents:

If a contact does not already exist, a new contact will be added with specified properties.

 

Examples

1. If the following text is sent through the pipe:

Text: Hello!
To: +123456789
<Send>

Then, the message containing the text Hello!, will be sent to +123456789, using Default reply account and Default reply address from the named pipe settings in the Info Setup dialog.

To send this message by using Visual Basic script you can use the following code:

Set fso=CreateObject("Scripting.FileSystemObject")
Set tf=fso.CreateTextFile("\\.\pipe\Name")
tf.WriteLine("Text: Hello!")
tf.WriteLine("To: +123456789")
tf.WriteLine("<Send>")
tf.Close

To send this message by using C/C++ you can use the following code:

FILE *f=fopen("\\\\.\\pipe\\Name","wt");
fprintf(f,"Text: Hello!\n");
fprintf(f,"To: +123456789\n");
fprintf(f,"<Send>\n");
fclose(f);

To send this message by using PHP script you can use the following code:

$pipe=fopen("\\\\".php_uname('n')."\\pipe\\Name","wt");
fwrite($pipe,"Text: Hello!\n");
fwrite($pipe,"To: +123456789\n");
fwrite($pipe,"<Send>\n");
fclose($pipe);

2. If the following text is sent through the pipe:

ReplyToID: 123
From: 5555
Text: Hello!
<Send>

Then, the message with ID 123 (obtained through %MsgID% parameter) will be used to collect the sender and recipient phone numbers and the account from which the message should be sent. Finally, the message containing the text Hello!, will be sent with the sender address 5555 (since From command will override the collected value).

3. If the following text is sent through the pipe:

Text: Hello!
NewLine: Hello, again!
From: 3333
AccountID: SMPP #1

To: +123456000
<Send>

To: +123456111
<Send>

Then, two messages both containing the text Hello!<CR>Hello, again!, will be sent to +123456000 and +123456111, using SMPP #1 account with 3333 as the sender.

4. If the following text is sent through the pipe:

Text: Hello!
To: 5555
AccountID: HTTP #2

From: +123456000
<Receive>

From: +123456111
<Receive>

Then, two messages both containing the text Hello!, will be received in Inbox as if they were sent from +123456000 and +123456111, to 5555, through HTTP #2 account.

5. To send a message containing a WAP Push link through the pipe, you can use the text similar to this:

BodyType: WAP Push
Body: http://wap.codesegment.com
NewLine: CodeSegment

To: +123456000
From: 5555
<Send>

6. If the following text is sent through the pipe:

Contact: +123456111
Name: John
AddGroup: Friends
Note: Age
NoteText: 27
Note: City
NoteText: New York
<Update>

Then, the contact with phone number +123456111 will have its name set to John, will be added to group Friends and his Age and City notes will be set to new values. If this contact does not already exist in the Address Book, a new one will be created with these parameters.

7. If the following text is sent through the pipe:

AddGroup: Friends
Note: City
NoteText: Chicago

Contact: +123456000
<Update>

Contact: +123456111
<Update>

Contact: +123456222
<Update>

Then, the contacts with phone numbers +123456000, +123456111 and +123456222 will be added to group Friends, and will have their City notes set to Chicago.

 

Copyright © 2002-2007 CodeSegment. All rights reserved.

   www.codesegment.com