mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-14 13:28:31 +00:00
allow system API command to capture output from the executed command
This commit is contained in:
1 parent
0a8e6129d8
commit
d7a37e9754
4 files changed
+157
-24
No files matched your search
@@ -4791,11 +4791,10 @@ SWITCH_STANDARD_API(system_function)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Executing command: %s\n", cmd);
|
||||
if (switch_system(cmd, SWITCH_TRUE) < 0) {
|
||||
if (switch_stream_system(cmd, stream) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Failed to execute command: %s\n", cmd);
|
||||
}
|
||||
stream->write_function(stream, "+OK\n");
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user