mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-30 15:14:17 +00:00
update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10898 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
b3d0a62c20
commit
1bda469485
6 files changed
+102
-39
No files matched your search
+20
-8
@@ -32,7 +32,6 @@
|
||||
*/
|
||||
|
||||
#include <esl.h>
|
||||
#include <sys/signal.h>
|
||||
|
||||
#ifndef HAVE_GETHOSTBYNAME_R
|
||||
extern int gethostbyname_r (const char *__name,
|
||||
@@ -367,6 +366,8 @@ esl_status_t esl_sendevent(esl_handle_t *handle, esl_event_t *event)
|
||||
send(handle->sock, "\n\n", 2, 0);
|
||||
|
||||
free(txt);
|
||||
|
||||
return ESL_SUCCESS;
|
||||
}
|
||||
|
||||
esl_status_t esl_execute(esl_handle_t *handle, const char *app, const char *arg, const char *uuid)
|
||||
@@ -390,7 +391,7 @@ esl_status_t esl_execute(esl_handle_t *handle, const char *app, const char *arg,
|
||||
|
||||
snprintf(send_buf, sizeof(send_buf), "%s\ncall-command: execute\n%s%s\n", cmd_buf, app_buf, arg_buf);
|
||||
|
||||
esl_send_recv(handle, send_buf);
|
||||
return esl_send_recv(handle, send_buf);
|
||||
}
|
||||
|
||||
esl_status_t esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback)
|
||||
@@ -452,7 +453,6 @@ esl_status_t esl_connect(esl_handle_t *handle, const char *host, esl_port_t port
|
||||
|
||||
struct hostent *result;
|
||||
char sendbuf[256];
|
||||
char recvbuf[256];
|
||||
int rval;
|
||||
const char *hval;
|
||||
|
||||
@@ -560,7 +560,7 @@ esl_status_t esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, esl_event_t
|
||||
{
|
||||
fd_set rfds, efds;
|
||||
struct timeval tv = { 0, ms * 1000 };
|
||||
int max, activity, i = 0;
|
||||
int max, activity;
|
||||
esl_status_t status = ESL_SUCCESS;
|
||||
|
||||
esl_mutex_lock(handle->mutex);
|
||||
@@ -820,21 +820,31 @@ esl_status_t esl_send(esl_handle_t *handle, const char *cmd)
|
||||
esl_log(ESL_LOG_DEBUG, "SEND\n%s\n", cmd);
|
||||
}
|
||||
|
||||
send(handle->sock, cmd, strlen(cmd), 0);
|
||||
if (send(handle->sock, cmd, strlen(cmd), 0)) {
|
||||
strerror_r(handle->errno, handle->err, sizeof(handle->err));
|
||||
return ESL_FAIL;
|
||||
}
|
||||
|
||||
if (!(*e == '\n' && *(e-1) == '\n')) {
|
||||
send(handle->sock, "\n\n", 2, 0);
|
||||
if (send(handle->sock, "\n\n", 2, 0)) {
|
||||
strerror_r(handle->errno, handle->err, sizeof(handle->err));
|
||||
return ESL_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return ESL_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
esl_status_t esl_send_recv(esl_handle_t *handle, const char *cmd)
|
||||
{
|
||||
const char *hval;
|
||||
|
||||
esl_status_t status;
|
||||
|
||||
esl_mutex_lock(handle->mutex);
|
||||
esl_send(handle, cmd);
|
||||
esl_recv_event(handle, &handle->last_sr_event);
|
||||
status = esl_recv_event(handle, &handle->last_sr_event);
|
||||
|
||||
if (handle->last_sr_event) {
|
||||
hval = esl_event_get_header(handle->last_sr_event, "reply-text");
|
||||
@@ -845,6 +855,8 @@ esl_status_t esl_send_recv(esl_handle_t *handle, const char *cmd)
|
||||
}
|
||||
|
||||
esl_mutex_unlock(handle->mutex);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <esl.h>
|
||||
#include <esl_event.h>
|
||||
|
||||
@@ -56,7 +57,7 @@ static char *my_dup(const char *s)
|
||||
/* make sure this is synced with the esl_event_types_t enum in esl_types.h
|
||||
also never put any new ones before EVENT_ALL
|
||||
*/
|
||||
static char *EVENT_NAMES[] = {
|
||||
static const char *EVENT_NAMES[] = {
|
||||
"CUSTOM",
|
||||
"CHANNEL_CREATE",
|
||||
"CHANNEL_DESTROY",
|
||||
@@ -277,7 +278,7 @@ esl_status_t esl_event_del_header(esl_event_t *event, const char *header_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t stack, const char *header_name, char *data)
|
||||
static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t stack, const char *header_name, char *data)
|
||||
{
|
||||
esl_event_header_t *header;
|
||||
esl_ssize_t hlen = -1;
|
||||
|
||||
@@ -149,15 +149,19 @@ typedef struct esl_event esl_event_t;
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/signal.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
#define esl_assert(_x) assert(_x)
|
||||
#define esl_safe_free(_x) if (_x) free(_x); _x = NULL
|
||||
#define esl_strlen_zero(s) (!s || *(s) == '\0')
|
||||
@@ -261,6 +265,7 @@ void esl_global_set_default_logger(int level);
|
||||
|
||||
size_t esl_url_encode(const char *url, char *buf, size_t len);
|
||||
char *esl_url_decode(char *s);
|
||||
const char *esl_stristr(const char *instr, const char *str);
|
||||
int esl_toupper(int c);
|
||||
int esl_tolower(int c);
|
||||
|
||||
|
||||
Reference in new issue
Block a user