Hi!
IMO the siremis CDR generation procedure is buggy:
CREATE PROCEDURE `kamailio_cdrs`()
DECLARE inv_cursor CURSOR FOR SELECT src_user, src_domain, dst_user,
dst_domain, dst_ouser, time, callid,from_tag, to_tag, src_ip
FROM acc
where method='INVITE' and cdr_id='0';
...
REPEAT
FETCH inv_cursor INTO v_src_user,
v_src_domain, v_dst_user, v_dst_domain,
v_dst_ouser, v_inv_time, v_callid, v_from_tag,
v_to_tag, v_src_ip;
IF NOT done THEN
SET bye_record = 0;
SELECT 1, time INTO bye_record, v_bye_time FROM acc WHERE
method='BYE' AND callid=v_callid AND
((from_tag=v_from_tag AND to_tag=v_to_tag)
OR (from_tag=v_to_tag AND to_tag=v_from_tag))
ORDER BY time ASC LIMIT 1;
IF bye_record = 1 THEN
INSERT INTO cdrs (src_username,src_domain,dst_username,
dst_domain,dst_ousername,call_start_time,
duration,sip_call_id,
sip_from_tag,sip_to_tag,src_ip,created) VALUES
(v_src_user, v_src_domain,v_dst_user,
v_dst_domain,v_dst_ouser,v_inv_time,
UNIX_TIMESTAMP(v_bye_time)-UNIX_TIMESTAMP(v_inv_time),
v_callid,v_from_tag,v_to_tag,v_src_ip,NOW());
UPDATE acc SET cdr_id=last_insert_id() WHERE callid=v_callid
AND from_tag=v_from_tag AND to_tag=v_to_tag;
END IF;
SET done = 0;
END IF;
UNTIL done END REPEAT;
...
1. The UPDATE query will not UPDATE BYE records which were sent from
CALLEE to CALLER. This can be easily fixed with:
UPDATE acc SET cdr_id=last_insert_id() WHERE callid=v_callid
AND ( (from_tag=v_from_tag AND to_tag=v_to_tag) OR
(to_tag=v_from_tag AND from_tag=v_to_tag) );
2. (minor) It does not consider reINVITEs. I know the default Kamailio
config does not account reINVITEs, but I think when reINVITEs are
accounted too, this can mess up the CDR generation.
regards
Klaus
As I posted here before, Ubuntu has moved to Upstart as the main
engine to start daemons. As a result, Kamailio will fail to start on boot time because
it starts before MySQL that has already been moved to the new Upstart daemon
starting fashion. I am struggling to get some help from the Ubuntu community
explaining how we can match the previous init script behavior when using
Upstart but I got no success till now. Anyway, I have created an Upstart script
for Kamailio that does most everything that the old script use to do. However,
in this script I am making sure MySQL starts before Kamailio. If you have another SQL engine
you must change the script to match your SQL engine by changing the “start on
started” statement on the script. To use it you have to: A – Create a kamailio.conf file at “/etc/init/” with the
contents of the kamailio.conf script in attach, that is the new Upstart stile
init script. Please notice that I just adapted the existing script, no news… B – Create a symbolic link at /etc/init.d/ pointing to this
kamailio.conf at /etc/init/. C – If you want, you can still have a /etc/default/kamailio
file like it used to be and the script will behave like it used to behave when using
the default file. Hopefully someone more “influent” at the Ubuntu community
may get some help on how to adapt their “start on started” Upstart stanza to
behave like we need for multiple possible SQL engines. Cheers! Moacir
Hello all,
Is there any way to rewrite "tu" in CANCEL message in 3.2.1?
We use remove_hf / insert_hf for INVITE's "tu" modification before
t_relay.
It works fine, but it doesn't work for CANCEL (INVITE re-parsing is
disabled).
Ths,
Hi,
I am using app_lua to frequently store some data in htable and avp
entries, using sr.pv.sets. When I read the values using sr.pv.get
immediately after writing them, they seem correct. However, when I read
them later from Lua, I have noticed that sometimes the value is
incorrect or nil. Am I doing something wrong?
The following code uses rtimer to duplicate the problem on startup,
printing the errors to syslog.
Tested on version: kamailio 3.3.1 (i386/linux) 2d0f6f
###############
# kamailio.cfg
###############
loadmodule "pv.so"
loadmodule "xlog.so"
loadmodule "htable.so"
loadmodule "rtimer.so"
loadmodule "app_lua"
modparam("htable", "htable", "status=>size=14;autoexpire=0;")
modparam("rtimer", "timer", "name=ta;interval=10;mode=1")
modparam("rtimer", "exec", "timer=ta;route=LUA_TEST")
# the following path may need to change depending on filesystem setup
modparam("app_lua", "load", "/etc/kamailio/kamailio.lua")
route
{
route(LUA_TEST);
}
route[LUA_TEST] {
$var(lua_test_key) = $(pp{s.toupper}) + "::";
lua_runstring("htable_test([[status=>$var(lua_test_key)]])");
lua_runstring("avp_test([[status=>$var(lua_test_key)]])");
}
----------------
-- kamailio.lua
----------------
-- Test of sr.pv operations in Lua
function htable_test (namekey)
local pvar_prefix = "$sht("..namekey
pvar_test(pvar_prefix)
end
function avp_test ( name )
local pvar_prefix = "$avp("..name
pvar_test(pvar_prefix)
end
function pvar_test ( pvar_prefix )
for value = 10000, 10050 do
local pvar = pvar_prefix..value..")"
--sr.log("info", "Lua attempting to set '"..pvar.."' to value
'"..value.."'")
sr.pv.sets(pvar, value)
end
for value = 10000, 10050 do
-- now we check what was stored
local pvar = pvar_prefix..value..")"
local checkvar = sr.pv.get(pvar)
if ( tostring(checkvar) ~= tostring(value) ) then
sr.err(string.format("CHECK: Lua checking pvar '%s' and got value
'%s' which is NOT '%s'",
tostring(pvar),
tostring(checkvar),
tostring(value)
))
end
end
end
-- end of kamailio.lua
Thanks,
-Andrew
Hi,
i am using kamailio 3.3 version please help me with this issue.
1) Registered from SIP end point, kamailio added row in location table
2) Now using same SIP account details, pushed registration entry using *kamctl
ul add , * instead of overwriting the previous contact by new one it
inserts another new row in the location table
3) Total now 2 rows with same username are present in DB.
I am using save("location", "0x04") so before inserting new row it should
check whether already entry is there or not, if there should update the
same row.
I look forward to your reply.
Thanks
Ram
I am looking for a way to integrate Java business logic with Kamailio to
influence routing decisions, add/remove/modify headers, record
accounting-related information, etc. A while back there was a project named
WeSIP, but it doesn't appear to active anymore.
Is anyone doing something like this now, or any ideas or suggestions?
Thanks,
Ron
On Tue, January 22, 2013 1:58 pm, sr-users-request(a)lists.sip-router.org
wrote:
> Send sr-users mailing list submissions to
> sr-users(a)lists.sip-router.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
> or, via email, send a message with subject or body 'help' to
> sr-users-request(a)lists.sip-router.org
>
> You can reach the person managing the list at
> sr-users-owner(a)lists.sip-router.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of sr-users digest..."
>
>
> Today's Topics:
>
>
> 1. Modify IP address in SDP (Austin Einter)
> 2. Re: Modify IP address in SDP (Olle E. Johansson)
> 3. Problem with 4.0 nightlies and IMS - sem_post undefined
> (Barry Flanagan)
> 4. Patch to resolve segfault in json module (Richard Brady)
> 5. Re: Modify IP address in SDP (Austin Einter)
> 6. Re: Patch to resolve segfault in json module
> (Daniel-Constantin Mierla)
> 7. Re: [sr-dev] FOSDEM (Daniel Pocock)
>
>
>
> ----------------------------------------------------------------------
>
>
> Message: 1
> Date: Tue, 22 Jan 2013 18:37:13 +0530
> From: Austin Einter <austin.einter(a)gmail.com>
> Subject: [SR-Users] Modify IP address in SDP
> To: "SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) -
> Users Mailing List" <sr-users(a)lists.sip-router.org>
> Message-ID:
> <CANXt1k--VtC6aYHGTBZ5GqF8n=66g5PVwG4YhOC_uefxpVYy=g(a)mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
> Dear All
> When 200 OK to INVITE passes through Kamailio proxy , I want to change the
> IP address in SDP to a specific IP address.
>
>
> Can this be done by just modifying configuration files or do I need to
> modify in source code.
>
> In case I need to modify source code, which files I need to look at.
>
>
> Kindly provide pointers for said problem.
>
>
> Thanks
> Austin
Hello Austin,
1...I was doing similar one for my task.
Files : /root/kamailio-3.3.2/parser/sdp/sdp.h
sdp.h file has struct that holds ip address and port numbers of audio and
video.
Stucture: sdp_session_cell struct has member named str ip_addr will give
you ip address in sdp.
2...Yes you can edit existing code or else you can create your own 200ok
packet.I created my own 200OK and invite packets with sdp.
3...You can grab below ip address when kamailio proxy is about to forward
200OK to end client.File where you can find 200OK is
(though not sure but you can try this file edit existing 200OK):
/root/kamailio-3.3.2/modules/tm/t_reply.c
has below function
static int _reply( struct cell *trans, struct sip_msg* p_msg,
unsigned int code, char * text, int lock )
{
}
4...I did the following way to get ipaddr...and below piece of code you
can use it in the above function's body to edit 200OK's ip address::
char my_src_rtp_addr[8];
int my_src_rtp_addr_len=0;
struct sdp_session_cell *sdp_session;
if(0 != parse_sdp(p_msg))
{
LOG(L_INFO,"Unable to parse sdp\n");
}
sdp_session=get_sdp_session(p_msg,0);
if(sdp_session!=0){
my_src_rtp_addr_len=strlen(my_src_rtp_addr);
my_src_rtp_addr[my_src_rtp_addr_len]='\0';
my_src_rtp_addr[my_src_rtp_addr_len+1]='\0';
my_src_rtp_addr[my_src_rtp_addr_len+2]='\0';
my_src_rtp_addr[my_src_rtp_addr_len+3]='\0';
strncpy(my_src_rtp_addr,sdp_session->ip_addr.s,sdp_session->ip_addr.len);
}
If any questions,please let me know.
Thanks & Regards,
Manjusha A.
Integra Micro Software Services (P) Ltd.
When I used, last versions from git, I got error and crash of kamailo
using m_dump.
I got latest version from git, and I made one patch:
diff --git a/modules/msilo/msilo.c b/modules/msilo/msilo.c
index 209b309..4bda8fa 100644
--- a/modules/msilo/msilo.c
+++ b/modules/msilo/msilo.c
@@ -1125,8 +1125,16 @@ static int m_dump(struct sip_msg* msg, str* owner_s)
memcpy(tmp_extra_hdrs.s, extra_hdrs_str.s,
extra_hdrs_str.len);
memcpy(tmp_extra_hdrs.s+extra_hdrs_str.len,
str_vals[4].s, str_vals[4].len);
} else {
- tmp_extra_hdrs.len = 0;
- tmp_extra_hdrs.s = "";
+ tmp_extra_hdrs.len = 1;
+ if ((tmp_extra_hdrs.s = pkg_malloc(1)) == NULL)
+ {
+ LM_ERR("Out of pkg memory");
+ if (msilo_dbf.free_result(db_con, db_res) < 0)
+ LM_ERR("failed to free the
query result\n");
+ msg_list_set_flag(ml, mid, MS_MSG_ERRO);
+ goto error;
+ }
+ tmp_extra_hdrs.s[0]='\x0';
}
hdr_str.len = 1024;
if(m_build_headers(&hdr_str, str_vals[3] /*ctype*/,
The problem is:
tmp_extra_hdrs.s = "";
and consequent
pkg_free(tmp_extra_hdrs.s);
As I see, there are couple of ways to solve problem, one of them is
setting tmp_extra_hdrs.s = 0; but then we have warnings, or setting
tmp_extra_hdrs.s = 0;
and check before pkg_free, but pkg_free is used on couple of places.
I am not sure what is the best way to report bugs and offer patches.
Greetings,
I'm in the process of adding logic to 'detect' the direction of my
message, I have to set:
rtpproxy_manage("ei")
or
rtpproxy_manage("ie")
respectively. Rather then hard-coding IP addresses in my
configuration, I was curious how other people over come this? Perhaps
tagging their call control in some other method?
--
Paul Belanger | PolyBeacon, Inc.
Jabber: paul.belanger(a)polybeacon.com | IRC: pabelanger (Freenode)
Github: https://github.com/pabelanger | Twitter: https://twitter.com/pabelanger