[SR-Users] Problem with resuming suspended transactions.

Dmytro Bogovych dmytro.bogovych at gmail.com
Mon Nov 23 20:58:07 CET 2015


Now I see another problem. Seems it affects 4.1.2 - 4.3.3 versions at least.

This part of script resumes suspended transactions:

route[JOININVITE] {
    $var(hjoin) = 0;<------><------>
    lock("$tU");
    $var(hjoin) = $sht(vtp=>join::$tU);
    $sht(vtp=>join::$tU) = $null;
    unlock("$tU");
    if($var(hjoin)==0)
    {
         xlog("L_INFO","No suspended transactions for $tU account\n");
         return;
    }
   # Restore suspended transaction
   $var(id_index) = $(var(hjoin){s.select,0,:}{s.int});
   $var(id_label) = $(var(hjoin){s.select,1,:}{s.int});
   xlog("L_INFO","resuming trasaction [$var(id_index):$var(id_label)]
$tU ($var(hjoin))\n");
   $var(rr_proto) = $proto;
   $var(rr_ip) = $si;
   $var(rr_port) = $sp;
   $var(rr_target) = $proto  + ":" + $si + ":" + $sp;
   t_continue("$var(id_index)", "$var(id_label)", "RELAYRESUMED");
}

Kamailio runs on internal IPs. Public IP are advertised in configuration file.
fix_nated_contact() is used to help routing - most of softphones run
behind the NAT.
Everything works fine except the case with push notifications i.e.
transaction suspend and resume sequence ( I think so ).

In these cases fix_nated_contact() rewrites the IP addresses to
internal IP only. It does not see (or lost) external source address.

So after a push notification resumed call BYE is sent to the some
internal IP (therefore call is not terminated) and also reINVITEs +
ACK do not work as expected.

I would be happy to hear any idea how to resolve it from server side...

Thank you!


On Mon, Nov 23, 2015 at 7:01 PM, Dmytro Bogovych
<dmytro.bogovych at gmail.com> wrote:
> (facepalm)
>
> Thank you!
>
>
> On Mon, Nov 23, 2015 at 6:39 PM, Daniel-Constantin Mierla
> <miconda at gmail.com> wrote:
>> Hello,
>>
>> probably you want the next snippet:
>>
>>                 if (!t_relay())
>>                         xlog("L_INFO","Cannot relay PUSHED invite.");
>>                         sl_reply_error();
>>
>>
>> to be:
>>
>>                 if (!t_relay()) {
>>                         xlog("L_INFO","Cannot relay PUSHED invite.");
>>                         sl_reply_error();
>>                 }
>>
>>
>> Because you don't have curly braces for the IF block, only the xlog is
>> executed in case of error. sl_reply_error() is executed always.
>>
>> Cheers,
>> Daniel
>>
>> On 23/11/15 17:29, Dmytro Bogovych wrote:
>>> Greetings.
>>>
>>> We build specialized softphone for iOS. Push notifications are used to
>>> notify user and wake up softphone app on missed calls and messages.
>>>
>>> We used Daniel's example config script as base for own configuration
>>> file. It has the same parts and does not differ too much. I talk about
>>> this example: http://www.kamailio.org/events/2014-KamailioWorld/day2/26-Daniel-Constantin.Mierla-Kamailio.cfg-Async.pdf
>>>
>>> Everything was ok for few monthes - with kamailio 4.1.2.
>>> Few weeks ago we upgraded to 4.3.3.
>>> Now paused calls cannot be resumed properly.
>>>
>>> Softphone receives 500 Server error (No error 0/SL) in response
>>>
>>> This is problem part of script:
>>>
>>> route[RELAYRESUMED] {
>>>
>>>         # enable additional event routes for forwarded requests
>>>         # - serial forking, RTP relaying handling, a.s.o.
>>>         if (is_method("INVITE|SUBSCRIBE")) {
>>>                 t_on_branch("MANAGE_BRANCH");
>>>                 t_on_reply("MANAGE_REPLY");
>>>         }
>>>         if (is_method("INVITE")) {
>>>                 t_on_failure("MANAGE_FAILURE");
>>>         }
>>>         if ($var(rr_target) != "")
>>>         {
>>>                 xlog("L_INFO","Relay to $var(rr_ip):$var(rr_port)\n");
>>>                 $ru = "sip:" + $rU + "@" + $var(rr_ip) + ":" +
>>> $var(rr_port) + ";transport=" + $var(rr_proto);
>>>                 xlog("L_INFO","Current request URI is $ru\n");
>>>                 if (!t_relay())
>>>                         xlog("L_INFO","Cannot relay PUSHED invite.");
>>>                         sl_reply_error();
>>>         }
>>>         else
>>>         {
>>>                 xlog("L_WARN","Target proto is not set\n");
>>>                 sl_reply_error();
>>>         }
>>>         exit;
>>> }
>>>
>>> It produces log
>>> -----
>>> Nov 23 14:42:24 ctdsip3 /usr/local/sbin/kamailio[32141]: INFO:
>>> <script>: resuming trasaction [23927:345343979] 1985987629
>>> (23927:345343979)
>>>
>>> Nov 23 14:42:24 ctdsip3 /usr/local/sbin/kamailio[32141]: INFO:
>>> <script>: Relay to 95.133.110.17:11791
>>>
>>> Nov 23 14:42:24 ctdsip3 /usr/local/sbin/kamailio[32141]: INFO:
>>> <script>: Current request URI is
>>> sip:1985987629 at 95.133.110.17:11791;transport=tls
>>>
>>> Nov 23 14:42:24 ctdsip3 /usr/local/sbin/kamailio[32141]: ERROR: sl
>>> [sl_funcs.c:363]: sl_reply_error(): ERROR: sl_reply_error used: No
>>> error (0/SL)
>>>
>>> Nov 23 14:42:24 ctdsip3 /usr/local/sbin/kamailio[32141]: INFO:
>>> <script>: Checking FAILED messages for 1985987629: 0
>>> -----
>>>
>>> sl_reply_error() sends 500 with No error (0/SL) description. Later 180
>>> & 200 are sent.
>>>
>>> But client softphone terminates transaction already (as it handles 500
>>> response code) .
>>>
>>> There is no "Cannot relay PUSHED invite." message in the log however.
>>>
>>>
>>> I will be happy to heary any idea what can be cause...
>>>
>>> Thank you!
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>> sr-users at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>> --
>> Daniel-Constantin Mierla
>> http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>> Book: SIP Routing With Kamailio - http://www.asipto.com
>> Kamailio Advanced Training, Nov 30-Dec 2, Berlin - http://asipto.com/kat
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



More information about the sr-users mailing list