Please find below a patch to allow an SMPP SMSC group to contain a service-type definition. Previously Kannel would always send NULL, i.e. "use default service-type". I've tested this patch and it works against Xwireless/Mblox SMPP server. If no-one objects I'll commit it to CVS and update the userguide.
Many thanks to Nick Clarey for writing this when I realised what the missing functionality was. Dave -- :: David Holland :: Systems Manager :: 3G Lab :: +44 01223 478900 :: "Standards ought to be less whimsical than, say, Microsoft APIs." -- Graham Nelson Index: gw/smsc/smsc_smpp.c =================================================================== RCS file: /home/cvs/gateway/gw/smsc/smsc_smpp.c,v retrieving revision 1.23 diff -u -r1.23 smsc_smpp.c --- gw/smsc/smsc_smpp.c 14 Feb 2003 10:44:39 -0000 1.23 +++ gw/smsc/smsc_smpp.c 18 Feb 2003 13:34:11 -0000 @@ -89,6 +89,7 @@ Octstr *address_range; Octstr *our_host; Octstr *my_number; + Octstr *service_type; int source_addr_ton; int source_addr_npi; int dest_addr_ton; @@ -120,7 +121,7 @@ int max_pending_submits, int reconnect_delay, int version, int priority, Octstr *my_number, int smpp_msg_id_type, int autodetect_addr, - Octstr *alt_charset) + Octstr *alt_charset, Octstr *service_type) { SMPP *smpp; @@ -144,6 +145,7 @@ smpp->alt_dcs = alt_dcs; smpp->our_host = octstr_duplicate(our_host); smpp->my_number = octstr_duplicate(my_number); + smpp->service_type = octstr_duplicate(service_type); smpp->transmit_port = transmit_port; smpp->receive_port = receive_port; smpp->enquire_link_interval = enquire_link_interval; @@ -173,6 +175,7 @@ octstr_destroy(smpp->username); octstr_destroy(smpp->password); octstr_destroy(smpp->system_type); + octstr_destroy(smpp->service_type); octstr_destroy(smpp->address_range); octstr_destroy(smpp->our_host); octstr_destroy(smpp->my_number); @@ -326,6 +329,9 @@ pdu->u.submit_sm.source_addr = octstr_duplicate(msg->sms.sender); pdu->u.submit_sm.destination_addr = octstr_duplicate(msg->sms.receiver); + + /* Set the service type of the outgoing message */ + pdu->u.submit_sm.service_type = octstr_duplicate(smpp->service_type); /* Check for manual override of source ton and npi values */ if(smpp->source_addr_ton > -1 && smpp->source_addr_npi > -1) { @@ -1252,6 +1258,7 @@ long dest_addr_npi; Octstr *our_host; Octstr *my_number; + Octstr *service_type; SMPP *smpp; int ok; int transceiver_mode; @@ -1284,6 +1291,7 @@ address_range = cfg_get(grp, octstr_imm("address-range")); our_host = cfg_get(grp, octstr_imm("our-host")); my_number = cfg_get(grp, octstr_imm("my-number")); + service_type = cfg_get(grp, octstr_imm("service-type")); system_id = cfg_get(grp, octstr_imm("system-id")); if (system_id != NULL) { @@ -1328,6 +1336,11 @@ error(0, "SMPP: Configuration file doesn't specify system-type."); ok = 0; } + if (octstr_len(service_type) > 6) { + error(0, "SMPP: Service type must be 6 characters or less."); + ok = 0; + } + if (!ok) return -1; @@ -1379,7 +1392,7 @@ dest_addr_npi, alt_dcs, enquire_link_interval, max_pending_submits, reconnect_delay, version, priority, my_number, smpp_msg_id_type, - autodetect_addr, alt_charset); + autodetect_addr, alt_charset, service_type); conn->data = smpp; conn->name = octstr_format("SMPP:%S:%d/%d:%S:%S", @@ -1401,6 +1414,7 @@ octstr_destroy(my_number); octstr_destroy(smsc_id); octstr_destroy(alt_charset); + octstr_destroy(service_type); conn->status = SMSCCONN_CONNECTING; Index: gwlib/cfg.def =================================================================== RCS file: /home/cvs/gateway/gwlib/cfg.def,v retrieving revision 1.81 diff -u -r1.81 cfg.def --- gwlib/cfg.def 14 Feb 2003 10:55:37 -0000 1.81 +++ gwlib/cfg.def 18 Feb 2003 13:34:11 -0000 @@ -232,6 +232,7 @@ OCTSTR(source-addr-npi) OCTSTR(dest-addr-ton) OCTSTR(dest-addr-npi) + OCTSTR(service-type) OCTSTR(source-addr-autodetect) OCTSTR(enquire-link-interval) OCTSTR(max-pending-submits)