[I've send this email a couple of days ago but seems to have been lost
during the last round of kernel panics on the Kannel server. Sorry if
it comes twice]

Dear list,

I've made a patch for fakesmsc to implement an "Interactive Mode".

The patch modifies fakesmsc as follows:

If you call fakesmsc without any message, instead of panicking it
enters "interactive mode", meaning that listens on stdin for "fake MO"
messages.

Syntax for messages is the same as with regular non-interactive mode
(123 456 text Hello world), though no quotation marks are necessary.
One message per line, newline sends the message.

If you run kannel on localhost:10000 that means that you can call
fakesmsc without any switches, start typing your messages on stdin
and get the responses on stdout.

I've implemented it using select() on stdin so fgets doesn't block (it
timeouts and continues) and new messages are displayed on stdout
without the need to type anything. I've set a buffer of 256 bytes and
a timeout of 1 second, it could be easily changed from a couple of
defines on top of fakesmsc.c

I've found it quite useful to emulate user interaction on a more
"human" way (for trivias and similar sms games, for example, where
messages are very context-dependent).

Of course it could be theoretically possible to wrap this with
tcpserver or a similar beast and implement a socket based client from
a higher level language, but I didn't tried yet.

Patch it's here:

http://www.magicom-bcn.net/kannel/fakesmsc_interactive_mode.patch

A small excerpt explaining the new functionality for the userguide is
also included.

Hope it helps somebody.

Best regards,
--
Alejandro Guerrieri
Magicom
http://www.magicom-bcn.net/
LinkedIn: http://www.linkedin.com/in/aguerrieri

Reply via email to