>From the users manual:

Example 4: sms-service-configuration

Please note that there are a mandatory keyword and an optional keyword-regex
fields. That means that service selection can be simplified as in the
following example. Suppose that some Web-content should be delivered to the
mobile. Different costumers use the same service but they rely on different
keywords. Whenever a sms-service is requested, Kannel first checks whether a
regex has been defined, if not a literal match based on keyword is
performed. If a regex is configured then the literal match is never tried.

                group=sms-service
                ...
                keyword=web_service
                keyword-regex=^(data|www|text|net)$
                get-url=http://someserver.net/getContent.jsp
                ...
                

Here it says that keyword is mandatory, even if it won't be evaluated
because you have a keyword-regex. So in your case, your sms-service group
could be:

group = sms-service
name = SLG
keyword = SLG
keyword-regex = "^SLG[0-9]+$"
text = "Hi there,SLG %a %b"
catch-all = true

What happens if you use this config?

== Rene


-----Original Message-----
From: users-boun...@kannel.org [mailto:users-boun...@kannel.org] On Behalf
Of Cariotoglou Mike
Sent: Thursday, 26 August, 2010 00:23
To: Nikos Balkanas; users@kannel.org
Subject: RE: Problem with Regular Expressions

ok, here it is :

-----BEGIN CONF----
#
# Sample configuration file for Kannel bearerbox on Debian.
# See the documentation for explanations of fields.
#

# HTTP administration is disabled by default. Make sure you set the
# password if you enable it.

group = core
admin-port = 13000
admin-password = xxxxxx
#admin-deny-ip = "*.*.*.*"
#admin-allow-ip = ""
wapbox-port = 13002
wdp-interface-name = "*"
log-file = "/var/log/kannel/bearerbox.log"
log-level = 0
#box-deny-ip = "*.*.*.*"
#box-allow-ip = "127.0.0.1"
smsbox-port = 13003

group = wapbox
bearerbox-host = localhost
log-file = "/var/log/kannel/wapbox.log"

# SMSC Fake
group = smsc
smsc = fake
host = localhost
port = 13004

group = smsbox
bearerbox-host = localhost
sendsms-port = 13005
log-file = "/var/log/kannel/smsbox.log"
log-level = 0
access-log = "/var/log/kannel/smsbox-access.log"

group = sendsms-user
username = test
password = test
default-sender = 12345

group = sms-service
name = SLG
#keyword = SLG
keyword-regex = "^SLG[0-9]+$"
text = "Hi there,SLG %a %b"
#exec = "ls -l /"
catch-all = true

# SMS SERVICE Default
# there should be default always
group = sms-service
keyword = default
text = "No service specified %a %b"
catch-all = true
-----END CONF------ 

----BEGIN LOG------
2010-08-26 01:17:09 [10783] [0] INFO: Added logfile
`/var/log/kannel/smsbox.log' with level `0'.
2010-08-26 01:17:09 [10783] [0] INFO: Logging accesses to
'/var/log/kannel/smsbox-access.log'.
2010-08-26 01:17:09 [10783] [0] INFO: Started access logfile
`/var/log/kannel/smsbox-access.log'.
2010-08-26 01:17:09 [10783] [0] INFO: HTTP: Opening server at port
13005.
2010-08-26 01:17:09 [10783] [0] DEBUG: Started thread 1
(gwlib/fdset.c:poller)
2010-08-26 01:17:09 [10783] [0] DEBUG: Started thread 2
(gwlib/http.c:server_thread)
2010-08-26 01:17:09 [10783] [0] INFO: Set up send sms service at port
13005
2010-08-26 01:17:09 [10783] [0] DEBUG: Started thread 3
(gw/smsbox.c:sendsms_thread)
2010-08-26 01:17:09 [10783] [0] DEBUG:
----------------------------------------------
2010-08-26 01:17:09 [10783] [0] DEBUG: Kannel smsbox version 1.4.3
starting
2010-08-26 01:17:09 [10783] [1] DEBUG: Thread 1 (gwlib/fdset.c:poller)
maps to pid 10783.
2010-08-26 01:17:09 [10783] [3] DEBUG: Thread 3
(gw/smsbox.c:sendsms_thread) maps to pid 10783.
2010-08-26 01:17:09 [10783] [2] DEBUG: Thread 2
(gwlib/http.c:server_thread) maps to pid 10783.
2010-08-26 01:17:09 [10783] [0] DEBUG:   dumping group (sendsms-user):
2010-08-26 01:17:09 [10783] [0] DEBUG:     <default-sender> = <12345>
2010-08-26 01:17:09 [10783] [0] DEBUG:     <group> = <sendsms-user>
2010-08-26 01:17:09 [10783] [0] DEBUG:     <username> = <test>
2010-08-26 01:17:09 [10783] [0] DEBUG:     <password> = <test>
2010-08-26 01:17:09 [10783] [0] DEBUG: Started thread 4
(gw/smsbox.c:obey_request_thread)
2010-08-26 01:17:09 [10783] [0] DEBUG: Started thread 5
(gw/smsbox.c:url_result_thread)
2010-08-26 01:17:09 [10783] [4] DEBUG: Thread 4
(gw/smsbox.c:obey_request_thread) maps to pid 10783.
2010-08-26 01:17:09 [10783] [5] DEBUG: Thread 5
(gw/smsbox.c:url_result_thread) maps to pid 10783.
2010-08-26 01:17:09 [10783] [0] DEBUG: Started thread 6
(gw/smsbox.c:http_queue_thread)
2010-08-26 01:17:09 [10783] [6] DEBUG: Thread 6
(gw/smsbox.c:http_queue_thread) maps to pid 10783.
2010-08-26 01:17:09 [10783] [0] INFO: Connected to bearerbox at
localhost port 13003.
2010-08-26 01:17:09 [10783] [0] DEBUG: Started thread 7
(gw/heartbeat.c:heartbeat_thread)
2010-08-26 01:17:09 [10783] [7] DEBUG: Thread 7
(gw/heartbeat.c:heartbeat_thread) maps to pid 10783.
2010-08-26 01:17:58 [10783] [4] DEBUG: no match found: SLG
2010-08-26 01:17:58 [10783] [4] INFO: Starting to service <SLG123> from
<1> to <2>
2010-08-26 01:17:58 [10783] [4] DEBUG: formatted text answer: <No
service specified SLG123 SLG123>
2010-08-26 01:17:58 [10783] [4] DEBUG: message length 34, sending 1
messages
2010-08-26 01:17:58 [10783] [0] DEBUG: Got ACK (0) of
43c761e3-1681-44f0-93f9-000ffbbd5141
2010-08-26 01:17:58 [10783] [0] DEBUG: No client - multi-send or ACK to
pull-reply
----END LOG--------

and, the relevant msg was, using fakesmsc in interactive mode:
1 2 text SLG123

btw, Nikos, are you Greek, as the name implies ? if so, could you
perhaps give me a ring (I will send my phone number)

> -----Original Message-----
> From: Nikos Balkanas [mailto:nbalka...@gmail.com] 
> Sent: Wednesday, August 25, 2010 10:18 PM
> To: Cariotoglou Mike; users@kannel.org
> Subject: Re: Problem with Regular Expressions
> 
> Hi,
> 
> Please post relevant smsbox logs at maximum detail (level = 
> 0). Also post your whole configuration.
> 
> BR,
> Nikos
> ----- Original Message -----
> From: "Cariotoglou Mike" <m...@singular.gr>
> To: <users@kannel.org>
> Sent: Wednesday, August 25, 2010 8:22 PM
> Subject: Problem with Regular Expressions
> 
> 
> Hi, I am new to Kannel. I am using 1.4.3 on Ubuntu 10.04 Server. I am
> trying to set up an SMS gateway, which will connect to smsc 
> using SMPP.
> before actually connecting to the smsc, I am testing locally, using
> fakesmsc. The problem I am having is that the keyword-regex variable
> does not seem
> to be working as documented.
> specifically :
> 
> the SMS message I am trying to match looks like this :
> SLGxxxxxxxxxxxxx (no spaces at all, a single string)
> 
> This configuration seems to work, although there is no <SLG> 
> word in the
> message, assuming that "word" implies space-delimiters:
> 
> group = sms-service
> name = SLG
> keyword = SLG
> text = "Hi there,SLG"
> catch-all = true
> 
> although it shouldn't work, IMHO! (it should work for <SLG 
> 123>, but not
> for <SLG123>, yet it does)
> 
> this configuration, which is the one I want, does not work at all:
> 
> group = sms-service
> name = SLG
> keyword-regex = "^SLG[0-9]+"
> text = "Hi there,SLG"
> catch-all = true
> 
> according to my understanding of regular expressions, this 
> should match
> SLG123, and NOT match SLGAAAA.
> it actually matches NOTHING.
> 
> Could you please explain why, and, in general, how can I 
> match a message
> that STARTS with a pattern, but does NOT contain any word delimiters ?
> 
> Mike
> 
> 




Reply via email to