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 All/ Daniel,
According to the recommendation I have migrated my Kamailio 4.1.2 to the
Kamailio 4.1.3. But very frequent crashes are coming in Kamailio 4.1.3
which was not coming on the 4.1.2. The gdb backtrace of the crash is below:
I have seen many crashes in couple of days but the "data_lump.c: No such
file or directory" this line is coming in every crash. I think every time
it crashes in the same file and same function somewhere else.
GDB Backtrace:
Program terminated with signal 11, Segmentation fault.
#0 0x080791c5 in count_applied_lumps (ll=0xb74f9898, type=10)
at data_lump.c:702
702 data_lump.c: No such file or directory.
in data_lump.c
Missing separate debuginfos, use: debuginfo-install
glibc-2.12-1.132.el6.i686
(gdb) where
#0 0x080791c5 in count_applied_lumps (ll=0xb74f9898, type=10)
at data_lump.c:702
#1 0x00141392 in add_uac (t=0xb5688bc8, request=0xb7506288, uri=0xb75062ac,
next_hop=0xb75062ac, path=0xb7506604, proxy=0x0, fsocket=0x0,
snd_flags=..., proto=0, flags=2, instance=0xb750660c, ruid=0xb7506618,
location_ua=0xb7506620) at t_fwd.c:855
#2 0x001459a1 in t_forward_nonack (t=0xb5688bc8, p_msg=0xb7506288,
proxy=0x0,
proto=0) at t_fwd.c:1721
#3 0x00139a3a in t_relay_to (p_msg=0xb7506288, proxy=0x0, proto=0,
replicate=0) at t_funcs.c:354
#4 0x0015d9d3 in _w_t_relay_to (p_msg=0xb7506288, proxy=0x0, force_proto=0)
at tm.c:1515
#5 0x0015e41e in w_t_relay (p_msg=0xb7506288, _foo=0x0, _bar=0x0) at
tm.c:1713
#6 0x0805d400 in do_action (h=0xbf849ba0, a=0xb74e5194, msg=0xb7506288)
at action.c:1099
#7 0x08064dd9 in run_actions (h=0xbf849ba0, a=0xb74e5194, msg=0xb7506288)
at action.c:1599
#8 0x08065429 in run_actions_safe (h=0xbf84ae9c, a=0xb74e5194,
msg=0xb7506288)
at action.c:1664
#9 0x080ff0c4 in rval_get_int (h=0xbf84ae9c, msg=0xb7506288, i=0xbf849f18,
rv=0xb74e53ac, cache=0x0) at rvalue.c:924
#10 0x08101a48 in rval_expr_eval_int (h=0xbf84ae9c, msg=0xb7506288,
res=0xbf849f18, rve=0xb74e53a8) at rvalue.c:1918
---Type <return> to continue, or q <return> to quit---
Regards
Varun
Hi,
I have just started using Kamalio and We are using it for a VOIP app that I
am trying to build.
Here are the things that i have done
1. I have setup kamalio server
2. I could get it running using linphone app
3. I could add users using kamctl command
Since I am building a smartphone app I want to register users remotely from
the phone. I did check up the XML RPC documentation and it doesn't talk
about apis to add users and a lot of other functionalities that are present
on kamctl commandline tool.
I am wondering if there a webservice API tha ti can user to manage users
and locations and accounts on kamalio ?
--
Cheers,
Akash A
ᐧ
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>
Is it possible to manipulate the pings (OPTIONS in my case) to force a source
ip:port combo per destination?
dispartcher.list:
1 sip:192.168.0.1:5060
2 sip:192.168.1.1:5070
3 sip:192.168.2.1:5050
The kamailio (4.1) is listening on 192.168.3.1 5060 and 5070. dispatcher 2
cares about the source port, which should be 5070. 1 and 3 don't care.
--
POCOS B.V. - Croy 9c - 5653 LC Eindhoven
Telefoon: 040 293 8661 - Fax: 040 293 8658
http://www.pocos.nl/ - http://www.sipo.nl/
K.v.K. Eindhoven 17097024
Hi Daniel,
Yes I agree with you that kamailio is not involved in the rtp handling and
forwarding but RTP Proxy does this. So I have mentioned that when my call
is established then my RTP passes through the RTPProxy. The issue is that
RTP is coming proper at UAC Side so no Voice Problem but may be RTP is not
coming good at Phone Side that is why voice is bad at Phone SIde.
Please see again my network.
SIP UAC--------->Kamailio+RTPProxy------>SIP Server------->Phone
And Kamailio and RTPProxy are on same machine and load is not high only one
call is enough to produce this issue. It seems that this issue is with
RTPProxy. Please anyone can provide me some settings or inputs on this
issue. I can provide more information if required.
Thanks and Regards
Varun
Date: Fri, 02 May 2014 11:27:09 +0200
From: Daniel-Constantin Mierla <miconda(a)gmail.com>
To: "Kamailio (SER) - Users Mailing List"
<sr-users(a)lists.sip-router.org>
Subject: Re: [SR-Users] Voice is breaking when using Kamailio 4.1.3
Message-ID: <536364ED.4080806(a)gmail.com>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
Hello,
kamailio is not involved in the rtp handling/forwarding. So either is a
bad connection somewhere in the path or an issue in the client sides.
Can you try with different phones?
Cheers,
Daniel
On 02/05/14 07:49, varun pratapsingh wrote:
> HI All/ Daniel,
> We are using the Kamailio+ RTPProxy as a SIP and RTP Proxy to call the
> Phones. Our setup is like below:
> SIP UAC--------->Kamailio+RTPProxy------>SIP Server------->Phone
> Now when we call from UAC to Phone then voice is coming good at the
> UAC side. But we receive the bad voice at the Phone side the Voice is
> breaking and hardly audible.
> Can anybody faced this problem. Please suggest me any solution if any.
> I can mail any settings if anybody asks.
> Thanks in advance.
> Regards
> Varun
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users(a)lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
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