osip-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: eXosip_event_wait needs to call twice for the OK response


From: Aymeric Moizard
Subject: Re: eXosip_event_wait needs to call twice for the OK response
Date: Wed, 23 Jun 2021 14:35:20 +0200

Hi Mostafa & osip-dev list!

The bug seems related to the latest epoll implementation introduced in 2020
which is now automatically used on linux platform.

The select implementation is not affected.

The first line in  eXosip_event_wait_epoll is wrong (the timeout should have been 0 instead of the
"tv_s * 1000 + tv_ms") as the wait operation should happen during the second call to epoll_wait (a
few lines after). Then, using  eXosip_event_wait, many SIP messages are received with an extra delay
or received only upon the next  eXosip_event_wait call. It's not only 200, but also all other incoming
messages.

The patch (see the commit URL from git below) is fixing the issue.

With lower values of tv_s and tv_ms, the bug was affecting runtime, but not more than "tv_ms" delay.

SIDENOTE: THIS IS WRONG:
      // Send back ack response message
      eXosip_call_build_ack(ctx, je->did, &ack);

      eXosip_lock(ctx);
      eXosip_call_send_ack(ctx, je->did, ack);
      eXosip_unlock(ctx);
AND MUST BE:
      // Send back ack response message
      eXosip_lock(ctx);
      eXosip_call_build_ack(ctx, je->did, &ack);
      eXosip_call_send_ack(ctx, je->did, ack);
      eXosip_unlock(ctx);

PATCH IS HERE:

https://git.savannah.nongnu.org/cgit/exosip.git/commit/?id=13121df2c9aa121f3435530ff6b07e2ea2f777db

Thanks a lot for the report and test code.
Regards
Aymeric






Le mer. 23 juin 2021 à 12:41, Aymeric Moizard <amoizard@gmail.com> a écrit :
Hi

Sorry for delay.

I just compiled the code and see apparently the same.

I will investigate and should come up with a solution today 

Regards
Aymeric


Le mer. 16 juin 2021 à 12:53, Mostafa Farzane <farzanemostafa@gmail.com> a écrit :
Hi Aymeric,

Thanks for the reply,
 
exosip_event_wait will return null after timeout (5 second in your case), so if the 200 ok is coming later, that is expected.
 I think it is not the case here. Because I can see the OK message with Wireshark. Even if I set the timeout to 10 or more, it does not capture the OK response the first time.

Can you please attach the log?
Here it is:

eXosip_init successfully!
| INFO1 | 2021-06-16 15:13:04.5355 < eXutils.c: 1440> [eXosip] [getaddrinfo] =  [0.0.0.0][15060]
| INFO2 | 2021-06-16 15:13:04.5357 <  eXconf.c:  920> [eXosip] reseting timer to 10s before waking up
| INFO2 | 2021-06-16 15:13:04.5361 <osip_trans:  143> allocating transaction resource 1 1600967078
| INFO2 | 2021-06-16 15:13:04.5362 <     ict.c:   30> allocating ICT context
| INFO2 | 2021-06-16 15:13:04.5364 < eXutils.c: 3143> [eXosip] [NAPTR LOOKUP] about to ask for [webex.com NAPTR]
| INFO2 | 2021-06-16 15:13:04.8592 < eXutils.c: 2408> [eXosip] [NAPTR callback] [webex.com] [Successful completion] [but missing NAPTR data]
| INFO2 | 2021-06-16 15:13:04.8593 < eXutils.c: 2441> [eXosip] [NAPTR callback] no NAPTR answer // SRV record created manually -> [49][49][_sips._udp.webex.com]
| INFO2 | 2021-06-16 15:13:04.8596 < eXutils.c: 3029> [eXosip] [SRV LOOKUP] about to ask for [_sip._udp.webex.com SRV]
| INFO2 | 2021-06-16 15:13:04.8596 < eXutils.c: 3034> [eXosip] [SRV LOOKUP] about to ask for [_sip._tcp.webex.com SRV]
| INFO2 | 2021-06-16 15:13:04.8597 < eXutils.c: 3039> [eXosip] [SRV LOOKUP] about to ask for [_sips._tcp.webex.com SRV]
| INFO2 | 2021-06-16 15:13:04.8597 < eXutils.c: 3044> [eXosip] [SRV LOOKUP] about to ask for [_sips._udp.webex.com SRV]
| INFO2 | 2021-06-16 15:13:05.1641 < eXutils.c: 1918> [eXosip] [save_SRV record] [_sip._tcp.webex.com] IN SRV -> [ecccppr1.amer.pub.webex.com][5060][50][100][238336]
| INFO2 | 2021-06-16 15:13:05.1641 < eXutils.c: 1918> [eXosip] [save_SRV record] [_sip._tcp.webex.com] IN SRV -> [ecccpsc3.amer.pub.webex.com][5060][70][100][885387]
| INFO2 | 2021-06-16 15:13:05.1642 < eXutils.c: 1918> [eXosip] [save_SRV record] [_sip._tcp.webex.com] IN SRV -> [ecccpsc2.amer.pub.webex.com][5060][70][100][760493]
| INFO2 | 2021-06-16 15:13:05.1642 < eXutils.c: 1918> [eXosip] [save_SRV record] [_sip._tcp.webex.com] IN SRV -> [ecccpsc1.amer.pub.webex.com][5060][70][100][516650]
| INFO2 | 2021-06-16 15:13:05.1642 < eXutils.c: 1918> [eXosip] [save_SRV record] [_sip._tcp.webex.com] IN SRV -> [ecccppr3.amer.pub.webex.com][5060][50][100][641422]
| INFO2 | 2021-06-16 15:13:05.1642 < eXutils.c: 1918> [eXosip] [save_SRV record] [_sip._tcp.webex.com] IN SRV -> [ecccppr2.amer.pub.webex.com][5060][50][100][202363]
| INFO2 | 2021-06-16 15:13:05.1643 < eXutils.c: 1918> [eXosip] [save_SRV record] [_sips._tcp.webex.com] IN SRV -> [ecccppr2.amer.pub.webex.com][5061][10][100][490028]
| INFO2 | 2021-06-16 15:13:05.1643 < eXutils.c: 1918> [eXosip] [save_SRV record] [_sips._tcp.webex.com] IN SRV -> [ecccppr1.amer.pub.webex.com][5061][10][100][368691]
| INFO2 | 2021-06-16 15:13:05.1644 < eXutils.c: 1918> [eXosip] [save_SRV record] [_sips._tcp.webex.com] IN SRV -> [ecccpsc3.amer.pub.webex.com][5061][20][100][520060]
| INFO2 | 2021-06-16 15:13:05.1645 < eXutils.c: 1918> [eXosip] [save_SRV record] [_sips._tcp.webex.com] IN SRV -> [ecccpsc2.amer.pub.webex.com][5061][20][100][897764]
| INFO2 | 2021-06-16 15:13:05.1645 < eXutils.c: 1918> [eXosip] [save_SRV record] [_sips._tcp.webex.com] IN SRV -> [ecccpsc1.amer.pub.webex.com][5061][20][100][513927]
| INFO2 | 2021-06-16 15:13:05.1645 < eXutils.c: 1918> [eXosip] [save_SRV record] [_sips._tcp.webex.com] IN SRV -> [ecccppr3.amer.pub.webex.com][5061][10][100][180541]
|WARNING| 2021-06-16 15:13:05.1833 < eXutils.c: 2146> [eXosip] [DNS SRV record] [webex.com] [Domain name not found]
|WARNING| 2021-06-16 15:13:05.1839 < eXutils.c: 2146> [eXosip] [DNS SRV record] [webex.com] [Domain name not found]
| INFO1 | 2021-06-16 15:13:05.4921 < eXutils.c: 1440> [eXosip] [getaddrinfo] dns [ecccppr1.amer.pub.webex.com][5060] =  [209.197.207.52][5060]
| INFO1 | 2021-06-16 15:13:05.4922 <eXtl_tcp.c: 1020> [eXosip] [TCP] [new] new binding with [209.197.207.52][5060]
| INFO2 | 2021-06-16 15:13:05.4923 <eXtl_tcp.c: 1279> [eXosip] [TCP] [new] socket [ecccppr1.amer.pub.webex.com] [sock=10] family:2
| INFO2 | 2021-06-16 15:13:05.4925 <eXtl_tcp.c: 1301> [eXosip] [TCP] [new] socket [ecccppr1.amer.pub.webex.com] [sock=10] [pos=0] family:2, in progress
| INFO2 | 2021-06-16 15:13:05.4925 <eXtl_tcp.c: 1375> [eXosip] [TCP] [new] outgoing socket created on port [54864]
| INFO2 | 2021-06-16 15:13:05.4926 <eXtl_tcp.c: 1846> [eXosip] [TCP] [tid=1] socket [ecccppr1.amer.pub.webex.com] [sock=10] [pos=0] in progress
| INFO1 | 2021-06-16 15:13:05.8560 <eXtl_tcp.c: 1761> [eXosip] [TCP] [tid=1] reusing REQUEST connection to [209.197.207.52][5060]
| INFO2 | 2021-06-16 15:13:05.8562 <eXtl_tcp.c: 1889> [eXosip] [TCP] [tid=1] socket [ecccppr1.amer.pub.webex.com] [sock=10] [pos=0] connected
| INFO1 | 2021-06-16 15:13:05.8563 <jrequest.c: 1080> [eXosip] updating: Via header to [192.168.255.14][54864]
| INFO1 | 2021-06-16 15:13:05.8563 <jrequest.c: 1169> [eXosip] updating: Contact header to [192.168.255.14][54864]
| INFO1 | 2021-06-16 15:13:05.8565 <eXtl_tcp.c: 1950> [eXosip] [TCP] [tid=1] message sent [len=829] to [ecccppr1.amer.pub.webex.com][5060]
INVITE sip:MEETINGID@webex.com SIP/2.0
Via: SIP/2.0/TCP 192.168.255.14:54864;rport;branch=z9hG4bK1119057346
From: <sip:mosi@192.168.0.115>;tag=86202233
To: <sip:MEETINGID@webex.com>
Call-ID: 1600967078
CSeq: 20 INVITE
Contact: <sip:mosi@192.168.255.14:54864;transport=TCP>
Content-Type: application/sdp
Max-Forwards: 70
User-Agent: eXosip/5.2.1
Subject: This is a call for a conversation
Content-Length:   385

v=0
o=- 1491669071 1491669071 IN IP4 192.168.0.115
s=Asterisk
c=IN IP4 192.168.0.115
t=0 0
m=audio 1234 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
m=video 1235 RTP/AVPF 100 99
a=rtpmap:100 VP8/90000
a=rtpmap:99 H264/90000
a=fmtp:99 profile-level-id=42801F
a=rtcp-fb:99 ccm fir
a=sendrecv

| INFO1 | 2021-06-16 15:13:05.8567 <jcallback.: 1706> [eXosip] [tid=1] [cb_sndreq_retransmission]
| INFO2 | 2021-06-16 15:13:05.8567 <  eXconf.c:  920> [eXosip] reseting timer to 10s before waking up
| INFO2 | 2021-06-16 15:13:05.8569 <  eXconf.c:  920> [eXosip] reseting timer to 10s before waking up
| INFO1 | 2021-06-16 15:13:06.2308 <eXtl_tcp.c:  577> [eXosip] [TCP] socket [209.197.207.52][5060] read 327 bytes
| INFO1 | 2021-06-16 15:13:06.2309 <     udp.c: 1679> [eXosip] received message [len=327] from [209.197.207.52][5060]
SIP/2.0 100 Trying
Via: SIP/2.0/TCP 192.168.255.14:54864;branch=z9hG4bK1119057346;rport=54864
To: <sip:MEETINGID@webex.com>
From: <sip:mosi@192.168.0.115>;tag=86202233
Call-ID: 1600967078
CSeq: 20 INVITE
Session-ID: 00000000000000000000000000000000;remote=1f8f6f682e413cddb9e7897fada5903b
Content-Length: 0


| INFO2 | 2021-06-16 15:13:06.2312 <  eXconf.c:  920> [eXosip] reseting timer to 10s before waking up
| INFO2 | 2021-06-16 15:13:06.2313 <  eXconf.c:  920> [eXosip] reseting timer to 10s before waking up
| INFO1 | 2021-06-16 15:13:06.8009 <eXtl_tcp.c:  577> [eXosip] [TCP] socket [209.197.207.52][5060] read 656 bytes
| INFO1 | 2021-06-16 15:13:06.8011 <     udp.c: 1679> [eXosip] received message [len=656] from [209.197.207.52][5060]
SIP/2.0 180 Ringing
Via: SIP/2.0/TCP 192.168.255.14:54864;branch=z9hG4bK1119057346;rport=54864
Record-Route: <sip:l2sip-aore-03.wbx2.com:5062;transport=tls;lr>
Record-Route: <sip:rr$n=net_me_tls_l2sip@209.197.207.52:5060;transport=tcp;lr;bypassvcs=true>
To: <sip:MEETINGID@webex.com>;tag=226624891
From: <sip:mosi@192.168.0.115>;tag=86202233
Call-ID: 1600967078
CSeq: 20 INVITE
Content-Length: 0
Session-ID: 9fb6bb422c5a2a7b9a32b5a829636394;remote=1f8f6f682e413cddb9e7897fada5903b
Locus: 184d96d5-757a-3279-b289-16d139e9e35c
Locus-SessionId: 9fb6bb42-2c5a-2a7b-9a32-b5a829636394
Locus-Type: MEETING
WebexMeetingNumber: MEETINGID


| INFO2 | 2021-06-16 15:13:06.8016 <eXtl_tcp.c: 2300> [eXosip] [TCP] [check] socket info:[209.197.207.52][5060] [sock=10] [pos=0] connected
|WARNING| 2021-06-16 15:13:06.8017 <osip_dialo:  446> Remote UA is not compliant: missing a contact in remote message!
| INFO2 | 2021-06-16 15:13:06.8018 <  eXconf.c:  920> [eXosip] reseting timer to 10s before waking up
proceeding!
ringing!
call_id is 1,dialog_id is 2
| INFO1 | 2021-06-16 15:13:06.8577 <eXtl_tcp.c:  577> [eXosip] [TCP] socket [209.197.207.52][5060] read 1346 bytes
| INFO2 | 2021-06-16 15:13:06.8585 <eXtl_tcp.c: 2300> [eXosip] [TCP] [check] socket info:[209.197.207.52][5060] [sock=10] [pos=0] connected
| INFO2 | 2021-06-16 15:13:06.8588 <  eXconf.c:  920> [eXosip] reseting timer to 10s before waking up
| INFO1 | 2021-06-16 15:13:06.8591 <eXtl_tcp.c:  577> [eXosip] [TCP] socket [209.197.207.52][5060] read 68 bytes
| INFO1 | 2021-06-16 15:13:06.8592 <     udp.c: 1679> [eXosip] received message [len=1414] from [209.197.207.52][5060]
SIP/2.0 200 OK
Via: SIP/2.0/TCP 192.168.255.14:54864;branch=z9hG4bK1119057346;rport=54864
Record-Route: <sip:l2sip-aore-03.wbx2.com:5062;transport=tls;lr>
Record-Route: <sip:rr$n=net_me_tls_l2sip@209.197.207.52:5060;transport=tcp;lr;bypassvcs=true>
To: <sip:MEETINGID@webex.com>;tag=226624891
From: <sip:mosi@192.168.0.115>;tag=86202233
Contact: <sip:l2sip-UA@l2sip-aore-03.wbx2.com:5062;transport=tls>;isfocus
Call-ID: 1600967078
CSeq: 20 INVITE
Content-Length: 498
Session-ID: 9fb6bb422c5a2a7b9a32b5a829636394;remote=1f8f6f682e413cddb9e7897fada5903b
Locus: 184d96d5-757a-3279-b289-16d139e9e35c
Locus-SessionId: 9fb6bb42-2c5a-2a7b-9a32-b5a829636394
Locus-Type: MEETING
WebexMeetingNumber: MEETINGID
User-Agent: Cisco-L2SIP
Accept: application/sdp
Allow: INVITE,ACK,CANCEL,BYE,REFER,INFO,OPTIONS,NOTIFY,SUBSCRIBE
Allow-Events: kpml
Supported: replaces
Content-Type: application/sdp

v=0
o=Calliope 44614916 0 IN IP4 170.72.149.93
s=-
i=MediaEngine
c=IN IP4 170.72.149.93
b=TIAS:6756000
t=0 0
m=audio 49644 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000/1
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=content:main
a=label:0
m=video 55268 RTP/AVPF 99
b=TIAS:2500000
a=rtpmap:99 H264/90000
a=fmtp:99 profile-level-id=42e014;max-mbps=108000;max-fs=3600;max-br=2500;max-fps=3000;max-dpb=5400;max-rcmd-nalu-size=196608
a=rtcp-fb:* ccm fir
a=sendrecv
a=label:1

| INFO2 | 2021-06-16 15:13:06.8606 <eXtl_tcp.c: 2300> [eXosip] [TCP] [check] socket info:[209.197.207.52][5060] [sock=10] [pos=0] connected
| INFO1 | 2021-06-16 15:13:06.8612 <jcallback.:  255> [eXosip] [tid=1] [cb_nict_kill_transaction]
| INFO2 | 2021-06-16 15:13:06.8613 <  eXconf.c:  920> [eXosip] reseting timer to 10s before waking up
| INFO1 | 2021-06-16 15:13:07.3589 <eXtl_tcp.c:  577> [eXosip] [TCP] socket [209.197.207.52][5060] read 1414 bytes
| INFO1 | 2021-06-16 15:13:07.3591 <     udp.c: 1679> [eXosip] received message [len=1414] from [209.197.207.52][5060]
SIP/2.0 200 OK
Via: SIP/2.0/TCP 192.168.255.14:54864;branch=z9hG4bK1119057346;rport=54864
Record-Route: <sip:l2sip-aore-03.wbx2.com:5062;transport=tls;lr>
Record-Route: <sip:rr$n=net_me_tls_l2sip@209.197.207.52:5060;transport=tcp;lr;bypassvcs=true>
To: <sip:MEETINGID@webex.com>;tag=226624891
From: <sip:mosi@192.168.0.115>;tag=86202233
Contact: <sip:l2sip-UA@l2sip-aore-03.wbx2.com:5062;transport=tls>;isfocus
Call-ID: 1600967078
CSeq: 20 INVITE
Content-Length: 498
Session-ID: 9fb6bb422c5a2a7b9a32b5a829636394;remote=1f8f6f682e413cddb9e7897fada5903b
Locus: 184d96d5-757a-3279-b289-16d139e9e35c
Locus-SessionId: 9fb6bb42-2c5a-2a7b-9a32-b5a829636394
Locus-Type: MEETING
WebexMeetingNumber: MEETINGID
User-Agent: Cisco-L2SIP
Accept: application/sdp
Allow: INVITE,ACK,CANCEL,BYE,REFER,INFO,OPTIONS,NOTIFY,SUBSCRIBE
Allow-Events: kpml
Supported: replaces
Content-Type: application/sdp

v=0
o=Calliope 44614916 0 IN IP4 170.72.149.93
s=-
i=MediaEngine
c=IN IP4 170.72.149.93
b=TIAS:6756000
t=0 0
m=audio 49644 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000/1
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=content:main
a=label:0
m=video 55268 RTP/AVPF 99
b=TIAS:2500000
a=rtpmap:99 H264/90000
a=fmtp:99 profile-level-id=42e014;max-mbps=108000;max-fs=3600;max-br=2500;max-fps=3000;max-dpb=5400;max-rcmd-nalu-size=196608
a=rtcp-fb:* ccm fir
a=sendrecv
a=label:1

| INFO1 | 2021-06-16 15:13:07.3597 <     udp.c: 1753> [eXosip] no transaction for message
| INFO1 | 2021-06-16 15:13:07.3597 <     udp.c: 1405> [eXosip] 2xx restransmission received for established dialog
| INFO1 | 2021-06-16 15:13:07.3598 <     udp.c: 1419> [eXosip] ACK for -old- restransmission not sent
| INFO2 | 2021-06-16 15:13:07.3599 <eXtl_tcp.c: 2300> [eXosip] [TCP] [check] socket info:[209.197.207.52][5060] [sock=10] [pos=0] connected
| INFO2 | 2021-06-16 15:13:07.3599 <  eXconf.c:  920> [eXosip] reseting timer to 10s before waking up
| INFO1 | 2021-06-16 15:13:08.3625 <eXtl_tcp.c:  577> [eXosip] [TCP] socket [209.197.207.52][5060] read 1414 bytes
| INFO1 | 2021-06-16 15:13:08.3626 <     udp.c: 1679> [eXosip] received message [len=1414] from [209.197.207.52][5060]
SIP/2.0 200 OK
Via: SIP/2.0/TCP 192.168.255.14:54864;branch=z9hG4bK1119057346;rport=54864
Record-Route: <sip:l2sip-aore-03.wbx2.com:5062;transport=tls;lr>
Record-Route: <sip:rr$n=net_me_tls_l2sip@209.197.207.52:5060;transport=tcp;lr;bypassvcs=true>
To: <sip:MEETINGID@webex.com>;tag=226624891
From: <sip:mosi@192.168.0.115>;tag=86202233
Contact: <sip:l2sip-UA@l2sip-aore-03.wbx2.com:5062;transport=tls>;isfocus
Call-ID: 1600967078
CSeq: 20 INVITE
Content-Length: 498
Session-ID: 9fb6bb422c5a2a7b9a32b5a829636394;remote=1f8f6f682e413cddb9e7897fada5903b
Locus: 184d96d5-757a-3279-b289-16d139e9e35c
Locus-SessionId: 9fb6bb42-2c5a-2a7b-9a32-b5a829636394
Locus-Type: MEETING
WebexMeetingNumber: MEETINGID
User-Agent: Cisco-L2SIP
Accept: application/sdp
Allow: INVITE,ACK,CANCEL,BYE,REFER,INFO,OPTIONS,NOTIFY,SUBSCRIBE
Allow-Events: kpml
Supported: replaces
Content-Type: application/sdp

v=0
o=Calliope 44614916 0 IN IP4 170.72.149.93
s=-
i=MediaEngine
c=IN IP4 170.72.149.93
b=TIAS:6756000
t=0 0
m=audio 49644 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000/1
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=content:main
a=label:0
m=video 55268 RTP/AVPF 99
b=TIAS:2500000
a=rtpmap:99 H264/90000
a=fmtp:99 profile-level-id=42e014;max-mbps=108000;max-fs=3600;max-br=2500;max-fps=3000;max-dpb=5400;max-rcmd-nalu-size=196608
a=rtcp-fb:* ccm fir
a=sendrecv
a=label:1

| INFO1 | 2021-06-16 15:13:08.3631 <     udp.c: 1753> [eXosip] no transaction for message
| INFO1 | 2021-06-16 15:13:08.3631 <     udp.c: 1405> [eXosip] 2xx restransmission received for established dialog
| INFO1 | 2021-06-16 15:13:08.3631 <     udp.c: 1419> [eXosip] ACK for -old- restransmission not sent
| INFO2 | 2021-06-16 15:13:08.3633 <eXtl_tcp.c: 2300> [eXosip] [TCP] [check] socket info:[209.197.207.52][5060] [sock=10] [pos=0] connected
| INFO2 | 2021-06-16 15:13:08.3633 <  eXconf.c:  920> [eXosip] reseting timer to 10s before waking up
| INFO1 | 2021-06-16 15:13:10.3574 <eXtl_tcp.c:  577> [eXosip] [TCP] socket [209.197.207.52][5060] read 1346 bytes
| INFO2 | 2021-06-16 15:13:10.3576 <eXtl_tcp.c: 2300> [eXosip] [TCP] [check] socket info:[209.197.207.52][5060] [sock=10] [pos=0] connected
| INFO2 | 2021-06-16 15:13:10.3576 <  eXconf.c:  920> [eXosip] reseting timer to 10s before waking up
| INFO1 | 2021-06-16 15:13:10.3577 <eXtl_tcp.c:  577> [eXosip] [TCP] socket [209.197.207.52][5060] read 68 bytes
| INFO1 | 2021-06-16 15:13:10.3577 <     udp.c: 1679> [eXosip] received message [len=1414] from [209.197.207.52][5060]
SIP/2.0 200 OK
Via: SIP/2.0/TCP 192.168.255.14:54864;branch=z9hG4bK1119057346;rport=54864
Record-Route: <sip:l2sip-aore-03.wbx2.com:5062;transport=tls;lr>
Record-Route: <sip:rr$n=net_me_tls_l2sip@209.197.207.52:5060;transport=tcp;lr;bypassvcs=true>
To: <sip:MEETINGID@webex.com>;tag=226624891
From: <sip:mosi@192.168.0.115>;tag=86202233
Contact: <sip:l2sip-UA@l2sip-aore-03.wbx2.com:5062;transport=tls>;isfocus
Call-ID: 1600967078
CSeq: 20 INVITE
Content-Length: 498
Session-ID: 9fb6bb422c5a2a7b9a32b5a829636394;remote=1f8f6f682e413cddb9e7897fada5903b
Locus: 184d96d5-757a-3279-b289-16d139e9e35c
Locus-SessionId: 9fb6bb42-2c5a-2a7b-9a32-b5a829636394
Locus-Type: MEETING
WebexMeetingNumber: MEETINGID
User-Agent: Cisco-L2SIP
Accept: application/sdp
Allow: INVITE,ACK,CANCEL,BYE,REFER,INFO,OPTIONS,NOTIFY,SUBSCRIBE
Allow-Events: kpml
Supported: replaces
Content-Type: application/sdp

v=0
o=Calliope 44614916 0 IN IP4 170.72.149.93
s=-
i=MediaEngine
c=IN IP4 170.72.149.93
b=TIAS:6756000
t=0 0
m=audio 49644 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000/1
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=content:main
a=label:0
m=video 55268 RTP/AVPF 99
b=TIAS:2500000
a=rtpmap:99 H264/90000
a=fmtp:99 profile-level-id=42e014;max-mbps=108000;max-fs=3600;max-br=2500;max-fps=3000;max-dpb=5400;max-rcmd-nalu-size=196608
a=rtcp-fb:* ccm fir
a=sendrecv
a=label:1

| INFO1 | 2021-06-16 15:13:10.3582 <     udp.c: 1753> [eXosip] no transaction for message
| INFO1 | 2021-06-16 15:13:10.3582 <     udp.c: 1405> [eXosip] 2xx restransmission received for established dialog
| INFO1 | 2021-06-16 15:13:10.3582 <     udp.c: 1419> [eXosip] ACK for -old- restransmission not sent
| INFO2 | 2021-06-16 15:13:10.3583 <eXtl_tcp.c: 2300> [eXosip] [TCP] [check] socket info:[209.197.207.52][5060] [sock=10] [pos=0] connected
| INFO2 | 2021-06-16 15:13:10.3584 <  eXconf.c:  920> [eXosip] reseting timer to 10s before waking up
No response or the time is over!
ok!connected!
*******1*********
170.72.149.93*******2*********
call_id is 1,dialog_id is 2
| INFO1 | 2021-06-16 15:13:11.8645 <eXtl_tcp.c: 1800> [eXosip] [TCP] [tid=-1] reusing connection to [209.197.207.52][5060]
| INFO2 | 2021-06-16 15:13:11.8646 <eXtl_tcp.c: 1889> [eXosip] [TCP] [tid=-1] socket [209.197.207.52] [sock=10] [pos=0] connected
| INFO1 | 2021-06-16 15:13:11.8646 <jrequest.c: 1080> [eXosip] updating: Via header to [192.168.255.14][54864]
| INFO1 | 2021-06-16 15:13:11.8646 <eXtl_tcp.c: 1950> [eXosip] [TCP] [tid=-1] message sent [len=541] to [209.197.207.52][5060]
ACK sip:l2sip-UA@l2sip-aore-03.wbx2.com:5062;transport=tls SIP/2.0
Via: SIP/2.0/TCP 192.168.255.14:54864;rport;branch=z9hG4bK1757256626
Route: <sip:rr$n=net_me_tls_l2sip@209.197.207.52:5060;transport=tcp;lr;bypassvcs=true>
Route: <sip:l2sip-aore-03.wbx2.com:5062;transport=tls;lr>
From: <sip:mosi@192.168.0.115>;tag=86202233
To: <sip:MEETINGID@webex.com>;tag=226624891
Call-ID: 1600967078
CSeq: 20 ACK
Contact: <sip:mosi@192.168.255.14:54864;transport=TCP>
Max-Forwards: 70
User-Agent: eXosip/5.2.1
Content-Length: 0


SLEEEP1
| INFO2 | 2021-06-16 15:13:11.8647 <  eXconf.c:  920> [eXosip] reseting timer to 10s before waking up
 

On Wed, Jun 16, 2021 at 1:20 PM Aymeric Moizard <amoizard@gmail.com> wrote:
Hi!

Can you please attach the log? (Also add my amoizard@gmail.com email if the list reject the large log)

exosip_event_wait will return null after timeout (5 second in your case), so if the 200 ok is coming later, that is expected.

Regards
Aymeric


Le mar. 15 juin 2021 à 18:30, Mostafa Farzane <farzanemostafa@gmail.com> a écrit :
I have the following code to call a Webex meeting. After sending an INVITE request, Webex replies with a TRYING, a RINGING, and an OK response.
I receive TRYING, and RINGING responses without any problem, But the problem is, for receiving the "OK" response, I have to call "eXosip_event_wait" twice. The first time it returns NULL and the second time It returns the OK response.

Any ideas?

#include <eXosip2/eXosip.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <netinet/in.h>
#include <unistd.h>
#include <string.h>

int main(int argc,char *argv[])
{
struct eXosip_t *context_eXosip;

eXosip_event_t *je;
osip_message_t *reg=NULL;
osip_message_t *invite=NULL;
osip_message_t *ack=NULL;
osip_message_t *message=NULL;

sdp_message_t *remote_sdp=NULL;
sdp_connection_t *remote_video_conn=NULL;
sdp_media_t *remote_video_media=NULL;

int call_id,dialog_id;
int i;
int flag1=1;

char tmp[4096];

// Initialize
//
struct eXosip_t *ctx;
TRACE_INITIALIZE (6, NULL);

ctx = eXosip_malloc();
if (ctx==NULL)
return -1;
i=eXosip_init(ctx);


if(i!=0)
{
printf("Couldn't initialize eXosip!\n");
return -1;
}
else
{
printf("eXosip_init successfully!\n");
}

// Bind uac its own port 15060, and perform port monitoring
i=eXosip_listen_addr(ctx, IPPROTO_TCP,NULL,15060,AF_INET,0);
if(i!=0)
{
eXosip_quit(ctx);
fprintf(stderr,"Couldn't initialize transport layer!\n");
return -1;
}

int val;
val=2;
eXosip_set_option (ctx, EXOSIP_OPT_DNS_CAPABILITIES, (void*)&val);

val=1;
eXosip_set_option (ctx, EXOSIP_OPT_USE_RPORT, (void*)&val);

val=0;
i = eXosip_set_option (ctx, EXOSIP_OPT_SET_TLS_VERIFY_CERTIFICATE, (void*)&val);

i = eXosip_call_build_initial_invite (ctx, &invite, "<sip:MEETING_NUMBER@webex.com>",
"<sip:mosi@192.168.0.115>",
NULL, // optional route header
"This is a call for a conversation");

if(i!=0)
{
printf("Initial INVITE failed!\n");
return 0;
}

    snprintf (tmp, 4096,
            "v=0\r\n"
            "o=- 1491669071 1491669071 IN IP4 192.168.0.115\r\n"
            "s=Asterisk\r\n"
            "c=IN IP4 192.168.0.115\r\n"
            "t=0 0\r\n"
            "m=audio 1234 RTP/AVP 0 101\r\n"
            "a=rtpmap:0 PCMU/8000\r\n"
            "a=rtpmap:101 telephone-event/8000\r\n"
            "a=fmtp:101 0-16\r\n"
            "a=ptime:20\r\n"
            "a=maxptime:150\r\n"
            "a=sendrecv\r\n"
            "m=video 1235 RTP/AVP 100 99\r\n"
            "a=rtpmap:100 VP8/90000\r\n"
            "a=rtpmap:99 H264/90000\r\n"
            "a=fmtp:99 profile-level-id=42801F\r\n"
            "a=sendrecv\r\n");

osip_message_set_body(invite,tmp,strlen(tmp));
osip_message_set_content_type(invite,"application/sdp");

eXosip_lock(ctx);
i=eXosip_call_send_initial_invite(ctx, invite); //invite SIP INVITE message to send
eXosip_unlock (ctx);

//Sent an INVITE message and wait for a response
flag1=1;
while(flag1)
{
je = eXosip_event_wait (ctx, 5, 0);
eXosip_lock(ctx);
eXosip_automatic_action (ctx);
eXosip_unlock(ctx);

if(je==NULL)
{
printf("No response or the time is over!\n");
continue;
}
switch(je->type) //Event types that may come
{
case EXOSIP_CALL_INVITE: // received an INVITE request
printf("a new invite received!\n");
break;
case EXOSIP_CALL_PROCEEDING: //Received 100 trying message, indicating that the request is being processed
printf("proceeding!\n");
break;
case EXOSIP_CALL_RINGING: //Received 180 Ringing response, indicating that the UAS receiving the INVITE request is ringing to the called user.
printf("ringing!\n");
printf("call_id is %d,dialog_id is %d \n",je->cid,je->did);
break;
case EXOSIP_CALL_ANSWERED: //Received 200 OK, indicating that the request has been successfully accepted, the user answers
printf("ok!connected!\n");
call_id=je->cid;
dialog_id=je->did;

remote_sdp = eXosip_get_remote_sdp(ctx, dialog_id);
remote_video_media = eXosip_get_audio_media(remote_sdp);
remote_video_conn = eXosip_get_audio_connection(remote_sdp);
if (remote_sdp == NULL) {
printf("remote sdp is empty");
}

if (remote_video_media == NULL) {
printf("####remote video media is empty\n");
}

if (remote_video_conn == NULL) {
printf("####remote video conn is empty\n");
} else {
printf(remote_video_conn->c_addr);
}
printf("call_id is %d,dialog_id is %d \n",je->cid,je->did);

// Send back ack response message
eXosip_call_build_ack(ctx, je->did,&ack);

eXosip_lock(ctx);
eXosip_call_send_ack(ctx, je->did,ack);
eXosip_unlock(ctx);
flag1=0; //launch the while loop
break;
case EXOSIP_CALL_CLOSED: //a BYE was received for this call
printf("the other sid closed!\n");
break;
case EXOSIP_CALL_ACK: //ACK received for 200ok to INVITE
printf("ACK received!\n");
break;
default: //Received another response
break;
}
eXosip_event_free(je); //Free ressource in an eXosip event
}

sleep(10);
eXosip_lock (ctx);
eXosip_call_terminate (ctx, call_id, dialog_id);
eXosip_unlock (ctx);
eXosip_quit(ctx);
return(0);
}


--
Antisip - http://www.antisip.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]