I already filed a bug (#198) in Kannel/Mantis but it looks like this list is the better place ...
I've attached a patch against wsp_headers.c which solves this issue (and another one which is closely related).
Cheers, Kai
Index: wap/wsp_headers.c
===================================================================
RCS file: /home/cvs/gateway/wap/wsp_headers.c,v
retrieving revision 1.22
diff -u -p -d -r1.22 wsp_headers.c
--- wap/wsp_headers.c 11 Feb 2005 15:59:18 -0000 1.22
+++ wap/wsp_headers.c 3 Mar 2005 22:21:21 -0000
@@ -251,8 +251,9 @@ static Octstr *convert_q_value(int q)
}
/* Three decimal quality factors shall be multiplied with 1000
- * and incremented by 100. */
- if (q > 100 && q <= 1000) {
+ * and incremented by 100. I.e. the values to be converted range from
+ * 101 (.001 * 1000 + 100) to 1099 (.999 * 1000 + 100). */
+ if (q > 100 && q < 1100) {
q = q - 100;
result = octstr_create("0.");
octstr_append_char(result, (q / 100) + '0');
@@ -270,6 +271,9 @@ static Octstr *convert_q_value(int q)
static Octstr *unpack_q_value(ParseContext *context)
{
int c, c2;
+
+ /* better use the existing parse_get_uintvar(..) to extract the
+ * encoded uintvar? */
c = parse_get_char(context);
if (c < 0)
@@ -279,7 +283,7 @@ static Octstr *unpack_q_value(ParseConte
c2 = parse_get_char(context);
if (c2 < 0 || (c2 & 0x80))
return NULL;
- c = ((c & 0x7f) << 8) + c2;
+ c = ((c & 0x7f) << 7) + c2;
}
return convert_q_value(c);
