mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 05:02:10 +00:00
pass cause from originate
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2647 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -42,6 +42,7 @@ static void audio_bridge_function(switch_core_session_t *session, char *data)
|
||||
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 @@ static void audio_bridge_function(switch_core_session_t *session, char *data)
|
||||
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;
|
||||
|
||||
@@ -217,7 +217,7 @@ static switch_status_t originate_function(char *cmd, switch_core_session_t *ises
|
||||
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 @@ static switch_status_t originate_function(char *cmd, switch_core_session_t *ises
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -2044,13 +2044,21 @@ static switch_status_t conference_outcall(conference_obj_t *conference,
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1390,6 +1390,7 @@ static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
|
||||
{
|
||||
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 @@ static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user