[commit] r2647 - in freeswitch/trunk/src: . include mod/applications/mod_bridgecall mod/applications/mod_commands mod/applications/mod_conference mod/languages/mod_spidermonkey
Author: anthm Date: Mon Sep 11 21:32:04 2006 New Revision: 2647 Modified: freeswitch/trunk/src/include/switch_ivr.h freeswitch/trunk/src/mod/applications/mod_bridgecall/mod_bridgecall.c freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c freeswitch/trunk/src/switch_ivr.c Log: pass cause from originate Modified: freeswitch/trunk/src/include/switch_ivr.h ============================================================================== --- freeswitch/trunk/src/include/switch_ivr.h (original) +++ freeswitch/trunk/src/include/switch_ivr.h Mon Sep 11 21:32:04 2006 @@ -189,6 +189,7 @@ \brief Make an outgoing call \param session originating session \param bleg B leg session + \param cause a pointer to hold call cause \param bridgeto the desired remote callstring \param timelimit_sec timeout in seconds for outgoing call \param table optional state handler table to install on the channel @@ -199,6 +200,7 @@ */ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *session, switch_core_session_t **bleg, + switch_call_cause_t *cause, char *bridgeto, uint32_t timelimit_sec, const switch_state_handler_table_t *table, Modified: freeswitch/trunk/src/mod/applications/mod_bridgecall/mod_bridgecall.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_bridgecall/mod_bridgecall.c (original) +++ freeswitch/trunk/src/mod/applications/mod_bridgecall/mod_bridgecall.c Mon Sep 11 21:32:04 2006 @@ -42,6 +42,7 @@ switch_core_session_t *peer_session; unsigned int timelimit = 60; char *var; + switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING; caller_channel = switch_core_session_get_channel(session); assert(caller_channel != NULL); @@ -50,7 +51,7 @@ timelimit = atoi(var); } - if (switch_ivr_originate(session, &peer_session, data, timelimit, NULL, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) { + if (switch_ivr_originate(session, &peer_session, &cause, data, timelimit, NULL, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel!\n"); switch_channel_hangup(caller_channel, SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL); return; 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 Mon Sep 11 21:32:04 2006 @@ -217,7 +217,7 @@ int x, argc = 0; char *aleg, *exten, *dp, *context, *cid_name, *cid_num; uint32_t timeout = 60; - + switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING; if (isession) { stream->write_function(stream, "Illegal Usage\n"); return SWITCH_STATUS_SUCCESS; @@ -260,7 +260,7 @@ return SWITCH_STATUS_SUCCESS; } - if (switch_ivr_originate(NULL, &caller_session, aleg, timeout, &noop_state_handler, cid_name, cid_num, NULL) != SWITCH_STATUS_SUCCESS) { + if (switch_ivr_originate(NULL, &caller_session, &cause, aleg, timeout, &noop_state_handler, cid_name, cid_num, NULL) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "Cannot Create Outgoing Channel! [%s]\n", aleg); return SWITCH_STATUS_SUCCESS; } 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 Mon Sep 11 21:32:04 2006 @@ -2044,13 +2044,21 @@ switch_status_t status = SWITCH_STATUS_SUCCESS; switch_channel_t *caller_channel = NULL; char appdata[512]; + switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING; - - if (switch_ivr_originate(session, &peer_session, bridgeto, timeout, &audio_bridge_peer_state_handlers, cid_name, cid_num, NULL) != SWITCH_STATUS_SUCCESS) { + if (switch_ivr_originate(session, + &peer_session, + &cause, + bridgeto, + timeout, + &audio_bridge_peer_state_handlers, + cid_name, + cid_num, + NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel!\n"); if (session) { caller_channel = switch_core_session_get_channel(session); - switch_channel_hangup(caller_channel, SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL); + switch_channel_hangup(caller_channel, cause); } goto done; } 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 Mon Sep 11 21:32:04 2006 @@ -1390,6 +1390,7 @@ { switch_memory_pool_t *pool = NULL; if (argc > 1) { + switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING; struct js_session *jss = NULL; JSObject *session_obj; switch_core_session_t *session = NULL, *peer_session = NULL; @@ -1471,7 +1472,7 @@ context, dest); - if (switch_ivr_originate(session, &peer_session, dest, to ? atoi(to) : 60, NULL, NULL, NULL, caller_profile) != SWITCH_STATUS_SUCCESS) { + if (switch_ivr_originate(session, &peer_session, &cause, dest, to ? atoi(to) : 60, NULL, NULL, NULL, caller_profile) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot Create Outgoing Channel! [%s]\n", dest); return JS_TRUE; } Modified: freeswitch/trunk/src/switch_ivr.c ============================================================================== --- freeswitch/trunk/src/switch_ivr.c (original) +++ freeswitch/trunk/src/switch_ivr.c Mon Sep 11 21:32:04 2006 @@ -1534,6 +1534,7 @@ #define MAX_PEERS 256 SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *session, switch_core_session_t **bleg, + switch_call_cause_t *cause, char *bridgeto, uint32_t timelimit_sec, const switch_state_handler_table_t *table, @@ -1849,6 +1850,11 @@ done: + if (caller_channel) { + *cause = switch_channel_get_cause(caller_channel); + } else { + *cause = SWITCH_CAUSE_CHANNEL_UNACCEPTABLE; + } if (odata) { free(odata); }
participants (1)
-
Freeswitch SVN