mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 21:22:09 +00:00
Skinny: Initial Windows support
Thanks to Peter Olsson Closes: MODSKINNY-3
This commit is contained in:
@@ -145,8 +145,10 @@ skinny_profile_t *skinny_find_profile(const char *profile_name)
|
||||
|
||||
switch_status_t skinny_profile_find_listener_by_device_name(skinny_profile_t *profile, const char *device_name, listener_t **listener)
|
||||
{
|
||||
listener_t *l;
|
||||
|
||||
switch_mutex_lock(profile->listener_mutex);
|
||||
for (listener_t *l = profile->listeners; l; l = l->next) {
|
||||
for (l = profile->listeners; l; l = l->next) {
|
||||
if (!strcmp(l->device_name, device_name)) {
|
||||
*listener = l;
|
||||
}
|
||||
@@ -158,8 +160,10 @@ switch_status_t skinny_profile_find_listener_by_device_name(skinny_profile_t *pr
|
||||
|
||||
switch_status_t skinny_profile_find_listener_by_device_name_and_instance(skinny_profile_t *profile, const char *device_name, uint32_t device_instance, listener_t **listener)
|
||||
{
|
||||
listener_t *l;
|
||||
|
||||
switch_mutex_lock(profile->listener_mutex);
|
||||
for (listener_t *l = profile->listeners; l; l = l->next) {
|
||||
for (l = profile->listeners; l; l = l->next) {
|
||||
if (!strcmp(l->device_name, device_name) && (l->device_instance == device_instance)) {
|
||||
*listener = l;
|
||||
}
|
||||
@@ -1084,9 +1088,7 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
|
||||
|
||||
switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event)
|
||||
{
|
||||
struct private_object *tech_pvt = switch_core_session_get_private(session);
|
||||
char *body = switch_event_get_body(event);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (!body) {
|
||||
body = "";
|
||||
|
||||
@@ -1324,6 +1324,7 @@ switch_status_t skinny_handle_button_template_request(listener_t *listener, skin
|
||||
struct button_template_helper helper = {0};
|
||||
skinny_profile_t *profile;
|
||||
char *sql;
|
||||
int i;
|
||||
|
||||
switch_assert(listener->profile);
|
||||
switch_assert(listener->device_name);
|
||||
@@ -1367,7 +1368,7 @@ switch_status_t skinny_handle_button_template_request(listener_t *listener, skin
|
||||
}
|
||||
|
||||
/* Fill remaining buttons with Undefined */
|
||||
for(int i = 0; i+1 < helper.max_position; i++) {
|
||||
for(i = 0; i+1 < helper.max_position; i++) {
|
||||
if(message->data.button_template.btn[i].button_definition == SKINNY_BUTTON_UNKNOWN) {
|
||||
message->data.button_template.btn[i].instance_number = ++helper.count[SKINNY_BUTTON_UNDEFINED];
|
||||
message->data.button_template.btn[i].button_definition = SKINNY_BUTTON_UNDEFINED;
|
||||
@@ -1546,7 +1547,11 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste
|
||||
tech_pvt->agreed_pt,
|
||||
tech_pvt->read_impl.microseconds_per_packet / 1000,
|
||||
switch_rtp_ready(tech_pvt->rtp_session) ? "SUCCESS" : err);
|
||||
#ifdef WIN32
|
||||
addr.s_addr = inet_addr((uint16_t) tech_pvt->local_sdp_audio_ip);
|
||||
#else
|
||||
inet_aton(tech_pvt->local_sdp_audio_ip, &addr);
|
||||
#endif
|
||||
send_start_media_transmission(listener,
|
||||
tech_pvt->call_id, /* uint32_t conference_id, */
|
||||
tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
|
||||
|
||||
@@ -44,8 +44,9 @@ struct skinny_table {
|
||||
const char *func(uint32_t id) \
|
||||
{ \
|
||||
const char *str = DEFAULT_STR; \
|
||||
uint8_t x; \
|
||||
\
|
||||
for (uint8_t x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
|
||||
for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
|
||||
if (TABLE[x].id == id) {\
|
||||
str = TABLE[x].name;\
|
||||
break;\
|
||||
@@ -58,12 +59,13 @@ const char *func(uint32_t id) \
|
||||
#define SKINNY_DECLARE_STR2ID(func, TABLE, DEFAULT_ID) \
|
||||
uint32_t func(const char *str)\
|
||||
{\
|
||||
uint32_t id = DEFAULT_ID;\
|
||||
uint32_t id = (uint32_t) DEFAULT_ID;\
|
||||
\
|
||||
if (*str > 47 && *str < 58) {\
|
||||
id = atoi(str);\
|
||||
} else {\
|
||||
for (uint8_t x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1 && TABLE[x].name; x++) {\
|
||||
uint8_t x;\
|
||||
for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1 && TABLE[x].name; x++) {\
|
||||
if (!strcasecmp(TABLE[x].name, str)) {\
|
||||
id = TABLE[x].id;\
|
||||
break;\
|
||||
@@ -75,7 +77,8 @@ uint32_t func(const char *str)\
|
||||
|
||||
#define SKINNY_DECLARE_PUSH_MATCH(TABLE) \
|
||||
switch_console_callback_match_t *my_matches = NULL;\
|
||||
for (uint8_t x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
|
||||
uint8_t x;\
|
||||
for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
|
||||
switch_console_push_match(&my_matches, TABLE[x].name);\
|
||||
}\
|
||||
if (my_matches) {\
|
||||
|
||||
Reference in New Issue
Block a user