Included is a patch that allows shortnumbers to be printed on the receivers phone without prepending the pluss sign. This also make it easy for the receiver to reply directly to the message. This can be very convenient in services for chat, games, dating etc.
I have added a parameter called shortnumber to the smsc group. If the user sets for instance shortnumber=4 in the cimd2 section a sender of 2030 will be seen as 2030 on the receivers phone - it not it would have been +2030 (which makes replies harder).
Any comments or questions are welcome
--
Med vennlig hilsen,
Eurobate ASA
Arne K. Haaje
Senior Network Engineer
--------------------------------------------------------------------
Eurobate ASA - Postboks 4589 Nydalen - 0404 Oslo - Norway
Phone: +47 23 22 73 73 - Fax: +47 23 22 73 74 - Mob: +47 92 88 44 66
http://www.eurobate.com/
diff -ru kannel-snapshot.org/doc/userguide/userguide.xml
kannel-snapshot/doc/userguide/userguide.xml
--- kannel-snapshot.org/doc/userguide/userguide.xml 2003-01-15 09:52:41.000000000
+0100
+++ kannel-snapshot/doc/userguide/userguide.xml 2003-02-03 18:17:51.000000000 +0100
@@ -2056,6 +2056,7 @@
smsc-password = bar
keepalive = 5
sender-prefix = "12345"
+shortnumber = 5
</programlisting>
<informaltable frame=none>
@@ -2116,6 +2117,16 @@
empty string <literal>""</literal>.
</entry></row>
+ <row><entry><literal>shortnumber</literal></entry>
+ <entry><literal>number</literal></entry>
+ <entry valign=bottom>
+ If set Kannel will check all numerical sender adresses if they have less
+ or equal than this number of digits. If not Kannel will treat it as a SMS
+ short number, and will be received by the phone without the pluss sign
+prepended.
+ This is not connected to billing, but will just format the shortnumber so it
+can be directly replied to.
+ Your operator must support alphanumerical sender for this to work.
+ </entry></row>
+
</tbody></tgroup></informaltable>
</sect3>
diff -ru kannel-snapshot.org/gw/smsc/smsc.c kannel-snapshot/gw/smsc/smsc.c
--- kannel-snapshot.org/gw/smsc/smsc.c 2003-01-28 01:10:04.000000000 +0100
+++ kannel-snapshot/gw/smsc/smsc.c 2003-02-03 17:27:24.000000000 +0100
@@ -56,6 +56,7 @@
smsc->denied_prefix = NULL;
smsc->alt_charset = 0;
smsc->keepalive = 0;
+ smsc->shortnumber = 0;
smsc->mutex = mutex_create();
@@ -520,6 +521,7 @@
long iwaitreport;
long port, receive_port, our_port;
long keepalive;
+ long shortnumber;
long ois_debug;
long alt_dcs;
int typeno;
@@ -581,6 +583,9 @@
if (cfg_get_integer(&keepalive, grp, octstr_imm("keepalive")) == -1)
keepalive = 0;
+ if (cfg_get_integer(&shortnumber, grp, octstr_imm("shortnumber")) == -1)
+ shortnumber = 0;
+
if (cfg_get_integer(&alt_dcs, grp, octstr_imm("alt-dcs")) == -1)
alt_dcs = 0;
if (alt_dcs > 1)
@@ -619,7 +624,7 @@
username,
password,
keepalive,
- sender_prefix);
+ sender_prefix, shortnumber);
break;
case SMSC_TYPE_EMI:
diff -ru kannel-snapshot.org/gw/smsc/smsc_cimd2.c kannel-snapshot/gw/smsc/smsc_cimd2.c
--- kannel-snapshot.org/gw/smsc/smsc_cimd2.c 2003-01-28 01:05:11.000000000 +0100
+++ kannel-snapshot/gw/smsc/smsc_cimd2.c 2003-02-03 17:27:46.000000000 +0100
@@ -1202,7 +1202,7 @@
packet->seq = seq;
}
-static struct packet *packet_encode_message(Msg *msg, Octstr *sender_prefix)
+static struct packet *packet_encode_message(Msg *msg, Octstr *sender_prefix, int
+shortnumber)
{
struct packet *packet;
Octstr *text;
@@ -1237,7 +1237,10 @@
* be configured. */
/* Quick and dirty check to see if we are using alphanumeric sender */
- if (parm_valid_address(msg->sms.sender)) {
+ /* We also check to see if there are more digits than we have configured
+shortnumbers to have */
+ /* If less digits, it is a shortnumber and will be sent as alphanumeric sender. */
+ /* This avoids the the number getting a + prefix on the phone */
+ if (parm_valid_address(msg->sms.sender) && octstr_len(msg->sms.sender) >
+shortnumber) {
/* We are not, so send in the usual way */
/* Speed up the default case */
if (octstr_len(sender_prefix) == 0) {
@@ -1755,7 +1758,7 @@
/***************************************************************************/
SMSCenter *cimd2_open(Octstr *hostname, int port, Octstr *username,
-Octstr *password, int keepalive, Octstr *sender_prefix)
+Octstr *password, int keepalive, Octstr *sender_prefix, int shortnumber)
{
SMSCenter *smsc = NULL;
int maxlen;
@@ -1765,6 +1768,7 @@
smsc->type = SMSC_TYPE_CIMD2;
smsc->keepalive = keepalive;
+ smsc->shortnumber = shortnumber;
smsc->cimd2_hostname = octstr_duplicate(hostname);
smsc->cimd2_port = port;
smsc->cimd2_username = octstr_duplicate(username);
@@ -1864,7 +1868,7 @@
gw_assert(smsc != NULL);
- packet = packet_encode_message(msg, smsc->sender_prefix);
+ packet = packet_encode_message(msg, smsc->sender_prefix, smsc->shortnumber);
if (!packet)
return 0; /* We can't signal protocol errors yet */
diff -ru kannel-snapshot.org/gw/smsc/smsc_p.h kannel-snapshot/gw/smsc/smsc_p.h
--- kannel-snapshot.org/gw/smsc/smsc_p.h 2003-01-28 01:10:04.000000000 +0100
+++ kannel-snapshot/gw/smsc/smsc_p.h 2003-02-03 16:22:31.000000000 +0100
@@ -102,6 +102,7 @@
int cimd2_error;
time_t cimd2_next_ping;
Octstr *sender_prefix;
+ int shortnumber;
/* EMI */
int emi_fd;
@@ -211,7 +212,7 @@
/*
* Interface to Nokia SMS centers using CIMD 2.
*/
-SMSCenter *cimd2_open(Octstr *hostname, int port, Octstr *username, Octstr *password,
int keepalive, Octstr *sender_prefix);
+SMSCenter *cimd2_open(Octstr *hostname, int port, Octstr *username, Octstr *password,
+int keepalive, Octstr *sender_prefix, int shortnumber);
int cimd2_reopen(SMSCenter *smsc);
int cimd2_close(SMSCenter *smsc);
int cimd2_pending_smsmessage(SMSCenter *smsc);
diff -ru kannel-snapshot.org/gwlib/cfg.def kannel-snapshot/gwlib/cfg.def
--- kannel-snapshot.org/gwlib/cfg.def 2003-01-10 09:00:28.000000000 +0100
+++ kannel-snapshot/gwlib/cfg.def 2003-02-03 15:17:13.000000000 +0100
@@ -239,6 +239,7 @@
OCTSTR(notification-pid)
OCTSTR(notification-addr)
OCTSTR(msg-id-type)
+ OCTSTR(shortnumber)
)
