THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Sławomir Bocheński (lkslawek)
Attached to Project - sip-router
Summary - CANCEL sent shortly after '100 trying' response to INVITE does not always end the call
Task Type - Bug Report
Category - Core
Status - Unconfirmed
Assigned To -
Operating System - Linux
Severity - Low
Priority - Normal
Reported Version - 4.1
Due in Version - Undecided
Due Date - Undecided
Details - This is the situation we have observed during some manual tests of SIP-enabled product when using Kamailio as registrar and proxy. When a client sends INVITE via Kamailio and then right after receiving '100 trying' provisional response it sends CANCEL, it happens that Kamailio replies instantly with '487 terminated' and yet it continues to forward the INVITE to the callee's end. So to put this in diagram:
<code>caller kamailio callee
| | |
|---------- INVITE -------->| |
|<------- 100 trying -------| |
|---------- CANCEL -------->| |
|<-- 487 Request canceled --| |
|<--- 200 ok -- no more ----| |
| pending branches | |
| |---------- INVITE -------->|
|---------- ACK ----------->| |
| |<------- 180 Ringing ------|</code>
It seems to me that another Kamailio process is processing the CANCEL before INVITE has been fully processed and it is yet unaware of the session existence.
The problem was originally observed on our Kamailio 4.0 instance with the routing script based on the default one, with NAT and authorisation enabled. Actually enabling NAT is one of the factors that makes this to occur more frequently, as anything that slows down INVITE processing. Even enabling debugging makes the probability rise. For simulation it's enough to e.g. insert sleep(1) at the top of the NATMANAGE block. I've also confirmed this on the latest release, that is 4.1.6, and on git master branch.
Attached logs were collected while using Kamailio development version compiled from git tree, branch master, using the default ./etc/kamailio.cfg modified to have full debug in syslog only, so defining WITH_DEBUG and setting log_stderr to 'no'. No other changes. Logs start with series of successful cancels, followed by one occurrence of the problem.
Both ends are running baresip 0.4.11. Callee is using TCP transport, listening on 5061 (but no TLS, so you may tune your dissector to decode 5061 as SIP), caller - UDP. Note that using UDP on both ends only slightly changes the reply sent on CANCEL, but the problem stays.
The tests for logs were mostly performed using caller's baresip with enabled module cons.so, thus accepting command over tcp port 5555, by running some flavour of:
<code>( echo -e 'dcallee'; sleep 0.01; echo -ne '\e' ) | nc localhost 5555</code>
In baresip console this is d for dial, destination and <RET> to confirm, then <ESC> to cancel/drop the call. Pasting 'dcalle\n\e' sequence from the X selection buffer directly to baresip console even without delay before cancellation also should do (although baresip more or less often will cancel the call before actually sending the INVITE itself).
One or more files have been attached.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=468
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
Module: sip-router
Branch: master
Commit: 288d8abb1b84a1a42121d62f61affe7cb9a4f12e
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=288d8ab…
Author: Olle E. Johansson <oej(a)edvina.net>
Committer: Olle E. Johansson <oej(a)edvina.net>
Date: Mon Sep 22 14:28:32 2014 +0200
permissions: Fix typo in documentation
---
modules/permissions/README | 2 +-
modules/permissions/doc/permissions_admin.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/permissions/README b/modules/permissions/README
index 6f44727..f4c9916 100644
--- a/modules/permissions/README
+++ b/modules/permissions/README
@@ -339,7 +339,7 @@ Chapter 1. Admin Guide
peer_tag_avp module parameter has been defined.
Rules are stored in a database table specified by module parameters.
- There also exists a module parameter dm_mode that determines if rules
+ There also exists a module parameter db_mode that determines if rules
are cached into memory for faster matching or if database is consulted
for each invocation of allow_trusted function call.
diff --git a/modules/permissions/doc/permissions_admin.xml b/modules/permissions/doc/permissions_admin.xml
index a6da004..8ef1b2f 100644
--- a/modules/permissions/doc/permissions_admin.xml
+++ b/modules/permissions/doc/permissions_admin.xml
@@ -247,7 +247,7 @@
<para>
Rules are stored in a database table specified by module
parameters. There also exists a module parameter
- <varname>dm_mode</varname> that
+ <varname>db_mode</varname> that
determines if rules are cached into memory for faster
matching or if database is consulted for each invocation
of allow_trusted function call.
Hi,
I upgraded both kamailio and RTPEngine to latest trunk last night and now
when I engage media proxy for any call i see following warning in rtpengine
logs,
rtpengine[8506]: Unknown flag encountered: 'force'
The list of flags i pass in offer is,
'force trust-address replace-origin replace-session-connection ICE=remove'
Although i am not running chain of rtp proxies, so it is probably safe for
me to remove this flag but still this may be a bug in RTPEngine. The flag
is listed in kamailio's rtpengine module documentation here,
http://kamailio.org/docs/modules/devel/modules/rtpengine.html#rtpengine.f.r…
Thank you.
Hello,
I was going through the new features and stumbled upon this new one -
developed by Mohd. Shahzad Shafi.
As already mentioned on the wiki about this module, I intend to use it for
my custom security layer between UACs and SIP Proxy (Kamailio) but the
issue is - the custom security layer (encryption/decryption code) is
written in C and should precisely be applied for the messages between UAC
and Proxy.
Is there a way I can achieve this using Corex module since it does
intercept the network I/O messages ?
Any help here would be really appreciated.
--
Warm Regds.
MathuRahul
HI Shehzad,
First of all thanks to you for writing such a nice module.
I am also facing the same problem. The module works fine when UAC (PJSIP)
sends the encoded SIP packet on UDP transport but when it sends the same
encoded packet with TCP transport it never reaches to the
nio_msg_received() function in corex_nio.c and so does not print anything
in $mb when printed from the kamailio.cfg using the xlog in
event_route[network:msg].
Digging further I also found that when kamailio receives the TCP packet
with encoded sip in file tcp_read.c in function tcp_read_headers() then it
goes for some tcp_headers parsing and drops the packet. But it works good
when the TCP packet data segment is not encoded that is SIP packet is not
encoded and transmitted on TCP :
1) TCP Headers + payload (SIP Packet) ----> this case works fine
2) TCP Headers + payload (encoded SIP Packet) ------> this case does not
work fine.
Any pointers where I might be wrong.
Thanks
Varun
Regards
Varun
> Date: Sat, 20 Sep 2014 19:12:24 +0200
> From: Muhammad Shahzad <shaheryarkh(a)gmail.com>
> To: "Kamailio (SER) - Development Mailing List"
> <sr-dev(a)lists.sip-router.org>
> Subject: Re: [sr-dev] Reqd. help on Corex (Obfuscate) - Kamailio 4.2.x
> Message-ID:
> <
> CAFZQphwxr6TbVV98tF5bGAcfi7822POMGGhadP4_x77XZw+hDg(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> There is something wrong with your encryption setup, the event_route
> [network:msg] gets raw messages that was either just received from the
> network interface or the final message that is about to be sent over
> network socket. The SIP parsing is done AFTER message has been processed by
> this route. So, if SIP parsing fails then it means the message was not
> correctly decrypted in event_route [network:msg].
>
> Thank you.
>
>
>
> On Sat, Sep 20, 2014 at 3:25 PM, Rahul MathuR <rahul.ultimate(a)gmail.com>
> wrote:
>
> > Hello Gents,
> >
> > Thanks for guiding me in the correct direction.
> >
> > However, it so came out that when encrypted packets come to kamailio over
> > transport 'TCP' then it gets rejected from tcp_read.c even before coming
> to
> > corex module.
> > I guess, maybe it is getting rejected due to header parsing failure.
> >
> > Any pointers here would be very helpful !!
> >
> > Thanks one again..
> >
> >
> >
> > On Wed, Sep 17, 2014 at 12:44 PM, Daniel-Constantin Mierla <
> > miconda(a)gmail.com> wrote:
> >
> >> Hello,
> >>
> >> the corex has a function to tell if the message is received by kamailio
> >> or sent out:
> >>
> >> - http://kamailio.org/docs/modules/devel/modules/corex.html#idp29928
> >>
> >> If you interconnect with other servers/gateways when you don't what to
> do
> >> special encoding, then you need to test src ip or look ar r-uri/dst uri.
> >>
> >> Cheers,
> >> Daniel
> >>
> >>
> >> On 17/09/14 04:24, Rahul MathuR wrote:
> >>
> >> Hi,
> >>
> >> Did you get some free cycles to look at it ?
> >>
> >> On Wed, Sep 17, 2014 at 12:12 AM, Rahul MathuR <
> rahul.ultimate(a)gmail.com>
> >> wrote:
> >>
> >>> Thanks for replying !
> >>>
> >>> But how to check whether a particular message received by Kamailio was
> >>> sent by UAC or SIP Server ?
> >>> Also, on the same lines - how to know whether a particular message
> about
> >>> to be send from Kamailio is bound to UAC or SIP Server ?
> >>>
> >>> On Tue, Sep 16, 2014 at 10:51 PM, Muhammad Shahzad <
> >>> shaheryarkh(a)gmail.com> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> The network io intercept feature basically allows kamailio script
> >>>> writer to do whatever s/he may want to do with raw SIP packets (that
> are
> >>>> just received by kamailio or about to be sent out by kamailio), e.g.
> >>>> encryption, compression or any final touches to sip message before it
> is
> >>>> processed by kamailio core. That is why it is purposely kept abstract
> and
> >>>> any particular use or implementation is left to the script writer.
> >>>>
> >>>> In your case the encryption / decryption code is in C/C++, you can
> >>>> try one of the followings,
> >>>>
> >>>> 1. Writeup a C/C++ program that receives outgoing SIP message as text
> >>>> (and some other parameters, e.g. encryption key) in input arguments
> and
> >>>> returns the encrypted message in event_route [ network:msg ] and vice
> versa
> >>>> (for incoming messages). You can call this program directly from
> >>>> kamailio.cfg script.
> >>>>
> >>>> 2. Writeup e.g. a PERL wrapper for your encryption / decryption C/C++
> >>>> code and call it using kamailio app_perl module within event_route [
> >>>> network:msg ] as demonstrated in this example,
> >>>>
> >>>> http://kamailio.org/docs/modules/devel/modules/corex.html#idp125704
> >>>>
> >>>> You can also use any other kamailio language bind of you choice as
> >>>> well, e.g. Python, LUA, JAVA and so on.
> >>>>
> >>>> I would recommend the second option, as it has less processing
> >>>> overhead for kamailio.
> >>>>
> >>>> Thank you.
> >>>>
> >>>>
> >>>>
> >>>> On Tue, Sep 16, 2014 at 6:09 PM, Rahul MathuR <
> >>>> rahul.ultimate(a)gmail.com> wrote:
> >>>>
> >>>>> Hello,
> >>>>>
> >>>>> I was going through the new features and stumbled upon this new one
> >>>>> - developed by Mohd. Shahzad Shafi.
> >>>>> As already mentioned on the wiki about this module, I intend to use
> it
> >>>>> for my custom security layer between UACs and SIP Proxy (Kamailio)
> but the
> >>>>> issue is - the custom security layer (encryption/decryption code) is
> >>>>> written in C and should precisely be applied for the messages
> between UAC
> >>>>> and Proxy.
> >>>>>
> >>>>> Is there a way I can achieve this using Corex module since it does
> >>>>> intercept the network I/O messages ?
> >>>>>
> >>>>> Any help here would be really appreciated.
> >>>>>
> >>>>> --
> >>>>> Warm Regds.
> >>>>> MathuRahul
> >>>>>
> >>>>> _______________________________________________
> >>>>> sr-dev mailing list
> >>>>> sr-dev(a)lists.sip-router.org
> >>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> >>>>>
> >>>>>
> >>>>
> >>>> _______________________________________________
> >>>> sr-dev mailing list
> >>>> sr-dev(a)lists.sip-router.org
> >>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> >>>>
> >>>>
> >>>
> >>>
> >>> --
> >>> Warm Regds.
> >>> MathuRahul
> >>>
> >>
> >>
> >>
> >> --
> >> Warm Regds.
> >> MathuRahul
> >>
> >>
> >> _______________________________________________
> >> sr-dev mailing listsr-dev@lists.sip-router.orghttp://
> lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> >>
> >>
> >> --
> >> Daniel-Constantin Mierlahttp://twitter.com/#!/miconda -
> http://www.linkedin.com/in/miconda
> >> Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
> >> Sep 22-25, Berlin, Germany
> >>
> >>
> >> _______________________________________________
> >> sr-dev mailing list
> >> sr-dev(a)lists.sip-router.org
> >> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> >>
> >>
> >
> >
> > --
> > Warm Regds.
> > MathuRahul
> >
> > _______________________________________________
> > sr-dev mailing list
> > sr-dev(a)lists.sip-router.org
> > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> >
> >
>