Attached a patch that fixes the problem.
Now, all check tests run ok.

2010/9/22 Paulo Pizarro <paulo.piza...@gmail.com>:
> Attached patch with unit test to verify this.
>
> The patch that corrects this problem is still not ok.
>
> On the test unit if not send the 180 patch works, but not :(
>
>
> 2010/9/22 Paulo Pizarro <paulo.piza...@gmail.com>:
>>  Attached a patch which fixes the problem of sending the answer SDP on
>> the PRACK request.
>>
>> Now, all nua tests passed.
>>
>> 2010/9/22 Paulo Pizarro <paulo.piza...@gmail.com>:
>>> 2010/9/21 Paulo Pizarro <paulo.piza...@gmail.com>:
>>>> Dear all,
>>>>
>>>> The useragent "A" sent a INVITE without the SDP offer, the useragent
>>>> "B" sent a 183 with the SDP offer and the useragent "A" sent a PRACK
>>>> with a SDP answer. The O/A round is complete. After that, the
>>>> useragent "B" answer the call (sent 200 to INVITE) and then "nua" sent
>>>> a BYE (900 internal media error).
>>>>
>>>> A                                    B
>>>>
>>>> --------------INVITE------------>
>>>>
>>>> <---------183 (offer)-------------
>>>> --------PRACK (answer)----->
>>>> <---------200/PRACK----------
>>>>
>>>>
>>>> <---------------180----------------
>>>> --------------PRACK----------->
>>>> <------------200/PRACK-------
>>>>
>>>>
>>>> <-----------------200-------------
>>>> ------------------ACK----------->
>>>>
>>>> When "nua" receives the SDP offer on the 183, it calls
>>>> "soa_generate_answer" and sent the SDP answer on the PRACK of the 183.
>>>> The  O/A round is complete.
>>>>
>>>> When "nua" receives the 200 from the INVITE, it calls
>>>> "soa_generate_answer" again, but now it generates an error (900
>>>> Internal media error) because there is no negotiation in progress.
>>>>
>>>> Attached log of call.
>>>>
>>>> Attached a patch to fixes this problem.
>>>> With the latest git code, make check fails during check_nta:
>>>>
>>>> make[4]: Entrando no diretório
>>>> `/home/pizarro/workspace/src/sofia-sip/sofia-sip-git/libsofia-sip-ua/nta'
>>>>         COMPILE check_nta.o
>>>>         COMPILE check_nta_api.o
>>>>         COMPILE check_nta_client.o
>>>>         LINK check_nta
>>>> check_nta.o: In function `main':
>>>> /home/pizarro/workspace/src/sofia-sip/sofia-sip-git/libsofia-sip-ua/nta/check_nta.c:116:
>>>> undefined reference to `check_nta_server_3_0'
>>>> collect2: ld returned 1 exit status
>>>> make[4]: ** [check_nta] Erro 1
>>>>
>>>
>>> I ran autogen.sh, configure, make and make check  again and now NTA check 
>>> is ok.
>>>
>>>> I could not run the nua tests, I hope this patch does not break anything. 
>>>> :)
>>>
>>> I ran nua tests and the patch doesn't work.
>>>
>>> The following tests after applying the patch failed:
>>>
>>> check_session.c:1622:E:2.5 - Call with preconditions:call_2_5_1:0:
>>> (after this point) Test timeout expired
>>> check_session.c:1704:F:2.5 - Call with preconditions:call_2_5_2:0:
>>> Assertion 's2_check_callstate(nua_callstate_completing)' failed
>>> check_session.c:1781:E:2.5 - Call with preconditions:call_2_5_3:0:
>>> (after this point) Test timeout expired
>>> check_etsi.c:334:F:6.1 - ETSI CC OE - Call
>>> Establishment:SIP_CC_OE_CE_TI_011_012:0: Failure
>>> 's2_sip_check_request_timeout(SIP_METHOD_ACK, 3)' occured
>>>
>>> :(
>>>
>>>>
>>>> Thanks in advance,
>>>>
>>>> Paulo Pizarro
>>>>
>>>
>>
>
From 7cc0be3c8bb8c2e9a26b20aafdf75c2524ce9c69 Mon Sep 17 00:00:00 2001
From: Paulo Pizarro <paulo.piza...@gmail.com>
Date: Thu, 23 Sep 2010 12:03:05 -0300
Subject: [PATCH] Fixed sent answer SDP on the PRACK request


Signed-off-by: Paulo Pizarro <paulo.piza...@gmail.com>
---
 libsofia-sip-ua/nua/check_session.c |   52 +++++++++++++++++++++++++++++++++++
 libsofia-sip-ua/nua/nua_session.c   |    6 ++++
 2 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/libsofia-sip-ua/nua/check_session.c b/libsofia-sip-ua/nua/check_session.c
index ed1f575..a8d17b6 100644
--- a/libsofia-sip-ua/nua/check_session.c
+++ b/libsofia-sip-ua/nua/check_session.c
@@ -1570,6 +1570,57 @@ START_TEST(call_2_4_5)
 }
 END_TEST
 
+START_TEST(call_2_4_6)
+{
+  nua_handle_t *nh;
+  struct message *invite, *prack;
+  int with_sdp;
+
+  S2_CASE("2.4.6", "Call with 100rel and delayed offer",
+	  "NUA sends INVITE without SDP offer, "
+	  "receives 183 with SDP offer, sends PRACK with SDP answer, receives 200 for it, "
+	  "receives 180, sends PRACK, receives 200 for it, "
+          "receives 200, send ACK.");
+
+  nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+
+  invite = invite_sent_by_nua(nh, SOATAG_DELAYED_OFFER_ENABLE(1),
+                                  SOATAG_USER_SDP_STR("m=audio 5008 RTP/AVP 8 0" CRLF
+                                                      "m=video 5010 RTP/AVP 34" CRLF),
+                                  TAG_END());
+
+  soa_generate_offer(soa, 1, NULL);
+
+  prack = respond_with_100rel(invite, dialog, with_sdp = 1,
+			      SIP_183_SESSION_PROGRESS,
+			      TAG_END());
+  process_answer(prack);
+  s2_sip_respond_to(prack, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(prack), prack = NULL;
+  fail_unless(s2_check_callstate(nua_callstate_proceeding));
+  fail_unless_event(nua_r_prack, 200);
+
+  prack = respond_with_100rel(invite, dialog, with_sdp = 0,
+			      SIP_180_RINGING,
+			      TAG_END());
+  s2_sip_respond_to(prack, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(prack), prack = NULL;
+  fail_unless(s2_check_callstate(nua_callstate_proceeding));
+  fail_unless_event(nua_r_prack, 200);
+
+  s2_sip_respond_to(invite, dialog, SIP_200_OK, TAG_END());
+  s2_sip_free_message(invite);
+  fail_unless_event(nua_r_invite, 200);
+
+  fail_unless(s2_check_callstate(nua_callstate_ready));
+  fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
+
+  bye_to_nua(nh, TAG_END());
+
+  nua_handle_destroy(nh);
+}
+END_TEST
+
 TCase *invite_100rel_tcase(int threading)
 {
   TCase *tc = tcase_create("2.4 - INVITE with 100rel");
@@ -1580,6 +1631,7 @@ TCase *invite_100rel_tcase(int threading)
     tcase_add_test(tc, call_2_4_3);
     tcase_add_test(tc, call_2_4_4);
     tcase_add_test(tc, call_2_4_5);
+    tcase_add_test(tc, call_2_4_6);
   }
   return tc;
 }
diff --git a/libsofia-sip-ua/nua/nua_session.c b/libsofia-sip-ua/nua/nua_session.c
index 5bf473c..7a7da86 100644
--- a/libsofia-sip-ua/nua/nua_session.c
+++ b/libsofia-sip-ua/nua/nua_session.c
@@ -1811,6 +1811,12 @@ static int nua_prack_client_request(nua_client_request_t *cr,
     cr->cr_offer_sent = offer_sent;
     cr->cr_answer_sent = answer_sent;
 
+    if (cri->cr_offer_recv && answer_sent) {
+      cr->cr_answer_sent = 0;
+      cri->cr_offer_recv = 0;
+      cri->cr_answer_sent = 0;
+    }
+
     if (offer_sent)
       ss->ss_oa_sent = Offer;
     else if (answer_sent)
-- 
1.7.0.4

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to