From d26293e591c532cc3227ef9c78278600caa27d6e Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sun, 9 Sep 2012 01:08:15 +0800 Subject: [PATCH 1/7] Some tweaks to spandsp --- libs/spandsp/src/fax_modems.c | 1 - libs/spandsp/src/t38_gateway.c | 1 + libs/spandsp/tests/t31_tests.c | 2 +- libs/spandsp/tests/t4_tests.c | 6 +++--- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/spandsp/src/fax_modems.c b/libs/spandsp/src/fax_modems.c index d2510a4909..f1658ccf56 100644 --- a/libs/spandsp/src/fax_modems.c +++ b/libs/spandsp/src/fax_modems.c @@ -262,7 +262,6 @@ SPAN_DECLARE(void) fax_modems_start_slow_modem(fax_modems_state_t *s, int which) case FAX_MODEM_V21_RX: fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, &s->hdlc_rx); fsk_rx_signal_cutoff(&s->v21_rx, -39.09f); - //fax_modems_set_rx_handler(s, (span_rx_handler_t) &fsk_rx, &s->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx); s->rx_frame_received = FALSE; break; case FAX_MODEM_V21_TX: diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index e3993609cc..3572b36c1e 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -1977,6 +1977,7 @@ static int restart_rx_modem(t38_gateway_state_t *s) fax_modems_start_fast_modem(t, s->core.fast_rx_modem, s->core.fast_bit_rate, s->core.short_train, FALSE); s->core.fast_rx_active = s->core.fast_rx_modem; break; + case FAX_MODEM_V21_RX: default: //fax_modems_start_slow_modem(t, FAX_MODEM_V21_RX); fax_modems_set_rx_handler(t, (span_rx_handler_t) &fsk_rx, &t->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &t->v21_rx); diff --git a/libs/spandsp/tests/t31_tests.c b/libs/spandsp/tests/t31_tests.c index a5a1293167..82e1597dd0 100644 --- a/libs/spandsp/tests/t31_tests.c +++ b/libs/spandsp/tests/t31_tests.c @@ -120,7 +120,7 @@ static const struct command_response_s fax_send_test_seq[] = // EXCHANGE("\xFF\x03\x43\x32\x32\x32\x32\x32\x32\x32\x32\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x10\x03", "\r\nCONNECT\r\n"), // - EXCHANGE("\xFF\x13\x83\x01\xC6\x80\x80\x80\x80\x01\xFD\x13\x10\x03", "\r\nOK\r\n"), + EXCHANGE("\xFF\x13\x83\x01\xC6\x80\x80\x80\x80\x01\x10\x03", "\r\nOK\r\n"), //Do a wait for timed silence at this point, or there won't be one in the tests EXCHANGE("AT+FRS=7\r", "\r\nOK\r\n"), //EXCHANGE("AT+FTS=8;+FTM=96\r", "\r\nCONNECT\r\n"), diff --git a/libs/spandsp/tests/t4_tests.c b/libs/spandsp/tests/t4_tests.c index b53c8f65be..db9581aaee 100644 --- a/libs/spandsp/tests/t4_tests.c +++ b/libs/spandsp/tests/t4_tests.c @@ -484,7 +484,7 @@ int main(int argc, char *argv[]) } end_of_page = t4_rx_put(&receive_state, block, i); } - else if (strlen(buf) > 2 && sscanf(buf, "T.30 Rx: %x %x", (unsigned int *) &bit, (unsigned int *) &bit) == 2) + else if (strlen(buf) > 2 && sscanf(buf, "T.30 Rx: %x %x %x %x", (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &pkt_no) == 4) { /* Useful for breaking up ECM logs */ if (pkt_no != last_pkt_no + 1) @@ -575,7 +575,7 @@ int main(int argc, char *argv[]) if (compression < 0 || (block_size == 0 && compression_step >= 3)) break; } - t4_tx_set_tx_encoding(&send_state, compression); + t4_tx_set_tx_encoding(&send_state, compression, T4_COMPRESSION_NONE); t4_rx_set_rx_encoding(&receive_state, compression); rows_read = 0; @@ -716,7 +716,7 @@ int main(int argc, char *argv[]) compression = compression_sequence[compression_step++]; } } - t4_tx_set_tx_encoding(&send_state, compression); + t4_tx_set_tx_encoding(&send_state, compression, T4_COMPRESSION_NONE); t4_rx_set_rx_encoding(&receive_state, compression); if (t4_tx_start_page(&send_state)) From 36cee285b0c11c08e1aae1184f38b31bdda1aaa5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 8 Sep 2012 16:12:35 -0500 Subject: [PATCH 2/7] FS-4602 --resolve --- src/mod/endpoints/mod_sofia/sofia.c | 40 ++++++++++++++++++----------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 79a925f4f8..c95a00b820 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1716,26 +1716,36 @@ void sofia_event_callback(nua_event_t event, switch_core_session_t *session; if ((session = switch_core_session_locate(sofia_private->uuid))) { - private_object_t *tech_pvt = switch_core_session_get_private(session); switch_channel_t *channel = switch_core_session_get_channel(session); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "detaching session %s\n", sofia_private->uuid); - set_call_id(tech_pvt, sip); + int end = 0; - if (!zstr(tech_pvt->call_id)) { - tech_pvt->sofia_private = NULL; - tech_pvt->nh = NULL; - sofia_set_flag(tech_pvt, TFLAG_BYE); - switch_mutex_lock(profile->flag_mutex); - switch_core_hash_insert(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session))); - switch_mutex_unlock(profile->flag_mutex); - switch_core_session_rwunlock(session); - } else { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND && !switch_channel_test_flag(channel, CF_ANSWERED)) { + private_object_t *tech_pvt = switch_core_session_get_private(session); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "detaching session %s\n", sofia_private->uuid); + + if (!zstr(tech_pvt->call_id)) { + tech_pvt->sofia_private = NULL; + tech_pvt->nh = NULL; + sofia_set_flag(tech_pvt, TFLAG_BYE); + switch_mutex_lock(profile->flag_mutex); + switch_core_hash_insert(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session))); + switch_mutex_unlock(profile->flag_mutex); + } else { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + + end++; + } + + switch_core_session_rwunlock(session); + + if (end) { + goto end; } } } - goto end; + break; case nua_i_invite: case nua_i_register: case nua_i_options: From e977d158442ac4df462acf1db965ed87318b10e9 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 10 Sep 2012 08:54:53 -0500 Subject: [PATCH 3/7] FS-4343 --resolve add mod_directory, mod_callcenter, mod_skypopen --- w32/Setup/Setup.wixproj | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index f7873cac08..9a42d520a1 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -175,6 +175,15 @@ Binaries;Content;Satellites MODLOCATION + + mod_callcenter + {47886a6c-cca6-4f9f-a7d4-f97d06fb2b1a} + True + + + Binaries;Content;Satellites + MODLOCATION + mod_commands {30a5b29c-983e-4580-9fd0-d647ccdcc7eb} @@ -211,6 +220,15 @@ Binaries;Content;Satellites MODLOCATION + + mod_directory + {b889a18e-70a7-44b5-b2c9-47798d4f43b3} + True + + + Binaries;Content;Satellites + MODLOCATION + mod_dptools {b5881a85-fe70-4f64-8607-2caae52669c6} @@ -508,6 +526,24 @@ Binaries;Content;Satellites MODLOCATION + + mod_rtmp + {48414740-c693-4968-9846-ee058020c64f} + True + + + Binaries;Content;Satellites + MODLOCATION + + + mod_skypopen + {c6e78a4c-db1e-47f4-9b63-4dc27d86343f} + True + + + Binaries;Content;Satellites + MODLOCATION + mod_sofia {0df3abd0-ddc0-4265-b778-07c66780979b} From 3918d0876faf093696089d6c476b86f0a582c698 Mon Sep 17 00:00:00 2001 From: William King Date: Mon, 10 Sep 2012 08:59:38 -0700 Subject: [PATCH 4/7] Add better handling of time values when the times aren't defined. Fix formatting of the config values for two config values. --- .../xml_int/mod_xml_radius/mod_radius.diff | 59 +++++++++++++++++++ .../xml_int/mod_xml_radius/mod_xml_radius.c | 12 ++++ .../mod_xml_radius/xml_radius.conf.xml | 4 +- 3 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 src/mod/xml_int/mod_xml_radius/mod_radius.diff diff --git a/src/mod/xml_int/mod_xml_radius/mod_radius.diff b/src/mod/xml_int/mod_xml_radius/mod_radius.diff new file mode 100644 index 0000000000..f32d39e1b6 --- /dev/null +++ b/src/mod/xml_int/mod_xml_radius/mod_radius.diff @@ -0,0 +1,59 @@ +diff --git src/mod/xml_int/mod_xml_radius/mod_xml_radius.c src/mod/xml_int/mod_xml_radius/mod_xml_radius.c +index 0707388..e9e6e2a 100644 +--- src/mod/xml_int/mod_xml_radius/mod_xml_radius.c ++++ src/mod/xml_int/mod_xml_radius/mod_xml_radius.c +@@ -367,6 +367,10 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch + switch_time_t time = profile->times->created; + switch_time_exp_t tm; + ++ if ( !time ) { ++ goto err; ++ } ++ + switch_time_exp_lt(&tm, time); + av_value = switch_mprintf("%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, +@@ -381,6 +385,10 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch + switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel); + switch_time_t time = profile->times->answered; + switch_time_exp_t tm; ++ ++ if ( !time ) { ++ goto err; ++ } + + switch_time_exp_lt(&tm, time); + +@@ -397,6 +405,10 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch + switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel); + switch_time_t time = profile->times->hungup; + switch_time_exp_t tm; ++ ++ if ( !time ) { ++ goto err; ++ } + + switch_time_exp_lt(&tm, time); + +diff --git src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml +index eb3070c..6349d05 100644 +--- src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml ++++ src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml +@@ -22,7 +22,7 @@ + + + +- ++ + + + +@@ -48,7 +48,7 @@ + + + +- ++ + + + diff --git a/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c b/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c index 0707388374..e9e6e2ac82 100644 --- a/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c +++ b/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c @@ -367,6 +367,10 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch switch_time_t time = profile->times->created; switch_time_exp_t tm; + if ( !time ) { + goto err; + } + switch_time_exp_lt(&tm, time); av_value = switch_mprintf("%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, @@ -381,6 +385,10 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel); switch_time_t time = profile->times->answered; switch_time_exp_t tm; + + if ( !time ) { + goto err; + } switch_time_exp_lt(&tm, time); @@ -397,6 +405,10 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel); switch_time_t time = profile->times->hungup; switch_time_exp_t tm; + + if ( !time ) { + goto err; + } switch_time_exp_lt(&tm, time); diff --git a/src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml b/src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml index eb3070c929..6349d05210 100644 --- a/src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml +++ b/src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml @@ -22,7 +22,7 @@ - + @@ -48,7 +48,7 @@ - + From f71b67e02ce0151c45c416c9af674d646ef93069 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 10 Sep 2012 11:14:19 -0500 Subject: [PATCH 5/7] hangup pickup chans with no answer if they are the only ones left --- src/switch_ivr_originate.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 2c9c772a21..5b7ee93935 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -780,6 +780,16 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat end: + if (rval == 0 && pickups) { + for (i = 0; i < len; i++) { + if (originate_status[i].peer_channel && switch_channel_test_flag(originate_status[i].peer_channel, CF_PICKUP) && + switch_channel_up(originate_status[i].peer_channel)) { + switch_channel_hangup(originate_status[i].peer_channel, SWITCH_CAUSE_NO_ANSWER); + } + } + } + + if (pindex > -1 && caller_channel && switch_channel_ready(caller_channel) && !switch_channel_media_ready(caller_channel) && switch_channel_media_ready(originate_status[pindex].peer_channel)) { inherit_codec(caller_channel, originate_status[pindex].peer_session); From 0fd5d7696c677d7bf825943936d75b3d5308c95c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 10 Sep 2012 12:58:06 -0500 Subject: [PATCH 6/7] video tweaks for echo app --- src/switch_ivr_async.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 4ab523a3a5..03f9839f78 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -580,11 +580,24 @@ static void *SWITCH_THREAD_FUNC echo_video_thread(switch_thread_t *thread, void switch_channel_t *channel = switch_core_session_get_channel(session); switch_status_t status; switch_frame_t *read_frame; + switch_core_session_message_t msg = { 0 }; + + + msg.from = __FILE__; + msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ; + + switch_core_session_receive_message(session, &msg); eh->up = 1; while (switch_channel_ready(channel)) { status = switch_core_session_read_video_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); + + if (switch_channel_test_flag(channel, CF_VIDEO_REFRESH_REQ)) { + switch_core_session_receive_message(session, &msg); + switch_channel_clear_flag(channel, CF_VIDEO_REFRESH_REQ); + } + if (!SWITCH_READ_ACCEPTABLE(status)) { break; } @@ -606,6 +619,8 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, swi switch_status_t status; switch_frame_t *read_frame; switch_channel_t *channel = switch_core_session_get_channel(session); + int orig_vid = switch_channel_test_flag(channel, CF_VIDEO); + #ifdef SWITCH_VIDEO_IN_THREADS struct echo_helper eh = { 0 }; switch_thread_t *thread; @@ -615,6 +630,9 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, swi if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { return; } + + restart: + #ifdef SWITCH_VIDEO_IN_THREADS if (switch_channel_test_flag(channel, CF_VIDEO)) { eh.session = session; @@ -630,6 +648,12 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, swi if (!SWITCH_READ_ACCEPTABLE(status)) { break; } + + if (!orig_vid && switch_channel_test_flag(channel, CF_VIDEO)) { + orig_vid = 1; + goto restart; + } + switch_ivr_parse_all_events(session); From 4ddfedbf717c4d98c41ab2641924061a913a75f9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 10 Sep 2012 12:58:23 -0500 Subject: [PATCH 7/7] minor video tweaks --- src/mod/endpoints/mod_sofia/sofia_glue.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 97d9e06e07..ae92061f70 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2884,6 +2884,10 @@ void sofia_glue_deactivate_rtp(private_object_t *tech_pvt) switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force) { + if (!tech_pvt->video_rm_encoding) { + return SWITCH_STATUS_FALSE; + } + if (tech_pvt->video_read_codec.implementation && switch_core_codec_ready(&tech_pvt->video_read_codec)) { if (!force) { return SWITCH_STATUS_SUCCESS; @@ -2902,10 +2906,7 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int } } - if (!tech_pvt->video_rm_encoding) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec with no name?\n"); - return SWITCH_STATUS_FALSE; - } + if (switch_core_codec_init(&tech_pvt->video_read_codec, tech_pvt->video_rm_encoding, @@ -3077,6 +3078,7 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force) switch_core_session_unlock_codec_read(tech_pvt->session); } + sofia_glue_tech_set_video_codec(tech_pvt, force); return status; } @@ -5307,7 +5309,8 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->video_recv_pt); switch_channel_set_variable(tech_pvt->channel, "sip_video_recv_pt", tmp); - + if (!match && vmatch) match = 1; + break; } else { vmatch = 0;