提交 319d3661 authored 作者: Anthony Minessale's avatar Anthony Minessale

update

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5030 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 e90d0380
......@@ -254,11 +254,15 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
profile->s_root = su_root_create(NULL);
profile->home = su_home_new(sizeof(*profile->home));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating agent for %s\n", profile->name);
profile->nua = nua_create(profile->s_root, /* Event loop */
sofia_event_callback, /* Callback for processing events */
profile, /* Additional data to pass to callback */
NUTAG_URL(profile->bindurl), NTATAG_UDP_MTU(65536), TAG_END()); /* Last tag should always finish the sequence */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created agent for %s\n", profile->name);
nua_set_params(profile->nua,
//NUTAG_EARLY_MEDIA(1),
NUTAG_AUTOANSWER(0),
......@@ -275,6 +279,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("message-summary")),
SIPTAG_SUPPORTED_STR("100rel, precondition"), SIPTAG_USER_AGENT_STR(SOFIA_USER_AGENT), TAG_END());
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set params for %s\n", profile->name);
for (node = profile->aliases; node; node = node->next) {
node->nua = nua_create(profile->s_root, /* Event loop */
......@@ -301,6 +306,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
goto end;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "activated db for %s\n", profile->name);
switch_mutex_init(&profile->ireg_mutex, SWITCH_MUTEX_NESTED, profile->pool);
switch_mutex_init(&profile->gateway_mutex, SWITCH_MUTEX_NESTED, profile->pool);
......@@ -332,6 +338,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
sofia_presence_establish_presence(profile);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting thread for %s\n", profile->name);
while (mod_sofia_globals.running == 1) {
if (++ireg_loops >= IREG_SECONDS) {
sofia_reg_check_expire(profile, time(NULL));
......
......@@ -169,6 +169,9 @@ abyss_bool HandleHook(TSession * r)
}
if (switch_event_create(&stream.event, SWITCH_EVENT_API) == SWITCH_STATUS_SUCCESS) {
const char * const content_length = RequestHeaderValue(r, "content-length");
if (r->uri)
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-URI", "%s", r->uri);
if (r->query)
......@@ -187,6 +190,82 @@ abyss_bool HandleHook(TSession * r)
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-USER", "%s", r->user);
if (r->port)
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-PORT", "%u", r->port);
if (r->query || content_length) {
char *q, *qd;
char *next;
char *query = r->query;
char *name, *val;
char qbuf[8192] = "";
if (r->method == m_post && content_length) {
int len = atoi(content_length);
int qlen = 0;
if (len > 0) {
int succeeded;
char *qp = qbuf;
do {
int blen = r->conn->buffersize - r->conn->bufferpos;
if ((qlen + blen) > len) {
blen = len - qlen;
}
qlen += blen;
if ( qlen > sizeof(qbuf) ) {
break;
}
memcpy(qp, r->conn->buffer + r->conn->bufferpos, blen);
qp += blen;
if (qlen >= len) {
break;
}
} while ((succeeded = ConnRead(r->conn, r->server->timeout)));
query = qbuf;
}
}
if (query) {
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-QUERY", "%s", query);
qd = strdup(query);
assert(qd != NULL);
q = qd;
next = q;
do {
char *p;
if ((next = strchr(next, '&'))) {
*next++ = '\0';
}
for (p = q; p && *p; p++) {
if (*p == '+') {
*p = ' ';
}
}
switch_url_decode(q);
name = q;
if ((val = strchr(name, '='))) {
*val++ = '\0';
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, name, "%s", val);
}
q = next;
} while (q != NULL);
free(qd);
}
}
}
command = r->uri + 5;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论