Hi All,
I've started to play with MSILO module on kamailio v4.1.2, but it seems that all the stored
messages aren't delivered to the give user even if, looking at the debug log, the given messages
are found and queued for shipping. Another info I can add is that all the users are connected in
TLS. The relevant conf is below. Doe anyone can suggest a working setup for TLS users?
Thanks in advance,
Roberto Fichera.
# ----- msilo params -----
modparam("msilo", "db_url", DBURL)
modparam("msilo", "from_address", "sip:$rU@test.net")
modparam("msilo", "contact_hdr", "Contact: msilo@test.net:5060;msilo=yes\r\n")
modparam("msilo", "content_type_hdr", "Content-Type: text/plain\r\n")
# Handle SIP registrations
route[REGISTRAR] {
if (is_method("REGISTER"))
{
if(isflagset(FLT_NATS))
{
setbflag(FLB_NATB);
# uncomment next line to do SIP NAT pinging
## setbflag(FLB_NATSIPPING);
}
# MSILO - dumping user's offline messages
if (m_dump())
{
xlog("MSILO: offline messages dumped - if they were for user $fu\n");
}
else
{
xlog("MSILO: no offline messages dumped\n");
}
exit;
}
}
and in the route[LOCATION] I've this snippet
xlog( "Checking the destination user $rU exists\n");
if(avp_db_query("select username from subscriber where username='$rU'"))
{
xlog("MESSAGE received $ru -> storing using MSILO user=$rU\n");
if(m_store("$ru"))
{
xlog("MSILO: offline message stored\n");
if (!t_reply("202", "Accepted"))
{
sl_reply_error();
}
}
else
{
xlog("MSILO: offline message NOT stored\n");
if (!t_reply("503", "Service Unavailable"))
{
sl_reply_error();
}
}
# if the downstream UA doesn't support MESSAGE requests
# go to failure_route[1]
t_on_failure("1");
exit;
}
else
{
# The destination recipiend doen't exist
xlog( "Unable to store message for $ru because the user doesn't exist" );
if (!t_reply("404", "Not Found"))
{
sl_reply_error();
}
exit;
}
}
Hi
I am using Kamailio 4.0.1 in front of an asterisk servers farm to handle TLS with our clients and providers. The idea is to have kamailio "talking" SIP/UDP/5060 and TLS/TCP/5061 with the customers and providers and regular SIP/UDP/5060 with our internal asterisk servers.
So far at least for the customers it looks like it can work. But I have a problem, when the call is established and the called person hangs up, the BYE from the called person to the calling person is ignored. Only when the calling person hangs up first the call is terminated properly.
This is what I have been able to see:
1- Customer starts the TLS handshake/connection.
2- Kamailio authenticate it, then routes the call to the asterisk server using regular SIP/UDP/5060 but I see that it is inserting 2 Record Routes in the INVITE:
Record-Route: <sip:192.168.1.58;r2=on;lr=on>
Record-Route: <sip:192.168.1.58:5061;transport=tls;r2=on;lr=on>
3- The Contact on that INVITE to the asterisk also comes like this:
Contact: <sip:94167032@172.31.196.21:53325;transport=tls>
4- The ACK sent to the asterisk once it accepts the call (200 OK) also has those 2 Record-Routes:
Record-Route: <sip:192.168.1.58;r2=on;lr=on>
Record-Route: <sip:192.168.1.58:5061;transport=tls;r2=on;lr=on>
5- The call is established, once the called person decides to hang up the BYE looks like this:
BYE sip:94167032@172.31.196.21:53325;transport=tls SIP/2.0
Via: SIP/2.0/UDP 192.168.1.59:5060;branch=z9hG4bK40fa1c23;rport
Route: <sip:192.168.1.58;r2=on;lr=on>,<sip:192.168.1.58:5061;transport=tls;r2=on;lr=on>
Max-Forwards: 70
From: <sip:3030500@1.2.3.4>;tag=as37953869
To: "kamailio" <sip:kamailio@1.2.3.4>;tag=788cd7c892df40f3b1967112395e2ca4
Call-ID: f9fe65daf1074219be26cb0c224339f1
CSeq: 102 BYE
User-Agent: Asterisk PBX 11.3.0
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0
My kamailio TLS config is shown below:
enable_tls=yes
loadmodule "tls.so"
# ----- tls params -----
modparam("tls", "config", "/usr/local/kamailio-4.1//etc/kamailio/tls.cfg")
modparam("tls", "private_key", "./privkey.pem")
modparam("tls", "certificate", "./kamailio1_cert.pem")
modparam("tls", "ca_list", "./calist.pem")
modparam("tls", "verify_certificate", 1)
modparam("tls", "require_certificate", 1)
The TLS client that I am using is called Blink.At this point I don't know whether kamailio is sending the BYE using TLS to the customer and waiting for the 200 OK from the customer or whether kamailio does not like something in the BYE and that is why is ignoring it.
I see some encrypted packets from kamailio to the client but I don't know what is inside.
Any help would be very appreciated.
thank you
fabian
Hello,
One of the tests I've been working with is Asterisk realtime integration
according to Daniel's guide here:
http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb
Weird thing is the client looks registered but I'm not sure if it really is
registered. If I'm not mistaken I should see the peers when I issue 'sip
show peers' on asterisk cli. Instead I get this:
*CLI> sip show peers
Name/username Host Dyn Forcerport Comedia ACL Port
Status Description Realtime
0 sip peers [Monitored: 0 online, 0 offline Unmonitored: 0 online, 0
offline]
Also, calling between clients will fail; in Asterisk cli I get:
*CLI>
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
-- Executing [661@default:1] NoOp("SIP/660-00000000", "Testing: Dialed
661") in new stack
-- Executing [661@default:2] Dial("SIP/660-00000000",
"SIP/661,3600,rt") in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
-- Called SIP/661
== Everyone is busy/congested at this time (1:0/0/1)
-- Executing [661@default:3] Hangup("SIP/660-00000000", "") in new stack
== Spawn extension (default, 661, 3) exited non-zero on 'SIP/660-00000000'
In this setup I have SIP peers in an asterisk table added like this:
INSERT INTO sippeers (name, defaultuser, host, sippasswd, fromuser,
fromdomain) VALUES ('660', '660', 'dynamic', 'password', '660', 'testers.com
');
I have Kamailio and Asterisk on the same machine where Kamailio listens
port 5060 and Asterisk listens 5070. Things that differ from the guide are
Kamailio and Asterisk versions, which in my case are newer. Also, for
another testing case I have MULTIDOMAIN enabled in Kamailio, does this
interfere with the realtime integration? I'm using only one domain though.
Please let me know if any configs or traces I can provide will help figure
out what's going on.
cheers,
Olli
I am currently preparing a kamailio-asterisk combination. The asterisk installation uses realtime for SIP. The kamailio configuration (attached) was based on the reference at http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb but
has been heavily modified. Currently asterisk runs on localhost and only listens on SIP/RTP at 127.0.0.1 . Therefore, all of the SIP traffic appears to come from localhost, from the point of view of asterisk.
Currently I have a model on which internal SIP phones get identified by the authentication username, and then the contact names at From: and To: get massaged to incorporate the SIP domain, in order to emulate multiple-domain support. The 'sip' table in
Asterisk defines all such contacts as SIP accounts of the form name_domain.com, and the SIP phones are configured to use 'name' as authentication username for domain 'domain.com'. However, SIP providers that register on the server with authentication names
are left with their original names, since in the model, SIP trunks are available to all domains.
Now I have to add support for SIP providers which are to be authorized on the basis of IP only. Apparently, the permissions.so (WITH_IPAUTH) is made for just this purpose, so I enabled it. After authentication, I need to route the INVITE to asterisk, and
asterisk must somehow match the account for the SIP trunk from the available information on the INVITE request.
A typical INVITE for this scenario looks like this, before being processed by kamailio:
INVITE sip:6008010@172.28.161.218:5060;transport=udp;user=phone SIP/2.0
Via: SIP/2.0/UDP 200.25.144.58:5060;branch=z9hG4bK+676ea13f680e853fd847230512a347561+32e3da76+1
Call-ID: FBE75B3A@32e3da76
From: <sip:042294440@200.25.144.58:5060;user=phone>;tag=32e3da76+1+544c000c+52be771c
To: <sip:6008010@172.28.161.218:5060;user=phone>
CSeq: 975469826 INVITE
Expires: 180
Organization: SetelGYE
Min-SE: 90
Session-Expires: 18000
Supported: replaces, 100rel, timer
Contact: <sip:042294440@200.25.144.58:5060;transport=udp;user=phone>
Content-Length: 149
Content-Type: application/sdp
Max-Forwards: 70
Allow: INVITE, ACK, CANCEL, BYE, OPTIONS, NOTIFY, PRACK, UPDATE, INFO, REFER
v=0
o=- 0 0 IN IP4 201.217.79.3
s=-
c=IN IP4 201.217.79.3
t=0 0
m=audio 5388 RTP/AVP 8 101
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
Here, 6008010 is the phone number that was dialed at the provider in order to reach my system, and 042294440 is the provider-supplied Caller-ID, which I want to preserve all the way to Asterisk. In particular, 042294440 appears as the value that ends up as
$fU (From: username) while being processed in kamailio. If I pass the SIP packet as-is to asterisk, asterisk first tries to match by the value of $fU, which obviously fails to match the trunk name. It then tries to match by incoming IP, which also fails
because asterisk received this packet from 127.0.0.1 . Finally, asterisk sort of matches to the first record in the sip table, which is *not* the SIP account for this trunk, but some other random account.
I have a partial solution that uses sqlops to make a query to the sip table, using the $si (source IP) and reads the trunk name in order to replace $fU. This works, as now $fU will have the trunk name and asterisk will now recognize the intended SIP
account for the trunk. However, this has the unfortunate side effect of throwing out the Caller-ID information.
What is the standard/proper way to deal with this situation? Is there a well-known way to make Asterisk match the trunk name, without overwriting the Caller-ID information? Before you ask, requesting the provider to modify its INVITEs is not an option. I
believe there is a standard way to deal with this, since this scenario should also arise with a kamailio that faces the internet, and relays INVITEs (after authentication) to an asterisk in a local network. As far as I can tell, the fact that in my case
the 'local network' is localhost should be irrelevant.
Hi
We experimented a crash with kamailio 4.0.5 , it looks like a memory corruption.
After an analyse of the core file, it appears that it crashed while doing a str2int transformation (trying to convert the value of myvar to int):
if (($(dlg_var("myvar"){s.int}) == 0) && some_other_condition ) {
do_something();
}
gdb output:
(gdb) frame 4
#4 0x00000000004bcb77 in rval_get_btype (h=0x7fffd69713d0, msg=0x7ffc8a58a4d0, rv=0x7ffc8a3dfc18, val_cache=0x7fffd69706a0) at rvalue.c:418
418in rvalue.c
(gdb) i loc
r_avp = 0x7fffd69709b0
tmp_avp_val = {n = -1975661232, s = {s = 0x7ffc8a3dcd50 "\034\001", len = -1973902128}, re = 0x7ffc8a3dcd50}
avpv = 0x7fffd6970928
tmp_pval = {rs = {s = 0x7ffc8a5b86e0 "route[MAIN]: call-id=52e8c2b553540db4 from=987654321 to=+1234567890 : ACK ip=10.0.x.x", len = -1975658024}, ri = -694745968, flags = 32767}
pv = 0x7fffd69706a8
tmp = RV_NONE
ptype = 0x7ffc8a58a4d0
__FUNCTION__ = "rval_get_btype"
(gdb) p *pv
$8 = {rs = {s = 0x7069736f58652820 <Address 0x7069736f58652820 out of bounds>, len = 775106354}, ri = 0, flags = 4}
(gdb) p val_cache->c.pval
$9 = {rs = {s = 0x7069736f58652820 <Address 0x7069736f58652820 out of bounds>, len = 775106354}, ri = 0, flags = 4} <- the value of s is invalid, it's a string from a SIP message.
Full GDB backtrace and info locals here :
kamailio 4.0.5 crash - memory corruption ? - Pastebin.com
kamailio 4.0.5 crash - memory corruption ? - Pastebin.co...
(gdb) bt full #0 0x00007ffc822851e8 in str2sint (_s=0x7fffd69706a8, _r=0x7fffd69706b8) at ../../ut.h:681 i = 0 sign = 1
View on pastebin.com Preview by Yahoo
I still have the core file and I can help with further analysis .
Regards,
Dragos
PS: Kamailio still rocks.
Hi,
I'm looking for a solution to limit the number of call initiations or
OPTIONS packets or REGISTER packets per user. Neither pike, nor pipelimit
or ratelimit give me the possibility to do this. Limiting it based on the
source IP is not an option in our case.
Is there a module I can use? Or is this generally a bad idea?
Best Regards,
Sebastian
<http://www.sipgate.co.uk>
Hello,
I have Kamailio with websocket module and I want to connect Asterisk as
media server. I'm trying to route calls from web JsSIP users to non-web
users I would like to ask how can I implement it? Can i use
the rtpproxy-ng Module and here setup IP of Asterisk? Or is there any other
way to do it?
Thank you for your help!
Regards,
Patrik Kristel