FS-5794 --resolve

This commit is contained in:
Anthony Minessale 2013-09-16 19:56:02 -05:00
parent 52f4507619
commit 802794b9f1
2 changed files with 10 additions and 4 deletions

View File

@ -107,8 +107,9 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
protected:
char *last_data;
char time_buf[64];
switch_core_session_t *session;
public:
SWITCH_DECLARE_CONSTRUCTOR API(void);
SWITCH_DECLARE_CONSTRUCTOR API(CoreSession *s = NULL);
virtual SWITCH_DECLARE_CONSTRUCTOR ~ API();
SWITCH_DECLARE(const char *) execute(const char *command, const char *data = NULL);
SWITCH_DECLARE(const char *) executeString(const char *command);

View File

@ -215,8 +215,13 @@ SWITCH_DECLARE(void) IVRMenu::execute(CoreSession *session, const char *name)
switch_ivr_menu_execute(session->session, menu, (char *)name, NULL);
}
SWITCH_DECLARE_CONSTRUCTOR API::API()
SWITCH_DECLARE_CONSTRUCTOR API::API(CoreSession *s)
{
if (s) {
session = s->session;
} else {
session = NULL;
}
last_data = NULL;
}
@ -231,7 +236,7 @@ SWITCH_DECLARE(const char *) API::execute(const char *cmd, const char *arg)
switch_stream_handle_t stream = { 0 };
this_check("");
SWITCH_STANDARD_STREAM(stream);
switch_api_execute(cmd, arg, NULL, &stream);
switch_api_execute(cmd, arg, session, &stream);
switch_safe_free(last_data);
last_data = (char *) stream.data;
return last_data;
@ -267,7 +272,7 @@ SWITCH_DECLARE(const char *) API::executeString(const char *cmd)
switch_safe_free(last_data);
SWITCH_STANDARD_STREAM(stream);
switch_api_execute(mycmd, arg, NULL, &stream);
switch_api_execute(mycmd, arg, session, &stream);
last_data = (char *) stream.data;
switch_safe_free(mycmd);
return last_data;