Freeswitch-svn
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
March 2009
- 17 participants
- 512 discussions
[commit] r12400 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/su
by FreeSWITCH SVN 03 Mar '09
by FreeSWITCH SVN 03 Mar '09
03 Mar '09
Author: mikej
Date: Tue Mar 3 16:02:55 2009
New Revision: 12400
Log:
Tue Mar 3 12:23:35 CST 2009 Della Betta Filippo <filippo DOT dellabetta AT telecomitalia DOT it>
* su_uniqueid.c: srand() must be called per-thread on windows
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_uniqueid.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Mar 3 16:02:55 2009
@@ -1 +1 @@
-Tue Mar 3 16:01:07 CST 2009
+Tue Mar 3 16:01:38 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_uniqueid.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_uniqueid.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_uniqueid.c Tue Mar 3 16:02:55 2009
@@ -73,8 +73,13 @@
#include "sofia-sip/su_time.h"
#include "sofia-sip/su_uniqueid.h"
+#ifdef SU_HAVE_WINSOCK
+#define PERTHREAD __declspec(thread)
+#else
+#define PERTHREAD
+#endif
/* For random number generator */
-static int initialized = 0;
+static PERTHREAD int initialized = 0;
static void init(void);
static void init_node(void);
1
0
[commit] r12399 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nua
by FreeSWITCH SVN 03 Mar '09
by FreeSWITCH SVN 03 Mar '09
03 Mar '09
Author: mikej
Date: Tue Mar 3 16:01:25 2009
New Revision: 12399
Log:
Tue Mar 3 12:18:30 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* check_session.c: more CANCEL timeout cases
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Mar 3 16:01:25 2009
@@ -1 +1 @@
-Tue Mar 3 16:00:35 CST 2009
+Tue Mar 3 16:01:07 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c Tue Mar 3 16:01:25 2009
@@ -96,10 +96,11 @@
s2_register_teardown();
- mark_point();
-
- nua_shutdown(nua);
- fail_unless(s2_check_event(nua_r_shutdown, 200));
+ if (s2->shutdown == 0) {
+ mark_point();
+ nua_shutdown(nua);
+ fail_unless(s2_check_event(nua_r_shutdown, 200));
+ }
mark_point();
@@ -1051,6 +1052,110 @@
}
END_TEST
+START_TEST(cancel_2_2_9)
+{
+ nua_handle_t *nh;
+ struct message *invite, *cancel;
+ int timeout;
+
+ s2_case("2.2.9", "CANCEL a RFC2543 UA",
+ "NUA is caller, NUA sends CANCEL after receiving 180, "
+ "UAS sends 200 OK to CANCEL but no response to INVITE.");
+
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+
+ nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
+ TAG_END());
+ fail_unless(s2_check_callstate(nua_callstate_calling));
+
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
+ process_offer(invite);
+ respond_with_sdp(
+ invite, dialog, SIP_180_RINGING,
+ SIPTAG_CONTENT_DISPOSITION_STR("session;handling=optional"),
+ TAG_END());
+ fail_unless(s2_check_event(nua_r_invite, 180));
+ fail_unless(s2_check_callstate(nua_callstate_proceeding));
+
+ nua_cancel(nh, TAG_END());
+ cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
+ fail_if(!cancel);
+ s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(cancel);
+
+ /* Time out INVITE */
+ for (timeout = 0; timeout < 34; timeout++) {
+ s2_nua_fast_forward(1, s2base->root);
+ }
+
+ fail_unless(s2_check_event(nua_r_invite, 408));
+ fail_unless(s2_check_callstate(nua_callstate_terminated));
+ nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(cancel_2_2_10)
+{
+ nua_handle_t *nh;
+ struct message *invite, *cancel;
+ struct event *event;
+ int timeout;
+
+ s2_case("2.2.10", "CANCEL and INVITE times out",
+ "NUA is caller, NUA sends CANCEL after receiving 180 "
+ "but UAS never responds.");
+
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+
+ nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
+ TAG_END());
+ fail_unless(s2_check_callstate(nua_callstate_calling));
+
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
+ process_offer(invite);
+ respond_with_sdp(
+ invite, dialog, SIP_180_RINGING,
+ SIPTAG_CONTENT_DISPOSITION_STR("session;handling=optional"),
+ TAG_END());
+ fail_unless(s2_check_event(nua_r_invite, 180));
+ fail_unless(s2_check_callstate(nua_callstate_proceeding));
+
+ nua_cancel(nh, TAG_END());
+ cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
+ s2_sip_free_message(cancel);
+ fail_if(!cancel);
+
+ nua_cancel(nh, TAG_END());
+ cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
+ fail_if(!cancel);
+ s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(cancel);
+
+ s2_register_teardown();
+
+ nua_set_params(s2->nua, NUTAG_SHUTDOWN_EVENTS(1), TAG_END());
+ fail_unless(s2_check_event(nua_r_set_params, 200));
+
+ nua_shutdown(s2->nua);
+ event = s2_wait_for_event(nua_r_shutdown, 100);
+ fail_unless(event != NULL);
+ s2_free_event(event);
+
+ /* Time out */
+ for (timeout = 0; timeout < 34; timeout++) {
+ s2_nua_fast_forward(5, s2base->root);
+ nua_shutdown(s2->nua);
+ event = s2_wait_for_event(nua_r_shutdown, 0);
+ fail_unless(event != NULL);
+ if (event->data->e_status >= 200)
+ break;
+ }
+
+ s2->shutdown = 200;
+}
+END_TEST
+
+
TCase *cancel_tcase(int threading)
{
@@ -1065,6 +1170,8 @@
tcase_add_test(tc, cancel_2_2_6);
tcase_add_test(tc, cancel_2_2_7);
tcase_add_test(tc, cancel_2_2_8);
+ tcase_add_test(tc, cancel_2_2_9);
+ tcase_add_test(tc, cancel_2_2_10);
return tc;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h Tue Mar 3 16:01:25 2009
@@ -40,6 +40,8 @@
nua_t *nua;
+ int shutdown;
+
struct event {
struct event *next, **prev;
nua_saved_event_t event[1];
1
0
[commit] r12398 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nua
by FreeSWITCH SVN 03 Mar '09
by FreeSWITCH SVN 03 Mar '09
03 Mar '09
Author: mikej
Date: Tue Mar 3 16:00:56 2009
New Revision: 12398
Log:
Tue Mar 3 12:15:01 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* nua: check_nua now uses s2base.h and s2sip.h
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_etsi.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_simple.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Mar 3 16:00:56 2009
@@ -1 +1 @@
-Tue Mar 3 15:59:49 CST 2009
+Tue Mar 3 16:00:35 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am Tue Mar 3 16:00:56 2009
@@ -55,8 +55,6 @@
check_nua_LDADD = $(nua_libs) ${top_builddir}/s2check/libs2.a \
@CHECK_LIBS@
-check_nua_CFLAGS = $(CFLAGS) -I$(top_srcdir)/s2check
-
nua_libs = libnua.la \
../iptsec/libiptsec.la \
../ipt/libipt.la \
@@ -84,6 +82,6 @@
include $(top_srcdir)/rules/sofia.am
-INCLUDES = ${INTERNAL_INCLUDES}
+INCLUDES = ${INTERNAL_INCLUDES} -I$(top_srcdir)/s2check
TAG_DLL_FLAGS = LIST=nua_tag_list
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_etsi.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_etsi.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_etsi.c Tue Mar 3 16:00:56 2009
@@ -71,7 +71,7 @@
NUTAG_OUTBOUND("no-options-keepalive, no-validate"),
TAG_END());
- soa = soa_create(NULL, s2->root, NULL);
+ soa = soa_create(NULL, s2base->root, NULL);
fail_if(!soa);
@@ -148,7 +148,7 @@
fail_if(soa_get_local_sdp(soa, NULL, &body, &bodylen) != 1);
ta_start(ta, tag, value);
- s2_respond_to(request, dialog, status, phrase,
+ s2_sip_respond_to(request, dialog, status, phrase,
SIPTAG_CONTENT_TYPE_STR("application/sdp"),
SIPTAG_PAYLOAD_STR(body),
SIPTAG_CONTENT_DISPOSITION_STR("session"),
@@ -168,7 +168,7 @@
fail_unless(s2_check_callstate(nua_callstate_calling));
- return s2_wait_for_request(SIP_METHOD_INVITE);
+ return s2_sip_wait_for_request(SIP_METHOD_INVITE);
}
static void
@@ -182,10 +182,10 @@
nua_bye(nh, ta_tags(ta));
ta_end(ta);
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
}
@@ -208,7 +208,7 @@
"sends an ACK request with a To header identical to the "
"received one for each received Success (200 OK) responses.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(nh, TAG_END());
@@ -218,17 +218,17 @@
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
respond_with_sdp(invite, d2, SIP_200_OK, TAG_END());
- s2_free_message(invite);
+ s2_sip_free_message(invite);
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, d2, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, d2, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
bye_by_nua(d1, nh, TAG_END());
@@ -248,39 +248,39 @@
"that matches the transaction, still answer with an "
"ACK request until timer D set to at least 32 second expires.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(nh, TAG_END());
- s2_respond_to(invite, d1, 404, "First not found", TAG_END());
+ s2_sip_respond_to(invite, d1, 404, "First not found", TAG_END());
fail_unless(s2_check_event(nua_r_invite, 404));
fail_unless(s2_check_callstate(nua_callstate_terminated));
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
- s2_fast_forward(5, s2->root);
+ s2_nua_fast_forward(5, s2base->root);
- s2_respond_to(invite, d1, 404, "Not found after 5 seconds", TAG_END());
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ s2_sip_respond_to(invite, d1, 404, "Not found after 5 seconds", TAG_END());
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
- s2_fast_forward(5, s2->root);
+ s2_nua_fast_forward(5, s2base->root);
- s2_respond_to(invite, d1, 404, "Not found after 10 seconds", TAG_END());
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ s2_sip_respond_to(invite, d1, 404, "Not found after 10 seconds", TAG_END());
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
- s2_fast_forward(21, s2->root);
+ s2_nua_fast_forward(21, s2base->root);
- s2_respond_to(invite, d1, 404, "Not found after 31 seconds", TAG_END());
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ s2_sip_respond_to(invite, d1, 404, "Not found after 31 seconds", TAG_END());
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
- s2_fast_forward(5, s2->root);
+ s2_nua_fast_forward(5, s2base->root);
/* Wake up nua thread and let it time out INVITE transaction */
nua_set_params(s2->nua, TAG_END());
s2_check_event(nua_r_set_params, 0);
- s2_respond_to(invite, d1, 404, "Not found after 32 seconds", TAG_END());
- s2_free_message(invite);
- fail_if(s2_check_request_timeout(SIP_METHOD_ACK, 500));
+ s2_sip_respond_to(invite, d1, 404, "Not found after 32 seconds", TAG_END());
+ s2_sip_free_message(invite);
+ fail_if(s2_sip_check_request_timeout(SIP_METHOD_ACK, 3));
nua_handle_destroy(nh);
}
@@ -299,7 +299,7 @@
"on receipt of a retransmitted Success (200 OK) "
"responses does not send an ACK request.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(nh, TAG_END());
@@ -309,29 +309,29 @@
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
- s2_fast_forward(5, s2->root);
+ s2_nua_fast_forward(5, s2base->root);
respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
- s2_fast_forward(5, s2->root);
+ s2_nua_fast_forward(5, s2base->root);
respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
- s2_fast_forward(21, s2->root);
+ s2_nua_fast_forward(20, s2base->root);
respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
- s2_fast_forward(5, s2->root);
+ /* Stack times out the INVITE transaction */
+ s2_nua_fast_forward(5, s2base->root);
- /* Wake up nua thread and let it time out INVITE transaction */
- nua_set_params(s2->nua, TAG_END());
- s2_check_event(nua_r_set_params, 0);
-
- respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
- s2_free_message(invite);
- fail_if(s2_check_request_timeout(SIP_METHOD_ACK, 500));
+ respond_with_sdp(invite, d1, SIP_200_OK,
+ SIPTAG_SUBJECT_STR("Stray 200 OK"),
+ TAG_END());
+ s2_sip_free_message(invite);
+ mark_point();
+ fail_if(s2_sip_check_request_timeout(SIP_METHOD_ACK, 3));
bye_by_nua(d1, nh, TAG_END());
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c Tue Mar 3 16:00:56 2009
@@ -33,6 +33,7 @@
#include "config.h"
+#include "test_s2.h"
#include "check_nua.h"
#include <stdlib.h>
@@ -43,8 +44,6 @@
#include <fnmatch.h>
#endif
-#include "test_s2.h"
-
static void usage(int exitcode)
{
fprintf(exitcode ? stderr : stdout,
@@ -62,6 +61,8 @@
s2_tester = "check_nua";
+ s2_suite("N2");
+
if (getenv("CHECK_NUA_VERBOSE"))
s2_start_stop = strtoul(getenv("CHECK_NUA_VERBOSE"), NULL, 10);
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c Tue Mar 3 16:00:56 2009
@@ -75,7 +75,7 @@
TPTAG_PINGPONG(20000),
TPTAG_KEEPALIVE(10000),
TAG_END());
- tport_set_params(s2->tcp.tport, TPTAG_PONG2PING(1), TAG_END());
+ tport_set_params(s2sip->tcp.tport, TPTAG_PONG2PING(1), TAG_END());
}
static void pingpong_thread_setup(void)
@@ -121,12 +121,12 @@
nua_register(nh, TAG_END());
- fail_unless((m = s2_wait_for_request(SIP_METHOD_REGISTER)) != NULL, NULL);
+ fail_unless((m = s2_sip_wait_for_request(SIP_METHOD_REGISTER)) != NULL, NULL);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_403_FORBIDDEN,
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
nua_handle_destroy(nh);
@@ -156,38 +156,38 @@
nua_register(nh, TAG_END());
- m = s2_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
- s2_respond_to(m, NULL,
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
+ s2_sip_respond_to(m, NULL,
SIP_407_PROXY_AUTH_REQUIRED,
SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
s2_check_event(nua_r_register, 407);
nua_authenticate(nh, NUTAG_AUTH(s2_auth_credentials), TAG_END());
- m = s2_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
- s2_respond_to(m, NULL,
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
+ s2_sip_respond_to(m, NULL,
SIP_401_UNAUTHORIZED,
SIPTAG_WWW_AUTHENTICATE_STR(s2_auth2_digest_str),
SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
s2_check_event(nua_r_register, 401);
nua_authenticate(nh, NUTAG_AUTH(s2_auth2_credentials), TAG_END());
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m);
fail_if(!m->sip->sip_authorization);
fail_if(!m->sip->sip_proxy_authorization);
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
assert(s2->registration->contact != NULL);
s2_check_event(nua_r_register, 200);
@@ -237,32 +237,32 @@
nua_register(nh, TAG_END());
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m);
fail_if(!m->sip->sip_contact || m->sip->sip_contact->m_next);
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
assert(s2->registration->contact != NULL);
s2_check_event(nua_r_register, 100);
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m);
fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
fail_unless(s2->registration->contact != NULL);
fail_if(s2->registration->contact->m_next != NULL);
@@ -286,19 +286,19 @@
nua_register(nh, ta_tags(ta));
ta_end(ta);
- m = s2_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
- s2_respond_to(m, NULL,
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
+ s2_sip_respond_to(m, NULL,
SIP_401_UNAUTHORIZED,
SIPTAG_WWW_AUTHENTICATE_STR(s2_auth_digest_str),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
s2_check_event(nua_r_register, 401);
nua_authenticate(nh, NUTAG_AUTH(s2_auth_credentials), TAG_END());
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m);
fail_if(!m->sip->sip_authorization);
/* should not unregister the previous contact
@@ -307,12 +307,12 @@
fail_if(m->sip->sip_contact->m_next);
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
assert(s2->registration->contact != NULL);
s2_check_event(nua_r_register, 200);
@@ -350,61 +350,61 @@
mark_point();
- m = s2_wait_for_request(SIP_METHOD_OPTIONS);
+ m = s2_sip_wait_for_request(SIP_METHOD_OPTIONS);
fail_if(!m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_407_PROXY_AUTH_REQUIRED,
SIPTAG_VIA(natted_via(m)),
SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
mark_point();
- m = s2_wait_for_request(SIP_METHOD_OPTIONS);
+ m = s2_sip_wait_for_request(SIP_METHOD_OPTIONS);
fail_if(!m); fail_if(!m->sip->sip_proxy_authorization);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
- su_root_step(s2->root, 20); su_root_step(s2->root, 20);
- s2_fast_forward(120, s2->root); /* Default keepalive interval */
+ su_root_step(s2base->root, 20); su_root_step(s2base->root, 20);
+ s2_nua_fast_forward(120, s2base->root); /* Default keepalive interval */
mark_point();
- m = s2_wait_for_request(SIP_METHOD_OPTIONS);
- s2_respond_to(m, NULL,
+ m = s2_sip_wait_for_request(SIP_METHOD_OPTIONS);
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
- su_root_step(s2->root, 20); su_root_step(s2->root, 20);
- s2_fast_forward(120, s2->root); /* Default keepalive interval */
+ su_root_step(s2base->root, 20); su_root_step(s2base->root, 20);
+ s2_nua_fast_forward(120, s2base->root); /* Default keepalive interval */
mark_point();
receive_natted = "received=4.255.255.10";
- m = s2_wait_for_request(SIP_METHOD_OPTIONS);
- s2_respond_to(m, NULL,
+ m = s2_sip_wait_for_request(SIP_METHOD_OPTIONS);
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
s2_check_event(nua_i_outbound, 0);
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m); fail_if(!m->sip->sip_authorization);
fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
s2_check_event(nua_r_register, 200);
@@ -434,33 +434,33 @@
receive_natted = "received=4.255.255.10";
- s2_fast_forward(3600, s2->root);
+ s2_nua_fast_forward(3600, s2base->root);
mark_point();
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m); fail_if(!m->sip->sip_authorization);
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
s2_check_event(nua_r_register, 100);
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m); fail_if(!m->sip->sip_authorization);
fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
fail_unless(s2->registration->contact != NULL);
fail_if(s2->registration->contact->m_next != NULL);
@@ -484,28 +484,28 @@
mark_point();
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m);
fail_if(!m->sip->sip_contact || m->sip->sip_contact->m_next);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
400, "Bad Contact",
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
s2_check_event(nua_r_register, 100);
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m);
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
fail_unless(s2->registration->contact != NULL);
fail_if(s2->registration->contact->m_next != NULL);
@@ -530,34 +530,34 @@
nh = nua_handle(nua, NULL, TAG_END());
- nua_register(nh, NUTAG_PROXY(s2->tcp.contact->m_url), TAG_END());
+ nua_register(nh, NUTAG_PROXY(s2sip->tcp.contact->m_url), TAG_END());
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m); fail_if(!m->sip->sip_contact || m->sip->sip_contact->m_next);
fail_if(!tport_is_tcp(m->tport));
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
assert(s2->registration->contact != NULL);
s2_check_event(nua_r_register, 100);
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m);
fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
fail_unless(s2->registration->contact != NULL);
fail_if(s2->registration->contact->m_next != NULL);
@@ -581,7 +581,7 @@
mark_point();
s2->registration->nh = nh;
- make_auth_natted_register(nh, NUTAG_PROXY(s2->tcp.contact->m_url), TAG_END());
+ make_auth_natted_register(nh, NUTAG_PROXY(s2sip->tcp.contact->m_url), TAG_END());
fail_if(!tport_is_tcp(s2->registration->tport));
s2_register_teardown();
}
@@ -604,38 +604,38 @@
mark_point();
s2->registration->nh = nh;
make_auth_natted_register(
- nh, NUTAG_PROXY(s2->tcp.contact->m_url),
+ nh, NUTAG_PROXY(s2sip->tcp.contact->m_url),
NUTAG_OUTBOUND("no-options-keepalive, no-validate"),
TAG_END());
fail_if(!tport_is_tcp(s2->registration->tport));
tport_shutdown(s2->registration->tport, 2);
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m); fail_if(!m->sip->sip_authorization);
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
/* The "NAT binding" changed when new TCP connection is established */
/* => NUA re-REGISTERs with newly detected contact */
s2_check_event(nua_r_register, 100);
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m); fail_if(!m->sip->sip_authorization);
fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
s2_check_event(nua_r_register, 200);
@@ -667,22 +667,22 @@
/* NTA tries with UDP, we drop them */
for (;;) {
- m = s2_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER); fail_if(!m);
if (!tport_is_udp(m->tport)) /* Drop UDP */
break;
- s2_free_message(m);
- s2_fast_forward(4, s2->root);
+ s2_sip_free_message(m);
+ s2_nua_fast_forward(4, s2base->root);
}
tcp = tport_ref(m->tport);
/* Respond to request over TCP */
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_401_UNAUTHORIZED,
SIPTAG_WWW_AUTHENTICATE_STR(s2_auth_digest_str),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
s2_check_event(nua_r_register, 401);
nua_authenticate(nh, NUTAG_AUTH(s2_auth_credentials), TAG_END());
@@ -690,32 +690,32 @@
tport_set_params(tcp, TPTAG_PONG2PING(0), TAG_END());
/* Now request over UDP ... registering TCP contact! */
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m); fail_if(!m->sip->sip_authorization);
s2_save_register(m);
fail_unless(
url_has_param(s2->registration->contact->m_url, "transport=tcp"));
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
/* NUA detects oops... re-registers UDP */
s2_check_event(nua_r_register, 100);
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m); fail_if(!m->sip->sip_authorization);
fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m)),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
s2_check_event(nua_r_register, 200);
@@ -726,10 +726,10 @@
{
int i;
for (i = 0; i < 5; i++) {
- su_root_step(s2->root, 5);
- su_root_step(s2->root, 5);
- su_root_step(s2->root, 5);
- s2_fast_forward(5, s2->root);
+ su_root_step(s2base->root, 5);
+ su_root_step(s2base->root, 5);
+ su_root_step(s2base->root, 5);
+ s2_nua_fast_forward(5, s2base->root);
}
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c Tue Mar 3 16:00:56 2009
@@ -68,7 +68,7 @@
NUTAG_OUTBOUND("no-options-keepalive, no-validate"),
TAG_END());
- soa = soa_create(NULL, s2->root, NULL);
+ soa = soa_create(NULL, s2base->root, NULL);
fail_if(!soa);
@@ -161,7 +161,7 @@
fail_if(soa_get_local_sdp(soa, NULL, &body, &bodylen) != 1);
ta_start(ta, tag, value);
- s2_respond_to(request, dialog, status, phrase,
+ s2_sip_respond_to(request, dialog, status, phrase,
SIPTAG_CONTENT_TYPE_STR("application/sdp"),
SIPTAG_PAYLOAD_STR(body),
SIPTAG_CONTENT_DISPOSITION_STR("session"),
@@ -184,7 +184,7 @@
ta_start(ta, tag, value);
fail_if(
- s2_request_to(dialog, method, name, tport,
+ s2_sip_request_to(dialog, method, name, tport,
SIPTAG_CONTENT_TYPE_STR("application/sdp"),
SIPTAG_PAYLOAD_STR(body),
ta_tags(ta)));
@@ -203,7 +203,7 @@
fail_unless(s2_check_callstate(nua_callstate_calling));
- return s2_wait_for_request(SIP_METHOD_INVITE);
+ return s2_sip_wait_for_request(SIP_METHOD_INVITE);
}
static uint32_t s2_rseq;
@@ -233,7 +233,7 @@
ta_tags(ta));
}
else {
- s2_respond_to(
+ s2_sip_respond_to(
invite, dialog, status, phrase,
SIPTAG_REQUIRE_STR("100rel"),
SIPTAG_RSEQ(rs),
@@ -243,7 +243,7 @@
fail_unless(s2_check_event(nua_r_invite, status));
- return s2_wait_for_request(SIP_METHOD_PRACK);
+ return s2_sip_wait_for_request(SIP_METHOD_PRACK);
}
static void
@@ -267,10 +267,10 @@
fail_unless(s2_check_callstate(nua_callstate_proceeding));
respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
- s2_free_message(invite);
+ s2_sip_free_message(invite);
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
}
static nua_handle_t *
@@ -295,7 +295,7 @@
s2_free_event(invite);
- response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
fail_if(!response);
nua_respond(nh, SIP_180_RINGING,
@@ -303,23 +303,23 @@
TAG_END());
fail_unless(s2_check_callstate(nua_callstate_early));
- response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
fail_if(!response);
- s2_update_dialog(dialog, response);
+ s2_sip_update_dialog(dialog, response);
process_answer(response);
- s2_free_message(response);
+ s2_sip_free_message(response);
nua_respond(nh, SIP_200_OK, TAG_END());
fail_unless(s2_check_callstate(nua_callstate_completed));
- response = s2_wait_for_response(200, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
fail_if(!response);
- s2_update_dialog(dialog, response);
- s2_free_message(response);
+ s2_sip_update_dialog(dialog, response);
+ s2_sip_free_message(response);
- fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
fail_unless(s2_check_event(nua_i_ack, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
@@ -338,10 +338,10 @@
nua_bye(nh, ta_tags(ta));
ta_end(ta);
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
}
@@ -359,19 +359,19 @@
nua_bye(nh, ta_tags(ta));
ta_end(ta);
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
+ s2_sip_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
TAG_END());
- s2_free_message(bye);
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 407));
nua_authenticate(nh, NUTAG_AUTH("Digest:\"s2test\":abc:abc"), TAG_END());
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
fail_if(s2->events);
@@ -391,14 +391,14 @@
nua_cancel(nh, ta_tags(ta));
ta_end(ta);
- cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+ cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
fail_if(!cancel);
- s2_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
- s2_free_message(cancel);
+ s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(cancel);
fail_unless(s2_check_event(nua_r_cancel, 200));
- s2_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ s2_sip_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
fail_unless(s2_check_event(nua_r_invite, 487));
}
@@ -410,12 +410,12 @@
ta_list ta;
ta_start(ta, tag, value);
- fail_if(s2_request_to(dialog, SIP_METHOD_BYE, NULL, ta_tags(ta)));
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, ta_tags(ta)));
ta_end(ta);
fail_unless(s2_check_event(nua_i_bye, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
- fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+ fail_unless(s2_sip_check_response(200, SIP_METHOD_BYE));
}
/* ====================================================================== */
@@ -430,7 +430,7 @@
s2_case("2.1.1", "Basic call",
"NUA sends INVITE, NUA sends BYE");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite_by_nua(nh, TAG_END());
@@ -448,7 +448,7 @@
s2_case("2.1.2.1", "Basic call",
"NUA sends INVITE, NUA receives BYE");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite_by_nua(nh, TAG_END());
@@ -465,11 +465,11 @@
s2_case("2.1.2.2", "Basic call over TCP",
"NUA sends INVITE, NUA receives BYE");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local),
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor),
TAG_END());
invite_by_nua(nh,
- NUTAG_PROXY(s2->tcp.contact->m_url),
+ NUTAG_PROXY(s2sip->tcp.contact->m_url),
TAG_END());
bye_to_nua(nh, TAG_END());
@@ -502,7 +502,7 @@
s2_case("2.1.3.2", "Incoming call over TCP",
"NUA receives INVITE and BYE");
- dialog->tport = s2->tcp.tport;
+ dialog->tport = s2sip->tcp.tport;
nh = invite_to_nua(TAG_END());
@@ -569,44 +569,44 @@
s2_free_event(invite);
- response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
fail_if(!response);
nua_respond(nh, SIP_180_RINGING,
/* Dialog-specific proxy is saved */
- NUTAG_PROXY(s2->tcp.contact->m_url),
+ NUTAG_PROXY(s2sip->tcp.contact->m_url),
SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
TAG_END());
fail_unless(s2_check_callstate(nua_callstate_early));
- response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
fail_if(!response);
- s2_update_dialog(dialog, response);
+ s2_sip_update_dialog(dialog, response);
process_answer(response);
- s2_free_message(response);
+ s2_sip_free_message(response);
nua_respond(nh, SIP_200_OK, TAG_END());
fail_unless(s2_check_callstate(nua_callstate_completed));
- response = s2_wait_for_response(200, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
fail_if(!response);
- s2_update_dialog(dialog, response);
- s2_free_message(response);
+ s2_sip_update_dialog(dialog, response);
+ s2_sip_free_message(response);
- fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
fail_unless(s2_check_event(nua_i_ack, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
nua_bye(nh, TAG_END());
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
/* Check that NUA used dialog-specific proxy with BYE */
fail_unless(tport_is_tcp(bye->tport));
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
@@ -623,7 +623,7 @@
s2_case("2.1.7", "Call lookup",
"Test dialog and call-id lookup");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite_by_nua(nh, TAG_END());
@@ -656,11 +656,11 @@
s2_case("2.1.8", "Call using NUTAG_PROXY()",
"Test handle-specific NUTAG_PROXY().");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(
nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
- NUTAG_PROXY(s2->tcp.contact->m_url), TAG_END());
+ NUTAG_PROXY(s2sip->tcp.contact->m_url), TAG_END());
process_offer(invite);
respond_with_sdp(
@@ -672,10 +672,10 @@
fail_unless(s2_check_callstate(nua_callstate_proceeding));
respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
- s2_free_message(invite);
+ s2_sip_free_message(invite);
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
fail_unless(ack && tport_is_tcp(ack->tport));
bye_by_nua(nh, TAG_END());
@@ -715,23 +715,23 @@
s2_case("2.2.1", "Cancel call",
"NUA is caller, NUA sends CANCEL immediately");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
TAG_END());
fail_unless(s2_check_callstate(nua_callstate_calling));
nua_cancel(nh, TAG_END());
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
fail_if(!invite);
- fail_if(s2->received != NULL);
- s2_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
- cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+ fail_if(s2sip->received != NULL);
+ s2_sip_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
+ cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
fail_if(!cancel);
- s2_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
- s2_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+ s2_sip_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
+ s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
fail_unless(s2_check_event(nua_r_invite, 487));
fail_unless(s2_check_callstate(nua_callstate_terminated));
@@ -751,15 +751,15 @@
s2_case("2.2.2", "Canceled call",
"NUA is caller, NUA sends CANCEL after receiving 100");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
TAG_END());
fail_unless(s2_check_callstate(nua_callstate_calling));
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
process_offer(invite);
- s2_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
+ s2_sip_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
cancel_by_nua(nh, invite, dialog, TAG_END());
@@ -778,13 +778,13 @@
s2_case("2.2.3", "Canceled call",
"NUA is caller, NUA sends CANCEL after receiving 180");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
TAG_END());
fail_unless(s2_check_callstate(nua_callstate_calling));
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
process_offer(invite);
respond_with_sdp(
invite, dialog, SIP_180_RINGING,
@@ -810,13 +810,13 @@
"NUA is caller, NUA sends CANCEL after receiving 180 "
"but UAS already sent 200 OK.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
TAG_END());
fail_unless(s2_check_callstate(nua_callstate_calling));
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
process_offer(invite);
respond_with_sdp(
invite, dialog, SIP_180_RINGING,
@@ -826,16 +826,16 @@
fail_unless(s2_check_callstate(nua_callstate_proceeding));
nua_cancel(nh, TAG_END());
- cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+ cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
fail_if(!cancel);
respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
- s2_respond_to(cancel, dialog, SIP_481_NO_TRANSACTION, TAG_END());
- s2_free_message(cancel);
+ s2_sip_respond_to(cancel, dialog, SIP_481_NO_TRANSACTION, TAG_END());
+ s2_sip_free_message(cancel);
fail_unless(s2_check_event(nua_r_cancel, 481));
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
fail_unless(s2_check_callstate(nua_callstate_ready));
@@ -858,14 +858,14 @@
"but UAS already sent 200 OK.\n"
"Test case checks that NUA really sends BYE after nua_bye() is called\n");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
NUTAG_AUTOACK(0),
TAG_END());
fail_unless(s2_check_callstate(nua_callstate_calling));
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
process_offer(invite);
respond_with_sdp(
invite, dialog, SIP_180_RINGING,
@@ -875,23 +875,23 @@
fail_unless(s2_check_callstate(nua_callstate_proceeding));
nua_bye(nh, TAG_END());
- cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+ cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
fail_if(!cancel);
respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
- s2_respond_to(cancel, dialog, SIP_481_NO_TRANSACTION, TAG_END());
- s2_free_message(cancel);
+ s2_sip_respond_to(cancel, dialog, SIP_481_NO_TRANSACTION, TAG_END());
+ s2_sip_free_message(cancel);
fail_unless(s2_check_event(nua_r_cancel, 481));
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
fail_unless(s2_check_callstate(nua_callstate_terminating));
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
@@ -919,7 +919,7 @@
s2_free_event(invite);
- response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
fail_if(!response);
nua_respond(nh, SIP_180_RINGING,
@@ -927,22 +927,22 @@
TAG_END());
fail_unless(s2_check_callstate(nua_callstate_early));
- response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
fail_if(!response);
- s2_update_dialog(dialog, response);
+ s2_sip_update_dialog(dialog, response);
process_answer(response);
- s2_free_message(response);
+ s2_sip_free_message(response);
- fail_if(s2_request_to(dialog, SIP_METHOD_CANCEL, NULL, TAG_END()));
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_CANCEL, NULL, TAG_END()));
fail_unless(s2_check_event(nua_i_cancel, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
- response = s2_wait_for_response(200, SIP_METHOD_CANCEL);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_CANCEL);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
- response = s2_wait_for_response(487, SIP_METHOD_INVITE);
- fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+ response = s2_sip_wait_for_response(487, SIP_METHOD_INVITE);
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
TAG_END()));
@@ -974,7 +974,7 @@
s2_free_event(invite);
- response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
fail_if(!response);
nua_respond(nh, SIP_180_RINGING,
@@ -982,22 +982,22 @@
TAG_END());
fail_unless(s2_check_callstate(nua_callstate_early));
- response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
fail_if(!response);
- s2_update_dialog(dialog, response);
+ s2_sip_update_dialog(dialog, response);
process_answer(response);
- s2_free_message(response);
+ s2_sip_free_message(response);
- fail_if(s2_request_to(dialog, SIP_METHOD_CANCEL, NULL, TAG_END()));
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_CANCEL, NULL, TAG_END()));
fail_unless(s2_check_event(nua_i_cancel, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
- response = s2_wait_for_response(200, SIP_METHOD_CANCEL);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_CANCEL);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
- response = s2_wait_for_response(487, SIP_METHOD_INVITE);
- fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+ response = s2_sip_wait_for_response(487, SIP_METHOD_INVITE);
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
TAG_END()));
@@ -1082,7 +1082,7 @@
struct message *invite, *ack;
fail_unless(s2_check_callstate(nua_callstate_calling));
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
process_offer(invite);
respond_with_sdp(
invite, dialog, SIP_200_OK,
@@ -1090,12 +1090,12 @@
SIPTAG_REQUIRE_STR("timer"),
SIPTAG_RECORD_ROUTE(rr),
TAG_END());
- s2_free_message(invite);
+ s2_sip_free_message(invite);
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
if (rr == NULL)
- s2_free_message(ack);
+ s2_sip_free_message(ack);
return ack;
}
@@ -1106,7 +1106,7 @@
struct message *ack;
sip_record_route_init(rr);
- *rr->r_url = *s2->contact->m_url;
+ *rr->r_url = *s2sip->contact->m_url;
rr->r_url->url_user = "record";
rr->r_url->url_params = "lr";
@@ -1121,11 +1121,11 @@
SIPTAG_REQUIRE_STR("timer"),
TAG_END());
- s2_fast_forward(300, s2->root);
+ s2_nua_fast_forward(300, s2base->root);
ack = invite_timer_round(nh, "300;refresher=uac", rr);
fail_if(ack->sip->sip_route &&
su_strmatch(ack->sip->sip_route->r_url->url_user, "record"));
- s2_fast_forward(300, s2->root);
+ s2_nua_fast_forward(300, s2base->root);
invite_timer_round(nh, "300;refresher=uac", NULL);
bye_by_nua(nh, TAG_END());
@@ -1149,9 +1149,9 @@
SIPTAG_REQUIRE_STR("timer"),
TAG_END());
- s2_fast_forward(300, s2->root);
+ s2_nua_fast_forward(300, s2base->root);
invite_timer_round(nh, "300", NULL);
- s2_fast_forward(300, s2->root);
+ s2_nua_fast_forward(300, s2base->root);
invite_timer_round(nh, "300", NULL);
bye_by_nua(nh, TAG_END());
@@ -1190,11 +1190,11 @@
"receives 200, send ACK.");
sip_record_route_init(rr);
- *rr->r_url = *s2->contact->m_url;
+ *rr->r_url = *s2sip->contact->m_url;
rr->r_url->url_user = "record";
rr->r_url->url_params = "lr";
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(
nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
@@ -1205,8 +1205,8 @@
SIP_183_SESSION_PROGRESS,
SIPTAG_RECORD_ROUTE(rr),
TAG_END());
- s2_respond_to(prack, dialog, SIP_200_OK, TAG_END());
- s2_free_message(prack), prack = NULL;
+ 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(s2_check_event(nua_r_prack, 200));
@@ -1216,23 +1216,23 @@
fail_unless(prack->sip->sip_route != NULL);
fail_unless(su_strmatch(prack->sip->sip_route->r_url->url_user, "record"));
- s2_respond_to(prack, dialog, SIP_200_OK, TAG_END());
- s2_free_message(prack), prack = NULL;
+ 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(s2_check_event(nua_r_prack, 200));
/* Change the record-route */
rr->r_url->url_user = "record2";
- s2_respond_to(invite, dialog, SIP_200_OK,
+ s2_sip_respond_to(invite, dialog, SIP_200_OK,
SIPTAG_RECORD_ROUTE(rr),
TAG_END());
- s2_free_message(invite);
+ s2_sip_free_message(invite);
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
fail_if(!ack);
fail_unless(su_strmatch(ack->sip->sip_route->r_url->url_user, "record2"));
- s2_free_message(ack);
+ s2_sip_free_message(ack);
bye_to_nua(nh, TAG_END());
@@ -1252,7 +1252,7 @@
"receives 180, sends PRACK, receives 200 for it, "
"receives 200, send ACK.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(
nh,
@@ -1269,24 +1269,24 @@
prack = respond_with_100rel(invite, dialog, with_sdp = 0,
SIP_183_SESSION_PROGRESS,
TAG_END());
- s2_respond_to(prack, dialog, SIP_200_OK, TAG_END());
- s2_free_message(prack), prack = NULL;
+ 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(s2_check_event(nua_r_prack, 200));
prack = respond_with_100rel(invite, dialog, with_sdp = 0,
SIP_180_RINGING,
TAG_END());
- s2_respond_to(prack, dialog, SIP_200_OK, TAG_END());
- s2_free_message(prack), prack = NULL;
+ 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(s2_check_event(nua_r_prack, 200));
- s2_respond_to(invite, dialog, SIP_200_OK, TAG_END());
- s2_free_message(invite);
+ s2_sip_respond_to(invite, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(invite);
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
bye_to_nua(nh, TAG_END());
@@ -1321,7 +1321,7 @@
"receives 180, sends PRACK, receives 200 for it, "
"receives 200, send ACK.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(
nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
@@ -1338,11 +1338,11 @@
prack, dialog, SIP_200_OK,
SIPTAG_REQUIRE_STR("100rel"),
TAG_END());
- s2_free_message(prack), prack = NULL;
+ s2_sip_free_message(prack), prack = NULL;
fail_unless(s2_check_event(nua_r_prack, 200));
fail_unless(s2_check_callstate(nua_callstate_proceeding));
- update = s2_wait_for_request(SIP_METHOD_UPDATE);
+ update = s2_sip_wait_for_request(SIP_METHOD_UPDATE);
/* UPDATE sent by stack, stack sends event for it */
fail_unless(s2_check_callstate(nua_callstate_proceeding));
@@ -1350,7 +1350,7 @@
respond_with_sdp(
update, dialog, SIP_200_OK,
TAG_END());
- s2_free_message(update), update = NULL;
+ s2_sip_free_message(update), update = NULL;
fail_unless(s2_check_event(nua_r_update, 200));
fail_unless(s2_check_callstate(nua_callstate_proceeding));
@@ -1358,16 +1358,16 @@
prack = respond_with_100rel(invite, dialog, with_sdp = 0,
SIP_180_RINGING,
TAG_END());
- s2_respond_to(prack, dialog, SIP_200_OK, TAG_END());
- s2_free_message(prack), prack = NULL;
+ 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(s2_check_event(nua_r_prack, 200));
- s2_respond_to(invite, dialog, SIP_200_OK, TAG_END());
- s2_free_message(invite);
+ s2_sip_respond_to(invite, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(invite);
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
bye_to_nua(nh, TAG_END());
@@ -1391,7 +1391,7 @@
"sends UPDATE, "
"receives 200 to UPDATE.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(
nh,
@@ -1416,24 +1416,24 @@
rack->ra_method_name = invite->sip->sip_cseq->cs_method_name;
nua_prack(nh, SIPTAG_RACK(rack), TAG_END());
- prack = s2_wait_for_request(SIP_METHOD_PRACK);
+ prack = s2_sip_wait_for_request(SIP_METHOD_PRACK);
process_offer(prack);
- s2_respond_to(invite, dialog, SIP_200_OK, TAG_END());
- s2_free_message(invite);
+ s2_sip_respond_to(invite, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(invite);
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_completing));
respond_with_sdp(
prack, dialog, SIP_200_OK,
TAG_END());
- s2_free_message(prack), prack = NULL;
+ s2_sip_free_message(prack), prack = NULL;
fail_unless(s2_check_event(nua_r_prack, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
- update = s2_wait_for_request(SIP_METHOD_UPDATE);
+ update = s2_sip_wait_for_request(SIP_METHOD_UPDATE);
/* UPDATE sent by stack, stack sends event for it */
fail_unless(s2_check_callstate(nua_callstate_calling));
@@ -1441,7 +1441,7 @@
respond_with_sdp(
update, dialog, SIP_200_OK,
TAG_END());
- s2_free_message(update), update = NULL;
+ s2_sip_free_message(update), update = NULL;
fail_unless(s2_check_event(nua_r_update, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
@@ -1467,7 +1467,7 @@
"receives 200 to UPDATE, "
"sends ACK.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(
nh,
@@ -1492,21 +1492,21 @@
rack->ra_method_name = invite->sip->sip_cseq->cs_method_name;
nua_prack(nh, SIPTAG_RACK(rack), TAG_END());
- prack = s2_wait_for_request(SIP_METHOD_PRACK);
+ prack = s2_sip_wait_for_request(SIP_METHOD_PRACK);
process_offer(prack);
respond_with_sdp(
prack, dialog, SIP_200_OK,
TAG_END());
- s2_free_message(prack), prack = NULL;
+ s2_sip_free_message(prack), prack = NULL;
fail_unless(s2_check_event(nua_r_prack, 200));
fail_unless(s2_check_callstate(nua_callstate_proceeding));
- update = s2_wait_for_request(SIP_METHOD_UPDATE);
+ update = s2_sip_wait_for_request(SIP_METHOD_UPDATE);
/* UPDATE sent by stack, stack sends event for it */
fail_unless(s2_check_callstate(nua_callstate_proceeding));
- s2_respond_to(invite, dialog, SIP_200_OK, TAG_END());
- s2_free_message(invite);
+ s2_sip_respond_to(invite, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(invite);
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_completing));
@@ -1514,11 +1514,11 @@
respond_with_sdp(
update, dialog, SIP_200_OK,
TAG_END());
- s2_free_message(update), update = NULL;
+ s2_sip_free_message(update), update = NULL;
fail_unless(s2_check_event(nua_r_update, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
bye_to_nua(nh, TAG_END());
@@ -1560,15 +1560,15 @@
for (i = 0; i < 2; i++) {
fail_unless(s2_check_callstate(nua_callstate_calling));
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
fail_if(!invite);
process_offer(invite);
respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
- s2_free_message(invite);
+ s2_sip_free_message(invite);
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
fail_if(!ack);
- s2_free_message(ack);
+ s2_sip_free_message(ack);
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
@@ -1597,40 +1597,40 @@
soa_generate_offer(soa, 1, NULL);
request_with_sdp(dialog, SIP_METHOD_INVITE, NULL, TAG_END());
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
fail_if(!invite);
respond_with_sdp(invite, dialog, SIP_500_INTERNAL_SERVER_ERROR,
SIPTAG_RETRY_AFTER_STR("8"),
TAG_END());
- s2_free_message(invite);
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ s2_sip_free_message(invite);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
fail_if(!ack);
- s2_free_message(ack);
+ s2_sip_free_message(ack);
- response = s2_wait_for_response(491, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(491, SIP_METHOD_INVITE);
fail_if(!response);
- fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
TAG_END()));
- s2_free_message(response);
+ s2_sip_free_message(response);
fail_if(soa_process_reject(soa, NULL) < 0);
/* We get nua_r_invite with 100 trying (and 500 in sip->sip_status) */
fail_unless(s2_check_event(nua_r_invite, 100));
- s2_fast_forward(10, s2->root);
+ s2_nua_fast_forward(10, s2base->root);
fail_unless(s2_check_callstate(nua_callstate_calling));
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
process_offer(invite);
respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
fail_if(!ack);
- s2_free_message(ack);
+ s2_sip_free_message(ack);
bye_by_nua(nh, TAG_END());
@@ -1652,7 +1652,7 @@
nh = invite_to_nua(
TAG_END());
- s2_request_to(dialog, SIP_METHOD_INVITE, NULL,
+ s2_sip_request_to(dialog, SIP_METHOD_INVITE, NULL,
SIPTAG_USER_AGENT_STR("evil (evil) evil"),
TAG_END());
@@ -1660,24 +1660,24 @@
fail_unless(s2_check_callstate(nua_callstate_completed));
- response = s2_wait_for_response(200, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
fail_if(!response);
- s2_update_dialog(dialog, response);
+ s2_sip_update_dialog(dialog, response);
fail_if(!response->sip->sip_content_type);
- s2_free_message(response);
+ s2_sip_free_message(response);
- fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
fail_unless(s2_check_event(nua_i_ack, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
- s2_fast_forward(10, s2->root);
+ s2_nua_fast_forward(10, s2base->root);
nua_set_hparams(nh, NUTAG_REFRESH_WITHOUT_SDP(1), TAG_END());
fail_unless(s2_check_event(nua_r_set_params, 200));
- s2_request_to(dialog, SIP_METHOD_INVITE, NULL,
+ s2_sip_request_to(dialog, SIP_METHOD_INVITE, NULL,
SIPTAG_USER_AGENT_STR("evil (evil) evil"),
TAG_END());
@@ -1685,14 +1685,14 @@
fail_unless(s2_check_callstate(nua_callstate_completed));
- response = s2_wait_for_response(200, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
fail_if(!response);
- s2_update_dialog(dialog, response);
+ s2_sip_update_dialog(dialog, response);
fail_if(response->sip->sip_content_type);
- s2_free_message(response);
+ s2_sip_free_message(response);
- fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
fail_unless(s2_check_event(nua_i_ack, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
@@ -1719,17 +1719,17 @@
nua_invite(nh, SIPTAG_PAYLOAD_STR(""), TAG_END());
fail_unless(s2_check_callstate(nua_callstate_calling));
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
fail_if(!invite);
fail_if(invite->sip->sip_content_type);
soa_generate_offer(soa, 1, NULL);
respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
- s2_free_message(invite);
+ s2_sip_free_message(invite);
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
fail_if(!ack);
process_answer(ack);
- s2_free_message(ack);
+ s2_sip_free_message(ack);
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
@@ -1764,7 +1764,7 @@
struct message *invite, *ack;
s2_case("3.1.1", "Call failure", "Call fails with 403 response");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local),
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor),
TAG_END());
nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
@@ -1772,17 +1772,17 @@
fail_unless(s2_check_callstate(nua_callstate_calling));
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
fail_if(!invite);
- s2_respond_to(invite, NULL, SIP_403_FORBIDDEN,
+ s2_sip_respond_to(invite, NULL, SIP_403_FORBIDDEN,
SIPTAG_TO_STR("UAS Changed <sip:To@Header.field.invalid>"),
TAG_END());
- s2_free_message(invite);
+ s2_sip_free_message(invite);
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
fail_if(!ack);
fail_if(strcmp(ack->sip->sip_to->a_display, "UAS Changed"));
- s2_free_message(ack);
+ s2_sip_free_message(ack);
fail_unless(s2_check_event(nua_r_invite, 403));
fail_unless(s2_check_callstate(nua_callstate_terminated));
@@ -1800,7 +1800,7 @@
s2_case("3.1.2", "Call fails after too many retries",
"Call fails after 4 times 500 Retry-After");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local),
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor),
NUTAG_RETRY_COUNT(3),
TAG_END());
@@ -1809,17 +1809,17 @@
for (i = 0;; i++) {
fail_unless(s2_check_callstate(nua_callstate_calling));
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
fail_if(!invite);
- s2_respond_to(invite, NULL, SIP_500_INTERNAL_SERVER_ERROR,
+ s2_sip_respond_to(invite, NULL, SIP_500_INTERNAL_SERVER_ERROR,
SIPTAG_RETRY_AFTER_STR("5"),
TAG_END());
- s2_free_message(invite);
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ s2_sip_free_message(invite);
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
if (i == 3)
break;
fail_unless(s2_check_event(nua_r_invite, 100));
- s2_fast_forward(5, s2->root);
+ s2_nua_fast_forward(5, s2base->root);
}
fail_unless(s2_check_event(nua_r_invite, 500));
@@ -1835,7 +1835,7 @@
struct message *invite;
s2_case("3.2.1", "Re-INVITE failure", "Re-INVITE fails with 403 response");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local),
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor),
TAG_END());
invite_by_nua(nh, TAG_END());
@@ -1844,12 +1844,12 @@
fail_unless(s2_check_callstate(nua_callstate_calling));
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
fail_if(!invite);
- s2_respond_to(invite, NULL, SIP_403_FORBIDDEN, TAG_END());
- s2_free_message(invite);
+ s2_sip_respond_to(invite, NULL, SIP_403_FORBIDDEN, TAG_END());
+ s2_sip_free_message(invite);
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
fail_unless(s2_check_event(nua_r_invite, 403));
/* Return to previous state */
fail_unless(s2_check_callstate(nua_callstate_ready));
@@ -1868,7 +1868,7 @@
s2_case("3.2.2", "Re-INVITE fails after too many retries",
"Call fails after 4 times 500 Retry-After");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local),
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor),
NUTAG_RETRY_COUNT(3),
TAG_END());
@@ -1879,26 +1879,26 @@
for (i = 0;; i++) {
fail_unless(s2_check_callstate(nua_callstate_calling));
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
fail_if(!invite);
- s2_respond_to(invite, NULL, SIP_500_INTERNAL_SERVER_ERROR,
+ s2_sip_respond_to(invite, NULL, SIP_500_INTERNAL_SERVER_ERROR,
SIPTAG_RETRY_AFTER_STR("5"),
TAG_END());
- s2_free_message(invite);
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ s2_sip_free_message(invite);
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
if (i == 3)
break;
fail_unless(s2_check_event(nua_r_invite, 100));
- s2_fast_forward(5, s2->root);
+ s2_nua_fast_forward(5, s2base->root);
}
fail_unless(s2_check_event(nua_r_invite, 500));
/* Graceful termination */
fail_unless(s2_check_callstate(nua_callstate_terminating));
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
@@ -1913,7 +1913,7 @@
struct message *invite;
s2_case("3.2.3", "Re-INVITE failure", "Re-INVITE fails with 491 response");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local),
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor),
TAG_END());
invite_by_nua(nh, TAG_END());
@@ -1922,11 +1922,11 @@
fail_unless(s2_check_callstate(nua_callstate_calling));
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
fail_if(!invite);
- s2_respond_to(invite, NULL, SIP_491_REQUEST_PENDING, TAG_END());
- s2_free_message(invite);
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ s2_sip_respond_to(invite, NULL, SIP_491_REQUEST_PENDING, TAG_END());
+ s2_sip_free_message(invite);
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
fail_unless(s2_check_event(nua_r_invite, 491));
/* Return to previous state */
fail_unless(s2_check_callstate(nua_callstate_ready));
@@ -1971,12 +1971,12 @@
nua_bye(nh, TAG_END());
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
+ s2_sip_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
TAG_END());
- s2_free_message(bye);
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 407));
soa_generate_offer(soa, 1, NULL);
@@ -1984,11 +1984,11 @@
request_with_sdp(dialog, SIP_METHOD_INVITE, NULL, TAG_END());
do {
- r481 = s2_wait_for_response(0, SIP_METHOD_INVITE);
+ r481 = s2_sip_wait_for_response(0, SIP_METHOD_INVITE);
}
while (r481->sip->sip_status->st_status < 200);
- s2_update_dialog(dialog, r481); /* send ACK */
+ s2_sip_update_dialog(dialog, r481); /* send ACK */
fail_unless(s2_check_callstate(nua_callstate_terminated));
@@ -2010,22 +2010,22 @@
s2_flush_events();
nua_bye(nh, TAG_END());
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
request_with_sdp(dialog, SIP_METHOD_INVITE, NULL, TAG_END());
do {
- r481 = s2_wait_for_response(0, SIP_METHOD_INVITE);
+ r481 = s2_sip_wait_for_response(0, SIP_METHOD_INVITE);
}
while (r481->sip->sip_status->st_status < 200);
- s2_update_dialog(dialog, r481); /* send ACK */
+ s2_sip_update_dialog(dialog, r481); /* send ACK */
fail_unless(s2_check_callstate(nua_callstate_terminated));
- s2_respond_to(bye, dialog, SIP_200_OK,
+ s2_sip_respond_to(bye, dialog, SIP_200_OK,
TAG_END());
- s2_free_message(bye);
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 200));
nua_handle_destroy(nh);
@@ -2051,22 +2051,22 @@
s2_flush_events();
nua_bye(nh, TAG_END());
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+ s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
i_bye = s2_wait_for_event(nua_i_bye, 100);
fail_if(!i_bye);
nua_respond(nh, 200, "OKOK", NUTAG_WITH(i_bye->data->e_msg), TAG_END());
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
- fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+ fail_unless(s2_sip_check_response(200, SIP_METHOD_BYE));
nua_handle_destroy(nh);
}
@@ -2089,23 +2089,23 @@
fail_unless(s2_check_event(nua_r_set_params, 200));
s2_flush_events();
- s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+ s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
i_bye = s2_wait_for_event(nua_i_bye, 100);
fail_if(!i_bye);
nua_bye(nh, TAG_END());
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
nua_respond(nh, 200, "OKOK", NUTAG_WITH(i_bye->data->e_msg), TAG_END());
- fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+ fail_unless(s2_sip_check_response(200, SIP_METHOD_BYE));
nua_handle_destroy(nh);
}
@@ -2128,23 +2128,23 @@
fail_unless(s2_check_event(nua_r_set_params, 200));
s2_flush_events();
- s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+ s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
i_bye = s2_wait_for_event(nua_i_bye, 100);
fail_if(!i_bye);
nua_bye(nh, TAG_END());
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
nua_handle_destroy(nh);
- fail_unless(s2_check_response(500, SIP_METHOD_BYE));
+ fail_unless(s2_sip_check_response(500, SIP_METHOD_BYE));
}
END_TEST
@@ -2165,22 +2165,22 @@
s2_flush_events();
request_with_sdp(dialog, SIP_METHOD_INVITE, NULL, TAG_END());
- fail_unless(s2_check_response(100, SIP_METHOD_INVITE));
+ fail_unless(s2_sip_check_response(100, SIP_METHOD_INVITE));
nua_bye(nh, TAG_END());
fail_unless(s2_check_event(nua_i_invite, 100));
fail_unless(s2_check_callstate(nua_callstate_received));
do {
- r486 = s2_wait_for_response(0, SIP_METHOD_INVITE);
+ r486 = s2_sip_wait_for_response(0, SIP_METHOD_INVITE);
}
while (r486->sip->sip_status->st_status < 200);
- s2_update_dialog(dialog, r486); /* send ACK */
+ s2_sip_update_dialog(dialog, r486); /* send ACK */
fail_unless(r486->sip->sip_status->st_status == 486);
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
nua_handle_destroy(nh);
}
@@ -2203,21 +2203,21 @@
s2_flush_events();
request_with_sdp(dialog, SIP_METHOD_INVITE, NULL, TAG_END());
- fail_unless(s2_check_response(100, SIP_METHOD_INVITE));
+ fail_unless(s2_sip_check_response(100, SIP_METHOD_INVITE));
nua_bye(nh, TAG_END());
fail_unless(s2_check_event(nua_i_invite, 100));
fail_unless(s2_check_callstate(nua_callstate_received));
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
do {
- r486 = s2_wait_for_response(0, SIP_METHOD_INVITE);
+ r486 = s2_sip_wait_for_response(0, SIP_METHOD_INVITE);
}
while (r486->sip->sip_status->st_status < 200);
- s2_update_dialog(dialog, r486); /* send ACK */
+ s2_sip_update_dialog(dialog, r486); /* send ACK */
fail_unless(r486->sip->sip_status->st_status == 486);
nua_handle_destroy(nh);
@@ -2232,14 +2232,14 @@
s2_case("4.1.8", "BYE followed by response to INVITE",
"NUA receives INVITE, sends BYE at same time");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite_by_nua(nh, NUTAG_AUTOANSWER(0), TAG_END());
s2_flush_events();
request_with_sdp(dialog, SIP_METHOD_INVITE, NULL, TAG_END());
- fail_unless(s2_check_response(100, SIP_METHOD_INVITE));
+ fail_unless(s2_sip_check_response(100, SIP_METHOD_INVITE));
nua_bye(nh, TAG_END());
fail_unless(s2_check_event(nua_i_invite, 100));
fail_unless(s2_check_callstate(nua_callstate_received));
@@ -2247,16 +2247,16 @@
nua_respond(nh, SIP_486_BUSY_HERE, TAG_END());
do {
- r486 = s2_wait_for_response(0, SIP_METHOD_INVITE);
+ r486 = s2_sip_wait_for_response(0, SIP_METHOD_INVITE);
}
while (r486->sip->sip_status->st_status < 200);
- s2_update_dialog(dialog, r486); /* send ACK */
+ s2_sip_update_dialog(dialog, r486); /* send ACK */
fail_unless(r486->sip->sip_status->st_status == 486);
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
nua_handle_destroy(nh);
}
@@ -2279,29 +2279,29 @@
s2_flush_events();
nua_bye(nh, TAG_END());
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+ s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
i_bye = s2_wait_for_event(nua_i_bye, 200);
fail_if(!i_bye);
s2_free_event(i_bye), i_bye = NULL;
fail_unless(s2_check_callstate(nua_callstate_terminated));
- fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+ fail_unless(s2_sip_check_response(200, SIP_METHOD_BYE));
nua_handle_destroy(nh);
mark_point();
- su_root_step(s2->root, 10);
- su_root_step(s2->root, 10);
- su_root_step(s2->root, 10);
+ su_root_step(s2base->root, 10);
+ su_root_step(s2base->root, 10);
+ su_root_step(s2base->root, 10);
mark_point();
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
mark_point();
while (su_home_check_alloc((su_home_t *)nua, (void *)nh)) {
- su_root_step(s2->root, 10);
+ su_root_step(s2base->root, 10);
}
}
END_TEST
@@ -2323,37 +2323,37 @@
s2_flush_events();
nua_invite(nh, TAG_END());
- invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
fail_if(!invite);
- s2_respond_to(invite, dialog, SIP_501_NOT_IMPLEMENTED, TAG_END());
- s2_free_message(invite);
+ s2_sip_respond_to(invite, dialog, SIP_501_NOT_IMPLEMENTED, TAG_END());
+ s2_sip_free_message(invite);
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
fail_unless(s2_check_callstate(nua_callstate_calling));
fail_unless(s2_check_event(nua_r_invite, 501));
fail_unless(s2_check_callstate(nua_callstate_terminating));
- s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+ s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
i_bye = s2_wait_for_event(nua_i_bye, 200);
fail_if(!i_bye);
s2_free_event(i_bye), i_bye = NULL;
fail_unless(s2_check_callstate(nua_callstate_terminated));
- fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+ fail_unless(s2_sip_check_response(200, SIP_METHOD_BYE));
nua_handle_destroy(nh);
- su_root_step(s2->root, 10);
- su_root_step(s2->root, 10);
- su_root_step(s2->root, 10);
+ su_root_step(s2base->root, 10);
+ su_root_step(s2base->root, 10);
+ su_root_step(s2base->root, 10);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
while (su_home_check_alloc((su_home_t *)nua, (void *)nh)) {
- su_root_step(s2->root, 10);
+ su_root_step(s2base->root, 10);
}
}
END_TEST
@@ -2367,29 +2367,29 @@
s2_case("4.1.11", "Receive BYE in completing state",
"NUA sends INVITE, receives 200, receives BYE.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(nh, NUTAG_AUTOACK(0), TAG_END());
process_offer(invite);
- s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+ s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
fail_unless(s2_check_event(nua_r_invite, 180));
fail_unless(s2_check_callstate(nua_callstate_proceeding));
respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
- s2_free_message(invite);
+ s2_sip_free_message(invite);
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_completing));
- s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+ s2_sip_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
i_bye = s2_wait_for_event(nua_i_bye, 200);
fail_if(!i_bye);
s2_free_event(i_bye), i_bye = NULL;
fail_unless(s2_check_callstate(nua_callstate_terminated));
- fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+ fail_unless(s2_sip_check_response(200, SIP_METHOD_BYE));
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
fail_if(!ack);
- s2_free_message(ack);
+ s2_sip_free_message(ack);
nua_handle_destroy(nh);
}
@@ -2411,26 +2411,26 @@
SIPTAG_REQUIRE_STR("timer"),
TAG_END());
- s2_fast_forward(300, s2->root);
+ s2_nua_fast_forward(300, s2base->root);
invite_timer_round(nh, "300", NULL);
nua_bye(nh, TAG_END());
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
+ s2_sip_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
TAG_END());
- s2_free_message(bye);
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 407));
- s2_fast_forward(300, s2->root);
+ s2_nua_fast_forward(300, s2base->root);
nua_authenticate(nh, NUTAG_AUTH("Digest:\"s2test\":abc:abc"), TAG_END());
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
fail_if(s2->events);
@@ -2455,28 +2455,28 @@
SIPTAG_REQUIRE_STR("timer"),
TAG_END());
- s2_fast_forward(300, s2->root);
+ s2_nua_fast_forward(300, s2base->root);
invite_timer_round(nh, "300", NULL);
- s2_fast_forward(140, s2->root);
+ s2_nua_fast_forward(140, s2base->root);
nua_bye(nh, TAG_END());
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
+ s2_sip_respond_to(bye, dialog, SIP_407_PROXY_AUTH_REQUIRED,
SIPTAG_PROXY_AUTHENTICATE_STR(s2_auth_digest_str),
TAG_END());
- s2_free_message(bye);
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 407));
- s2_fast_forward(160, s2->root);
+ s2_nua_fast_forward(160, s2base->root);
nua_authenticate(nh, NUTAG_AUTH(s2_auth_credentials), TAG_END());
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 200));
fail_unless(s2_check_callstate(nua_callstate_terminated));
fail_if(s2->events);
@@ -2518,22 +2518,22 @@
s2_case("4.3.1", "Destroy handle after INVITE sent",
"NUA sends INVITE, handle gets destroyed.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(nh, TAG_END());
process_offer(invite);
nua_handle_destroy(nh);
- s2_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
+ s2_sip_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
- cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+ cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
fail_if(!cancel);
- s2_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
- s2_free_message(invite);
+ s2_sip_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
+ s2_sip_free_message(invite);
- s2_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
- s2_free_message(cancel);
+ s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(cancel);
}
END_TEST
@@ -2546,23 +2546,23 @@
s2_case("4.3.2", "Destroy handle in calling state",
"NUA sends INVITE, receives 180, handle gets destroyed.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(nh, TAG_END());
process_offer(invite);
- s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+ s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
fail_unless(s2_check_event(nua_r_invite, 180));
fail_unless(s2_check_callstate(nua_callstate_proceeding));
nua_handle_destroy(nh);
- cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+ cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
fail_if(!cancel);
- s2_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
- s2_free_message(invite);
+ s2_sip_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
+ s2_sip_free_message(invite);
- s2_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
- s2_free_message(cancel);
+ s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(cancel);
}
END_TEST
@@ -2574,11 +2574,11 @@
s2_case("4.3.3", "Destroy handle in completing state",
"NUA sends INVITE, receives 200, handle gets destroyed.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(nh, NUTAG_AUTOACK(0), TAG_END());
process_offer(invite);
- s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+ s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
fail_unless(s2_check_event(nua_r_invite, 180));
fail_unless(s2_check_callstate(nua_callstate_proceeding));
@@ -2588,16 +2588,16 @@
nua_handle_destroy(nh);
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
fail_if(!ack);
- s2_free_message(ack);
+ s2_sip_free_message(ack);
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
- s2_free_message(invite);
+ s2_sip_free_message(invite);
}
END_TEST
@@ -2610,11 +2610,11 @@
s2_case("4.3.3", "Destroy handle in ready state ",
"NUA sends INVITE, receives 200, handle gets destroyed.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(nh, NUTAG_AUTOACK(0), TAG_END());
process_offer(invite);
- s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+ s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
fail_unless(s2_check_event(nua_r_invite, 180));
fail_unless(s2_check_callstate(nua_callstate_proceeding));
@@ -2623,20 +2623,20 @@
fail_unless(s2_check_callstate(nua_callstate_completing));
nua_ack(nh, TAG_END());
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
fail_if(!ack);
- s2_free_message(ack);
+ s2_sip_free_message(ack);
fail_unless(s2_check_callstate(nua_callstate_ready));
nua_handle_destroy(nh);
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
- s2_free_message(invite);
+ s2_sip_free_message(invite);
}
END_TEST
@@ -2656,15 +2656,15 @@
nua_handle_destroy(nh);
- s2_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
+ s2_sip_respond_to(invite, dialog, SIP_100_TRYING, TAG_END());
- cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+ cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
fail_if(!cancel);
- s2_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
- s2_free_message(invite);
+ s2_sip_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
+ s2_sip_free_message(invite);
- s2_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
- s2_free_message(cancel);
+ s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(cancel);
}
END_TEST
@@ -2681,19 +2681,19 @@
invite = invite_sent_by_nua(nh, TAG_END());
process_offer(invite);
- s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+ s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
fail_unless(s2_check_event(nua_r_invite, 180));
fail_unless(s2_check_callstate(nua_callstate_proceeding));
nua_handle_destroy(nh);
- cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+ cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
fail_if(!cancel);
- s2_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
- s2_free_message(invite);
+ s2_sip_respond_to(invite, dialog, SIP_487_REQUEST_CANCELLED, TAG_END());
+ s2_sip_free_message(invite);
- s2_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
- s2_free_message(cancel);
+ s2_sip_respond_to(cancel, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(cancel);
}
END_TEST
@@ -2710,7 +2710,7 @@
invite = invite_sent_by_nua(nh, NUTAG_AUTOACK(0), TAG_END());
process_offer(invite);
- s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+ s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
fail_unless(s2_check_event(nua_r_invite, 180));
fail_unless(s2_check_callstate(nua_callstate_proceeding));
@@ -2720,16 +2720,16 @@
nua_handle_destroy(nh);
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
fail_if(!ack);
- s2_free_message(ack);
+ s2_sip_free_message(ack);
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
- s2_free_message(invite);
+ s2_sip_free_message(invite);
}
END_TEST
@@ -2739,15 +2739,12 @@
nua_handle_t *nh;
struct message *invite, *ack, *bye;
- tport_set_params(s2->master, TPTAG_LOG(1), TAG_END());
- s2_setup_logs(7);
-
s2_case("4.3.8", "Destroy handle after INVITE sent",
"NUA sends INVITE, handle gets destroyed, "
"but remote end returns 200 OK. "
"Make sure nua tries to release call properly.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(nh, TAG_END());
process_offer(invite);
@@ -2755,16 +2752,16 @@
nua_handle_destroy(nh);
respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
- s2_free_message(invite);
+ s2_sip_free_message(invite);
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
fail_if(!ack);
- s2_free_message(ack);
+ s2_sip_free_message(ack);
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
}
END_TEST
@@ -2774,40 +2771,37 @@
nua_handle_t *nh;
struct message *invite, *cancel, *ack, *bye;
- tport_set_params(s2->master, TPTAG_LOG(1), TAG_END());
- s2_setup_logs(7);
-
s2_case("4.3.9", "Destroy handle in calling state",
"NUA sends INVITE, receives 180, handle gets destroyed, "
"but remote end returns 200 OK. "
"Make sure nua tries to release call properly.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite = invite_sent_by_nua(nh, TAG_END());
process_offer(invite);
- s2_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
+ s2_sip_respond_to(invite, dialog, SIP_180_RINGING, TAG_END());
fail_unless(s2_check_event(nua_r_invite, 180));
fail_unless(s2_check_callstate(nua_callstate_proceeding));
nua_handle_destroy(nh);
- cancel = s2_wait_for_request(SIP_METHOD_CANCEL);
+ cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
fail_if(!cancel);
- s2_respond_to(cancel, dialog, SIP_481_NO_TRANSACTION, TAG_END());
- s2_free_message(cancel);
+ s2_sip_respond_to(cancel, dialog, SIP_481_NO_TRANSACTION, TAG_END());
+ s2_sip_free_message(cancel);
respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
- s2_free_message(invite);
+ s2_sip_free_message(invite);
- ack = s2_wait_for_request(SIP_METHOD_ACK);
+ ack = s2_sip_wait_for_request(SIP_METHOD_ACK);
fail_if(!ack);
- s2_free_message(ack);
+ s2_sip_free_message(ack);
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
}
END_TEST
@@ -2831,18 +2825,18 @@
s2_free_event(invite);
- response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
nua_handle_destroy(nh);
- response = s2_wait_for_response(480, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(480, SIP_METHOD_INVITE);
fail_if(!response);
- fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
TAG_END()));
- s2_free_message(response);
+ s2_sip_free_message(response);
}
END_TEST
@@ -2866,24 +2860,24 @@
s2_free_event(invite);
- response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
nua_respond(nh, SIP_180_RINGING, TAG_END());
- response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
nua_handle_destroy(nh);
- response = s2_wait_for_response(480, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(480, SIP_METHOD_INVITE);
fail_if(!response);
- fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
TAG_END()));
- s2_free_message(response);
+ s2_sip_free_message(response);
}
END_TEST
@@ -2907,37 +2901,37 @@
s2_free_event(invite);
- response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
nua_respond(nh, SIP_180_RINGING,
SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
TAG_END());
- response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
fail_unless(s2_check_callstate(nua_callstate_early));
nua_respond(nh, SIP_200_OK, TAG_END());
fail_unless(s2_check_callstate(nua_callstate_completed));
- response = s2_wait_for_response(200, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
fail_if(!response);
nua_handle_destroy(nh);
- fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
TAG_END()));
- s2_free_message(response);
+ s2_sip_free_message(response);
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
}
END_TEST
@@ -2961,37 +2955,37 @@
s2_free_event(invite);
- response = s2_wait_for_response(100, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(100, SIP_METHOD_INVITE);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
nua_respond(nh, SIP_180_RINGING,
SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
TAG_END());
- response = s2_wait_for_response(180, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(180, SIP_METHOD_INVITE);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
fail_unless(s2_check_callstate(nua_callstate_early));
nua_respond(nh, SIP_200_OK, TAG_END());
fail_unless(s2_check_callstate(nua_callstate_completed));
- response = s2_wait_for_response(200, SIP_METHOD_INVITE);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_INVITE);
fail_if(!response);
nua_handle_destroy(nh);
- bye = s2_wait_for_request(SIP_METHOD_BYE);
+ bye = s2_sip_wait_for_request(SIP_METHOD_BYE);
fail_if(!bye);
- s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
- s2_free_message(bye);
+ s2_sip_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_sip_free_message(bye);
- fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL,
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_ACK, NULL,
SIPTAG_VIA(sip_object(dialog->invite)->sip_via),
TAG_END()));
- s2_free_message(response);
+ s2_sip_free_message(response);
}
END_TEST
@@ -3037,23 +3031,23 @@
s2_case("5.1.1", "Test nua_respond() API",
"Test nua_respond() API with OPTIONS.");
- s2_request_to(dialog, SIP_METHOD_OPTIONS, NULL, TAG_END());
+ s2_sip_request_to(dialog, SIP_METHOD_OPTIONS, NULL, TAG_END());
options = s2_wait_for_event(nua_i_options, 200);
fail_unless(options != NULL);
nh = options->nh; fail_if(!nh);
- response = s2_wait_for_response(200, SIP_METHOD_OPTIONS);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_OPTIONS);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
nua_handle_destroy(nh);
nua_set_params(nua, NUTAG_APPL_METHOD("OPTIONS"), TAG_END());
fail_unless(s2_check_event(nua_r_set_params, 200));
- s2_request_to(dialog, SIP_METHOD_OPTIONS, NULL, TAG_END());
+ s2_sip_request_to(dialog, SIP_METHOD_OPTIONS, NULL, TAG_END());
options = s2_wait_for_event(nua_i_options, 100);
fail_unless(options != NULL);
@@ -3061,9 +3055,9 @@
nua_respond(nh, 202, "okok", NUTAG_WITH_SAVED(options->event), TAG_END());
- response = s2_wait_for_response(202, SIP_METHOD_OPTIONS);
+ response = s2_sip_wait_for_response(202, SIP_METHOD_OPTIONS);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
nua_handle_destroy(nh);
}
@@ -3099,7 +3093,7 @@
nua_set_params(nua, NUTAG_APPL_METHOD("OPTIONS"), TAG_END());
fail_unless(s2_check_event(nua_r_set_params, 200));
- s2_request_to(dialog, SIP_METHOD_OPTIONS, NULL, TAG_END());
+ s2_sip_request_to(dialog, SIP_METHOD_OPTIONS, NULL, TAG_END());
options = s2_wait_for_event(nua_i_options, 100);
fail_unless(options != NULL);
@@ -3109,9 +3103,9 @@
pthread_join(tid, &thread_return);
fail_unless(thread_return == (void *)options);
- response = s2_wait_for_response(202, SIP_METHOD_OPTIONS);
+ response = s2_sip_wait_for_response(202, SIP_METHOD_OPTIONS);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
nua_handle_destroy(nh);
}
@@ -3160,13 +3154,13 @@
s2_case("5.2.1", "Receive REFER",
"Make a call, receive REFER.");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite_by_nua(nh, TAG_END());
- *sip_refer_to_init(r)->r_url = *s2->local->a_url;
+ *sip_refer_to_init(r)->r_url = *s2sip->aor->a_url;
r->r_url->url_user = "bob2";
- s2_request_to(dialog, SIP_METHOD_REFER, NULL,
+ s2_sip_request_to(dialog, SIP_METHOD_REFER, NULL,
SIPTAG_REFER_TO(r),
TAG_END());
refer = s2_wait_for_event(nua_i_refer, 202);
@@ -3175,8 +3169,8 @@
nua_handle_destroy(nh);
- notify = s2_wait_for_request(SIP_METHOD_NOTIFY);
- s2_respond_to(notify, dialog, SIP_200_OK, TAG_END());
+ notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+ s2_sip_respond_to(notify, dialog, SIP_200_OK, TAG_END());
}
END_TEST
@@ -3200,16 +3194,13 @@
dialog2 = su_home_new(sizeof *dialog2); fail_unless(dialog2 != NULL);
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
invite_by_nua(nh, TAG_END());
- *sip_refer_to_init(r)->r_url = *s2->local->a_url;
+ *sip_refer_to_init(r)->r_url = *s2sip->aor->a_url;
r->r_url->url_user = "bob2";
- tport_set_params(s2->master, TPTAG_LOG(1), TAG_END());
- s2_setup_logs(7);
-
- s2_request_to(dialog, SIP_METHOD_REFER, NULL,
+ s2_sip_request_to(dialog, SIP_METHOD_REFER, NULL,
SIPTAG_REFER_TO(r),
TAG_END());
refer = s2_wait_for_event(nua_i_refer, 202);
@@ -3233,10 +3224,10 @@
SIPTAG_PAYLOAD_STR("SIP/2.0 100 Trying\r\n"),
NUTAG_SUBSTATE(nua_substate_active),
TAG_END());
- notify0 = s2_wait_for_request(SIP_METHOD_NOTIFY);
+ notify0 = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
fail_unless((ss = notify0->sip->sip_subscription_state) != NULL);
fail_unless(su_casematch("active", ss->ss_substate));
- s2_respond_to(notify0, dialog1, SIP_200_OK, TAG_END());
+ s2_sip_respond_to(notify0, dialog1, SIP_200_OK, TAG_END());
notified = s2_wait_for_event(nua_r_notify, 200);
nh2 = nua_handle(nua, NULL, NUTAG_URL(r->r_url), TAG_END());
@@ -3255,17 +3246,17 @@
fail_unless(s2_check_event(nua_r_invite, 180));
fail_unless(s2_check_callstate(nua_callstate_proceeding));
- notify1 = s2_wait_for_request(SIP_METHOD_NOTIFY);
- s2_respond_to(notify1, dialog1, SIP_200_OK, TAG_END());
+ notify1 = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+ s2_sip_respond_to(notify1, dialog1, SIP_200_OK, TAG_END());
respond_with_sdp(invite, dialog, SIP_200_OK, TAG_END());
- s2_free_message(invite);
+ s2_sip_free_message(invite);
fail_unless(s2_check_event(nua_r_invite, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
- fail_unless(s2_check_request(SIP_METHOD_ACK));
+ fail_unless(s2_sip_check_request(SIP_METHOD_ACK));
- notify2 = s2_wait_for_request(SIP_METHOD_NOTIFY);
- s2_respond_to(notify2, dialog1, SIP_200_OK, TAG_END());
+ notify2 = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
+ s2_sip_respond_to(notify2, dialog1, SIP_200_OK, TAG_END());
fail_unless((ss = notify2->sip->sip_subscription_state) != NULL);
fail_unless(su_casematch("terminated", ss->ss_substate));
@@ -3296,10 +3287,10 @@
s2_case("0.0.0", "Empty test case",
"Detailed explanation for empty test case.");
- tport_set_params(s2->master, TPTAG_LOG(1), TAG_END());
+ tport_set_params(s2sip->master, TPTAG_LOG(1), TAG_END());
s2_setup_logs(7);
s2_setup_logs(0);
- tport_set_params(s2->master, TPTAG_LOG(0), TAG_END());
+ tport_set_params(s2sip->master, TPTAG_LOG(0), TAG_END());
}
END_TEST
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_simple.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_simple.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_simple.c Tue Mar 3 16:00:56 2009
@@ -56,7 +56,6 @@
/* ====================================================================== */
static nua_t *nua;
-static soa_session_t *soa = NULL;
static struct dialog *dialog = NULL;
#define CRLF "\r\n"
@@ -138,7 +137,7 @@
ta_list ta;
ta_start(ta, tag, value);
- s2_respond_to(subscribe, dialog, status, phrase,
+ s2_sip_respond_to(subscribe, dialog, status, phrase,
ta_tags(ta));
ta_end(ta);
@@ -156,15 +155,15 @@
ta_list ta;
ta_start(ta, tag, value);
- fail_if(s2_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
SIPTAG_CONTENT_TYPE_STR(event_mime_type),
SIPTAG_PAYLOAD_STR(event_state),
ta_tags(ta)));
ta_end(ta);
- response = s2_wait_for_response(200, SIP_METHOD_NOTIFY);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_NOTIFY);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
event = s2_wait_for_event(nua_i_notify, 200); fail_if(!event);
fail_unless(s2_check_substate(event, expect_substate));
@@ -186,7 +185,7 @@
char const *substate_str = subscription_state;
char const *expires = "600";
- subscribe = s2_wait_for_request(SIP_METHOD_SUBSCRIBE);
+ subscribe = s2_sip_wait_for_request(SIP_METHOD_SUBSCRIBE);
if (event_type)
fail_if(!subscribe->sip->sip_event ||
strcmp(event_type, subscribe->sip->sip_event->o_type));
@@ -200,7 +199,7 @@
ta_start(ta, tag, value);
if (send_notify_before_response) {
- s2_save_uas_dialog(dialog, subscribe->sip);
+ s2_sip_save_uas_dialog(dialog, subscribe->sip);
notify = notify_to_nua(substate,
SIPTAG_EVENT(subscribe->sip->sip_event),
SIPTAG_SUBSCRIPTION_STATE_STR(substate_str),
@@ -223,7 +222,7 @@
ta_tags(ta));
}
- s2_free_message(subscribe);
+ s2_sip_free_message(subscribe);
return notify;
}
@@ -235,15 +234,15 @@
struct event *event;
nua_unsubscribe(nh, TAG_END());
- subscribe = s2_wait_for_request(SIP_METHOD_SUBSCRIBE);
+ subscribe = s2_sip_wait_for_request(SIP_METHOD_SUBSCRIBE);
- s2_respond_to(subscribe, dialog, SIP_200_OK, SIPTAG_EXPIRES_STR("0"), TAG_END());
+ s2_sip_respond_to(subscribe, dialog, SIP_200_OK, SIPTAG_EXPIRES_STR("0"), TAG_END());
event = s2_wait_for_event(nua_r_unsubscribe, 200); fail_if(!event);
fail_unless(s2_check_substate(event, nua_substate_active));
s2_free_event(event);
- fail_if(s2_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
SIPTAG_EVENT(subscribe->sip->sip_event),
SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=tiemout"),
SIPTAG_CONTENT_TYPE_STR(event_mime_type),
@@ -254,9 +253,9 @@
fail_unless(s2_check_substate(event, nua_substate_terminated));
s2_free_event(event);
- response = s2_wait_for_response(200, SIP_METHOD_NOTIFY);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_NOTIFY);
fail_if(!response);
- s2_free_message(response); s2_free_message(subscribe);
+ s2_sip_free_message(response); s2_sip_free_message(subscribe);
}
/* ====================================================================== */
@@ -269,7 +268,7 @@
s2_case("6.1.1", "Basic subscription",
"NUA sends SUBSCRIBE, waits for NOTIFY, sends un-SUBSCRIBE");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), TAG_END());
notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
s2_free_event(notify);
@@ -291,15 +290,15 @@
send_notify_before_response = 1;
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), TAG_END());
notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
s2_free_event(notify);
/* Wait for refresh */
- s2_fast_forward(600, s2->root);
- subscribe = s2_wait_for_request(SIP_METHOD_SUBSCRIBE);
- s2_respond_to(subscribe, dialog, SIP_200_OK,
+ s2_nua_fast_forward(600, s2base->root);
+ subscribe = s2_sip_wait_for_request(SIP_METHOD_SUBSCRIBE);
+ s2_sip_respond_to(subscribe, dialog, SIP_200_OK,
SIPTAG_EXPIRES_STR("600"),
TAG_END());
@@ -307,7 +306,7 @@
fail_unless(s2_check_substate(event, nua_substate_active));
s2_free_event(event);
- fail_if(s2_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
SIPTAG_EVENT(subscribe->sip->sip_event),
SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=600"),
SIPTAG_CONTENT_TYPE_STR(event_mime_type),
@@ -316,9 +315,9 @@
event = s2_wait_for_event(nua_i_notify, 200); fail_if(!event);
fail_unless(s2_check_substate(event, nua_substate_active));
s2_free_event(event);
- response = s2_wait_for_response(200, SIP_METHOD_NOTIFY);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_NOTIFY);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
unsubscribe_by_nua(nh, TAG_END());
@@ -336,21 +335,21 @@
"NUA sends SUBSCRIBE, waits for NOTIFY, "
"gets NOTIFY terminating the subscription,");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), TAG_END());
notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
s2_free_event(notify);
- fail_if(s2_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
SIPTAG_EVENT_STR(event_type),
SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"),
TAG_END()));
event = s2_wait_for_event(nua_i_notify, 200); fail_if(!event);
fail_unless(s2_check_substate(event, nua_substate_terminated));
s2_free_event(event);
- response = s2_wait_for_response(200, SIP_METHOD_NOTIFY);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_NOTIFY);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
nua_handle_destroy(nh);
}
@@ -366,25 +365,25 @@
"NUA sends SUBSCRIBE, waits for NOTIFY, "
"gets NOTIFY terminating the subscription,");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), TAG_END());
notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
s2_free_event(notify);
- fail_if(s2_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
+ fail_if(s2_sip_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
SIPTAG_EVENT_STR(event_type),
SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=deactivated"),
TAG_END()));
event = s2_wait_for_event(nua_i_notify, 200); fail_if(!event);
fail_unless(s2_check_substate(event, nua_substate_embryonic));
s2_free_event(event);
- response = s2_wait_for_response(200, SIP_METHOD_NOTIFY);
+ response = s2_sip_wait_for_response(200, SIP_METHOD_NOTIFY);
fail_if(!response);
- s2_free_message(response);
+ s2_sip_free_message(response);
su_home_unref((void *)dialog), dialog = su_home_new(sizeof *dialog); fail_if(!dialog);
- s2_fast_forward(5, s2->root);
+ s2_nua_fast_forward(5, s2base->root);
/* nua re-establishes the subscription */
notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
s2_free_event(notify);
@@ -423,7 +422,7 @@
s2_case("6.2.1", "Event fetch - NOTIFY after 202",
"NUA sends SUBSCRIBE with Expires 0, waits for NOTIFY");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), SIPTAG_EXPIRES_STR("0"), TAG_END());
notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
s2_check_substate(notify, nua_substate_terminated);
@@ -442,7 +441,7 @@
send_notify_before_response = 1;
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), SIPTAG_EXPIRES_STR("0"), TAG_END());
notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
s2_check_substate(notify, nua_substate_terminated);
@@ -460,18 +459,18 @@
s2_case("6.2.3", "Event fetch - no NOTIFY",
"NUA sends SUBSCRIBE with Expires 0, waits for NOTIFY, times out");
- nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), SIPTAG_EXPIRES_STR("0"), TAG_END());
- subscribe = s2_wait_for_request(SIP_METHOD_SUBSCRIBE);
- s2_respond_to(subscribe, dialog, SIP_202_ACCEPTED,
+ subscribe = s2_sip_wait_for_request(SIP_METHOD_SUBSCRIBE);
+ s2_sip_respond_to(subscribe, dialog, SIP_202_ACCEPTED,
SIPTAG_EXPIRES_STR("0"), TAG_END());
- s2_free_message(subscribe);
+ s2_sip_free_message(subscribe);
event = s2_wait_for_event(nua_r_subscribe, 202); fail_if(!event);
fail_unless(s2_check_substate(event, nua_substate_embryonic));
s2_free_event(event);
- s2_fast_forward(600, s2->root);
+ s2_nua_fast_forward(600, s2base->root);
event = s2_wait_for_event(nua_i_notify, 408); fail_if(!event);
fail_unless(s2_check_substate(event, nua_substate_terminated));
@@ -513,7 +512,7 @@
s2_check_event(nua_r_set_params, 200);
ta_start(ta, tag, value);
- s2_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
+ s2_sip_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
SIPTAG_EVENT_STR(event),
ta_tags(ta));
ta_end(ta);
@@ -525,10 +524,10 @@
TAG_END());
s2_free_event(subscribe);
- response = s2_wait_for_response(202, SIP_METHOD_SUBSCRIBE);
- s2_update_dialog(dialog, response);
+ response = s2_sip_wait_for_response(202, SIP_METHOD_SUBSCRIBE);
+ s2_sip_update_dialog(dialog, response);
fail_unless(response->sip->sip_expires != NULL);
- s2_free_message(response);
+ s2_sip_free_message(response);
return nh;
}
@@ -544,24 +543,24 @@
"NUA receives SUBSCRIBE, sends 202 and NOTIFY. "
"First NOTIFY terminates subscription. ");
- s2_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
- SIPTAG_EVENT_STR("presence"),
- TAG_END());
+ s2_sip_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
+ SIPTAG_EVENT_STR("presence"),
+ TAG_END());
/* 489 Bad Event by default */
- s2_check_response(489, SIP_METHOD_SUBSCRIBE);
+ s2_sip_check_response(489, SIP_METHOD_SUBSCRIBE);
nua_set_params(nua, NUTAG_APPL_METHOD("SUBSCRIBE"), TAG_END());
s2_check_event(nua_r_set_params, 200);
- s2_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
+ s2_sip_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
SIPTAG_EVENT_STR("presence"),
TAG_END());
- s2_check_response(489, SIP_METHOD_SUBSCRIBE);
+ s2_sip_check_response(489, SIP_METHOD_SUBSCRIBE);
nua_set_params(nua, SIPTAG_ALLOW_EVENTS_STR("presence"), TAG_END());
s2_check_event(nua_r_set_params, 200);
- s2_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
+ s2_sip_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
SIPTAG_EVENT_STR("presence"),
TAG_END());
subscribe = s2_wait_for_event(nua_i_subscribe, 100);
@@ -571,11 +570,11 @@
TAG_END());
s2_free_event(subscribe);
- s2_check_response(403, SIP_METHOD_SUBSCRIBE);
+ s2_sip_check_response(403, SIP_METHOD_SUBSCRIBE);
nua_handle_destroy(nh);
- s2_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
+ s2_sip_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
SIPTAG_EVENT_STR("presence"),
TAG_END());
subscribe = s2_wait_for_event(nua_i_subscribe, 100);
@@ -585,22 +584,22 @@
TAG_END());
s2_free_event(subscribe);
- response = s2_wait_for_response(202, SIP_METHOD_SUBSCRIBE);
- s2_update_dialog(dialog, response);
+ response = s2_sip_wait_for_response(202, SIP_METHOD_SUBSCRIBE);
+ s2_sip_update_dialog(dialog, response);
fail_unless(response->sip->sip_expires != NULL);
- s2_free_message(response);
+ s2_sip_free_message(response);
nua_notify(nh,
NUTAG_SUBSTATE(nua_substate_terminated),
SIPTAG_PAYLOAD_STR(presence_closed),
TAG_END());
- notify = s2_wait_for_request(SIP_METHOD_NOTIFY);
+ notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
fail_unless(notify != NULL);
sip = notify->sip;
fail_unless(sip->sip_subscription_state != NULL);
fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
"terminated"));
- s2_respond_to(notify, dialog, SIP_200_OK, TAG_END());
+ s2_sip_respond_to(notify, dialog, SIP_200_OK, TAG_END());
s2_check_event(nua_r_notify, 200);
nua_handle_destroy(nh);
@@ -610,8 +609,7 @@
START_TEST(notify_6_3_2)
{
nua_handle_t *nh;
- struct event *subscribe;
- struct message *notify, *response;
+ struct message *notify;
sip_t *sip;
s2_case("6.3.2", "NOTIFY server - automatic subscription termination",
@@ -624,24 +622,24 @@
NUTAG_SUBSTATE(nua_substate_active),
SIPTAG_PAYLOAD_STR(presence_closed),
TAG_END());
- notify = s2_wait_for_request(SIP_METHOD_NOTIFY);
+ notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
fail_unless(notify != NULL);
sip = notify->sip;
fail_unless(sip->sip_subscription_state != NULL);
fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
"active"));
- s2_respond_to(notify, dialog, SIP_200_OK, TAG_END());
+ s2_sip_respond_to(notify, dialog, SIP_200_OK, TAG_END());
s2_check_event(nua_r_notify, 200);
- s2_fast_forward(300, s2->root);
+ s2_nua_fast_forward(300, s2base->root);
- notify = s2_wait_for_request(SIP_METHOD_NOTIFY);
+ notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
fail_unless(notify != NULL);
sip = notify->sip;
fail_unless(sip->sip_subscription_state != NULL);
fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
"terminated"));
- s2_respond_to(notify, dialog, SIP_200_OK, TAG_END());
+ s2_sip_respond_to(notify, dialog, SIP_200_OK, TAG_END());
s2_check_event(nua_r_notify, 200);
nua_handle_destroy(nh);
@@ -677,26 +675,26 @@
NUTAG_SUBSTATE(nua_substate_active),
SIPTAG_PAYLOAD_STR(presence_closed),
TAG_END());
- notify = s2_wait_for_request(SIP_METHOD_NOTIFY);
+ notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
fail_unless(notify != NULL);
sip = notify->sip;
fail_unless(sip->sip_subscription_state != NULL);
fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
"active"));
- s2_respond_to(notify, dialog, SIP_200_OK, TAG_END());
+ s2_sip_respond_to(notify, dialog, SIP_200_OK, TAG_END());
s2_check_event(nua_r_notify, 200);
nua_notify(nh,
NUTAG_SUBSTATE(nua_substate_active),
SIPTAG_PAYLOAD_STR(presence_closed),
TAG_END());
- notify = s2_wait_for_request(SIP_METHOD_NOTIFY);
+ notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
fail_unless(notify != NULL);
sip = notify->sip;
fail_unless(sip->sip_subscription_state != NULL);
fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
"active"));
- s2_respond_to(notify, dialog, SIP_481_NO_TRANSACTION, TAG_END());
+ s2_sip_respond_to(notify, dialog, SIP_481_NO_TRANSACTION, TAG_END());
response = s2_wait_for_event(nua_r_notify, 481);
fail_unless(s2_event_substate(response) == nua_substate_terminated);
@@ -723,13 +721,13 @@
NUTAG_SUBSTATE(nua_substate_active),
SIPTAG_PAYLOAD_STR(presence_closed),
TAG_END());
- notify = s2_wait_for_request(SIP_METHOD_NOTIFY);
+ notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
fail_unless(notify != NULL);
sip = notify->sip;
fail_unless(sip->sip_subscription_state != NULL);
fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
"active"));
- s2_respond_to(notify, dialog, SIP_200_OK, TAG_END());
+ s2_sip_respond_to(notify, dialog, SIP_200_OK, TAG_END());
s2_check_event(nua_r_notify, 200);
nua_notify(nh,
@@ -740,13 +738,13 @@
NUTAG_SUBSTATE(nua_substate_active),
SIPTAG_PAYLOAD_STR(presence_closed),
TAG_END());
- notify = s2_wait_for_request(SIP_METHOD_NOTIFY);
+ notify = s2_sip_wait_for_request(SIP_METHOD_NOTIFY);
fail_unless(notify != NULL);
sip = notify->sip;
fail_unless(sip->sip_subscription_state != NULL);
fail_unless(su_strmatch(sip->sip_subscription_state->ss_substate,
"active"));
- s2_respond_to(notify, dialog, SIP_481_NO_TRANSACTION, TAG_END());
+ s2_sip_respond_to(notify, dialog, SIP_481_NO_TRANSACTION, TAG_END());
response = s2_wait_for_event(nua_r_notify, 481);
fail_unless(s2_event_substate(response) == nua_substate_terminated);
response = s2_wait_for_event(nua_r_notify, 481);
@@ -783,10 +781,10 @@
s2_case("0.0.0", "Empty test case",
"Detailed explanation for empty test case.");
- tport_set_params(s2->master, TPTAG_LOG(1), TAG_END());
+ tport_set_params(s2sip->master, TPTAG_LOG(1), TAG_END());
s2_setup_logs(7);
s2_setup_logs(0);
- tport_set_params(s2->master, TPTAG_LOG(0), TAG_END());
+ tport_set_params(s2sip->master, TPTAG_LOG(0), TAG_END());
}
END_TEST
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c Tue Mar 3 16:00:56 2009
@@ -54,33 +54,11 @@
#include <limits.h>
#include <time.h>
-char const *s2_tester = "s2_tester";
-int s2_start_stop;
+/* -- Globals -------------------------------------------------------------- */
-/* -- Module types ------------------------------------------------------ */
+struct s2nua *s2;
-struct tp_magic_s
-{
- sip_via_t *via;
- sip_contact_t *contact;
-};
-
-/* -- Module prototypes ------------------------------------------------- */
-
-static msg_t *s2_msg(int flags);
-static int s2_complete_response(msg_t *response,
- int status, char const *phrase,
- msg_t *request);
-static char *s2_generate_tag(su_home_t *home);
-
-/* -- Module globals ---------------------------------------------------- */
-
-struct tester *s2;
-
-static char const *_s2case = "0.0";
-static unsigned s2_tag_generator = 0;
-
-/* -- Globals ----------------------------------------------------------- */
+int s2_nua_thread = 0;
unsigned s2_default_registration_duration = 3600;
@@ -108,8 +86,6 @@
char const s2_auth3_credentials[] = "Digest:\"s2test3\":abc:abc";
-int s2_nua_thread = 0;
-
/* -- NUA events -------------------------------------------------------- */
struct event *s2_remove_event(struct event *e)
@@ -148,7 +124,7 @@
if (s2->events)
return s2_remove_event(s2->events);
- su_root_step(s2->root, 100);
+ su_root_step(s2base->root, 100);
}
}
@@ -165,7 +141,7 @@
return s2_remove_event(e);
}
- su_root_step(s2->root, 100);
+ su_root_step(s2base->root, 100);
}
}
@@ -230,862 +206,6 @@
*prev = e, e->prev = prev;
}
-/* ---------------------------------------------------------------------- */
-/* SIP messages sent by nua */
-
-struct message *
-s2_remove_message(struct message *m)
-{
- if ((*m->prev = m->next))
- m->next->prev = m->prev;
-
- m->prev = NULL, m->next = NULL;
-
- return m;
-}
-
-void
-s2_free_message(struct message *m)
-{
- if (m) {
- if (m->prev) {
- if ((*m->prev = m->next))
- m->next->prev = m->prev;
- }
- msg_destroy(m->msg);
- tport_unref(m->tport);
- free(m);
- }
-}
-
-void s2_flush_messages(void)
-{
- while (s2->received) {
- s2_free_message(s2->received);
- }
-}
-
-struct message *
-s2_next_response(void)
-{
- struct message *m;
-
- for (;;) {
- for (m = s2->received; m; m = m->next) {
- if (m->sip->sip_status)
- return s2_remove_message(m);
- }
- su_root_step(s2->root, 100);
- }
-}
-
-struct message *
-s2_wait_for_response(int status, sip_method_t method, char const *name)
-{
- struct message *m;
-
- for (;;) {
- for (m = s2->received; m; m = m->next) {
- if (!m->sip->sip_status)
- continue;
-
- if (status != 0 && m->sip->sip_status->st_status != status)
- continue;
-
- if (method == sip_method_unknown && name == NULL)
- break;
-
- if (m->sip->sip_cseq == NULL)
- continue;
-
- if (m->sip->sip_cseq->cs_method != method)
- continue;
- if (name == NULL)
- break;
- if (strcmp(m->sip->sip_cseq->cs_method_name, name) == 0)
- break;
- }
-
- if (m)
- return s2_remove_message(m);
-
- su_root_step(s2->root, 100);
- }
-}
-
-int
-s2_check_response(int status, sip_method_t method, char const *name)
-{
- struct message *m = s2_wait_for_response(status, method, name);
- s2_free_message(m);
- return m != NULL;
-}
-
-
-struct message *
-s2_next_request(void)
-{
- struct message *m;
-
- for (;;) {
- for (m = s2->received; m; m = m->next) {
- if (m->sip->sip_request)
- return s2_remove_message(m);
- }
-
- su_root_step(s2->root, 100);
- }
-
- return NULL;
-}
-
-struct message *
-s2_wait_for_request(sip_method_t method, char const *name)
-{
- return s2_wait_for_request_timeout(method, name, -1);
-}
-
-struct message *
-s2_wait_for_request_timeout(sip_method_t method, char const *name, int timeout)
-{
- struct message *m;
- int t = timeout;
-
- for (;;) {
- for (m = s2->received; m; m = m->next) {
- if (m->sip->sip_request) {
- if (method == sip_method_unknown && name == NULL)
- return s2_remove_message(m);
-
- if (m->sip->sip_request->rq_method == method &&
- strcmp(m->sip->sip_request->rq_method_name, name) == 0)
- return s2_remove_message(m);
- }
- }
-
- su_root_step(s2->root, 100);
- if (timeout != -1 && ((t -= 100) <= 0))
- break;
- }
-
- return NULL;
-}
-
-int
-s2_check_request(sip_method_t method, char const *name)
-{
- struct message *m = s2_wait_for_request(method, name);
- s2_free_message(m);
- return m != NULL;
-}
-
-int
-s2_check_request_timeout(sip_method_t method, char const *name, int timeout)
-{
- struct message *m = s2_wait_for_request_timeout(method, name, timeout);
- s2_free_message(m);
- return m != NULL;
-}
-
-void
-s2_save_uas_dialog(struct dialog *d, sip_t *sip)
-{
- if (d && !d->local) {
- assert(sip->sip_request);
- d->local = sip_from_dup(d->home, sip->sip_to);
- if (d->local->a_tag == NULL)
- sip_from_tag(d->home, d->local, s2_generate_tag(d->home));
- d->remote = sip_to_dup(d->home, sip->sip_from);
- d->call_id = sip_call_id_dup(d->home, sip->sip_call_id);
- d->rseq = sip->sip_cseq->cs_seq;
- /* d->route = sip_route_dup(d->home, sip->sip_record_route); */
- d->target = sip_contact_dup(d->home, sip->sip_contact);
- }
-}
-
-struct message *
-s2_respond_to(struct message *m, struct dialog *d,
- int status, char const *phrase,
- tag_type_t tag, tag_value_t value, ...)
-{
- ta_list ta;
- msg_t *reply;
- sip_t *sip;
- su_home_t *home;
- tp_name_t tpn[1];
- char *rport;
-
- assert(m); assert(m->msg); assert(m->tport);
- assert(100 <= status && status < 700);
-
- s2_save_uas_dialog(d, m->sip);
-
- ta_start(ta, tag, value);
-
- reply = s2_msg(0); sip = sip_object(reply); home = msg_home(reply);
-
- assert(reply && home && sip);
-
- if (sip_add_tl(reply, sip, ta_tags(ta)) < 0) {
- abort();
- }
-
- s2_complete_response(reply, status, phrase, m->msg);
-
- if (sip->sip_status && sip->sip_status->st_status > 100 &&
- sip->sip_to && !sip->sip_to->a_tag &&
- sip->sip_cseq && sip->sip_cseq->cs_method != sip_method_cancel) {
- char const *ltag = NULL;
-
- if (d && d->local)
- ltag = d->local->a_tag;
-
- if (ltag == NULL)
- ltag = s2_generate_tag(home);
-
- if (sip_to_tag(msg_home(reply), sip->sip_to, ltag) < 0) {
- assert(!"add To tag");
- }
- }
-
- if (d && !d->contact) {
- d->contact = sip_contact_dup(d->home, sip->sip_contact);
- }
-
- *tpn = *tport_name(m->tport);
-
- rport = su_sprintf(home, "rport=%u",
- ntohs(((su_sockaddr_t *)
- msg_addrinfo(m->msg)->ai_addr)->su_port));
-
- if (s2->server_uses_rport &&
- sip->sip_via->v_rport &&
- sip->sip_via->v_rport[0] == '\0') {
- msg_header_add_param(home, sip->sip_via->v_common, rport);
- }
-
- tpn->tpn_port = rport + strlen("rport=");
-
- tport_tsend(m->tport, reply, tpn, TPTAG_MTU(INT_MAX), ta_tags(ta));
- msg_destroy(reply);
-
- ta_end(ta);
-
- return m;
-}
-
-/** Add headers from the request to the response message. */
-static int
-s2_complete_response(msg_t *response,
- int status, char const *phrase,
- msg_t *request)
-{
- su_home_t *home = msg_home(response);
- sip_t *response_sip = sip_object(response);
- sip_t const *request_sip = sip_object(request);
-
- int incomplete = 0;
-
- if (!response_sip || !request_sip || !request_sip->sip_request)
- return -1;
-
- if (!response_sip->sip_status)
- response_sip->sip_status = sip_status_create(home, status, phrase, NULL);
- if (!response_sip->sip_via)
- response_sip->sip_via = sip_via_dup(home, request_sip->sip_via);
- if (!response_sip->sip_from)
- response_sip->sip_from = sip_from_dup(home, request_sip->sip_from);
- if (!response_sip->sip_to)
- response_sip->sip_to = sip_to_dup(home, request_sip->sip_to);
- if (!response_sip->sip_call_id)
- response_sip->sip_call_id =
- sip_call_id_dup(home, request_sip->sip_call_id);
- if (!response_sip->sip_cseq)
- response_sip->sip_cseq = sip_cseq_dup(home, request_sip->sip_cseq);
-
- if (!response_sip->sip_record_route && request_sip->sip_record_route)
- sip_add_dup(response, response_sip, (void*)request_sip->sip_record_route);
-
- incomplete = sip_complete_message(response) < 0;
-
- msg_serialize(response, (msg_pub_t *)response_sip);
-
- if (incomplete ||
- !response_sip->sip_status ||
- !response_sip->sip_via ||
- !response_sip->sip_from ||
- !response_sip->sip_to ||
- !response_sip->sip_call_id ||
- !response_sip->sip_cseq ||
- !response_sip->sip_content_length ||
- !response_sip->sip_separator ||
- (request_sip->sip_record_route && !response_sip->sip_record_route))
- return -1;
-
- return 0;
-}
-
-/* Send request (updating dialog).
- *
- * Return zero upon success, nonzero upon failure.
- */
-int
-s2_request_to(struct dialog *d,
- sip_method_t method, char const *name,
- tport_t *tport,
- tag_type_t tag, tag_value_t value, ...)
-{
- ta_list ta;
- tagi_t const *tags;
-
- msg_t *msg = s2_msg(0);
- sip_t *sip = sip_object(msg);
- url_t const *target = NULL;
- sip_cseq_t cseq[1];
- sip_via_t via[1]; char const *v_params[8];
- sip_content_length_t l[1];
- tp_name_t tpn[1];
- tp_magic_t *magic;
- int user_via = 0;
-
- ta_start(ta, tag, value);
- tags = ta_args(ta);
-
- if (sip_add_tagis(msg, sip, &tags) < 0)
- goto error;
-
- if (sip->sip_request)
- target = sip->sip_request->rq_url;
- else if (d->target)
- target = d->target->m_url;
- else if (s2->registration->contact)
- target = s2->registration->contact->m_url;
- else
- target = NULL;
-
- if (target == NULL)
- goto error;
-
- if (!sip->sip_request) {
- sip_request_t *rq;
- rq = sip_request_create(msg_home(msg), method, name,
- (url_string_t *)target, NULL);
- sip_header_insert(msg, sip, (sip_header_t *)rq);
- }
-
- if (!d->local && sip->sip_from)
- d->local = sip_from_dup(d->home, sip->sip_from);
- if (!d->contact && sip->sip_contact)
- d->contact = sip_contact_dup(d->home, sip->sip_contact);
- if (!d->remote && sip->sip_to)
- d->remote = sip_to_dup(d->home, sip->sip_to);
- if (!d->target && sip->sip_request)
- d->target = sip_contact_create(d->home,
- (url_string_t *)sip->sip_request->rq_url,
- NULL);
- if (!d->call_id && sip->sip_call_id)
- d->call_id = sip_call_id_dup(d->home, sip->sip_call_id);
- if (!d->lseq && sip->sip_cseq)
- d->lseq = sip->sip_cseq->cs_seq;
-
- if (!d->local)
- d->local = sip_from_dup(d->home, s2->local);
- if (!d->contact)
- d->contact = sip_contact_dup(d->home, s2->contact);
- if (!d->remote)
- d->remote = sip_to_dup(d->home, s2->registration->aor);
- if (!d->call_id)
- d->call_id = sip_call_id_create(d->home, NULL);
- assert(d->local && d->contact);
- assert(d->remote && d->target);
- assert(d->call_id);
-
- if (tport == NULL)
- tport = d->tport;
-
- if (tport == NULL)
- tport = s2->registration->tport;
-
- if (tport == NULL && d->target->m_url->url_type == url_sips)
- tport = s2->tls.tport;
-
- if (tport == NULL)
- tport = s2->udp.tport;
- else if (tport == NULL)
- tport = s2->tcp.tport;
- else if (tport == NULL)
- tport = s2->tls.tport;
-
- assert(tport);
-
- *tpn = *tport_name(tport);
-
- if (tport_is_primary(tport)) {
- tpn->tpn_host = target->url_host;
- tpn->tpn_port = url_port(target);
- if (!tpn->tpn_port || !tpn->tpn_port[0])
- tpn->tpn_port = url_port_default(target->url_type);
- }
-
- magic = tport_magic(tport);
- assert(magic != NULL);
-
- sip_cseq_init(cseq);
- cseq->cs_method = method;
- cseq->cs_method_name = name;
-
- if (d->invite && (method == sip_method_ack || method == sip_method_cancel)) {
- cseq->cs_seq = sip_object(d->invite)->sip_cseq->cs_seq;
- }
- else {
- cseq->cs_seq = ++d->lseq;
- }
-
- if (sip->sip_via) {
- user_via = 1;
- }
- else if (d->invite && method == sip_method_cancel) {
- *via = *sip_object(d->invite)->sip_via;
- }
- else {
- *via = *magic->via;
- via->v_params = v_params;
- v_params[0] = su_sprintf(msg_home(msg), "branch=z9hG4bK%lx", ++s2->tid);
- v_params[1] = NULL;
- }
-
- sip_content_length_init(l);
- if (sip->sip_payload)
- l->l_length = sip->sip_payload->pl_len;
-
- if (d->local->a_tag == NULL) {
- char const *ltag = s2_generate_tag(d->home);
-
- if (sip_from_tag(d->home, d->local, ltag) < 0) {
- assert(!"add To tag");
- }
-
- if (sip->sip_from && sip->sip_from->a_tag == NULL) {
- if (sip_from_tag(msg_home(msg), sip->sip_from, ltag) < 0) {
- assert(!"add To tag");
- }
- }
- }
-
- sip_add_tl(msg, sip,
- TAG_IF(!sip->sip_from, SIPTAG_FROM(d->local)),
- TAG_IF(!sip->sip_contact, SIPTAG_CONTACT(d->contact)),
- TAG_IF(!sip->sip_to, SIPTAG_TO(d->remote)),
- TAG_IF(!sip->sip_call_id, SIPTAG_CALL_ID(d->call_id)),
- TAG_IF(!sip->sip_cseq, SIPTAG_CSEQ(cseq)),
- TAG_IF(!user_via, SIPTAG_VIA(via)),
- TAG_IF(!sip->sip_content_length, SIPTAG_CONTENT_LENGTH(l)),
- TAG_IF(!sip->sip_separator, SIPTAG_SEPARATOR_STR("\r\n")),
- TAG_END());
-
- msg_serialize(msg, NULL);
-
- if (method == sip_method_invite) {
- msg_destroy(d->invite);
- d->invite = msg_ref_create(msg);
- }
-
- tport = tport_tsend(tport, msg, tpn, ta_tags(ta));
- ta_end(ta);
-
- if (d->tport != tport) {
- tport_unref(d->tport);
- d->tport = tport_ref(tport);
- }
-
- return tport ? 0 : -1;
-
- error:
- ta_end(ta);
- return -1;
-}
-
-/** Save information from response.
- *
- * Send ACK for error messages to INVITE.
- */
-int s2_update_dialog(struct dialog *d, struct message *m)
-{
- int status = 0;
-
- if (m->sip->sip_status)
- status = m->sip->sip_status->st_status;
-
- if (100 < status && status < 300) {
- d->remote = sip_to_dup(d->home, m->sip->sip_to);
- if (m->sip->sip_contact)
- d->contact = sip_contact_dup(d->home, m->sip->sip_contact);
- }
-
- if (300 <= status && m->sip->sip_cseq &&
- m->sip->sip_cseq->cs_method == sip_method_invite &&
- d->invite) {
- msg_t *ack = s2_msg(0);
- sip_t *sip = sip_object(ack);
- sip_t *invite = sip_object(d->invite);
- sip_request_t rq[1];
- sip_cseq_t cseq[1];
- tp_name_t tpn[1];
-
- *rq = *invite->sip_request;
- rq->rq_method = sip_method_ack, rq->rq_method_name = "ACK";
- *cseq = *invite->sip_cseq;
- cseq->cs_method = sip_method_ack, cseq->cs_method_name = "ACK";
-
- sip_add_tl(ack, sip,
- SIPTAG_REQUEST(rq),
- SIPTAG_VIA(invite->sip_via),
- SIPTAG_FROM(invite->sip_from),
- SIPTAG_TO(invite->sip_to),
- SIPTAG_CALL_ID(invite->sip_call_id),
- SIPTAG_CSEQ(cseq),
- SIPTAG_CONTENT_LENGTH_STR("0"),
- SIPTAG_SEPARATOR_STR("\r\n"),
- TAG_END());
-
- *tpn = *tport_name(d->tport);
- if (!tport_is_secondary(d->tport) ||
- !tport_is_clear_to_send(d->tport)) {
- tpn->tpn_host = rq->rq_url->url_host;
- tpn->tpn_port = rq->rq_url->url_port;
- }
-
- msg_serialize(ack, NULL);
- tport_tsend(d->tport, ack, tpn, TAG_END());
- }
-
- return 0;
-}
-
-/* ---------------------------------------------------------------------- */
-
-int
-s2_save_register(struct message *rm)
-{
- sip_contact_t *contact, *m, **m_prev;
- sip_expires_t const *ex;
- sip_date_t const *date;
- sip_time_t now = rm->when.tv_sec, expires;
-
- msg_header_free_all(s2->home, (msg_header_t *)s2->registration->aor);
- msg_header_free_all(s2->home, (msg_header_t *)s2->registration->contact);
- tport_unref(s2->registration->tport);
-
- s2->registration->aor = NULL;
- s2->registration->contact = NULL;
- s2->registration->tport = NULL;
-
- if (rm == NULL)
- return 0;
-
- assert(rm && rm->sip && rm->sip->sip_request);
- assert(rm->sip->sip_request->rq_method == sip_method_register);
-
- ex = rm->sip->sip_expires;
- date = rm->sip->sip_date;
-
- contact = sip_contact_dup(s2->home, rm->sip->sip_contact);
-
- for (m_prev = &contact; *m_prev;) {
- m = *m_prev;
-
- expires = sip_contact_expires(m, ex, date,
- s2_default_registration_duration,
- now);
- if (expires) {
- char *p = su_sprintf(s2->home, "expires=%lu", (unsigned long)expires);
- msg_header_add_param(s2->home, m->m_common, p);
- m_prev = &m->m_next;
- }
- else {
- *m_prev = m->m_next;
- m->m_next = NULL;
- msg_header_free(s2->home, (msg_header_t *)m);
- }
- }
-
- if (contact == NULL)
- return 0;
-
- s2->registration->aor = sip_to_dup(s2->home, rm->sip->sip_to);
- s2->registration->contact = contact;
- s2->registration->tport = tport_ref(rm->tport);
-
- return 0;
-}
-
-/* ---------------------------------------------------------------------- */
-
-static char *
-s2_generate_tag(su_home_t *home)
-{
- s2_tag_generator += 1;
-
- return su_sprintf(home, "tag=N2-%s/%u", _s2case, s2_tag_generator);
-}
-
-void s2_case(char const *number,
- char const *title,
- char const *description)
-{
- _s2case = number;
-
- if (s2_start_stop)
- printf("%s - starting %s %s\n", s2_tester, number, title);
-}
-
-/* ---------------------------------------------------------------------- */
-/* tport interface */
-static void
-s2_stack_recv(struct tester *s2,
- tport_t *tp,
- msg_t *msg,
- tp_magic_t *magic,
- su_time_t now)
-{
- struct message *next = calloc(1, sizeof *next), **prev;
-
- next->msg = msg;
- next->sip = sip_object(msg);
- next->when = now;
- next->tport = tport_ref(tp);
-
-#if 0
- if (next->sip->sip_request)
- printf("nua sent: %s\n", next->sip->sip_request->rq_method_name);
- else
- printf("nua sent: SIP/2.0 %u %s\n",
- next->sip->sip_status->st_status,
- next->sip->sip_status->st_phrase);
-#endif
-
- for (prev = &s2->received; *prev; prev = &(*prev)->next)
- ;
-
- next->prev = prev, *prev = next;
-}
-
-static void
-s2_stack_error(struct tester *s2,
- tport_t *tp,
- int errcode,
- char const *remote)
-{
- fprintf(stderr, "%s(%p): error %d (%s) from %s\n",
- "nua_tester_error",
- (void *)tp, errcode, su_strerror(errcode),
- remote ? remote : "<unknown destination>");
-}
-
-static msg_t *
-s2_stack_alloc(struct tester *s2, int flags,
- char const data[], usize_t size,
- tport_t const *tport,
- tp_client_t *tpc)
-{
- return msg_create(s2->mclass, flags | s2->flags);
-}
-
-static msg_t *
-s2_msg(int flags)
-{
- return msg_create(s2->mclass, flags | s2->flags);
-}
-
-tp_stack_class_t const s2_stack[1] =
- {{
- /* tpac_size */ (sizeof s2_stack),
- /* tpac_recv */ s2_stack_recv,
- /* tpac_error */ s2_stack_error,
- /* tpac_alloc */ s2_stack_alloc,
- }};
-
-/** Basic setup for test cases */
-void s2_setup_base(char const *label, char const *hostname)
-{
- assert(s2 == NULL);
-
- if (s2_start_stop > 1) {
- printf("%s - setup %s test case\n", s2_tester, label ? label : "next");
- }
-
- su_init();
-
- s2 = su_home_new(sizeof *s2);
-
- assert(s2 != NULL);
-
- s2->root = su_root_create(s2);
-
- assert(s2->root != NULL);
-
- s2->local = sip_from_format(s2->home, "Bob <sip:bob@%s>",
- hostname ? hostname : "example.net");
-
- if (hostname == NULL)
- hostname = "127.0.0.1";
-
- s2->hostname = hostname;
- s2->tid = (unsigned long)time(NULL) * 510633671UL;
-
-}
-
-SOFIAPUBVAR su_log_t nua_log[];
-SOFIAPUBVAR su_log_t soa_log[];
-SOFIAPUBVAR su_log_t nea_log[];
-SOFIAPUBVAR su_log_t nta_log[];
-SOFIAPUBVAR su_log_t tport_log[];
-SOFIAPUBVAR su_log_t su_log_default[];
-
-void
-s2_setup_logs(int level)
-{
- assert(s2);
-
- su_log_soft_set_level(nua_log, level);
- su_log_soft_set_level(soa_log, level);
- su_log_soft_set_level(su_log_default, level);
- su_log_soft_set_level(nea_log, level);
- su_log_soft_set_level(nta_log, level);
- su_log_soft_set_level(tport_log, level);
-}
-
-static char const * default_protocols[] = { "udp", "tcp", NULL };
-
-void
-s2_setup_tport(char const * const *protocols,
- tag_type_t tag, tag_value_t value, ...)
-{
- ta_list ta;
- tp_name_t tpn[1];
- int bound;
- tport_t *tp;
-
- assert(s2 != NULL);
-
- ta_start(ta, tag, value);
-
- if (s2->master == NULL) {
- s2->master = tport_tcreate(s2, s2_stack, s2->root,
- TPTAG_LOG(getenv("S2_TPORT_LOG") != NULL),
- ta_tags(ta));
-
- if (s2->master == NULL) {
- assert(s2->master);
- }
- s2->mclass = sip_default_mclass();
- s2->flags = 0;
- }
-
- memset(tpn, 0, (sizeof tpn));
- tpn->tpn_proto = "*";
- tpn->tpn_host = s2->hostname;
- tpn->tpn_port = "*";
-
- if (protocols == NULL)
- protocols = default_protocols;
-
- bound = tport_tbind(s2->master, tpn, protocols,
- TPTAG_SERVER(1),
- ta_tags(ta));
- assert(bound != -1);
-
- tp = tport_primaries(s2->master);
-
- if (protocols == default_protocols && s2->contact == NULL) {
- *tpn = *tport_name(tp);
- s2->contact = sip_contact_format(s2->home, "<sip:%s:%s>",
- tpn->tpn_host,
- tpn->tpn_port);
- }
-
- for (;tp; tp = tport_next(tp)) {
- sip_via_t *v;
- sip_contact_t *m;
- tp_magic_t *magic;
-
- if (tport_magic(tp))
- continue;
-
- *tpn = *tport_name(tp);
-
- v = sip_via_format(s2->home, "SIP/2.0/%s %s:%s",
- tpn->tpn_proto,
- tpn->tpn_host,
- tpn->tpn_port);
- assert(v != NULL);
- if (!su_casenmatch(tpn->tpn_proto, "tls", 3)) {
- m = sip_contact_format(s2->home, "<sip:%s:%s;transport=%s>",
- tpn->tpn_host,
- tpn->tpn_port,
- tpn->tpn_proto);
- if (s2->udp.contact == NULL && su_casematch(tpn->tpn_proto, "udp")) {
- s2->udp.tport = tport_ref(tp);
- s2->udp.contact = m;
- }
- if (s2->tcp.contact == NULL && su_casematch(tpn->tpn_proto, "tcp")) {
- s2->tcp.tport = tport_ref(tp);
- s2->tcp.contact = m;
- }
- }
- else if (!su_casematch(tpn->tpn_proto, "tls")) {
- m = sip_contact_format(s2->home, "<sips:%s:%s;transport=%s>",
- tpn->tpn_host,
- tpn->tpn_port,
- tpn->tpn_proto);
- }
- else {
- m = sip_contact_format(s2->home, "<sips:%s:%s>",
- tpn->tpn_host,
- tpn->tpn_port);
- if (s2->tls.contact == NULL) {
- s2->tls.tport = tport_ref(tp);
- s2->tls.contact = m;
- }
- }
- assert(m != NULL);
-
- magic = su_zalloc(s2->home, (sizeof *magic));
- magic->via = v, magic->contact = m;
-
- if (s2->contact == NULL)
- s2->contact = m;
-
- tport_set_magic(tp, magic);
- }
-}
-
-static char const *s2_teardown_label = NULL;
-
-void
-s2_teardown_started(char const *label)
-{
- if (!s2_teardown_label) {
- s2_teardown_label = label;
- if (s2_start_stop > 1) {
- printf("%s - tearing down %s test case\n", s2_tester, label);
- }
- }
-}
-
-void
-s2_teardown(void)
-{
- s2 = NULL;
- su_deinit();
-
- if (s2_start_stop > 1) {
- printf("%s - %s test case tore down\n", s2_tester,
- s2_teardown_label ? s2_teardown_label : "previous");
- }
-
- s2_teardown_label = NULL;
-}
/* ====================================================================== */
@@ -1094,27 +214,31 @@
{
ta_list ta;
- s2_setup_base(label, NULL);
- s2_dns_setup(s2->root);
+ s2_setup(label);
+
+ s2 = su_home_new(sizeof *s2);
+
+ s2_dns_setup(s2base->root);
s2_setup_logs(0);
- s2_setup_tport(NULL, TAG_END());
- assert(s2->contact);
+ s2_sip_setup("example.org", NULL, TAG_END());
+ assert(s2sip->contact);
+
s2_dns_domain("example.org", 1,
- "s2", 1, s2->udp.contact->m_url,
- "s2", 1, s2->tcp.contact->m_url,
+ "s2", 1, s2sip->udp.contact->m_url,
+ "s2", 1, s2sip->tcp.contact->m_url,
NULL);
/* enable/disable multithreading */
- su_root_threading(s2->root, s2_nua_thread);
+ su_root_threading(s2base->root, s2_nua_thread);
ta_start(ta, tag, value);
s2->nua =
- nua_create(s2->root,
+ nua_create(s2base->root,
s2_nua_callback,
s2,
SIPTAG_FROM_STR("Alice <sip:alice@example.org>"),
- /* NUTAG_PROXY((url_string_t *)s2->contact->m_url), */
+ /* NUTAG_PROXY((url_string_t *)s2sip->contact->m_url), */
/* Use internal DNS server */
NUTAG_PROXY("sip:example.org"),
/* Force sresolv to use localhost and s2dns as DNS server */
@@ -1129,12 +253,33 @@
return s2->nua;
}
+void
+s2_nua_fast_forward(unsigned long seconds,
+ su_root_t *steproot)
+{
+ s2_fast_forward(seconds, NULL);
+
+ if (s2_nua_thread)
+ /* Wake up nua thread */
+ nua_handle_by_call_id(s2->nua, NULL);
+
+ if (steproot)
+ su_root_step(steproot, 0);
+}
+
void s2_nua_teardown(void)
{
- nua_destroy(s2->nua);
- s2->nua = NULL;
+ if (s2) {
+ struct s2nua *zap = s2;
+ nua_destroy(s2->nua), s2->nua = NULL;
+ s2 = NULL;
+ su_home_unref(zap->home);
+ }
+
s2_dns_teardown();
+ s2_sip_teardown();
s2_teardown();
+
}
/* ====================================================================== */
@@ -1160,15 +305,16 @@
nua_register(nh, TAG_END());
- m = s2_wait_for_request(SIP_METHOD_REGISTER);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
assert(m);
+
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
TAG_END());
- s2_free_message(m);
+ s2_sip_free_message(m);
assert(s2->registration->contact != NULL);
s2_check_event(nua_r_register, 200);
@@ -1193,15 +339,15 @@
nua_unregister(nh, TAG_END());
- m = s2_wait_for_request(SIP_METHOD_REGISTER); assert(m);
+ m = s2_sip_wait_for_request(SIP_METHOD_REGISTER); assert(m);
s2_save_register(m);
- s2_respond_to(m, NULL,
+ s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
TAG_END());
assert(s2->registration->contact == NULL);
- s2_free_message(m);
+ s2_sip_free_message(m);
s2_check_event(nua_r_unregister, 200);
@@ -1209,3 +355,62 @@
s2->registration->nh = NULL;
}
}
+
+int
+s2_save_register(struct message *rm)
+{
+ sip_contact_t *contact, *m, **m_prev;
+ sip_expires_t const *ex;
+ sip_date_t const *date;
+ sip_time_t now = rm->when.tv_sec, expires;
+
+ msg_header_free_all(s2->home, (msg_header_t *)s2->registration->aor);
+ msg_header_free_all(s2->home, (msg_header_t *)s2->registration->contact);
+ tport_unref(s2->registration->tport);
+
+ s2->registration->aor = NULL;
+ s2->registration->contact = NULL;
+ s2->registration->tport = NULL;
+
+ if (rm == NULL)
+ return 0;
+
+ assert(rm && rm->sip && rm->sip->sip_request);
+ assert(rm->sip->sip_request->rq_method == sip_method_register);
+
+ ex = rm->sip->sip_expires;
+ date = rm->sip->sip_date;
+
+ contact = sip_contact_dup(s2->home, rm->sip->sip_contact);
+
+ for (m_prev = &contact; *m_prev;) {
+ m = *m_prev;
+
+ expires = sip_contact_expires(m, ex, date,
+ s2_default_registration_duration,
+ now);
+ if (expires) {
+ char *p = su_sprintf(s2->home, "expires=%lu", (unsigned long)expires);
+ msg_header_add_param(s2->home, m->m_common, p);
+ m_prev = &m->m_next;
+ }
+ else {
+ *m_prev = m->m_next;
+ m->m_next = NULL;
+ msg_header_free(s2->home, (msg_header_t *)m);
+ }
+ }
+
+ if (contact == NULL)
+ return 0;
+
+ s2->registration->aor = sip_to_dup(s2->home, rm->sip->sip_to);
+ s2->registration->contact = contact;
+ s2->registration->tport = tport_ref(rm->tport);
+
+ s2sip->sut.aor = s2->registration->aor;
+ s2sip->sut.contact = s2->registration->contact;
+ s2sip->sut.tport = s2->registration->tport;
+
+ return 0;
+}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h Tue Mar 3 16:00:56 2009
@@ -24,42 +24,20 @@
#ifndef S2TESTER_H
#define S2TESTER_H
-#define TP_STACK_T struct tester
-#define SU_ROOT_MAGIC_T struct tester
-
#include <sofia-sip/su_wait.h>
#include <sofia-sip/sip.h>
#include <sofia-sip/tport.h>
#include <sofia-sip/nua.h>
+#include <sofia-sip/su_string.h>
+#include "s2base.h"
#include "s2util.h"
+#include "s2sip.h"
-struct tester
+struct s2nua
{
su_home_t home[1];
- su_root_t *root;
- msg_mclass_t const *mclass;
- int flags;
-
- char const *hostname;
- tport_t *master;
-
- sip_to_t *local;
- sip_contact_t *contact;
- struct {
- sip_contact_t *contact;
- tport_t *tport;
- } udp, tcp, tls;
-
- struct message {
- struct message *next, **prev;
- msg_t *msg;
- sip_t *sip;
- tport_t *tport;
- su_time_t when;
- } *received;
-
nua_t *nua;
struct event {
@@ -76,33 +54,8 @@
sip_contact_t *contact;
tport_t *tport;
} registration[1];
-
- unsigned long tid;
-
- /* Settings */
- int server_uses_rport;
};
-struct dialog
-{
- su_home_t home[1];
- sip_from_t *local;
- sip_to_t *remote;
- sip_call_id_t *call_id;
- uint32_t lseq, rseq;
- sip_contact_t *target;
- sip_route_t *route;
- sip_contact_t *contact;
-
- tport_t *tport;
- msg_t *invite; /* latest invite sent */
-};
-
-extern char const *s2_tester;
-extern int s2_start_stop;
-extern struct tester *s2;
-extern tp_stack_class_t const s2_stack[1];
-
extern unsigned s2_default_registration_duration;
extern char const s2_auth_digest_str[];
extern char const s2_auth_credentials[];
@@ -115,9 +68,7 @@
extern int s2_nua_thread;
-void s2_case(char const *tag,
- char const *title,
- char const *description);
+extern struct s2nua *s2;
struct event *s2_remove_event(struct event *);
void s2_free_event(struct event *);
@@ -127,54 +78,23 @@
struct event *s2_wait_for_event(nua_event_t event, int status);
int s2_check_event(nua_event_t event, int status);
int s2_check_callstate(enum nua_callstate state);
-
-struct message *s2_remove_message(struct message *m);
-void s2_free_message(struct message *m);
-void s2_flush_messages(void);
-
-struct message *s2_next_response(void);
-struct message *s2_wait_for_response(int status, sip_method_t , char const *);
-int s2_check_response(int status, sip_method_t method, char const *name);
-
-struct message *s2_next_request(void);
-struct message *s2_wait_for_request(sip_method_t method, char const *name);
-struct message *s2_wait_for_request_timeout(sip_method_t, char const *,
- int timeout);
-int s2_check_request(sip_method_t method, char const *name);
-int s2_check_request_timeout(sip_method_t method, char const *, int timeout);
-
int s2_check_substate(struct event *e, enum nua_substate state);
#define SIP_METHOD_UNKNOWN sip_method_unknown, NULL
-void s2_save_uas_dialog(struct dialog *d, sip_t *sip);
-
-struct message *s2_respond_to(struct message *m, struct dialog *d,
- int status, char const *phrase,
- tag_type_t tag, tag_value_t value, ...);
-
-int s2_request_to(struct dialog *d,
- sip_method_t method, char const *name,
- tport_t *tport,
- tag_type_t tag, tag_value_t value, ...);
-
-int s2_update_dialog(struct dialog *d, struct message *response);
-
-int s2_save_register(struct message *m);
-
void s2_flush_all(void);
-void s2_setup_base(char const *label, char const *hostname);
-void s2_setup_logs(int level);
-void s2_setup_tport(char const * const *protocols,
- tag_type_t tag, tag_value_t value, ...);
-void s2_teardown(void);
-
nua_t *s2_nua_setup(char const *label, tag_type_t tag, tag_value_t value, ...);
-void s2_teardown_started(char const *label);
void s2_nua_teardown(void);
+
+void s2_nua_fast_forward(unsigned long seconds,
+ su_root_t *steproot);
+
+int s2_save_register(struct message *m);
+
void s2_register_setup(void);
void s2_register_teardown(void);
#endif
+
1
0
[commit] r12397 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nua
by FreeSWITCH SVN 03 Mar '09
by FreeSWITCH SVN 03 Mar '09
03 Mar '09
Author: mikej
Date: Tue Mar 3 16:00:18 2009
New Revision: 12397
Log:
Tue Mar 3 11:30:32 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* check_nua: added test case for CANCELed INVITE timing out
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Mar 3 16:00:18 2009
@@ -1 +1 @@
-Tue Mar 3 11:27:12 CST 2009
+Tue Mar 3 15:59:49 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c Tue Mar 3 16:00:18 2009
@@ -1005,6 +1005,53 @@
}
END_TEST
+
+START_TEST(cancel_2_2_8)
+{
+ nua_handle_t *nh;
+ struct message *invite, *cancel;
+ int timeout;
+
+ s2_case("2.2.8", "CANCEL and INVITE times out",
+ "NUA is caller, NUA sends CANCEL after receiving 180 "
+ "but UAS never responds.");
+
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
+
+ nua_invite(nh, SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
+ TAG_END());
+ fail_unless(s2_check_callstate(nua_callstate_calling));
+
+ invite = s2_sip_wait_for_request(SIP_METHOD_INVITE);
+ process_offer(invite);
+ respond_with_sdp(
+ invite, dialog, SIP_180_RINGING,
+ SIPTAG_CONTENT_DISPOSITION_STR("session;handling=optional"),
+ TAG_END());
+ fail_unless(s2_check_event(nua_r_invite, 180));
+ fail_unless(s2_check_callstate(nua_callstate_proceeding));
+
+ nua_cancel(nh, TAG_END());
+ cancel = s2_sip_wait_for_request(SIP_METHOD_CANCEL);
+ s2_sip_free_message(cancel);
+ fail_if(!cancel);
+
+ /* Now, time out both CANCEL and INVITE */
+ for (timeout = 0; timeout < 34; timeout++) {
+ s2_nua_fast_forward(1, s2base->root);
+ cancel = s2_sip_next_request(SIP_METHOD_CANCEL);
+ if (cancel)
+ s2_sip_free_message(cancel);
+ }
+
+ fail_unless(s2_check_event(nua_r_cancel, 408));
+ fail_unless(s2_check_event(nua_r_invite, 408));
+ fail_unless(s2_check_callstate(nua_callstate_terminated));
+ nua_handle_destroy(nh);
+}
+END_TEST
+
+
TCase *cancel_tcase(int threading)
{
TCase *tc = tcase_create("2.2 - CANCEL");
@@ -1017,6 +1064,7 @@
if (XXX) tcase_add_test(tc, cancel_2_2_5);
tcase_add_test(tc, cancel_2_2_6);
tcase_add_test(tc, cancel_2_2_7);
+ tcase_add_test(tc, cancel_2_2_8);
return tc;
}
1
0
03 Mar '09
Author: brian
Date: Tue Mar 3 15:47:18 2009
New Revision: 12396
Log:
you can't join a detached thread later on
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Tue Mar 3 15:47:18 2009
@@ -669,7 +669,6 @@
int x = 0;
switch_threadattr_create(&thd_attr, profile->pool);
- switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
switch_threadattr_priority_increase(thd_attr);
switch_thread_create(&thread, thd_attr, sofia_profile_worker_thread_run, profile, profile->pool);
1
0
03 Mar '09
Author: anthm
Date: Tue Mar 3 14:55:39 2009
New Revision: 12395
Log:
FSCORE-313
Modified:
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Tue Mar 3 14:55:39 2009
@@ -2238,6 +2238,8 @@
unsigned int timelimit = 60;
switch_channel_t *new_channel = NULL;
switch_event_t *params = NULL;
+ char stupid[128] = "";
+
if (switch_strlen_zero(outbound_profile->destination_number)) {
goto done;
}
@@ -2357,7 +2359,11 @@
myflags |= SOF_NOBLOCK;
}
- if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL,
+ switch_snprintf(stupid, sizeof(stupid), "user/%s", user);
+ if (switch_stristr(stupid, d_dest)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Waddya Daft? You almost called '%s' in an infinate loop!\n", stupid);
+ cause = SWITCH_CAUSE_INVALID_IE_CONTENTS;
+ } else if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL,
cid_name_override, cid_num_override, NULL, var_event, myflags) == SWITCH_STATUS_SUCCESS) {
const char *context;
switch_caller_profile_t *cp;
1
0
[commit] r12393 - in freeswitch/trunk: conf/autoload_configs libs/esl/perl
by FreeSWITCH SVN 03 Mar '09
by FreeSWITCH SVN 03 Mar '09
03 Mar '09
Author: brian
Date: Tue Mar 3 14:20:27 2009
New Revision: 12393
Log:
revert
Modified:
freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml
freeswitch/trunk/libs/esl/perl/ESL.pm
freeswitch/trunk/libs/esl/perl/esl_wrap.cpp
Modified: freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml (original)
+++ freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml Tue Mar 3 14:20:27 2009
@@ -3,8 +3,8 @@
<!-- The port where you want to run the http service (default 8080) -->
<param name="http-port" value="8080"/>
<!-- if all 3 of the following params exist all http traffic will require auth -->
- <!-- <param name="auth-realm" value="freeswitch"/> -->
- <!-- <param name="auth-user" value="freeswitch"/> -->
- <!-- <param name="auth-pass" value="works"/> -->
+ <param name="auth-realm" value="freeswitch"/>
+ <param name="auth-user" value="freeswitch"/>
+ <param name="auth-pass" value="works"/>
</settings>
</configuration>
Modified: freeswitch/trunk/libs/esl/perl/ESL.pm
==============================================================================
--- freeswitch/trunk/libs/esl/perl/ESL.pm (original)
+++ freeswitch/trunk/libs/esl/perl/ESL.pm Tue Mar 3 14:20:27 2009
@@ -1,5 +1,8 @@
-# This file was created automatically by SWIG 1.3.29.
+# This file was automatically generated by SWIG (http://www.swig.org)
+# Version 1.3.35
+#
# Don't modify this file, modify the SWIG interface instead.
+
package ESL;
require Exporter;
require DynaLoader;
Modified: freeswitch/trunk/libs/esl/perl/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/perl/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/perl/esl_wrap.cpp Tue Mar 3 14:20:27 2009
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org)
- * Version 1.3.29
+ * Version 1.3.35
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -12,7 +12,7 @@
#define SWIG_CASTRANK_MODE
#ifdef __cplusplus
-template<class T> class SwigValueWrapper {
+template<typename T> class SwigValueWrapper {
T *tt;
public:
SwigValueWrapper() : tt(0) { }
@@ -25,6 +25,10 @@
private:
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
};
+
+template <typename T> T SwigValueInit() {
+ return T();
+}
#endif
/* -----------------------------------------------------------------------------
@@ -34,14 +38,14 @@
/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC)
-# if (__SUNPRO_CC <= 0x560)
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# else
-# define SWIGTEMPLATEDISAMBIGUATOR
-# endif
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+# define SWIGTEMPLATEDISAMBIGUATOR template
# else
-# define SWIGTEMPLATEDISAMBIGUATOR
+# define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif
@@ -120,10 +124,16 @@
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
/* -----------------------------------------------------------------------------
* swigrun.swg
*
@@ -133,7 +143,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "2"
+#define SWIG_RUNTIME_VERSION "4"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@@ -168,6 +178,7 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
+#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@@ -308,10 +319,10 @@
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
@@ -356,7 +367,7 @@
while ((*f2 == ' ') && (f2 != l2)) ++f2;
if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
}
- return (l1 - f1) - (l2 - f2);
+ return (int)((l1 - f1) - (l2 - f2));
}
/*
@@ -438,8 +449,8 @@
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}
/*
@@ -792,6 +803,10 @@
# endif
#endif /* !INT2PTR */
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
#ifndef get_sv
# define get_sv perl_get_sv
#endif
@@ -940,6 +955,11 @@
/* SWIG Perl macros */
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+# define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
/* Macro to call an XS function */
#ifdef PERL_OBJECT
# define SWIG_CALLXS(_name) _name(cv,pPerl)
@@ -951,51 +971,50 @@
# endif
#endif
-/* Note: SwigMagicFuncHack is a typedef used to get the C++ compiler to just shut up already */
-
#ifdef PERL_OBJECT
#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this;
-typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
-typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *);
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
#define SWIGCLASS_STATIC
-#else
+
+#else /* PERL_OBJECT */
+
#define MAGIC_PPERL
#define SWIGCLASS_STATIC static SWIGUNUSED
+
#ifndef MULTIPLICITY
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
-typedef int (*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
-typedef int (*SwigMagicFuncHack)(SV *, MAGIC *);
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
+#else /* MULTIPLICITY */
-#else
#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
-typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+
#ifdef __cplusplus
extern "C" {
#endif
-typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *);
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
-#endif
-#endif
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
/* Workaround for bug in perl 5.6.x croak and earlier */
#if (PERL_VERSION < 8)
@@ -1019,6 +1038,35 @@
#endif
+/*
+ Define how strict is the cast between strings and integers/doubles
+ when overloading between these types occurs.
+
+ The default is making it as strict as possible by using SWIG_AddCast
+ when needed.
+
+ You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+ disable the SWIG_AddCast, making the casting between string and
+ numbers less strict.
+
+ In the end, we try to solve the overloading between strings and
+ numerical types in the more natural way, but if you can avoid it,
+ well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+# define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
#include <stdlib.h>
@@ -1035,7 +1083,7 @@
SWIGRUNTIME swig_cast_info *
SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
- SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp((char*)iter->type->name, c) == 0))
+ SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0))
|| (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
}
@@ -1093,7 +1141,11 @@
if (!tc) {
return SWIG_ERROR;
}
- *ptr = SWIG_TypeCast(tc,voidptr);
+ {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ }
} else {
*ptr = voidptr;
}
@@ -1183,7 +1235,7 @@
const char *c = 0;
if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
- c = SvPV(obj, PL_na);
+ c = SvPV_nolen(obj);
/* Pointer values must start with leading underscore */
if (*c != '_') return SWIG_ERROR;
c++;
@@ -1200,7 +1252,7 @@
#define SWIG_croak(x) { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
-typedef XS(SwigPerlWrapper);
+typedef XSPROTO(SwigPerlWrapper);
typedef SwigPerlWrapper *SwigPerlWrapperPtr;
/* Structure for command table */
@@ -1253,8 +1305,8 @@
sv_magic(sv,sv,'U',(char *) name,strlen(name));
mg = mg_find(sv,'U');
mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
- mg->mg_virtual->svt_get = (SwigMagicFuncHack) get;
- mg->mg_virtual->svt_set = (SwigMagicFuncHack) set;
+ mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+ mg->mg_virtual->svt_set = (SwigMagicFunc) set;
mg->mg_virtual->svt_len = 0;
mg->mg_virtual->svt_clear = 0;
mg->mg_virtual->svt_free = 0;
@@ -1268,7 +1320,7 @@
/* first check if pointer already created */
if (!type_pointer) {
- pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
+ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
if (pointer && SvOK(pointer)) {
type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
}
@@ -1282,7 +1334,7 @@
SV *pointer;
/* create a new pointer */
- pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
+ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
sv_setiv(pointer, PTR2IV(module));
}
@@ -1377,6 +1429,12 @@
#ifdef check
#undef check
#endif
+#ifdef seekdir
+ #undef seekdir
+#endif
+#ifdef open
+ #undef open
+#endif
@@ -1405,7 +1463,8 @@
#define SWIG_name "ESLc::boot_ESL"
#define SWIG_prefix "ESLc::"
-#define SWIGVERSION 0x010329
+#define SWIGVERSION 0x010335
+#define SWIG_VERSION SWIGVERSION
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
@@ -1434,7 +1493,7 @@
SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor()
+SWIG_pchar_descriptor(void)
{
static int init = 0;
static swig_type_info* info = 0;
@@ -1488,16 +1547,8 @@
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
SV *obj = sv_newmortal();
- if (size && carray) {
- if (carray[size - 1] == 0) {
- sv_setpv(obj, carray);
- } else {
- char *tmp = (new char[size + 1]);
- memcpy(tmp, carray, size);
- tmp[size] = 0;
- sv_setpv(obj, tmp);
- delete[] tmp;
- }
+ if (carray) {
+ sv_setpvn(obj, carray, size);
} else {
sv_setsv(obj, &PL_sv_undef);
}
@@ -1513,14 +1564,12 @@
#include <limits.h>
-#ifndef LLONG_MIN
-# define LLONG_MIN LONG_LONG_MIN
-#endif
-#ifndef LLONG_MAX
-# define LLONG_MAX LONG_LONG_MAX
-#endif
-#ifndef ULLONG_MAX
-# define ULLONG_MAX ULONG_LONG_MAX
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+# define LLONG_MAX __LONG_LONG_MAX__
+# define LLONG_MIN (-LLONG_MAX - 1LL)
+# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
#endif
@@ -1534,7 +1583,7 @@
if (val) *val = (double) SvIV(obj);
return SWIG_AddCast(SWIG_OK);
} else {
- const char *nptr = SvPV(obj, PL_na);
+ const char *nptr = SvPV_nolen(obj);
if (nptr) {
char *endptr;
double v = strtod(nptr, &endptr);
@@ -1544,7 +1593,7 @@
} else {
if (*endptr == '\0') {
if (val) *val = v;
- return SWIG_AddCast(SWIG_OK);
+ return SWIG_Str2NumCast(SWIG_OK);
}
}
}
@@ -1597,17 +1646,19 @@
return SWIG_OK;
} else {
int dispatch = 0;
- const char *nptr = SvPV(obj, PL_na);
+ const char *nptr = SvPV_nolen(obj);
if (nptr) {
char *endptr;
- long v = strtol(nptr, &endptr,0);
+ long v;
+ errno = 0;
+ v = strtol(nptr, &endptr,0);
if (errno == ERANGE) {
errno = 0;
return SWIG_OverflowError;
} else {
if (*endptr == '\0') {
if (val) *val = v;
- return SWIG_AddCast(SWIG_OK);
+ return SWIG_Str2NumCast(SWIG_OK);
}
}
}
@@ -1668,6 +1719,10 @@
return obj;
}
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef PERL_OBJECT
#define MAGIC_CLASS _wrap_ESL_var::
class _wrap_ESL_var : public CPerlObj {
@@ -1687,6 +1742,10 @@
#endif
#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
extern "C" {
#endif
XS(_wrap_ESLevent_event_set) {
@@ -1779,11 +1838,11 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialized_string_set" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
if (arg1->serialized_string) delete[] arg1->serialized_string;
if (arg2) {
- size_t size = strlen(arg2) + 1;
- arg1->serialized_string = reinterpret_cast< char* >(memcpy((new char[size]), arg2, sizeof(char)*(size)));
+ size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+ arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
} else {
arg1->serialized_string = 0;
}
@@ -1817,7 +1876,7 @@
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
result = (char *) ((arg1)->serialized_string);
- ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
XSRETURN(argvi);
fail:
@@ -1914,13 +1973,13 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "char const *""'");
}
- arg1 = buf1;
+ arg1 = reinterpret_cast< char * >(buf1);
if (items > 1) {
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
}
result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
@@ -2163,10 +2222,10 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialize" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
}
result = (char *)(arg1)->serialize((char const *)arg2);
- ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
XSRETURN(argvi);
@@ -2247,9 +2306,9 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_getHeader" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (char *)(arg1)->getHeader(arg2);
- ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
XSRETURN(argvi);
@@ -2279,7 +2338,7 @@
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
result = (char *)(arg1)->getBody();
- ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
XSRETURN(argvi);
fail:
@@ -2307,7 +2366,7 @@
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
result = (char *)(arg1)->getType();
- ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
XSRETURN(argvi);
fail:
@@ -2342,7 +2401,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addBody" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (bool)(arg1)->addBody((char const *)arg2);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
@@ -2385,12 +2444,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addHeader" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_addHeader" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
@@ -2431,7 +2490,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_delHeader" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (bool)(arg1)->delHeader((char const *)arg2);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
@@ -2526,17 +2585,17 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'");
}
- arg1 = buf1;
+ arg1 = reinterpret_cast< char * >(buf1);
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
@@ -2767,7 +2826,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_send" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (int)(arg1)->send((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -2806,7 +2865,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendRecv" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | SWIG_SHADOW); argvi++ ;
@@ -3057,12 +3116,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_filter" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
result = (int)(arg1)->filter((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3107,12 +3166,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_events" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_events" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3161,20 +3220,20 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_execute" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
if (items > 2) {
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_execute" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
}
if (items > 3) {
res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_execute" "', argument " "4"" of type '" "char const *""'");
}
- arg4 = buf4;
+ arg4 = reinterpret_cast< char * >(buf4);
}
result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3218,7 +3277,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setBlockingExecute" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (int)(arg1)->setBlockingExecute((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3257,7 +3316,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setEventLock" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (int)(arg1)->setEventLock((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3393,7 +3452,7 @@
* structures together.
*
* The generated swig_type_info structures are assigned staticly to an initial
- * array. We just loop though that array, and handle each type individually.
+ * array. We just loop through that array, and handle each type individually.
* First we lookup if this type has been already loaded, and if so, use the
* loaded structure instead of the generated one. Then we have to fill in the
* cast linked list. The cast data is initially stored in something like a
@@ -3431,32 +3490,58 @@
#define SWIGRUNTIME_DEBUG
#endif
+
SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
- swig_module_info *module_head;
- static int init_run = 0;
+ swig_module_info *module_head, *iter;
+ int found, init;
clientdata = clientdata;
- if (init_run) return;
- init_run = 1;
-
- /* Initialize the swig_module */
- swig_module.type_initial = swig_type_initial;
- swig_module.cast_initial = swig_cast_initial;
+ /* check to see if the circular list has been setup, if not, set it up */
+ if (swig_module.next==0) {
+ /* Initialize the swig_module */
+ swig_module.type_initial = swig_type_initial;
+ swig_module.cast_initial = swig_cast_initial;
+ swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
+ }
/* Try and load any already created modules */
module_head = SWIG_GetModule(clientdata);
- if (module_head) {
+ if (!module_head) {
+ /* This is the first module loaded for this interpreter */
+ /* so set the swig module into the interpreter */
+ SWIG_SetModule(clientdata, &swig_module);
+ module_head = &swig_module;
+ } else {
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+ found=0;
+ iter=module_head;
+ do {
+ if (iter==&swig_module) {
+ found=1;
+ break;
+ }
+ iter=iter->next;
+ } while (iter!= module_head);
+
+ /* if the is found in the list, then all is done and we may leave */
+ if (found) return;
+ /* otherwise we must add out module into the list */
swig_module.next = module_head->next;
module_head->next = &swig_module;
- } else {
- /* This is the first module loaded */
- swig_module.next = &swig_module;
- SWIG_SetModule(clientdata, &swig_module);
}
+ /* When multiple interpeters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0) return;
+
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
@@ -3610,7 +3695,7 @@
/* Install variables */
for (i = 0; swig_variables[i].name; i++) {
SV *sv;
- sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2);
+ sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
if (swig_variables[i].type) {
SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
} else {
@@ -3622,7 +3707,7 @@
/* Install constant */
for (i = 0; swig_constants[i].type; i++) {
SV *sv;
- sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2);
+ sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
switch(swig_constants[i].type) {
case SWIG_INT:
sv_setiv(sv, (IV) swig_constants[i].lvalue);
1
0
[commit] r12392 - in freeswitch/trunk: . conf/autoload_configs libs/esl/perl src src/mod/applications/mod_enum src/mod/endpoints/mod_sofia
by FreeSWITCH SVN 03 Mar '09
by FreeSWITCH SVN 03 Mar '09
03 Mar '09
Author: anthm
Date: Tue Mar 3 14:16:05 2009
New Revision: 12392
Log:
FSCORE-297 FSCORE-305 FSCORE-315
Modified:
freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml
freeswitch/trunk/libs/esl/perl/ESL.pm
freeswitch/trunk/libs/esl/perl/esl_wrap.cpp
freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/trunk/src/switch_core.c
freeswitch/trunk/src/switch_rtp.c
Changes in other areas also in this revision:
Modified:
freeswitch/trunk/ (props changed)
Modified: freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml (original)
+++ freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml Tue Mar 3 14:16:05 2009
@@ -3,8 +3,8 @@
<!-- The port where you want to run the http service (default 8080) -->
<param name="http-port" value="8080"/>
<!-- if all 3 of the following params exist all http traffic will require auth -->
- <param name="auth-realm" value="freeswitch"/>
- <param name="auth-user" value="freeswitch"/>
- <param name="auth-pass" value="works"/>
+ <!-- <param name="auth-realm" value="freeswitch"/> -->
+ <!-- <param name="auth-user" value="freeswitch"/> -->
+ <!-- <param name="auth-pass" value="works"/> -->
</settings>
</configuration>
Modified: freeswitch/trunk/libs/esl/perl/ESL.pm
==============================================================================
--- freeswitch/trunk/libs/esl/perl/ESL.pm (original)
+++ freeswitch/trunk/libs/esl/perl/ESL.pm Tue Mar 3 14:16:05 2009
@@ -1,8 +1,5 @@
-# This file was automatically generated by SWIG (http://www.swig.org)
-# Version 1.3.35
-#
+# This file was created automatically by SWIG 1.3.29.
# Don't modify this file, modify the SWIG interface instead.
-
package ESL;
require Exporter;
require DynaLoader;
Modified: freeswitch/trunk/libs/esl/perl/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/perl/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/perl/esl_wrap.cpp Tue Mar 3 14:16:05 2009
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org)
- * Version 1.3.35
+ * Version 1.3.29
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -12,7 +12,7 @@
#define SWIG_CASTRANK_MODE
#ifdef __cplusplus
-template<typename T> class SwigValueWrapper {
+template<class T> class SwigValueWrapper {
T *tt;
public:
SwigValueWrapper() : tt(0) { }
@@ -25,10 +25,6 @@
private:
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
};
-
-template <typename T> T SwigValueInit() {
- return T();
-}
#endif
/* -----------------------------------------------------------------------------
@@ -38,14 +34,14 @@
/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# elif defined(__HP_aCC)
-/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
-/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
-# define SWIGTEMPLATEDISAMBIGUATOR template
+# if defined(__SUNPRO_CC)
+# if (__SUNPRO_CC <= 0x560)
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+# define SWIGTEMPLATEDISAMBIGUATOR
+# endif
# else
-# define SWIGTEMPLATEDISAMBIGUATOR
+# define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif
@@ -124,16 +120,10 @@
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
# define _CRT_SECURE_NO_DEPRECATE
#endif
-/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
-#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
-# define _SCL_SECURE_NO_DEPRECATE
-#endif
-
-
/* -----------------------------------------------------------------------------
* swigrun.swg
*
@@ -143,7 +133,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "4"
+#define SWIG_RUNTIME_VERSION "2"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@@ -178,7 +168,6 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
-#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@@ -319,10 +308,10 @@
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *, int *);
+typedef void *(*swig_converter_func)(void *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
-/* Structure to store information on one type */
+/* Structure to store inforomation on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
@@ -367,7 +356,7 @@
while ((*f2 == ' ') && (f2 != l2)) ++f2;
if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
}
- return (int)((l1 - f1) - (l2 - f2));
+ return (l1 - f1) - (l2 - f2);
}
/*
@@ -449,8 +438,8 @@
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
}
/*
@@ -803,10 +792,6 @@
# endif
#endif /* !INT2PTR */
-#ifndef SvPV_nolen
-# define SvPV_nolen(x) SvPV(x,PL_na)
-#endif
-
#ifndef get_sv
# define get_sv perl_get_sv
#endif
@@ -955,11 +940,6 @@
/* SWIG Perl macros */
-/* Macro to declare an XS function */
-#ifndef XSPROTO
-# define XSPROTO(name) void name(pTHX_ CV* cv)
-#endif
-
/* Macro to call an XS function */
#ifdef PERL_OBJECT
# define SWIG_CALLXS(_name) _name(cv,pPerl)
@@ -971,50 +951,51 @@
# endif
#endif
+/* Note: SwigMagicFuncHack is a typedef used to get the C++ compiler to just shut up already */
+
#ifdef PERL_OBJECT
#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this;
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
-typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
#define SWIGCLASS_STATIC
-
-#else /* PERL_OBJECT */
-
+#else
#define MAGIC_PPERL
#define SWIGCLASS_STATIC static SWIGUNUSED
-
#ifndef MULTIPLICITY
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
-typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+typedef int (*SwigMagicFuncHack)(SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
-#else /* MULTIPLICITY */
+#else
#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
-
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
-typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
-#endif /* MULTIPLICITY */
-#endif /* PERL_OBJECT */
+#endif
+#endif
/* Workaround for bug in perl 5.6.x croak and earlier */
#if (PERL_VERSION < 8)
@@ -1038,35 +1019,6 @@
#endif
-/*
- Define how strict is the cast between strings and integers/doubles
- when overloading between these types occurs.
-
- The default is making it as strict as possible by using SWIG_AddCast
- when needed.
-
- You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
- disable the SWIG_AddCast, making the casting between string and
- numbers less strict.
-
- In the end, we try to solve the overloading between strings and
- numerical types in the more natural way, but if you can avoid it,
- well, avoid it using %rename, for example.
-*/
-#ifndef SWIG_PERL_NO_STRICT_STR2NUM
-# ifndef SWIG_PERL_STRICT_STR2NUM
-# define SWIG_PERL_STRICT_STR2NUM
-# endif
-#endif
-#ifdef SWIG_PERL_STRICT_STR2NUM
-/* string takes precedence */
-#define SWIG_Str2NumCast(x) SWIG_AddCast(x)
-#else
-/* number takes precedence */
-#define SWIG_Str2NumCast(x) x
-#endif
-
-
#include <stdlib.h>
@@ -1083,7 +1035,7 @@
SWIGRUNTIME swig_cast_info *
SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
- SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0))
+ SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp((char*)iter->type->name, c) == 0))
|| (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
}
@@ -1141,11 +1093,7 @@
if (!tc) {
return SWIG_ERROR;
}
- {
- int newmemory = 0;
- *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
- }
+ *ptr = SWIG_TypeCast(tc,voidptr);
} else {
*ptr = voidptr;
}
@@ -1235,7 +1183,7 @@
const char *c = 0;
if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
- c = SvPV_nolen(obj);
+ c = SvPV(obj, PL_na);
/* Pointer values must start with leading underscore */
if (*c != '_') return SWIG_ERROR;
c++;
@@ -1252,7 +1200,7 @@
#define SWIG_croak(x) { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
-typedef XSPROTO(SwigPerlWrapper);
+typedef XS(SwigPerlWrapper);
typedef SwigPerlWrapper *SwigPerlWrapperPtr;
/* Structure for command table */
@@ -1305,8 +1253,8 @@
sv_magic(sv,sv,'U',(char *) name,strlen(name));
mg = mg_find(sv,'U');
mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
- mg->mg_virtual->svt_get = (SwigMagicFunc) get;
- mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+ mg->mg_virtual->svt_get = (SwigMagicFuncHack) get;
+ mg->mg_virtual->svt_set = (SwigMagicFuncHack) set;
mg->mg_virtual->svt_len = 0;
mg->mg_virtual->svt_clear = 0;
mg->mg_virtual->svt_free = 0;
@@ -1320,7 +1268,7 @@
/* first check if pointer already created */
if (!type_pointer) {
- pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
if (pointer && SvOK(pointer)) {
type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
}
@@ -1334,7 +1282,7 @@
SV *pointer;
/* create a new pointer */
- pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
sv_setiv(pointer, PTR2IV(module));
}
@@ -1429,12 +1377,6 @@
#ifdef check
#undef check
#endif
-#ifdef seekdir
- #undef seekdir
-#endif
-#ifdef open
- #undef open
-#endif
@@ -1463,8 +1405,7 @@
#define SWIG_name "ESLc::boot_ESL"
#define SWIG_prefix "ESLc::"
-#define SWIGVERSION 0x010335
-#define SWIG_VERSION SWIGVERSION
+#define SWIGVERSION 0x010329
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
@@ -1493,7 +1434,7 @@
SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor(void)
+SWIG_pchar_descriptor()
{
static int init = 0;
static swig_type_info* info = 0;
@@ -1547,8 +1488,16 @@
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
SV *obj = sv_newmortal();
- if (carray) {
- sv_setpvn(obj, carray, size);
+ if (size && carray) {
+ if (carray[size - 1] == 0) {
+ sv_setpv(obj, carray);
+ } else {
+ char *tmp = (new char[size + 1]);
+ memcpy(tmp, carray, size);
+ tmp[size] = 0;
+ sv_setpv(obj, tmp);
+ delete[] tmp;
+ }
} else {
sv_setsv(obj, &PL_sv_undef);
}
@@ -1564,12 +1513,14 @@
#include <limits.h>
-#if !defined(SWIG_NO_LLONG_MAX)
-# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
-# define LLONG_MAX __LONG_LONG_MAX__
-# define LLONG_MIN (-LLONG_MAX - 1LL)
-# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
-# endif
+#ifndef LLONG_MIN
+# define LLONG_MIN LONG_LONG_MIN
+#endif
+#ifndef LLONG_MAX
+# define LLONG_MAX LONG_LONG_MAX
+#endif
+#ifndef ULLONG_MAX
+# define ULLONG_MAX ULONG_LONG_MAX
#endif
@@ -1583,7 +1534,7 @@
if (val) *val = (double) SvIV(obj);
return SWIG_AddCast(SWIG_OK);
} else {
- const char *nptr = SvPV_nolen(obj);
+ const char *nptr = SvPV(obj, PL_na);
if (nptr) {
char *endptr;
double v = strtod(nptr, &endptr);
@@ -1593,7 +1544,7 @@
} else {
if (*endptr == '\0') {
if (val) *val = v;
- return SWIG_Str2NumCast(SWIG_OK);
+ return SWIG_AddCast(SWIG_OK);
}
}
}
@@ -1646,19 +1597,17 @@
return SWIG_OK;
} else {
int dispatch = 0;
- const char *nptr = SvPV_nolen(obj);
+ const char *nptr = SvPV(obj, PL_na);
if (nptr) {
char *endptr;
- long v;
- errno = 0;
- v = strtol(nptr, &endptr,0);
+ long v = strtol(nptr, &endptr,0);
if (errno == ERANGE) {
errno = 0;
return SWIG_OverflowError;
} else {
if (*endptr == '\0') {
if (val) *val = v;
- return SWIG_Str2NumCast(SWIG_OK);
+ return SWIG_AddCast(SWIG_OK);
}
}
}
@@ -1719,10 +1668,6 @@
return obj;
}
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifdef PERL_OBJECT
#define MAGIC_CLASS _wrap_ESL_var::
class _wrap_ESL_var : public CPerlObj {
@@ -1742,10 +1687,6 @@
#endif
#ifdef __cplusplus
-}
-#endif
-
-#ifdef __cplusplus
extern "C" {
#endif
XS(_wrap_ESLevent_event_set) {
@@ -1838,11 +1779,11 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialized_string_set" "', argument " "2"" of type '" "char *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
if (arg1->serialized_string) delete[] arg1->serialized_string;
if (arg2) {
- size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
- arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+ size_t size = strlen(arg2) + 1;
+ arg1->serialized_string = reinterpret_cast< char* >(memcpy((new char[size]), arg2, sizeof(char)*(size)));
} else {
arg1->serialized_string = 0;
}
@@ -1876,7 +1817,7 @@
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
result = (char *) ((arg1)->serialized_string);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
XSRETURN(argvi);
fail:
@@ -1973,13 +1914,13 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "char const *""'");
}
- arg1 = reinterpret_cast< char * >(buf1);
+ arg1 = buf1;
if (items > 1) {
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
}
result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
@@ -2222,10 +2163,10 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialize" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
}
result = (char *)(arg1)->serialize((char const *)arg2);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
XSRETURN(argvi);
@@ -2306,9 +2247,9 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_getHeader" "', argument " "2"" of type '" "char *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (char *)(arg1)->getHeader(arg2);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
XSRETURN(argvi);
@@ -2338,7 +2279,7 @@
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
result = (char *)(arg1)->getBody();
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
XSRETURN(argvi);
fail:
@@ -2366,7 +2307,7 @@
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
result = (char *)(arg1)->getType();
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
XSRETURN(argvi);
fail:
@@ -2401,7 +2342,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addBody" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (bool)(arg1)->addBody((char const *)arg2);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
@@ -2444,12 +2385,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addHeader" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_addHeader" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = reinterpret_cast< char * >(buf3);
+ arg3 = buf3;
result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
@@ -2490,7 +2431,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_delHeader" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (bool)(arg1)->delHeader((char const *)arg2);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
@@ -2585,17 +2526,17 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'");
}
- arg1 = reinterpret_cast< char * >(buf1);
+ arg1 = buf1;
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = reinterpret_cast< char * >(buf3);
+ arg3 = buf3;
result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
@@ -2826,7 +2767,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_send" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (int)(arg1)->send((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -2865,7 +2806,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendRecv" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | SWIG_SHADOW); argvi++ ;
@@ -3116,12 +3057,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_filter" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = reinterpret_cast< char * >(buf3);
+ arg3 = buf3;
result = (int)(arg1)->filter((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3166,12 +3107,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_events" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_events" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = reinterpret_cast< char * >(buf3);
+ arg3 = buf3;
result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3220,20 +3161,20 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_execute" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
if (items > 2) {
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_execute" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = reinterpret_cast< char * >(buf3);
+ arg3 = buf3;
}
if (items > 3) {
res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_execute" "', argument " "4"" of type '" "char const *""'");
}
- arg4 = reinterpret_cast< char * >(buf4);
+ arg4 = buf4;
}
result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3277,7 +3218,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setBlockingExecute" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (int)(arg1)->setBlockingExecute((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3316,7 +3257,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setEventLock" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (int)(arg1)->setEventLock((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3452,7 +3393,7 @@
* structures together.
*
* The generated swig_type_info structures are assigned staticly to an initial
- * array. We just loop through that array, and handle each type individually.
+ * array. We just loop though that array, and handle each type individually.
* First we lookup if this type has been already loaded, and if so, use the
* loaded structure instead of the generated one. Then we have to fill in the
* cast linked list. The cast data is initially stored in something like a
@@ -3490,58 +3431,32 @@
#define SWIGRUNTIME_DEBUG
#endif
-
SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
- swig_module_info *module_head, *iter;
- int found, init;
+ swig_module_info *module_head;
+ static int init_run = 0;
clientdata = clientdata;
- /* check to see if the circular list has been setup, if not, set it up */
- if (swig_module.next==0) {
- /* Initialize the swig_module */
- swig_module.type_initial = swig_type_initial;
- swig_module.cast_initial = swig_cast_initial;
- swig_module.next = &swig_module;
- init = 1;
- } else {
- init = 0;
- }
+ if (init_run) return;
+ init_run = 1;
+
+ /* Initialize the swig_module */
+ swig_module.type_initial = swig_type_initial;
+ swig_module.cast_initial = swig_cast_initial;
/* Try and load any already created modules */
module_head = SWIG_GetModule(clientdata);
- if (!module_head) {
- /* This is the first module loaded for this interpreter */
- /* so set the swig module into the interpreter */
- SWIG_SetModule(clientdata, &swig_module);
- module_head = &swig_module;
- } else {
- /* the interpreter has loaded a SWIG module, but has it loaded this one? */
- found=0;
- iter=module_head;
- do {
- if (iter==&swig_module) {
- found=1;
- break;
- }
- iter=iter->next;
- } while (iter!= module_head);
-
- /* if the is found in the list, then all is done and we may leave */
- if (found) return;
- /* otherwise we must add out module into the list */
+ if (module_head) {
swig_module.next = module_head->next;
module_head->next = &swig_module;
+ } else {
+ /* This is the first module loaded */
+ swig_module.next = &swig_module;
+ SWIG_SetModule(clientdata, &swig_module);
}
- /* When multiple interpeters are used, a module could have already been initialized in
- a different interpreter, but not yet have a pointer in this interpreter.
- In this case, we do not want to continue adding types... everything should be
- set up already */
- if (init == 0) return;
-
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
@@ -3695,7 +3610,7 @@
/* Install variables */
for (i = 0; swig_variables[i].name; i++) {
SV *sv;
- sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+ sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2);
if (swig_variables[i].type) {
SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
} else {
@@ -3707,7 +3622,7 @@
/* Install constant */
for (i = 0; swig_constants[i].type; i++) {
SV *sv;
- sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+ sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2);
switch(swig_constants[i].type) {
case SWIG_INT:
sv_setiv(sv, (IV) swig_constants[i].lvalue);
Modified: freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c Tue Mar 3 14:16:05 2009
@@ -93,9 +93,9 @@
route = switch_core_alloc(globals.pool, sizeof(*route));
- route->service = strdup(service);
- route->regex = strdup(regex);
- route->replace = strdup(replace);
+ route->service = switch_core_strdup(globals.pool, service);
+ route->regex = switch_core_strdup(globals.pool, regex);
+ route->replace = switch_core_strdup(globals.pool, replace);
switch_mutex_lock(MUTEX);
if (!globals.route_order) {
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Tue Mar 3 14:16:05 2009
@@ -2964,12 +2964,12 @@
while (mod_sofia_globals.threads) {
switch_cond_next();
- if (++sanity >= 10000) {
+ if (++sanity >= 60000) {
break;
}
}
- switch_yield(1000000);
+ //switch_yield(1000000);
su_deinit();
switch_mutex_lock(mod_sofia_globals.hash_mutex);
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Tue Mar 3 14:16:05 2009
@@ -662,7 +662,7 @@
return NULL;
}
-void launch_sofia_worker_thread(sofia_profile_t *profile)
+switch_thread_t *launch_sofia_worker_thread(sofia_profile_t *profile)
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
@@ -680,6 +680,8 @@
break;
}
}
+
+ return thread;
}
void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj)
@@ -693,6 +695,8 @@
int use_timer = !sofia_test_pflag(profile, PFLAG_DISABLE_TIMER);
const char *supported = NULL;
int sanity;
+ switch_thread_t *worker_thread;
+ switch_status_t st;
switch_mutex_lock(mod_sofia_globals.mutex);
mod_sofia_globals.threads++;
@@ -823,7 +827,7 @@
profile->started = switch_epoch_time_now(NULL);
sofia_set_pflag_locked(profile, PFLAG_RUNNING);
- launch_sofia_worker_thread(profile);
+ worker_thread = launch_sofia_worker_thread(profile);
switch_yield(1000000);
@@ -850,15 +854,11 @@
sofia_reg_unregister(profile);
nua_shutdown(profile->nua);
su_root_run(profile->s_root);
- nua_shutdown(profile->nua);
- su_root_run(profile->s_root);
-
+
sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n");
- while (sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
- switch_yield(100000);
- }
+ switch_thread_join(&st, worker_thread);
sanity = 4;
while (profile->inuse) {
@@ -3243,10 +3243,7 @@
case nua_callstate_terminating:
if (status == 488 || switch_channel_get_state(channel) == CS_HIBERNATE) {
tech_pvt->q850_cause = SWITCH_CAUSE_MANDATORY_IE_MISSING;
- } else if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
- sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
}
- break;
case nua_callstate_terminated:
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
@@ -3274,17 +3271,17 @@
switch_channel_hangup(channel, cause);
}
}
-
- if (tech_pvt->sofia_private) {
- tech_pvt->sofia_private = NULL;
- }
-
- tech_pvt->nh = NULL;
-
-
- if (nh) {
- nua_handle_bind(nh, NULL);
- nua_handle_destroy(nh);
+ if (ss_state == nua_callstate_terminated) {
+ if (tech_pvt->sofia_private) {
+ tech_pvt->sofia_private = NULL;
+ }
+
+ tech_pvt->nh = NULL;
+
+ if (nh) {
+ nua_handle_bind(nh, NULL);
+ nua_handle_destroy(nh);
+ }
}
break;
}
Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c (original)
+++ freeswitch/trunk/src/switch_core.c Tue Mar 3 14:16:05 2009
@@ -249,6 +249,20 @@
return val;
}
+static void switch_core_unset_variables(void)
+{
+ switch_hash_index_t *hi;
+ const void *var;
+ void *val;
+
+ switch_mutex_lock(runtime.global_var_mutex);
+ for (hi = switch_hash_first(NULL, runtime.global_vars); hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, &var, NULL, &val);
+ free(val);
+ }
+ switch_mutex_unlock(runtime.global_var_mutex);
+}
+
SWITCH_DECLARE(void) switch_core_set_variable(const char *varname, const char *value)
{
char *val;
@@ -1488,6 +1502,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Finalizing Shutdown.\n");
switch_log_shutdown();
+ switch_core_unset_variables();
switch_core_memory_stop();
if (runtime.console && runtime.console != stdout && runtime.console != stderr) {
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Tue Mar 3 14:16:05 2009
@@ -409,7 +409,26 @@
SWITCH_DECLARE(void) switch_rtp_shutdown(void)
{
+ switch_core_port_allocator_t *alloc = NULL;
+ switch_hash_index_t *hi;
+ const void *var;
+ void *val;
+
+ switch_mutex_lock(port_lock);
+
+ for (hi = switch_hash_first(NULL, alloc_hash); hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, &var, NULL, &val);
+ if ((alloc = (switch_core_port_allocator_t *) val)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroy port allocator for %s\n", (char *)var);
+ switch_core_port_allocator_destroy(&alloc);
+ }
+ }
+
switch_core_hash_destroy(&alloc_hash);
+ switch_mutex_unlock(port_lock);
+
+ crypto_kernel_shutdown();
+
}
SWITCH_DECLARE(switch_port_t) switch_rtp_set_start_port(switch_port_t port)
1
0
Author: mrene
Date: Tue Mar 3 13:01:21 2009
New Revision: 12391
Log:
Add switch_vmprintf
Modified:
freeswitch/trunk/src/include/switch_core_db.h
freeswitch/trunk/src/switch_core_db.c
Modified: freeswitch/trunk/src/include/switch_core_db.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core_db.h (original)
+++ freeswitch/trunk/src/include/switch_core_db.h Tue Mar 3 13:01:21 2009
@@ -541,6 +541,11 @@
*/
SWITCH_DECLARE(char *) switch_mprintf(const char *zFormat, ...);
+/*!
+ * \see switch_mprintf
+ */
+SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap);
+
SWITCH_END_EXTERN_C
#endif
/* For Emacs:
Modified: freeswitch/trunk/src/switch_core_db.c
==============================================================================
--- freeswitch/trunk/src/switch_core_db.c (original)
+++ freeswitch/trunk/src/switch_core_db.c Tue Mar 3 13:01:21 2009
@@ -180,6 +180,12 @@
return z;
}
+SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap)
+{
+
+ return sqlite3_vmprintf(zFormat, ap);
+}
+
SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_file(char *filename)
{
switch_core_db_t *db;
1
0
Author: brian
Date: Tue Mar 3 12:03:25 2009
New Revision: 12390
Log:
FSCORE-317
Modified:
freeswitch/trunk/src/switch_core_speech.c
Modified: freeswitch/trunk/src/switch_core_speech.c
==============================================================================
--- freeswitch/trunk/src/switch_core_speech.c (original)
+++ freeswitch/trunk/src/switch_core_speech.c Tue Mar 3 12:03:25 2009
@@ -154,7 +154,7 @@
if (switch_test_flag(sh, SWITCH_SPEECH_FLAG_DONE)) {
switch_clear_flag(sh, SWITCH_SPEECH_FLAG_DONE);
*datalen = 0;
- return SWITCH_STATUS_FALSE;
+ return SWITCH_STATUS_BREAK;
}
more:
1
0