[SR-Users] Kamailio v4.0.2, iPhone, TCP connection and PJLIB

Roberto Fichera kernel at tekno-soft.it
Tue Aug 13 15:15:07 CEST 2013


On 08/13/2013 02:33 PM, Daniel-Constantin Mierla wrote:
> Hello,
>
> On 8/13/13 1:10 PM, Roberto Fichera wrote:
>> On 08/13/2013 12:03 PM, Daniel-Constantin Mierla wrote:
>>> Hello,
>>>
>>> you should grab the ngrep for such call to understand better what happens. Also, dumping the location records will be
>>> useful (kamctl ul show).
>>>
>>> Also, be sure that tcp connection lifetime is long enough to survive re-registration. To avoid trying to open
>>> connections behind nat, use set_forward_no_connect() for calls involving nat traversal.
>> I'm using the default conf coming from fedora rpm. So, mainly the problem seems related to kamailio
>> which doesn't reuse the TCP port used by NATed clients. I've also notice that the received
>> field isn't set at all, so this means that the contact will not get aliased at all.
>>
>> I would really like to have a look to a working cfg file for TCP NATed clients that reuse the TCP port.
>> Even better if the configuration is based on the fedora default rpm.
>
> if received is not set, then means the register was not detected as coming from behind nat. Is the phone using stun?

I'm testing with a normal rtpproxy configuration. BTW udp -> udp work perfectly.

>
> Again, put here the ngrep for registration and a call to see if something is wrong with signaling. There is no help
> that we can provide otherwise. The default config works fine for tcp and natted clients, I use it everywhere for this
> case without issues.

I tried the default cfg enabling both NAT and RTPproxy, but seems that kamailio doesn't reuse TCP ports.
Anyway, this is a call from UDP (512) -> TCP (526) both behind the same NAT, from kamailio point of view

[root at proxy ~]# kamctl ul show 526
Contact::
<sip:526 at 94.94.X.X:1238;transport=TCP;ob>;q=;expires=537;flags=0x0;cflags=0x40;state=0;socket=<tcp:178.79.x.x:5060>;methods=0x1FDF;received=<sip:94.94.X.X:61922;transport=TCP>;user_agent=<DICE
Smartphone 1.0/iPhone>;reg-id=0
[root at proxy ~]# kamctl ul show 512
Contact::
<sip:512 at 94.94.X.X:5060>;q=;expires=32;flags=0x0;cflags=0x40;state=0;socket=<udp:178.79.x.x:5060>;methods=0xFFFFFFFF;received=<sip:94.94.X.X:1025>;user_agent=<DICE
1.8.20.1>;reg-id=0
[root at proxy ~]#


U 94.94.X.X:1025 -> 178.79.x.x:5060
INVITE sip:526 at test.domain:5060 SIP/2.0.
Via: SIP/2.0/UDP 94.94.X.X:5060;branch=z9hG4bK4a420cee;rport.
Max-Forwards: 70.
From: "asterisk" <sip:512 at test.domain>;tag=as76007db0.
To: <sip:526 at test.domain:5060>.
Contact: <sip:512 at 94.94.X.X:5060>.
Call-ID: 068a5a23639785a7583d952d6f9bca84 at test.domain.
CSeq: 102 INVITE.
User-Agent: DICE 1.8.20.1.
Date: Tue, 13 Aug 2013 13:04:30 GMT.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH.
Supported: replaces, timer.
Content-Type: application/sdp.
Content-Length: 264.
.
v=0.
o=root 1263161426 1263161426 IN IP4 94.94.X.X.
s=Asterisk PBX 11.3.0.
c=IN IP4 94.94.X.X.
t=0 0.
m=audio 10782 RTP/AVP 0 110 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:110 speex/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-16.
a=ptime:20.
a=sendrecv.

#
U 178.79.x.x:5060 -> 94.94.X.X:1025
SIP/2.0 407 Proxy Authentication Required.
Via: SIP/2.0/UDP 94.94.X.X:5060;branch=z9hG4bK4a420cee;rport=1025.
From: "asterisk" <sip:512 at test.domain>;tag=as76007db0.
To: <sip:526 at test.domain:5060>;tag=333a0370df4a40d5d5a0c21bb156e2a6.4a00.
Call-ID: 068a5a23639785a7583d952d6f9bca84 at test.domain.
CSeq: 102 INVITE.
Proxy-Authenticate: Digest realm="test.domain", nonce="UgowYFIKLzQXDSUWUpy4xlhdXZ7WNjPt".
Server: kamailio (4.0.2 (x86_64/linux)).
Content-Length: 0.
.

#
U 94.94.X.X:1025 -> 178.79.x.x:5060
INVITE sip:526 at test.domain:5060 SIP/2.0.
Via: SIP/2.0/UDP 94.94.X.X:5060;branch=z9hG4bK4a420cee;rport.
Max-Forwards: 70.
From: "asterisk" <sip:512 at test.domain>;tag=as76007db0.
To: <sip:526 at test.domain:5060>.
Contact: <sip:512 at 94.94.X.X:5060>.
Call-ID: 068a5a23639785a7583d952d6f9bca84 at test.domain.
CSeq: 102 INVITE.
User-Agent: DICE 1.8.20.1.
Date: Tue, 13 Aug 2013 13:04:30 GMT.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH.
Supported: replaces, timer.
Content-Type: application/sdp.
Content-Length: 264.
.
v=0.
o=root 1263161426 1263161426 IN IP4 94.94.X.X.
s=Asterisk PBX 11.3.0.
c=IN IP4 94.94.X.X.
t=0 0.
m=audio 10782 RTP/AVP 0 110 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:110 speex/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-16.
a=ptime:20.
a=sendrecv.

#
U 178.79.x.x:5060 -> 94.94.X.X:1025
SIP/2.0 407 Proxy Authentication Required.
Via: SIP/2.0/UDP 94.94.X.X:5060;branch=z9hG4bK4a420cee;rport=1025.
From: "asterisk" <sip:512 at test.domain>;tag=as76007db0.
To: <sip:526 at test.domain:5060>;tag=333a0370df4a40d5d5a0c21bb156e2a6.4a00.
Call-ID: 068a5a23639785a7583d952d6f9bca84 at test.domain.
CSeq: 102 INVITE.
Proxy-Authenticate: Digest realm="test.domain", nonce="UgowYFIKLzQXDSUWUpy4xlhdXZ7WNjPt".
Server: kamailio (4.0.2 (x86_64/linux)).
Content-Length: 0.
.

#
U 94.94.X.X:1025 -> 178.79.x.x:5060
ACK sip:526 at test.domain:5060 SIP/2.0.
Via: SIP/2.0/UDP 94.94.X.X:5060;branch=z9hG4bK4a420cee;rport.
Max-Forwards: 70.
From: "asterisk" <sip:512 at test.domain>;tag=as76007db0.
To: <sip:526 at test.domain:5060>;tag=333a0370df4a40d5d5a0c21bb156e2a6.4a00.
Contact: <sip:512 at 94.94.X.X:5060>.
Call-ID: 068a5a23639785a7583d952d6f9bca84 at test.domain.
CSeq: 102 ACK.
User-Agent: DICE 1.8.20.1.
Content-Length: 0.
.

#
U 94.94.X.X:1025 -> 178.79.x.x:5060
ACK sip:526 at test.domain:5060 SIP/2.0.
Via: SIP/2.0/UDP 94.94.X.X:5060;branch=z9hG4bK4a420cee;rport.
Max-Forwards: 70.
From: "asterisk" <sip:512 at test.domain>;tag=as76007db0.
To: <sip:526 at test.domain:5060>.
Contact: <sip:512 at 94.94.X.X:5060>.
Call-ID: 068a5a23639785a7583d952d6f9bca84 at test.domain.
CSeq: 102 ACK.
User-Agent: DICE 1.8.20.1.
Content-Length: 0.
.

#
T 178.79.x.x:5060 -> 94.94.X.X:61922 [AP]
ACK sip:526 at 94.94.X.X:1238;transport=TCP;ob SIP/2.0.
Via: SIP/2.0/TCP 178.79.x.x;branch=z9hG4bKcydzigwkX.
Via: SIP/2.0/UDP 94.94.X.X:5060;branch=z9hG4bK4a420cee;rport=1025.
Max-Forwards: 16.
From: "asterisk" <sip:512 at test.domain>;tag=as76007db0.
To: <sip:526 at test.domain:5060>.
Contact: <sip:512 at 94.94.X.X:1025>.
Call-ID: 068a5a23639785a7583d952d6f9bca84 at test.domain.
CSeq: 102 ACK.
User-Agent: DICE 1.8.20.1.
Content-Length: 0.
.

#
T 178.79.x.x:5060 -> 94.94.X.X:61922 [AP]
ACK sip:526 at 94.94.X.X:1238;transport=TCP;ob SIP/2.0.
Via: SIP/2.0/TCP 178.79.x.x;branch=z9hG4bKcydzigwkX.
Via: SIP/2.0/UDP 94.94.X.X:5060;branch=z9hG4bK4a420cee;rport=1025.
Max-Forwards: 16.
From: "asterisk" <sip:512 at test.domain>;tag=as76007db0.
To: <sip:526 at test.domain:5060>.
Contact: <sip:512 at 94.94.X.X:1025>.
Call-ID: 068a5a23639785a7583d952d6f9bca84 at test.domain.
CSeq: 102 ACK.
User-Agent: DICE 1.8.20.1.
Content-Length: 0.
.


>
> Cheers,
> Daniel
>>
>> Cheers,
>> Roberto Fichera.
>>
>>> Cheers,
>>> Daniel
>>>
>>> On 7/30/13 6:44 PM, Roberto Fichera wrote:
>>>> Hi All,
>>>>
>>>> Sorry for cross-posting this email to PJLIB, but maybe there are some things related.
>>>> Anyhow! I'm having problems on kamailio v4.0.2 under Fedora 18 64bit and TCP client like iPhone using PJSIP as SIP
>>>> library.
>>>> Basically once the iPhone side in close the call (TCP->UDP) I'm getting the error below. Kamailio is running under
>>>> a VPS
>>>> without
>>>> NATed network so it uses a real public address. Furthermore, note that tcp_main is answering to a 192.168.2.98 ip
>>>> address
>>>> which is the iPhone client. This looks really strange to me since it should answer directly to the public/port used
>>>> for
>>>> the registration
>>>> and not to a such kind of reserved address. The kamilio configuration is basically the default with a very few changes
>>>> like NAT, rtpproxy and postgresql backend.
>>>>
>>>> This problems doesn't happen at all when using UDP->UDP calls. But I cannot use it because as you certain know UDP
>>>> connection under iPhone will not work when the application run in background mode.
>>>>
>>>> Can someone suggest how to solve this issue or maybe suggest a TCP working solution for iPhone?
>>>>
>>>> Thanks in advance.
>>>> Roberto Fichera.
>>>>
>>>> Jul 30 16:21:53 proxy /usr/sbin/kamailio[9502]: ERROR: <core> [tcp_main.c:4432]: tcpconn_main_timeout(): connect
>>>> 192.168.2.98:5060 failed (timeout)
>>>> Jul 30 16:21:55 proxy rtpproxy[2262]: DBUG:get_command: received command "9483_9 D
>>>> 12d1d19926c4ff742a52f0c855b1bb83 at 94.94.x.x:5060 as74e0c388 GROahimCK6KTrl5CkYEg7nuoPIIXZ8cj"
>>>> Jul 30 16:21:55 proxy rtpproxy[2262]: INFO:handle_delete: forcefully deleting session 1 on ports 15604/17354
>>>> Jul 30 16:21:55 proxy rtpproxy[2262]: INFO:remove_session: RTP stats: 354 in from callee, 603 in from caller, 957
>>>> relayed, 0 dropped
>>>> Jul 30 16:21:55 proxy rtpproxy[2262]: INFO:remove_session: RTCP stats: 5 in from callee, 2 in from caller, 7
>>>> relayed, 0
>>>> dropped
>>>> Jul 30 16:21:55 proxy rtpproxy[2262]: INFO:remove_session: session on ports 15604/17354 is cleaned up
>>>> Jul 30 16:21:55 proxy rtpproxy[2262]: DBUG:doreply: sending reply "9483_9 0
>>>> Jul 30 16:21:55 proxy rtpproxy[2262]: "
>>>> Jul 30 16:22:04 proxy /usr/sbin/kamailio[9502]: ERROR: <core> [tcp_main.c:4432]: tcpconn_main_timeout(): connect
>>>> 192.168.2.98:5060 failed (timeout)
>>>> Jul 30 16:22:14 proxy rtpproxy[2262]: DBUG:get_command: received command "9496_16 D
>>>> 12d1d19926c4ff742a52f0c855b1bb83 at 94.94.x.x:5060 GROahimCK6KTrl5CkYEg7nuoPIIXZ8cj as74e0c388"
>>>> Jul 30 16:22:14 proxy rtpproxy[2262]: INFO:handle_command: delete request failed: session
>>>> 12d1d19926c4ff742a52f0c855b1bb83 at 94.94.x.x:5060, tags GROahimCK6KTrl5CkYEg7nuoPIIXZ8cj/as74e0c388 not found
>>>> Jul 30 16:22:14 proxy rtpproxy[2262]: DBUG:doreply: sending reply "9496_16 E8
>>>> Jul 30 16:22:14 proxy rtpproxy[2262]: "
>>>>
>>>>
>>>> _______________________________________________
>>>> 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