mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-29 22:54:18 +00:00
Merge branch 'master' into smgmaster
This commit is contained in:
commit
0fa9f47c25
76 files changed
+5846
-2191
No files matched your search
@@ -1,2 +1,4 @@
|
||||
!/gsmlib/gsmlib-*/aclocal.m4
|
||||
!/gsmlib/gsmlib-*/configure
|
||||
!/gsmlib/gsmlib-1.10.tar.gz
|
||||
!/gsmlib/gsmlib_1.10-12ubuntu1.diff.gz
|
||||
@@ -77,11 +77,11 @@ struct private_object {
|
||||
|
||||
switch_frame_t cng_frame;
|
||||
unsigned char cng_databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
||||
switch_timer_t timer;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
int32_t bowout_frame_count;
|
||||
char *other_uuid;
|
||||
switch_queue_t *frame_queue;
|
||||
switch_codec_implementation_t read_impl;
|
||||
};
|
||||
|
||||
typedef struct private_object private_t;
|
||||
@@ -111,7 +111,6 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
|
||||
int interval = 20;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
const switch_codec_implementation_t *read_impl;
|
||||
|
||||
if (codec) {
|
||||
iananame = codec->implementation->iananame;
|
||||
@@ -166,15 +165,7 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
|
||||
switch_core_session_set_read_codec(session, &tech_pvt->read_codec);
|
||||
switch_core_session_set_write_codec(session, &tech_pvt->write_codec);
|
||||
|
||||
if (tech_pvt->flag_mutex) {
|
||||
switch_core_timer_destroy(&tech_pvt->timer);
|
||||
}
|
||||
|
||||
read_impl = tech_pvt->read_codec.implementation;
|
||||
|
||||
switch_core_timer_init(&tech_pvt->timer, "soft",
|
||||
read_impl->microseconds_per_packet / 1000, read_impl->samples_per_packet * 4, switch_core_session_get_pool(session));
|
||||
|
||||
tech_pvt->read_impl = *tech_pvt->read_codec.implementation;
|
||||
|
||||
if (!tech_pvt->flag_mutex) {
|
||||
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
|
||||
@@ -376,7 +367,6 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
|
||||
if (tech_pvt) {
|
||||
switch_core_timer_destroy(&tech_pvt->timer);
|
||||
|
||||
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
|
||||
switch_core_codec_destroy(&tech_pvt->read_codec);
|
||||
@@ -568,12 +558,10 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
goto end;
|
||||
}
|
||||
|
||||
switch_core_timer_next(&tech_pvt->timer);
|
||||
|
||||
mutex = tech_pvt->mutex;
|
||||
switch_mutex_lock(mutex);
|
||||
|
||||
if (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
|
||||
|
||||
if (switch_queue_pop_timeout(tech_pvt->frame_queue, &pop, tech_pvt->read_impl.microseconds_per_packet) == SWITCH_STATUS_SUCCESS && pop) {
|
||||
if (tech_pvt->write_frame) {
|
||||
switch_frame_free(&tech_pvt->write_frame);
|
||||
}
|
||||
@@ -585,6 +573,8 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
switch_set_flag(tech_pvt, TFLAG_CNG);
|
||||
}
|
||||
|
||||
switch_mutex_lock(mutex);
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_CNG)) {
|
||||
unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
||||
uint32_t flag = 0;
|
||||
@@ -775,8 +765,6 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
||||
switch_frame_free(&frame);
|
||||
}
|
||||
|
||||
switch_core_timer_sync(&tech_pvt->timer);
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -4945,7 +4945,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
|
||||
sofia_endpoint_interface->state_handler = &sofia_event_handlers;
|
||||
|
||||
management_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_MANAGEMENT_INTERFACE);
|
||||
management_interface->relative_oid = "1";
|
||||
management_interface->relative_oid = "1001";
|
||||
management_interface->management_function = sofia_manage;
|
||||
|
||||
SWITCH_ADD_API(api_interface, "sofia", "Sofia Controls", sofia_function, "<cmd> <args>");
|
||||
|
||||
@@ -808,6 +808,18 @@ void sofia_event_callback(nua_event_t event,
|
||||
}
|
||||
}
|
||||
|
||||
if ((event == nua_i_invite) && (!session)) {
|
||||
uint32_t sess_count = switch_core_session_count();
|
||||
uint32_t sess_max = switch_core_session_limit(0);
|
||||
|
||||
if (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING) || !switch_core_ready()) {
|
||||
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No more sessions allowed at this time.\n");
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) {
|
||||
sip_authorization_t const *authorization = NULL;
|
||||
|
||||
@@ -630,6 +630,11 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
|
||||
char *probe_user = NULL, *probe_euser, *probe_host, *p;
|
||||
struct dialog_helper dh = { { 0 } };
|
||||
|
||||
if (strcasecmp(proto, SOFIA_CHAT_PROTO) != 0) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
if (!to || !(probe_user = strdup(to))) {
|
||||
goto done;
|
||||
}
|
||||
@@ -2405,6 +2410,20 @@ void sofia_presence_handle_sip_i_subscribe(int status,
|
||||
switch_event_fire(&sevent);
|
||||
}
|
||||
|
||||
} else if (to_user && (strcasecmp(proto, SOFIA_CHAT_PROTO) != 0)) {
|
||||
if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto", proto);
|
||||
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "long", profile->name);
|
||||
switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host);
|
||||
switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "to", "%s%s%s@%s", proto, "+", to_user, to_host);
|
||||
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto-specific-event-name", event);
|
||||
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str);
|
||||
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "event_type", "presence");
|
||||
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
|
||||
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str);
|
||||
switch_event_fire(&sevent);
|
||||
|
||||
}
|
||||
} else {
|
||||
if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
|
||||
|
||||
Reference in new issue
Block a user