Merge branch 'master' of ssh://stash.freeswitch.org:7999/fs/freeswitch

This commit is contained in:
Steve Underwood 2015-04-16 23:52:19 +08:00
commit 6e247a3f3d
5 changed files with 59 additions and 25 deletions

View File

@ -453,7 +453,7 @@ Build-Depends: libperl-dev
## mod/event_handlers
Module: event_handler/mod_amqp
Module: event_handlers/mod_amqp
Description: Event handler to send events to an amqp server
AMQP event handler
Build-Depends: librabbitmq-dev

View File

@ -1805,6 +1805,7 @@ fi
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/abstraction.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/acl.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/alsa.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/amqp.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/blacklist.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/callcenter.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/cdr_csv.conf.xml

View File

@ -627,6 +627,28 @@ SWITCH_STANDARD_APP(rename_function)
}
}
#define TRANSFER_VARS_SYNTAX "<~variable_prefix|variable>"
SWITCH_STANDARD_APP(transfer_vars_function)
{
char *argv[1] = { 0 };
int argc;
char *lbuf = NULL;
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
switch_core_session_t *nsession = NULL;
switch_core_session_get_partner(session, &nsession);
if (nsession) {
switch_ivr_transfer_variable(session, nsession, argv[0]);
switch_core_session_rwunlock(nsession);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", TRANSFER_VARS_SYNTAX);
}
}
}
#define SOFT_HOLD_SYNTAX "<unhold key> [<moh_a>] [<moh_b>]"
SWITCH_STANDARD_APP(soft_hold_function)
{
@ -6004,6 +6026,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SWITCH_ADD_APP(app_interface, "media_reset", "Reset all bypass/proxy media flags", "Reset all bypass/proxy media flags", media_reset_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "mkdir", "Create a directory", "Create a directory", mkdir_function, MKDIR_SYNTAX, SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "rename", "Rename file", "Rename file", rename_function, RENAME_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC);
SWITCH_ADD_APP(app_interface, "transfer_vars", "Transfer variables", "Transfer variables", transfer_vars_function, TRANSFER_VARS_SYNTAX,
SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC);
SWITCH_ADD_APP(app_interface, "soft_hold", "Put a bridged channel on hold", "Put a bridged channel on hold", soft_hold_function, SOFT_HOLD_SYNTAX,
SAF_NONE);
SWITCH_ADD_APP(app_interface, "bind_meta_app", "Bind a key to an application", "Bind a key to an application", dtmf_bind_function, BIND_SYNTAX,

View File

@ -2201,9 +2201,23 @@ static void _send_presence_notify(sofia_profile_t *profile,
path = sofia_glue_get_path_from_contact((char *) o_contact);
}
tmp = (char *)o_contact;
o_contact_dup = sofia_glue_get_url_from_contact(tmp, 1);
dst = sofia_glue_get_destination((char *) o_contact);
switch_assert(dst);
if (!zstr(dst->contact)) {
contact = sofia_glue_get_url_from_contact(dst->contact, 1);
} else {
contact = strdup(o_contact);
}
if (dst->route_uri) {
route_uri = sofia_glue_strip_uri(dst->route_uri);
tmp = (char *)route_uri;
} else {
tmp = (char *)o_contact;
}
o_contact_dup = sofia_glue_get_url_from_contact(tmp, 1);
if ((tp = switch_stristr("transport=", o_contact_dup))) {
tp += 10;
@ -2272,19 +2286,6 @@ static void _send_presence_notify(sofia_profile_t *profile,
free(to_uri);
}
dst = sofia_glue_get_destination((char *) o_contact);
switch_assert(dst);
if (!zstr(dst->contact)) {
contact = sofia_glue_get_url_from_contact(dst->contact, 1);
} else {
contact = strdup(o_contact);
}
if (dst->route_uri) {
route_uri = sofia_glue_strip_uri(dst->route_uri);
}
if (expires) {
long ltmp = atol(expires);
@ -4023,7 +4024,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
char *sticky = NULL;
char *contactstr = profile->url, *cs = NULL;
char *p = NULL, *new_contactstr = NULL;
sofia_transport_t transport;
if (np.is_nat) {
char params[128] = "";
@ -4040,20 +4041,23 @@ void sofia_presence_handle_sip_i_subscribe(int status,
contactstr = profile->url;
}
if (sip->sip_via) {
transport = sofia_glue_via2transport(sip->sip_via);
} else {
transport = sofia_glue_url2transport(contact->m_url);
}
if (switch_stristr("port=tcp", contact->m_url->url_params)) {
if (transport == SOFIA_TRANSPORT_TCP) {
if (np.is_auto_nat) {
cs = profile->tcp_public_contact;
} else {
cs = profile->tcp_contact;
}
} else if (switch_stristr("port=tls", contact->m_url->url_params)) {
} else if (transport == SOFIA_TRANSPORT_TCP_TLS) {
if (np.is_auto_nat) {
cs = sofia_test_pflag(profile, PFLAG_TLS) ?
profile->tls_public_contact : profile->tcp_public_contact;
cs = sofia_test_pflag(profile, PFLAG_TLS) ? profile->tls_public_contact : profile->tcp_public_contact;
} else {
cs = sofia_test_pflag(profile, PFLAG_TLS) ?
profile->tls_contact : profile->tcp_contact;
cs = sofia_test_pflag(profile, PFLAG_TLS) ? profile->tls_contact : profile->tcp_contact;
}
}

View File

@ -48,10 +48,15 @@ static switch_status_t silence_stream_file_open(switch_file_handle_t *handle, co
int ms;
char *p;
sh = switch_core_alloc(handle->memory_pool, sizeof(*sh));
ms = atoi(path);
if (ms == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid Input [%s] Expect <msec>[,<silence_factor>]\n", path);
return SWITCH_STATUS_FALSE;
}
sh = switch_core_alloc(handle->memory_pool, sizeof(*sh));
if (ms > 0) {
sh->samples = (handle->samplerate / 1000) * ms;
} else {