Freeswitch-svn
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- 12151 discussions
Author: brian
Date: Sat Dec 22 15:58:01 2007
New Revision: 6960
Modified:
freeswitch/trunk/conf/autoload_configs/cdr_csv.conf.xml
Log:
tweak config
Modified: freeswitch/trunk/conf/autoload_configs/cdr_csv.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/cdr_csv.conf.xml (original)
+++ freeswitch/trunk/conf/autoload_configs/cdr_csv.conf.xml Sat Dec 22 15:58:01 2007
@@ -9,7 +9,7 @@
</settings>
<templates>
<template name="sql">INSERT INTO cdr VALUES ("${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}", "${accountcode}");</template>
- <template name="example">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}", "${accountcode}","${read_codec}","${write_codec}"</template>
+ <template name="example">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}", "${accountcode}","${read_codec}","${write_codec},"${sip_user_agent}"</template>
<template name="asterisk">"${accountcode}","${caller_id_number}","${destination_number}","${context}","${caller_id}","${channel_name}","${bridge_channel}","${last_app}","${last_arg}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${amaflags}","${uuid}","${userfield}"</template>
</templates>
</configuration>
1
0
22 Dec '07
Author: brian
Date: Sat Dec 22 15:51:57 2007
New Revision: 6959
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
Log:
add user_agent channel var so we can cdr it if we needed
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Sat Dec 22 15:51:57 2007
@@ -2276,6 +2276,10 @@
if (sip->sip_subject && sip->sip_subject->g_string) {
switch_channel_set_variable(channel, "sip_subject", sip->sip_subject->g_string);
}
+
+ if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)){
+ switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
+ }
if (sip->sip_via) {
if (sip->sip_via->v_host) {
1
0
22 Dec '07
Author: brian
Date: Sat Dec 22 13:59:36 2007
New Revision: 6958
Removed:
freeswitch/trunk/conf/dialplan/US.conf.xml
Modified:
freeswitch/trunk/conf/dialplan/default.xml
freeswitch/trunk/conf/sip_profiles/default.xml
Log:
update default configs slightly
Modified: freeswitch/trunk/conf/dialplan/default.xml
==============================================================================
--- freeswitch/trunk/conf/dialplan/default.xml (original)
+++ freeswitch/trunk/conf/dialplan/default.xml Sat Dec 22 13:59:36 2007
@@ -113,8 +113,7 @@
<anti-action application="set" data="transfer_ringback=${us-ring}"/>
<anti-action application="set" data="call_timeout=30"/>
<anti-action application="set" data="hangup_after_bridge=true"/>
- <anti-action application="set" data="left_hanging_extension=5900"/>
- <anti-action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,BUSY,USER_BUSY,NO_ANSWER,TIMEOUT"/>
+ <anti-action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,BUSY,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/>
<anti-action application="db" data="insert/call_return/${dialed_ext}/${caller_id_number}"/>
<anti-action application="db" data="insert/last_dial_ext/${dialed_ext}/${uuid}"/>
<anti-action application="bridge" data="user/${dialed_ext}@$${domain}"/>
Modified: freeswitch/trunk/conf/sip_profiles/default.xml
==============================================================================
--- freeswitch/trunk/conf/sip_profiles/default.xml (original)
+++ freeswitch/trunk/conf/sip_profiles/default.xml Sat Dec 22 13:59:36 2007
@@ -29,6 +29,8 @@
<param name="rtp-ip" value="$${local_ip_v4}"/>
<param name="sip-ip" value="$${local_ip_v4}"/>
<param name="hold-music" value="$${moh_uri}"/>
+ <!--<param name="dtmf-type" value="info"/>-->
+ <param name="record-template" value="$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
<!--enable to use presense and mwi -->
<param name="manage-presence" value="true"/>
<!-- This setting is for AAL2 bitpacking on G726 -->
@@ -44,13 +46,13 @@
<!--<param name="bind-params" value="transport=udp"/>-->
<!-- TLS: disabled by default, set to "true" to enable -->
- <!--<param name="tls" value="false"/>-->
+ <param name="tls" value="true"/>
<!-- additional bind parameters for TLS -->
- <!--<param name="tls-bind-params" value="transport=tls"/>-->
+ <param name="tls-bind-params" value="transport=tls"/>
<!-- Port to listen on for TLS requests. (5061 will be used if unspecified) -->
- <!--<param name="tls-sip-port" value="5061"/>-->
+ <param name="tls-sip-port" value="5061"/>
<!-- Location of the agent.pem and cafile.pem ssl certificates (needed for TLS server) -->
- <!--<param name="tls-cert-dir" value="$${base_dir}/conf/ssl"/>-->
+ <param name="tls-cert-dir" value="$${base_dir}/conf/ssl"/>
<!--If you don't want to pass through timestampes from 1 RTP call to another (on a per call basis with rtp_rewrite_timestamps chanvar)-->
<!--<param name="rtp-rewrite-timestamps" value="true"/>-->
@@ -74,7 +76,7 @@
that the originator is using-->
<!--<param name="disable-transcoding" value="true"/>-->
<!-- Used for when phones respond to a challenged ACK with method INVITE in the hash -->
- <param name="NDLB-broken-auth-hash" value="true"/>
+ <!--<param name="NDLB-broken-auth-hash" value="true"/>-->
<param name="auth-calls" value="true"/>
<!-- on authed calls, authenticate *all* the packets not just invite -->
<param name="auth-all-packets" value="false"/>
1
0
Author: mikej
Date: Fri Dec 21 21:20:53 2007
New Revision: 6957
Modified:
freeswitch/trunk/src/include/switch_platform.h
Log:
whoops
Modified: freeswitch/trunk/src/include/switch_platform.h
==============================================================================
--- freeswitch/trunk/src/include/switch_platform.h (original)
+++ freeswitch/trunk/src/include/switch_platform.h Fri Dec 21 21:20:53 2007
@@ -311,6 +311,7 @@
#define _Out_
#define _Check_return_
#define _Inout_
+#define _Inout_opt_
#endif
1
0
Author: anthm
Date: Fri Dec 21 21:15:50 2007
New Revision: 6956
Modified:
freeswitch/trunk/src/switch_channel.c
Log:
update
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Fri Dec 21 21:15:50 2007
@@ -306,7 +306,7 @@
SWITCH_DECLARE(void) switch_channel_uninit(switch_channel_t *channel)
{
-
+ switch_channel_flush_dtmf(channel);
switch_core_hash_destroy(&channel->private_hash);
switch_event_destroy(&channel->variables);
}
1
0
22 Dec '07
Author: trixter
Date: Fri Dec 21 20:33:38 2007
New Revision: 6955
Modified:
freeswitch/trunk/scripts/contrib/trixter/dialplan/localized.dialplan.xml
Log:
make it only work if the variables are set
Modified: freeswitch/trunk/scripts/contrib/trixter/dialplan/localized.dialplan.xml
==============================================================================
--- freeswitch/trunk/scripts/contrib/trixter/dialplan/localized.dialplan.xml (original)
+++ freeswitch/trunk/scripts/contrib/trixter/dialplan/localized.dialplan.xml Fri Dec 21 20:33:38 2007
@@ -1,5 +1,11 @@
<context name="default">
<extension name="localized-dialplan">
+ <!-- make sure that stuff is set or abort -->
+ <condition field="${default_emergency_number}" expression="^$" break="on-true"/>
+ <condition field="${default_international_regexp}" expression="^$" break="on-true"/>
+ <condition field="${default_domestic_regexp}" expression="^$" break="on-true"/>
+ <condition field="${default_local_regexp}" expression="^$" break="on-true"/>
+
<!--
Emergency service - verify your provider really supports this
-->
1
0
22 Dec '07
Author: mikej
Date: Fri Dec 21 20:00:10 2007
New Revision: 6954
Modified:
freeswitch/trunk/src/include/switch_core.h
freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c
freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c
freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c
freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c
freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c
freeswitch/trunk/src/switch_ivr_originate.c
freeswitch/trunk/src/switch_stun.c
Log:
more error checking.
Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h (original)
+++ freeswitch/trunk/src/include/switch_core.h Fri Dec 21 20:00:10 2007
@@ -218,8 +218,10 @@
\param new_allocator new pointer for the return value
\return SWITCH_STATUS_SUCCESS if the operation was a success
*/
-SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_new(switch_port_t start,
- switch_port_t end, switch_port_flag_t flags, switch_core_port_allocator_t **new_allocator);
+SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_new(_In_ switch_port_t start,
+ _In_ switch_port_t end,
+ _In_ switch_port_flag_t flags,
+ _Out_ switch_core_port_allocator_t **new_allocator);
/*!
\brief Get a port from the port allocator
@@ -227,14 +229,14 @@
\param port a pointer to the port
\return SUCCESS
*/
-SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_request_port(switch_core_port_allocator_t *alloc, switch_port_t *port_ptr);
-SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_free_port(switch_core_port_allocator_t *alloc, switch_port_t port);
+SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_request_port(_In_ switch_core_port_allocator_t *alloc, _Out_ switch_port_t *port_ptr);
+SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_free_port(_In_ switch_core_port_allocator_t *alloc, _In_ switch_port_t port);
/*!
\brief destroythe port allocator
\param alloc the allocator object
*/
-SWITCH_DECLARE(void) switch_core_port_allocator_destroy(switch_core_port_allocator_t **alloc);
+SWITCH_DECLARE(void) switch_core_port_allocator_destroy(_Inout_ switch_core_port_allocator_t **alloc);
///\}
///\defgroup ss Startup/Shutdown
@@ -247,7 +249,7 @@
\param err a pointer to set any errors to
\note to be called at application startup
*/
-SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err);
+SWITCH_DECLARE(switch_status_t) switch_core_init(_In_ switch_core_flag_t flags, _In_ switch_bool_t console, _Out_ const char **err);
/*!
\brief Initilize the core and load modules
@@ -256,21 +258,21 @@
\param err a pointer to set any errors to
\note to be called at application startup instead of switch_core_init. Includes module loading.
*/
-SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t flags, switch_bool_t console, const char **err);
+SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(_In_ switch_core_flag_t flags, _In_ switch_bool_t console, _Out_ const char **err);
/*!
\brief Set/Get Session Limit
\param new_limit new value (if > 0)
\return the current session limit
*/
-SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new_limit);
+SWITCH_DECLARE(uint32_t) switch_core_session_limit(_In_ uint32_t new_limit);
/*!
\brief Set/Get Session Rate Limit
\param new_limit new value (if > 0)
\return the current session rate limit
*/
-SWITCH_DECLARE(uint32_t) switch_core_sessions_per_second(uint32_t new_limit);
+SWITCH_DECLARE(uint32_t) switch_core_sessions_per_second(_In_ uint32_t new_limit);
/*!
\brief Destroy the core
@@ -296,7 +298,7 @@
#ifdef SWITCH_DEBUG_RWLOCKS
#define switch_core_session_read_lock(session) switch_core_session_perform_read_lock(session, __FILE__, __SWITCH_FUNC__, __LINE__)
#else
-SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_session_t *session);
+SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(_In_ switch_core_session_t *session);
#endif
@@ -311,7 +313,7 @@
#ifdef SWITCH_DEBUG_RWLOCKS
#define switch_core_session_write_lock(session) switch_core_session_perform_write_lock(session, __FILE__, __SWITCH_FUNC__, __LINE__)
#else
-SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session_t *session);
+SWITCH_DECLARE(void) switch_core_session_write_lock(_In_ switch_core_session_t *session);
#endif
#ifdef SWITCH_DEBUG_RWLOCKS
@@ -325,7 +327,7 @@
#ifdef SWITCH_DEBUG_RWLOCKS
#define switch_core_session_rwunlock(session) switch_core_session_perform_rwunlock(session, __FILE__, __SWITCH_FUNC__, __LINE__)
#else
-SWITCH_DECLARE(void) switch_core_session_rwunlock(switch_core_session_t *session);
+SWITCH_DECLARE(void) switch_core_session_rwunlock(_In_ switch_core_session_t *session);
#endif
///\}
@@ -338,17 +340,18 @@
\param state_handler a state handler to add
\return the current index/priority of this handler
*/
-SWITCH_DECLARE(int) switch_core_add_state_handler(const switch_state_handler_table_t *state_handler);
+SWITCH_DECLARE(int) switch_core_add_state_handler(_In_ const switch_state_handler_table_t *state_handler);
/*!
\brief Access a state handler
\param index the desired index to access
\return the desired state handler table or NULL when it does not exist.
*/
-SWITCH_DECLARE(const switch_state_handler_table_t *) switch_core_get_state_handler(int index);
+SWITCH_DECLARE(const switch_state_handler_table_t *) switch_core_get_state_handler(_In_ int index);
///\}
-SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memory_pool_t **pool, const char *file, const char *func, int line);
+SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(_Out_ switch_memory_pool_t **pool,
+ _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
///\defgroup memp Memory Pooling/Allocation
///\ingroup core1
@@ -359,7 +362,8 @@
*/
#define switch_core_new_memory_pool(p) switch_core_perform_new_memory_pool(p, __FILE__, __SWITCH_FUNC__, __LINE__)
-SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_memory_pool_t **pool, const char *file, const char *func, int line);
+SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(_Inout_ switch_memory_pool_t **pool,
+ _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
/*!
\brief Returns a subpool back to the main pool
\return SWITCH_STATUS_SUCCESS on success
@@ -370,13 +374,13 @@
\brief Start the session's state machine
\param session the session on which to start the state machine
*/
-SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session);
+SWITCH_DECLARE(void) switch_core_session_run(_In_ switch_core_session_t *session);
/*!
\brief determine if the session's state machine is running
\param session the session on which to check
*/
-SWITCH_DECLARE(unsigned int) switch_core_session_running(switch_core_session_t *session);
+SWITCH_DECLARE(unsigned int) switch_core_session_running(_In_ switch_core_session_t *session);
/*!
\brief Allocate memory from the main pool with no intention of returning it
@@ -384,7 +388,7 @@
\return a void pointer to the allocated memory
\note this memory never goes out of scope until the core is destroyed
*/
-SWITCH_DECLARE(void *) switch_core_permanent_alloc(switch_size_t memory);
+SWITCH_DECLARE(void *) switch_core_permanent_alloc(_In_ switch_size_t memory);
/*!
\brief Allocate memory directly from a memory pool
@@ -392,7 +396,7 @@
\param memory the number of bytes to allocate
\return a void pointer to the allocated memory
*/
-SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool_t *pool, switch_size_t memory);
+SWITCH_DECLARE(void *) switch_core_alloc(_In_ switch_memory_pool_t *pool, _In_ switch_size_t memory);
/*!
\brief Allocate memory from a session's pool
@@ -401,14 +405,14 @@
\return a void pointer to the newly allocated memory
\note the memory will be in scope as long as the session exists
*/
-SWITCH_DECLARE(void *) switch_core_session_alloc(switch_core_session_t *session, switch_size_t memory);
+SWITCH_DECLARE(void *) switch_core_session_alloc(_In_ switch_core_session_t *session, _In_ switch_size_t memory);
/*!
\brief Copy a string using permanent memory allocation
\param todup the string to duplicate
\return a pointer to the newly duplicated string
*/
-SWITCH_DECLARE(char *) switch_core_permanent_strdup(const char *todup);
+SWITCH_DECLARE(char *) switch_core_permanent_strdup(_In_z_ const char *todup);
/*!
\brief Copy a string using memory allocation from a session's pool
@@ -416,7 +420,7 @@
\param todup the string to duplicate
\return a pointer to the newly duplicated string
*/
-SWITCH_DECLARE(char *) switch_core_session_strdup(switch_core_session_t *session, const char *todup);
+SWITCH_DECLARE(char *) switch_core_session_strdup(_In_ switch_core_session_t *session, _In_z_ const char *todup);
/*!
\brief Copy a string using memory allocation from a given pool
@@ -424,7 +428,7 @@
\param todup the string to duplicate
\return a pointer to the newly duplicated string
*/
-SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool_t *pool, const char *todup);
+SWITCH_DECLARE(char *) switch_core_strdup(_In_ switch_memory_pool_t *pool, _In_z_ const char *todup);
/*!
\brief printf-style style printing routine. The data is output to a string allocated from the session
@@ -433,7 +437,7 @@
\param ... The arguments to use while printing the data
\return The new string
*/
-SWITCH_DECLARE(char *) switch_core_session_sprintf(switch_core_session_t *session, const char *fmt, ...);
+SWITCH_DECLARE(char *) switch_core_session_sprintf(_In_ switch_core_session_t *session, _In_z_ _Printf_format_string_ const char *fmt, ...);
/*!
\brief printf-style style printing routine. The data is output to a string allocated from the pool
@@ -442,7 +446,7 @@
\param ... The arguments to use while printing the data
\return The new string
*/
-SWITCH_DECLARE(char *) switch_core_sprintf(switch_memory_pool_t *pool, const char *fmt, ...);
+SWITCH_DECLARE(char *) switch_core_sprintf(_In_ switch_memory_pool_t *pool, _In_z_ _Printf_format_string_ const char *fmt, ...);
/*!
\brief Retrieve the memory pool from a session
@@ -450,7 +454,7 @@
\return the session's pool
\note to be used sparingly
*/
-SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(switch_core_session_t *session);
+SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(_In_ switch_core_session_t *session);
///\}
///\defgroup sessm Session Creation / Management
@@ -462,11 +466,12 @@
\param pool the pool to use for the allocation (a new one will be used if NULL)
\return the newly created session
*/
-SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request(const switch_endpoint_interface_t
- *endpoint_interface, switch_memory_pool_t **pool);
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request(_In_ const switch_endpoint_interface_t *endpoint_interface,
+ _Inout_opt_ switch_memory_pool_t **pool);
-SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t **session, const char *file, const char *func, int line);
+SWITCH_DECLARE(void) switch_core_session_perform_destroy(_Inout_ switch_core_session_t **session,
+ _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
/*!
\brief Destroy a session and return the memory pool to the core
@@ -493,33 +498,33 @@
\param pool the pool to use
\return the newly created session
*/
-SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(char *endpoint_name, switch_memory_pool_t **pool);
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(_In_z_ char *endpoint_name, _Inout_ switch_memory_pool_t **pool);
/*!
\brief Launch the session thread (state machine) on a given session
\param session the session to activate the state machine on
\return SWITCH_STATUS_SUCCESS if the thread was launched
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(switch_core_session_t *session);
+SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(_In_ switch_core_session_t *session);
/*!
\brief Retrieve a pointer to the channel object associated with a given session
\param session the session to retrieve from
\return a pointer to the channel object
*/
-SWITCH_DECLARE(switch_channel_t *) switch_core_session_get_channel(switch_core_session_t *session);
+SWITCH_DECLARE(switch_channel_t *) switch_core_session_get_channel(_In_ switch_core_session_t *session);
/*!
\brief Signal a session's state machine thread that a state change has occured
*/
-SWITCH_DECLARE(void) switch_core_session_signal_state_change(switch_core_session_t *session);
+SWITCH_DECLARE(void) switch_core_session_signal_state_change(_In_ switch_core_session_t *session);
/*!
\brief Retrieve the unique identifier from a session
\param session the session to retrieve the uuid from
\return a string representing the uuid
*/
-SWITCH_DECLARE(char *) switch_core_session_get_uuid(switch_core_session_t *session);
+SWITCH_DECLARE(char *) switch_core_session_get_uuid(_In_ switch_core_session_t *session);
/*!
\brief Retrieve the unique identifier from the core
@@ -540,7 +545,7 @@
#ifdef SWITCH_DEBUG_RWLOCKS
#define switch_core_session_locate(uuid_str) switch_core_session_perform_locate(uuid_str, __FILE__, __SWITCH_FUNC__, __LINE__)
#else
-SWITCH_DECLARE(switch_core_session_t *) switch_core_session_locate(const char *uuid_str);
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_locate(_In_z_ const char *uuid_str);
#endif
/*!
@@ -548,20 +553,20 @@
\param varname the name of the variable
\return the value of the desired variable
*/
-SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname);
+SWITCH_DECLARE(char *) switch_core_get_variable(_In_z_ const char *varname);
/*!
\brief Add a global variable to the core
\param varname the name of the variable
\param value the value of the variable
*/
-SWITCH_DECLARE(void) switch_core_set_variable(const char *varname, const char *value);
+SWITCH_DECLARE(void) switch_core_set_variable(_In_z_ const char *varname, _In_opt_z_ const char *value);
/*!
\brief Hangup All Sessions
\param cause the hangup cause to apply to the hungup channels
*/
-SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause);
+SWITCH_DECLARE(void) switch_core_session_hupall(_In_ switch_call_cause_t cause);
/*!
\brief Send a message to another session using it's uuid
@@ -569,7 +574,7 @@
\param message the switch_core_session_message_t object to send
\return the status returned by the message handler
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(char *uuid_str, switch_core_session_message_t *message);
+SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(_In_z_ char *uuid_str, _In_ switch_core_session_message_t *message);
/*!
\brief Queue a message on a session
@@ -577,7 +582,7 @@
\param message the message to queue
\return SWITCH_STATUS_SUCCESS if the message was queued
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(switch_core_session_t *session, switch_core_session_message_t *message);
+SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(_In_ switch_core_session_t *session, _In_ switch_core_session_message_t *message);
/*!
\brief pass an indication message on a session
@@ -585,7 +590,7 @@
\param indication the indication message to pass
\return SWITCH_STATUS_SUCCESS if the message was passed
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(switch_core_session_t *session, switch_core_session_message_types_t indication);
+SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_core_session_t *session, _In_ switch_core_session_message_types_t indication);
/*!
\brief Queue an indication message on a session
@@ -593,7 +598,7 @@
\param indication the indication message to queue
\return SWITCH_STATUS_SUCCESS if the message was queued
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(switch_core_session_t *session, switch_core_session_message_types_t indication);
+SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(_In_ switch_core_session_t *session, _In_ switch_core_session_message_types_t indication);
/*!
\brief DE-Queue an message on a given session
@@ -601,14 +606,14 @@
\param message the de-queued message
\return the SWITCH_STATUS_SUCCESS if the message was de-queued
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(switch_core_session_t *session, switch_core_session_message_t **message);
+SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(_In_ switch_core_session_t *session, _Out_ switch_core_session_message_t **message);
/*!
\brief Flush a message queue on a given session
\param session the session to de-queue the message on
\return the SWITCH_STATUS_SUCCESS if the message was de-queued
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_flush_message(switch_core_session_t *session);
+SWITCH_DECLARE(switch_status_t) switch_core_session_flush_message(_In_ switch_core_session_t *session);
/*!
\brief Queue an event on another session using its uuid
@@ -1191,12 +1196,12 @@
\param pool the pool to use (NULL for new pool)
\return SWITCH_STATUS_SUCCESS if the handle is opened
*/
-SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *sh,
+SWITCH_DECLARE(switch_status_t) switch_core_speech_open(_In_ switch_speech_handle_t *sh,
const char *module_name,
const char *voice_name,
- unsigned int rate,
- unsigned int interval,
- switch_speech_flag_t *flags, switch_memory_pool_t *pool);
+ _In_ unsigned int rate,
+ _In_ unsigned int interval,
+ switch_speech_flag_t *flags, _In_ switch_memory_pool_t *pool);
/*!
\brief Feed text to the TTS module
\param sh the speech handle to feed
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 Fri Dec 21 20:00:10 2007
@@ -814,8 +814,9 @@
mydata = strdup(cmd);
switch_assert(mydata != NULL);
- if ((argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]))) < 3) {
+ if ((argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]))) < 3 || !argv[0]) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "-ERR INVALID ARGS!\n");
+ return SWITCH_STATUS_SUCCESS;
}
@@ -1206,15 +1207,15 @@
path = argv[2];
limit = argv[3] ? atoi(argv[3]) : 0;
+ if (switch_strlen_zero(uuid) || switch_strlen_zero(action) || switch_strlen_zero(path)) {
+ goto usage;
+ }
+
if (!(rsession = switch_core_session_locate(uuid))) {
stream->write_function(stream, "-ERR Cannot locate session!\n");
return SWITCH_STATUS_SUCCESS;
}
- if (switch_strlen_zero(action) || switch_strlen_zero(path)) {
- goto usage;
- }
-
if (!strcasecmp(action, "start")) {
switch_ivr_record_session(rsession, path, limit, NULL);
} else if (!strcasecmp(action, "stop")) {
@@ -1273,15 +1274,15 @@
limit = argv[3] ? atoi(argv[3]) : 0;
flags = argv[4];
+ if (switch_strlen_zero(uuid) || switch_strlen_zero(action) || switch_strlen_zero(path)) {
+ goto usage;
+ }
+
if (!(rsession = switch_core_session_locate(uuid))) {
stream->write_function(stream, "-ERR Cannot locate session!\n");
return SWITCH_STATUS_SUCCESS;
}
- if (switch_strlen_zero(action) || switch_strlen_zero(path)) {
- goto usage;
- }
-
if (!strcasecmp(action, "start")) {
switch_ivr_displace_session(rsession, path, limit, flags);
} else if (!strcasecmp(action, "stop")) {
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Fri Dec 21 20:00:10 2007
@@ -4599,63 +4599,63 @@
var = buf;
}
- if (!strcasecmp(var, "rate")) {
+ if (!strcasecmp(var, "rate") && !switch_strlen_zero(val)) {
rate_name = val;
- } else if (!strcasecmp(var, "domain")) {
+ } else if (!strcasecmp(var, "domain") && !switch_strlen_zero(val)) {
domain = val;
- } else if (!strcasecmp(var, "interval")) {
+ } else if (!strcasecmp(var, "interval") && !switch_strlen_zero(val)) {
interval_name = val;
- } else if (!strcasecmp(var, "timer-name")) {
+ } else if (!strcasecmp(var, "timer-name") && !switch_strlen_zero(val)) {
timer_name = val;
- } else if (!strcasecmp(var, "tts-engine")) {
+ } else if (!strcasecmp(var, "tts-engine") && !switch_strlen_zero(val)) {
tts_engine = val;
- } else if (!strcasecmp(var, "tts-voice")) {
+ } else if (!strcasecmp(var, "tts-voice") && !switch_strlen_zero(val)) {
tts_voice = val;
- } else if (!strcasecmp(var, "enter-sound")) {
+ } else if (!strcasecmp(var, "enter-sound") && !switch_strlen_zero(val)) {
enter_sound = val;
- } else if (!strcasecmp(var, "exit-sound")) {
+ } else if (!strcasecmp(var, "exit-sound") && !switch_strlen_zero(val)) {
exit_sound = val;
- } else if (!strcasecmp(var, "alone-sound")) {
+ } else if (!strcasecmp(var, "alone-sound") && !switch_strlen_zero(val)) {
alone_sound = val;
- } else if (!strcasecmp(var, "perpetual-sound")) {
+ } else if (!strcasecmp(var, "perpetual-sound") && !switch_strlen_zero(val)) {
perpetual_sound = val;
- } else if (!strcasecmp(var, "moh-sound")) {
+ } else if (!strcasecmp(var, "moh-sound") && !switch_strlen_zero(val)) {
moh_sound = val;
- } else if (!strcasecmp(var, "ack-sound")) {
+ } else if (!strcasecmp(var, "ack-sound") && !switch_strlen_zero(val)) {
ack_sound = val;
- } else if (!strcasecmp(var, "nack-sound")) {
+ } else if (!strcasecmp(var, "nack-sound") && !switch_strlen_zero(val)) {
nack_sound = val;
- } else if (!strcasecmp(var, "muted-sound")) {
+ } else if (!strcasecmp(var, "muted-sound") && !switch_strlen_zero(val)) {
muted_sound = val;
- } else if (!strcasecmp(var, "unmuted-sound")) {
+ } else if (!strcasecmp(var, "unmuted-sound") && !switch_strlen_zero(val)) {
unmuted_sound = val;
- } else if (!strcasecmp(var, "locked-sound")) {
+ } else if (!strcasecmp(var, "locked-sound") && !switch_strlen_zero(val)) {
locked_sound = val;
- } else if (!strcasecmp(var, "is-locked-sound")) {
+ } else if (!strcasecmp(var, "is-locked-sound") && !switch_strlen_zero(val)) {
is_locked_sound = val;
- } else if (!strcasecmp(var, "is-unlocked-sound")) {
+ } else if (!strcasecmp(var, "is-unlocked-sound") && !switch_strlen_zero(val)) {
is_unlocked_sound = val;
- } else if (!strcasecmp(var, "member-flags")) {
+ } else if (!strcasecmp(var, "member-flags") && !switch_strlen_zero(val)) {
member_flags = val;
- } else if (!strcasecmp(var, "kicked-sound")) {
+ } else if (!strcasecmp(var, "kicked-sound") && !switch_strlen_zero(val)) {
kicked_sound = val;
- } else if (!strcasecmp(var, "pin")) {
+ } else if (!strcasecmp(var, "pin") && !switch_strlen_zero(val)) {
pin = val;
- } else if (!strcasecmp(var, "pin-sound")) {
+ } else if (!strcasecmp(var, "pin-sound") && !switch_strlen_zero(val)) {
pin_sound = val;
- } else if (!strcasecmp(var, "bad-pin-sound")) {
+ } else if (!strcasecmp(var, "bad-pin-sound") && !switch_strlen_zero(val)) {
bad_pin_sound = val;
- } else if (!strcasecmp(var, "energy-level")) {
+ } else if (!strcasecmp(var, "energy-level") && !switch_strlen_zero(val)) {
energy_level = val;
- } else if (!strcasecmp(var, "caller-id-name")) {
+ } else if (!strcasecmp(var, "caller-id-name") && !switch_strlen_zero(val)) {
caller_id_name = val;
- } else if (!strcasecmp(var, "caller-id-number")) {
+ } else if (!strcasecmp(var, "caller-id-number") && !switch_strlen_zero(val)) {
caller_id_number = val;
- } else if (!strcasecmp(var, "caller-controls")) {
+ } else if (!strcasecmp(var, "caller-controls") && !switch_strlen_zero(val)) {
caller_controls = val;
- } else if (!strcasecmp(var, "sound-prefix")) {
+ } else if (!strcasecmp(var, "sound-prefix") && !switch_strlen_zero(val)) {
sound_prefix = val;
- } else if (!strcasecmp(var, "max-members")) {
+ } else if (!strcasecmp(var, "max-members") && !switch_strlen_zero(val)) {
errno = 0; // sanity first
max_members = strtol(val, NULL, 0); // base 0 lets 0x... for hex 0... for octal and base 10 otherwise through
if (errno == ERANGE || errno == EINVAL || max_members < 0 || max_members == 1) {
@@ -4664,9 +4664,9 @@
max_members = 0; // set to 0 to disable max counts
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "max-members %s is invalid, not setting a limit\n", val);
}
- } else if (!strcasecmp(var, "max-members-sound")) {
+ } else if (!strcasecmp(var, "max-members-sound") && !switch_strlen_zero(val)) {
maxmember_sound = val;
- } else if (!strcasecmp(var, "anounce-count")) {
+ } else if (!strcasecmp(var, "anounce-count") && !switch_strlen_zero(val)) {
errno = 0; // safety first
anounce_count = strtol(val, NULL, 0);
if (errno == ERANGE || errno == EINVAL) {
@@ -4728,9 +4728,15 @@
/* initialize the conference object with settings from the specified profile */
conference->pool = pool;
conference->profile_name = switch_core_strdup(conference->pool, switch_xml_attr_soft(cfg.profile, "name"));
- conference->timer_name = switch_core_strdup(conference->pool, timer_name);
- conference->tts_engine = switch_core_strdup(conference->pool, tts_engine);
- conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);
+ if (timer_name) {
+ conference->timer_name = switch_core_strdup(conference->pool, timer_name);
+ }
+ if (tts_engine) {
+ conference->tts_engine = switch_core_strdup(conference->pool, tts_engine);
+ }
+ if (tts_voice) {
+ conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);
+ }
conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c Fri Dec 21 20:00:10 2007
@@ -461,7 +461,7 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid threshold value [%s] must be between 0 and 1000 ms\n", val);
}
- } else if (!strcasecmp(var, "tone-spec")) {
+ } else if (!strcasecmp(var, "tone-spec") && !switch_strlen_zero(val)) {
tone_spec = val;
} else if (!strcasecmp(var, "digit-timeout")) {
int tmp = 0;
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 Fri Dec 21 20:00:10 2007
@@ -1335,14 +1335,14 @@
}
-static switch_status_t channel_send_dtmf(switch_core_session_t *session, char *dtmf)
+static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
{
struct private_object *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF [%s]\n", dtmf);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF [%c]\n", dtmf->digit);
return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, dtmf);
@@ -1627,7 +1627,7 @@
char *profile_name;
char *callto;
char idbuf[1024];
- char *full_id;
+ char *full_id = NULL;
char sess_id[11] = "";
char *dnis = NULL;
char workspace[1024] = "";
@@ -1716,7 +1716,9 @@
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
tech_pvt->recip = switch_core_session_strdup(*new_session, full_id);
- tech_pvt->dnis = switch_core_session_strdup(*new_session, dnis);
+ if (dnis) {
+ tech_pvt->dnis = switch_core_session_strdup(*new_session, dnis);
+ }
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -1956,25 +1958,25 @@
#endif
} else if (!strcasecmp(var, "use-rtp-timer") && switch_true(val)) {
switch_set_flag(profile, TFLAG_TIMER);
- } else if (!strcasecmp(var, "dialplan")) {
+ } else if (!strcasecmp(var, "dialplan") && !switch_strlen_zero(val)) {
profile->dialplan = switch_core_strdup(module_pool, val);
#ifdef AUTO_REPLY // gotta fix looping on this
} else if (!strcasecmp(var, "auto-reply")) {
profile->auto_reply = switch_core_strdup(module_pool, val);
#endif
- } else if (!strcasecmp(var, "name")) {
+ } else if (!strcasecmp(var, "name") && !switch_strlen_zero(val)) {
profile->name = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "message")) {
+ } else if (!strcasecmp(var, "message") && !switch_strlen_zero(val)) {
profile->message = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "rtp-ip")) {
profile->ip = switch_core_strdup(module_pool, strcasecmp(switch_str_nil(val), "auto") ? switch_str_nil(val) : globals.guess_ip);
} else if (!strcasecmp(var, "ext-rtp-ip")) {
profile->extip = switch_core_strdup(module_pool, strcasecmp(switch_str_nil(val), "auto") ? switch_str_nil(val) : globals.guess_ip);
- } else if (!strcasecmp(var, "server")) {
+ } else if (!strcasecmp(var, "server") && !switch_strlen_zero(val)) {
profile->server = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "rtp-timer-name")) {
+ } else if (!strcasecmp(var, "rtp-timer-name") && !switch_strlen_zero(val)) {
profile->timer_name = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "lanaddr")) {
+ } else if (!strcasecmp(var, "lanaddr") && !switch_strlen_zero(val)) {
profile->lanaddr = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "tls")) {
if (switch_true(val)) {
@@ -1986,11 +1988,11 @@
} else if (val && !strcasecmp(val, "md5")) {
profile->user_flags |= LDL_FLAG_SASL_MD5;
}
- } else if (!strcasecmp(var, "exten")) {
+ } else if (!strcasecmp(var, "exten") && !switch_strlen_zero(val)) {
profile->exten = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "context")) {
+ } else if (!strcasecmp(var, "context") && !switch_strlen_zero(val)) {
profile->context = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "auto-login")) {
+ } else if (!strcasecmp(var, "auto-login") && !switch_strlen_zero(val)) {
if (switch_true(val)) {
switch_set_flag(profile, TFLAG_AUTO);
}
Modified: freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c Fri Dec 21 20:00:10 2007
@@ -176,9 +176,9 @@
char sbuf[13] = "";
switch_status_t status;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -426,9 +426,9 @@
char *dollars = NULL;
char *cents = NULL;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
Modified: freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c Fri Dec 21 20:00:10 2007
@@ -176,9 +176,9 @@
char sbuf[13] = "";
switch_status_t status;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -426,9 +426,9 @@
char *dollars = NULL;
char *cents = NULL;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
Modified: freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c Fri Dec 21 20:00:10 2007
@@ -176,9 +176,9 @@
char sbuf[13] = "";
switch_status_t status;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -426,9 +426,9 @@
char *dollars = NULL;
char *cents = NULL;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
Modified: freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c Fri Dec 21 20:00:10 2007
@@ -176,9 +176,9 @@
char sbuf[13] = "";
switch_status_t status;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -426,9 +426,9 @@
char *dollars = NULL;
char *cents = NULL;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
Modified: freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c Fri Dec 21 20:00:10 2007
@@ -176,9 +176,9 @@
char sbuf[13] = "";
switch_status_t status;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -426,9 +426,9 @@
char *dollars = NULL;
char *cents = NULL;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
Modified: freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c Fri Dec 21 20:00:10 2007
@@ -176,9 +176,9 @@
char sbuf[13] = "";
switch_status_t status;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -426,9 +426,9 @@
char *dollars = NULL;
char *cents = NULL;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c (original)
+++ freeswitch/trunk/src/switch_ivr_originate.c Fri Dec 21 20:00:10 2007
@@ -564,7 +564,7 @@
if (caller_profile_override) {
new_profile = switch_caller_profile_dup(pool, caller_profile_override);
- new_profile->destination_number = switch_core_strdup(new_profile->pool, chan_data);
+ new_profile->destination_number = switch_core_strdup(new_profile->pool, switch_str_nil(chan_data));
new_profile->uuid = SWITCH_BLANK_STRING;
new_profile->chan_name = SWITCH_BLANK_STRING;
} else {
Modified: freeswitch/trunk/src/switch_stun.c
==============================================================================
--- freeswitch/trunk/src/switch_stun.c (original)
+++ freeswitch/trunk/src/switch_stun.c Fri Dec 21 20:00:10 2007
@@ -279,7 +279,7 @@
switch_stun_packet_attribute_t *attr;
switch_size_t bytes = 0;
char username[33] = { 0 };
- char rip[16];
+ char rip[16] = { 0 };
uint16_t rport = 0;
switch_time_t started = 0;
unsigned int elapsed = 0;
1
0
Author: mikej
Date: Fri Dec 21 19:51:26 2007
New Revision: 6953
Modified:
freeswitch/trunk/src/switch_cpp.cpp
freeswitch/trunk/src/switch_ivr.c
freeswitch/trunk/src/switch_ivr_async.c
Log:
fix msvc build.
Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp (original)
+++ freeswitch/trunk/src/switch_cpp.cpp Fri Dec 21 19:51:26 2007
@@ -390,8 +390,6 @@
int CoreSession::flushDigits()
{
- char buf[256];
- switch_size_t has;
switch_channel_t *channel;
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Fri Dec 21 19:51:26 2007
@@ -640,7 +640,7 @@
if (switch_channel_has_dtmf(channel)) {
switch_dtmf_t dtmf = {0};
- int y;
+ switch_size_t y;
for (y = 0; y < maxdigits; y++) {
if (switch_channel_dequeue_dtmf(channel, &dtmf) != SWITCH_STATUS_SUCCESS) {
Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c (original)
+++ freeswitch/trunk/src/switch_ivr_async.c Fri Dec 21 19:51:26 2007
@@ -821,8 +821,8 @@
switch_inband_dtmf_generate_t *pvt = (switch_inband_dtmf_generate_t *) switch_core_media_bug_get_user_data(bug);
if (pvt) {
- switch_mutex_lock(pvt->mutex);
char buf[2] = "";
+ switch_mutex_lock(pvt->mutex);
buf[0] = dtmf->digit;
teletone_run(&pvt->ts, buf);
switch_mutex_unlock(pvt->mutex);
1
0
Author: anthm
Date: Fri Dec 21 19:32:20 2007
New Revision: 6952
Modified:
freeswitch/trunk/src/include/private/switch_core_pvt.h
freeswitch/trunk/src/include/switch_channel.h
freeswitch/trunk/src/include/switch_core.h
freeswitch/trunk/src/include/switch_core_event_hook.h
freeswitch/trunk/src/include/switch_module_interfaces.h
freeswitch/trunk/src/include/switch_rtp.h
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c
freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c
freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_core.c
freeswitch/trunk/src/switch_core_io.c
freeswitch/trunk/src/switch_core_session.c
freeswitch/trunk/src/switch_cpp.cpp
freeswitch/trunk/src/switch_ivr.c
freeswitch/trunk/src/switch_ivr_async.c
freeswitch/trunk/src/switch_ivr_bridge.c
freeswitch/trunk/src/switch_ivr_play_say.c
freeswitch/trunk/src/switch_rtp.c
Log:
dtmf overhaul testers wanted
Modified: freeswitch/trunk/src/include/private/switch_core_pvt.h
==============================================================================
--- freeswitch/trunk/src/include/private/switch_core_pvt.h (original)
+++ freeswitch/trunk/src/include/private/switch_core_pvt.h Fri Dec 21 19:32:20 2007
@@ -168,6 +168,7 @@
uint32_t flags;
switch_time_t timestamp;
switch_mutex_t *throttle_mutex;
+ switch_mutex_t *global_mutex;
uint32_t sps_total;
int32_t sps;
int32_t sps_last;
Modified: freeswitch/trunk/src/include/switch_channel.h
==============================================================================
--- freeswitch/trunk/src/include/switch_channel.h (original)
+++ freeswitch/trunk/src/include/switch_channel.h Fri Dec 21 19:32:20 2007
@@ -422,19 +422,20 @@
/*!
\brief Queue DTMF on a given channel
\param channel channel to queue DTMF to
- \param dtmf string of digits to queue
+ \param dtmf digit
\return SWITCH_STATUS_SUCCESS if successful
*/
-SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *channel, const char *dtmf);
+SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *channel, const switch_dtmf_t *dtmf);
/*!
\brief Retrieve DTMF digits from a given channel
\param channel channel to retrieve digits from
- \param dtmf buffer to write dtmf to
- \param len max size in bytes of the buffer
+ \param dtmf digit
\return number of bytes read into the buffer
*/
-SWITCH_DECLARE(switch_size_t) switch_channel_dequeue_dtmf(switch_channel_t *channel, char *dtmf, switch_size_t len);
+SWITCH_DECLARE(switch_status_t) switch_channel_dequeue_dtmf(switch_channel_t *channel, switch_dtmf_t *dtmf);
+SWITCH_DECLARE(void) switch_channel_flush_dtmf(switch_channel_t *channel);
+SWITCH_DECLARE(switch_size_t) switch_channel_dequeue_dtmf_string(switch_channel_t *channel, char *dtmf_str, switch_size_t len);
/*!
\brief Render the name of the provided state enum
Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h (original)
+++ freeswitch/trunk/src/include/switch_core.h Fri Dec 21 19:32:20 2007
@@ -829,7 +829,7 @@
\param dtmf string to send to the session
\return SWITCH_STATUS_SUCCESS if the dtmf was written
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_session_t *session, const char *dtmf);
+SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf);
/*!
\brief RECV DTMF on a session
@@ -837,7 +837,7 @@
\param dtmf string to recv from the session
\return SWITCH_STATUS_SUCCESS if the dtmf is ok to queue
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_session_t *session, const char *dtmf);
+SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf);
///\}
Modified: freeswitch/trunk/src/include/switch_core_event_hook.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core_event_hook.h (original)
+++ freeswitch/trunk/src/include/switch_core_event_hook.h Fri Dec 21 19:32:20 2007
@@ -59,8 +59,8 @@
typedef switch_status_t (*switch_kill_channel_hook_t) (switch_core_session_t *, int);
typedef switch_status_t (*switch_waitfor_read_hook_t) (switch_core_session_t *, int, int);
typedef switch_status_t (*switch_waitfor_write_hook_t) (switch_core_session_t *, int, int);
-typedef switch_status_t (*switch_send_dtmf_hook_t) (switch_core_session_t *, const char *);
-typedef switch_status_t (*switch_recv_dtmf_hook_t) (switch_core_session_t *, const char *);
+typedef switch_status_t (*switch_send_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *);
+typedef switch_status_t (*switch_recv_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *);
typedef switch_status_t (*switch_state_change_hook_t) (switch_core_session_t *);
Modified: freeswitch/trunk/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/trunk/src/include/switch_module_interfaces.h (original)
+++ freeswitch/trunk/src/include/switch_module_interfaces.h Fri Dec 21 19:32:20 2007
@@ -105,7 +105,7 @@
typedef switch_status_t (*switch_io_kill_channel_t) (switch_core_session_t *, int);
typedef switch_status_t (*switch_io_waitfor_read_t) (switch_core_session_t *, int, int);
typedef switch_status_t (*switch_io_waitfor_write_t) (switch_core_session_t *, int, int);
-typedef switch_status_t (*switch_io_send_dtmf_t) (switch_core_session_t *, char *);
+typedef switch_status_t (*switch_io_send_dtmf_t) (switch_core_session_t *, const switch_dtmf_t *);
typedef switch_status_t (*switch_io_receive_message_t) (switch_core_session_t *, switch_core_session_message_t *);
typedef switch_status_t (*switch_io_receive_event_t) (switch_core_session_t *, switch_event_t *);
typedef switch_status_t (*switch_io_state_change_t) (switch_core_session_t *);
Modified: freeswitch/trunk/src/include/switch_rtp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_rtp.h (original)
+++ freeswitch/trunk/src/include/switch_rtp.h Fri Dec 21 19:32:20 2007
@@ -261,7 +261,8 @@
\param digits the digit string to queue
\param duration the duration of the dtmf
*/
-SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833(switch_rtp_t *rtp_session, char *digits, uint32_t duration);
+SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf);
+SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833_in(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf);
/*!
\brief Test for presence of DTMF on a given RTP session
@@ -271,21 +272,12 @@
SWITCH_DECLARE(switch_size_t) switch_rtp_has_dtmf(switch_rtp_t *rtp_session);
/*!
- \brief Queue DTMF on a given RTP session
- \param rtp_session RTP session to queue DTMF to
- \param dtmf string of digits to queue
- \return SWITCH_STATUS_SUCCESS if successful
-*/
-SWITCH_DECLARE(switch_status_t) switch_rtp_queue_dtmf(switch_rtp_t *rtp_session, char *dtmf);
-
-/*!
\brief Retrieve DTMF digits from a given RTP session
\param rtp_session RTP session to retrieve digits from
- \param dtmf buffer to write dtmf to
- \param len max size in bytes of the buffer
+ \param dtmf the dtmf
\return number of bytes read into the buffer
*/
-SWITCH_DECLARE(switch_size_t) switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session, char *dtmf, switch_size_t len);
+SWITCH_DECLARE(switch_size_t) switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session, switch_dtmf_t *dtmf);
/*!
\brief Read data from a given RTP session without copying
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Fri Dec 21 19:32:20 2007
@@ -92,7 +92,7 @@
#define SWITCH_SEQ_CLEARLINEEND SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINEEND_CHAR
#define SWITCH_SEQ_CLEARSCR SWITCH_SEQ_ESC SWITCH_SEQ_CLEARSCR_CHAR SWITCH_SEQ_HOME
-
+#define SWITCH_DEFAULT_DTMF_DURATION 250
#define SWITCH_DEFAULT_DIR_PERMS SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_UEXECUTE | SWITCH_FPROT_GREAD | SWITCH_FPROT_GEXECUTE
#ifdef WIN32
@@ -136,6 +136,11 @@
#define SWITCH_BITS_PER_BYTE 8
typedef uint8_t switch_byte_t;
+typedef struct {
+ char digit;
+ uint32_t duration;
+} switch_dtmf_t;
+
typedef enum {
SOF_NONE = 0,
SOF_NOBLOCK = (1 << 0),
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Fri Dec 21 19:32:20 2007
@@ -1648,7 +1648,7 @@
/* if we have caller digits, feed them to the parser to find an action */
if (switch_channel_has_dtmf(channel)) {
- switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
+ switch_channel_dequeue_dtmf_string(channel, dtmf, sizeof(dtmf));
if (member->conference->dtmf_parser != NULL) {
@@ -2637,6 +2637,8 @@
{
switch_event_t *event;
char *dtmf = (char *) data;
+ char *p = dtmf;
+ switch_dtmf_t _dtmf = { 0, SWITCH_DEFAULT_DTMF_DURATION };
if (member == NULL) {
stream->write_function(stream, "Invalid member!\n");
@@ -2651,9 +2653,15 @@
switch_mutex_lock(member->flag_mutex);
switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
- switch_core_session_send_dtmf(member->session, dtmf);
- switch_mutex_unlock(member->flag_mutex);
+ while(p && *p) {
+ _dtmf.digit = *p;
+ switch_core_session_send_dtmf(member->session, &_dtmf);
+ p++;
+ }
+
+ switch_mutex_unlock(member->flag_mutex);
+
if (stream != NULL) {
stream->write_function(stream, "OK sent %s to %u\n", (char *) data, member->id);
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Fri Dec 21 19:32:20 2007
@@ -193,10 +193,17 @@
SWITCH_STANDARD_APP(queue_dtmf_function)
{
switch_channel_t *channel;
+ char *p;
+ switch_dtmf_t dtmf = {0, SWITCH_DEFAULT_DTMF_DURATION};
+
if (!switch_strlen_zero(data)) {
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
- switch_channel_queue_dtmf(channel, data);
+ for (p = (char *)data; p && *p; p++) {
+ dtmf.digit = *p;
+ switch_channel_queue_dtmf(channel, &dtmf);
+ p++;
+ }
}
}
@@ -1048,7 +1055,7 @@
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:
{
- char *dtmf = (char *) input;
+ switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
const char *terminators;
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *p;
@@ -1061,14 +1068,11 @@
if (!strcasecmp(terminators, "none")) {
terminators = NULL;
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digits %s\n", dtmf);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digit %c\n", dtmf->digit);
for (p = terminators; p && *p; p++) {
- char *d;
- for (d = dtmf; d && *d; d++) {
- if (*p == *d) {
- return SWITCH_STATUS_BREAK;
- }
+ if (*p == dtmf->digit) {
+ return SWITCH_STATUS_BREAK;
}
}
}
Modified: freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c Fri Dec 21 19:32:20 2007
@@ -48,8 +48,9 @@
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:
{
- char *dtmf = (char *) input;
- if (*dtmf == '*') {
+ switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
+
+ if (dtmf->digit == '*') {
channel = switch_core_session_get_channel(session);
if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
channel = switch_core_session_get_channel(bleg);
Modified: freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c Fri Dec 21 19:32:20 2007
@@ -91,11 +91,11 @@
{
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:{
- char *dtmf = (char *) input;
+ switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
struct dtmf_buffer *dtb;
dtb = (struct dtmf_buffer *) buf;
- switch (*dtmf) {
+ switch (dtmf->digit) {
case '#':
switch_set_flag(dtb, SFLAG_MAIN);
return SWITCH_STATUS_BREAK;
Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c Fri Dec 21 19:32:20 2007
@@ -615,9 +615,11 @@
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:
{
- char *dtmf = (char *) input;
+ switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
if (buf && buflen) {
- switch_copy_string(buf, dtmf, buflen);
+ char *bp = (char *) buf;
+ bp[0] = dtmf->digit;
+ bp[1] = '\0';
}
return SWITCH_STATUS_BREAK;
}
@@ -643,13 +645,13 @@
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:
{
- char *dtmf = (char *) input;
+ switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
cc_t *cc = (cc_t *) buf;
switch_file_handle_t *fh = cc->fh;
uint32_t pos = 0;
- if (!cc->noexit && (*dtmf == *cc->profile->delete_file_key || *dtmf == *cc->profile->save_file_key || *dtmf == *cc->profile->terminator_key)) {
- *cc->buf = *dtmf;
+ if (!cc->noexit && (dtmf->digit == *cc->profile->delete_file_key || dtmf->digit == *cc->profile->save_file_key || dtmf->digit == *cc->profile->terminator_key)) {
+ *cc->buf = dtmf->digit;
return SWITCH_STATUS_BREAK;
}
@@ -657,7 +659,7 @@
return SWITCH_STATUS_SUCCESS;
}
- if (*dtmf == *cc->profile->pause_key) {
+ if (dtmf->digit == *cc->profile->pause_key) {
if (switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
switch_clear_flag(fh, SWITCH_FILE_PAUSE);
} else {
@@ -666,20 +668,20 @@
return SWITCH_STATUS_SUCCESS;
}
- if (*dtmf == *cc->profile->restart_key) {
+ if (dtmf->digit == *cc->profile->restart_key) {
unsigned int seekpos = 0;
fh->speed = 0;
switch_core_file_seek(fh, &seekpos, 0, SEEK_SET);
return SWITCH_STATUS_SUCCESS;
}
- if (*dtmf == *cc->profile->ff_key) {
+ if (dtmf->digit == *cc->profile->ff_key) {
int samps = 24000;
switch_core_file_seek(fh, &pos, samps, SEEK_CUR);
return SWITCH_STATUS_SUCCESS;
}
- if (*dtmf == *cc->profile->rew_key) {
+ if (dtmf->digit == *cc->profile->rew_key) {
int samps = 24000;
switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET);
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c Fri Dec 21 19:32:20 2007
@@ -522,14 +522,14 @@
}
-static switch_status_t channel_send_dtmf(switch_core_session_t *session, char *dtmf)
+static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
{
private_t *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF ON CALL %s [%s]\n", tech_pvt->call_id, dtmf);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF ON CALL %s [%c]\n", tech_pvt->call_id, dtmf->digit);
return SWITCH_STATUS_SUCCESS;
}
@@ -1205,15 +1205,21 @@
static switch_status_t dtmf_call(char **argv, int argc, switch_stream_handle_t *stream)
{
- char *dtmf = argv[0];
-
- if (switch_strlen_zero(dtmf)) {
+ char *dtmf_str = argv[0];
+ switch_dtmf_t dtmf = {0, SWITCH_DEFAULT_DTMF_DURATION};
+
+ if (switch_strlen_zero(dtmf_str)) {
stream->write_function(stream, "No DTMF Supplied!\n");
} else {
switch_mutex_lock(globals.pvt_lock);
if (globals.call_list) {
switch_channel_t *channel = switch_core_session_get_channel(globals.call_list->session);
- switch_channel_queue_dtmf(channel, dtmf);
+ char *p = dtmf_str;
+ while(p && *p) {
+ dtmf.digit = *p;
+ switch_channel_queue_dtmf(channel, &dtmf);
+ p++;
+ }
}
switch_mutex_unlock(globals.pvt_lock);
}
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 Fri Dec 21 19:32:20 2007
@@ -1344,7 +1344,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF [%s]\n", dtmf);
- return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, dtmf, 100 * (tech_pvt->read_codec.implementation->samples_per_second / 1000));
+ return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, dtmf);
}
@@ -1416,9 +1416,9 @@
}
#endif
if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) {
- char dtmf[128];
- switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, dtmf, sizeof(dtmf));
- switch_channel_queue_dtmf(channel, dtmf);
+ switch_dtmf_t dtmf = { 0 };
+ switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, &dtmf);
+ switch_channel_queue_dtmf(channel, &dtmf);
}
@@ -2722,7 +2722,13 @@
case LDL_SIGNAL_MSG:
if (msg) {
if (*msg == '+') {
- switch_channel_queue_dtmf(channel, msg + 1);
+ char *p = msg + 1;
+ switch_dtmf_t dtmf = { 0, SWITCH_DEFAULT_DTMF_DURATION };
+ while (p && *p) {
+ dtmf.digit = *p;
+ switch_channel_queue_dtmf(channel, &dtmf);
+ p++;
+ }
switch_set_flag_locked(tech_pvt, TFLAG_DTMF);
if (switch_rtp_ready(tech_pvt->rtp_session)) {
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_BREAK);
Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c Fri Dec 21 19:32:20 2007
@@ -620,17 +620,14 @@
}
-static switch_status_t channel_send_dtmf(switch_core_session_t *session, char *dtmf)
+static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
{
private_t *tech_pvt = NULL;
- char *digit;
-
+
tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
if (tech_pvt->iax_session) {
- for (digit = dtmf; *digit; digit++) {
- iax_send_dtmf(tech_pvt->iax_session, *digit);
- }
+ iax_send_dtmf(tech_pvt->iax_session, dtmf->digit);
}
return SWITCH_STATUS_SUCCESS;
@@ -1206,11 +1203,12 @@
break;
case IAX_EVENT_DTMF:
if (channel) {
- char str[2] = { (char) iaxevent->subclass };
+ switch_dtmf_t dtmf = { (char) iaxevent->subclass , SWITCH_DEFAULT_DTMF_DURATION };
if (globals.debug) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s DTMF %s\n", str, switch_channel_get_name(channel));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%c DTMF %s\n", dtmf.digit, switch_channel_get_name(channel));
}
- switch_channel_queue_dtmf(channel, str);
+
+ switch_channel_queue_dtmf(channel, &dtmf);
}
break;
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 Fri Dec 21 19:32:20 2007
@@ -524,14 +524,14 @@
}
-static switch_status_t channel_send_dtmf(switch_core_session_t *session, char *dtmf)
+static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
{
private_t *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF ON CALL %s [%s]\n", tech_pvt->call_id, dtmf);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF ON CALL %s [%c]\n", tech_pvt->call_id, dtmf->digit);
return SWITCH_STATUS_SUCCESS;
}
@@ -1314,18 +1314,23 @@
-
static switch_status_t dtmf_call(char **argv, int argc, switch_stream_handle_t *stream)
{
- char *dtmf = argv[0];
-
- if (switch_strlen_zero(dtmf)) {
+ char *dtmf_str = argv[0];
+ switch_dtmf_t dtmf = {0, SWITCH_DEFAULT_DTMF_DURATION};
+
+ if (switch_strlen_zero(dtmf_str)) {
stream->write_function(stream, "No DTMF Supplied!\n");
} else {
switch_mutex_lock(globals.pvt_lock);
if (globals.call_list) {
switch_channel_t *channel = switch_core_session_get_channel(globals.call_list->session);
- switch_channel_queue_dtmf(channel, dtmf);
+ char *p = dtmf_str;
+ while(p && *p) {
+ dtmf.digit = *p;
+ switch_channel_queue_dtmf(channel, &dtmf);
+ p++;
+ }
}
switch_mutex_unlock(globals.pvt_lock);
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Fri Dec 21 19:32:20 2007
@@ -540,9 +540,9 @@
payload = tech_pvt->read_frame.payload;
if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) {
- char dtmf[128];
- switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, dtmf, sizeof(dtmf));
- switch_channel_queue_dtmf(channel, dtmf);
+ switch_dtmf_t dtmf = {0};
+ switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, &dtmf);
+ switch_channel_queue_dtmf(channel, &dtmf);
}
@@ -696,15 +696,31 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t sofia_send_dtmf(switch_core_session_t *session, char *digits)
+static switch_status_t sofia_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
{
private_object_t *tech_pvt;
+ char message[128] = "";
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
- return switch_rtp_queue_rfc2833(tech_pvt->rtp_session,
- digits, tech_pvt->profile->dtmf_duration * (tech_pvt->read_codec.implementation->samples_per_second / 1000));
+ switch (tech_pvt->dtmf_type) {
+ case DTMF_2833:
+ return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, dtmf);
+
+ case DTMF_INFO:
+ snprintf(message, sizeof(message), "Signal=%c\r\nDuration=%d\r\n", dtmf->digit, dtmf->duration);
+ nua_info(tech_pvt->nh,
+ //NUTAG_WITH_THIS(tech_pvt->profile->nua),
+ SIPTAG_CONTENT_TYPE_STR("application/dtmf-relay"),
+ SIPTAG_PAYLOAD_STR(message),
+ TAG_END());
+ break;
+ default:
+ break;
+ }
+
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t sofia_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Fri Dec 21 19:32:20 2007
@@ -83,6 +83,13 @@
#include <sofia-sip/nea.h>
#include <sofia-sip/msg_addr.h>
+
+typedef enum {
+ DTMF_2833,
+ DTMF_INFO,
+ DTMF_NONE
+} sofia_dtmf_t;
+
struct sofia_private {
char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
sofia_gateway_t *gateway;
@@ -232,6 +239,8 @@
char *tls_cert_dir;
char *reg_domain;
char *user_agent;
+ char *record_template;
+ sofia_dtmf_t dtmf_type;
int sip_port;
int tls_sip_port;
char *codec_string;
@@ -357,6 +366,7 @@
switch_payload_t video_agreed_pt;
char *video_fmtp_out;
uint32_t video_count;
+ sofia_dtmf_t dtmf_type;
};
struct callback_t {
@@ -547,3 +557,4 @@
const char *sofia_glue_transport2str(const sofia_transport_t tp);
int sofia_glue_transport_has_tls(const sofia_transport_t tp);
+const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name);
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Fri Dec 21 19:32:20 2007
@@ -884,6 +884,16 @@
} else if (!strcasecmp(var, "user-agent-string")) {
profile->user_agent = switch_core_strdup(profile->pool, val);;
+ } else if (!strcasecmp(var, "dtmf-type")) {
+ if (!strcasecmp(val, "rfc2833")) {
+ profile->dtmf_type = DTMF_2833;
+ } else if (!strcasecmp(val, "info")) {
+ profile->dtmf_type = DTMF_INFO;
+ } else {
+ profile->dtmf_type = DTMF_NONE;
+ }
+ } else if (!strcasecmp(var, "record-template")) {
+ profile->record_template = switch_core_strdup(profile->pool, val);;
} else if (!strcasecmp(var, "inbound-no-media") && switch_true(val)) {
switch_set_flag(profile, TFLAG_INB_NOMEDIA);
} else if (!strcasecmp(var, "inbound-late-negotiation") && switch_true(val)) {
@@ -1916,57 +1926,108 @@
{
struct private_object *tech_pvt = NULL;
switch_channel_t *channel = NULL;
- char dtmf_digit[2] = { 0, 0 };
-
/* placeholder for string searching */
char *signal_ptr;
+ const char *rec_header;
- /* Try and find signal information in the payload */
- signal_ptr = strstr(sip->sip_payload->pl_data, "Signal=");
+ if (session) {
+ /* Get the channel */
+ channel = switch_core_session_get_channel(session);
- /* unknown info type */
- if (!signal_ptr) {
- sip_from_t const *from = sip->sip_from;
-
- /* print in the logs if something comes through we don't understand */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unknown INFO Recieved: %s%s" URL_PRINT_FORMAT "[%s]\n",
- from->a_display ? from->a_display : "",
- from->a_display ? " " : "",
- URL_PRINT_ARGS(from->a_url),
- sip->sip_payload->pl_data);
- /* Send 415 Unsupported Media response */
- nua_respond(nh, SIP_415_UNSUPPORTED_MEDIA, NUTAG_WITH_THIS(nua), TAG_END());
- return;
- }
+ /* Barf if we didn't get it */
+ switch_assert(channel != NULL);
+
+ /* make sure we have our privates */
+ tech_pvt = switch_core_session_get_private(session);
+
+ /* Barf if we didn't get it */
+ switch_assert(tech_pvt != NULL);
- /* Get the channel */
- channel = switch_core_session_get_channel(session);
- /* Barf if we didn't get it */
- switch_assert(channel != NULL);
+ if (sip && sip->sip_payload && sip->sip_payload->pl_data) {
+ switch_dtmf_t dtmf = { 0, SWITCH_DEFAULT_DTMF_DURATION };
- /* make sure we have our privates */
- tech_pvt = switch_core_session_get_private(session);
+ /* Try and find signal information in the payload */
+ if ((signal_ptr = strstr(sip->sip_payload->pl_data, "Signal="))) {
+ /* move signal_ptr where we need it (right past Signal=) */
+ signal_ptr = signal_ptr + 7;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Bad signal\n");
+ return;
+ }
+
+ /* unknown info type */
+ if (!signal_ptr) {
+ sip_from_t const *from = sip->sip_from;
+
+ /* print in the logs if something comes through we don't understand */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unknown INFO Recieved: %s%s" URL_PRINT_FORMAT "[%s]\n",
+ from->a_display ? from->a_display : "",
+ from->a_display ? " " : "",
+ URL_PRINT_ARGS(from->a_url),
+ sip->sip_payload->pl_data);
+ /* Send 415 Unsupported Media response */
+ nua_respond(nh, SIP_415_UNSUPPORTED_MEDIA, NUTAG_WITH_THIS(nua), TAG_END());
+ return;
+ }
- /* Barf if we didn't get it */
- switch_assert(tech_pvt != NULL);
+
+ dtmf.digit = *signal_ptr;
+ if ((signal_ptr = strstr(sip->sip_payload->pl_data, "Duration="))) {
+ int tmp;
+ signal_ptr += 8;
+ if ((tmp = atoi(signal_ptr)) < 0) {
+ tmp = SWITCH_DEFAULT_DTMF_DURATION;
+ }
+ dtmf.duration = tmp;
+ }
- /* move signal_ptr where we need it (right past Signal=) */
- signal_ptr = signal_ptr + 7;
+ /* queue it up */
+ switch_channel_queue_dtmf(channel, &dtmf);
- /* put the digit somewhere we can muck with */
- strncpy(dtmf_digit, signal_ptr, 1);
+ /* print debug info */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "INFO DTMF(%c)\n", dtmf.digit);
- /* queue it up */
- switch_channel_queue_dtmf(channel, dtmf_digit);
+ /* Send 200 OK response */
+ nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
+
+ return;
+ }
- /* print debug info */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "INFO DTMF(%s)\n", dtmf_digit);
+ if ((rec_header = sofia_glue_get_unknown_header(sip, "record"))) {
+ if (switch_strlen_zero(profile->record_template)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Record attempted but no template defined.\n");
+ nua_respond(nh, 488, "Recording not enabled", NUTAG_WITH_THIS(nua), TAG_END());
+ } else {
+ if (!strcasecmp(rec_header, "on")) {
+ char *file;
- /* Send 200 OK response */
- nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
+ file = switch_channel_expand_variables(channel, profile->record_template);
+ switch_ivr_record_session(session, file, 0, NULL);
+ switch_channel_set_variable(channel, "sofia_record_file", file);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Recording %s to %s\n", switch_channel_get_name(channel), file);
+ nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
+ if (file != profile->record_template) {
+ free(file);
+ file = NULL;
+ }
+ } else {
+ const char *file;
+
+ if ((file = switch_channel_get_variable(channel, "sofia_record_file"))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Done recording %s to %s\n", switch_channel_get_name(channel), file);
+ switch_ivr_stop_record_session(session, file);
+ nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
+ } else {
+ nua_respond(nh, 488, "Nothing to stop", NUTAG_WITH_THIS(nua), TAG_END());
+ }
+ }
+ }
+
+ return;
+ }
+ }
- return;
}
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 Fri Dec 21 19:32:20 2007
@@ -347,6 +347,10 @@
tech_pvt->te = profile->te;
}
+
+ tech_pvt->dtmf_type = profile->dtmf_type;
+
+
if (tech_pvt->bcng_pt) {
tech_pvt->cng_pt = tech_pvt->bcng_pt;
} else if (!tech_pvt->cng_pt) {
@@ -387,6 +391,20 @@
return SWITCH_STATUS_SUCCESS;
}
+
+const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name)
+{
+ sip_unknown_t *un;
+ for (un = sip->sip_unknown; un; un = un->un_next) {
+ if (!strcasecmp(un->un_name, name)) {
+ if (!switch_strlen_zero(un->un_value)) {
+ return un->un_value;
+ }
+ }
+ }
+ return NULL;
+}
+
switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt)
{
char *ip = tech_pvt->profile->rtpip;
@@ -1097,6 +1115,16 @@
flags |= SWITCH_RTP_FLAG_BUGGY_2833;
}
+ if ((val = switch_channel_get_variable(tech_pvt->channel, "dtmf_type"))) {
+ if (!strcasecmp(val, "rfc2833")) {
+ tech_pvt->dtmf_type = DTMF_2833;
+ } else if (!strcasecmp(val, "info")) {
+ tech_pvt->dtmf_type = DTMF_INFO;
+ } else {
+ tech_pvt->dtmf_type = tech_pvt->profile->dtmf_type;
+ }
+ }
+
if ((tech_pvt->profile->pflags & PFLAG_PASS_RFC2833)
|| ((val = switch_channel_get_variable(tech_pvt->channel, "pass_rfc2833")) && switch_true(val))) {
flags |= SWITCH_RTP_FLAG_PASS_RFC2833;
Modified: freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c Fri Dec 21 19:32:20 2007
@@ -810,7 +810,13 @@
teletone_dtmf_get(&tech_pvt->dtmf_detect, digit_str, sizeof(digit_str));
if(digit_str[0]) {
- switch_channel_queue_dtmf(channel, digit_str);
+ char *p = digit_str;
+ switch_dtmf_t dtmf = {0, globals.dtmf_on};
+ while(p && *p) {
+ dtmf.digit = *p;
+ switch_channel_queue_dtmf(channel, &dtmf);
+ p++;
+ }
if (globals.debug) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF DETECTED: [%s]\n", digit_str);
}
@@ -876,13 +882,12 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t wanpipe_send_dtmf(switch_core_session_t *session, char *digits)
+static switch_status_t wanpipe_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
{
private_object_t *tech_pvt;
switch_channel_t *channel = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
int wrote = 0;
- char *cur = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -903,12 +908,13 @@
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "SUCCESS!\n");
}
}
- for (cur = digits; *cur; cur++) {
- if ((wrote = teletone_mux_tones(&tech_pvt->tone_session, &tech_pvt->tone_session.TONES[(int)*cur]))) {
- switch_buffer_write(tech_pvt->dtmf_buffer, tech_pvt->tone_session.buffer, wrote * 2);
- }
+
+ tech_pvt->tone_session.duration = dtmf.duration * (tech_pvt->tone_session.rate / 1000);
+ if ((wrote = teletone_mux_tones(&tech_pvt->tone_session, &tech_pvt->tone_session.TONES[(int)dtmf->digit]))) {
+ switch_buffer_write(tech_pvt->dtmf_buffer, tech_pvt->tone_session.buffer, wrote * 2);
}
+
tech_pvt->skip_read_frames = 200;
return status;
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Fri Dec 21 19:32:20 2007
@@ -1010,10 +1010,14 @@
return SWITCH_STATUS_FALSE;
}
break;
- case SWITCH_INPUT_TYPE_DTMF:
- dtmf = (char *) input;
- argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(cb_state->cx, "dtmf"));
- argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(cb_state->cx, dtmf));
+ case SWITCH_INPUT_TYPE_DTMF:
+ {
+ switch_dtmf_t *_dtmf = (switch_dtmf_t *) input;
+ dtmf[0] = _dtmf->digit;
+ dtmf[1] = '\0';
+ argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(cb_state->cx, "dtmf"));
+ argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(cb_state->cx, dtmf));
+ }
break;
}
@@ -1208,8 +1212,6 @@
static JSBool session_flush_digits(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
struct js_session *jss = JS_GetPrivate(cx, obj);
- char buf[256];
- switch_size_t has;
switch_channel_t *channel;
METHOD_SANITY_CHECK();
@@ -1217,9 +1219,7 @@
channel = switch_core_session_get_channel(jss->session);
switch_assert(channel != NULL);
- while ((has = switch_channel_has_dtmf(channel))) {
- switch_channel_dequeue_dtmf(channel, buf, sizeof(buf));
- }
+ switch_channel_flush_dtmf(channel);
*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
return JS_TRUE;
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c Fri Dec 21 19:32:20 2007
@@ -257,7 +257,7 @@
uintN aargc = 0;
jsval aargv[4];
- switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
+ switch_channel_dequeue_dtmf_string(channel, dtmf, sizeof(dtmf));
aargv[aargc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, dtmf));
JS_CallFunction(cx, obj, tto->function, aargc, aargv, &tto->ret);
ret = JS_GetStringBytes(JS_ValueToString(cx, tto->ret));
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Fri Dec 21 19:32:20 2007
@@ -104,7 +104,7 @@
struct switch_channel {
char *name;
- switch_buffer_t *dtmf_buffer;
+ switch_queue_t *dtmf_queue;
switch_mutex_t *dtmf_mutex;
switch_mutex_t *flag_mutex;
switch_mutex_t *profile_mutex;
@@ -186,7 +186,7 @@
switch_event_create(&(*channel)->variables, SWITCH_EVENT_MESSAGE);
switch_core_hash_init(&(*channel)->private_hash, pool);
- switch_buffer_create_dynamic(&(*channel)->dtmf_buffer, 128, 128, 0);
+ switch_queue_create(&(*channel)->dtmf_queue, 128, pool);
switch_mutex_init(&(*channel)->dtmf_mutex, SWITCH_MUTEX_NESTED, pool);
switch_mutex_init(&(*channel)->flag_mutex, SWITCH_MUTEX_NESTED, pool);
@@ -203,18 +203,16 @@
switch_assert(channel != NULL);
switch_mutex_lock(channel->dtmf_mutex);
- has = switch_buffer_inuse(channel->dtmf_buffer);
+ has = switch_queue_size(channel->dtmf_queue);
switch_mutex_unlock(channel->dtmf_mutex);
return has;
}
-SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *channel, const char *dtmf)
+SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *channel, const switch_dtmf_t *dtmf)
{
switch_status_t status;
- register switch_size_t len, inuse;
- switch_size_t wr = 0;
- const char *p;
+ void *pop;
switch_assert(channel != NULL);
@@ -224,23 +222,24 @@
goto done;
}
- inuse = switch_buffer_inuse(channel->dtmf_buffer);
- len = strlen(dtmf);
-
- if (len + inuse > switch_buffer_len(channel->dtmf_buffer)) {
- switch_buffer_toss(channel->dtmf_buffer, strlen(dtmf));
- }
-
- p = dtmf;
- while (wr < len && p) {
- if (is_dtmf(*p)) {
- wr++;
- } else {
- break;
+ if (is_dtmf(dtmf->digit)) {
+ switch_dtmf_t *dt;
+ int x = 0;
+
+ switch_zmalloc(dt, sizeof(*dt));
+ *dt = *dtmf;
+ while (switch_queue_trypush(channel->dtmf_queue, dt) != SWITCH_STATUS_SUCCESS) {
+ switch_queue_trypop(channel->dtmf_queue, &pop);
+ if (++x > 100) {
+ status = SWITCH_STATUS_FALSE;
+ free(dt);
+ goto done;
+ }
}
- p++;
}
- status = switch_buffer_write(channel->dtmf_buffer, dtmf, wr) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_MEMERR;
+
+
+ status = SWITCH_STATUS_SUCCESS;
done:
@@ -250,33 +249,64 @@
}
-SWITCH_DECLARE(switch_size_t) switch_channel_dequeue_dtmf(switch_channel_t *channel, char *dtmf, switch_size_t len)
+SWITCH_DECLARE(switch_status_t) switch_channel_dequeue_dtmf(switch_channel_t *channel, switch_dtmf_t *dtmf)
{
- switch_size_t bytes;
switch_event_t *event;
+ void *pop;
+ switch_dtmf_t *dt;
+ switch_status_t status = SWITCH_STATUS_FALSE;
switch_assert(channel != NULL);
switch_mutex_lock(channel->dtmf_mutex);
- if ((bytes = switch_buffer_read(channel->dtmf_buffer, dtmf, len)) > 0) {
- *(dtmf + bytes) = '\0';
+
+ if (switch_queue_trypop(channel->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
+ dt = (switch_dtmf_t *) pop;
+ *dtmf = *dt;
+ free(dt);
+ status = SWITCH_STATUS_SUCCESS;
}
switch_mutex_unlock(channel->dtmf_mutex);
-
- if (bytes && switch_event_create(&event, SWITCH_EVENT_DTMF) == SWITCH_STATUS_SUCCESS) {
+
+ if (status == SWITCH_STATUS_SUCCESS && switch_event_create(&event, SWITCH_EVENT_DTMF) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-String", "%s", dtmf);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Digit", "%c", dtmf->digit);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Duration", "%u", dtmf->duration);
switch_event_fire(&event);
}
- return bytes;
+ return status;
+
+}
+SWITCH_DECLARE(switch_size_t) switch_channel_dequeue_dtmf_string(switch_channel_t *channel, char *dtmf_str, switch_size_t len)
+{
+ switch_size_t x = 0;
+ switch_dtmf_t dtmf = {0};
+
+ memset(dtmf_str, 0, len);
+
+ while(x < len - 1 && switch_channel_dequeue_dtmf(channel, &dtmf) == SWITCH_STATUS_SUCCESS) {
+ dtmf_str[x++] = dtmf.digit;
+ }
+
+ return x;
+
+}
+
+SWITCH_DECLARE(void) switch_channel_flush_dtmf(switch_channel_t *channel)
+{
+ void *pop;
+ switch_mutex_lock(channel->dtmf_mutex);
+ while(switch_queue_trypop(channel->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
+ free(pop);
+ }
+ switch_mutex_unlock(channel->dtmf_mutex);
}
SWITCH_DECLARE(void) switch_channel_uninit(switch_channel_t *channel)
{
- switch_buffer_destroy(&channel->dtmf_buffer);
switch_core_hash_destroy(&channel->private_hash);
switch_event_destroy(&channel->variables);
}
Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c (original)
+++ freeswitch/trunk/src/switch_core.c Fri Dec 21 19:32:20 2007
@@ -145,9 +145,9 @@
SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname)
{
char *val;
- switch_mutex_lock(runtime.throttle_mutex);
+ switch_mutex_lock(runtime.global_mutex);
val = (char *) switch_core_hash_find(runtime.global_vars, varname);
- switch_mutex_unlock(runtime.throttle_mutex);
+ switch_mutex_unlock(runtime.global_mutex);
return val;
}
@@ -156,7 +156,7 @@
char *val;
if (varname) {
- switch_mutex_lock(runtime.throttle_mutex);
+ switch_mutex_lock(runtime.global_mutex);
val = (char *) switch_core_hash_find(runtime.global_vars, varname);
if (val) {
free(val);
@@ -166,7 +166,7 @@
} else {
switch_core_hash_delete(runtime.global_vars, varname);
}
- switch_mutex_unlock(runtime.throttle_mutex);
+ switch_mutex_unlock(runtime.global_mutex);
}
}
@@ -671,6 +671,7 @@
}
switch_assert(runtime.memory_pool != NULL);
switch_mutex_init(&runtime.throttle_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
+ switch_mutex_init(&runtime.global_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
switch_core_set_globals();
switch_core_session_init(runtime.memory_pool);
switch_core_hash_init(&runtime.global_vars, runtime.memory_pool);
Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c (original)
+++ freeswitch/trunk/src/switch_core_io.c Fri Dec 21 19:32:20 2007
@@ -881,7 +881,7 @@
}
-SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_session_t *session, const char *dtmf)
+SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
{
switch_io_event_hook_recv_dtmf_t *ptr;
switch_status_t status;
@@ -894,7 +894,7 @@
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_session_t *session, const char *dtmf)
+SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
{
switch_io_event_hook_send_dtmf_t *ptr;
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -907,28 +907,13 @@
}
if (session->endpoint_interface->io_routines->send_dtmf) {
- if (strchr(dtmf, 'w') || strchr(dtmf, 'W')) {
- const char *d;
- for (d = dtmf; d && *d; d++) {
- char digit[2] = { 0 };
-
- if (*d == 'w') {
- switch_yield(500000);
- continue;
- } else if (*d == 'W') {
- switch_yield(1000000);
- continue;
- }
-
- digit[0] = *d;
- if ((status = session->endpoint_interface->io_routines->send_dtmf(session, digit)) != SWITCH_STATUS_SUCCESS) {
- return status;
- }
- }
+ if (dtmf->digit == 'w') {
+ switch_yield(500000);
+ } else if (dtmf->digit == 'W') {
+ switch_yield(1000000);
} else {
- status = session->endpoint_interface->io_routines->send_dtmf(session, (char *)dtmf);
+ status = session->endpoint_interface->io_routines->send_dtmf(session, dtmf);
}
-
}
return status;
Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c (original)
+++ freeswitch/trunk/src/switch_core_session.c Fri Dec 21 19:32:20 2007
@@ -565,7 +565,6 @@
SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session)
{
switch_channel_t *channel;
- char buf[256];
switch_size_t has;
/* clear resamplers*/
@@ -583,7 +582,7 @@
channel = switch_core_session_get_channel(session);
while ((has = switch_channel_has_dtmf(channel))) {
- switch_channel_dequeue_dtmf(channel, buf, sizeof(buf));
+ switch_channel_flush_dtmf(channel);
}
switch_ivr_deactivate_unicast(session);
Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp (original)
+++ freeswitch/trunk/src/switch_cpp.cpp Fri Dec 21 19:32:20 2007
@@ -398,9 +398,8 @@
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
- while ((has = switch_channel_has_dtmf(channel))) {
- switch_channel_dequeue_dtmf(channel, buf, sizeof(buf));
- }
+ switch_channel_flush_dtmf(channel);
+
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Fri Dec 21 19:32:20 2007
@@ -495,10 +495,10 @@
}
if (switch_channel_has_dtmf(channel)) {
- char dtmf[128];
- switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
+ switch_dtmf_t dtmf = {0};
+ switch_channel_dequeue_dtmf(channel, &dtmf);
if (args && args->input_callback) {
- if ((status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) {
break;
}
}
@@ -552,7 +552,7 @@
while (switch_channel_ready(channel)) {
switch_frame_t *read_frame;
switch_event_t *event;
- char dtmf[128];
+ switch_dtmf_t dtmf = {0};
if (timeout) {
elapsed = (uint32_t) ((switch_time_now() - started) / 1000);
@@ -566,8 +566,8 @@
}
if (switch_channel_has_dtmf(channel)) {
- switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
- status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+ switch_channel_dequeue_dtmf(channel, &dtmf);
+ status = args->input_callback(session, (void *)&dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
}
if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
@@ -639,17 +639,20 @@
}
if (switch_channel_has_dtmf(channel)) {
- char dtmf[128];
-
- switch_channel_dequeue_dtmf(channel, dtmf, maxdigits);
- for (i = 0; i < strlen(dtmf); i++) {
+ switch_dtmf_t dtmf = {0};
+ int y;
+
+ for (y = 0; y < maxdigits; y++) {
+ if (switch_channel_dequeue_dtmf(channel, &dtmf) != SWITCH_STATUS_SUCCESS) {
+ break;
+ }
- if (!switch_strlen_zero(terminators) && strchr(terminators, dtmf[i]) && terminator != NULL) {
- *terminator = dtmf[i];
+ if (!switch_strlen_zero(terminators) && strchr(terminators, dtmf.digit) && terminator != NULL) {
+ *terminator = dtmf.digit;
return SWITCH_STATUS_SUCCESS;
}
- buf[x++] = dtmf[i];
+ buf[x++] = dtmf.digit;
buf[x] = '\0';
if (x >= buflen || x >= maxdigits) {
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c (original)
+++ freeswitch/trunk/src/switch_ivr_async.c Fri Dec 21 19:32:20 2007
@@ -481,9 +481,9 @@
}
if ((flags & ED_DTMF) && switch_channel_has_dtmf(channel)) {
- char dtmf[128] = "";
- switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
- fcommand = dtmf;
+ switch_dtmf_t dtmf = {0};
+ switch_channel_dequeue_dtmf(channel, &dtmf);
+ *fcommand = dtmf.digit;
}
if (fcommand) {
@@ -717,7 +717,14 @@
teletone_dtmf_detect(&pvt->dtmf_detect, frame.data, frame.samples);
teletone_dtmf_get(&pvt->dtmf_detect, digit_str, sizeof(digit_str));
if (digit_str[0]) {
- switch_channel_queue_dtmf(channel, digit_str);
+ char *p = digit_str;
+ while(p && *p) {
+ switch_dtmf_t dtmf;
+ dtmf.digit = *p;
+ dtmf.duration = SWITCH_DEFAULT_DTMF_DURATION;
+ switch_channel_queue_dtmf(channel, &dtmf);
+ p++;
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF DETECTED: [%s]\n", digit_str);
}
}
@@ -804,7 +811,7 @@
}
-static switch_status_t generate_on_dtmf(switch_core_session_t *session, const char *dtmf)
+static switch_status_t generate_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
{
switch_media_bug_t *bug;
@@ -815,7 +822,9 @@
if (pvt) {
switch_mutex_lock(pvt->mutex);
- teletone_run(&pvt->ts, (char *)dtmf);
+ char buf[2] = "";
+ buf[0] = dtmf->digit;
+ teletone_run(&pvt->ts, buf);
switch_mutex_unlock(pvt->mutex);
return SWITCH_STATUS_FALSE;
}
Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c (original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c Fri Dec 21 19:32:20 2007
@@ -116,17 +116,20 @@
}
/* if 1 channel has DTMF pass it to the other */
- if (switch_channel_has_dtmf(chan_a)) {
- char dtmf[128];
- switch_channel_dequeue_dtmf(chan_a, dtmf, sizeof(dtmf));
- if (input_callback) {
- if (input_callback(session_a, dtmf, SWITCH_INPUT_TYPE_DTMF, user_data, 0) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s ended call via DTMF\n", switch_channel_get_name(chan_a));
- switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
- break;
+ while (switch_channel_has_dtmf(chan_a)) {
+ switch_dtmf_t dtmf = { 0, 0 };
+ if (switch_channel_dequeue_dtmf(chan_a, &dtmf) == SWITCH_STATUS_SUCCESS) {
+ if (input_callback) {
+ if (input_callback(session_a, (void *)&dtmf, SWITCH_INPUT_TYPE_DTMF, user_data, 0) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s ended call via DTMF\n", switch_channel_get_name(chan_a));
+ switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
+ break;
+ }
}
+
+
+ switch_core_session_send_dtmf(session_b, &dtmf);
}
- switch_core_session_send_dtmf(session_b, dtmf);
}
if (switch_core_session_dequeue_event(session_a, &event) == SWITCH_STATUS_SUCCESS) {
Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c (original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c Fri Dec 21 19:32:20 2007
@@ -338,7 +338,7 @@
switch_file_handle_t *fh, char *file, switch_input_args_t *args, uint32_t limit)
{
switch_channel_t *channel;
- char dtmf[128];
+ switch_dtmf_t dtmf = {0};
switch_file_handle_t lfh = { 0 };
switch_frame_t *read_frame;
switch_codec_t codec, *read_codec;
@@ -476,11 +476,11 @@
status = SWITCH_STATUS_BREAK;
break;
}
- switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
+ switch_channel_dequeue_dtmf(channel, &dtmf);
if (args->input_callback) {
- status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+ status = args->input_callback(session, (void *)&dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
} else {
- switch_copy_string((char *) args->buf, dtmf, args->buflen);
+ switch_copy_string((char *) args->buf, (void *)&dtmf, args->buflen);
status = SWITCH_STATUS_BREAK;
}
}
@@ -664,7 +664,7 @@
{
switch_channel_t *channel;
int16_t *abuf;
- char dtmf[128];
+ switch_dtmf_t dtmf = {0};
uint32_t interval = 0, samples = 0, framelen, sample_start = 0;
uint32_t ilen = 0;
switch_size_t olen = 0, llen = 0;
@@ -900,11 +900,11 @@
done = 1;
break;
}
- switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
+ switch_channel_dequeue_dtmf(channel, &dtmf);
if (args->input_callback) {
- status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+ status = args->input_callback(session, (void *)&dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
} else {
- switch_copy_string((char *) args->buf, dtmf, args->buflen);
+ switch_copy_string((char *) args->buf, (void *)&dtmf, args->buflen);
status = SWITCH_STATUS_BREAK;
}
}
@@ -1227,7 +1227,7 @@
{
switch_channel_t *channel;
short abuf[960];
- char dtmf[128];
+ switch_dtmf_t dtmf = {0};
uint32_t len = 0;
switch_size_t ilen = 0;
switch_frame_t write_frame = { 0 };
@@ -1357,11 +1357,11 @@
if (args->buf && !strcasecmp(args->buf, "_break_")) {
status = SWITCH_STATUS_BREAK;
} else {
- switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
+ switch_channel_dequeue_dtmf(channel, &dtmf);
if (args->input_callback) {
- status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+ status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
} else {
- switch_copy_string((char *) args->buf, dtmf, args->buflen);
+ switch_copy_string((char *) args->buf, (void *) &dtmf, args->buflen);
status = SWITCH_STATUS_BREAK;
}
}
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Fri Dec 21 19:32:20 2007
@@ -75,11 +75,6 @@
} rtp_msg_t;
-struct rfc2833_digit {
- char digit;
- int duration;
-};
-
struct switch_rtp_vad_data {
switch_core_session_t *session;
switch_codec_t vad_codec;
@@ -115,7 +110,7 @@
char last_digit;
unsigned int dc;
time_t last_digit_time;
- switch_buffer_t *dtmf_buffer;
+ switch_queue_t *dtmf_inqueue;
switch_mutex_t *dtmf_mutex;
};
@@ -497,7 +492,9 @@
switch_mutex_init(&rtp_session->flag_mutex, SWITCH_MUTEX_NESTED, pool);
switch_mutex_init(&rtp_session->dtmf_data.dtmf_mutex, SWITCH_MUTEX_NESTED, pool);
- switch_buffer_create_dynamic(&rtp_session->dtmf_data.dtmf_buffer, 128, 128, 0);
+ switch_queue_create(&rtp_session->dtmf_data.dtmf_queue, 100, rtp_session->pool);
+ switch_queue_create(&rtp_session->dtmf_data.dtmf_inqueue, 100, rtp_session->pool);
+
switch_rtp_set_flag(rtp_session, flags);
/* for from address on recvfrom calls */
@@ -696,11 +693,20 @@
SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
{
+ void *pop;
+
if (!switch_rtp_ready(*rtp_session)) {
return;
}
-
+ while(switch_queue_trypop((*rtp_session)->dtmf_data.dtmf_inqueue, &pop) == SWITCH_STATUS_SUCCESS) {
+ free(pop);
+ }
+
+ while(switch_queue_trypop((*rtp_session)->dtmf_data.dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
+ free(pop);
+ }
+
(*rtp_session)->ready = 0;
switch_mutex_lock((*rtp_session)->flag_mutex);
@@ -709,10 +715,6 @@
stfu_n_destroy(&(*rtp_session)->jb);
}
- if ((*rtp_session)->dtmf_data.dtmf_buffer) {
- switch_buffer_destroy(&(*rtp_session)->dtmf_data.dtmf_buffer);
- }
-
switch_rtp_kill_socket(*rtp_session);
switch_socket_close((*rtp_session)->sock);
(*rtp_session)->sock = NULL;
@@ -834,7 +836,7 @@
if (switch_queue_trypop(rtp_session->dtmf_data.dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
int x;
- struct rfc2833_digit *rdigit = pop;
+ switch_dtmf_t *rdigit = pop;
memset(rtp_session->dtmf_data.out_digit_packet, 0, 4);
rtp_session->dtmf_data.out_digit_sofar = 0;
@@ -1078,9 +1080,9 @@
rtp_session->dtmf_data.in_digit_seq = in_digit_seq;
if (duration && end) {
if (key != rtp_session->dtmf_data.last_digit) {
- char digit_str[] = { key, 0 };
+ switch_dtmf_t dtmf = { key, duration };
time(&rtp_session->dtmf_data.last_digit_time);
- switch_rtp_queue_dtmf(rtp_session, digit_str);
+ switch_rtp_queue_rfc2833_in(rtp_session, &dtmf);
switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_BREAK);
}
if (++rtp_session->dtmf_data.dc >= 3) {
@@ -1126,92 +1128,72 @@
if (switch_rtp_ready(rtp_session)) {
switch_mutex_lock(rtp_session->dtmf_data.dtmf_mutex);
- has = switch_buffer_inuse(rtp_session->dtmf_data.dtmf_buffer);
+ has = switch_queue_size(rtp_session->dtmf_data.dtmf_inqueue);
switch_mutex_unlock(rtp_session->dtmf_data.dtmf_mutex);
}
return has;
}
-SWITCH_DECLARE(switch_status_t) switch_rtp_queue_dtmf(switch_rtp_t *rtp_session, char *dtmf)
-{
- switch_status_t status;
- register switch_size_t len, inuse;
- switch_size_t wr = 0;
- char *p;
+SWITCH_DECLARE(switch_size_t) switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session, switch_dtmf_t *dtmf)
+{
+ switch_size_t bytes = 0;
+ switch_dtmf_t *_dtmf = NULL;
+ void *pop;
+
if (!switch_rtp_ready(rtp_session)) {
- return SWITCH_STATUS_FALSE;
+ return bytes;
}
switch_mutex_lock(rtp_session->dtmf_data.dtmf_mutex);
-
- inuse = switch_buffer_inuse(rtp_session->dtmf_data.dtmf_buffer);
- len = strlen(dtmf);
-
- if (len + inuse > switch_buffer_len(rtp_session->dtmf_data.dtmf_buffer)) {
- switch_buffer_toss(rtp_session->dtmf_data.dtmf_buffer, strlen(dtmf));
+ if (switch_queue_trypop(rtp_session->dtmf_data.dtmf_inqueue, &pop) == SWITCH_STATUS_SUCCESS) {
+ _dtmf = (switch_dtmf_t *) pop;
+ *dtmf = *_dtmf;
+ bytes++;
}
-
- p = dtmf;
- while (wr < len && p) {
- if (is_dtmf(*p)) {
- wr++;
- } else {
- break;
- }
- p++;
- }
-
- status = switch_buffer_write(rtp_session->dtmf_data.dtmf_buffer, dtmf, wr) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_MEMERR;
switch_mutex_unlock(rtp_session->dtmf_data.dtmf_mutex);
- return status;
+ return bytes;
}
-SWITCH_DECLARE(switch_size_t) switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session, char *dtmf, switch_size_t len)
+SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf)
{
- switch_size_t bytes = 0;
+
+ switch_dtmf_t *rdigit;
if (!switch_rtp_ready(rtp_session)) {
- return bytes;
+ return SWITCH_STATUS_FALSE;
}
- switch_mutex_lock(rtp_session->dtmf_data.dtmf_mutex);
- if ((bytes = switch_buffer_read(rtp_session->dtmf_data.dtmf_buffer, dtmf, len)) > 0) {
- *(dtmf + bytes) = '\0';
+ if ((rdigit = malloc(sizeof(*rdigit))) != 0) {
+ *rdigit = *dtmf;
+ switch_queue_push(rtp_session->dtmf_data.dtmf_queue, rdigit);
+ } else {
+ abort();
}
- switch_mutex_unlock(rtp_session->dtmf_data.dtmf_mutex);
-
- return bytes;
+
+ return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833(switch_rtp_t *rtp_session, char *digits, uint32_t duration)
+SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833_in(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf)
{
- char *c;
+
+ switch_dtmf_t *rdigit;
if (!switch_rtp_ready(rtp_session)) {
return SWITCH_STATUS_FALSE;
}
- if (!rtp_session->dtmf_data.dtmf_queue) {
- switch_queue_create(&rtp_session->dtmf_data.dtmf_queue, 100, rtp_session->pool);
- }
-
- for (c = digits; *c; c++) {
- struct rfc2833_digit *rdigit;
-
- if ((rdigit = malloc(sizeof(*rdigit))) != 0) {
- memset(rdigit, 0, sizeof(*rdigit));
- rdigit->digit = *c;
- rdigit->duration = duration;
- switch_queue_push(rtp_session->dtmf_data.dtmf_queue, rdigit);
- } else {
- return SWITCH_STATUS_MEMERR;
- }
+ if ((rdigit = malloc(sizeof(*rdigit))) != 0) {
+ *rdigit = *dtmf;
+ switch_queue_push(rtp_session->dtmf_data.dtmf_inqueue, rdigit);
+ } else {
+ abort();
}
+
return SWITCH_STATUS_SUCCESS;
}
1
0
Author: anthm
Date: Fri Dec 21 13:15:33 2007
New Revision: 6951
Modified:
freeswitch/trunk/src/switch_event.c
Log:
update
Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c (original)
+++ freeswitch/trunk/src/switch_event.c Fri Dec 21 13:15:33 2007
@@ -552,8 +552,10 @@
{
switch_event_header_t *hp, *lp = NULL;
switch_status_t status = SWITCH_STATUS_FALSE;
-
+ int x = 0;
for (hp = event->headers; hp; hp = hp->next) {
+ x++;
+ switch_assert(x < 1000);
if (!strcmp(header_name, hp->name)) {
if (lp) {
lp->next = hp->next;
@@ -562,6 +564,7 @@
}
FREE(hp->name);
FREE(hp->value);
+ memset(hp, 0, sizeof(*hp));
if (switch_queue_trypush(EVENT_HEADER_RECYCLE_QUEUE, hp) != SWITCH_STATUS_SUCCESS) {
FREE(hp);
}
@@ -606,11 +609,12 @@
event->headers = header;
} else {
for (hp = event->headers; hp && hp->next; hp = hp->next);
-
+
if (hp) {
hp->next = header;
} else {
event->headers = header;
+ header->next = NULL;
}
}
return SWITCH_STATUS_SUCCESS;
@@ -652,11 +656,13 @@
hp = hp->next;
FREE(this->name);
FREE(this->value);
+ memset(this, 0, sizeof(*this));
if (switch_queue_trypush(EVENT_HEADER_RECYCLE_QUEUE, this) != SWITCH_STATUS_SUCCESS) {
FREE(this);
}
}
FREE(ep->body);
+ memset(ep, 0, sizeof(*ep));
if (switch_queue_trypush(EVENT_RECYCLE_QUEUE, ep) != SWITCH_STATUS_SUCCESS) {
FREE(ep);
}
1
0