Following examples, I tried to add processing of
offline messages.
Structure of my system is:
SIP client
<->Kamailio<->Asterisk<->Kamailio<->SIP
client
Where Kamailio in above is same server, but SIP clients are
different.
Now I have no problems with audio, video calls and messages,
if both clients are online.
All messages received from client are sent to Asterisk, where
I can or not process them and then I forward back to Kamailio.
When messages came from Asterisk server, then they are sent
directly to end user.
Sending messages to end user - I call this function, only if
message come from allow_source_address():
route[MSILO_MESSAGE]{
if
(lookup("location")){
xlog("
Relying");
t_relay();
}else{
xlog("Storing
MSILO_MESSAGE $ru-$tu-$ou");
m_store("$ru");
t_relay();
t_reply("202",
"Accepted");
};
exit();
}
When client register:
route[REGISTRAR] {
if
(is_method("REGISTER"))
{
if(isflagset(FLT_NATS))
{
setbflag(FLB_NATB);
#
uncomment next line to do SIP NAT pinging
##
setbflag(FLB_NATSIPPING);
}
if
(!save("location",0x04))
sl_reply_error();
#
MSILO - dumping user's offline messages
if
(m_dump("$fu")){
xlog("MSILO:
offline messages for $fu dumped - if they were \n");
}else{
xlog("MSILO:
no offline messages dumped\n");
};
exit;
}
}
I am sending message to offline contact, and I see record in
silo table. Record looks perfect.
Then offline contact become online, I see in debug MSILO:
offline messages for {offlined contact} dumped - if they were
But client do not receive nothing.
In case all contacts are online, then message go to contact,
and is not stored in silo.
Setup of msilio is:
loadmodule "msilo.so"
modparam("msilo","db_url",DBURL)
modparam("msilo","contact_hdr","Contact: registrar@MY
DOMAIN:5060;msilo=yes\r\n")
modparam("msilo","content_type_hdr","Content-Type:
text/plain\r\n")
modparam("msilo","offline_message","***$rU***$rb***")
By the way - I receive in Asterisk offline message.
Obviously, I am doing something wrong, but I cant understand
what.
Any help is welcome.
Version of Kamailio is:
#~> kamailio -V
version: kamailio 3.2.3 (x86_64/linux) 59f87e
flags: STATS: Off, USE_IPV6, USE_TCP, USE_TLS, TLS_HOOKS,
USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM,
SHM_MMAP, PKG_MALLOC, DBG_QM_MALLOC, USE_FUTEX,
FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER,
USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144,
MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT
PKG_SIZE 4MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt,
select.
id: 59f87e
compiled on 14:43:47 Jul 19 2012 with gcc 4.5.2
any reason you are calling t_relay() after m_store()?