self fix: missed fieldmap initialisation from the settings, please use
the attached patches for the gw/smsc/smsc_http.c, gwlib/cgf.def and
doc/userguide/userguide.xml
On 04/28/2011 06:19 PM, Semion Spivak wrote:
Update - Solved.
Added meta-data support to generic http smsc and used the previous
routing setup.
If anyone is interested, here's the patch attached.
On 04/27/2011 01:08 AM, Semion Spivak wrote:
Hi All,
I have a service that needs to pass MO messages via HTTP to SMPP clients.
I've managed to configure the following setup:
MO --> generic http smsc --> bearerbox --> opensmppbox -- esme
but there is a set of meta-data params to be passed along with the
message, and generic http smsc doesn't handle "meta-data" parameter of
incoming request.
So, I guess, the setup that uses smsbox cgi handler, would look like
MO --> smsbox (cgi-bin/sendsms handler) --> loopback smsc --> bearerbox
--> opensmppbox --> esme
Can anyone suggest the routing-related settings for smsbox and
the loopback, please?
Thank you in advance for your help,
--
Regards,
Semion Spivak
Smscoin.com Technical support.
Index: gwlib/cfg.def
===================================================================
--- gwlib/cfg.def (revision 4904)
+++ gwlib/cfg.def (working copy)
@@ -415,6 +415,7 @@
OCTSTR(generic-param-validity)
OCTSTR(generic-param-deferred)
OCTSTR(generic-param-foreign-id)
+ OCTSTR(generic-param-meta-data)
OCTSTR(generic-message-sent)
OCTSTR(generic-status-sent)
OCTSTR(generic-status-error)
Index: gw/smsc/smsc_http.c
===================================================================
--- gw/smsc/smsc_http.c (revision 4905)
+++ gw/smsc/smsc_http.c (working copy)
@@ -142,6 +142,7 @@
Octstr *service;
Octstr *account;
Octstr *binfo;
+ Octstr *meta_data;
Octstr *dlr_mask;
Octstr *dlr_url;
Octstr *dlr_mid;
@@ -217,6 +218,7 @@
octstr_destroy(fieldmap->service);
octstr_destroy(fieldmap->account);
octstr_destroy(fieldmap->binfo);
+ octstr_destroy(fieldmap->meta_data);
octstr_destroy(fieldmap->dlr_mask);
octstr_destroy(fieldmap->dlr_url);
octstr_destroy(fieldmap->dlr_mid);
@@ -1013,7 +1015,7 @@
} else if (apimsgid == NULL || status == NULL || timestamp == NULL || dest
== NULL) {
error(0, "HTTP[%s]: Insufficient args.",
octstr_get_cstr(conn->id));
- httpstatus = HTTP_OK;
+ httpstatus = HTTP_BAD_REQUEST;
retmsg = octstr_create("Insufficient arguments, rejected.");
} else {
switch (atoi(octstr_get_cstr(status))) {
@@ -1727,6 +1729,9 @@
if (fm->deferred == NULL)
fm->deferred = octstr_create("deferred");
fm->foreign_id = cfg_get(grp, octstr_imm("generic-param-foreign-id"));
+ fm->meta_data = cfg_get(grp, octstr_imm("generic-param-meta-data"));
+ if (fm->meta_data == NULL)
+ fm->meta_data = octstr_create("meta-data");
if (fm->foreign_id == NULL)
fm->foreign_id = octstr_create("foreign-id");
fm->message_sent = cfg_get(grp, octstr_imm("generic-message-sent"));
@@ -1748,7 +1753,7 @@
{
ConnData *conndata = conn->data;
FieldMap *fm = conndata->fieldmap;
- Octstr *user, *pass, *from, *to, *text, *udh, *account, *binfo;
+ Octstr *user, *pass, *from, *to, *text, *udh, *account, *binfo, *meta_data;
Octstr *dlrurl, *dlrmid;
Octstr *tmp_string, *retmsg;
int mclass, mwi, coding, validity, deferred, dlrmask;
@@ -1867,6 +1872,7 @@
}
account = http_cgi_variable(cgivars, octstr_get_cstr(fm->account));
binfo = http_cgi_variable(cgivars, octstr_get_cstr(fm->binfo));
+ meta_data = http_cgi_variable(cgivars, octstr_get_cstr(fm->meta_data));
debug("smsc.http.generic", 0, "HTTP[%s]: Constructing new SMS",
octstr_get_cstr(conn->id));
@@ -1887,6 +1893,7 @@
msg->sms.time = time(NULL);
msg->sms.account = octstr_duplicate(account);
msg->sms.binfo = octstr_duplicate(binfo);
+ msg->sms.meta_data = octstr_duplicate(meta_data);
Msg *resp = msg_duplicate(msg);
ret = bb_smscconn_receive(conn, msg);
if (ret == -1) {
Index: doc/userguide/userguide.xml
===================================================================
--- doc/userguide/userguide.xml (revision 4904)
+++ doc/userguide/userguide.xml (working copy)
@@ -4427,6 +4427,13 @@
Overrides the default parameter for the 'foreign-id' field
used on incoming requests.
</entry></row>
+
+ <row><entry><literal>generic-param-meta-data (o)</literal></entry>
+ <entry><literal>string</literal></entry>
+ <entry valign="bottom">
+ Overrides the default parameter for the 'meta-data' field
+ used on incoming requests.
+ </entry></row>
<row><entry><literal>generic-message-sent (o)</literal></entry>
<entry><literal>string</literal></entry>
@@ -8119,8 +8126,8 @@
</chapter>
+generic-param
-
<chapter id="ppg">
<title>Setting up Push Proxy Gateway</title>
<para>This chapter explains how to set up a push proxy gateway (PPG).