[PATCH] Alphanumeric sender in CIMD2
Stefan Cars <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi! Here is a patch against current CVS for implementing alphanumeric sender in the CIMD2 driver. Since (at least our) CIMD2 SMSC rejects the submit if you add a alphanumeric sender if you don't have access to that I had to implement a configuration directive for the CIMD2 to set if you have alphanum access or not. (This is set with alphanum = 0 or alphanum = 1). If you agree to this patch I could write some in the docs aswell! This is tested aganst 4 CIMD2 SMSC's and works fine for me. / Stefan
cimd2_alpha.patch
(text/plain, 2.7 KB)
Index: gw/smsc/smsc.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc.c,v
retrieving revision 1.1
diff -r1.1 smsc.c
75a76
>
86a88,89
> smsc->alphanum = 0;
>
494c497
<
---
> long alphanum;
538a542,544
> if(cfg_get_integer(&alphanum, grp, octstr_imm("alphanum")) == -1)
> alphanum = 0;
>
588c594,595
< sender_prefix);
---
> sender_prefix,
> alphanum);
Index: gw/smsc/smsc_cimd2.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_cimd2.c,v
retrieving revision 1.2
diff -r1.2 smsc_cimd2.c
78a79
> P_ORIGINATING_ALPHA = 27,
133a135
> { "originating alphanum", P_ORIGINATING_ALPHA, 11, P_STRING },
1203c1205
< static struct packet *packet_encode_message(Msg *msg, Octstr *sender_prefix)
---
> static struct packet *packet_encode_message(Msg *msg, Octstr *sender_prefix, int alphanum)
1226,1232d1227
< if (!parm_valid_address(msg->sms.sender)) {
< warning(0, "cimd2_submit_msg: non-digits in "
< "originating phone number '%s', discarded",
< octstr_get_cstr(msg->sms.sender));
< return NULL;
< }
<
1236a1232,1240
> /* Check if msg->sms.sender includes other that digits and that the
> the alphanum configuration directive set. If both is true then
> we can add the the alphanumerical sender*/
>
>
> if (!octstr_check_range(msg->sms.sender, 1, 256, gw_isdigit) && alphanum == 1) {
> packet_add_string_parm(packet, P_ORIGINATING_ALPHA, msg->sms.sender);
> }
>
1711c1715
< Octstr *password, int keepalive, Octstr *sender_prefix)
---
> Octstr *password, int keepalive, Octstr *sender_prefix, int alphanum)
1720a1725
> smsc->alphanum = alphanum;
1819,1820c1824
<
< packet = packet_encode_message(msg, smsc->sender_prefix);
---
> packet = packet_encode_message(msg, smsc->sender_prefix, smsc->alphanum);
Index: gw/smsc/smsc_p.h
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_p.h,v
retrieving revision 1.1
diff -r1.1 smsc_p.h
103a104
> int alphanum;
203c204
< 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 alphanum);
Index: gwlib/cfg.def
===================================================================
RCS file: /home/cvs/gateway/gwlib/cfg.def,v
retrieving revision 1.72
diff -r1.72 cfg.def
224a225
> OCTSTR(alphanum)