Skip to content

Commit

Permalink
Merge pull request #1134 from signalwire/add-dial-handle-to-enterpris…
Browse files Browse the repository at this point in the history
…e-originate

[core] Update switch_ivr_enterprise_originate() to accept optional switch_dial_handle_list_t instead of dialstring.
  • Loading branch information
andywolk committed Mar 23, 2021
2 parents 0cab42b + 877102d commit 4e581b0
Show file tree
Hide file tree
Showing 14 changed files with 1,082 additions and 20 deletions.
15 changes: 13 additions & 2 deletions src/include/switch_ivr.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2019, Anthony Minessale II <anthm@freeswitch.org>
* Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
Expand Down Expand Up @@ -525,7 +525,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess
const char *cid_num_override,
switch_caller_profile_t *caller_profile_override,
switch_event_t *ovars, switch_originate_flag_t flags,
switch_call_cause_t *cancel_cause);
switch_call_cause_t *cancel_cause,
switch_dial_handle_list_t *hl);

SWITCH_DECLARE(void) switch_ivr_bridge_display(switch_core_session_t *session, switch_core_session_t *peer_session);

Expand Down Expand Up @@ -1057,6 +1058,16 @@ SWITCH_DECLARE(switch_event_t *) switch_dial_handle_get_global_vars(switch_dial_
SWITCH_DECLARE(switch_event_t *) switch_dial_leg_get_vars(switch_dial_leg_t *leg);
SWITCH_DECLARE(const char *) switch_dial_leg_get_var(switch_dial_leg_t *leg, const char *key);
SWITCH_DECLARE(int) switch_dial_handle_get_total(switch_dial_handle_t *handle);
SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_serialize_json_obj(switch_dial_handle_list_t *hl, cJSON **json);
SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_serialize_json(switch_dial_handle_list_t *hl, char **str);
SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_create_json_obj(switch_dial_handle_list_t **handle, cJSON *json);
SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_create_json(switch_dial_handle_list_t **handle, const char *handle_string);
SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_create(switch_dial_handle_list_t **hl);
SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_create_handle(switch_dial_handle_list_t *hl, switch_dial_handle_t **handle);
SWITCH_DECLARE(void) switch_dial_handle_list_destroy(switch_dial_handle_list_t **hl);
SWITCH_DECLARE(void) switch_dial_handle_list_add_global_var(switch_dial_handle_list_t *hl, const char *var, const char *val);
SWITCH_DECLARE(void) switch_dial_handle_list_add_global_var_printf(switch_dial_handle_list_t *hl, const char *var, const char *fmt, ...);
SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_list_t *hl, switch_call_cause_t *cause);
SWITCH_DECLARE(switch_status_t) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh, switch_call_cause_t *cause);

SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_session_t *session,
Expand Down
4 changes: 3 additions & 1 deletion src/include/switch_types.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
* Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
Expand Down Expand Up @@ -2868,6 +2868,8 @@ typedef struct switch_dial_leg_s switch_dial_leg_t;
struct switch_dial_leg_list_s;
typedef struct switch_dial_leg_list_s switch_dial_leg_list_t;

struct switch_dial_handle_list_s;
typedef struct switch_dial_handle_list_s switch_dial_handle_list_t;

SWITCH_END_EXTERN_C
#endif
Expand Down
4 changes: 4 additions & 0 deletions src/mod/languages/mod_java/src/org/freeswitch/swig/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,8 @@ public boolean fire() {
return freeswitchJNI.Event_fire(swigCPtr, this);
}

public boolean merge(Event to_merge) {
return freeswitchJNI.Event_merge(swigCPtr, this, Event.getCPtr(to_merge), to_merge);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class freeswitchJNI {
public final static native boolean Event_addHeader(long jarg1, Event jarg1_, String jarg2, String jarg3);
public final static native boolean Event_delHeader(long jarg1, Event jarg1_, String jarg2);
public final static native boolean Event_fire(long jarg1, Event jarg1_);
public final static native boolean Event_merge(long jarg1, Event jarg1_, long jarg2, Event jarg2_);
public final static native void EventConsumer_events_set(long jarg1, EventConsumer jarg1_, long jarg2);
public final static native long EventConsumer_events_get(long jarg1, EventConsumer jarg1_);
public final static native void EventConsumer_e_event_id_set(long jarg1, EventConsumer jarg1_, long jarg2);
Expand Down
18 changes: 18 additions & 0 deletions src/mod/languages/mod_java/switch_swig_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,24 @@ SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_Event_1fire(J
}


SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_Event_1merge(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
jboolean jresult = 0 ;
Event *arg1 = (Event *) 0 ;
Event *arg2 = (Event *) 0 ;
bool result;

(void)jenv;
(void)jcls;
(void)jarg1_;
(void)jarg2_;
arg1 = *(Event **)&jarg1;
arg2 = *(Event **)&jarg2;
result = (bool)(arg1)->merge(arg2);
jresult = (jboolean)result;
return jresult;
}


SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1events_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
EventConsumer *arg1 = (EventConsumer *) 0 ;
switch_queue_t *arg2 = (switch_queue_t *) 0 ;
Expand Down
32 changes: 32 additions & 0 deletions src/mod/languages/mod_lua/mod_lua_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4961,6 +4961,37 @@ static int _wrap_Event_fire(lua_State* L) {
}


static int _wrap_Event_merge(lua_State* L) {
int SWIG_arg = 0;
Event *arg1 = (Event *) 0 ;
Event *arg2 = (Event *) 0 ;
bool result;

SWIG_check_num_args("Event::merge",2,2)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event::merge",1,"Event *");
if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("Event::merge",2,"Event *");

if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
SWIG_fail_ptr("Event_merge",1,SWIGTYPE_p_Event);
}


if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Event,0))){
SWIG_fail_ptr("Event_merge",2,SWIGTYPE_p_Event);
}

result = (bool)(arg1)->merge(arg2);
lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
return SWIG_arg;

if(0) SWIG_fail;

fail:
lua_error(L);
return SWIG_arg;
}


static void swig_delete_Event(void *obj) {
Event *arg1 = (Event *) obj;
delete arg1;
Expand Down Expand Up @@ -4991,6 +5022,7 @@ static swig_lua_method swig_Event_methods[]= {
{ "addHeader", _wrap_Event_addHeader},
{ "delHeader", _wrap_Event_delHeader},
{ "fire", _wrap_Event_fire},
{ "merge", _wrap_Event_merge},
{0,0}
};
static swig_lua_method swig_Event_meta[] = {
Expand Down

0 comments on commit 4e581b0

Please sign in to comment.