[Freeswitch-svn] [commit] r4181 - in freeswitch/trunk: conf src src/include src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_iax src/mod/endpoints/mod_portaudio src/mod/endpoints/mod_sofia src/mod/endpoints/mod_wanpipe src/mod/endpoints/mod_woomera
Freeswitch SVN
anthm at freeswitch.org
Fri Feb 9 15:03:07 EST 2007
Author: anthm
Date: Fri Feb 9 15:03:07 2007
New Revision: 4181
Modified:
freeswitch/trunk/conf/wanpipe.conf.xml
freeswitch/trunk/src/include/switch_core.h
freeswitch/trunk/src/include/switch_module_interfaces.h
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_wanpipe/mod_wanpipe.c
freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c
freeswitch/trunk/src/switch_core.c
freeswitch/trunk/src/switch_ivr.c
Log:
update core
Modified: freeswitch/trunk/conf/wanpipe.conf.xml
==============================================================================
--- freeswitch/trunk/conf/wanpipe.conf.xml (original)
+++ freeswitch/trunk/conf/wanpipe.conf.xml Fri Feb 9 15:03:07 2007
@@ -2,7 +2,7 @@
<settings>
<param name="debug" value="0"/>
<param name="dialplan" value="XML"/>
- <param name="mtu" value="320"/>
+ <param name="ms-per-frame" value="20"/>
<param name="dtmf-on" value="800"/>
<param name="dtmf-off" value="100"/>
<param name="supress-dtmf-tone" value="yes"/>
Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h (original)
+++ freeswitch/trunk/src/include/switch_core.h Fri Feb 9 15:03:07 2007
@@ -612,13 +612,13 @@
\param caller_profile the originator's caller profile
\param new_session a NULL pointer to aim at the newly created session
\param pool optional existing memory pool to donate to the session
- \return SWITCH_STATUS_SUCCESS if the session was created
+ \return the cause code of the attempted call
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_outgoing_channel(switch_core_session_t *session,
- char *endpoint_name,
- switch_caller_profile_t *caller_profile,
- switch_core_session_t **new_session,
- switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_core_session_t *session,
+ char *endpoint_name,
+ switch_caller_profile_t *caller_profile,
+ switch_core_session_t **new_session,
+ switch_memory_pool_t *pool);
/*!
\brief Answer the channel of a given session
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 Feb 9 15:03:07 2007
@@ -172,7 +172,7 @@
/*! \brief A table of i/o routines that an endpoint interface can implement */
struct switch_io_routines {
/*! creates an outgoing session from given session, caller profile */
- switch_status_t (*outgoing_channel)(switch_core_session_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t *);
+ switch_call_cause_t (*outgoing_channel)(switch_core_session_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t *);
/*! answers the given session's channel */
switch_status_t (*answer_channel)(switch_core_session_t *);
/*! read a frame from a session */
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 Feb 9 15:03:07 2007
@@ -180,8 +180,8 @@
static switch_status_t channel_on_ring(switch_core_session_t *session);
static switch_status_t channel_on_loopback(switch_core_session_t *session);
static switch_status_t channel_on_transmit(switch_core_session_t *session);
-static switch_status_t channel_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t *pool);
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t *pool);
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
switch_io_flag_t flags, int stream_id);
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
@@ -1508,8 +1508,8 @@
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
-static switch_status_t channel_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t *pool)
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t *pool)
{
if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
struct private_object *tech_pvt;
@@ -1534,7 +1534,7 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid URL!\n");
terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_INVALID_NUMBER_FORMAT;
}
if ((dnis = strchr(callto, ':'))) {
@@ -1571,17 +1571,17 @@
if (!ldl_handle_ready(mdl_profile->handle)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doh! we are not logged in yet!\n");
terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
if (!(full_id = ldl_handle_probe(mdl_profile->handle, callto, user, idbuf, sizeof(idbuf)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unknown Recipient!\n");
- terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- return SWITCH_STATUS_GENERR;
+ terminate_session(new_session, __LINE__, SWITCH_CAUSE_NO_USER_RESPONSE);
+ return SWITCH_CAUSE_NO_USER_RESPONSE;
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unknown Profile!\n");
terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
@@ -1601,7 +1601,7 @@
} 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);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
if (outbound_profile) {
@@ -1616,7 +1616,7 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doh! no caller profile\n");
terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
switch_channel_set_flag(channel, CF_OUTBOUND);
@@ -1633,15 +1633,15 @@
ldl_session_set_value(dlsession, "caller_id_number", outbound_profile->caller_id_number);
tech_pvt->dlsession = dlsession;
if (!get_codecs(tech_pvt)) {
- terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- return SWITCH_STATUS_GENERR;
+ terminate_session(new_session, __LINE__, SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL);
+ return SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL;
}
switch_channel_set_state(channel, CS_INIT);
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_CAUSE_SUCCESS;
}
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
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 Feb 9 15:03:07 2007
@@ -426,8 +426,8 @@
static switch_status_t channel_on_ring(switch_core_session_t *session);
static switch_status_t channel_on_loopback(switch_core_session_t *session);
static switch_status_t channel_on_transmit(switch_core_session_t *session);
-static switch_status_t channel_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t *pool);
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t *pool);
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
switch_io_flag_t flags, int stream_id);
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
@@ -802,8 +802,8 @@
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
-static switch_status_t channel_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t *pool)
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t *pool)
{
if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
private_t *tech_pvt;
@@ -819,7 +819,7 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
if (outbound_profile) {
@@ -834,18 +834,18 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
if ((tech_pvt->iax_session = iax_session_new()) == 0) {
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
if (iax_set_codec(tech_pvt, tech_pvt->iax_session, &req, &cap, &samprate, IAX_QUERY) != SWITCH_STATUS_SUCCESS) {
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_BEARERCAPABILITY_NOTIMPL;
}
if (samprate) {
@@ -859,10 +859,10 @@
switch_channel_set_flag(channel, CF_OUTBOUND);
switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
switch_channel_set_state(channel, CS_INIT);
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_CAUSE_SUCCESS;
}
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
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 Feb 9 15:03:07 2007
@@ -142,9 +142,9 @@
static switch_status_t channel_on_ring(switch_core_session_t *session);
static switch_status_t channel_on_loopback(switch_core_session_t *session);
static switch_status_t channel_on_transmit(switch_core_session_t *session);
-static switch_status_t channel_outgoing_channel(switch_core_session_t *session,
- switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t *pool);
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+ switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t *pool);
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
switch_io_flag_t flags, int stream_id);
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
@@ -824,8 +824,8 @@
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
-static switch_status_t channel_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t *pool)
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t *pool)
{
if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
@@ -844,7 +844,7 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
if (outbound_profile) {
@@ -860,16 +860,16 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
switch_channel_set_flag(channel, CF_OUTBOUND);
switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
switch_channel_set_state(channel, CS_INIT);
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_CAUSE_SUCCESS;
}
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Fri Feb 9 15:03:07 2007
@@ -330,8 +330,8 @@
static switch_status_t sofia_on_transmit(switch_core_session_t *session);
-static switch_status_t sofia_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t *pool);
+static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t *pool);
static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
switch_io_flag_t flags, int stream_id);
@@ -1246,6 +1246,7 @@
return 501;
case SWITCH_CAUSE_NORMAL_UNSPECIFIED:
return 480;
+ case SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL:
case SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION:
case SWITCH_CAUSE_NETWORK_OUT_OF_ORDER:
case SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE:
@@ -2182,10 +2183,10 @@
}
-static switch_status_t sofia_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t *pool)
+static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t *pool)
{
- switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
switch_core_session_t *nsession;
char *data, *profile_name, *dest;
sofia_profile_t *profile;
@@ -2213,6 +2214,7 @@
if (!(dest = strchr(profile_name, '/'))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n");
terminate_session(&nsession, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER, __LINE__);
+ cause = SWITCH_CAUSE_INVALID_NUMBER_FORMAT;
goto done;
}
@@ -2221,6 +2223,7 @@
if (!(profile = (sofia_profile_t *) switch_core_hash_find(globals.profile_hash, profile_name))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Profile\n");
terminate_session(&nsession, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER, __LINE__);
+ cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
goto done;
}
@@ -2233,7 +2236,8 @@
tech_pvt->dest = switch_core_session_strdup(nsession, buf);
} else {
- terminate_session(&nsession, SWITCH_CAUSE_NO_ROUTE_DESTINATION, __LINE__);
+ cause = SWITCH_CAUSE_NO_ROUTE_DESTINATION;
+ terminate_session(&nsession, cause, __LINE__);
goto done;
}
} else if (!strchr(dest, '@')) {
@@ -2243,7 +2247,8 @@
tech_pvt->dest = switch_core_session_strdup(nsession, buf);
} else {
- terminate_session(&nsession, SWITCH_CAUSE_NO_ROUTE_DESTINATION, __LINE__);
+ cause = SWITCH_CAUSE_NO_ROUTE_DESTINATION;
+ terminate_session(&nsession, cause, __LINE__);
goto done;
}
} else {
@@ -2261,7 +2266,7 @@
switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
switch_channel_set_state(nchannel, CS_INIT);
*new_session = nsession;
- status = SWITCH_STATUS_SUCCESS;
+ cause = SWITCH_CAUSE_SUCCESS;
if (session) {
//char *val;
//switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -2269,7 +2274,7 @@
}
done:
- return status;
+ return cause;
}
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 Feb 9 15:03:07 2007
@@ -71,12 +71,12 @@
} TFLAGS;
-#define DEFAULT_MTU 160
+#define DEFAULT_SAMPLES_PER_FRAME 160
static struct {
int debug;
int panic;
- uint32_t mtu;
+ uint32_t samples_per_frame;
int dtmf_on;
int dtmf_off;
int supress_dtmf_tone;
@@ -92,7 +92,6 @@
int dchan;
unsigned int bchans;
int node;
- int mtu;
int pswitch;
char *dialplan;
unsigned int l1;
@@ -134,6 +133,7 @@
unsigned int skip_read_frames;
unsigned int skip_write_frames;
switch_mutex_t *flag_mutex;
+ int frame_size;
#ifdef DOTRACE
int fd;
int fd2;
@@ -296,8 +296,8 @@
static switch_status_t wanpipe_on_hangup(switch_core_session_t *session);
static switch_status_t wanpipe_on_loopback(switch_core_session_t *session);
static switch_status_t wanpipe_on_transmit(switch_core_session_t *session);
-static switch_status_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t *pool);
+static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t *pool);
static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
switch_io_flag_t flags, int stream_id);
static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
@@ -323,9 +323,8 @@
switch_channel_t *channel = NULL;
wanpipe_tdm_api_t tdm_api = {{0}};
int err = 0;
- unsigned int mtu_mru;
unsigned int rate = 8000;
- int new_mtu = ((globals.mtu / 8) / 2);
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -337,23 +336,11 @@
err = sangoma_tdm_set_codec(tech_pvt->wpsock->fd, &tdm_api, WP_SLINEAR);
- mtu_mru = sangoma_tdm_get_usr_mtu_mru(tech_pvt->wpsock->fd, &tdm_api);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WANPIPE INIT MTU is %d\n", mtu_mru);
-
- if (mtu_mru != globals.mtu) {
- sangoma_tdm_set_usr_period(tech_pvt->wpsock->fd, &tdm_api, 40);
- err = sangoma_tdm_set_usr_period(tech_pvt->wpsock->fd, &tdm_api, new_mtu);
- mtu_mru = sangoma_tdm_get_usr_mtu_mru(tech_pvt->wpsock->fd, &tdm_api);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ADJUSTED MTU AFTER SETTING IT TO %d is %d %d [%s]\n", new_mtu, mtu_mru, err, strerror(err));
- if (mtu_mru != globals.mtu) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure to adjust MTU\n");
- switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- return SWITCH_STATUS_FALSE;
- }
- }
+ sangoma_tdm_set_usr_period(tech_pvt->wpsock->fd, &tdm_api, globals.samples_per_frame / 8);
+ tech_pvt->frame_size = sangoma_tdm_get_usr_mtu_mru(tech_pvt->wpsock->fd, &tdm_api);
if (switch_core_codec_init
- (&tech_pvt->read_codec, "L16", NULL, rate, 20, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ (&tech_pvt->read_codec, "L16", NULL, rate, globals.samples_per_frame / 8, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n", switch_channel_get_name(channel));
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -361,7 +348,7 @@
}
if (switch_core_codec_init
- (&tech_pvt->write_codec, "L16", NULL, rate, 20, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ (&tech_pvt->write_codec, "L16", NULL, rate, globals.samples_per_frame / 8, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n", switch_channel_get_name(channel));
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -449,12 +436,14 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WANPIPE HANGUP\n");
if (!switch_test_flag(tech_pvt, TFLAG_NOSIG)) {
- pri_hangup(tech_pvt->spri->pri, tech_pvt->call, tech_pvt->cause);
+ pri_hangup(tech_pvt->spri->pri, tech_pvt->call, switch_channel_get_cause(channel));
pri_destroycall(tech_pvt->spri->pri, tech_pvt->call);
+ switch_mutex_lock(globals.channel_mutex);
if (chanmap->map[tech_pvt->callno]) {
chanmap->map[tech_pvt->callno][0] = '\0';
}
+ switch_mutex_unlock(globals.channel_mutex);
/*
pri_hangup(tech_pvt->spri->pri,
tech_pvt->hangup_event.hangup.call ? tech_pvt->hangup_event.hangup.call : tech_pvt->ring_event.ring.call,
@@ -521,7 +510,7 @@
switch_channel_t *channel = NULL;
uint8_t *bp;
uint32_t bytes = 0;
- int res = 0;
+ int bread = 0;
char digit_str[80];
channel = switch_core_session_get_channel(session);
@@ -530,7 +519,6 @@
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
-
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->wpsock->fd < 0) {
return SWITCH_STATUS_GENERR;
}
@@ -539,8 +527,7 @@
*frame = NULL;
memset(tech_pvt->databuf, 0, sizeof(tech_pvt->databuf));
- while (bytes < globals.mtu) {
-
+ while (bytes < globals.samples_per_frame * 2) {
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->wpsock->fd < 0) {
return SWITCH_STATUS_GENERR;
}
@@ -550,7 +537,7 @@
return SWITCH_STATUS_GENERR;
}
- if ((res = sangoma_readmsg_socket(tech_pvt->wpsock->fd,
+ if ((bread = sangoma_readmsg_socket(tech_pvt->wpsock->fd,
&tech_pvt->hdrframe,
sizeof(tech_pvt->hdrframe), bp, sizeof(tech_pvt->databuf) - bytes, 0)) < 0) {
if (errno == EBUSY) {
@@ -560,7 +547,7 @@
}
}
- bytes += res;
+ bytes += bread;
bp += bytes;
}
@@ -571,8 +558,8 @@
tech_pvt->read_frame.datalen = bytes;
tech_pvt->read_frame.samples = bytes / 2;
- res = teletone_dtmf_detect (&tech_pvt->dtmf_detect, tech_pvt->read_frame.data, tech_pvt->read_frame.samples);
- res = teletone_dtmf_get(&tech_pvt->dtmf_detect, digit_str, sizeof(digit_str));
+ teletone_dtmf_detect (&tech_pvt->dtmf_detect, tech_pvt->read_frame.data, tech_pvt->read_frame.samples);
+ teletone_dtmf_get(&tech_pvt->dtmf_detect, digit_str, sizeof(digit_str));
if(digit_str[0]) {
switch_channel_queue_dtmf(channel, digit_str);
@@ -622,8 +609,8 @@
return SWITCH_STATUS_GENERR;
}
- if ((bread = switch_buffer_read(tech_pvt->dtmf_buffer, dtmf, globals.mtu)) < globals.mtu) {
- while (bread < globals.mtu) {
+ if ((bread = switch_buffer_read(tech_pvt->dtmf_buffer, dtmf, tech_pvt->frame_size)) < tech_pvt->frame_size) {
+ while (bread < tech_pvt->frame_size) {
dtmf[bread++] = 0;
}
}
@@ -674,14 +661,14 @@
#endif
#ifdef DOTRACE
- write(tech_pvt->fd, bp, (int) globals.mtu);
+ write(tech_pvt->fd, bp, (int) tech_pvt->frame_size);
#endif
- towrite = bytes >= globals.mtu ? globals.mtu : bytes;
+ towrite = bytes >= tech_pvt->frame_size ? tech_pvt->frame_size : bytes;
- if (towrite < globals.mtu) {
- int diff = globals.mtu - towrite;
+ if (towrite < tech_pvt->frame_size) {
+ int diff = tech_pvt->frame_size - towrite;
memset(bp + towrite, 0, diff);
- towrite = globals.mtu;
+ towrite = tech_pvt->frame_size;
}
result = sangoma_sendmsg_socket(tech_pvt->wpsock->fd,
@@ -689,7 +676,7 @@
if (result < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Bad Write frame len %u write %d bytes returned %d (%s)!\n", towrite,
- globals.mtu, result, strerror(errno));
+ tech_pvt->frame_size, result, strerror(errno));
if (errno == EBUSY) {
continue;
}
@@ -846,8 +833,8 @@
};
-static switch_status_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t *pool)
+static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t *pool)
{
char *bchan = NULL;
char name[128] = "";
@@ -862,12 +849,12 @@
if (bchan) {
bchan++;
if (!bchan) {
- return SWITCH_STATUS_FALSE;
+ return SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL;
}
outbound_profile->destination_number++;
} else if (!globals.configured_spans) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error No Spans Configured.\n");
- return SWITCH_STATUS_FALSE;
+ SWITCH_CAUSE_NETWORK_OUT_OF_ORDER;
}
@@ -885,7 +872,7 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
@@ -902,17 +889,21 @@
num = caller_profile->destination_number;
if ((p = strchr(num, '/'))) {
*p++ = '\0';
- if (*num != 'a') {
+
+ if (*num == 'a') {
+ span = 1;
+ autospan = 1;
+ } else if (*num = 'A') {
+ span = MAX_SPANS - 1;
+ autospan = -1;
+ } else {
if (num && *num > 47 && *num < 58) {
span = atoi(num);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invlid Syntax\n");
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
- } else {
- span = 0;
- autospan = 1;
}
num = p;
if ((p = strchr(num, '/'))) {
@@ -926,13 +917,13 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invlid Syntax\n");
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
caller_profile->destination_number = p;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invlid Syntax\n");
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
}
}
@@ -946,64 +937,70 @@
if (!wp_open(tech_pvt, span, chan)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n", span, chan, strerror(errno));
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
switch_set_flag_locked(tech_pvt, TFLAG_NOSIG);
- snprintf(name, sizeof(name), "WanPipe/%s/nosig-%04x", bchan, rand() & 0xffff);
+ snprintf(name, sizeof(name), "WanPipe/%s/nosig", bchan);
switch_channel_set_name(channel, name);
switch_channel_set_caller_profile(channel, caller_profile);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid address\n");
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL;
}
} else {
switch_mutex_lock(globals.channel_mutex);
- do {
- if (autospan) {
- span++;
+ channo = 0;
+ while (!channo) {
+ if (autospan > 0 && span == MAX_SPANS - 1) {
+ break;
+ }
+
+ if (autospan < 0 && span == 0) {
+ break;
}
- if ((spri = &SPANS[span]->spri) && switch_test_flag(spri, SANGOMA_PRI_READY)) {
+
+ if (SPANS[span] && (spri = &SPANS[span]->spri) && switch_test_flag(spri, SANGOMA_PRI_READY)) {
chanmap = spri->private_info;
- if (channo == 0) {
- if (autochan > 0) {
- for(channo = 1; channo < SANGOMA_MAX_CHAN_PER_SPAN; channo++) {
- if ((SPANS[span]->bchans & (1 << channo)) && !chanmap->map[channo][0]) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel %d\n", channo);
- break;
- }
- }
- } else if (autochan < 0) {
- for(channo = SANGOMA_MAX_CHAN_PER_SPAN; channo > 0; channo--) {
- if ((SPANS[span]->bchans & (1 << channo)) && !chanmap->map[channo][0]) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel %d\n", channo);
- break;
- }
+
+ if (autochan > 0) {
+ for(channo = 1; channo < SANGOMA_MAX_CHAN_PER_SPAN; channo++) {
+ if ((SPANS[span]->bchans & (1 << channo)) && !chanmap->map[channo][0]) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel s%dc%d\n", span, channo);
+ goto done;
}
}
-
- if (channo <= 0 || channo == (SANGOMA_MAX_CHAN_PER_SPAN)) {
- channo = 0;
- break;
+ channo = 0;
+ } else if (autochan < 0) {
+ for(channo = SANGOMA_MAX_CHAN_PER_SPAN; channo > 0; channo--) {
+ if ((SPANS[span]->bchans & (1 << channo)) && !chanmap->map[channo][0]) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel s%dc%d\n", span, channo);
+ goto done;
+ }
}
+ channo = 0;
}
- if (channo) {
- break;
- }
}
- } while(autospan && span < MAX_SPANS && !spri && !channo);
+
+ if (autospan > 0) {
+ span++;
+ } else if (autospan < 0) {
+ span--;
+ }
+ }
+ done:
switch_mutex_unlock(globals.channel_mutex);
-
+
if (!spri || channo == 0 || channo == (SANGOMA_MAX_CHAN_PER_SPAN)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No Free Channels!\n");
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_SWITCH_CONGESTION;
}
if (spri && (tech_pvt->call = pri_new_call(spri->pri))) {
struct pri_sr *sr;
- snprintf(name, sizeof(name), "WanPipe/s%dc%d/%s-%04x", spri->span, channo, caller_profile->destination_number, rand() & 0xffff);
+ snprintf(name, sizeof(name), "WanPipe/s%dc%d/%s", spri->span, channo, caller_profile->destination_number);
switch_channel_set_name(channel, name);
switch_channel_set_caller_profile(channel, caller_profile);
sr = pri_sr_new();
@@ -1024,14 +1021,14 @@
if (pri_setup(spri->pri, tech_pvt->call , sr)) {
switch_core_session_destroy(new_session);
pri_sr_free(sr);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
if (!wp_open(tech_pvt, spri->span, channo)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd!\n");
switch_core_session_destroy(new_session);
pri_sr_free(sr);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
pri_sr_free(sr);
switch_copy_string(chanmap->map[channo],
@@ -1043,16 +1040,16 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
switch_channel_set_flag(channel, CF_OUTBOUND);
switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
switch_channel_set_state(channel, CS_INIT);
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_CAUSE_SUCCESS;
}
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
@@ -1144,9 +1141,12 @@
tech_pvt->cause = pevent->hangup.cause;
- switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+ switch_channel_hangup(channel, tech_pvt->cause);
+ switch_mutex_lock(globals.channel_mutex);
chanmap->map[pevent->hangup.channel][0] = '\0';
+ switch_mutex_unlock(globals.channel_mutex);
+
switch_core_session_rwunlock(session);
}
@@ -1190,6 +1190,7 @@
switch_core_session_message_t *msg;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d\n", spri->span, pevent->proceeding.channel);
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -1203,7 +1204,7 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
}
-
+
switch_core_session_rwunlock(session);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d but it's not in use?\n",
@@ -1463,7 +1464,7 @@
int current_span = 0, min_span = 0, max_span = 0;
switch_xml_t cfg, xml, settings, param, span;
- globals.mtu = DEFAULT_MTU;
+ globals.samples_per_frame = DEFAULT_SAMPLES_PER_FRAME;
globals.dtmf_on = 150;
globals.dtmf_off = 50;
@@ -1482,8 +1483,8 @@
if (!strcmp(var, "debug")) {
globals.debug = atoi(val);
- } else if (!strcmp(var, "mtu")) {
- globals.mtu = atoi(val);
+ } else if (!strcmp(var, "ms-per-frame")) {
+ globals.samples_per_frame = atoi(val) * 8;
} else if (!strcmp(var, "dtmf-on")) {
globals.dtmf_on = atoi(val);
} else if (!strcmp(var, "dtmf-off")) {
@@ -1578,14 +1579,6 @@
SPANS[current_span]->l1 = str2l1(val);
} else if (!strcmp(var, "dialplan")) {
set_global_dialplan(val);
- } else if (!strcmp(var, "mtu")) {
- int mtu = atoi(val);
-
- if (mtu >= 10 && mtu < 960) {
- SPANS[current_span]->mtu = mtu;
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid MTU (%s)!\n", val);
- }
}
}
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c Fri Feb 9 15:03:07 2007
@@ -169,7 +169,7 @@
static switch_status_t woomera_on_ring(switch_core_session_t *session);
static switch_status_t woomera_on_loopback(switch_core_session_t *session);
static switch_status_t woomera_on_transmit(switch_core_session_t *session);
-static switch_status_t woomera_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+static switch_call_cause_t woomera_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t *pool);
static switch_status_t woomera_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
switch_io_flag_t flags, int stream_id);
@@ -481,8 +481,8 @@
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
-static switch_status_t woomera_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t *pool)
+static switch_call_cause_t woomera_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t *pool)
{
if ((*new_session = switch_core_session_request(&woomera_endpoint_interface, pool)) != 0) {
struct private_object *tech_pvt;
@@ -500,7 +500,7 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
if (outbound_profile) {
@@ -516,16 +516,16 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
switch_core_session_destroy(new_session);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
switch_channel_set_flag(channel, CF_OUTBOUND);
switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
switch_channel_set_state(channel, CS_INIT);
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_CAUSE_SUCCESS;
}
- return SWITCH_STATUS_GENERR;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c (original)
+++ freeswitch/trunk/src/switch_core.c Fri Feb 9 15:03:07 2007
@@ -1542,21 +1542,22 @@
return session->stream_count;
}
-SWITCH_DECLARE(switch_status_t) switch_core_session_outgoing_channel(switch_core_session_t *session,
- char *endpoint_name,
- switch_caller_profile_t *caller_profile,
- switch_core_session_t **new_session,
- switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_core_session_t *session,
+ char *endpoint_name,
+ switch_caller_profile_t *caller_profile,
+ switch_core_session_t **new_session,
+ switch_memory_pool_t *pool)
{
switch_io_event_hook_outgoing_channel_t *ptr;
switch_status_t status = SWITCH_STATUS_FALSE;
const switch_endpoint_interface_t *endpoint_interface;
switch_channel_t *channel = NULL;
switch_caller_profile_t *outgoing_profile = caller_profile;
+ switch_call_cause_t cause = SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL;
if ((endpoint_interface = switch_loadable_module_get_endpoint_interface(endpoint_name)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not locate channel type %s\n", endpoint_name);
- return SWITCH_STATUS_FALSE;
+ return SWITCH_CAUSE_CHAN_NOT_IMPLEMENTED;
}
if (endpoint_interface->io_routines->outgoing_channel) {
@@ -1595,10 +1596,10 @@
}
}
- if ((status = endpoint_interface->io_routines->outgoing_channel(session,
- outgoing_profile,
- new_session,
- pool)) == SWITCH_STATUS_SUCCESS) {
+ if ((cause = endpoint_interface->io_routines->outgoing_channel(session,
+ outgoing_profile,
+ new_session,
+ pool)) == SWITCH_CAUSE_SUCCESS) {
if (session) {
for (ptr = session->event_hooks.outgoing_channel; ptr; ptr = ptr->next) {
if ((status = ptr->outgoing_channel(session, caller_profile, *new_session)) != SWITCH_STATUS_SUCCESS) {
@@ -1607,11 +1608,11 @@
}
}
} else {
- return status;
+ return cause;
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not locate outgoing channel interface for %s\n", endpoint_name);
- return SWITCH_STATUS_FALSE;
+ return SWITCH_CAUSE_CHAN_NOT_IMPLEMENTED;
}
if (*new_session) {
@@ -1688,7 +1689,7 @@
}
}
- return status;
+ return cause;
}
SWITCH_DECLARE(switch_status_t) switch_core_session_answer_channel(switch_core_session_t *session)
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Fri Feb 9 15:03:07 2007
@@ -2678,8 +2678,8 @@
}
}
- if (switch_core_session_outgoing_channel(session, chan_type, caller_profiles[i], &peer_sessions[i], pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel!\n");
+ if ((reason = switch_core_session_outgoing_channel(session, chan_type, caller_profiles[i], &peer_sessions[i], pool)) != SWITCH_CAUSE_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel! cause: %s\n", switch_channel_cause2str(reason));
if (pool) {
switch_core_destroy_memory_pool(&pool);
}
More information about the Freeswitch-svn
mailing list