Freeswitch-trunk
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
June 2007
- 7 participants
- 182 discussions
20 Jun '07
Author: mikej
Date: Wed Jun 20 06:49:25 2007
New Revision: 5416
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
Log:
fix for new switch_log_printf prototype
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Wed Jun 20 06:49:25 2007
@@ -904,7 +904,7 @@
switch_mutex_lock(mod_sofia_globals.hash_mutex);
if ((gateway = (sofia_gateway_t *) switch_core_hash_find(mod_sofia_globals.gateway_hash, key))) {
if (switch_thread_rwlock_tryrdlock(gateway->profile->rwlock) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "Profile %s is locked\n", gateway->profile->name);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "Profile %s is locked\n", gateway->profile->name);
gateway = NULL;
}
}
1
0
20 Jun '07
Author: mikej
Date: Wed Jun 20 06:46:51 2007
New Revision: 5415
Modified:
freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
Log:
fix for new switch_log_printf prototype
Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Wed Jun 20 06:46:51 2007
@@ -732,7 +732,7 @@
if (strlen(xmltxt) > 2) {
xml = switch_xml_parse_str(xmltxt, strlen(xmltxt));
form = switch_xml_toxml(xml);
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, level,
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level,
"%s:\n-------------------------------------------------------------------------------\n"
"%s\n", ll, form);
switch_xml_free(xml);
@@ -741,7 +741,7 @@
}
}
} else {
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, level, "%s\n", data);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level, "%s\n", data);
}
}
va_end(ap);
1
0
Author: mikej
Date: Wed Jun 20 06:43:24 2007
New Revision: 5414
Modified:
freeswitch/trunk/src/include/switch_log.h
Log:
correct printf function args for modified switch_log_printf.
Modified: freeswitch/trunk/src/include/switch_log.h
==============================================================================
--- freeswitch/trunk/src/include/switch_log.h (original)
+++ freeswitch/trunk/src/include/switch_log.h Wed Jun 20 06:43:24 2007
@@ -95,7 +95,7 @@
\note there are channel macros to supply the first 4 parameters
*/
SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
- const char *userdata, switch_log_level_t level, const char *fmt, ...) PRINTF_FUNCTION(6, 7);
+ const char *userdata, switch_log_level_t level, const char *fmt, ...) PRINTF_FUNCTION(7, 8);
/*!
\brief Shut down the logging engine
1
0
Author: mikej
Date: Wed Jun 20 06:41:15 2007
New Revision: 5413
Modified:
freeswitch/trunk/libs/sofia-sip/Makefile.am
freeswitch/trunk/libs/sofia-sip/RELEASE
freeswitch/trunk/libs/sofia-sip/configure.ac
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/docs/hide_emails.sh
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_tag.h.in
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_msg.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/sofia-sip/nth_tag.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_init.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_refer.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_tag.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_tag.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_configure.h.in
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_io.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/url/torture_url.c
freeswitch/trunk/libs/sofia-sip/m4/sac-su2.m4
Log:
Update sofia-sip from darcs:
Mon May 14 12:43:07 EDT 2007 martti.mela(a)nokia.com
* su_base_port.c: fixed a double free in su_base_port_start_shared().
Fri May 25 13:56:23 EDT 2007 Pekka.Pessi(a)nokia.com
* soa: added SOATAG_ORDERED_USER(), SOATAG_REUSE_REJECTED().
Allow replacing existing m=lines.
Sun May 27 14:52:13 EDT 2007 Pekka.Pessi(a)nokia.com
* msg_parser.c: fixed bug #1726034
Mon May 28 04:57:08 EDT 2007 Pekka.Pessi(a)nokia.com
* test_nth.c: using non-blocking connect in test program, too.
Mon May 28 04:58:05 EDT 2007 Pekka.Pessi(a)nokia.com
* su.c: making all sockets non-blocking by default.
Mon May 28 04:59:28 EDT 2007 Pekka.Pessi(a)nokia.com
* m4/sac-su.m4: moved contents into sac-s2.m4
Mon May 28 05:32:26 EDT 2007 Pekka.Pessi(a)nokia.com
* RELEASE: updated.
Wed May 30 10:37:53 EDT 2007 Pekka.Pessi(a)nokia.com
* m4/sac-su2.m4: added configure option --disable-tag-cast.
Added SU_INLINE_TAG_CAST into sofia-sip/su_configure.h{,.in}.
Using SU_INLINE_TAG_CAST in
sofia-sip/sip_tag.h{,.in}
sofia-sip/http_tag.h{,.in}
sofia-sip/su_tag.h
sofia-sip/su_tag_io.h
sofia-sip/auth_module.h
sofia-sip/nth_tag.h
sofia-sip/nua_tag.h
Fri Jun 1 15:11:52 EDT 2007 Pekka.Pessi(a)nokia.com
* tport.c: fixed tport_set_params() with secondary transports
Fri Jun 1 15:13:23 EDT 2007 Pekka.Pessi(a)nokia.com
* tport_type_tcp.c: checking for end-of-stream even if su_getmsgsize() promised more data
Fri Jun 1 15:15:34 EDT 2007 Pekka.Pessi(a)nokia.com
* tport: added tport_is_clear_to_send(), allow use of tport_pending() without msg
The error callback from tport can now be registered even if there is no
request pending on transport (e.g., when keeping a transport connection open
for inbound messages).
Fri Jun 1 15:16:43 EDT 2007 Pekka.Pessi(a)nokia.com
* nta: not retrying after an transport error if application provided the transport
Fri Jun 1 15:17:23 EDT 2007 Pekka.Pessi(a)nokia.com
* sip: do not accept empty URIs (<>) in From, To, and other headers expecting name-addr format
Fri Jun 1 15:17:43 EDT 2007 Pekka.Pessi(a)nokia.com
* torture_url.c: added test for parsing empty URLs.
Fri Jun 1 15:19:27 EDT 2007 Pekka.Pessi(a)nokia.com
* nua/test_proxy.[hc]: use registered connections for outbound with TCP.
Added test_proxy_close_tports() used testing recovering from TCP failures.
Fri Jun 1 15:20:33 EDT 2007 Pekka.Pessi(a)nokia.com
* test_nua.c: added --print-tags and --tags-a, --tags=b and --tags=c options
Added more functions for handling events
Fri Jun 1 15:22:08 EDT 2007 Pekka.Pessi(a)nokia.com
* test_nua: fixed some tests depending on delivery of responses in correct order
Reordering might happen if some messages are sent over TCP, other over UDP.
Fri Jun 1 15:27:55 EDT 2007 Pekka.Pessi(a)nokia.com
* nua_register.c: re-registering in case the TCP connection towards proxy is closed
In test_nua, Mr. B is now using TCP with the test proxy.
Fri Jun 1 15:35:39 EDT 2007 Pekka.Pessi(a)nokia.com
* nua/test_refer.c: fixed SIP payload checks
Fri Jun 1 15:36:08 EDT 2007 Pekka.Pessi(a)nokia.com
* nta_internal.h: added orq_user_tport field
Tue Jun 5 06:16:43 EDT 2007 Pekka.Pessi(a)nokia.com
* hide_email.sh: now fixing links, too.
Fri Jun 15 05:34:29 EDT 2007 Pekka.Pessi(a)nokia.com
* nua: fixed documentation entries for API functions left out from doxygen
Thanks for Jerry Ricahrds for pointing this out.
Wed May 23 10:26:26 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev(a)nokia.com>
* Correct documentation for parameter type of NUTAG_WITH_SAVED
Mon Jun 18 12:34:58 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev(a)nokia.com>
* Make nua_saved_event_request() and hence NUTAG_WITH_SAVED resilient to a NULL event content
Modified: freeswitch/trunk/libs/sofia-sip/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/Makefile.am (original)
+++ freeswitch/trunk/libs/sofia-sip/Makefile.am Wed Jun 20 06:41:15 2007
@@ -24,7 +24,7 @@
ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST += m4/sac-general.m4 m4/sac-su.m4 m4/sac-coverage.m4 \
+EXTRA_DIST += m4/sac-general.m4 m4/sac-coverage.m4 \
m4/sac-su2.m4 m4/sac-tport.m4 m4/sac-openssl.m4
EXTRA_DIST += docs/build_system.txt \
Modified: freeswitch/trunk/libs/sofia-sip/RELEASE
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/RELEASE (original)
+++ freeswitch/trunk/libs/sofia-sip/RELEASE Wed Jun 20 06:41:15 2007
@@ -24,6 +24,9 @@
New features in API are marked with Doxytag macro @VERSION_1_12_7.
libsofia-sip-ua:
+- Removed extra system headers from <sofia-sip/stun_common.h>
+- Added global variable su_socket_blocking. If it is set to true,
+ sockets are created as blocking.
- Added accessor function nta_outgoing_branch()
- **template**: Added foobar() function (sofia-sip/foobar.h).
- This release is ABI/API compatible with applications linked against
Modified: freeswitch/trunk/libs/sofia-sip/configure.ac
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/configure.ac (original)
+++ freeswitch/trunk/libs/sofia-sip/configure.ac Wed Jun 20 06:41:15 2007
@@ -69,7 +69,6 @@
SAC_SOFIA_SU
SAC_OPENSSL
SAC_TPORT
-SAC_SU
### internal modules
### ----------------
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/docs/hide_emails.sh
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/docs/hide_emails.sh (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/docs/hide_emails.sh Wed Jun 20 06:41:15 2007
@@ -29,9 +29,13 @@
#
# --------------------------------------------------------------------
-echo "Hiding email addresses in ${1:-.}"
+echo "Postprocessing HTML in ${1:-.}: hiding email addresses, fixing links"
find ${1:-.} -name '*.html' -print0 |
xargs -0 \
-sed -r -i 's/([:>;][a-z][-a-z.]*)((a)[a-z][a-z]*)\.[a-z][a-z]*(["<\&])/\1\2-email.address.hidden\3/gi'
-
+sed -r -i '
+# Hide e-mail addresses
+s/([:>;][a-z][-a-z.]*)((a)[a-z][a-z]*)\.[a-z][a-z]*(["<\&])/\1\2-email.address.hidden\3/gi;
+# Fix cross-module links
+s!doxygen="([a-z]*).doxytags:../\1/" href="../\1/\1_index.html"!doxygen="\1.doxytags:../\1/" href="../\1/index.html"!g;
+'
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_tag.h.in
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_tag.h.in (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_tag.h.in Wed Jun 20 06:41:15 2007
@@ -102,7 +102,7 @@
#define HTTPTAG_HTTP_REF(x) httptag_http_ref, httptag_http_vr(&(x))
SOFIAPUBVAR tag_typedef_t httptag_http_ref;
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
su_inline
tag_value_t httptag_http_v(http_t const *v) { return (tag_value_t)v; }
su_inline
@@ -150,7 +150,7 @@
#define HTTPTAG_HEADER_REF(x) httptag_header_ref, httptag_header_vr(&(x))
SOFIAPUBVAR tag_typedef_t httptag_header_ref;
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
su_inline tag_value_t
httptag_header_v(http_header_t const *v)
{ return (tag_value_t)v; }
@@ -220,7 +220,7 @@
#define HTTPTAG_#XXXXXX#_STR_REF(x) HTTPTAG_STR_REF(#xxxxxx#, x)
SOFIAPUBVAR tag_typedef_t httptag_#xxxxxx#_str_ref;
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
su_inline tag_value_t
httptag_#xxxxxx#_v(http_#xxxxxx#_t const *v)
{ return (tag_value_t)v; }
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h Wed Jun 20 06:41:15 2007
@@ -253,7 +253,7 @@
#define AUTHTAG_MODULE_REF(x) authtag_module_ref, authtag_module_vr((&x))
SOFIAPUBVAR tag_typedef_t authtag_module_ref;
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
su_inline tag_value_t authtag_module_v(auth_mod_t *v) {
return (tag_value_t)v;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c Wed Jun 20 06:41:15 2007
@@ -1840,6 +1840,8 @@
return NULL;
}
+ b = b2;
+
continue;
}
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_msg.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_msg.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_msg.c Wed Jun 20 06:41:15 2007
@@ -797,7 +797,21 @@
{
size_t size = SIZE_MAX;
- char *s = msg_as_string(msg_home(msg), msg, NULL, 0, &size);
+ char *s;
+ char body[66 * 15 + 1];
+ int i;
+ msg_payload_t *pl;
+
+ /* Bug #1726034 */
+ for (i = 0; i < 15; i++)
+ strcpy(body + i * 66,
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n");
+ pl = msg_payload_make(msg_home(msg), body);
+
+ TEST(msg_header_insert(msg, (msg_pub_t *)tst, (void *)pl), 0);
+
+ s = msg_as_string(msg_home(msg), msg, NULL, 0, &size);
TEST_S(s,
"GET a-wife HTTP/1.1" CRLF
"Foo: bar" CRLF
@@ -806,7 +820,23 @@
"Content-Language: se-FI, fi-FI, sv-FI\r\n"
"Accept-Language: se, fi, sv\r\n"
CRLF
-"test" CRLF);
+"test" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+);
}
msg_destroy(msg);
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c Wed Jun 20 06:41:15 2007
@@ -2198,7 +2198,8 @@
TPTAG_SDWN_AFTER(stream),
TAG_END());
}
- } else {
+ }
+ else {
msg_destroy(msg);
if (stream) /* Send FIN */
tport_shutdown(tport, 1);
@@ -6172,13 +6173,6 @@
HTABLE_BODIES_WITH(outgoing_htable, oht, nta_outgoing_t, HTABLE_HASH_ORQ,
size_t, hash_value_t);
-static nta_outgoing_t *outgoing_create(nta_agent_t *agent,
- nta_response_f *callback,
- nta_outgoing_magic_t *magic,
- url_string_t const *route_url,
- tp_name_t const *tpn,
- msg_t *msg,
- tag_type_t tag, tag_value_t value, ...);
static int outgoing_features(nta_agent_t *agent, nta_outgoing_t *orq,
msg_t *msg, sip_t *sip,
tagi_t *tags);
@@ -6815,7 +6809,11 @@
/* select the tport to use for the outgoing message */
if (override_tport) {
/* note: no ref taken to the tport as its only used once here */
- tpn = tport_name(override_tport);
+ if (tport_is_secondary(override_tport)) {
+ tpn = tport_name(override_tport);
+ orq->orq_user_tport = 1;
+ }
+
}
if (route_url) {
@@ -7095,8 +7093,10 @@
if (cc)
nta_compartment_decref(&cc);
+ if (orq->orq_user_tport)
+ /* No retries */;
/* RFC3261, 18.1.1 */
- if (err == EMSGSIZE && !orq->orq_try_tcp_instead) {
+ else if (err == EMSGSIZE && !orq->orq_try_tcp_instead) {
if (strcasecmp(tpn->tpn_proto, "udp") == 0 ||
strcasecmp(tpn->tpn_proto, "*") == 0) {
outgoing_try_tcp_instead(orq);
@@ -10217,6 +10217,10 @@
}
+/** Return a new reference to the transaction transport.
+ *
+ * @note The referenced transport must be unreferenced with tport_unref()
+ */
tport_t *
nta_incoming_transport(nta_agent_t *agent,
nta_incoming_t *irq,
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h Wed Jun 20 06:41:15 2007
@@ -504,6 +504,7 @@
unsigned orq_completed : 1;
unsigned orq_delayed : 1;
unsigned orq_stripped_uri : 1;
+ unsigned orq_user_tport : 1; /**< Application provided tport - don't retry */
unsigned orq_try_tcp_instead : 1;
unsigned orq_try_udp_instead : 1;
unsigned orq_reliable : 1; /**< Transport is reliable */
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/sofia-sip/nth_tag.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/sofia-sip/nth_tag.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/sofia-sip/nth_tag.h Wed Jun 20 06:41:15 2007
@@ -101,7 +101,7 @@
NTH_DLL extern tag_typedef_t nthtag_error_msg_ref;
#define NTHTAG_ERROR_MSG_REF(x) nthtag_error_msg_ref, tag_bool_vr(&(x))
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
struct nth_client_s;
su_inline tag_value_t nthtag_template_v(struct nth_client_s const *v)
{ return (tag_value_t)v; }
@@ -119,7 +119,7 @@
NTH_DLL extern tag_typedef_t nthtag_template_ref;
#define NTHTAG_TEMPLATE_REF(x) nthtag_template_ref, nthtag_template_vr(&(x))
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
su_inline tag_value_t nthtag_message_v(struct msg_s *v)
{ return (tag_value_t)v; }
su_inline tag_value_t nthtag_message_vr(struct msg_s **vp)
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c Wed Jun 20 06:41:15 2007
@@ -570,6 +570,7 @@
if (c == INVALID_SOCKET) {
c = su_socket(t->t_addr->su_family, SOCK_STREAM, 0); TEST_1(c != SOCK_STREAM);
+ TEST_1(su_setblocking(c, 1) != -1);
TEST_1(connect(c, &t->t_addr->su_sa, t->t_addrlen) != -1);
while (su_root_step(t->t_root, 1) == 0);
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua.c Wed Jun 20 06:41:15 2007
@@ -1049,7 +1049,7 @@
/** Get request message from saved nua event. @NEW_1_12_4. */
msg_t *nua_saved_event_request(nua_saved_event_t const *saved)
{
- return saved ? su_msg_data(saved)->e_msg : NULL;
+ return saved && saved[0] ? su_msg_data(saved)->e_msg : NULL;
}
/** Save nua event and its arguments */
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c Wed Jun 20 06:41:15 2007
@@ -48,7 +48,10 @@
/* ======================================================================== */
/* MESSAGE */
-/** Send an instant message.
+/**@fn void nua_message( \
+ * nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
+ *
+ * Send an instant message.
*
* Send an instant message using SIP MESSAGE method.
*
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c Wed Jun 20 06:41:15 2007
@@ -37,6 +37,8 @@
/** @internal SU network changed detector argument pointer type */
#define SU_NETWORK_CHANGED_MAGIC_T struct nua_s
+#define TP_CLIENT_T struct register_usage
+
#include <sofia-sip/string0.h>
#include <sofia-sip/su_strlst.h>
#include <sofia-sip/su_uniqueid.h>
@@ -46,7 +48,7 @@
#include <sofia-sip/sip_util.h>
#include <sofia-sip/sip_status.h>
-#define NTA_UPDATE_MAGIC_T struct nua_s
+#define NTA_UPDATE_MAGIC_T struct nua_handle_s
#include "nua_stack.h"
@@ -126,6 +128,7 @@
/** Status of registration */
unsigned nr_ready:1;
+
/** Kind of registration.
*
* If nr_default is true, this is not a real registration but placeholder
@@ -138,7 +141,11 @@
unsigned nr_default:1, nr_secure:1, nr_public:1, nr_ip4:1, nr_ip6:1;
/** Stack-generated contact */
- unsigned nr_by_stack:1, :0;
+ unsigned nr_by_stack:1;
+
+ unsigned:0;
+
+ int nr_error_report_id; /**< ID used to ask for error reports from tport */
sip_route_t *nr_route; /**< Outgoing Service-Route */
sip_path_t *nr_path; /**< Incoming Path */
@@ -205,6 +212,12 @@
nr->nr_compartment = NULL;
#endif
+ if (nr->nr_error_report_id)
+ tport_release(nr->nr_tport, nr->nr_error_report_id, NULL, NULL, nr, 0);
+
+ if (nr->nr_tport)
+ tport_unref(nr->nr_tport), nr->nr_tport = NULL;
+
ds->ds_has_register = 0; /* There can be only one */
}
@@ -222,6 +235,12 @@
/* ======================================================================== */
/* REGISTER */
+static void nua_register_connection_closed(tp_stack_t *sip_stack,
+ nua_registration_t *nr,
+ tport_t *tport,
+ msg_t *msg,
+ int error);
+
/* Interface towards outbound_t */
sip_contact_t *nua_handle_contact_by_via(nua_handle_t *nh,
su_home_t *home,
@@ -764,6 +783,7 @@
TAG_IF(unreg, NTATAG_SIGCOMP_CLOSE(1)),
TAG_IF(!unreg, NTATAG_COMP("sigcomp")),
#endif
+ NTATAG_TPORT(nr->nr_tport),
TAG_NEXT(tags));
}
@@ -827,6 +847,8 @@
msg_t *_reqmsg = nta_outgoing_getrequest(cr->cr_orq);
sip_t *req = sip_object(_reqmsg);
+ tport_t *tport;
+
msg_destroy(_reqmsg);
assert(nr); assert(sip); assert(req);
@@ -927,10 +949,26 @@
outbound_start_keepalive(nr->nr_ob, cr->cr_orq);
}
- /* persistant connection for registration */
- if (!nr->nr_tport)
- /* note: nta_outgoing_transport() takes a ref */
- nr->nr_tport = nta_outgoing_transport (cr->cr_orq);
+ tport = nta_outgoing_transport (cr->cr_orq);
+
+ /* cache persistant connection for registration */
+ if (tport && tport != nr->nr_tport) {
+ if (nr->nr_error_report_id) {
+ if (tport_release(nr->nr_tport, nr->nr_error_report_id, NULL, NULL, nr, 0) < 0)
+ SU_DEBUG_1(("nua_register: tport_release() failed\n"));
+ nr->nr_error_report_id = 0;
+ }
+ tport_unref(nr->nr_tport);
+ nr->nr_tport = tport;
+
+ if (tport_is_secondary(tport)) {
+ tport_set_params(tport, TPTAG_SDWN_ERROR(1), TAG_END());
+ nr->nr_error_report_id =
+ tport_pend(tport, NULL, nua_register_connection_closed, nr);
+ }
+ }
+ else
+ tport_unref(tport); /* note: nta_outgoing_transport() makes a ref */
nua_registration_set_ready(nr, 1);
}
@@ -943,9 +981,15 @@
outbound_stop_keepalive(nr->nr_ob);
/* release the persistant transport for registration */
- if (nr->nr_tport)
- tport_decref(&nr->nr_tport), nr->nr_tport = NULL;
+ if (nr->nr_tport) {
+ if (nr->nr_error_report_id) {
+ if (tport_release(nr->nr_tport, nr->nr_error_report_id, NULL, NULL, nr, 0) < 0)
+ SU_DEBUG_1(("nua_register: tport_release() failed\n"));
+ nr->nr_error_report_id = 0;
+ }
+ tport_unref(nr->nr_tport), nr->nr_tport = NULL;
+ }
nua_registration_set_ready(nr, 0);
}
@@ -953,6 +997,24 @@
return nua_base_client_response(cr, status, phrase, sip, NULL);
}
+static
+void nua_register_connection_closed(tp_stack_t *sip_stack,
+ nua_registration_t *nr,
+ tport_t *tport,
+ msg_t *msg,
+ int error)
+{
+ if (tport_release(nr->nr_tport, nr->nr_error_report_id, NULL, NULL, nr, 0) < 0)
+ SU_DEBUG_1(("nua_register: tport_release() failed\n"));
+
+ nr->nr_error_report_id = 0;
+ tport_unref(nr->nr_tport), nr->nr_tport = NULL;
+
+ /* Schedule re-REGISTER immediately */
+ nua_dialog_usage_refresh_at(nua_dialog_usage_public(nr), sip_now());
+}
+
+
static void nua_register_usage_refresh(nua_handle_t *nh,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du,
@@ -978,8 +1040,8 @@
* @retval <0 try again later
*/
static int nua_register_usage_shutdown(nua_handle_t *nh,
- nua_dialog_state_t *ds,
- nua_dialog_usage_t *du)
+ nua_dialog_state_t *ds,
+ nua_dialog_usage_t *du)
{
nua_client_request_t *cr = du->du_cr;
nua_registration_t *nr = nua_dialog_usage_private(du);
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c Wed Jun 20 06:41:15 2007
@@ -1627,7 +1627,8 @@
* (maybe NULL if call handle was created for this call)
* @param sip incoming INVITE request
* @param tags SOATAG_ACTIVE_AUDIO(), SOATAG_ACTIVE_VIDEO()
- *
+ *
+ * @par
* @par Responding to INVITE with nua_respond()
*
* If @a status in #nua_i_invite event is below 200, the application should
@@ -1700,6 +1701,7 @@
* #nua_i_prack, #nua_i_update, nua_update(),
* nua_invite(), #nua_r_invite
*
+ * @par
* @par Third Party Call Control
*
* When so called 2rd party call control is used, the initial @b INVITE may
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c Wed Jun 20 06:41:15 2007
@@ -121,7 +121,9 @@
/* ====================================================================== */
/* SUBSCRIBE */
-/** Subscribe to a SIP event.
+/**@fn void nua_subscribe(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
+ *
+ * Subscribe to a SIP event.
*
* Subscribe a SIP event using the SIP SUBSCRIBE request. If the
* SUBSCRBE is successful a subscription state is established and
@@ -145,7 +147,9 @@
* @sa NUTAG_SUBSTATE(), @RFC3265
*/
-/** Unsubscribe an event.
+/**@fn void nua_unsubscribe(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
+ *
+ * Unsubscribe an event.
*
* Unsubscribe an active or pending subscription with SUBSCRIBE request
* containing Expires: header with value 0. The dialog associated with
@@ -689,7 +693,9 @@
/* ======================================================================== */
/* REFER */
-/** Transfer a call.
+/**@fn void nua_refer(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
+ *
+ * Transfer a call.
*
* Send a REFER request asking the recipient to transfer the call.
*
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h Wed Jun 20 06:41:15 2007
@@ -166,7 +166,7 @@
* nua_respond()
*
* @par Parameter type
- * msg_t *
+ * nua_saved_event_t *
*
* @par Values
* Pointer to a saved event.
@@ -2270,7 +2270,7 @@
SOFIAPUBVAR tag_typedef_t nutag_detect_network_updates_ref;
/* Pass nua handle as tagged argument */
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
su_inline tag_value_t nutag_handle_v(nua_handle_t *v) { return (tag_value_t)v; }
su_inline tag_value_t nutag_handle_vr(nua_handle_t **vp) {return(tag_value_t)vp;}
#else
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c Wed Jun 20 06:41:15 2007
@@ -128,7 +128,7 @@
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
- struct event *e;
+ struct event *e, *ep, *ei;
sip_t *sip;
if (print_headings)
@@ -193,10 +193,17 @@
TEST_1(is_answer_recv(e->data->e_tags));
TEST_1(!is_offer_sent(e->data->e_tags));
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
+ ei = event_by_type(e->next, nua_r_invite);
+ ep = event_by_type(e->next, nua_r_prack);
+ if (!ep) {
+ run_a_until(ctx, -1, until_final_response);
+ ep = event_by_type(e->next, nua_r_prack);
+ }
+
+ TEST_1(e = ep); TEST_E(e->data->e_event, nua_r_prack);
TEST(e->data->e_status, 200);
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+ TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_content_type);
@@ -206,7 +213,8 @@
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
TEST_1(!is_offer_answer_done(e->data->e_tags));
- TEST_1(!e->next);
+
+ TEST_1(!e->next || !ep->next);
free_events_in_list(ctx, a->events);
/*
@@ -321,13 +329,13 @@
struct endpoint *c = &ctx->c, *b = &ctx->b;
struct call *c_call = c->call, *b_call = b->call;
- struct event *e;
+ struct event *e, *ep, *ei;
sip_t *sip;
sip_proxy_authenticate_t *au;
char const *md5 = NULL, *md5sess = NULL;
if (print_headings)
- printf("TEST NUA-10.1.1: Call with 100rel and 180\n");
+ printf("TEST NUA-10.1.3: Call with 100rel and 180\n");
/* Test for authentication during 100rel
@@ -405,8 +413,14 @@
TEST_1(is_answer_recv(e->data->e_tags));
TEST_1(!is_offer_sent(e->data->e_tags));
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
+ ei = event_by_type(e->next, nua_r_invite);
+ ep = event_by_type(e->next, nua_r_prack);
+ if (!ep) {
+ run_a_until(ctx, -1, until_final_response);
+ ep = event_by_type(e->next, nua_r_prack);
+ }
+ TEST_1(e = ep); TEST_E(e->data->e_event, nua_r_prack);
if (e->data->e_status != 200 && md5 && !md5sess) {
if (e->data->e_status != 100) {
TEST(e->data->e_status, 407);
@@ -419,16 +433,15 @@
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
}
-
TEST(e->data->e_status, 200);
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+ TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
TEST_1(!is_offer_answer_done(e->data->e_tags));
- TEST_1(!e->next);
+ TEST_1(!e->next || !ep->next || (ep->data->e_status != 200 && !e->next->next->next));
free_events_in_list(ctx, c->events);
/*
@@ -466,10 +479,10 @@
free_events_in_list(ctx, b->events);
if (print_headings)
- printf("TEST NUA-10.1.1: PASSED\n");
+ printf("TEST NUA-10.1.3: PASSED\n");
if (print_headings)
- printf("TEST NUA-10.1.2: terminate call\n");
+ printf("TEST NUA-10.1.4: terminate call\n");
BYE(b, b_call, b_call->nh, TAG_END());
run_bc_until(ctx, -1, until_terminated, -1, until_terminated);
@@ -496,7 +509,7 @@
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
if (print_headings)
- printf("TEST NUA-10.1.2: PASSED\n");
+ printf("TEST NUA-10.1.4: PASSED\n");
END();
}
@@ -558,7 +571,7 @@
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
- struct event *e;
+ struct event *e, *ei, *ep;
if (print_headings)
printf("TEST NUA-10.2.1: Call with 100rel, 183 and 180\n");
@@ -590,26 +603,43 @@
TEST_1(is_answer_recv(e->data->e_tags));
TEST_1(!is_offer_sent(e->data->e_tags));
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
- TEST(e->data->e_status, 200);
+ TEST_1(e = e->next);
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+ ep = e->data->e_event == nua_r_prack ? e : NULL;
+
+ if (ep) {
+ TEST(ep->data->e_status, 200); TEST_1(e = e->next);
+ }
+
+ TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST_1(!is_offer_answer_done(e->data->e_tags));
+
+ if (!ep) {
+ TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
+ TEST(e->data->e_status, 200);
+ }
+
+ ei = event_by_type(e->next, nua_r_invite);
+ ep = event_by_type(e->next, nua_r_prack);
+ if (!ep) {
+ run_a_until(ctx, -1, until_final_response);
+ ep = event_by_type(e->next, nua_r_prack);
+ }
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
+ TEST_1(e = ep); TEST_E(e->data->e_event, nua_r_prack);
TEST(e->data->e_status, 200);
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+ TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
TEST_1(!is_offer_answer_done(e->data->e_tags));
- TEST_1(!e->next);
+ TEST_1(!e->next || !ep->next);
free_events_in_list(ctx, a->events);
/*
@@ -879,7 +909,7 @@
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
- struct event *e;
+ struct event *e, *ep, *ei;
sip_t *sip;
if (print_headings)
@@ -969,7 +999,10 @@
TEST_1(!is_answer_recv(e->data->e_tags));
TEST_1(is_offer_sent(e->data->e_tags));
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_update);
+ ei = event_by_type(e->next, nua_r_invite);
+ ep = event_by_type(e->next, nua_r_update);
+
+ TEST_1(e = ep); TEST_E(e->data->e_event, nua_r_update);
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_session_expires);
@@ -979,17 +1012,27 @@
TEST_1(is_answer_recv(e->data->e_tags));
TEST_1(!is_offer_sent(e->data->e_tags));
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+ TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding); /* PROCEEDING */
TEST_1(!is_offer_answer_done(e->data->e_tags));
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
+ if (e == ep) /* invite was responded before update */
+ e = ep->next->next;
+
+ ei = event_by_type(e->next, nua_r_invite);
+ ep = event_by_type(e->next, nua_r_prack);
+ if (!ep) {
+ run_a_until(ctx, -1, until_final_response);
+ ep = event_by_type(e->next, nua_r_prack);
+ }
+
+ TEST_1(e = ep); TEST_E(e->data->e_event, nua_r_prack);
TEST(e->data->e_status, 200);
/* Does not have effect on call state */
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+ TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
if (ctx->proxy_tests) {
@@ -1001,7 +1044,7 @@
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
TEST_1(!is_offer_answer_done(e->data->e_tags));
- TEST_1(!e->next);
+ TEST_1(!e->next || !ep->next);
free_events_in_list(ctx, a->events);
/*
@@ -1169,7 +1212,7 @@
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
- struct event *e;
+ struct event *e, *eu, *ei;
if (print_headings)
printf("TEST NUA-10.4.1: Call with preconditions and non-100rel 180\n");
@@ -1253,22 +1296,25 @@
TEST_1(!is_answer_recv(e->data->e_tags));
TEST_1(is_offer_sent(e->data->e_tags));
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_update);
- TEST(e->data->e_status, 200);
+ eu = event_by_type(e->next, nua_r_update);
+ ei = event_by_type(e->next, nua_r_invite);
+ TEST_1(e = eu); TEST_E(e->data->e_event, nua_r_update);
+ TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST_1(is_answer_recv(e->data->e_tags));
TEST_1(!is_offer_sent(e->data->e_tags));
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+ TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding); /* PROCEEDING */
TEST_1(!is_offer_answer_done(e->data->e_tags));
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
- TEST(e->data->e_status, 200);
+ TEST_1(e = eu->next->next == ei ? ei->next->next : eu->next->next);
+
+ TEST_E(e->data->e_event, nua_r_invite); TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
@@ -1445,7 +1491,7 @@
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
- struct event *e;
+ struct event *e, *ep, *ei;
sip_t *sip;
/* -------------------------------------------------------------------- */
@@ -1563,11 +1609,18 @@
TEST(callstate(e->data->e_tags), nua_callstate_proceeding); /* PROCEEDING */
TEST_1(!is_offer_answer_done(e->data->e_tags));
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
+ ei = event_by_type(e->next, nua_r_invite);
+ ep = event_by_type(e->next, nua_r_prack);
+ if (!ep) {
+ run_a_until(ctx, -1, until_final_response);
+ ep = event_by_type(e->next, nua_r_prack);
+ }
+
+ TEST_1(e = ep); TEST_E(e->data->e_event, nua_r_prack);
TEST(e->data->e_status, 200);
/* Does not have effect on call state */
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+ TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
if (ctx->proxy_tests) {
TEST_1(sip = sip_object(e->data->e_msg));
@@ -1579,7 +1632,7 @@
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
TEST_1(!is_offer_answer_done(e->data->e_tags));
- TEST_1(!e->next);
+ TEST_1(!e->next || !ep->next);
free_events_in_list(ctx, a->events);
/*
@@ -1846,7 +1899,7 @@
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
- struct event *e;
+ struct event *e, *ep, *ec;
if (print_headings)
printf("TEST NUA-10.7: CANCEL after 100rel 180\n");
@@ -1911,17 +1964,21 @@
TEST_1(is_answer_recv(e->data->e_tags));
TEST_1(!is_offer_sent(e->data->e_tags));
-#define NEXT_SKIP_PRACK_CANCEL() \
+#define NEXT_SKIP(x) \
do { TEST_1(e = e->next); } \
- while (e->data->e_event == nua_r_prack || e->data->e_event == nua_r_cancel)
+ while (x);
- NEXT_SKIP_PRACK_CANCEL();
+ NEXT_SKIP(e->data->e_event == nua_r_prack ||
+ e->data->e_event == nua_r_cancel ||
+ e->data->e_event == nua_i_state);
TEST_E(e->data->e_event, nua_r_invite);
if (e->data->e_status == 487) {
TEST(e->data->e_status, 487);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated);
+ if (e->next)
+ NEXT_SKIP(e->data->e_event == nua_r_prack || e->data->e_event == nua_r_cancel);
TEST_1(!e->next);
}
else {
@@ -1932,7 +1989,8 @@
BYE(a, a_call, a_call->nh, TAG_END());
run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
- NEXT_SKIP_PRACK_CANCEL(); TEST_E(e->data->e_event, nua_r_bye);
+ NEXT_SKIP(e->data->e_event == nua_r_prack || e->data->e_event == nua_r_cancel);
+ TEST_E(e->data->e_event, nua_r_bye);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
@@ -1963,18 +2021,20 @@
TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
TEST_1(is_answer_sent(e->data->e_tags));
- /* 180 is PRACKed */
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_prack);
- /* Does not have effect on call state */
+ ec = event_by_type(e->next, nua_i_cancel);
- if (e->next->data->e_event == nua_i_cancel) {
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_cancel);
+ if (ec) {
+ TEST_1(e = ec); TEST_E(e->data->e_event, nua_i_cancel);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
}
else {
- /* Respond with 200 OK */
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+ /* 180 is PRACKed, PRACK does not have effect on call state */
+ ep = event_by_type(e->next, nua_i_prack);
+ if (ep) e = ep;
+ /* Responded with 200 OK */
+ TEST_1(e = event_by_type(e->next, nua_i_state));
+ TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
TEST_1(!is_offer_answer_done(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_ack);
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c Wed Jun 20 06:41:15 2007
@@ -1100,7 +1100,7 @@
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
if (print_headings)
- printf("TEST NUA-3.4: PASSED\n");
+ printf("TEST NUA-3.5: PASSED\n");
END();
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c Wed Jun 20 06:41:15 2007
@@ -1520,7 +1520,7 @@
test_reject_302(ctx) ||
test_reject_401(ctx) ||
test_mime_negotiation(ctx) ||
- test_call_timeouts(ctx) ||
test_reject_401_aka(ctx) ||
+ test_call_timeouts(ctx) ||
0;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c Wed Jun 20 06:41:15 2007
@@ -1349,11 +1349,14 @@
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
struct event *e;
+ sip_t *sip = NULL;
+
+ int seen_401;
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
-/* Early BYE 2
+/* Bad Contact URI
A B
|-------INVITE------>|
@@ -1362,14 +1365,17 @@
|<----180 Ringing----|
|<-------200---------|
| |
- |--------BYE-------->|
- |<------200 OK-------|
|--------ACK-------->|
| |
+ |<-------BYE---------|
+ |--------400-------->|
+ | |
+ |--------BYE-------->|
+ |<------200 OK-------|
| |
*/
if (print_headings)
- printf("TEST NUA-6.4.3: BYE call when completing\n");
+ printf("TEST NUA-6.4.3: Test dialog with bad Contact info\n");
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
@@ -1448,6 +1454,42 @@
if (print_headings)
printf("TEST NUA-6.4.3: PASSED\n");
+ if (!ctx->p)
+ return 0;
+
+ if (print_headings)
+ printf("TEST NUA-6.4.4: Wait for re-REGISTER after connection has been closed\n");
+
+ /* B is supposed to re-register pretty soon, wait for re-registration */
+
+ run_b_until(ctx, -1, save_until_final_response);
+
+ seen_401 = 0;
+
+ for (e = b->events->head; e; e = e->next) {
+ TEST_E(e->data->e_event, nua_r_register);
+ TEST_1(sip = sip_object(e->data->e_msg));
+
+ if (e->data->e_status == 200) {
+ TEST(e->data->e_status, 200);
+ TEST_1(seen_401);
+ TEST_1(sip->sip_contact);
+ }
+ else if (sip->sip_status && sip->sip_status->st_status == 401) {
+ seen_401 = 1;
+ }
+
+ if (!e->next)
+ break;
+ }
+ TEST_1(e);
+ TEST_S(sip->sip_contact->m_expires, "3600");
+ TEST_1(!e->next);
+ free_events_in_list(ctx, b->events);
+
+ if (print_headings)
+ printf("TEST NUA-6.4.4: PASSED\n");
+
END();
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_init.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_init.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_init.c Wed Jun 20 06:41:15 2007
@@ -70,8 +70,9 @@
sip_allow_t const *allow = NULL;
sip_supported_t const *supported = NULL;
char const *appl_method = NULL;
- url_t const *p_uri, *a_uri; /* Proxy URI */
+ url_t const *p_uri, *a_uri, *b_uri; /* Proxy URI */
char const *a_bind, *a_bind2;
+ url_t b_proxy[1];
a_bind = a_bind2 = "sip:0.0.0.0:*";
@@ -121,7 +122,7 @@
printf("TEST NUA-2.1.1: PASSED\n");
}
- p_uri = a_uri = test_proxy_uri(ctx->p);
+ p_uri = a_uri = b_uri = test_proxy_uri(ctx->p);
if (start_nat && p_uri == NULL)
p_uri = url_hdup(ctx->home, (void *)o_proxy);
@@ -257,8 +258,15 @@
ctx->b.instance = nua_generate_instance_identifier(ctx->home);
+ if (ctx->p) {
+ /* B uses TCP when talking with proxy */
+ *b_proxy = *b_uri;
+ b_uri = b_proxy;
+ b_proxy->url_params = "transport=tcp";
+ }
+
ctx->b.nua = nua_create(ctx->root, b_callback, ctx,
- NUTAG_PROXY(p_uri ? p_uri : o_proxy),
+ NUTAG_PROXY(b_uri ? b_uri : o_proxy),
SIPTAG_FROM_STR("sip:bob@example.org"),
NUTAG_URL("sip:0.0.0.0:*"),
SOATAG_USER_SDP_STR("m=audio 5006 RTP/AVP 8 0"),
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c Wed Jun 20 06:41:15 2007
@@ -211,6 +211,18 @@
else if (strcmp(argv[i], "--loop") == 0) {
o_alarm = 0, o_loop = 1;
}
+ else if (strcmp(argv[i], "--print-tags") == 0) {
+ ctx->print_tags = 1;
+ }
+ else if (strcmp(argv[i], "--tags=a") == 0) {
+ ctx->a.print_tags = 1;
+ }
+ else if (strcmp(argv[i], "--tags=b") == 0) {
+ ctx->b.print_tags = 1;
+ }
+ else if (strcmp(argv[i], "--tags=c") == 0) {
+ ctx->c.print_tags = 1;
+ }
else if (strcmp(argv[i], "--log=a") == 0) {
ctx->a.logging = 1;
}
@@ -317,8 +329,8 @@
retval |= test_rejects(ctx); SINGLE_FAILURE_CHECK();
retval |= test_call_cancel(ctx); SINGLE_FAILURE_CHECK();
retval |= test_call_destroy(ctx); SINGLE_FAILURE_CHECK();
- retval |= test_offer_answer(ctx); SINGLE_FAILURE_CHECK();
retval |= test_early_bye(ctx); SINGLE_FAILURE_CHECK();
+ retval |= test_offer_answer(ctx); SINGLE_FAILURE_CHECK();
retval |= test_reinvites(ctx); SINGLE_FAILURE_CHECK();
retval |= test_session_timer(ctx); SINGLE_FAILURE_CHECK();
retval |= test_refer(ctx); SINGLE_FAILURE_CHECK();
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.h Wed Jun 20 06:41:15 2007
@@ -124,6 +124,7 @@
su_root_t *root;
int threading, proxy_tests, expensive, quit_on_single_failure, osx_runloop;
+ int print_tags;
char const *external_proxy;
int proxy_logging;
@@ -133,6 +134,7 @@
struct context *ctx; /* Backpointer */
int logging;
+ int print_tags;
int running;
@@ -196,6 +198,9 @@
struct eventlist *list,
struct event *e);
+struct event *event_by_type(struct event *e, nua_event_t);
+size_t count_events(struct event const *e);
+
#define CONDITION_PARAMS \
nua_event_t event, \
int status, char const *phrase, \
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c Wed Jun 20 06:41:15 2007
@@ -190,7 +190,8 @@
ep->name, (void *)nh, operation);
}
- if ((tstflags & tst_verbatim) && tags)
+ if (tags &&
+ ((tstflags & tst_verbatim) || ctx->print_tags || ep->print_tags))
tl_print(stderr, "", tags);
}
@@ -499,6 +500,27 @@
}
}
+struct event *event_by_type(struct event *e, nua_event_t etype)
+{
+ for (; e; e = e->next) {
+ if (e->data->e_event == etype)
+ break;
+ }
+
+ return e;
+}
+
+size_t count_events(struct event const *e)
+{
+ size_t n;
+
+ for (n = 0; e; e = e->next)
+ n++;
+
+ return n;
+}
+
+
int is_special(nua_event_t e)
{
if (e == nua_i_active || e == nua_i_terminated)
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c Wed Jun 20 06:41:15 2007
@@ -53,6 +53,8 @@
#include <sofia-sip/su_tagarg.h>
#include <sofia-sip/msg_addr.h>
#include <sofia-sip/hostdomain.h>
+#include <sofia-sip/tport.h>
+#include <sofia-sip/nta_tport.h>
#include <stdlib.h>
#include <assert.h>
@@ -111,6 +113,8 @@
sip_time_t min_expires, expires, max_expires;
sip_time_t session_expires, min_se;
+
+ int outbound_tcp; /**< Use inbound TCP connection as outbound */
} prefs;
};
@@ -119,7 +123,6 @@
url_t const *);
static void registration_entry_destroy(struct registration_entry *e);
-
struct registration_entry
{
struct registration_entry *next, **prev;
@@ -132,14 +135,16 @@
struct binding
{
struct binding *next, **prev;
- sip_contact_t *contact; /* bindings */
+ sip_contact_t *contact; /* binding */
sip_time_t registered, expires; /* When registered and when expires */
- sip_call_id_t *call_id;
+ sip_call_id_t *call_id;
uint32_t cseq;
+ tport_t *tport; /**< Reference to tport */
};
static struct binding *binding_new(su_home_t *home,
sip_contact_t *contact,
+ tport_t *tport,
sip_call_id_t *call_id,
uint32_t cseq,
sip_time_t registered,
@@ -147,7 +152,9 @@
static void binding_destroy(su_home_t *home, struct binding *b);
static int binding_is_active(struct binding const *b)
{
- return b->expires > sip_now();
+ return
+ b->expires > sip_now() &&
+ (b->tport == NULL || tport_is_clear_to_send(b->tport));
}
LIST_PROTOS(static, proxy_transaction, struct proxy_transaction);
@@ -195,6 +202,8 @@
static struct registration_entry *
registration_entry_find(struct proxy const *proxy, url_t const *uri);
+static int close_tports(void *proxy);
+
static auth_challenger_t registrar_challenger[1];
static auth_challenger_t proxy_challenger[1];
@@ -268,6 +277,8 @@
proxy->prefs.session_expires = 180;
proxy->prefs.min_se = 90;
+ proxy->prefs.outbound_tcp = 1;
+
if (!proxy->defleg ||
!proxy->example_net || !proxy->example_org || !proxy->example_com)
return -1;
@@ -302,11 +313,11 @@
nta_outgoing_destroy(t->client), t->client = NULL;
}
- nta_agent_destroy(proxy->agent);
-
while (proxy->entries)
registration_entry_destroy(proxy->entries);
+ nta_agent_destroy(proxy->agent);
+
free(proxy->tags);
}
@@ -396,6 +407,38 @@
}
}
+void test_proxy_set_outbound(struct proxy *p,
+ int use_outbound)
+{
+ if (p) {
+ p->prefs.outbound_tcp = use_outbound;
+ }
+}
+
+void test_proxy_get_outbound(struct proxy *p,
+ int *return_use_outbound)
+{
+ if (p) {
+ if (return_use_outbound)
+ *return_use_outbound = p->prefs.outbound_tcp;
+ }
+}
+
+int test_proxy_close_tports(struct proxy *p)
+{
+ if (p) {
+ int retval = -EPROTO;
+
+ su_task_execute(su_clone_task(p->clone), close_tports, p, &retval);
+
+ if (retval < 0)
+ return errno = -retval, -1;
+ else
+ return 0;
+ }
+ return errno = EFAULT, -1;
+}
+
/* ---------------------------------------------------------------------- */
static sip_contact_t *create_transport_contacts(struct proxy *p)
@@ -449,6 +492,7 @@
sip_session_expires_t *x = NULL, x0[1];
sip_min_se_t *min_se = NULL, min_se0[1];
char const *require = NULL;
+ tport_t *tport = NULL;
mf = sip->sip_max_forwards;
@@ -529,8 +573,9 @@
nta_incoming_treply(irq, SIP_480_TEMPORARILY_UNAVAILABLE, TAG_END());
return 480;
}
-
+
target = b->contact->m_url;
+ tport = b->tport;
}
t = proxy_transaction_new(proxy);
@@ -560,6 +605,7 @@
SIPTAG_SESSION_EXPIRES(x),
SIPTAG_MIN_SE(min_se),
SIPTAG_REQUIRE_STR(require),
+ NTATAG_TPORT(tport),
TAG_END());
if (t->client == NULL) {
proxy_transaction_destroy(t);
@@ -734,9 +780,10 @@
static int check_out_of_order(struct proxy *p, auth_status_t *as,
struct registration_entry *e, sip_t const *);
static int binding_update(struct proxy *p,
- auth_status_t *as,
- struct registration_entry *e,
- sip_t const *sip);
+ auth_status_t *as,
+ struct registration_entry *e,
+ nta_incoming_t *irq,
+ sip_t const *sip);
sip_contact_t *binding_contacts(su_home_t *home, struct binding *bindings);
@@ -768,10 +815,11 @@
assert(as->as_status >= 200);
nta_incoming_treply(irq,
- as->as_status, as->as_phrase,
- SIPTAG_HEADER((void *)as->as_info),
- SIPTAG_HEADER((void *)as->as_response),
- TAG_END());
+ as->as_status, as->as_phrase,
+ SIPTAG_HEADER((void *)as->as_info),
+ SIPTAG_HEADER((void *)as->as_response),
+ TAG_END());
+
status = as->as_status;
su_home_unref(as->as_home);
@@ -816,7 +864,7 @@
if (!e)
return set_status(as, SIP_500_INTERNAL_SERVER_ERROR);
- if (binding_update(p, as, e, sip))
+ if (binding_update(p, as, e, irq, sip))
return as->as_status;
msg_header_free(p->home, (void *)e->contacts);
@@ -954,6 +1002,7 @@
static
struct binding *binding_new(su_home_t *home,
sip_contact_t *contact,
+ tport_t *tport,
sip_call_id_t *call_id,
uint32_t cseq,
sip_time_t registered,
@@ -968,6 +1017,7 @@
*m = *contact; m->m_next = NULL;
b->contact = sip_contact_dup(home, m);
+ b->tport = tport_ref(tport);
b->call_id = sip_call_id_dup(home, call_id);
b->cseq = cseq;
b->registered = registered;
@@ -992,6 +1042,7 @@
}
msg_header_free(home, (void *)b->contact);
msg_header_free(home, (void *)b->call_id);
+ tport_unref(b->tport);
su_free(home, b);
}
@@ -999,16 +1050,21 @@
int binding_update(struct proxy *p,
auth_status_t *as,
struct registration_entry *e,
+ nta_incoming_t *irq,
sip_t const *sip)
{
struct binding *b, *old, *next, *last, *bindings = NULL, **bb = &bindings;
sip_contact_t *m;
sip_time_t expires;
-
sip_time_t now = sip_now();
+ tport_t *tport = NULL;
assert(sip->sip_contact);
+ if (p->prefs.outbound_tcp &&
+ str0casecmp(sip->sip_via->v_protocol, sip_transport_tcp) == 0)
+ tport = nta_incoming_transport(p->agent, irq, NULL);
+
/* Create new bindings */
for (m = sip->sip_contact; m; m = m->m_next) {
if (m->m_url->url_type == url_any)
@@ -1022,7 +1078,7 @@
msg_header_remove_param(m->m_common, "expires");
- b = binding_new(p->home, m, sip->sip_call_id, sip->sip_cseq->cs_seq,
+ b = binding_new(p->home, m, tport, sip->sip_call_id, sip->sip_cseq->cs_seq,
now, now + expires);
if (!b)
break;
@@ -1030,6 +1086,8 @@
*bb = b, b->prev = bb, bb = &b->next;
}
+ tport_unref(tport);
+
last = NULL;
if (m == NULL) {
@@ -1095,3 +1153,25 @@
return retval;
}
+
+/* ---------------------------------------------------------------------- */
+
+static int close_tports(void *_proxy)
+{
+ struct proxy *p = _proxy;
+ struct registration_entry *e;
+ struct binding *b;
+
+ /* Close all outbound transports */
+ for (e = p->entries; e; e = e->next) {
+ for (b = e->bindings; b; b = b->next) {
+ if (b->tport) {
+ tport_shutdown(b->tport, 2);
+ tport_unref(b->tport);
+ b->tport = NULL;
+ }
+ }
+ }
+
+ return 0;
+}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h Wed Jun 20 06:41:15 2007
@@ -56,6 +56,8 @@
sip_time_t *return_session_expires,
sip_time_t *return_min_se);
+int test_proxy_close_tports(struct proxy *p);
+
SOFIA_END_DECLS
#endif
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_refer.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_refer.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_refer.c Wed Jun 20 06:41:15 2007
@@ -113,7 +113,7 @@
struct call *a_call = a->call, *b_call = b->call, *c_call = c->call;
struct call *a_refer, *a_c2, *b_refer;
struct eventlist *a_revents, *b_revents;
- struct event *e;
+ struct event *e, *notify_e;
sip_t const *sip;
sip_event_t const *a_event, *b_event;
sip_refer_to_t const *refer_to;
@@ -280,21 +280,38 @@
TAG_END()), 1);
TEST_1(b_event); TEST_1(b_event->o_id);
TEST_1(b_event = sip_event_dup(tmphome, b_event));
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_refer);
+
+ notify_e = NULL;
+
+ TEST_1(e = e->next);
+ if (e->data->e_event == nua_i_notify) {
+ notify_e = e;
+ TEST_1(e = e->next);
+ }
+ TEST_E(e->data->e_event, nua_r_refer);
TEST(e->data->e_status, 202);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_SIZE(strtoul(b_event->o_id, NULL, 10), sip->sip_cseq->cs_seq);
if (a_refer != a_call) {
- if (b_revents->head->next->next == NULL)
- run_ab_until(ctx, -1, save_until_received, nua_i_notify, save_events);
- else if (a_revents->head->next == NULL)
+ while (!notify_e) {
+ for (e = b_revents->head; e; e = e->next) {
+ if (e->data->e_event == nua_i_notify) {
+ notify_e = e;
+ break;
+ }
+ }
+ if (!notify_e)
+ run_ab_until(ctx, -1, save_until_received, nua_i_notify, save_events);
+ }
+
+ if (a_revents->head->next == NULL)
run_a_until(ctx, -1, save_until_received);
TEST_1(e = a_revents->head->next); TEST_E(e->data->e_event, nua_r_notify);
TEST_1(!e->next);
- TEST_1(e = b_revents->head->next->next);
+ TEST_1(e = notify_e);
TEST_E(e->data->e_event, nua_i_notify);
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
@@ -304,8 +321,8 @@
TEST_1(sip->sip_subscription_state);
TEST_S(sip->sip_subscription_state->ss_substate, "pending");
TEST_1(sip->sip_payload && sip->sip_payload->pl_data);
- TEST_S(sip->sip_payload->pl_data, "SIP/2.0 100 Trying\r\n");
- TEST_1(!e->next);
+ TEST_M(sip->sip_payload->pl_data, "SIP/2.0 100 Trying\r\n",
+ sip->sip_payload->pl_len);
}
free_events_in_list(ctx, a_revents);
@@ -363,7 +380,8 @@
TEST_1(sip->sip_subscription_state);
TEST_S(sip->sip_subscription_state->ss_substate, "pending");
TEST_1(sip->sip_payload && sip->sip_payload->pl_data);
- TEST_S(sip->sip_payload->pl_data, "SIP/2.0 100 Trying\r\n");
+ TEST_M(sip->sip_payload->pl_data, "SIP/2.0 100 Trying\r\n",
+ sip->sip_payload->pl_len);
TEST_1(e = e->next);
}
TEST_E(e->data->e_event, nua_r_subscribe);
@@ -476,7 +494,7 @@
TEST_1(sip->sip_subscription_state);
TEST_S(sip->sip_subscription_state->ss_substate, "active");
TEST_1(sip->sip_payload && sip->sip_payload->pl_data);
- TEST_S(sip->sip_payload->pl_data, "SIP/2.0 180 Ringing\r\n");
+ TEST_M(sip->sip_payload->pl_data, "SIP/2.0 180 Ringing\r\n", sip->sip_payload->pl_len);
TEST_1(sip->sip_event);
if (refer_with_id)
TEST_S(sip->sip_event->o_id, b_event->o_id);
@@ -486,7 +504,7 @@
TEST_1(sip->sip_subscription_state);
TEST_S(sip->sip_subscription_state->ss_substate, "terminated");
TEST_1(sip->sip_payload && sip->sip_payload->pl_data);
- TEST_S(sip->sip_payload->pl_data, "SIP/2.0 200 OK\r\n");
+ TEST_M(sip->sip_payload->pl_data, "SIP/2.0 200 OK\r\n", sip->sip_payload->pl_len);
TEST_1(sip->sip_event);
if (refer_with_id)
TEST_S(sip->sip_event->o_id, b_event->o_id);
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c Wed Jun 20 06:41:15 2007
@@ -200,6 +200,10 @@
m->m_display = "B";
m->m_url->url_user = "b";
+ /* Include "tcp" transport parameter in Contact */
+ if (ctx->p)
+ m->m_url->url_params = "transport=tcp";
+
REGISTER(b, b_reg, b_reg->nh, SIPTAG_TO(b->to),
SIPTAG_CONTACT(m),
/* Do not include credentials unless challenged */
@@ -229,11 +233,14 @@
TEST_S(sip->sip_contact->m_display, "B");
TEST_S(sip->sip_contact->m_url->url_user, "b");
free_events_in_list(ctx, b->events);
+
if (print_headings)
printf("TEST NUA-2.3.2: PASSED\n");
- if (ctx->p)
+ if (ctx->p) {
+ test_proxy_close_tports(ctx->p);
test_proxy_set_expiration(ctx->p, 600, 3600, 36000);
+ }
if (print_headings)
printf("TEST NUA-2.3.3: REGISTER c\n");
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c Wed Jun 20 06:41:15 2007
@@ -1194,7 +1194,7 @@
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
- struct event *e;
+ struct event *e, *en, *es;
sip_t const *sip;
tagi_t const *n_tags, *r_tags;
@@ -1220,22 +1220,16 @@
/* Client events:
nua_method(), nua_i_notify/nua_r_method, nua_i_notify
*/
- TEST_1(e = a->events->head);
- if (e->data->e_event == nua_i_notify) {
- TEST_E(e->data->e_event, nua_i_notify);
- TEST_1(sip = sip_object(e->data->e_msg));
- n_tags = e->data->e_tags;
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_subscribe);
- r_tags = e->data->e_tags;
- }
- else {
- TEST_E(e->data->e_event, nua_r_method);
- TEST(e->data->e_status, 202);
- r_tags = e->data->e_tags;
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_notify);
- TEST_1(sip = sip_object(e->data->e_msg));
- n_tags = e->data->e_tags;
- }
+ TEST_1(en = event_by_type(a->events->head, nua_i_notify));
+ TEST_1(es = event_by_type(a->events->head, nua_r_method));
+
+ TEST_1(e = en); TEST_E(e->data->e_event, nua_i_notify);
+ TEST_1(sip = sip_object(e->data->e_msg));
+ n_tags = e->data->e_tags;
+
+ TEST_1(e = es); TEST_E(e->data->e_event, nua_r_method);
+ r_tags = e->data->e_tags;
+
TEST_1(sip->sip_event); TEST_S(sip->sip_event->o_type, "presence");
TEST_1(sip->sip_content_type);
TEST_S(sip->sip_content_type->c_type, "application/pidf+xml");
@@ -1245,7 +1239,12 @@
TEST_1(tl_find(n_tags, nutag_substate));
TEST(tl_find(n_tags, nutag_substate)->t_value, nua_substate_pending);
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_notify);
+ if (es->next == en)
+ e = en->next;
+ else
+ e = es->next;
+
+ TEST_1(e); TEST_E(e->data->e_event, nua_i_notify);
n_tags = e->data->e_tags;
TEST_1(tl_find(n_tags, nutag_substate));
TEST(tl_find(n_tags, nutag_substate)->t_value, nua_substate_terminated);
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c Wed Jun 20 06:41:15 2007
@@ -89,9 +89,9 @@
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
- struct event *e;
+ struct event *e, *en, *es;
sip_t const *sip;
- tagi_t const *n_tags, *r_tags;
+ tagi_t const *t, *n_tags, *r_tags;
url_t b_url[1];
nea_sub_t *sub = NULL;
@@ -206,26 +206,25 @@
/* Client events:
nua_subscribe(), nua_i_notify/nua_r_subscribe
*/
- TEST_1(e = a->events->head);
- if (e->data->e_event == nua_i_notify) {
- TEST_E(e->data->e_event, nua_i_notify);
- TEST_1(sip = sip_object(e->data->e_msg));
- n_tags = e->data->e_tags;
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_subscribe);
- r_tags = e->data->e_tags;
- TEST_1(tl_find(r_tags, nutag_substate));
- TEST(tl_find(r_tags, nutag_substate)->t_value, nua_substate_active);
+ TEST_1(en = event_by_type(a->events->head, nua_i_notify));
+ TEST_1(es = event_by_type(a->events->head, nua_r_subscribe));
+
+ TEST_1(e = es); TEST_E(e->data->e_event, nua_r_subscribe);
+ r_tags = e->data->e_tags;
+ TEST_1(tl_find(r_tags, nutag_substate));
+ if (es->next == en) {
+ TEST_1(200 <= e->data->e_status && e->data->e_status < 300);
+ TEST(tl_find(r_tags, nutag_substate)->t_value, nua_substate_embryonic);
}
else {
- TEST_E(e->data->e_event, nua_r_subscribe);
- TEST(e->data->e_status, 202);
- r_tags = e->data->e_tags;
- TEST_1(tl_find(r_tags, nutag_substate));
- TEST(tl_find(r_tags, nutag_substate)->t_value, nua_substate_embryonic);
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_notify);
- TEST_1(sip = sip_object(e->data->e_msg));
- n_tags = e->data->e_tags;
+ TEST_1(200 <= e->data->e_status && e->data->e_status < 300);
+ TEST(tl_find(r_tags, nutag_substate)->t_value, nua_substate_active);
}
+
+ TEST_1(e = en); TEST_E(e->data->e_event, nua_i_notify);
+ TEST_1(sip = sip_object(e->data->e_msg));
+ n_tags = e->data->e_tags;
+
TEST_1(sip->sip_event); TEST_S(sip->sip_event->o_type, "presence");
TEST_1(sip->sip_content_type);
TEST_S(sip->sip_content_type->c_type, "application/pidf+xml");
@@ -234,7 +233,7 @@
TEST_1(sip->sip_subscription_state->ss_expires);
TEST_1(tl_find(n_tags, nutag_substate));
TEST(tl_find(n_tags, nutag_substate)->t_value, nua_substate_active);
- TEST_1(!e->next);
+ TEST_1(!en->next || !es->next);
free_events_in_list(ctx, a->events);
if (print_headings)
@@ -302,7 +301,7 @@
UNSUBSCRIBE(a, a_call, a_call->nh, TAG_END());
- run_ab_until(ctx, -1, save_until_notified_and_responded,
+ run_ab_until(ctx, -1, save_until_final_response,
-1, NULL /* XXX save_until_received */);
/* Client events:
@@ -313,26 +312,21 @@
TEST_E(e->data->e_event, nua_i_notify);
TEST_1(sip = sip_object(e->data->e_msg));
n_tags = e->data->e_tags;
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_unsubscribe);
- TEST_1(tl_find(e->data->e_tags, nutag_substate));
- TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
- nua_substate_terminated);
- }
- else {
- TEST_E(e->data->e_event, nua_r_unsubscribe);
- TEST(e->data->e_status, 202);
- TEST_1(tl_find(e->data->e_tags, nutag_substate));
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_notify);
- TEST_1(sip = sip_object(e->data->e_msg));
- n_tags = e->data->e_tags;
+ TEST_1(sip->sip_event);
+ TEST_1(sip->sip_subscription_state);
+ TEST_S(sip->sip_subscription_state->ss_substate, "terminated");
+ TEST_1(!sip->sip_subscription_state->ss_expires);
+ TEST_1(tl_find(n_tags, nutag_substate));
+ TEST(tl_find(n_tags, nutag_substate)->t_value, nua_substate_terminated);
+ TEST_1(e = e->next);
}
- TEST_1(sip->sip_event);
- TEST_1(sip->sip_subscription_state);
- TEST_S(sip->sip_subscription_state->ss_substate, "terminated");
- TEST_1(!sip->sip_subscription_state->ss_expires);
- TEST_1(tl_find(n_tags, nutag_substate));
- TEST(tl_find(n_tags, nutag_substate)->t_value, nua_substate_terminated);
- TEST_1(!e->next);
+ TEST_E(e->data->e_event, nua_r_unsubscribe);
+ TEST_1(tl_find(e->data->e_tags, nutag_substate));
+ TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
+ nua_substate_terminated);
+ /* Currently, NOTIFY is dropped after successful response to unsubscribe */
+ /* But we don't really care.. */
+ /* TEST_1(!e->next); */
free_events_in_list(ctx, a->events);
if (print_headings)
@@ -383,26 +377,18 @@
/* Client events:
nua_subscribe(), nua_i_notify/nua_r_subscribe
*/
- TEST_1(e = a->events->head);
- if (e->data->e_event == nua_i_notify) {
- TEST_E(e->data->e_event, nua_i_notify);
- TEST_1(sip = sip_object(e->data->e_msg));
- n_tags = e->data->e_tags;
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_subscribe);
- TEST_1(tl_find(e->data->e_tags, nutag_substate));
- TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
- nua_substate_pending);
- }
- else {
- TEST_E(e->data->e_event, nua_r_subscribe);
- TEST(e->data->e_status, 202);
- TEST_1(tl_find(e->data->e_tags, nutag_substate));
- TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
- nua_substate_embryonic);
- TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_notify);
- TEST_1(sip = sip_object(e->data->e_msg));
- n_tags = e->data->e_tags;
- }
+ TEST_1(en = event_by_type(a->events->head, nua_i_notify));
+ TEST_1(es = event_by_type(a->events->head, nua_r_subscribe));
+
+ e = es; TEST_E(e->data->e_event, nua_r_subscribe);
+ TEST_1(t = tl_find(e->data->e_tags, nutag_substate));
+ TEST_1(t->t_value == nua_substate_pending ||
+ t->t_value == nua_substate_embryonic);
+
+ e = en; TEST_E(e->data->e_event, nua_i_notify);
+ TEST_1(sip = sip_object(e->data->e_msg));
+ n_tags = e->data->e_tags;
+
TEST_1(sip->sip_event); TEST_S(sip->sip_event->o_type, "presence");
TEST_S(sip->sip_event->o_id, "1");
TEST_1(sip->sip_content_type);
@@ -417,7 +403,7 @@
TEST_1(tl_find(n_tags, nutag_substate));
TEST(tl_find(n_tags, nutag_substate)->t_value,
nua_substate_pending);
- TEST_1(!e->next);
+ TEST_1(!en->next || !es->next);
free_events_in_list(ctx, a->events);
/*
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c Wed Jun 20 06:41:15 2007
@@ -718,6 +718,9 @@
* it is like "Contact: url:foo,sip:bar,sip:zunk"
*/
c = *s; *s = '\0'; /* terminate temporarily */
+ /* Do not accept an empty URL */
+ if (addr_spec[0] == '\0')
+ return -1;
if (url_d(return_url, addr_spec) == -1)
return -1;
*s = c; /* return terminator */
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in Wed Jun 20 06:41:15 2007
@@ -104,7 +104,7 @@
#define SIPTAG_SIP_REF(x) siptag_sip_ref, siptag_sip_vr(&(x))
SOFIAPUBVAR tag_typedef_t siptag_sip_ref;
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
su_inline
tag_value_t siptag_sip_v(sip_t const *v) { return (tag_value_t)v; }
su_inline
@@ -136,7 +136,7 @@
#define SIPTAG_HEADER_REF(x) siptag_header_ref, siptag_header_vr(&(x))
SOFIAPUBVAR tag_typedef_t siptag_header_ref;
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
su_inline tag_value_t
siptag_header_v(sip_header_t const *v)
{ return (tag_value_t)v; }
@@ -240,7 +240,7 @@
#define SIPTAG_#XXXXXX#_STR_REF(x) siptag_#xxxxxx#_str_ref, tag_str_vr(&(x))
SOFIAPUBVAR tag_typedef_t siptag_#xxxxxx#_str_ref;
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
su_inline tag_value_t
siptag_#xxxxxx#_v(sip_#xxxxxx#_t const *v)
{ return (tag_value_t)v; }
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c Wed Jun 20 06:41:15 2007
@@ -405,6 +405,8 @@
TEST_1(!sip_from_create(home, (void *)"sip:joe@[baa"));
+ TEST_1(!sip_from_make(home, (void *)"tester <>;tag=fasjfuios"));
+
TEST_1(f = sip_from_make(home, (void *)"sip:joe@bar (foo)"));
su_free(home, f);
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c Wed Jun 20 06:41:15 2007
@@ -80,9 +80,19 @@
{
soa_session_t sss_session[1];
char *sss_audio_aux;
+ int sss_ordered_user; /**< User SDP is ordered */
+ int sss_reuse_rejected; /**< Try to reuse rejected media line slots */
+
+ /** Mapping from user SDP m= lines to session SDP m= lines */
+ int *sss_u2s;
+ /** Mapping from session SDP m= lines to user SDP m= lines */
+ int *sss_s2u;
}
soa_static_session_t;
+#define U2S_NOT_USED (-1)
+#define U2S_SENTINEL (-2)
+
static int soa_static_init(char const *, soa_session_t *, soa_session_t *);
static void soa_static_deinit(soa_session_t *);
static int soa_static_set_params(soa_session_t *ss, tagi_t const *tags);
@@ -152,10 +162,14 @@
{
soa_static_session_t *sss = (soa_static_session_t *)ss;
char const *audio_aux = sss->sss_audio_aux;
+ int ordered_user = sss->sss_ordered_user;
+ int reuse_rejected = sss->sss_reuse_rejected;
int n, m;
n = tl_gets(tags,
SOATAG_AUDIO_AUX_REF(audio_aux),
+ SOATAG_ORDERED_USER_REF(ordered_user),
+ SOATAG_REUSE_REJECTED_REF(reuse_rejected),
TAG_END());
if (n > 0 && str0casecmp(audio_aux, sss->sss_audio_aux)) {
@@ -167,6 +181,9 @@
su_free(ss->ss_home, tbf);
}
+ sss->sss_ordered_user = ordered_user != 0;
+ sss->sss_reuse_rejected = reuse_rejected != 0;
+
m = soa_base_set_params(ss, tags);
if (m < 0)
return m;
@@ -182,6 +199,8 @@
n = tl_tgets(tags,
SOATAG_AUDIO_AUX(sss->sss_audio_aux),
+ SOATAG_ORDERED_USER(sss->sss_ordered_user),
+ SOATAG_REUSE_REJECTED(sss->sss_reuse_rejected),
TAG_END());
m = soa_base_get_params(ss, tags);
if (m < 0)
@@ -204,6 +223,10 @@
tl = soa_base_get_paramlist(ss,
TAG_IF(sss->sss_audio_aux,
SOATAG_AUDIO_AUX(sss->sss_audio_aux)),
+ TAG_IF(sss->sss_ordered_user,
+ SOATAG_ORDERED_USER(1)),
+ TAG_IF(sss->sss_reuse_rejected,
+ SOATAG_REUSE_REJECTED(1)),
TAG_NEXT(ta_args(ta)));
ta_end(ta);
@@ -239,6 +262,7 @@
}
/** Generate a rejected m= line */
+static
sdp_media_t *soa_sdp_make_rejected_media(su_home_t *home,
sdp_media_t const *m,
sdp_session_t *sdp,
@@ -263,6 +287,7 @@
/** Expand a @a truncated SDP.
*/
+static
sdp_session_t *soa_sdp_expand_media(su_home_t *home,
sdp_session_t const *truncated,
sdp_session_t const *complete)
@@ -312,6 +337,7 @@
}
/** Check if codec is in auxiliary list */
+static
int soa_sdp_is_auxiliary_codec(sdp_rtpmap_t const *rm, char const *auxiliary)
{
char const *codec;
@@ -342,68 +368,84 @@
return 0;
}
+static
+sdp_rtpmap_t *soa_sdp_media_matching_rtpmap(sdp_rtpmap_t const *from,
+ sdp_rtpmap_t const *anylist,
+ char const *auxiliary)
+{
+ sdp_rtpmap_t const *rm;
+
+ for (rm = anylist; rm; rm = rm->rm_next) {
+ /* Ignore auxiliary codecs */
+ if (auxiliary && soa_sdp_is_auxiliary_codec(rm, auxiliary))
+ continue;
-/** Find first matching media in table. */
-sdp_media_t *soa_sdp_matching(soa_session_t *ss,
- sdp_media_t *mm[],
- sdp_media_t const *with,
- int *return_common_codecs)
+ if (sdp_rtpmap_find_matching(from, rm))
+ return (sdp_rtpmap_t *)rm;
+ }
+
+ return NULL;
+}
+
+#define SDP_MEDIA_NONE ((sdp_media_t *)-1)
+
+/** Find first matching media in table @a mm.
+ *
+ * - if allow_rtp_mismatch == 0, search for a matching codec
+ * - if allow_rtp_mismatch == 1, prefer m=line with matching codec
+ * - if allow_rtp_mismatch > 1, ignore codecs
+ */
+static
+int soa_sdp_matching_mindex(soa_session_t *ss,
+ sdp_media_t *mm[],
+ sdp_media_t const *with,
+ int *return_codec_mismatch)
{
int i, j = -1;
- sdp_media_t *m;
- sdp_rtpmap_t const *rm;
soa_static_session_t *sss = (soa_static_session_t *)ss;
- char const *auxiliary;
+ int rtp = sdp_media_uses_rtp(with), dummy;
+ char const *auxiliary = NULL;
- auxiliary = with->m_type == sdp_media_audio ? sss->sss_audio_aux : NULL;
+ if (return_codec_mismatch == NULL)
+ return_codec_mismatch = &dummy;
- /* Looking for a single codec */
- if (with->m_rtpmaps && with->m_rtpmaps->rm_next == NULL)
- auxiliary = NULL;
+ if (with->m_type == sdp_media_audio) {
+ auxiliary = sss->sss_audio_aux;
+ /* Looking for a single codec */
+ if (with->m_rtpmaps && with->m_rtpmaps->rm_next == NULL)
+ auxiliary = NULL;
+ }
for (i = 0; mm[i]; i++) {
+ if (mm[i] == SDP_MEDIA_NONE)
+ continue;
+
if (!sdp_media_match_with(mm[i], with))
continue;
- if (!sdp_media_uses_rtp(with))
+ if (!rtp)
break;
- if (!return_common_codecs)
+ if (soa_sdp_media_matching_rtpmap(with->m_rtpmaps,
+ mm[i]->m_rtpmaps,
+ auxiliary))
break;
- /* Check also rtpmaps */
- for (rm = mm[i]->m_rtpmaps; rm; rm = rm->rm_next) {
- /* Ignore auxiliary codecs */
- if (auxiliary && soa_sdp_is_auxiliary_codec(rm, auxiliary))
- continue;
-
- if (sdp_rtpmap_find_matching(with->m_rtpmaps, rm))
- break;
- }
- if (rm)
- break;
if (j == -1)
j = i;
}
- if (return_common_codecs)
- *return_common_codecs = mm[i] != NULL;
-
- if (mm[i] == NULL && j != -1)
- i = j; /* return m= line without common codecs */
-
- m = mm[i];
-
- for (; mm[i]; i++)
- mm[i] = mm[i + 1];
-
- return m;
+ if (mm[i])
+ return *return_codec_mismatch = 0, i;
+ else
+ return *return_codec_mismatch = 1, j;
}
/** Set payload types in @a l_m according to the values in @a r_m.
*
* @retval number of common codecs
*/
+static
int soa_sdp_set_rtpmap_pt(sdp_media_t *l_m,
sdp_media_t const *r_m)
{
@@ -511,6 +553,7 @@
*
* @return Number of common codecs
*/
+static
int soa_sdp_sort_rtpmap(sdp_rtpmap_t **inout_list,
sdp_rtpmap_t const *rrm,
char const *auxiliary)
@@ -564,6 +607,7 @@
*
* @return Number of common codecs
*/
+static
int soa_sdp_select_rtpmap(sdp_rtpmap_t **inout_list,
sdp_rtpmap_t const *rrm,
char const *auxiliary,
@@ -597,139 +641,220 @@
return common_codecs;
}
-/** Sort and select rtpmaps within session */
-int soa_sdp_upgrade_rtpmaps(soa_session_t *ss,
- sdp_session_t *session,
- sdp_session_t const *remote)
+
+/** Sort and select rtpmaps */
+static
+int soa_sdp_media_upgrade_rtpmaps(soa_session_t *ss,
+ sdp_media_t *sm,
+ sdp_media_t const *rm)
{
soa_static_session_t *sss = (soa_static_session_t *)ss;
+ char const *auxiliary = NULL;
+ int common_codecs;
+
+ common_codecs = soa_sdp_set_rtpmap_pt(sm, rm);
+
+ if (rm->m_type == sdp_media_audio)
+ auxiliary = sss->sss_audio_aux;
+
+ if (ss->ss_rtp_sort == SOA_RTP_SORT_REMOTE ||
+ (ss->ss_rtp_sort == SOA_RTP_SORT_DEFAULT &&
+ rm->m_mode == sdp_recvonly)) {
+ soa_sdp_sort_rtpmap(&sm->m_rtpmaps, rm->m_rtpmaps, auxiliary);
+ }
+
+ if (common_codecs == 0)
+ ;
+ else if (ss->ss_rtp_select == SOA_RTP_SELECT_SINGLE) {
+ soa_sdp_select_rtpmap(&sm->m_rtpmaps, rm->m_rtpmaps, auxiliary, 1);
+ }
+ else if (ss->ss_rtp_select == SOA_RTP_SELECT_COMMON) {
+ soa_sdp_select_rtpmap(&sm->m_rtpmaps, rm->m_rtpmaps, auxiliary, 0);
+ }
+
+ return common_codecs;
+}
+
+
+/** Sort and select rtpmaps within session */
+static
+int soa_sdp_session_upgrade_rtpmaps(soa_session_t *ss,
+ sdp_session_t *session,
+ sdp_session_t const *remote)
+{
sdp_media_t *sm;
sdp_media_t const *rm;
for (sm = session->sdp_media, rm = remote->sdp_media;
sm && rm;
sm = sm->m_next, rm = rm->m_next) {
- if (sm->m_rejected)
- continue;
- if (sdp_media_uses_rtp(sm)) {
- int common_codecs = soa_sdp_set_rtpmap_pt(sm, rm);
-
- char const *auxiliary =
- rm->m_type == sdp_media_audio ? sss->sss_audio_aux : NULL;
-
- if (ss->ss_rtp_sort == SOA_RTP_SORT_REMOTE ||
- (ss->ss_rtp_sort == SOA_RTP_SORT_DEFAULT &&
- rm->m_mode == sdp_recvonly)) {
- soa_sdp_sort_rtpmap(&sm->m_rtpmaps, rm->m_rtpmaps, auxiliary);
- }
-
- if (common_codecs == 0)
- ;
- else if (ss->ss_rtp_select == SOA_RTP_SELECT_SINGLE) {
- soa_sdp_select_rtpmap(&sm->m_rtpmaps, rm->m_rtpmaps, auxiliary, 1);
- }
- else if (ss->ss_rtp_select == SOA_RTP_SELECT_COMMON) {
- soa_sdp_select_rtpmap(&sm->m_rtpmaps, rm->m_rtpmaps, auxiliary, 0);
- }
- }
+ if (!sm->m_rejected && sdp_media_uses_rtp(sm))
+ soa_sdp_media_upgrade_rtpmaps(ss, sm, rm);
}
return 0;
}
-
/** Upgrade m= lines within session */
+static
int soa_sdp_upgrade(soa_session_t *ss,
su_home_t *home,
sdp_session_t *session,
- sdp_session_t const *caps,
- sdp_session_t const *upgrader)
+ sdp_session_t const *user,
+ sdp_session_t const *remote,
+ int **return_u2s,
+ int **return_s2u)
{
soa_static_session_t *sss = (soa_static_session_t *)ss;
- int Ns, Nc, Nu, size, i, j;
- sdp_media_t *m, **mm, *cm;
- sdp_media_t **s_media, **o_media, **c_media;
- sdp_media_t const **u_media;
+ int Ns, Nu, Nr, size, i, j;
+ sdp_media_t *m, **mm, *um;
+ sdp_media_t **s_media, **o_media, **u_media;
+ sdp_media_t const *rm, **r_media;
+ int *u2s = NULL, *s2u = NULL;
+
+ if (session == NULL || user == NULL)
+ return (errno = EFAULT), -1;
Ns = sdp_media_count(session, sdp_media_any, 0, 0, 0);
- Nc = sdp_media_count(caps, sdp_media_any, 0, 0, 0);
- Nu = sdp_media_count(upgrader, sdp_media_any, 0, 0, 0);
+ Nu = sdp_media_count(user, sdp_media_any, 0, 0, 0);
+ Nr = sdp_media_count(remote, sdp_media_any, 0, 0, 0);
- if (caps == upgrader)
- size = Ns + Nc + 1;
- else if (Ns < Nu)
- size = Nu + 1;
+ if (remote == NULL)
+ size = Ns + Nu + 1;
+ else if (Ns < Nr)
+ size = Nr + 1;
else
size = Ns + 1;
s_media = su_zalloc(home, size * (sizeof *s_media));
o_media = su_zalloc(home, (Ns + 1) * (sizeof *o_media));
- c_media = su_zalloc(home, (Nc + 1) * (sizeof *c_media));
u_media = su_zalloc(home, (Nu + 1) * (sizeof *u_media));
+ r_media = su_zalloc(home, (Nr + 1) * (sizeof *r_media));
- cm = sdp_media_dup_all(home, caps->sdp_media, session);
+ um = sdp_media_dup_all(home, user->sdp_media, session);
- if (!s_media || !c_media || !u_media || !cm)
+ if (!s_media || !u_media || !r_media || !um)
return -1;
+ u2s = su_alloc(home, (Nu + 1) * sizeof(*u2s));
+ s2u = su_alloc(home, size * sizeof(*s2u));
+ if (!u2s || !s2u)
+ return -1;
+
+ for (i = 0; i < Nu; i++)
+ u2s[i] = U2S_NOT_USED;
+ u2s[i] = U2S_SENTINEL;
+
+ for (i = 0; i <= size; i++)
+ s2u[i] = U2S_NOT_USED;
+ s2u[i] = U2S_SENTINEL;
+
for (i = 0, m = session->sdp_media; m && i < Ns; m = m->m_next)
o_media[i++] = m;
assert(i == Ns);
- for (i = 0, m = cm; m && i < Nc; m = m->m_next)
- c_media[i++] = m;
- assert(i == Nc);
- for (i = 0, m = upgrader->sdp_media; m && i < Nu; m = m->m_next)
+ for (i = 0, m = um; m && i < Nu; m = m->m_next)
u_media[i++] = m;
assert(i == Nu);
+ m = remote ? remote->sdp_media : NULL;
+ for (i = 0; m && i < Nr; m = m->m_next)
+ r_media[i++] = m;
+ assert(i == Nr);
+
+ if (sss->sss_ordered_user && sss->sss_u2s) { /* User SDP is ordered */
+ for (j = 0; sss->sss_u2s[j] != U2S_SENTINEL; j++) {
+ i = sss->sss_u2s[j];
+ if (i == U2S_NOT_USED)
+ continue;
+ if (j >= Nu) /* lines removed from user SDP */
+ continue;
+ s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
+ u2s[j] = i, s2u[i] = j;
+ }
+ }
- if (caps != upgrader) {
+ if (remote) {
/* Update session according to remote */
- for (i = 0; i < Nu; i++) {
- int common_codecs = 0;
+ for (i = 0; i < Nr; i++) {
+ rm = r_media[i];
+ m = s_media[i];
+
+ if (!m) {
+ int codec_mismatch = 0;
+
+ if (!rm->m_rejected)
+ j = soa_sdp_matching_mindex(ss, u_media, rm, &codec_mismatch);
+ else
+ j = -1;
+
+ if (j == -1) {
+ s_media[i] = soa_sdp_make_rejected_media(home, rm, session, 0);
+ continue;
+ }
+ else if (codec_mismatch && !ss->ss_rtp_mismatch) {
+ m = soa_sdp_make_rejected_media(home, u_media[j], session, 1);
+ soa_sdp_set_rtpmap_pt(s_media[i] = m, rm);
+ continue;
+ }
+
+ s_media[i] = m = u_media[j]; u_media[j] = SDP_MEDIA_NONE;
+ u2s[j] = i, s2u[i] = j;
+ }
- m = soa_sdp_matching(ss, c_media, u_media[i], &common_codecs);
+ if (sdp_media_uses_rtp(rm))
+ soa_sdp_media_upgrade_rtpmaps(ss, m, rm);
+ }
+ }
+ else if (sss->sss_ordered_user) {
+ /* Update session with unused media in u_media */
- if (!m || u_media[i]->m_rejected) {
- m = soa_sdp_make_rejected_media(home, u_media[i], session, 0);
+ if (!sss->sss_reuse_rejected) {
+ /* Mark previously used slots */
+ for (i = 0; i < Ns; i++) {
+ if (s_media[i])
+ continue;
+ s_media[i] = soa_sdp_make_rejected_media(home, o_media[i], session, 0);
}
- else if (sdp_media_uses_rtp(m)) {
- /* Process rtpmaps */
- char const *auxiliary =
- m->m_type == sdp_media_audio ? sss->sss_audio_aux : NULL;
-
- if (!common_codecs && !ss->ss_rtp_mismatch)
- m = soa_sdp_make_rejected_media(home, m, session, 1);
- soa_sdp_set_rtpmap_pt(m, u_media[i]);
-
- if (ss->ss_rtp_sort == SOA_RTP_SORT_REMOTE ||
- (ss->ss_rtp_sort == SOA_RTP_SORT_DEFAULT &&
- u_media[i]->m_mode == sdp_recvonly)) {
- soa_sdp_sort_rtpmap(&m->m_rtpmaps, u_media[i]->m_rtpmaps, auxiliary);
- }
+ }
- if (common_codecs &&
- (ss->ss_rtp_select == SOA_RTP_SELECT_SINGLE ||
- ss->ss_rtp_select == SOA_RTP_SELECT_COMMON)) {
- soa_sdp_select_rtpmap(&m->m_rtpmaps, u_media[i]->m_rtpmaps, auxiliary,
- ss->ss_rtp_select == SOA_RTP_SELECT_SINGLE);
- }
+ for (j = 0; j < Nu; j++) {
+ if (u_media[j] == SDP_MEDIA_NONE)
+ continue;
+
+ for (i = 0; i < size - 1; i++) {
+ if (s_media[i] != NULL)
+ continue;
+ s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
+ u2s[j] = i, s2u[i] = j;
}
- s_media[i] = m;
+ assert(i != size);
}
}
else {
- /* Update session according to local */
+ /* Match unused user media by media types with the existing session */
for (i = 0; i < Ns; i++) {
- m = soa_sdp_matching(ss, c_media, o_media[i], NULL);
- if (!m)
- m = soa_sdp_make_rejected_media(home, o_media[i], session, 0);
- s_media[i] = m;
+ if (s_media[i])
+ continue;
+
+ j = soa_sdp_matching_mindex(ss, u_media, o_media[i], NULL);
+ if (j == -1) {
+ s_media[i] = soa_sdp_make_rejected_media(home, o_media[i], session, 0);
+ continue;
+ }
+
+ s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
+ u2s[j] = i, s2u[i] = j;
}
+
/* Here we just append new media at the end */
- for (j = 0; c_media[j]; j++)
- s_media[i++] = c_media[j];
+ for (j = 0; j < Nu; j++) {
+ if (u_media[j] != SDP_MEDIA_NONE) {
+ s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
+ u2s[j] = i, s2u[i] = j;
+ i++;
+ }
+ }
assert(i <= size);
}
@@ -739,10 +864,46 @@
}
*mm = NULL;
+#ifndef NDEBUG
+ for (j = i; j < size; j++)
+ assert(s2u[j] == U2S_NOT_USED);
+#endif
+
+ s2u[size = i] = U2S_SENTINEL;
+ *return_u2s = u2s;
+ *return_s2u = s2u;
+
+#ifndef NDEBUG /* X check */
+ for (j = 0; j < Nu; j++) {
+ i = u2s[j];
+ assert(i == U2S_NOT_USED || s2u[i] == j);
+ }
+ for (i = 0; i < size; i++) {
+ j = s2u[i];
+ assert(j == U2S_NOT_USED || u2s[j] == i);
+ }
+#endif
+
return 0;
}
+int *u2s_alloc(su_home_t *home, int const *u2s)
+{
+ if (u2s) {
+ int i, *a;
+ for (i = 0; u2s[i] != U2S_SENTINEL; i++)
+ ;
+ a = su_alloc(home, (i + 1) * (sizeof *u2s));
+ if (a)
+ memcpy(a, u2s, (i + 1) * (sizeof *u2s));
+ return a;
+ }
+
+ return NULL;
+}
+
/** Check if @a session contains media that are rejected by @a remote. */
+static
int soa_sdp_reject_is_needed(sdp_session_t const *session,
sdp_session_t const *remote)
{
@@ -774,6 +935,7 @@
}
/** If m= line is rejected by remote mark m= line rejected within session */
+static
int soa_sdp_reject(su_home_t *home,
sdp_session_t *session,
sdp_session_t const *remote)
@@ -813,6 +975,7 @@
}
/** Check if @a session mode should be changed. */
+static
int soa_sdp_mode_set_is_needed(sdp_session_t const *session,
sdp_session_t const *remote,
char const *hold)
@@ -855,6 +1018,7 @@
/** Update mode within session */
+static
int soa_sdp_mode_set(sdp_session_t *session,
sdp_session_t const *remote,
char const *hold)
@@ -908,6 +1072,8 @@
enum offer_answer_action action,
char const *by)
{
+ soa_static_session_t *sss = (soa_static_session_t *)ss;
+
char c_address[64];
sdp_session_t *local = ss->ss_local->ssd_sdp;
sdp_session_t local0[1];
@@ -922,6 +1088,8 @@
sdp_connection_t *c, c0[1] = {{ sizeof(c0) }};
sdp_time_t t[1] = {{ sizeof(t) }};
+ int *u2s = NULL, *s2u = NULL, *tbf;
+
char const *phrase = "Internal Media Error";
su_home_t tmphome[SU_HOME_AUTO_SIZE(8192)];
@@ -991,7 +1159,7 @@
*local0 = *local, local = local0;
SU_DEBUG_7(("soa_static(%p, %s): %s\n", (void *)ss, by,
"upgrade with local description"));
- soa_sdp_upgrade(ss, tmphome, local, user, user);
+ soa_sdp_upgrade(ss, tmphome, local, user, NULL, &u2s, &s2u);
break;
case generate_answer:
/* Upgrade local SDP based on remote SDP */
@@ -1003,7 +1171,7 @@
*local0 = *local, local = local0;
SU_DEBUG_7(("soa_static(%p, %s): %s\n", (void *)ss, by,
"upgrade with remote description"));
- soa_sdp_upgrade(ss, tmphome, local, user, remote);
+ soa_sdp_upgrade(ss, tmphome, local, user, remote, &u2s, &s2u);
}
break;
case process_answer:
@@ -1074,7 +1242,7 @@
*local0 = *local, local = local0;
DUP_LOCAL(local);
}
- soa_sdp_upgrade_rtpmaps(ss, local, remote);
+ soa_sdp_session_upgrade_rtpmaps(ss, local, remote);
}
break;
case generate_offer:
@@ -1125,9 +1293,16 @@
soa_description_free(ss, ss->ss_previous);
+ if (u2s) {
+ u2s = u2s_alloc(ss->ss_home, u2s);
+ s2u = u2s_alloc(ss->ss_home, s2u);
+ if (!u2s || !s2u)
+ goto internal_error;
+ }
+
if (ss->ss_local->ssd_sdp != local &&
sdp_session_cmp(ss->ss_local->ssd_sdp, local)) {
- /* We have modfied local session: update origin-line */
+ /* We have modified local session: update origin-line */
if (local->sdp_origin != o)
*o = *local->sdp_origin, local->sdp_origin = o;
o->o_version++;
@@ -1151,10 +1326,24 @@
/* Update the unparsed and pretty-printed descriptions */
if (soa_description_set(ss, ss->ss_local, local, NULL, 0) < 0) {
+ if (action == generate_offer) {
+ /* Remove 2nd reference to local session state */
+ memset(ss->ss_previous, 0, (sizeof *ss->ss_previous));
+ ss->ss_previous_user_version = 0;
+ ss->ss_previous_remote_version = 0;
+ }
+
+ su_free(ss->ss_home, u2s), su_free(ss->ss_home, s2u);
+
goto internal_error;
}
}
+ if (u2s) {
+ tbf = sss->sss_u2s, sss->sss_u2s = u2s, su_free(ss->ss_home, tbf);
+ tbf = sss->sss_s2u, sss->sss_s2u = s2u, su_free(ss->ss_home, tbf);
+ }
+
/* Update version numbers */
switch (action) {
case generate_offer:
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_tag.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_tag.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_tag.c Wed Jun 20 06:41:15 2007
@@ -604,3 +604,32 @@
* @sa soa_set_params(), nua_invite(), @ref nua_event_diagram_call_hold
*/
tag_typedef_t soatag_hold = STRTAG_TYPEDEF(hold);
+
+
+/**@def SOATAG_ORDERED_USER(x)
+ *
+ * Take account strict ordering of user SDP m=lines. If user SDP has been
+ * updated, the new media lines replace old ones even if the media type has
+ * been changed. This allows the application to replace @b m=audio with
+ * @b m=image/t38, for instance.
+ *
+ * @par Used with
+ * soa_set_params(), soa_get_params(), soa_get_paramlist() \n
+ *
+ * @par Parameter type
+ * boolean
+ *
+ * @par Values
+ * - false (0) - update session with user SDP based on media type
+ * - true (1) - update session with m= line in user SDP based on their order
+ *
+ * The default value is false and session are updated based on media types.
+ *
+ *
+ * Corresponding tag taking a reference parameter is SOATAG_RTP_SELECT_REF().
+ *
+ * @sa @RFC3264 section 8.3.3, T.38
+ */
+tag_typedef_t soatag_ordered_user = BOOLTAG_TYPEDEF(ordered_user);
+
+tag_typedef_t soatag_reuse_rejected = BOOLTAG_TYPEDEF(reuse_rejected);
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_tag.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_tag.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_tag.h Wed Jun 20 06:41:15 2007
@@ -244,6 +244,20 @@
#define SOATAG_HOLD_REF(x) soatag_hold_ref, tag_str_vr(&(x))
SOFIAPUBVAR tag_typedef_t soatag_hold_ref;
+#define SOATAG_ORDERED_USER(x) soatag_ordered_user, tag_bool_v(x)
+SOFIAPUBVAR tag_typedef_t soatag_ordered_user;
+
+#define SOATAG_ORDERED_USER_REF(x) \
+ soatag_ordered_user_ref, tag_bool_vr(&(x))
+SOFIAPUBVAR tag_typedef_t soatag_ordered_user_ref;
+
+#define SOATAG_REUSE_REJECTED(x) soatag_reuse_rejected, tag_bool_v(x)
+SOFIAPUBVAR tag_typedef_t soatag_reuse_rejected;
+
+#define SOATAG_REUSE_REJECTED_REF(x) \
+ soatag_reuse_rejected_ref, tag_bool_vr(&(x))
+SOFIAPUBVAR tag_typedef_t soatag_reuse_rejected_ref;
+
SOFIA_END_DECLS
#endif /* SOA_TAG_H */
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c Wed Jun 20 06:41:15 2007
@@ -519,7 +519,7 @@
/* 'B' will reject. */
TEST(soa_set_params(a,
SOATAG_HOLD(NULL), /* 'A' will release hold. */
- SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8\r\n"
+ SOATAG_USER_SDP_STR("m=audio 5008 RTP/AVP 0 8\r\ni=x\r\n"
"m=video 5006 RTP/AVP 34\r\n"),
TAG_END()), 2);
@@ -663,7 +663,7 @@
TEST_1(m = b_sdp->sdp_media); TEST_1(m->m_rejected);
TEST_1(rm = m->m_rtpmaps); TEST(rm->rm_pt, 96);
TEST_S(rm->rm_encoding, "G7231");
- /* Not using payload type 97 from offer */
+ /* Not reusing payload type 97 from offer */
TEST_1(rm = rm->rm_next); TEST(rm->rm_pt, 98);
TEST_S(rm->rm_encoding, "G729");
TEST_1(!rm->rm_next);
@@ -1141,6 +1141,128 @@
END();
}
+int test_media_replace(struct context *ctx)
+{
+ BEGIN();
+ int n;
+
+ soa_session_t *a, *b;
+
+ char const *offer = NONE, *answer = NONE;
+ isize_t offerlen = (isize_t)-1, answerlen = (isize_t)-1;
+
+ sdp_session_t const *a_sdp, *b_sdp;
+ sdp_media_t const *m;
+
+ char const a_caps[] =
+ "v=0\r\n"
+ "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
+ "c=IN IP4 127.0.0.2\r\n"
+ "m=audio 5008 RTP/AVP 0 8\r\n"
+ ;
+
+ char const b_caps[] =
+ "m=audio 5004 RTP/AVP 0 8\n"
+ "a=rtpmap:96 G7231/8000\n"
+ "a=rtpmap:97 G729/8000\n"
+ "m=image 5556 UDPTL t38\r\n"
+ "a=T38FaxVersion:0\r\n"
+ "a=T38MaxBitRate:9600\r\n"
+ "a=T38FaxFillBitRemoval:0\r\n"
+ "a=T38FaxTranscodingMMR:0\r\n"
+ "a=T38FaxTranscodingJBIG:0\r\n"
+ "a=T38FaxRateManagement:transferredTCF\r\n"
+ "a=T38FaxMaxDatagram:400\r\n";
+
+ TEST_1(a = soa_create("static", ctx->root, ctx));
+ TEST_1(b = soa_create("static", ctx->root, ctx));
+
+ TEST(soa_set_user_sdp(a, 0, a_caps, strlen(a_caps)), 1);
+ TEST(soa_set_user_sdp(b, 0, b_caps, strlen(b_caps)), 1);
+
+ n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+ n = soa_get_local_sdp(a, NULL, &offer, &offerlen); TEST(n, 1);
+ TEST_1(offer != NULL && offer != NONE);
+ n = soa_set_remote_sdp(b, 0, offer, offerlen); TEST(n, 1);
+ n = soa_get_local_sdp(b, NULL, &answer, &answerlen); TEST(n, 0);
+ n = soa_generate_answer(b, test_completed); TEST(n, 0);
+ n = soa_get_local_sdp(b, &b_sdp, &answer, &answerlen); TEST(n, 1);
+ TEST_1(answer != NULL && answer != NONE);
+ n = soa_set_remote_sdp(a, 0, answer, -1); TEST(n, 1);
+ n = soa_process_answer(a, test_completed); TEST(n, 0);
+
+ TEST_1(soa_is_complete(b));
+ TEST(soa_activate(b, NULL), 0);
+
+ TEST_1(soa_is_complete(a));
+ TEST(soa_activate(a, NULL), 0);
+
+ TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDRECV);
+ TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
+
+ /* ---------------------------------------------------------------------- */
+
+ /* Re-O/A: replace media stream */
+
+ /* Accept media without common codecs */
+ TEST_1(soa_set_params(a, SOATAG_RTP_MISMATCH(0),
+ SOATAG_ORDERED_USER(1),
+ SOATAG_USER_SDP_STR(
+ "v=0\r\n"
+ "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
+ "c=IN IP4 127.0.0.2\r\n"
+ "m=image 16384 UDPTL t38\r\n"
+ "a=T38FaxVersion:0\r\n"
+ "a=T38MaxBitRate:9600\r\n"
+ "a=T38FaxFillBitRemoval:0\r\n"
+ "a=T38FaxTranscodingMMR:0\r\n"
+ "a=T38FaxTranscodingJBIG:0\r\n"
+ "a=T38FaxRateManagement:transferredTCF\r\n"
+ "a=T38FaxMaxDatagram:400\r\n"
+ ),
+ TAG_END()));
+
+ n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+ n = soa_get_local_sdp(a, &a_sdp, &offer, &offerlen); TEST(n, 1);
+ TEST_1(offer != NULL && offer != NONE);
+ n = soa_set_remote_sdp(b, 0, offer, offerlen); TEST(n, 1);
+ n = soa_generate_answer(b, test_completed); TEST(n, 0);
+ n = soa_get_local_sdp(b, &b_sdp, &answer, &answerlen); TEST(n, 1);
+ TEST_1(answer != NULL && answer != NONE);
+ n = soa_set_remote_sdp(a, 0, answer, -1); TEST(n, 1);
+ n = soa_process_answer(a, test_completed); TEST(n, 0);
+ n = soa_get_local_sdp(a, &a_sdp, NULL, NULL); TEST(n, 1);
+
+ TEST_1(soa_is_complete(b));
+ TEST(soa_activate(b, NULL), 0);
+
+ TEST_1(soa_is_complete(a));
+ TEST(soa_activate(a, NULL), 0);
+
+ TEST_1(m = a_sdp->sdp_media); TEST_1(!m->m_rejected);
+ TEST(m->m_type, sdp_media_image);
+ TEST(m->m_proto, sdp_proto_udptl);
+ TEST_1(m->m_format);
+ TEST_S(m->m_format->l_text, "t38");
+
+ TEST_1(m = b_sdp->sdp_media); TEST_1(!m->m_rejected);
+ TEST(m->m_type, sdp_media_image);
+ TEST(m->m_proto, sdp_proto_udptl);
+ TEST_1(m->m_format);
+ TEST_S(m->m_format->l_text, "t38");
+
+ TEST(soa_is_audio_active(a), SOA_ACTIVE_DISABLED);
+ TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_DISABLED);
+
+ TEST_VOID(soa_terminate(a, NULL));
+ TEST_VOID(soa_terminate(b, NULL));
+
+ TEST_VOID(soa_destroy(a));
+ TEST_VOID(soa_destroy(b));
+
+ END();
+}
+
int test_asynch_offer_answer(struct context *ctx)
{
@@ -1332,6 +1454,7 @@
retval |= test_params(ctx); SINGLE_FAILURE_CHECK();
retval |= test_static_offer_answer(ctx); SINGLE_FAILURE_CHECK();
retval |= test_codec_selection(ctx); SINGLE_FAILURE_CHECK();
+ retval |= test_media_replace(ctx); SINGLE_FAILURE_CHECK();
retval |= test_asynch_offer_answer(ctx); SINGLE_FAILURE_CHECK();
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_configure.h.in
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_configure.h.in (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_configure.h.in Wed Jun 20 06:41:15 2007
@@ -88,6 +88,9 @@
/** Define as suitable declarator static inline functions */
#undef su_inline
+/** Define as 1 the tag value casts use inlined functions */
+#undef SU_INLINE_TAG_CAST
+
/** Define this as 1 if we can use tags directly from stack. */
#undef SU_HAVE_TAGSTACK
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag.h Wed Jun 20 06:41:15 2007
@@ -171,7 +171,7 @@
#define SU_ALIGN(x) \
((sizeof(void *) - ((intptr_t)(x) & (sizeof(void *) - 1))) & (sizeof(void *) - 1))
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
su_inline tag_value_t tag_int_v(int v) { return (tag_value_t)v; }
su_inline tag_value_t tag_int_vr(int *vp) { return (tag_value_t)vp; }
su_inline tag_value_t tag_uint_v(unsigned v) { return (tag_value_t)v; }
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_io.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_io.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_io.h Wed Jun 20 06:41:15 2007
@@ -48,7 +48,7 @@
SOFIAPUBFUN void tl_print(FILE *f, char const *title, tagi_t const lst[]);
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
su_inline tag_value_t tag_socket_v(su_socket_t v) {
return (tag_value_t)v;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su.c Wed Jun 20 06:41:15 2007
@@ -51,14 +51,18 @@
#endif
int su_socket_close_on_exec = 0;
+int su_socket_blocking = 0;
/** Create an endpoint for communication. */
su_socket_t su_socket(int af, int socktype, int proto)
{
su_socket_t s = socket(af, socktype, proto);
#if SU_HAVE_BSDSOCK
- if (s != INVALID_SOCKET && su_socket_close_on_exec) {
- fcntl(s, F_SETFD, FD_CLOEXEC); /* Close on exec */
+ if (s != INVALID_SOCKET) {
+ if (su_socket_close_on_exec)
+ fcntl(s, F_SETFD, FD_CLOEXEC); /* Close on exec */
+ if (!su_socket_blocking) /* All sockets are born blocking */
+ su_setblocking(s, 0);
}
#endif
return s;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c Wed Jun 20 06:41:15 2007
@@ -540,7 +540,6 @@
init(child, magic) == 0)
return 0;
- deinit(child, magic);
su_msg_destroy(return_clone);
su_root_destroy(child);
return -1;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c Wed Jun 20 06:41:15 2007
@@ -204,6 +204,8 @@
TEST(getsockname(l, &su.su_sa, &sulen), 0);
TEST(listen(l, 5), 0);
+
+ TEST(su_setblocking(s, 1), 0);
TEST(connect(s, &su.su_sa, sulen), 0);
a = accept(l, &csu.su_sa, &csulen); TEST_1(a != -1);
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport.h Wed Jun 20 06:41:15 2007
@@ -279,6 +279,9 @@
/** Test if transport is connected. @NEW_1_12_5 */
TPORT_DLL int tport_is_connected(tport_t const *self);
+/** Test if transport can be used to send message. @NEW_1_12_7 */
+TPORT_DLL int tport_is_clear_to_send(tport_t const *self);
+
/** Set transport magic. */
TPORT_DLL void tport_set_magic(tport_t *self, tp_magic_t *magic);
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h Wed Jun 20 06:41:15 2007
@@ -403,7 +403,7 @@
* Use with tport_tcreate(), nua_create(), nta_agent_create(),
* nth_engine_create(), or initial nth_site_create().
*
- * @sa #TPORT_DUMP, TPTAG_DUMP()
+ * @sa #TPORT_LOG environment variable, TPTAG_DUMP()
*
* @NEW_1_12_5
*/
@@ -418,7 +418,7 @@
* Use with tport_tcreate(), nta_agent_create(), nua_create(),
* nth_engine_create(), or initial nth_site_create().
*
- * @sa #TPORT_DUMP, TPTAG_LOG().
+ * @sa #TPORT_DUMP environment variable, TPTAG_LOG().
*
* @NEW_1_12_5
*/
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c Wed Jun 20 06:41:15 2007
@@ -166,7 +166,7 @@
self->tp_pri->pri_primary != self;
}
-/** Test if transport has been registered */
+/** Test if transport has been registered to su_root_t */
int tport_is_registered(tport_t const *self)
{
return self->tp_index != 0;
@@ -291,6 +291,19 @@
return self->tp_is_connected;
}
+/** Test if transport can be used to send message. @NEW_1_12_7 */
+int tport_is_clear_to_send(tport_t const *self)
+{
+ return
+ tport_is_master(self) ||
+ tport_is_primary(self) ||
+ (tport_is_secondary(self) &&
+ tport_is_registered(self) &&
+ self->tp_reusable &&
+ !self->tp_closed &&
+ !self->tp_send_close);
+}
+
/** MTU for transport */
su_inline unsigned tport_mtu(tport_t const *self)
{
@@ -1164,7 +1177,7 @@
if (self == NULL)
return su_seterrno(EINVAL);
- memcpy(tpp, tpp0 = self->tp_params, sizeof *tpp);
+ memcpy(tpp, tpp0 = self->tp_params, sizeof tpp);
mtu = tpp->tpp_mtu;
connect = tpp->tpp_conn_orient;
@@ -1220,9 +1233,10 @@
if (tport_is_secondary(self) &&
self->tp_params == self->tp_pri->pri_primary->tp_params) {
tpp0 = su_zalloc(self->tp_home, sizeof *tpp0); if (!tpp0) return -1;
+ self->tp_params = tpp0;
}
- memcpy(tpp0, tpp, sizeof *tpp);
+ memcpy(tpp0, tpp, sizeof tpp);
return n;
}
@@ -1963,7 +1977,7 @@
*/
void tport_close(tport_t *self)
{
- SU_DEBUG_5(("%s(%p): " TPN_FORMAT "\n", "tport_close", (void *)self,
+ SU_DEBUG_5(("%s(%p): " TPN_FORMAT "\n", "tport_close", (void *)self,
TPN_ARGS(self->tp_name)));
self->tp_closed = 1;
@@ -2360,6 +2374,7 @@
else if (errcode > 0)
errmsg = su_strerror(errcode);
else
+ /* Should be something like ENOTCONN */
errcode = 0, errmsg = "stream closed";
if (addr && addr->su_family == AF_UNSPEC)
@@ -2369,12 +2384,12 @@
if (errcode > 0 && tport_has_connection(self))
self->tp_reusable = 0;
- if (addr == NULL && tport_is_connection_oriented(self))
- addr = self->tp_addr;
-
/* Report error */
if (addr && tport_pending_error(self, addr, errcode))
;
+ else if (tport_is_secondary(self) &&
+ tport_pending_error(self, NULL, errcode) > 0)
+ ;
else if (self->tp_master->mr_tpac->tpac_error) {
char *dstname = NULL;
char hp[TPORT_HOSTPORTSIZE];
@@ -3070,30 +3085,24 @@
/* Select a primary protocol, make a fresh connection */
self = primary->pri_primary;
}
+ else if (tport_is_secondary(self) && tport_is_clear_to_send(self)) {
+ self = self;
+ }
+ /*
+ * Try to find an already open connection to the destination,
+ * or get a primary protocol
+ */
else {
- if (tport_is_secondary(self) &&
- tport_is_registered(self) &&
- self->tp_reusable &&
- !self->tp_closed &&
- !self->tp_send_close) {
- self = self;
- }
- /*
- * Try to find an already open connection to the destination,
- * or get a primary protocol
- */
- else {
- /* If primary, resolve the destination address, store it in the msg */
- if (tport_resolve(primary->pri_primary, msg, tpn) < 0) {
- return NULL;
- }
- resolved = 1;
-
- self = tport_by_addrinfo(primary, msg_addrinfo(msg), tpn);
-
- if (!self)
- self = primary->pri_primary;
+ /* If primary, resolve the destination address, store it in the msg */
+ if (tport_resolve(primary->pri_primary, msg, tpn) < 0) {
+ return NULL;
}
+ resolved = 1;
+
+ self = tport_by_addrinfo(primary, msg_addrinfo(msg), tpn);
+
+ if (!self)
+ self = primary->pri_primary;
}
if (tport_is_primary(self)) {
@@ -3878,9 +3887,12 @@
{
tport_pending_t *pending;
- if (self == NULL || msg == NULL || callback == NULL || client == NULL)
+ if (self == NULL || callback == NULL || client == NULL)
return -1;
-
+
+ if (msg == NULL && tport_is_primary(self))
+ return -1;
+
SU_DEBUG_7(("tport_pend(%p): pending %p for %s/%s:%s (already %u)\n",
(void *)self, (void *)msg,
self->tp_protoname, self->tp_host, self->tp_port,
@@ -3930,7 +3942,7 @@
{
tport_pending_t *pending;
- if (self == NULL || msg == NULL || pendd <= 0 || pendd > (int)self->tp_plen)
+ if (self == NULL || pendd <= 0 || pendd > (int)self->tp_plen)
return su_seterrno(EINVAL), -1;
pending = self->tp_pending + (pendd - 1);
@@ -3968,7 +3980,7 @@
msg_t *msg;
su_addrinfo_t const *ai;
- assert(self); assert(dst);
+ assert(self);
callbacks = 0;
reported = ++self->tp_reported;
@@ -3979,22 +3991,25 @@
for (i = 0; i < self->tp_plen; i++) {
pending = self->tp_pending + i;
- if (!pending->p_callback || !pending->p_msg)
+ if (!pending->p_callback)
continue;
if (pending->p_reported == reported)
continue;
msg = pending->p_msg;
- ai = msg_addrinfo(msg);
- if (su_cmp_sockaddr(dst, (su_sockaddr_t *)ai->ai_addr) != 0)
- continue;
+ if (dst && msg) {
+ ai = msg_addrinfo(msg);
- pending->p_reported = reported;
+ if (su_cmp_sockaddr(dst, (su_sockaddr_t *)ai->ai_addr) != 0)
+ continue;
+ }
msg_set_errno(msg, error);
+ pending->p_reported = reported;
+
pending->p_callback(self->TP_STACK, pending->p_client, self, msg, error);
callbacks++;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c Wed Jun 20 06:41:15 2007
@@ -252,9 +252,9 @@
tport_dump_iovec(self, msg, n, iovec, veclen, "recv", "from");
/* Mark buffer as used */
- msg_recv_commit(msg, n, 0);
+ msg_recv_commit(msg, n, n == 0);
- return 1;
+ return n != 0;
}
ssize_t tport_send_stream(tport_t const *self, msg_t *msg,
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/url/torture_url.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/url/torture_url.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/url/torture_url.c Wed Jun 20 06:41:15 2007
@@ -214,6 +214,15 @@
TEST_S(u->url_fragment, "foo");
}
+ {
+ url_t u[1];
+ char b2[6] = "";
+
+ memset(u, 0xff, sizeof u);
+ TEST(url_d(u, b2), 0);
+ TEST(u->url_type, url_unknown);
+ }
+
su_home_deinit(home);
END();
Modified: freeswitch/trunk/libs/sofia-sip/m4/sac-su2.m4
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/m4/sac-su2.m4 (original)
+++ freeswitch/trunk/libs/sofia-sip/m4/sac-su2.m4 Wed Jun 20 06:41:15 2007
@@ -2,11 +2,11 @@
dnl su module
dnl ======================================================================
+AC_DEFUN([SAC_SU])
+
AC_DEFUN([SAC_SOFIA_SU], [
# Beginning of SAC_SOFIA_SU
-AC_REQUIRE([SAC_WITH_RT])
-
# ======================================================================
# Check for features used by su
@@ -66,6 +66,16 @@
AC_REQUIRE([AC_C_INLINE])
+AC_ARG_ENABLE(tag-cast,
+[ --disable-tag-cast cast tag values with inlined functions [[enabled]]],
+ , enable_tag_cast=yes)
+
+if test "$enable_tag_cast" = "yes"; then
+ tag_cast=1
+else
+ tag_cast=0
+fi
+
case "$ac_cv_c_inline" in
yes) SAC_SU_DEFINE(su_inline, static inline, [
Define to declarator for static inline functions.
@@ -76,15 +86,20 @@
SAC_SU_DEFINE(SU_HAVE_INLINE, 1, [
Define to 1 if you have inline functions.
])dnl
+ SAC_SU_DEFINE_UNQUOTED(SU_INLINE_TAG_CAST, $tag_cast, [
+ Define to 1 if you use inline function to cast tag values.
+ ])dnl
;;
no | "" )
SAC_SU_DEFINE(su_inline, static)dnl
SAC_SU_DEFINE(SU_INLINE, /*inline*/)dnl
SAC_SU_DEFINE(SU_HAVE_INLINE, 0)dnl
+ SAC_SU_DEFINE(SU_INLINE_TAG_CAST, 0)dnl
;;
*) SAC_SU_DEFINE_UNQUOTED(su_inline, static $ac_cv_c_inline)dnl
SAC_SU_DEFINE_UNQUOTED(SU_INLINE, $ac_cv_c_inline)dnl
SAC_SU_DEFINE(SU_HAVE_INLINE, 1)dnl
+ SAC_SU_DEFINE_UNQUOTED(SU_INLINE_TAG_CAST, $tag_cast)dnl
;;
esac
@@ -368,7 +383,15 @@
# Checks for libraries
# ===========================================================================
-SAC_CHECK_SU_LIBS
+AC_CHECK_LIB(pthread, pthread_create)
+AC_CHECK_LIB(socket, socketpair,,,-lnsl)
+
+AC_ARG_WITH(rt,
+[ --with-rt use POSIX realtime library [[used by default]]])
+if test "${with_rt}" != no; then
+ AC_SEARCH_LIBS(clock_gettime, rt)
+ AC_CHECK_FUNCS([clock_gettime clock_getcpuclockid])
+fi
# No GLib path explicitly defined, use pkg-config
AC_ARG_WITH(glib,
@@ -470,11 +493,6 @@
[Define to 1 if you have if_nameindex().])
fi
-AC_REQUIRE([SAC_WITH_RT])
-if test "${with_rt}" != no; then
- AC_CHECK_FUNCS([clock_gettime clock_getcpuclockid])
-fi
-
SAC_REPLACE_FUNCS([memmem memccpy memspn memcspn strcasestr strtoull \
inet_ntop inet_pton poll])
1
0
Author: mikej
Date: Wed Jun 20 05:19:45 2007
New Revision: 5412
Modified:
freeswitch/trunk/src/include/switch_log.h
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_core_io.c
freeswitch/trunk/src/switch_core_session.c
freeswitch/trunk/src/switch_log.c
Log:
add userdata param to switch_log_printf so we can pass uuid or other session or other identification information to the logger.
Modified: freeswitch/trunk/src/include/switch_log.h
==============================================================================
--- freeswitch/trunk/src/include/switch_log.h (original)
+++ freeswitch/trunk/src/include/switch_log.h Wed Jun 20 05:19:45 2007
@@ -61,7 +61,7 @@
switch_time_t timestamp;
/*! A pointer to where the actual content of the message starts (skipping past the preformatted portion) */
char *content;
-
+ const char *userdata;
/* To maintain abi, only add new elements to the end of this struct and do not delete any elements */
} switch_log_node_t;
@@ -95,7 +95,7 @@
\note there are channel macros to supply the first 4 parameters
*/
SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
- switch_log_level_t level, const char *fmt, ...) PRINTF_FUNCTION(6, 7);
+ const char *userdata, switch_log_level_t level, const char *fmt, ...) PRINTF_FUNCTION(6, 7);
/*!
\brief Shut down the logging engine
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Wed Jun 20 05:19:45 2007
@@ -511,9 +511,9 @@
SCSMF_DYNAMIC = (1 << 0)
} switch_core_session_message_flag_t;
-#define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__
-#define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__
-#define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__
+#define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
+#define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
+#define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
/*!
\enum switch_channel_state_t
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Wed Jun 20 05:19:45 2007
@@ -711,7 +711,7 @@
if (state > CS_RING) {
switch_channel_presence(channel, "unknown", (char *) state_names[state]);
}
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s State Change %s -> %s\n",
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "%s State Change %s -> %s\n",
channel->name, state_names[last_state], state_names[state]);
switch_mutex_lock(channel->flag_mutex);
channel->state = state;
@@ -742,7 +742,7 @@
}
} else {
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_WARNING,
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_WARNING,
"%s Invalid State Change %s -> %s\n", channel->name, state_names[last_state], state_names[state]);
/* we won't tolerate an invalid state change so we can make sure we are as robust as a nice cup of dark coffee! */
@@ -1049,7 +1049,7 @@
switch_channel_state_t last_state = channel->state;
channel->state = CS_HANGUP;
channel->hangup_cause = hangup_cause;
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n",
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n",
channel->name, state_names[last_state], switch_channel_cause2str(channel->hangup_cause));
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_HANGUP) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", "%s", switch_channel_cause2str(channel->hangup_cause));
@@ -1072,7 +1072,7 @@
SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready(switch_channel_t *channel, const char *file, const char *func, int line)
{
if (!switch_channel_test_flag(channel, CF_RING_READY)) {
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
switch_channel_set_flag(channel, CF_RING_READY);
return SWITCH_STATUS_SUCCESS;
}
@@ -1092,7 +1092,7 @@
char *uuid;
switch_core_session_t *other_session;
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name);
switch_channel_set_flag(channel, CF_EARLY_MEDIA);
switch_channel_set_variable(channel, "endpoint_disposition", "EARLY MEDIA");
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_PROGRESS) == SWITCH_STATUS_SUCCESS) {
@@ -1168,7 +1168,7 @@
status = switch_core_session_receive_message(channel->session, &msg);
if (status == SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name);
}
return status;
@@ -1213,7 +1213,7 @@
}
switch_channel_set_variable(channel, "endpoint_disposition", "ANSWER");
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name);
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c (original)
+++ freeswitch/trunk/src/switch_core_io.c Wed Jun 20 05:19:45 2007
@@ -746,7 +746,7 @@
switch_io_event_hook_kill_channel_t *ptr;
switch_status_t status = SWITCH_STATUS_FALSE;
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "Kill %s [%s]\n", switch_channel_get_name(session->channel),
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "Kill %s [%s]\n", switch_channel_get_name(session->channel),
SIG_NAMES[sig]);
if (session->endpoint_interface->io_routines->kill_channel) {
Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c (original)
+++ freeswitch/trunk/src/switch_core_session.c Wed Jun 20 05:19:45 2007
@@ -658,7 +658,7 @@
switch_memory_pool_t *pool;
switch_event_t *event;
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n",
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n",
switch_channel_get_name((*session)->channel),
switch_channel_state_name(switch_channel_get_state((*session)->channel)));
Modified: freeswitch/trunk/src/switch_log.c
==============================================================================
--- freeswitch/trunk/src/switch_log.c (original)
+++ freeswitch/trunk/src/switch_log.c Wed Jun 20 05:19:45 2007
@@ -164,7 +164,7 @@
}
SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
- switch_log_level_t level, const char *fmt, ...)
+ const char *userdata, switch_log_level_t level, const char *fmt, ...)
{
char *data = NULL;
char *new_fmt = NULL;
1
0
[commit] r5411 - in freeswitch/trunk/src: . include mod/endpoints/mod_dingaling mod/endpoints/mod_sofia
by Freeswitch SVN 20 Jun '07
by Freeswitch SVN 20 Jun '07
20 Jun '07
Author: mikej
Date: Wed Jun 20 05:02:30 2007
New Revision: 5411
Modified:
freeswitch/trunk/src/include/switch.h
freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/switch_rtp.c
freeswitch/trunk/src/switch_stun.c
Log:
only include switch_stun.h where needed. We use some c99isms in this header that do not get along well with some c++ compilers.
Modified: freeswitch/trunk/src/include/switch.h
==============================================================================
--- freeswitch/trunk/src/include/switch.h (original)
+++ freeswitch/trunk/src/include/switch.h Wed Jun 20 05:02:30 2007
@@ -99,7 +99,6 @@
#include <switch_resample.h>
#include <switch_ivr.h>
#include <switch_rtp.h>
-#include <switch_stun.h>
#include <switch_log.h>
#include <switch_xml.h>
#include <switch_core_event_hook.h>
Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Wed Jun 20 05:02:30 2007
@@ -30,6 +30,7 @@
*
*/
#include <switch.h>
+#include <switch_stun.h>
#include <libdingaling.h>
#ifdef SWITCH_HAVE_ODBC
#include <switch_odbc.h>
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 20 05:02:30 2007
@@ -33,6 +33,7 @@
*
*/
#include "mod_sofia.h"
+#include <switch_stun.h>
switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt);
switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force);
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Wed Jun 20 05:02:30 2007
@@ -32,6 +32,7 @@
*/
#include <switch.h>
+#include <switch_stun.h>
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
Modified: freeswitch/trunk/src/switch_stun.c
==============================================================================
--- freeswitch/trunk/src/switch_stun.c (original)
+++ freeswitch/trunk/src/switch_stun.c Wed Jun 20 05:02:30 2007
@@ -31,6 +31,7 @@
*
*/
#include <switch.h>
+#include <switch_stun.h>
struct value_mapping {
const uint32_t value;
1
0
[commit] r5410 - in freeswitch/trunk/src: . include mod/languages/mod_python
by Freeswitch SVN 20 Jun '07
by Freeswitch SVN 20 Jun '07
20 Jun '07
Author: mikej
Date: Wed Jun 20 04:56:34 2007
New Revision: 5410
Modified:
freeswitch/trunk/src/include/switch_cpp.h
freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp
freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h
freeswitch/trunk/src/mod/languages/mod_python/mod_python.i
freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
freeswitch/trunk/src/switch_cpp.cpp
Log:
merge r5393 from http://svn.freeswitch.org/svn/freeswitch/branches/greenlizard/
* implement originate() and bridge() methods in CoreSession.
* api changes for originate() : no longer passes 11 arguments
Modified: freeswitch/trunk/src/include/switch_cpp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_cpp.h (original)
+++ freeswitch/trunk/src/include/switch_cpp.h Wed Jun 20 04:56:34 2007
@@ -16,6 +16,16 @@
void console_clean_log(char *msg);
char *api_execute(char *cmd, char *arg);
void api_reply_delete(char *reply);
+
+
+/**
+ * \brief - process language specific callback results
+ *
+ * First the actual callback is called, (in the case of python,
+ * PythonDTMFCallback), it then calls the language specific callback defined
+ * by the user (eg, some python method), and then _this_ function is called
+ * with the results of the language specific callback.
+ */
switch_status_t process_callback_result(char *raw_result,
struct input_callback_state *cb_state,
switch_core_session_t *session);
@@ -28,30 +38,55 @@
// eg, PyThreadState *threadState
void *extra; // currently used to store a switch_file_handle_t
char *funcargs; // extra string that will be passed to callback function
-} input_callback_state;
+} input_callback_state_t;
class CoreSession {
protected:
- switch_input_args_t args;
- switch_input_args_t *ap;
+ switch_input_args_t args; // holds ptr to cb function and input_callback_state struct
+ // which has a language specific callback function
+ switch_input_args_t *ap; // ptr to args .. (is this really needed?)
+ switch_caller_profile_t caller_profile; // avoid passing so many args to originate,
+ // instead set them here first
char *uuid;
char *tts_name;
char *voice_name;
void store_file_handle(switch_file_handle_t *fh);
public:
+ CoreSession();
CoreSession(char *uuid);
CoreSession(switch_core_session_t *new_session);
virtual ~CoreSession();
switch_core_session_t *session;
switch_channel_t *channel;
- input_callback_state cb_state;
+ input_callback_state cb_state; // callback state, always pointed to by the buf
+ // field in this->args
+
int answer();
int preAnswer();
void hangup(char *cause);
void setVariable(char *var, char *val);
char *getVariable(char *var);
+ /** \brief Set attributes of caller data for purposes of outgoing calls
+ * \param var - the variable name, eg, "caller_id_name"
+ * \param val - the data to set, eg, "bob"
+ */
+ void setCallerData(char *var, char *val);
+
+ /** \brief Originate a call to a destination
+ *
+ * \param old_session - the session where the call is originating from
+ * and also the session in which _this_ session was
+ * created
+ * \param dest - a string representing destination, eg, sofia/mydomain.com/foo@bar.com
+ * \return an int status code indicating success or failure
+ *
+ */
+ int originate(CoreSession *aleg_session,
+ char *dest,
+ int timeout=60);
+
/** \brief Play a file that resides on disk into the channel
*
* \param file - the path to the .wav/.mp3 to be played
@@ -125,10 +160,35 @@
virtual void begin_allow_threads();
virtual void end_allow_threads();
+ /** \brief Get the uuid of this session
+ * \return the uuid of this session
+ */
+ char* get_uuid() const { return uuid; };
+
+ /** \brief Get the callback function arguments associated with this session
+ * \return a const reference to the callback function arguments
+ */
+ const switch_input_args_t& get_cb_args() const { return args; };
+
};
+/* ---- functions not bound to CoreSession instance ----- */
+
+void console_log(char *level_str, char *msg);
+void console_clean_log(char *msg);
+char *api_execute(char *cmd, char *arg);
+void api_reply_delete(char *reply);
+
+/** \brief bridge the audio of session_b into session_a
+ *
+ * NOTE: the stuff regarding the dtmf callback might be completely
+ * wrong and has not been reviewed or tested
+ */
+void bridge(CoreSession &session_a, CoreSession &session_b);
+
+
#ifdef __cplusplus
}
#endif
Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py Wed Jun 20 04:56:34 2007
@@ -53,32 +53,32 @@
api_execute = _freeswitch.api_execute
api_reply_delete = _freeswitch.api_reply_delete
process_callback_result = _freeswitch.process_callback_result
-class input_callback_state(_object):
+class input_callback_state_t(_object):
__swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, input_callback_state, name, value)
+ __setattr__ = lambda self, name, value: _swig_setattr(self, input_callback_state_t, name, value)
__swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, input_callback_state, name)
+ __getattr__ = lambda self, name: _swig_getattr(self, input_callback_state_t, name)
__repr__ = _swig_repr
- __swig_setmethods__["function"] = _freeswitch.input_callback_state_function_set
- __swig_getmethods__["function"] = _freeswitch.input_callback_state_function_get
- if _newclass:function = _swig_property(_freeswitch.input_callback_state_function_get, _freeswitch.input_callback_state_function_set)
- __swig_setmethods__["threadState"] = _freeswitch.input_callback_state_threadState_set
- __swig_getmethods__["threadState"] = _freeswitch.input_callback_state_threadState_get
- if _newclass:threadState = _swig_property(_freeswitch.input_callback_state_threadState_get, _freeswitch.input_callback_state_threadState_set)
- __swig_setmethods__["extra"] = _freeswitch.input_callback_state_extra_set
- __swig_getmethods__["extra"] = _freeswitch.input_callback_state_extra_get
- if _newclass:extra = _swig_property(_freeswitch.input_callback_state_extra_get, _freeswitch.input_callback_state_extra_set)
- __swig_setmethods__["funcargs"] = _freeswitch.input_callback_state_funcargs_set
- __swig_getmethods__["funcargs"] = _freeswitch.input_callback_state_funcargs_get
- if _newclass:funcargs = _swig_property(_freeswitch.input_callback_state_funcargs_get, _freeswitch.input_callback_state_funcargs_set)
+ __swig_setmethods__["function"] = _freeswitch.input_callback_state_t_function_set
+ __swig_getmethods__["function"] = _freeswitch.input_callback_state_t_function_get
+ if _newclass:function = _swig_property(_freeswitch.input_callback_state_t_function_get, _freeswitch.input_callback_state_t_function_set)
+ __swig_setmethods__["threadState"] = _freeswitch.input_callback_state_t_threadState_set
+ __swig_getmethods__["threadState"] = _freeswitch.input_callback_state_t_threadState_get
+ if _newclass:threadState = _swig_property(_freeswitch.input_callback_state_t_threadState_get, _freeswitch.input_callback_state_t_threadState_set)
+ __swig_setmethods__["extra"] = _freeswitch.input_callback_state_t_extra_set
+ __swig_getmethods__["extra"] = _freeswitch.input_callback_state_t_extra_get
+ if _newclass:extra = _swig_property(_freeswitch.input_callback_state_t_extra_get, _freeswitch.input_callback_state_t_extra_set)
+ __swig_setmethods__["funcargs"] = _freeswitch.input_callback_state_t_funcargs_set
+ __swig_getmethods__["funcargs"] = _freeswitch.input_callback_state_t_funcargs_get
+ if _newclass:funcargs = _swig_property(_freeswitch.input_callback_state_t_funcargs_get, _freeswitch.input_callback_state_t_funcargs_set)
def __init__(self, *args):
- this = _freeswitch.new_input_callback_state(*args)
+ this = _freeswitch.new_input_callback_state_t(*args)
try: self.this.append(this)
except: self.this = this
- __swig_destroy__ = _freeswitch.delete_input_callback_state
+ __swig_destroy__ = _freeswitch.delete_input_callback_state_t
__del__ = lambda self : None;
-input_callback_state_swigregister = _freeswitch.input_callback_state_swigregister
-input_callback_state_swigregister(input_callback_state)
+input_callback_state_t_swigregister = _freeswitch.input_callback_state_t_swigregister
+input_callback_state_t_swigregister(input_callback_state_t)
class CoreSession(_object):
__swig_setmethods__ = {}
@@ -106,6 +106,8 @@
def hangup(*args): return _freeswitch.CoreSession_hangup(*args)
def setVariable(*args): return _freeswitch.CoreSession_setVariable(*args)
def getVariable(*args): return _freeswitch.CoreSession_getVariable(*args)
+ def setCallerData(*args): return _freeswitch.CoreSession_setCallerData(*args)
+ def originate(*args): return _freeswitch.CoreSession_originate(*args)
def playFile(*args): return _freeswitch.CoreSession_playFile(*args)
def setDTMFCallback(*args): return _freeswitch.CoreSession_setDTMFCallback(*args)
def speak(*args): return _freeswitch.CoreSession_speak(*args)
@@ -118,9 +120,12 @@
def execute(*args): return _freeswitch.CoreSession_execute(*args)
def begin_allow_threads(*args): return _freeswitch.CoreSession_begin_allow_threads(*args)
def end_allow_threads(*args): return _freeswitch.CoreSession_end_allow_threads(*args)
+ def get_uuid(*args): return _freeswitch.CoreSession_get_uuid(*args)
+ def get_cb_args(*args): return _freeswitch.CoreSession_get_cb_args(*args)
CoreSession_swigregister = _freeswitch.CoreSession_swigregister
CoreSession_swigregister(CoreSession)
+bridge = _freeswitch.bridge
PythonDTMFCallback = _freeswitch.PythonDTMFCallback
class PySession(CoreSession):
__swig_setmethods__ = {}
Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp Wed Jun 20 04:56:34 2007
@@ -1,6 +1,22 @@
#include "freeswitch_python.h"
#define sanity_check(x) do { if (!session) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
+#define init_vars() do { caller_profile.source = "mod_python"; } while(0)
+
+PySession::PySession() : CoreSession()
+{
+ init_vars();
+}
+
+PySession::PySession(char *uuid) : CoreSession(uuid)
+{
+ init_vars();
+}
+
+PySession::PySession(switch_core_session_t *new_session) : CoreSession(new_session)
+{
+ init_vars();
+}
void PySession::setDTMFCallback(PyObject *pyfunc, char *funcargs)
@@ -34,15 +50,16 @@
void PySession::begin_allow_threads(void) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::begin_allow_threads() called\n");
+ // swap out threadstate and store in instance variable
threadState = (void *) PyEval_SaveThread();
cb_state.threadState = threadState;
- // cb_state.extra = &fh;
args.buf = &cb_state;
ap = &args;
}
void PySession::end_allow_threads(void) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::end_allow_threads() called\n");
+ // swap in threadstate from instance variable saved earlier
PyEval_RestoreThread(((PyThreadState *)threadState));
}
@@ -52,4 +69,88 @@
}
+/* ----- functions not bound to PySession instance ------ */
+
+
+switch_status_t PythonDTMFCallback(switch_core_session_t *session,
+ void *input,
+ switch_input_type_t itype,
+ void *buf,
+ unsigned int buflen)
+{
+ PyObject *func, *arglist;
+ PyObject *result;
+ char *resultStr;
+ char *funcargs;
+ input_callback_state_t *cb_state;
+ switch_file_handle_t *fh = NULL;
+ PyThreadState *threadState = NULL;
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PythonDTMFCallback\n");
+
+ if (!buf) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buf pointer is null");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ cb_state = (input_callback_state *) buf;
+
+ func = (PyObject *) cb_state->function;
+ if (!func) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cb_state->function is null\n");
+ return SWITCH_STATUS_FALSE;
+ }
+ else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cb_state->function is NOT null\n");
+ }
+ if (!PyCallable_Check(func)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ funcargs = (char *) cb_state->funcargs;
+
+ arglist = Py_BuildValue("(sis)", input, itype, funcargs);
+ if (!arglist) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error building arglist");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ threadState = (PyThreadState *) cb_state->threadState;
+ if (!threadState) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error, invalid threadstate\n");
+ return SWITCH_STATUS_FALSE;
+ }
+ else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "restoring threadstate: %p\n", threadState);
+ }
+
+ PyEval_RestoreThread(threadState); // nasty stuff happens when py interp has no thread state
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "restored threadstate, calling python function: %p\n", func);
+
+ result = PyEval_CallObject(func, arglist);
+
+ threadState = PyEval_SaveThread();
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "called python function\n");
+
+ Py_DECREF(arglist); // Trash arglist
+ if (result && result != Py_None) {
+ resultStr = (char *) PyString_AsString(result);
+ Py_XDECREF(result);
+ return process_callback_result(resultStr, cb_state, session);
+ }
+ else {
+ return SWITCH_STATUS_FALSE;
+ }
+
+
+}
+
+
+
+
+
+
Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h Wed Jun 20 04:56:34 2007
@@ -14,12 +14,12 @@
-// declaration for function that is defined in mod_python.i
-extern switch_status_t PythonDTMFCallback(switch_core_session *session,
- void *input,
- switch_input_type_t itype,
- void *buf,
- unsigned int buflen);
+switch_status_t PythonDTMFCallback(switch_core_session *session,
+ void *input,
+ switch_input_type_t itype,
+ void *buf,
+ unsigned int buflen);
+
void console_log(char *level_str, char *msg);
void console_clean_log(char *msg);
@@ -30,8 +30,9 @@
private:
void *threadState;
public:
- PySession(char *uuid) : CoreSession(uuid) {}
- PySession(switch_core_session_t *session) : CoreSession(session) {}
+ PySession();
+ PySession(char *uuid);
+ PySession(switch_core_session_t *session);
~PySession();
void setDTMFCallback(PyObject *pyfunc, char *funcargs);
void begin_allow_threads();
@@ -39,6 +40,7 @@
};
+
#ifdef __cplusplus
}
#endif
Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python.i
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python.i (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python.i Wed Jun 20 04:56:34 2007
@@ -1,218 +1,21 @@
%module freeswitch
%include "cstring.i"
-%cstring_bounded_mutable(char *dtmf_buf, 128);
-%cstring_bounded_mutable(char *terminator, 8);
-
+/** insert the following includes into generated code so it compiles */
%{
#include "switch_cpp.h"
#include "freeswitch_python.h"
%}
+/**
+ * tell swig to grok everything defined in these header files and
+ * build all sorts of c wrappers and python shadows of the c wrappers.
+ */
%include switch_cpp.h
%include freeswitch_python.h
-%{
-
-
-
-switch_status_t PythonDTMFCallback(switch_core_session_t *session,
- void *input,
- switch_input_type_t itype,
- void *buf,
- unsigned int buflen)
-{
- PyObject *func, *arglist;
- PyObject *result;
- char *resultStr;
- char *funcargs;
- struct input_callback_state *cb_state;
- switch_file_handle_t *fh = NULL;
- PyThreadState *threadState = NULL;
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "PythonDTMFCallback\n");
-
- if (!buf) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buf pointer is null");
- return SWITCH_STATUS_FALSE;
- }
-
- cb_state = (input_callback_state *) buf;
-
- func = (PyObject *) cb_state->function;
- if (!func) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cb_state->function is null\n");
- return SWITCH_STATUS_FALSE;
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "cb_state->function is NOT null\n");
- }
- if (!PyCallable_Check(func)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
- return SWITCH_STATUS_FALSE;
- }
-
- funcargs = (char *) cb_state->funcargs;
-
- arglist = Py_BuildValue("(sis)", input, itype, funcargs);
- if (!arglist) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error building arglist");
- return SWITCH_STATUS_FALSE;
- }
-
- threadState = (PyThreadState *) cb_state->threadState;
- if (!threadState) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error, invalid threadstate\n");
- return SWITCH_STATUS_FALSE;
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "restoring threadstate: %p\n", threadState);
- }
-
- PyEval_RestoreThread(threadState); // nasty stuff happens when py interp has no thread state
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "restored threadstate, calling python function: %p\n", func);
-
- result = PyEval_CallObject(func, arglist);
-
- threadState = PyEval_SaveThread();
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "called python function\n");
-
- Py_DECREF(arglist); // Trash arglist
- if (result && result != Py_None) {
- resultStr = (char *) PyString_AsString(result);
- Py_XDECREF(result);
- return process_callback_result(resultStr, cb_state, session);
- }
- else {
- return SWITCH_STATUS_FALSE;
- }
-
-
-}
-
-
-switch_status_t process_callback_result(char *ret,
- struct input_callback_state *cb_state,
- switch_core_session_t *session)
-{
-
- switch_file_handle_t *fh = NULL;
- fh = (switch_file_handle_t *) cb_state->extra;
-
- if (!fh) {
- return SWITCH_STATUS_FALSE;
- }
-
- if (!ret) {
- return SWITCH_STATUS_FALSE;
- }
-
- if (!strncasecmp(ret, "speed", 4)) {
- char *p;
-
- if ((p = strchr(ret, ':'))) {
- p++;
- if (*p == '+' || *p == '-') {
- int step;
- if (!(step = atoi(p))) {
- step = 1;
- }
- fh->speed += step;
- } else {
- int speed = atoi(p);
- fh->speed = speed;
- }
- return SWITCH_STATUS_SUCCESS;
- }
-
- return SWITCH_STATUS_FALSE;
-
- } else if (!strcasecmp(ret, "pause")) {
- if (switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
- switch_clear_flag(fh, SWITCH_FILE_PAUSE);
- } else {
- switch_set_flag(fh, SWITCH_FILE_PAUSE);
- }
- return SWITCH_STATUS_SUCCESS;
- } else if (!strcasecmp(ret, "stop")) {
- return SWITCH_STATUS_FALSE;
- } else if (!strcasecmp(ret, "restart")) {
- unsigned int pos = 0;
- fh->speed = 0;
- switch_core_file_seek(fh, &pos, 0, SEEK_SET);
- return SWITCH_STATUS_SUCCESS;
- } else if (!strncasecmp(ret, "seek", 4)) {
- switch_codec_t *codec;
- unsigned int samps = 0;
- unsigned int pos = 0;
- char *p;
- codec = switch_core_session_get_read_codec(session);
-
- if ((p = strchr(ret, ':'))) {
- p++;
- if (*p == '+' || *p == '-') {
- int step;
- if (!(step = atoi(p))) {
- step = 1000;
- }
- if (step > 0) {
- samps = step * (codec->implementation->samples_per_second / 1000);
- switch_core_file_seek(fh, &pos, samps, SEEK_CUR);
- } else {
- samps = step * (codec->implementation->samples_per_second / 1000);
- switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET);
- }
- } else {
- samps = atoi(p) * (codec->implementation->samples_per_second / 1000);
- switch_core_file_seek(fh, &pos, samps, SEEK_SET);
- }
- }
-
- return SWITCH_STATUS_SUCCESS;
- }
-
- if (!strcmp(ret, "true") || !strcmp(ret, "undefined")) {
- return SWITCH_STATUS_SUCCESS;
- }
-
- return SWITCH_STATUS_FALSE;
-
-
-}
-
-
-void console_log(char *level_str, char *msg)
-{
- switch_log_level_t level = SWITCH_LOG_DEBUG;
- if (level_str) {
- level = switch_log_str2level(level_str);
- }
- switch_log_printf(SWITCH_CHANNEL_LOG, level, msg);
-}
-
-void console_clean_log(char *msg)
-{
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN,SWITCH_LOG_DEBUG, msg);
-}
-
-
- char *api_execute(char *cmd, char *arg)
- {
- switch_stream_handle_t stream = { 0 };
- SWITCH_STANDARD_STREAM(stream);
- switch_api_execute(cmd, arg, NULL, &stream);
- return (char *) stream.data;
- }
-
- void api_reply_delete(char *reply)
- {
- if (!switch_strlen_zero(reply)) {
- free(reply);
- }
- }
-
+/** hmm .. dunno why this is here */
+%cstring_bounded_mutable(char *dtmf_buf, 128);
+%cstring_bounded_mutable(char *terminator, 8);
-%}
Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp Wed Jun 20 04:56:34 2007
@@ -2472,13 +2472,14 @@
#define SWIGTYPE_p_switch_channel_t swig_types[4]
#define SWIGTYPE_p_switch_core_session swig_types[5]
#define SWIGTYPE_p_switch_core_session_t swig_types[6]
-#define SWIGTYPE_p_switch_input_callback_function_t swig_types[7]
-#define SWIGTYPE_p_switch_input_type_t swig_types[8]
-#define SWIGTYPE_p_switch_status_t swig_types[9]
-#define SWIGTYPE_p_uint32_t swig_types[10]
-#define SWIGTYPE_p_void swig_types[11]
-static swig_type_info *swig_types[13];
-static swig_module_info swig_module = {swig_types, 12, 0, 0, 0, 0};
+#define SWIGTYPE_p_switch_input_args_t swig_types[7]
+#define SWIGTYPE_p_switch_input_callback_function_t swig_types[8]
+#define SWIGTYPE_p_switch_input_type_t swig_types[9]
+#define SWIGTYPE_p_switch_status_t swig_types[10]
+#define SWIGTYPE_p_uint32_t swig_types[11]
+#define SWIGTYPE_p_void swig_types[12]
+static swig_type_info *swig_types[14];
+static swig_module_info swig_module = {swig_types, 13, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -2887,209 +2888,6 @@
return res;
}
-
-
-
-
-switch_status_t PythonDTMFCallback(switch_core_session_t *session,
- void *input,
- switch_input_type_t itype,
- void *buf,
- unsigned int buflen)
-{
- PyObject *func, *arglist;
- PyObject *result;
- char *resultStr;
- char *funcargs;
- struct input_callback_state *cb_state;
- switch_file_handle_t *fh = NULL;
- PyThreadState *threadState = NULL;
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "PythonDTMFCallback\n");
-
- if (!buf) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buf pointer is null");
- return SWITCH_STATUS_FALSE;
- }
-
- cb_state = (input_callback_state *) buf;
-
- func = (PyObject *) cb_state->function;
- if (!func) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cb_state->function is null\n");
- return SWITCH_STATUS_FALSE;
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "cb_state->function is NOT null\n");
- }
- if (!PyCallable_Check(func)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
- return SWITCH_STATUS_FALSE;
- }
-
- funcargs = (char *) cb_state->funcargs;
-
- arglist = Py_BuildValue("(sis)", input, itype, funcargs);
- if (!arglist) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error building arglist");
- return SWITCH_STATUS_FALSE;
- }
-
- threadState = (PyThreadState *) cb_state->threadState;
- if (!threadState) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error, invalid threadstate\n");
- return SWITCH_STATUS_FALSE;
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "restoring threadstate: %p\n", threadState);
- }
-
- PyEval_RestoreThread(threadState); // nasty stuff happens when py interp has no thread state
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "restored threadstate, calling python function: %p\n", func);
-
- result = PyEval_CallObject(func, arglist);
-
- threadState = PyEval_SaveThread();
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "called python function\n");
-
- Py_DECREF(arglist); // Trash arglist
- if (result && result != Py_None) {
- resultStr = (char *) PyString_AsString(result);
- Py_XDECREF(result);
- return process_callback_result(resultStr, cb_state, session);
- }
- else {
- return SWITCH_STATUS_FALSE;
- }
-
-
-}
-
-
-switch_status_t process_callback_result(char *ret,
- struct input_callback_state *cb_state,
- switch_core_session_t *session)
-{
-
- switch_file_handle_t *fh = NULL;
- fh = (switch_file_handle_t *) cb_state->extra;
-
- if (!fh) {
- return SWITCH_STATUS_FALSE;
- }
-
- if (!ret) {
- return SWITCH_STATUS_FALSE;
- }
-
- if (!strncasecmp(ret, "speed", 4)) {
- char *p;
-
- if ((p = strchr(ret, ':'))) {
- p++;
- if (*p == '+' || *p == '-') {
- int step;
- if (!(step = atoi(p))) {
- step = 1;
- }
- fh->speed += step;
- } else {
- int speed = atoi(p);
- fh->speed = speed;
- }
- return SWITCH_STATUS_SUCCESS;
- }
-
- return SWITCH_STATUS_FALSE;
-
- } else if (!strcasecmp(ret, "pause")) {
- if (switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
- switch_clear_flag(fh, SWITCH_FILE_PAUSE);
- } else {
- switch_set_flag(fh, SWITCH_FILE_PAUSE);
- }
- return SWITCH_STATUS_SUCCESS;
- } else if (!strcasecmp(ret, "stop")) {
- return SWITCH_STATUS_FALSE;
- } else if (!strcasecmp(ret, "restart")) {
- unsigned int pos = 0;
- fh->speed = 0;
- switch_core_file_seek(fh, &pos, 0, SEEK_SET);
- return SWITCH_STATUS_SUCCESS;
- } else if (!strncasecmp(ret, "seek", 4)) {
- switch_codec_t *codec;
- unsigned int samps = 0;
- unsigned int pos = 0;
- char *p;
- codec = switch_core_session_get_read_codec(session);
-
- if ((p = strchr(ret, ':'))) {
- p++;
- if (*p == '+' || *p == '-') {
- int step;
- if (!(step = atoi(p))) {
- step = 1000;
- }
- if (step > 0) {
- samps = step * (codec->implementation->samples_per_second / 1000);
- switch_core_file_seek(fh, &pos, samps, SEEK_CUR);
- } else {
- samps = step * (codec->implementation->samples_per_second / 1000);
- switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET);
- }
- } else {
- samps = atoi(p) * (codec->implementation->samples_per_second / 1000);
- switch_core_file_seek(fh, &pos, samps, SEEK_SET);
- }
- }
-
- return SWITCH_STATUS_SUCCESS;
- }
-
- if (!strcmp(ret, "true") || !strcmp(ret, "undefined")) {
- return SWITCH_STATUS_SUCCESS;
- }
-
- return SWITCH_STATUS_FALSE;
-
-
-}
-
-
-void console_log(char *level_str, char *msg)
-{
- switch_log_level_t level = SWITCH_LOG_DEBUG;
- if (level_str) {
- level = switch_log_str2level(level_str);
- }
- switch_log_printf(SWITCH_CHANNEL_LOG, level, msg);
-}
-
-void console_clean_log(char *msg)
-{
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN,SWITCH_LOG_DEBUG, msg);
-}
-
-
- char *api_execute(char *cmd, char *arg)
- {
- switch_stream_handle_t stream = { 0 };
- SWITCH_STANDARD_STREAM(stream);
- switch_api_execute(cmd, arg, NULL, &stream);
- return (char *) stream.data;
- }
-
- void api_reply_delete(char *reply)
- {
- if (!switch_strlen_zero(reply)) {
- free(reply);
- }
- }
-
-
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -3257,9 +3055,9 @@
}
-SWIGINTERN PyObject *_wrap_input_callback_state_function_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_t_function_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
void *arg2 = (void *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
@@ -3267,15 +3065,15 @@
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_function_set",&obj0,&obj1)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_function_set",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_function_set" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_set" "', argument " "1"" of type '" "input_callback_state_t *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_function_set" "', argument " "2"" of type '" "void *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2"" of type '" "void *""'");
}
if (arg1) (arg1)->function = arg2;
@@ -3286,20 +3084,20 @@
}
-SWIGINTERN PyObject *_wrap_input_callback_state_function_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_t_function_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
void *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_function_get",&obj0)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_function_get",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_function_get" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_get" "', argument " "1"" of type '" "input_callback_state_t *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
result = (void *) ((arg1)->function);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
return resultobj;
@@ -3308,9 +3106,9 @@
}
-SWIGINTERN PyObject *_wrap_input_callback_state_threadState_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
void *arg2 = (void *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
@@ -3318,15 +3116,15 @@
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_threadState_set",&obj0,&obj1)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_threadState_set",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_threadState_set" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_set" "', argument " "1"" of type '" "input_callback_state_t *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_threadState_set" "', argument " "2"" of type '" "void *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_threadState_set" "', argument " "2"" of type '" "void *""'");
}
if (arg1) (arg1)->threadState = arg2;
@@ -3337,20 +3135,20 @@
}
-SWIGINTERN PyObject *_wrap_input_callback_state_threadState_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
void *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_threadState_get",&obj0)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_threadState_get",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_threadState_get" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_get" "', argument " "1"" of type '" "input_callback_state_t *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
result = (void *) ((arg1)->threadState);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
return resultobj;
@@ -3359,9 +3157,9 @@
}
-SWIGINTERN PyObject *_wrap_input_callback_state_extra_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
void *arg2 = (void *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
@@ -3369,15 +3167,15 @@
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_extra_set",&obj0,&obj1)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_extra_set",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_extra_set" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_set" "', argument " "1"" of type '" "input_callback_state_t *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_extra_set" "', argument " "2"" of type '" "void *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2"" of type '" "void *""'");
}
if (arg1) (arg1)->extra = arg2;
@@ -3388,20 +3186,20 @@
}
-SWIGINTERN PyObject *_wrap_input_callback_state_extra_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
void *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_extra_get",&obj0)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_extra_get",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_extra_get" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_get" "', argument " "1"" of type '" "input_callback_state_t *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
result = (void *) ((arg1)->extra);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
return resultobj;
@@ -3410,9 +3208,9 @@
}
-SWIGINTERN PyObject *_wrap_input_callback_state_funcargs_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
char *arg2 = (char *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
@@ -3422,15 +3220,15 @@
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_funcargs_set",&obj0,&obj1)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_funcargs_set",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_funcargs_set" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_set" "', argument " "1"" of type '" "input_callback_state_t *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_funcargs_set" "', argument " "2"" of type '" "char *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2"" of type '" "char *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
if (arg1->funcargs) delete[] arg1->funcargs;
@@ -3449,20 +3247,20 @@
}
-SWIGINTERN PyObject *_wrap_input_callback_state_funcargs_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_funcargs_get",&obj0)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_funcargs_get",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_funcargs_get" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_get" "', argument " "1"" of type '" "input_callback_state_t *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
result = (char *) ((arg1)->funcargs);
resultobj = SWIG_FromCharPtr((const char *)result);
return resultobj;
@@ -3471,12 +3269,12 @@
}
-SWIGINTERN PyObject *_wrap_new_input_callback_state(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_input_callback_state_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *result = 0 ;
+ input_callback_state_t *result = 0 ;
- if (!PyArg_ParseTuple(args,(char *)":new_input_callback_state")) SWIG_fail;
- result = (input_callback_state *)new input_callback_state();
+ if (!PyArg_ParseTuple(args,(char *)":new_input_callback_state_t")) SWIG_fail;
+ result = (input_callback_state_t *)new input_callback_state_t();
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_POINTER_NEW | 0 );
return resultobj;
fail:
@@ -3484,19 +3282,19 @@
}
-SWIGINTERN PyObject *_wrap_delete_input_callback_state(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_delete_input_callback_state_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:delete_input_callback_state",&obj0)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"O:delete_input_callback_state_t",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_input_callback_state" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_input_callback_state_t" "', argument " "1"" of type '" "input_callback_state_t *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
delete arg1;
resultobj = SWIG_Py_Void();
@@ -3506,7 +3304,7 @@
}
-SWIGINTERN PyObject *input_callback_state_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *input_callback_state_t_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_input_callback_state, SWIG_NewClientData(obj));
@@ -3515,6 +3313,19 @@
SWIGINTERN PyObject *_wrap_new_CoreSession__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
+ CoreSession *result = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)":new_CoreSession")) SWIG_fail;
+ result = (CoreSession *)new CoreSession();
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CoreSession, SWIG_POINTER_NEW | 0 );
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_CoreSession__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
char *arg1 = (char *) 0 ;
CoreSession *result = 0 ;
int res1 ;
@@ -3538,7 +3349,7 @@
}
-SWIGINTERN PyObject *_wrap_new_CoreSession__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_CoreSession__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
CoreSession *result = 0 ;
@@ -3570,13 +3381,16 @@
for (ii = 0; (ii < argc) && (ii < 1); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
+ if (argc == 0) {
+ return _wrap_new_CoreSession__SWIG_0(self, args);
+ }
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_core_session_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
- return _wrap_new_CoreSession__SWIG_1(self, args);
+ return _wrap_new_CoreSession__SWIG_2(self, args);
}
}
if (argc == 1) {
@@ -3584,12 +3398,12 @@
int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
- return _wrap_new_CoreSession__SWIG_0(self, args);
+ return _wrap_new_CoreSession__SWIG_1(self, args);
}
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_CoreSession'.\n Possible C/C++ prototypes are:\n CoreSession(char *)\n CoreSession(switch_core_session_t *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_CoreSession'.\n Possible C/C++ prototypes are:\n CoreSession()\n CoreSession(char *)\n CoreSession(switch_core_session_t *)\n");
return NULL;
}
@@ -3931,6 +3745,105 @@
}
+SWIGINTERN PyObject *_wrap_CoreSession_setCallerData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setCallerData",&obj0,&obj1,&obj2)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3"" of type '" "char *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ (arg1)->setCallerData(arg2,arg3);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return resultobj;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_originate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ CoreSession *arg2 = (CoreSession *) 0 ;
+ char *arg3 = (char *) 0 ;
+ int arg4 = (int) 60 ;
+ int result;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int val4 ;
+ int ecode4 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+ PyObject * obj3 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OOO|O:CoreSession_originate",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'");
+ }
+ arg2 = reinterpret_cast< CoreSession * >(argp2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ if (obj3) {
+ ecode4 = SWIG_AsVal_int(obj3, &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4"" of type '" "int""'");
+ }
+ arg4 = static_cast< int >(val4);
+ }
+ result = (int)(arg1)->originate(arg2,arg3,arg4);
+ resultobj = SWIG_From_int(static_cast< int >(result));
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return resultobj;
+fail:
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_CoreSession_playFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -4130,9 +4043,7 @@
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
- char temp2[128+1] ;
- char *t2 = 0 ;
- size_t n2 = 0 ;
+ char *buf2 = 0 ;
int alloc2 = 0 ;
int val3 ;
int ecode3 = 0 ;
@@ -4140,9 +4051,7 @@
char *buf4 = 0 ;
int alloc4 = 0 ;
int res5 ;
- char temp5[8+1] ;
- char *t5 = 0 ;
- size_t n5 = 0 ;
+ char *buf5 = 0 ;
int alloc5 = 0 ;
int val6 ;
int ecode6 = 0 ;
@@ -4159,15 +4068,11 @@
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &t2, &n2, &alloc2);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "char *dtmf_buf""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "char *""'");
}
- if ( n2 > (size_t) 128 ) n2 = (size_t) 128;
- memcpy(temp2, t2, sizeof(char)*n2);
- if (alloc2 == SWIG_NEWOBJ) delete[] t2;
- temp2[n2 - 1] = 0;
- arg2 = (char *) temp2;
+ arg2 = reinterpret_cast< char * >(buf2);
ecode3 = SWIG_AsVal_int(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "int""'");
@@ -4178,15 +4083,11 @@
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "char *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
- res5 = SWIG_AsCharPtrAndSize(obj4, &t5, &n5, &alloc5);
+ res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
if (!SWIG_IsOK(res5)) {
- SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_getDigits" "', argument " "5"" of type '" "char *terminator""'");
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_getDigits" "', argument " "5"" of type '" "char *""'");
}
- if ( n5 > (size_t) 8 ) n5 = (size_t) 8;
- memcpy(temp5, t5, sizeof(char)*n5);
- if (alloc5 == SWIG_NEWOBJ) delete[] t5;
- temp5[n5 - 1] = 0;
- arg5 = (char *) temp5;
+ arg5 = reinterpret_cast< char * >(buf5);
ecode6 = SWIG_AsVal_int(obj5, &val6);
if (!SWIG_IsOK(ecode6)) {
SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "CoreSession_getDigits" "', argument " "6"" of type '" "int""'");
@@ -4194,14 +4095,14 @@
arg6 = static_cast< int >(val6);
result = (int)(arg1)->getDigits(arg2,arg3,arg4,arg5,arg6);
resultobj = SWIG_From_int(static_cast< int >(result));
- arg2[128] = 0;
- resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2));
- arg5[8] = 0;
- resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg5));
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
return resultobj;
fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
return NULL;
}
@@ -4297,9 +4198,7 @@
char *buf8 = 0 ;
int alloc8 = 0 ;
int res9 ;
- char temp9[128+1] ;
- char *t9 = 0 ;
- size_t n9 = 0 ;
+ char *buf9 = 0 ;
int alloc9 = 0 ;
int res10 ;
char *buf10 = 0 ;
@@ -4356,15 +4255,11 @@
SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8"" of type '" "char *""'");
}
arg8 = reinterpret_cast< char * >(buf8);
- res9 = SWIG_AsCharPtrAndSize(obj8, &t9, &n9, &alloc9);
+ res9 = SWIG_AsCharPtrAndSize(obj8, &buf9, NULL, &alloc9);
if (!SWIG_IsOK(res9)) {
- SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9"" of type '" "char *dtmf_buf""'");
+ SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9"" of type '" "char *""'");
}
- if ( n9 > (size_t) 128 ) n9 = (size_t) 128;
- memcpy(temp9, t9, sizeof(char)*n9);
- if (alloc9 == SWIG_NEWOBJ) delete[] t9;
- temp9[n9 - 1] = 0;
- arg9 = (char *) temp9;
+ arg9 = reinterpret_cast< char * >(buf9);
res10 = SWIG_AsCharPtrAndSize(obj9, &buf10, NULL, &alloc10);
if (!SWIG_IsOK(res10)) {
SWIG_exception_fail(SWIG_ArgError(res10), "in method '" "CoreSession_playAndGetDigits" "', argument " "10"" of type '" "char *""'");
@@ -4372,17 +4267,17 @@
arg10 = reinterpret_cast< char * >(buf10);
result = (int)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);
resultobj = SWIG_From_int(static_cast< int >(result));
- arg9[128] = 0;
- resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg9));
if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+ if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
if (alloc10 == SWIG_NEWOBJ) delete[] buf10;
return resultobj;
fail:
if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+ if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
if (alloc10 == SWIG_NEWOBJ) delete[] buf10;
return NULL;
}
@@ -4540,6 +4435,53 @@
}
+SWIGINTERN PyObject *_wrap_CoreSession_get_uuid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject * obj0 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_get_uuid",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1"" of type '" "CoreSession const *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ result = (char *)((CoreSession const *)arg1)->get_uuid();
+ resultobj = SWIG_FromCharPtr((const char *)result);
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_get_cb_args(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ switch_input_args_t *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject * obj0 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_get_cb_args",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_cb_args" "', argument " "1"" of type '" "CoreSession const *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ {
+ switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args();
+ result = (switch_input_args_t *) &_result_ref;
+ }
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 | 0 );
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
SWIGINTERN PyObject *CoreSession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
@@ -4547,6 +4489,42 @@
return SWIG_Py_Void();
}
+SWIGINTERN PyObject *_wrap_bridge(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = 0 ;
+ CoreSession *arg2 = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OO:bridge",&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'");
+ }
+ if (!argp1) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'");
+ }
+ arg2 = reinterpret_cast< CoreSession * >(argp2);
+ bridge(*arg1,*arg2);
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_PythonDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
switch_core_session *arg1 = (switch_core_session *) 0 ;
@@ -4611,6 +4589,19 @@
SWIGINTERN PyObject *_wrap_new_PySession__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
+ PySession *result = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)":new_PySession")) SWIG_fail;
+ result = (PySession *)new PySession();
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0 );
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_PySession__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
char *arg1 = (char *) 0 ;
PySession *result = 0 ;
int res1 ;
@@ -4634,7 +4625,7 @@
}
-SWIGINTERN PyObject *_wrap_new_PySession__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_PySession__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
PySession *result = 0 ;
@@ -4666,13 +4657,16 @@
for (ii = 0; (ii < argc) && (ii < 1); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
+ if (argc == 0) {
+ return _wrap_new_PySession__SWIG_0(self, args);
+ }
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_core_session_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
- return _wrap_new_PySession__SWIG_1(self, args);
+ return _wrap_new_PySession__SWIG_2(self, args);
}
}
if (argc == 1) {
@@ -4680,12 +4674,12 @@
int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
- return _wrap_new_PySession__SWIG_0(self, args);
+ return _wrap_new_PySession__SWIG_1(self, args);
}
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_PySession'.\n Possible C/C++ prototypes are:\n PySession(char *)\n PySession(switch_core_session_t *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_PySession'.\n Possible C/C++ prototypes are:\n PySession()\n PySession(char *)\n PySession(switch_core_session_t *)\n");
return NULL;
}
@@ -4803,17 +4797,17 @@
{ (char *)"api_execute", _wrap_api_execute, METH_VARARGS, NULL},
{ (char *)"api_reply_delete", _wrap_api_reply_delete, METH_VARARGS, NULL},
{ (char *)"process_callback_result", _wrap_process_callback_result, METH_VARARGS, NULL},
- { (char *)"input_callback_state_function_set", _wrap_input_callback_state_function_set, METH_VARARGS, NULL},
- { (char *)"input_callback_state_function_get", _wrap_input_callback_state_function_get, METH_VARARGS, NULL},
- { (char *)"input_callback_state_threadState_set", _wrap_input_callback_state_threadState_set, METH_VARARGS, NULL},
- { (char *)"input_callback_state_threadState_get", _wrap_input_callback_state_threadState_get, METH_VARARGS, NULL},
- { (char *)"input_callback_state_extra_set", _wrap_input_callback_state_extra_set, METH_VARARGS, NULL},
- { (char *)"input_callback_state_extra_get", _wrap_input_callback_state_extra_get, METH_VARARGS, NULL},
- { (char *)"input_callback_state_funcargs_set", _wrap_input_callback_state_funcargs_set, METH_VARARGS, NULL},
- { (char *)"input_callback_state_funcargs_get", _wrap_input_callback_state_funcargs_get, METH_VARARGS, NULL},
- { (char *)"new_input_callback_state", _wrap_new_input_callback_state, METH_VARARGS, NULL},
- { (char *)"delete_input_callback_state", _wrap_delete_input_callback_state, METH_VARARGS, NULL},
- { (char *)"input_callback_state_swigregister", input_callback_state_swigregister, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get, METH_VARARGS, NULL},
+ { (char *)"new_input_callback_state_t", _wrap_new_input_callback_state_t, METH_VARARGS, NULL},
+ { (char *)"delete_input_callback_state_t", _wrap_delete_input_callback_state_t, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_t_swigregister", input_callback_state_t_swigregister, METH_VARARGS, NULL},
{ (char *)"new_CoreSession", _wrap_new_CoreSession, METH_VARARGS, NULL},
{ (char *)"delete_CoreSession", _wrap_delete_CoreSession, METH_VARARGS, NULL},
{ (char *)"CoreSession_session_set", _wrap_CoreSession_session_set, METH_VARARGS, NULL},
@@ -4827,6 +4821,8 @@
{ (char *)"CoreSession_hangup", _wrap_CoreSession_hangup, METH_VARARGS, NULL},
{ (char *)"CoreSession_setVariable", _wrap_CoreSession_setVariable, METH_VARARGS, NULL},
{ (char *)"CoreSession_getVariable", _wrap_CoreSession_getVariable, METH_VARARGS, NULL},
+ { (char *)"CoreSession_setCallerData", _wrap_CoreSession_setCallerData, METH_VARARGS, NULL},
+ { (char *)"CoreSession_originate", _wrap_CoreSession_originate, METH_VARARGS, NULL},
{ (char *)"CoreSession_playFile", _wrap_CoreSession_playFile, METH_VARARGS, NULL},
{ (char *)"CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback, METH_VARARGS, NULL},
{ (char *)"CoreSession_speak", _wrap_CoreSession_speak, METH_VARARGS, NULL},
@@ -4839,7 +4835,10 @@
{ (char *)"CoreSession_execute", _wrap_CoreSession_execute, METH_VARARGS, NULL},
{ (char *)"CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads, METH_VARARGS, NULL},
{ (char *)"CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads, METH_VARARGS, NULL},
+ { (char *)"CoreSession_get_uuid", _wrap_CoreSession_get_uuid, METH_VARARGS, NULL},
+ { (char *)"CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args, METH_VARARGS, NULL},
{ (char *)"CoreSession_swigregister", CoreSession_swigregister, METH_VARARGS, NULL},
+ { (char *)"bridge", _wrap_bridge, METH_VARARGS, NULL},
{ (char *)"PythonDTMFCallback", _wrap_PythonDTMFCallback, METH_VARARGS, NULL},
{ (char *)"new_PySession", _wrap_new_PySession, METH_VARARGS, NULL},
{ (char *)"delete_PySession", _wrap_delete_PySession, METH_VARARGS, NULL},
@@ -4863,6 +4862,7 @@
static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_core_session = {"_p_switch_core_session", "switch_core_session *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_input_callback_function_t = {"_p_switch_input_callback_function_t", "switch_input_callback_function_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
@@ -4877,6 +4877,7 @@
&_swigt__p_switch_channel_t,
&_swigt__p_switch_core_session,
&_swigt__p_switch_core_session_t,
+ &_swigt__p_switch_input_args_t,
&_swigt__p_switch_input_callback_function_t,
&_swigt__p_switch_input_type_t,
&_swigt__p_switch_status_t,
@@ -4891,6 +4892,7 @@
static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_core_session[] = { {&_swigt__p_switch_core_session, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_input_callback_function_t[] = { {&_swigt__p_switch_input_callback_function_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
@@ -4905,6 +4907,7 @@
_swigc__p_switch_channel_t,
_swigc__p_switch_core_session,
_swigc__p_switch_core_session_t,
+ _swigc__p_switch_input_args_t,
_swigc__p_switch_input_callback_function_t,
_swigc__p_switch_input_type_t,
_swigc__p_switch_status_t,
Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp (original)
+++ freeswitch/trunk/src/switch_cpp.cpp Wed Jun 20 04:56:34 2007
@@ -7,7 +7,14 @@
#define sanity_check(x) do { if (!session) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
#define sanity_check_noreturn do { if (!session) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0)
-#define init_vars() do { session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; memset(&args, 0, sizeof(args)); ap = NULL;} while(0)
+#define init_vars() do { session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown"; caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = ""; caller_profile.username = ""; } while(0)
+
+
+
+CoreSession::CoreSession()
+{
+ init_vars();
+}
CoreSession::CoreSession(char *nuuid)
{
@@ -177,7 +184,9 @@
{
switch_status_t status;
sanity_check(-1);
+ begin_allow_threads();
status = switch_ivr_session_transfer(session, extension, dialplan, context);
+ end_allow_threads();
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
}
@@ -250,6 +259,83 @@
}
+int CoreSession::originate(CoreSession *aleg_session,
+ char *dest,
+ int timeout)
+{
+
+ switch_memory_pool_t *pool = NULL;
+ switch_core_session_t *aleg_core_session = NULL;
+ switch_call_cause_t cause;
+
+ cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+
+ if (aleg_session != NULL) {
+ aleg_core_session = aleg_session->session;
+ }
+
+ begin_allow_threads();
+
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
+ goto failed;
+ }
+
+ if (switch_ivr_originate(aleg_core_session,
+ &session,
+ &cause,
+ dest,
+ timeout,
+ NULL,
+ NULL,
+ NULL,
+ &caller_profile) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error Creating Outgoing Channel! [%s]\n", dest);
+ goto failed;
+
+ }
+
+ end_allow_threads();
+ return SWITCH_STATUS_SUCCESS;
+
+ failed:
+ end_allow_threads();
+ return SWITCH_STATUS_FALSE;
+}
+
+
+void CoreSession::setCallerData(char *var, char *val) {
+
+ if (strcmp(var, "dialplan") == 0) {
+ caller_profile.dialplan = val;
+ }
+ if (strcmp(var, "context") == 0) {
+ caller_profile.context = val;
+ }
+ if (strcmp(var, "caller_id_name") == 0) {
+ caller_profile.caller_id_name = val;
+ }
+ if (strcmp(var, "caller_id_number") == 0) {
+ caller_profile.caller_id_number = val;
+ }
+ if (strcmp(var, "network_addr") == 0) {
+ caller_profile.network_addr = val;
+ }
+ if (strcmp(var, "ani") == 0) {
+ caller_profile.ani = val;
+ }
+ if (strcmp(var, "aniii") == 0) {
+ caller_profile.aniii = val;
+ }
+ if (strcmp(var, "rdnis") == 0) {
+ caller_profile.rdnis = val;
+ }
+ if (strcmp(var, "username") == 0) {
+ caller_profile.username = val;
+ }
+
+}
+
void CoreSession::begin_allow_threads() {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::begin_allow_threads() called and does nothing\n");
}
@@ -274,6 +360,147 @@
}
+/* ---- methods not bound to CoreSession instance ---- */
+
+
+void console_log(char *level_str, char *msg)
+{
+ switch_log_level_t level = SWITCH_LOG_DEBUG;
+ if (level_str) {
+ level = switch_log_str2level(level_str);
+ }
+ switch_log_printf(SWITCH_CHANNEL_LOG, level, msg);
+ fflush(stdout); // TEMP ONLY!! SHOULD NOT BE CHECKED IN!!
+}
+
+void console_clean_log(char *msg)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN,SWITCH_LOG_DEBUG, msg);
+}
+
+
+char *api_execute(char *cmd, char *arg)
+{
+ switch_stream_handle_t stream = { 0 };
+ SWITCH_STANDARD_STREAM(stream);
+ switch_api_execute(cmd, arg, NULL, &stream);
+ return (char *) stream.data;
+}
+
+void api_reply_delete(char *reply)
+{
+ if (!switch_strlen_zero(reply)) {
+ free(reply);
+ }
+}
+
+
+void bridge(CoreSession &session_a, CoreSession &session_b)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "bridge called, session_a uuid: %s\n", session_a.get_uuid());
+ switch_input_callback_function_t dtmf_func = NULL;
+ switch_input_args_t args;
+
+ session_a.begin_allow_threads();
+ args = session_a.get_cb_args(); // get the cb_args data structure for session a
+ dtmf_func = args.input_callback; // get the call back function
+ switch_ivr_multi_threaded_bridge(session_a.session, session_b.session, dtmf_func, args.buf, args.buf);
+ session_a.end_allow_threads();
+
+}
+
+
+
+switch_status_t process_callback_result(char *ret,
+ struct input_callback_state *cb_state,
+ switch_core_session_t *session)
+{
+
+ switch_file_handle_t *fh = NULL;
+ fh = (switch_file_handle_t *) cb_state->extra;
+
+ if (!fh) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (!ret) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (!strncasecmp(ret, "speed", 4)) {
+ char *p;
+
+ if ((p = strchr(ret, ':'))) {
+ p++;
+ if (*p == '+' || *p == '-') {
+ int step;
+ if (!(step = atoi(p))) {
+ step = 1;
+ }
+ fh->speed += step;
+ } else {
+ int speed = atoi(p);
+ fh->speed = speed;
+ }
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ return SWITCH_STATUS_FALSE;
+
+ } else if (!strcasecmp(ret, "pause")) {
+ if (switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
+ switch_clear_flag(fh, SWITCH_FILE_PAUSE);
+ } else {
+ switch_set_flag(fh, SWITCH_FILE_PAUSE);
+ }
+ return SWITCH_STATUS_SUCCESS;
+ } else if (!strcasecmp(ret, "stop")) {
+ return SWITCH_STATUS_FALSE;
+ } else if (!strcasecmp(ret, "restart")) {
+ unsigned int pos = 0;
+ fh->speed = 0;
+ switch_core_file_seek(fh, &pos, 0, SEEK_SET);
+ return SWITCH_STATUS_SUCCESS;
+ } else if (!strncasecmp(ret, "seek", 4)) {
+ switch_codec_t *codec;
+ unsigned int samps = 0;
+ unsigned int pos = 0;
+ char *p;
+ codec = switch_core_session_get_read_codec(session);
+
+ if ((p = strchr(ret, ':'))) {
+ p++;
+ if (*p == '+' || *p == '-') {
+ int step;
+ if (!(step = atoi(p))) {
+ step = 1000;
+ }
+ if (step > 0) {
+ samps = step * (codec->implementation->samples_per_second / 1000);
+ switch_core_file_seek(fh, &pos, samps, SEEK_CUR);
+ } else {
+ samps = step * (codec->implementation->samples_per_second / 1000);
+ switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET);
+ }
+ } else {
+ samps = atoi(p) * (codec->implementation->samples_per_second / 1000);
+ switch_core_file_seek(fh, &pos, samps, SEEK_SET);
+ }
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ if (!strcmp(ret, "true") || !strcmp(ret, "undefined")) {
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ return SWITCH_STATUS_FALSE;
+
+
+}
+
+
/* For Emacs:
* Local Variables:
* mode:c
1
0
20 Jun '07
Author: mikej
Date: Wed Jun 20 04:46:13 2007
New Revision: 5409
Modified:
freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
Log:
remove unused function
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Wed Jun 20 04:46:13 2007
@@ -158,8 +158,6 @@
static int get_dev_by_name(char *name, int in);
static int get_dev_by_number(int number, int in);
static switch_status_t pa_cmd(const char *dest, switch_core_session_t *session, switch_stream_handle_t *stream);
- static switch_status_t padep(const char *dest, switch_core_session_t *session, switch_stream_handle_t *stream);
-
/*
State methods they get called when the state changes to the specific state
1
0
20 Jun '07
Author: mikej
Date: Wed Jun 20 04:45:33 2007
New Revision: 5408
Modified:
freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
Log:
remove unused function
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Wed Jun 20 04:45:33 2007
@@ -1650,12 +1650,6 @@
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_STANDARD_API(padep)
-{
- stream->write_function(stream, "This command no longer exists (try 'pa help')\n");
- return SWITCH_STATUS_SUCCESS;
-}
-
SWITCH_STANDARD_API(pa_cmd)
{
char *argv[1024] = { 0 };
1
0
20 Jun '07
Author: mikej
Date: Wed Jun 20 04:44:14 2007
New Revision: 5407
Modified:
freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
Log:
typo
Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Wed Jun 20 04:44:14 2007
@@ -1251,7 +1251,7 @@
SWITCH_ADD_API(commands_api_interface, "killchan", "Kill Channel", kill_function, KILL_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "reloadxml", "Reload XML", reload_function, "");
SWITCH_ADD_API(commands_api_interface, "unload", "Unload Module", unload_function, LOAD_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "load", "Load Module", unload_function, LOAD_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "load", "Load Module", load_function, LOAD_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "transfer", "Transfer Module", transfer_function, TRANSFER_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "pause", "Pause", pause_function, PAUSE_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "show", "Show", show_function, SHOW_SYNTAX);
1
0