This is very simple Kamailio config and when i access Memcached directly everything seem to be fine but, when accessed via Kamailio he leading 8 char is omitted.
I have included everything needed to test.
kamailio
mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"
debug=0
fork=yes
loadmodule "tm.so"
loadmodule "sl.so"
loadmodule "pv.so"
loadmodule "xhttp.so"
loadmodule "memcached.so"
modparam("memcached", "servers", "localhost:11211")
port=80
tcp_accept_no_cl=yes
event_route[xhttp:request] {
$var(number) = $hu;
$var(number) = $(var(number){s.substr,2,0});
xhttp_reply("200", "OK", "text/html",
"value: $mct(@@lnp.$var(number))");
}
mysql:
source /usr/share/mysql/innodb_memcached_config.sql
install plugin daemon_memcached soname "libmemcached.so";
CREATE SCHEMA lnp;
CREATE TABLE `lnp`.`lnp` ( `number` bigint(20) NOT NULL, `ported` bigint(20) DEFAULT NULL, PRIMARY KEY (`number`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into lnp.lnp (number,ported) values (8055551212,8053214321);
insert into innodb_memcache.containers (name,db_schema,db_table,key_columns,value_columns,flags,cas_column, expire_time_column,unique_idx_name_on_key) values ('lnp','lnp','lnp','number','ported', 0,0,0,'PRIMARY');
url:
http://localhost/?8055551212reponse:
value: 21
memcached
# nc localhost 11211
get @@lnp.8055551212
VALUE @@lnp.8055551212 0 10
8053214321
END