From 5324063f44e8170bc91ff6bfff3bbc4168c23aa5 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 26 Jun 2013 23:17:49 -0400 Subject: [PATCH 01/88] Added support for blind transfer notification of negative responses --- src/mod/endpoints/mod_sofia/mod_sofia.c | 30 +++++++++++++++++++++---- src/mod/endpoints/mod_sofia/sofia.c | 7 ++++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 98d2228e96..716587cdbb 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1199,13 +1199,35 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi char *xdest; if (event && uuid) { + char payload_str[255] = "SIP/2.0 403 Forbidden\r\n"; + if (msg->numeric_arg) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "%s Completing blind transfer with success\n", switch_channel_get_name(channel)); + switch_set_string(payload_str, "SIP/2.0 200 OK\r\n"); + } else if (uuid) { + switch_core_session_t *other_session = switch_core_session_locate(uuid); + if (other_session) { + switch_channel_t *other_channel = switch_core_session_get_channel(other_session); + const char *invite_failure_status = switch_channel_get_variable(other_channel, "sip_invite_failure_status"); + const char *invite_failure_str = switch_channel_get_variable(other_channel, "sip_invite_failure_status"); + if (!zstr(invite_failure_status) && !zstr(invite_failure_str)) { + snprintf(payload_str, sizeof(payload_str), "SIP/2.0 %s %s\r\n", invite_failure_status, invite_failure_str); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "%s Completing blind transfer with custom failure: %s %s\n", + switch_channel_get_name(channel), invite_failure_status, invite_failure_str); + } + switch_core_session_rwunlock(other_session); + } + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "%s Completing blind transfer with status: %s\n", switch_channel_get_name(channel), payload_str); nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"), NUTAG_SUBSTATE(nua_substate_terminated), - SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"), - SIPTAG_PAYLOAD_STR(msg->numeric_arg ? "SIP/2.0 200 OK\r\n" : "SIP/2.0 403 Forbidden\r\n"), - SIPTAG_EVENT_STR(event), TAG_END()); + SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"), + SIPTAG_PAYLOAD_STR(payload_str), + SIPTAG_EVENT_STR(event), TAG_END()); + - if (!msg->numeric_arg) { xdest = switch_core_session_sprintf(session, "intercept:%s", uuid); switch_ivr_session_transfer(session, xdest, "inline", NULL); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e9f5b9fea4..a4dd9e24bb 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4985,6 +4985,13 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status switch_channel_set_variable(channel, "sip_hangup_disposition", "recv_refuse"); } + if (status >= 400) { + char status_str[5]; + switch_snprintf(status_str, sizeof(status_str), "%d", status); + switch_channel_set_variable_partner(channel, "sip_invite_failure_status", status_str); + switch_channel_set_variable_partner(channel, "sip_invite_failure_phrase", phrase); + } + if (status >= 400 && sip->sip_reason && sip->sip_reason->re_protocol && (!strcasecmp(sip->sip_reason->re_protocol, "Q.850") || !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH") || !strcasecmp(sip->sip_reason->re_protocol, profile->sdp_username)) && sip->sip_reason->re_cause) { From f08c3309f6166c869f5e8a89bc76d90708e0543a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 20 Jul 2013 14:06:34 -0500 Subject: [PATCH 02/88] FS-5621 --- src/mod/endpoints/mod_sofia/sofia.c | 12 +++++++++--- src/switch_xml.c | 5 +++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 55847d19bf..276c87a858 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -8095,13 +8095,19 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia switch_channel_set_caller_profile(channel, tech_pvt->caller_profile); if (x_user) { - const char *user = NULL, *domain = NULL; + const char *ruser = NULL, *rdomain = NULL, *user = switch_xml_attr(x_user, "id"), *domain = switch_xml_attr(x_user, "domain-name"); if (v_event) { - user = switch_event_get_header(v_event, "username"); - domain = switch_event_get_header(v_event, "domain_name"); + ruser = switch_event_get_header(v_event, "username"); + rdomain = switch_event_get_header(v_event, "domain_name"); + + switch_channel_set_variable(channel, "requested_user_name", ruser); + switch_channel_set_variable(channel, "requested_domain_name", rdomain); } + if (!user) user = ruser; + if (!domain) domain = rdomain; + switch_ivr_set_user_xml(session, NULL, user, domain, x_user); switch_xml_free(x_user); x_user = NULL; diff --git a/src/switch_xml.c b/src/switch_xml.c index 369f88e2c1..fcb98dcb74 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -1916,6 +1916,7 @@ static void do_merge(switch_xml_t in, switch_xml_t src, const char *container, c SWITCH_DECLARE(void) switch_xml_merge_user(switch_xml_t user, switch_xml_t domain, switch_xml_t group) { + const char *domain_name = switch_xml_attr(domain, "name"); do_merge(user, group, "params", "param"); do_merge(user, group, "variables", "variable"); @@ -1923,6 +1924,10 @@ SWITCH_DECLARE(void) switch_xml_merge_user(switch_xml_t user, switch_xml_t domai do_merge(user, domain, "params", "param"); do_merge(user, domain, "variables", "variable"); do_merge(user, domain, "profile-variables", "variable"); + + if (!zstr(domain_name)) { + switch_xml_set_attr_d(user, "domain-name", domain_name); + } } SWITCH_DECLARE(uint32_t) switch_xml_clear_user_cache(const char *key, const char *user_name, const char *domain_name) From 7fb4369932a2a28f230453624dd94a5fc505d070 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Sat, 20 Jul 2013 15:00:06 -0500 Subject: [PATCH 03/88] peak sessions step 1 --- src/include/private/switch_core_pvt.h | 2 ++ src/include/switch_types.h | 4 +++- src/mod/event_handlers/mod_snmp/FREESWITCH-MIB | 17 ++++++++++++++++- src/mod/event_handlers/mod_snmp/subagent.c | 10 +++++++++- src/mod/event_handlers/mod_snmp/subagent.h | 2 ++ src/switch_core.c | 8 ++++++++ src/switch_core_session.c | 8 ++++++++ src/switch_time.c | 4 ++++ 8 files changed, 52 insertions(+), 3 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 2b9cf628e7..dd83e7052d 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -242,6 +242,8 @@ struct switch_runtime { int32_t sps_last; int32_t sps_peak; int32_t sps_peak_fivemin; + int32_t sessions_peak; + int32_t sessions_peak_fivemin; switch_log_level_t hard_log_level; char *mailer_app; char *mailer_app_args; diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 3554d213c0..a847006e09 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1889,7 +1889,9 @@ typedef enum { SCSC_API_EXPANSION, SCSC_RECOVER, SCSC_SPS_PEAK, - SCSC_SPS_PEAK_FIVEMIN + SCSC_SPS_PEAK_FIVEMIN, + SCSC_SESSIONS_PEAK, + SCSC_SESSIONS_PEAK_FIVEMIN } switch_session_ctl_t; typedef enum { diff --git a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB index 6b5aeace95..82fdf4bbed 100644 --- a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB +++ b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB @@ -149,7 +149,7 @@ peakSessionsPerSecond OBJECT-TYPE "Peak sessions per second" ::= { systemStats 8 } -peakSessionsPerSecond OBJECT-TYPE +peakSessionsPerSecondFiveMin OBJECT-TYPE SYNTAX Gauge32 MAX-ACCESS read-only STATUS current @@ -157,6 +157,21 @@ peakSessionsPerSecond OBJECT-TYPE "Peak sessions per second last 5 minutes" ::= { systemStats 9 } +peakSessions OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Peak sessions" + ::= { systemStats 10 } + +peakSessionsFiveMin OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Peak sessions last 5 minutes" + ::= { systemStats 11 } ChannelEntry ::= SEQUENCE { chanIndex Integer32, diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c index f9bd4610d6..e5921b7381 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.c +++ b/src/mod/event_handlers/mod_snmp/subagent.c @@ -158,7 +158,7 @@ void init_subagent(switch_memory_pool_t *pool) DEBUGMSGTL(("init_subagent", "mod_snmp subagent initializing\n")); netsnmp_register_scalar_group(netsnmp_create_handler_registration("identity", handle_identity, identity_oid, OID_LENGTH(identity_oid), HANDLER_CAN_RONLY), 1, 2); - netsnmp_register_scalar_group(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY), 1, 9); + netsnmp_register_scalar_group(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY), 1, 11); ch_table_info = switch_core_alloc(pool, sizeof(netsnmp_table_registration_info)); netsnmp_table_helper_add_indexes(ch_table_info, ASN_INTEGER, 0); @@ -266,6 +266,14 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio switch_core_session_ctl(SCSC_SPS_PEAK_FIVEMIN, &int_val); snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val); break; + case SS_PEAK_SESSIONS: + switch_core_session_ctl(SCSC_SESSIONS_PEAK, &int_val); + snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val); + break; + case SS_PEAK_SESSIONS_FIVEMIN: + switch_core_session_ctl(SCSC_SESSIONS_PEAK_FIVEMIN, &int_val); + snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val); + break; default: snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid); netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT); diff --git a/src/mod/event_handlers/mod_snmp/subagent.h b/src/mod/event_handlers/mod_snmp/subagent.h index 2cf5d3f964..2b7974fd86 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.h +++ b/src/mod/event_handlers/mod_snmp/subagent.h @@ -48,6 +48,8 @@ #define SS_MAX_SESSIONS_PER_SECOND 7 #define SS_PEAK_SESSIONS_PER_SECOND 8 #define SS_PEAK_SESSIONS_PER_FIVEMIN 9 +#define SS_PEAK_SESSIONS 10 +#define SS_PEAK_SESSIONS_FIVEMIN 11 /* .1.3.6.1.4.1.27880.1.9 */ #define CH_INDEX 1 diff --git a/src/switch_core.c b/src/switch_core.c index 5964fa3019..b2dc5dc2ab 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -91,6 +91,8 @@ static void send_heartbeat(void) switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Per-Sec-Max", "%u", runtime.sps_peak); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Per-Sec-FiveMin", "%u", runtime.sps_peak_fivemin); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Since-Startup", "%" SWITCH_SIZE_T_FMT, switch_core_session_id() - 1); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Peak-Max", "%u", runtime.sessions_peak); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Peak-FiveMin", "%u", runtime.sessions_peak_fivemin); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Idle-CPU", "%f", switch_core_idle_cpu()); switch_event_fire(&event); } @@ -2488,6 +2490,12 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void * case SCSC_SPS_PEAK_FIVEMIN: newintval = runtime.sps_peak_fivemin; break; + case SCSC_SESSIONS_PEAK: + newintval = runtime.sessions_peak; + break; + case SCSC_SESSIONS_PEAK_FIVEMIN: + newintval = runtime.sessions_peak_fivemin; + break; case SCSC_MAX_DTMF_DURATION: newintval = switch_core_max_dtmf_duration(oldintval); break; diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 90dbac3f5f..2040939632 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -2300,6 +2300,14 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_ switch_core_hash_insert(session_manager.session_table, session->uuid_str, session); session->id = session_manager.session_id++; session_manager.session_count++; + + if (session_manager.session_count > runtime.sessions_peak) { + runtime.sessions_peak = session_manager.session_count; + } + if (session_manager.session_count > runtime.sessions_peak_fivemin) { + runtime.sessions_peak_fivemin = session_manager.session_count; + } + switch_mutex_unlock(runtime.session_hash_mutex); switch_channel_set_variable_printf(session->channel, "session_id", "%u", session->id); diff --git a/src/switch_time.c b/src/switch_time.c index d1c5926c8c..2a67a56b5e 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -1012,7 +1012,11 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) if (sps_interval_ticks >= 300) { runtime.sps_peak_fivemin = 0; sps_interval_ticks = 0; + switch_mutex_lock(runtime.session_hash_mutex); + runtime.sessions_peak_fivemin = session_manager.session_count; + switch_mutex_unlock(runtime.session_hash_mutex); } + sps_interval_ticks++; if (runtime.sps_last > runtime.sps_peak_fivemin) { From adf5e2f6ecd1e2cd44011379d4db7a647c99b375 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sat, 20 Jul 2013 22:13:27 -0500 Subject: [PATCH 04/88] fix windows compiler warnings --- src/switch_core_session.c | 4 ++-- src/switch_ivr.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 2040939632..9bcb6488be 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -2301,10 +2301,10 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_ session->id = session_manager.session_id++; session_manager.session_count++; - if (session_manager.session_count > runtime.sessions_peak) { + if (session_manager.session_count > (uint32_t)runtime.sessions_peak) { runtime.sessions_peak = session_manager.session_count; } - if (session_manager.session_count > runtime.sessions_peak_fivemin) { + if (session_manager.session_count > (uint32_t)runtime.sessions_peak_fivemin) { runtime.sessions_peak_fivemin = session_manager.session_count; } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index c3dc715e75..232f0a6dd2 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -3247,7 +3247,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_set_user_xml(switch_core_session_t *s SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data) { - switch_xml_t x_user; + switch_xml_t x_user = 0; char *user, *domain; switch_status_t status = SWITCH_STATUS_FALSE; From cb4e31b6cf641407476a68b43e4fc9edf24c3bc1 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Mon, 22 Jul 2013 18:48:35 +0800 Subject: [PATCH 05/88] Tweaks to spandsp --- libs/spandsp/src/adsi.c | 4 ++-- libs/spandsp/src/spandsp/fsk.h | 7 ++++--- libs/spandsp/src/spandsp/t4_tx.h | 10 +++++++++- libs/spandsp/src/v18.c | 8 ++++---- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/libs/spandsp/src/adsi.c b/libs/spandsp/src/adsi.c index 44add41be0..df327bf3c5 100644 --- a/libs/spandsp/src/adsi.c +++ b/libs/spandsp/src/adsi.c @@ -384,7 +384,7 @@ static void start_tx(adsi_tx_state_t *s) dtmf_tx_init(&s->dtmftx, NULL, NULL); break; case ADSI_STANDARD_TDD: - fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_WEITBRECHT], async_tx_get_bit, &s->asynctx); + fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_WEITBRECHT_4545], async_tx_get_bit, &s->asynctx); async_tx_init(&s->asynctx, 5, ASYNC_PARITY_NONE, 2, FALSE, adsi_tdd_get_async_byte, s); /* Schedule an explicit shift at the start of baudot transmission */ s->baudot_shift = 2; @@ -448,7 +448,7 @@ SPAN_DECLARE(adsi_rx_state_t *) adsi_rx_init(adsi_rx_state_t *s, case ADSI_STANDARD_TDD: /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and ride over the fraction. */ - fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_WEITBRECHT], FSK_FRAME_MODE_5N1_FRAMES, adsi_tdd_put_async_byte, s); + fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_WEITBRECHT_4545], FSK_FRAME_MODE_5N1_FRAMES, adsi_tdd_put_async_byte, s); break; } s->standard = standard; diff --git a/libs/spandsp/src/spandsp/fsk.h b/libs/spandsp/src/spandsp/fsk.h index bcb8df1de7..b65cd7842f 100644 --- a/libs/spandsp/src/spandsp/fsk.h +++ b/libs/spandsp/src/spandsp/fsk.h @@ -109,9 +109,10 @@ enum FSK_BELL103CH1, FSK_BELL103CH2, FSK_BELL202, - FSK_WEITBRECHT, /* 45.45 baud version, used for TDD (Telecom Device for the Deaf) */ - FSK_WEITBRECHT50, /* 50 baud version, used for TDD (Telecom Device for the Deaf) */ - FSK_V21CH1_110 /* 110 bps version of V.21 channel 1, as used by V.18 */ + FSK_WEITBRECHT_4545, /* 45.45 baud version, used for TDD (Telecom Device for the Deaf) */ + FSK_WEITBRECHT_50, /* 50 baud version, used for TDD (Telecom Device for the Deaf) */ + FSK_WEITBRECHT_476, /* 47.6 baud version, used for V.18 probing */ + FSK_V21CH1_110 /* 110 bps version of V.21 channel 1, as used by V.18 */ }; enum diff --git a/libs/spandsp/src/spandsp/t4_tx.h b/libs/spandsp/src/spandsp/t4_tx.h index bcf75d6c02..c5e08265f4 100644 --- a/libs/spandsp/src/spandsp/t4_tx.h +++ b/libs/spandsp/src/spandsp/t4_tx.h @@ -212,6 +212,14 @@ ImageLayer(34732) LONG #define COMPRESSION_T43 10 #endif +typedef enum +{ + T4_IMAGE_FORMAT_OK = 0, + T4_IMAGE_FORMAT_INCOMPATIBLE = -1, + T4_IMAGE_FORMAT_NOSIZESUPPORT = -2, + T4_IMAGE_FORMAT_NORESSUPPORT = -3 +} t4_image_format_status_t; + #if defined(__cplusplus) extern "C" { #endif @@ -267,7 +275,7 @@ SPAN_DECLARE(int) t4_tx_get_bit(t4_tx_state_t *s); indicates that the end of the document has been reached. */ SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len); -/*! \brief Set the encoding for the encoded data. +/*! \brief Set the compression for the encoded data. \param s The T.4 context. \param encoding The encoding. \return 0 for success, otherwise -1. */ diff --git a/libs/spandsp/src/v18.c b/libs/spandsp/src/v18.c index e821aa3b39..70a9cacc91 100644 --- a/libs/spandsp/src/v18.c +++ b/libs/spandsp/src/v18.c @@ -973,25 +973,25 @@ SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s, { case V18_MODE_5BIT_45: s->repeat_shifts = mode & 0x100; - fsk_tx_init(&s->fsk_tx, &preset_fsk_specs[FSK_WEITBRECHT], async_tx_get_bit, &s->async_tx); + fsk_tx_init(&s->fsk_tx, &preset_fsk_specs[FSK_WEITBRECHT_4545], async_tx_get_bit, &s->async_tx); async_tx_init(&s->async_tx, 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s); /* Schedule an explicit shift at the start of baudot transmission */ s->baudot_tx_shift = 2; /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and ride over the fraction. */ - fsk_rx_init(&s->fsk_rx, &preset_fsk_specs[FSK_WEITBRECHT], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); + fsk_rx_init(&s->fsk_rx, &preset_fsk_specs[FSK_WEITBRECHT_4545], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); s->baudot_rx_shift = 0; s->next_byte = (uint8_t) 0xFF; break; case V18_MODE_5BIT_50: s->repeat_shifts = mode & 0x100; - fsk_tx_init(&s->fsk_tx, &preset_fsk_specs[FSK_WEITBRECHT50], async_tx_get_bit, &s->async_tx); + fsk_tx_init(&s->fsk_tx, &preset_fsk_specs[FSK_WEITBRECHT_50], async_tx_get_bit, &s->async_tx); async_tx_init(&s->async_tx, 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s); /* Schedule an explicit shift at the start of baudot transmission */ s->baudot_tx_shift = 2; /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and ride over the fraction. */ - fsk_rx_init(&s->fsk_rx, &preset_fsk_specs[FSK_WEITBRECHT50], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); + fsk_rx_init(&s->fsk_rx, &preset_fsk_specs[FSK_WEITBRECHT_50], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); s->baudot_rx_shift = 0; s->next_byte = (uint8_t) 0xFF; break; From 8d005a4138fae6f6c693995733ca1047581ae8cd Mon Sep 17 00:00:00 2001 From: Raymond Chandler Date: Fri, 19 Jul 2013 21:01:41 -0400 Subject: [PATCH 06/88] fix commented load --- conf/vanilla/autoload_configs/modules.conf.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/vanilla/autoload_configs/modules.conf.xml b/conf/vanilla/autoload_configs/modules.conf.xml index 9f4168f803..0ca6bc5b34 100644 --- a/conf/vanilla/autoload_configs/modules.conf.xml +++ b/conf/vanilla/autoload_configs/modules.conf.xml @@ -48,7 +48,7 @@ - + From c741332dcdc67bf7e0c8273740b8b3611f3c4a59 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Tue, 23 Jul 2013 20:44:46 +0800 Subject: [PATCH 07/88] Spandsp tweaks --- libs/spandsp/src/spandsp/t42.h | 10 - libs/spandsp/src/spandsp/v18.h | 25 +- libs/spandsp/src/t4_tx.c | 64 +- libs/spandsp/src/v18.c | 365 +++++--- libs/spandsp/tests/fax_tests.sh | 66 +- libs/spandsp/tests/v18_tests.c | 838 +++++++++--------- .../mod_spandsp/mod_spandsp_dsp.c | 4 +- 7 files changed, 782 insertions(+), 590 deletions(-) diff --git a/libs/spandsp/src/spandsp/t42.h b/libs/spandsp/src/spandsp/t42.h index 343780b9fe..17c4758a7f 100644 --- a/libs/spandsp/src/spandsp/t42.h +++ b/libs/spandsp/src/spandsp/t42.h @@ -76,16 +76,6 @@ SPAN_DECLARE(void) set_lab_gamut2(lab_params_t *s, int L_P, int L_Q, int a_P, in SPAN_DECLARE(void) get_lab_gamut2(lab_params_t *s, int *L_P, int *L_Q, int *a_P, int *a_Q, int *b_P, int *b_Q); -SPAN_DECLARE(int) t42_itulab_to_itulab(logging_state_t *logging, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height); - -SPAN_DECLARE(int) t42_itulab_to_jpeg(logging_state_t *logging, lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen); - -SPAN_DECLARE(int) t42_jpeg_to_itulab(logging_state_t *logging, lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen); - -SPAN_DECLARE(int) t42_srgb_to_itulab(logging_state_t *logging, lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height); - -SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s, tdata_t dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t *width, uint32_t *height); - SPAN_DECLARE(void) t42_encode_set_options(t42_encode_state_t *s, uint32_t l0, int quality, int options); SPAN_DECLARE(int) t42_encode_set_image_width(t42_encode_state_t *s, uint32_t image_width); diff --git a/libs/spandsp/src/spandsp/v18.h b/libs/spandsp/src/spandsp/v18.h index b1fd500f43..970d2a3f22 100644 --- a/libs/spandsp/src/spandsp/v18.h +++ b/libs/spandsp/src/spandsp/v18.h @@ -40,7 +40,7 @@ enum { V18_MODE_NONE = 0, /* V.18 Annex A - Weitbrecht TDD at 45.45bps (US TTY), half-duplex, 5 bit baudot (USA). */ - V18_MODE_5BIT_45 = 1, + V18_MODE_5BIT_4545 = 1, /* V.18 Annex A - Weitbrecht TDD at 50bps (International TTY), half-duplex, 5 bit baudot (UK, Australia and others). */ V18_MODE_5BIT_50 = 2, /* V.18 Annex B - DTMF encoding of ASCII (Denmark, Holland and others). */ @@ -55,6 +55,7 @@ enum V18_MODE_V21TEXTPHONE = 7, /* V.18 Annex G - V.18 text telephone mode. */ V18_MODE_V18TEXTPHONE = 8, + V18_MODE_5BIT_476 = 9, /* Use repetitive shift characters where character set shifts are used */ V18_MODE_REPETITIVE_SHIFTS_OPTION = 0x1000 }; @@ -171,28 +172,6 @@ SPAN_DECLARE_NONSTD(int) v18_rx_fillin(v18_state_t *s, int len); invalid, this function will return -1. */ SPAN_DECLARE(int) v18_put(v18_state_t *s, const char msg[], int len); -/*! Convert a text string to a V.18 DTMF string. - \brief Convert a text string to a V.18 DTMF string. - \param s The V.18 context. - \param dtmf The resulting DTMF string. - \param msg The text string to be converted. - \return The length of the DTMF string. -*/ -SPAN_DECLARE(int) v18_encode_dtmf(v18_state_t *s, char dtmf[], const char msg[]); - -/*! Convert a V.18 DTMF string to a text string. - \brief Convert a V.18 DTMF string to a text string. - \param s The V.18 context. - \param msg The resulting test string. - \param dtmf The DTMF string to be converted. - \return The length of the text string. -*/ -SPAN_DECLARE(int) v18_decode_dtmf(v18_state_t *s, char msg[], const char dtmf[]); - -SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch); - -SPAN_DECLARE(uint8_t) v18_decode_baudot(v18_state_t *s, uint8_t ch); - /*! \brief Return a short name for an V.18 mode \param mode The code for the V.18 mode. \return A pointer to the name. diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index d281ff38f7..ee0d6202d9 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -132,18 +132,19 @@ static const res_table_t y_res_table[] = { -1.00f, -1} }; -static const int resolution_map[10][10] = +static const int resolution_map[10][9] = { - { 0, 0, 0, T4_RESOLUTION_R8_STANDARD, 0, 0, 0, 0, 0, 0}, - {T4_RESOLUTION_100_100, 0, T4_RESOLUTION_200_100, 0, 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, T4_RESOLUTION_R8_FINE, 0, 0, 0, 0, 0, 0}, - { 0, 0, T4_RESOLUTION_200_200, 0, 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, T4_RESOLUTION_300_300, 0, 0, 0, 0, 0}, - { 0, 0, 0, T4_RESOLUTION_R8_SUPERFINE, 0, 0, T4_RESOLUTION_R16_SUPERFINE, 0, 0, 0}, - { 0, 0, T4_RESOLUTION_200_400, 0, 0, T4_RESOLUTION_400_400, 0, 0, 0, 0}, - { 0, 0, 0, 0, T4_RESOLUTION_300_600, 0, 0, T4_RESOLUTION_600_600, 0, 0}, - { 0, 0, 0, 0, 0, T4_RESOLUTION_400_800, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0, 0, T4_RESOLUTION_600_1200, 0, T4_RESOLUTION_1200_1200}, + /* x = 100 102 200 204 300 400 408 600 1200 */ + { 0, 0, 0, T4_RESOLUTION_R8_STANDARD, 0, 0, 0, 0, 0}, /* y = 3.85/mm */ + {T4_RESOLUTION_100_100, 0, T4_RESOLUTION_200_100, 0, 0, 0, 0, 0, 0}, /* y = 100 */ + { 0, 0, 0, T4_RESOLUTION_R8_FINE, 0, 0, 0, 0, 0}, /* y = 7.7/mm */ + { 0, 0, T4_RESOLUTION_200_200, 0, 0, 0, 0, 0, 0}, /* y = 200 */ + { 0, 0, 0, 0, T4_RESOLUTION_300_300, 0, 0, 0, 0}, /* y = 300 */ + { 0, 0, 0, T4_RESOLUTION_R8_SUPERFINE, 0, 0, T4_RESOLUTION_R16_SUPERFINE, 0, 0}, /* y = 154/mm */ + { 0, 0, T4_RESOLUTION_200_400, 0, 0, T4_RESOLUTION_400_400, 0, 0, 0}, /* y = 400 */ + { 0, 0, 0, 0, T4_RESOLUTION_300_600, 0, 0, T4_RESOLUTION_600_600, 0}, /* y = 600 */ + { 0, 0, 0, 0, 0, T4_RESOLUTION_400_800, 0, 0, 0}, /* y = 800 */ + { 0, 0, 0, 0, 0, 0, 0, T4_RESOLUTION_600_1200, T4_RESOLUTION_1200_1200} /* y = 1200 */ }; #if defined(SPANDSP_SUPPORT_TIFF_FX) @@ -1354,12 +1355,14 @@ SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_tx_state_t *s, t4_stats_t *t t->image_type = s->tiff.image_type; t->image_width = s->tiff.image_width; t->image_length = s->tiff.image_length; + t->image_x_resolution = s->tiff.x_resolution; t->image_y_resolution = s->tiff.y_resolution; - t->x_resolution = s->metadata.x_resolution; t->y_resolution = s->metadata.y_resolution/s->row_squashing_ratio; + t->compression = s->metadata.compression; + switch (s->metadata.compression) { case T4_COMPRESSION_T4_1D: @@ -1417,7 +1420,7 @@ SPAN_DECLARE(int) t4_tx_image_complete(t4_tx_state_t *s) return t85_encode_image_complete(&s->encoder.t85); #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: - break; + return t88_encode_image_complete(&s->encoder.t88); #endif case T4_COMPRESSION_T42_T81: case T4_COMPRESSION_SYCC_T81: @@ -1428,7 +1431,7 @@ SPAN_DECLARE(int) t4_tx_image_complete(t4_tx_state_t *s) #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: - break; + return t45_encode_image_complete(&s->encoder.t45); #endif } return SIG_STATUS_END_OF_DATA; @@ -1444,6 +1447,19 @@ SPAN_DECLARE(int) t4_tx_get_bit(t4_tx_state_t *s) SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len) { +#if 0 + if (s->pre_encoded_len > 0) + { + if (max_len > (s->pre_encoded_len - s->pre_encoded_ptr)) + max_len = s->pre_encoded_len - s->pre_encoded_ptr; + memcpy(buf, &s->pre_encoded_buf[s->pre_encoded_ptr], max_len); + s->pre_encoded_ptr += max_len; + return max_len; + } + + if (s->image_get_handler) + return s->image_get_handler((void *) &s->encoder, buf, max_len); +#else switch (s->metadata.compression) { case T4_COMPRESSION_T4_1D: @@ -1469,6 +1485,7 @@ SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len) break; #endif } +#endif return 0; } /*- End of function --------------------------------------------------------*/ @@ -1497,31 +1514,44 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_tx_state_t *s) case T4_COMPRESSION_T4_2D: case T4_COMPRESSION_T6: t4_t6_encode_restart(&s->encoder.t4_t6, s->metadata.image_width, s->metadata.image_length); + s->image_get_handler = (t4_image_get_handler_t) t4_t6_encode_get; break; case T4_COMPRESSION_T85: case T4_COMPRESSION_T85_L0: t85_encode_restart(&s->encoder.t85, s->metadata.image_width, s->metadata.image_length); + s->image_get_handler = (t4_image_get_handler_t) t85_encode_get; break; #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: + t88_encode_restart(&s->encoder.t88, s->metadata.image_width, s->metadata.image_length); + s->image_get_handler = (t4_image_get_handler_t) t88_encode_get; break; #endif case T4_COMPRESSION_T42_T81: case T4_COMPRESSION_SYCC_T81: t42_encode_restart(&s->encoder.t42, s->metadata.image_width, s->metadata.image_length); + s->image_get_handler = (t4_image_get_handler_t) t42_encode_get; break; #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: t43_encode_restart(&s->encoder.t43, s->metadata.image_width, s->metadata.image_length); + s->image_get_handler = (t4_image_get_handler_t) t43_encode_get; break; #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: + t45_encode_restart(&s->encoder.t45, s->metadata.image_width, s->metadata.image_length); + s->image_get_handler = (t4_image_get_handler_t) t45_encode_get; break; #endif + default: + s->image_get_handler = NULL; + break; } + /* If there is a page header, create that first */ - if (s->tiff.image_type == T4_IMAGE_TYPE_BILEVEL && s->header_info && s->header_info[0] && make_header(s) == 0) + if (s->metadata.image_type == T4_IMAGE_TYPE_BILEVEL && s->header_info && s->header_info[0] && make_header(s) == 0) + //if (s->header_info && s->header_info[0] && make_header(s) == 0) { s->header_row = 0; set_row_read_handler(s, header_row_read_handler, (void *) s); @@ -1634,7 +1664,7 @@ SPAN_DECLARE(int) t4_tx_release(t4_tx_state_t *s) return t85_encode_release(&s->encoder.t85); #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: - break; + return t88_encode_release(&s->encoder.t88); #endif case T4_COMPRESSION_T42_T81: case T4_COMPRESSION_SYCC_T81: @@ -1645,7 +1675,7 @@ SPAN_DECLARE(int) t4_tx_release(t4_tx_state_t *s) #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: - break; + return t45_encode_release(&s->encoder.t45); #endif } return -1; diff --git a/libs/spandsp/src/v18.c b/libs/spandsp/src/v18.c index 70a9cacc91..65783eb73b 100644 --- a/libs/spandsp/src/v18.c +++ b/libs/spandsp/src/v18.c @@ -78,13 +78,13 @@ Silence for 0.5s then send TXP DTMF Proceed as Annex B - 1650Hz (V21 ch 2 low) + 1650Hz (V21 ch 2 low) [1650Hz +-12Hz] Proceed as Annex F in call mode - 1300Hz (Calling tone) + 1300Hz (Calling tone) [1300Hz +-16Hz] Proceed as Annex E in call mode - 1400Hz/1800Hz (Weitbrecht) + 1400Hz/1800Hz (Weitbrecht) [1400Hz +-5% and 1800Hz +-5%] Detect rate and proceed as Annex A - 980Hz/1180Hz (V21 ch 1) + 980Hz/1180Hz (V21 ch 1) [980Hz +-12Hz, 1180Hz +-12Hz] Start timer Tr 2225Hz (Bell ANS) Proceed as Annex D call mode @@ -98,21 +98,21 @@ Monitor as caller for 980Hz or 1300Hz CI/XCI Respond with ANSam - 1300Hz + 1300Hz [1300Hz +-16Hz] Probe Timer Ta (3s) Probe - 1400Hz/1800Hz (Weitbrecht) + 1400Hz/1800Hz (Weitbrecht) [1400Hz +-5% and 1800Hz +-5%] Detect rate and proceed as Annex A DTMF Proceed as Annex B - 980Hz (V21 ch 1 low) + 980Hz (V21 ch 1 low) [980Hz +-12Hz] Start timer Te 1270Hz (Bell103 ch 2 high) Proceed as Annex D answer mode 2225Hz (Bell ANS) Proceed as Annex D call mode - 1650Hz (V21 ch 2 low) + 1650Hz (V21 ch 2 low) [1650Hz +-12Hz] Proceed as Annex F answer mode ANSam Proceed as V.8 caller Annex G @@ -131,6 +131,7 @@ struct dtmf_to_ascii_s static const struct dtmf_to_ascii_s dtmf_to_ascii[] = { + {"###0", '!'}, {"###1", 'C'}, {"###2", 'F'}, {"###3", 'I'}, @@ -140,7 +141,6 @@ static const struct dtmf_to_ascii_s dtmf_to_ascii[] = {"###7", 'U'}, {"###8", 'X'}, {"###9", ';'}, - {"###0", '!'}, {"##*1", 'A'}, {"##*2", 'D'}, {"##*3", 'G'}, @@ -373,71 +373,174 @@ static const uint8_t txp[] = "1111111111000101011100001101110000010101"; 100 ms mark. */ static const uint8_t xci[] = "01111111110111111111"; -static int cmp(const void *s, const void *t) +/* The entries here must match the order in which the related names are defined in v18.h */ +static const int automoding_sequences[][6] = { - const char *ss; - struct dtmf_to_ascii_s *tt; - - ss = (const char *) s; - tt = (struct dtmf_to_ascii_s *) t; - return strncmp(ss, tt->dtmf, strlen(tt->dtmf)); -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) v18_encode_dtmf(v18_state_t *s, char dtmf[], const char msg[]) -{ - const char *t; - const char *v; - char *u; - - t = msg; - u = dtmf; - while (*t) { - v = ascii_to_dtmf[*t & 0x7F]; - while (*v) - *u++ = *v++; - t++; - } - *u = '\0'; - - return u - dtmf; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) v18_decode_dtmf(v18_state_t *s, char msg[], const char dtmf[]) -{ - int entries; - const char *t; - char *u; - struct dtmf_to_ascii_s *ss; - - entries = sizeof(dtmf_to_ascii)/sizeof(dtmf_to_ascii[0]) - 1; - t = dtmf; - u = msg; - while (*t) + /* Dummy entry 0 */ + V18_MODE_5BIT_4545, + V18_MODE_BELL103, + V18_MODE_V21TEXTPHONE, + V18_MODE_V23VIDEOTEX, + V18_MODE_EDT, + V18_MODE_DTMF + }, { - ss = bsearch(t, dtmf_to_ascii, entries, sizeof(dtmf_to_ascii[0]), cmp); - if (ss) - { - t += strlen(ss->dtmf); - *u++ = ss->ascii; - } - else - { - /* Can't match the code. Let's assume this is a code we just don't know, and skip over it */ - while (*t == '#' || *t == '*') - t++; - if (*t) - t++; - } + /* Australia */ + V18_MODE_5BIT_50, + V18_MODE_V21TEXTPHONE, + V18_MODE_V23VIDEOTEX, + V18_MODE_EDT, + V18_MODE_DTMF, + V18_MODE_BELL103 + }, + { + /* Ireland */ + V18_MODE_5BIT_50, + V18_MODE_V21TEXTPHONE, + V18_MODE_V23VIDEOTEX, + V18_MODE_EDT, + V18_MODE_DTMF, + V18_MODE_BELL103 + }, + { + /* Germany */ + V18_MODE_EDT, + V18_MODE_V21TEXTPHONE, + V18_MODE_V23VIDEOTEX, + V18_MODE_5BIT_50, + V18_MODE_DTMF, + V18_MODE_BELL103 + }, + { + /* Switzerland */ + V18_MODE_EDT, + V18_MODE_V21TEXTPHONE, + V18_MODE_V23VIDEOTEX, + V18_MODE_5BIT_50, + V18_MODE_DTMF, + V18_MODE_BELL103 + }, + { + /* Italy */ + V18_MODE_EDT, + V18_MODE_V21TEXTPHONE, + V18_MODE_V23VIDEOTEX, + V18_MODE_5BIT_50, + V18_MODE_DTMF, + V18_MODE_BELL103 + }, + { + /* Spain */ + V18_MODE_EDT, + V18_MODE_V21TEXTPHONE, + V18_MODE_V23VIDEOTEX, + V18_MODE_5BIT_50, + V18_MODE_DTMF, + V18_MODE_BELL103 + }, + { + /* Austria */ + V18_MODE_EDT, + V18_MODE_V21TEXTPHONE, + V18_MODE_V23VIDEOTEX, + V18_MODE_5BIT_50, + V18_MODE_DTMF, + V18_MODE_BELL103 + }, + { + /* Netherlands */ + V18_MODE_DTMF, + V18_MODE_V21TEXTPHONE, + V18_MODE_V23VIDEOTEX, + V18_MODE_5BIT_50, + V18_MODE_EDT, + V18_MODE_BELL103 + }, + { + /* Iceland */ + V18_MODE_V21TEXTPHONE, + V18_MODE_DTMF, + V18_MODE_5BIT_50, + V18_MODE_EDT, + V18_MODE_V23VIDEOTEX, + V18_MODE_BELL103 + }, + { + /* Norway */ + V18_MODE_V21TEXTPHONE, + V18_MODE_DTMF, + V18_MODE_5BIT_50, + V18_MODE_EDT, + V18_MODE_V23VIDEOTEX, + V18_MODE_BELL103 + }, + { + /* Sweden */ + V18_MODE_V21TEXTPHONE, + V18_MODE_DTMF, + V18_MODE_5BIT_50, + V18_MODE_EDT, + V18_MODE_V23VIDEOTEX, + V18_MODE_BELL103 + }, + { + /* Finland */ + V18_MODE_V21TEXTPHONE, + V18_MODE_DTMF, + V18_MODE_5BIT_50, + V18_MODE_EDT, + V18_MODE_V23VIDEOTEX, + V18_MODE_BELL103 + }, + { + /* Denmark */ + V18_MODE_V21TEXTPHONE, + V18_MODE_DTMF, + V18_MODE_5BIT_50, + V18_MODE_EDT, + V18_MODE_V23VIDEOTEX, + V18_MODE_BELL103 + }, + { + /* UK */ + V18_MODE_V21TEXTPHONE, + V18_MODE_5BIT_50, + V18_MODE_V23VIDEOTEX, + V18_MODE_EDT, + V18_MODE_DTMF, + V18_MODE_BELL103 + }, + { + /* USA */ + V18_MODE_5BIT_4545, + V18_MODE_BELL103, + V18_MODE_V21TEXTPHONE, + V18_MODE_V23VIDEOTEX, + V18_MODE_EDT, + V18_MODE_DTMF + }, + { + /* France */ + V18_MODE_V23VIDEOTEX, + V18_MODE_EDT, + V18_MODE_DTMF, + V18_MODE_5BIT_50, + V18_MODE_V21TEXTPHONE, + V18_MODE_BELL103 + }, + { + /* Belgium */ + V18_MODE_V23VIDEOTEX, + V18_MODE_EDT, + V18_MODE_DTMF, + V18_MODE_5BIT_50, + V18_MODE_V21TEXTPHONE, + V18_MODE_BELL103 } - *u = '\0'; - return u - msg; -} -/*- End of function --------------------------------------------------------*/ +}; -SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch) +static uint16_t encode_baudot(v18_state_t *s, uint8_t ch) { static const uint8_t conv[128] = { @@ -449,7 +552,7 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch) 0xFF, /* ENQ */ 0xFF, /* ACK */ 0xFF, /* BEL */ - 0x00, /* BS */ + 0x40, /* BS */ 0x44, /* HT >> SPACE */ 0x42, /* LF */ 0x42, /* VT >> LF */ @@ -572,14 +675,7 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch) }; uint16_t shift; - if (ch == 0x7F) - { - /* DLE is a special character meaning "force a - change to the letter character set */ - shift = BAUDOT_LETTER_SHIFT; - return 0; - } - ch = conv[ch]; + ch = conv[ch & 0x7F]; /* Is it a non-existant code? */ if (ch == 0xFF) return 0; @@ -605,7 +701,7 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(uint8_t) v18_decode_baudot(v18_state_t *s, uint8_t ch) +static uint8_t decode_baudot(v18_state_t *s, uint8_t ch) { static const uint8_t conv[2][32] = { @@ -624,8 +720,8 @@ SPAN_DECLARE(uint8_t) v18_decode_baudot(v18_state_t *s, uint8_t ch) default: return conv[s->baudot_rx_shift][ch]; } - /* return 0 if we did not produce a character */ - return 0; + /* Return 0xFF if we did not produce a character */ + return 0xFF; } /*- End of function --------------------------------------------------------*/ @@ -649,7 +745,7 @@ static int v18_tdd_get_async_byte(void *user_data) if (s->tx_signal_on) { /* The FSK should now be switched off. */ - s->tx_signal_on = FALSE; + s->tx_signal_on = 0; } return 0x1F; } @@ -659,14 +755,16 @@ static void v18_dtmf_get(void *user_data) { v18_state_t *s; int ch; - const char *v; + int len; + const char *t; s = (v18_state_t *) user_data; if ((ch = queue_read_byte(&s->queue.queue)) >= 0) { - v = ascii_to_dtmf[ch & 0x7F]; - dtmf_tx_put(&s->dtmf_tx, v, strlen(v)); - s->rx_suppression = ((300 + 100*strlen(v))*SAMPLE_RATE)/1000; + t = ascii_to_dtmf[ch & 0x7F]; + len = strlen(t); + dtmf_tx_put(&s->dtmf_tx, t, len); + s->rx_suppression = ((300 + 100*len)*SAMPLE_RATE)/1000; } } /*- End of function --------------------------------------------------------*/ @@ -685,7 +783,7 @@ static int v18_edt_get_async_byte(void *user_data) if (s->tx_signal_on) { /* The FSK should now be switched off. */ - s->tx_signal_on = FALSE; + s->tx_signal_on = 0; } return 0; } @@ -726,7 +824,7 @@ static void v18_tdd_put_async_byte(void *user_data, int byte) return; } span_log(&s->logging, SPAN_LOG_FLOW, "Rx byte %x\n", byte); - if ((octet = v18_decode_baudot(s, byte))) + if ((octet = decode_baudot(s, byte)) != 0xFF) s->rx_msg[s->rx_msg_len++] = octet; if (s->rx_msg_len >= 256) { @@ -738,11 +836,55 @@ static void v18_tdd_put_async_byte(void *user_data, int byte) } /*- End of function --------------------------------------------------------*/ +static int decode_dtmf_cmp(const void *s, const void *t) +{ + const char *ss; + struct dtmf_to_ascii_s *tt; + + ss = (const char *) s; + tt = (struct dtmf_to_ascii_s *) t; + return strncmp(ss, tt->dtmf, strlen(tt->dtmf)); +} +/*- End of function --------------------------------------------------------*/ + +static int decode_dtmf(v18_state_t *s, char msg[], const char dtmf[]) +{ + int entries; + int len; + const char *t; + char *u; + struct dtmf_to_ascii_s *ss; + + entries = sizeof(dtmf_to_ascii)/sizeof(dtmf_to_ascii[0]) - 1; + t = dtmf; + u = msg; + while (*t) + { + ss = bsearch(t, dtmf_to_ascii, entries, sizeof(dtmf_to_ascii[0]), decode_dtmf_cmp); + if (ss) + { + len = strlen(ss->dtmf); + t += len; + *u++ = ss->ascii; + return len; + } + /* Can't match the code. Let's assume this is a code we just don't know, and skip over it */ + while (*t == '#' || *t == '*') + t++; + if (*t) + t++; + } + *u = '\0'; + return u - msg; +} +/*- End of function --------------------------------------------------------*/ + static void v18_dtmf_put(void *user_data, const char dtmf[], int len) { v18_state_t *s; char buf[128]; int i; + int matched; s = (v18_state_t *) user_data; if (s->rx_suppression > 0) @@ -753,11 +895,17 @@ static void v18_dtmf_put(void *user_data, const char dtmf[], int len) if (dtmf[i] >= '0' && dtmf[i] <= '9') { s->rx_msg[s->rx_msg_len] = '\0'; - if (v18_decode_dtmf(s, buf, (const char *) s->rx_msg) > 0) + if ((matched = decode_dtmf(s, buf, (const char *) s->rx_msg)) > 0) + { + buf[1] = '\0'; s->put_msg(s->user_data, (const uint8_t *) buf, 1); - s->rx_msg_len = 0; + } + if (s->rx_msg_len > matched) + memcpy(&s->rx_msg[0], &s->rx_msg[matched], s->rx_msg_len - matched); + s->rx_msg_len -= matched; } } + s->in_progress = 5*SAMPLE_RATE; } /*- End of function --------------------------------------------------------*/ @@ -815,7 +963,7 @@ SPAN_DECLARE_NONSTD(int) v18_tx(v18_state_t *s, int16_t *amp, int max_len) if (len < max_len) { if ((lenx = fsk_tx(&s->fsk_tx, amp + len, max_len - len)) <= 0) - s->tx_signal_on = FALSE; + s->tx_signal_on = 0; len += lenx; } break; @@ -894,12 +1042,12 @@ SPAN_DECLARE(int) v18_put(v18_state_t *s, const char msg[], int len) } switch (s->mode) { - case V18_MODE_5BIT_45: + case V18_MODE_5BIT_4545: case V18_MODE_5BIT_50: for (i = 0; i < len; i++) { n = 0; - if ((x = v18_encode_baudot(s, msg[i]))) + if ((x = encode_baudot(s, msg[i]))) { if ((x & 0x3E0)) buf[n++] = (uint8_t) ((x >> 5) & 0x1F); @@ -907,7 +1055,7 @@ SPAN_DECLARE(int) v18_put(v18_state_t *s, const char msg[], int len) /* TODO: Deal with out of space condition */ if (queue_write(&s->queue.queue, (const uint8_t *) buf, n) < 0) return i; - s->tx_signal_on = TRUE; + s->tx_signal_on = 1; } } return len; @@ -920,12 +1068,14 @@ SPAN_DECLARE(int) v18_put(v18_state_t *s, const char msg[], int len) SPAN_DECLARE(const char *) v18_mode_to_str(int mode) { - switch ((mode & 0xFF)) + switch ((mode & 0xFFF)) { case V18_MODE_NONE: return "None"; - case V18_MODE_5BIT_45: + case V18_MODE_5BIT_4545: return "Weitbrecht TDD (45.45bps)"; + case V18_MODE_5BIT_476: + return "Weitbrecht TDD (47.6bps)"; case V18_MODE_5BIT_50: return "Weitbrecht TDD (50bps)"; case V18_MODE_DTMF: @@ -958,6 +1108,9 @@ SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s, put_msg_func_t put_msg, void *user_data) { + if (nation < 0 || nation >= V18_AUTOMODING_END) + return NULL; + if (s == NULL) { if ((s = (v18_state_t *) malloc(sizeof(*s))) == NULL) @@ -965,14 +1118,14 @@ SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s, } memset(s, 0, sizeof(*s)); s->calling_party = calling_party; - s->mode = mode & 0xFF; + s->mode = mode & ~V18_MODE_REPETITIVE_SHIFTS_OPTION; s->put_msg = put_msg; s->user_data = user_data; switch (s->mode) { - case V18_MODE_5BIT_45: - s->repeat_shifts = mode & 0x100; + case V18_MODE_5BIT_4545: + s->repeat_shifts = mode & V18_MODE_REPETITIVE_SHIFTS_OPTION; fsk_tx_init(&s->fsk_tx, &preset_fsk_specs[FSK_WEITBRECHT_4545], async_tx_get_bit, &s->async_tx); async_tx_init(&s->async_tx, 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s); /* Schedule an explicit shift at the start of baudot transmission */ @@ -983,8 +1136,20 @@ SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s, s->baudot_rx_shift = 0; s->next_byte = (uint8_t) 0xFF; break; + case V18_MODE_5BIT_476: + s->repeat_shifts = mode & V18_MODE_REPETITIVE_SHIFTS_OPTION; + fsk_tx_init(&s->fsk_tx, &preset_fsk_specs[FSK_WEITBRECHT_476], async_tx_get_bit, &s->async_tx); + async_tx_init(&s->async_tx, 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s); + /* Schedule an explicit shift at the start of baudot transmission */ + s->baudot_tx_shift = 2; + /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and + ride over the fraction. */ + fsk_rx_init(&s->fsk_rx, &preset_fsk_specs[FSK_WEITBRECHT_476], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); + s->baudot_rx_shift = 0; + s->next_byte = (uint8_t) 0xFF; + break; case V18_MODE_5BIT_50: - s->repeat_shifts = mode & 0x100; + s->repeat_shifts = mode & V18_MODE_REPETITIVE_SHIFTS_OPTION; fsk_tx_init(&s->fsk_tx, &preset_fsk_specs[FSK_WEITBRECHT_50], async_tx_get_bit, &s->async_tx); async_tx_init(&s->async_tx, 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s); /* Schedule an explicit shift at the start of baudot transmission */ diff --git a/libs/spandsp/tests/fax_tests.sh b/libs/spandsp/tests/fax_tests.sh index 4d4d1bc4e5..1fa6d4e19a 100755 --- a/libs/spandsp/tests/fax_tests.sh +++ b/libs/spandsp/tests/fax_tests.sh @@ -70,49 +70,55 @@ LOCALTESTS_DIR=../test-data/local # Colour/gray -> bilevel by not allowing ECM for OPTS in "-p AA" "-p TT" "-p GG" "-p TG" "-p GT" do - IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" - OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-bilevel.tif" - run_colour_fax_test + echo Colour to bi-level tests disabled +# IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" +# OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-bilevel.tif" +# run_colour_fax_test - IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif" - OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif" - run_colour_fax_test +# IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif" +# OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif" +# run_colour_fax_test - IN_FILE="${TIFFFX_DIR}/c03x_02x.tif" - OUT_FILE="${TIFFFX_DIR}/c03x_02x.tif" - run_colour_fax_test +# IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" +# OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif" +# run_colour_fax_test - IN_FILE="${TIFFFX_DIR}/l02x_02x.tif" - OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif" - run_colour_fax_test +# IN_FILE="${TIFFFX_DIR}/c03x_02x.tif" +# OUT_FILE="${TIFFFX_DIR}/c03x_02x.tif" +# run_colour_fax_test - IN_FILE="${TIFFFX_DIR}/l04x_02x.tif" - OUT_FILE="${TIFFFX_DIR}/l04x_02x.tif" - run_colour_fax_test +# IN_FILE="${TIFFFX_DIR}/l02x_02x.tif" +# OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif" +# run_colour_fax_test + +# IN_FILE="${TIFFFX_DIR}/l04x_02x.tif" +# OUT_FILE="${TIFFFX_DIR}/l04x_02x.tif" +# run_colour_fax_test done # Colour/gray -> colour/gray by allowing ECM for OPTS in "-p AA -C -e" "-p TT -C -e" "-p GG -C -e" "-p TG -C -e" "-p GT -C -e" do - IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" - OUT_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" - run_colour_fax_test + echo Colour to colour tests disabled +# IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" +# OUT_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" +# run_colour_fax_test - IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif" - OUT_FILE="${LOCALTESTS_DIR}/lenna-bw.tif" - run_colour_fax_test +# IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif" +# OUT_FILE="${LOCALTESTS_DIR}/lenna-bw.tif" +# run_colour_fax_test - IN_FILE="${TIFFFX_DIR}/c03x_02x.tif" - OUT_FILE="${TIFFFX_DIR}/c03x_02x.tif" - run_colour_fax_test +# IN_FILE="${TIFFFX_DIR}/c03x_02x.tif" +# OUT_FILE="${TIFFFX_DIR}/c03x_02x.tif" +# run_colour_fax_test - IN_FILE="${TIFFFX_DIR}/l02x_02x.tif" - OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif" - run_colour_fax_test +# IN_FILE="${TIFFFX_DIR}/l02x_02x.tif" +# OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif" +# run_colour_fax_test - IN_FILE="${TIFFFX_DIR}/l04x_02x.tif" - OUT_FILE="${TIFFFX_DIR}/l04x_02x.tif" - run_colour_fax_test +# IN_FILE="${TIFFFX_DIR}/l04x_02x.tif" +# OUT_FILE="${TIFFFX_DIR}/l04x_02x.tif" +# run_colour_fax_test done # Bi-level tests diff --git a/libs/spandsp/tests/v18_tests.c b/libs/spandsp/tests/v18_tests.c index 2293d39883..0cb6d93b8f 100644 --- a/libs/spandsp/tests/v18_tests.c +++ b/libs/spandsp/tests/v18_tests.c @@ -50,7 +50,7 @@ int log_audio = FALSE; SNDFILE *outhandle = NULL; -char result[1024]; +char result[2][1024]; int unexpected_echo = FALSE; char *decode_test_file = NULL; @@ -103,11 +103,11 @@ static void basic_tests(int mode) v18[0] = v18_init(NULL, TRUE, mode, V18_AUTOMODING_GLOBAL, put_text_msg, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); + span_log_set_tag(logging, "Tester"); v18[1] = v18_init(NULL, FALSE, mode, V18_AUTOMODING_GLOBAL, put_text_msg, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -227,14 +227,14 @@ static int test_misc_01(void) TUT should continue to probe until the test is terminated. Comments: This feature should also be verified by observation during the automoding tests. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -326,14 +326,14 @@ static int test_misc_02(void) Comments: The TUT should indicate that carrier has been lost at some time after the 1650Hz signal is lost. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -425,14 +425,14 @@ static int test_misc_03(void) Comments: The TUT should indicate that carrier has been lost at some time after the carrier signal is removed and not disconnect. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -523,14 +523,14 @@ static int test_misc_04(void) automatically hang up when busy tone is detected. PABX busy tones may differ in frequency and cadence from national parameters. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -618,14 +618,14 @@ static int test_misc_05(void) Pass criteria: The RINGING condition should be visually indicated by the TUT. Comments: This test should be repeated across a range of valid timings and ring voltages. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -716,14 +716,14 @@ static int test_misc_06(void) mode. There may be other cases, e.g. where the V.18 DCE is used in a gateway, when automatic disconnection is required. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -812,14 +812,14 @@ static int test_misc_07(void) However, this may possibly not be indicated by the DTE. Comments: The possible modes are: V.21, V.23, Baudot 45, Baudot 50, EDT, Bell 103, DTMF. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -909,14 +909,14 @@ static int test_misc_08(void) Comment: The response times and signal level thresholds of Circuit 135 are not specified in ITU-T V.18 or V.24 and therefore the pattern indicated may vary. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -1003,14 +1003,14 @@ static int test_misc_09(void) Pass criteria: TBD Comment: TBD */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -1106,14 +1106,14 @@ static int test_org_01(void) 8) The whole sequence should be repeated until the call is cleared. 9) When V.18 to V.18, the XCI must not force V.23 or Minitel mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -1204,14 +1204,14 @@ static int test_org_02(void) 2) The TUT should reply with transmission of TXP as defined in 5.1.2. 3) Verify that TXP sequence has correct bit pattern. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -1299,14 +1299,14 @@ static int test_org_03(void) Pass criteria: The TUT should stop sending TXP at the end of the current sequence when ANS tone ceases. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -1388,7 +1388,7 @@ static int test_org_04(void) III.5.4.2.4 ANS tone followed by TXP Purpose: To check correct detection of V.18 modem. Preamble: Tests ORG-02 and ORG-03 should be successfully completed prior to this test. - Method: Tester transmits ANS for 2.5 seconds followed by 75 ms of no tone then transmits + Method: Tester transmits ANS for 2.5 seconds followed by 75ms of no tone then transmits 3 TXP sequences using V.21 (2) and starts a 1 s timer. It will then transmit 1650Hz for 5 seconds. Pass criteria: 1) TUT should initially respond with TXP. @@ -1398,14 +1398,14 @@ static int test_org_04(void) with the V.18 operational requirements. Comments: The TUT should indicate that V.18 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -1488,7 +1488,7 @@ static int test_org_05(void) Purpose: To check correct detection of V.21 modem upper channel when preceded by answer tone and to confirm discrimination between V.21 and V.18 modes. Preamble: Tests ORG-02 and ORG-03 should be successfully completed prior to this test. - Method: Tester transmits ANS for 2.5 seconds followed by 75 ms of no tone then transmits + Method: Tester transmits ANS for 2.5 seconds followed by 75ms of no tone then transmits 1650Hz and starts a 0.7 second timer. Pass criteria: 1) TUT should initially respond with TXP. 2) TUT should stop sending TXP within 0.2 seconds of end of ANS. @@ -1498,14 +1498,14 @@ static int test_org_05(void) examination of TUT. If there is no visual indication, verify by use of ITU-T T.50 for ITU-T V.21 as opposed to UTF-8 coded ISO 10646 character set for ITU-T V.18. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -1588,7 +1588,7 @@ static int test_org_06(void) Purpose: To check correct detection of V.23 modem upper channel when preceded by answer tone. Preamble: Tests ORG-02 and ORG-03 should be successfully completed prior to this test. - Method: Tester transmits ANS for 2.5 seconds followed by 75 ms of no tone then transmits + Method: Tester transmits ANS for 2.5 seconds followed by 75ms of no tone then transmits 1300Hz and starts a 2.7 s timer. Pass criteria: 1) TUT should initially respond with TXP. 2) TUT should stop sending TXP within 0.2 seconds of end of ANS. @@ -1597,14 +1597,14 @@ static int test_org_06(void) by the TUT to comply with Annex E. Comments: The TUT should indicate that V.23 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -1696,14 +1696,14 @@ static int test_org_07(void) literally. It may however, occur when connected to certain Swedish textphones if the handset is lifted just after the start of an automatically answered incoming call. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -1791,14 +1791,14 @@ static int test_org_08(void) 2) Data should be transmitted and received at 300 bit/s to comply with Annex D. Comments: The TUT should indicate that Bell 103 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -1886,14 +1886,14 @@ static int test_org_09(void) 2) Data should be transmitted and received at 300 bit/s to comply with Annex F. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -1982,14 +1982,14 @@ static int test_org_10(void) by the TUT to comply with Annex E. Comments: The TUT should indicate that V.23 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -2081,14 +2081,14 @@ static int test_org_11(void) Comments: The TUT should indicate that V.23 mode has been selected at least 3 seconds after the start of the 390Hz tone. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -2185,14 +2185,14 @@ static int test_org_12(void) automode answer state. The TUT may then select either 45.45 or 50 bit/s for the transmission. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -2275,7 +2275,7 @@ static int test_org_13(void) Purpose: To verify whether the TUT correctly recognizes DTMF signals during the 2-second interval between transmission of CI. Preamble: N/A - Method: The tester will send a single DTMF tone of 40 ms duration to TUT. When TUT + Method: The tester will send a single DTMF tone of 40ms duration to TUT. When TUT indicates a connection, type at least 5 characters back to the tester so that correct selection of mode can be confirmed. Pass criteria: The tester will analyse the received characters to confirm DTMF mode selection. @@ -2283,14 +2283,14 @@ static int test_org_13(void) TUT should comply with ITU-T Q.24 for the Danish Administration while receiving for best possible performance. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -2383,14 +2383,14 @@ static int test_org_14(void) the number lost should be minimal. The data bits and parity are specified in Annex C. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -2478,14 +2478,14 @@ static int test_org_15(void) the CI signal. Comments: Echoes of the CI sequences may be detected at 300 bit/s. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -2573,14 +2573,14 @@ static int test_org_16(void) 2) Data should be transmitted and received at 300 bit/s complying with Annex F. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -2666,14 +2666,14 @@ static int test_org_17(void) Pass criteria: TUT should not respond to the 980Hz tone and resume sending CI signals after a maximum of 2.4 seconds from the end of the 980Hz tone. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -2761,14 +2761,14 @@ static int test_org_18(void) Comments: This implies timer Tr has expired 2 seconds after the start of the 980Hz tone and then 1650Hz has been detected for 0.5 seconds. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -2855,14 +2855,14 @@ static int test_org_19(void) 2) Data should be transmitted and received at 300 bit/s complying with Annex D. Comments: The TUT should indicate that Bell 103 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -2956,14 +2956,14 @@ static int test_org_20(void) presence and cadence of the tones for instance by a flashing light. The TUT may disconnect on reception of tones indicating a failed call attempt. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -3053,14 +3053,14 @@ static int test_org_21(void) Comments: Some high speed modems may fall back to a compatibility mode, e.g. V.21 or V.23 that should be correctly detected by the TUT. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -3149,14 +3149,14 @@ static int test_org_22(void) Comments: Ideally the TUT should detect the presence of a fax machine and report it back to the user. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -3245,14 +3245,14 @@ static int test_org_23(void) Comments: Ideally the TUT should report the presence of speech back to the user, e.g. via circuit 135. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -3343,14 +3343,14 @@ static int test_org_24(void) 2) The TUT should reply with transmission of CM as defined in 5.2.13. 3) Verify that CM sequence has correct bit pattern. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -3436,14 +3436,14 @@ static int test_org_25(void) Method: The Test System waits for the TUT to start transmitting V.21 carrier (1). Pass criteria: The TUT should connect by sending V.21 carrier (1). */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -3530,14 +3530,14 @@ static int test_ans_01(void) answers the call. It will then monitor for any signal. Pass criteria: The TUT should start probing 3 seconds after answering the call. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -3626,14 +3626,14 @@ static int test_ans_02(void) Comments: The ANSam tone is a modulated 2100Hz tone. It may have phase reversals. The XCI signal is tested in a separate test. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -3719,21 +3719,21 @@ static int test_ans_03(void) Method: The tester will transmit 2 sequences of 4 CI patterns separated by 2 seconds. On reception of the ANSam tone the tester will wait 0.5 seconds and then begin transmitting the TXP signal in V.21 (1) mode. - Pass criteria: 1) On reception of the TXP signal, the TUT should remain silent for 75+-5 ms. + Pass criteria: 1) On reception of the TXP signal, the TUT should remain silent for 75+-5ms. 2) The TUT should then transmit 3 TXP sequences in V.21(2) mode. 3) The 3 TXPs should be followed by continuous 1650Hz. 4) Correct transmission and reception of T.140 data should be verified after the V.18 mode connection is completed. Comments: The TUT should indicate V.18 mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -3820,14 +3820,14 @@ static int test_ans_04(void) Pass criteria: The TUT should start probing 3 seconds after ANSam disappears. Comments: It is assumed that timer Ta is restarted on return to Monitor A. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -3910,19 +3910,19 @@ static int test_ans_05(void) Purpose: To check correct detection of V.21 modem lower channel when preceded by answer tone. Preamble: N/A - Method: Tester transmits ANS for 2.5 seconds followed by 75 ms of no tone then transmits + Method: Tester transmits ANS for 2.5 seconds followed by 75ms of no tone then transmits 980Hz and starts a 1 s timer. - Pass criteria: TUT should respond with 1650Hz within 400+-100 ms of start of 980Hz. + Pass criteria: TUT should respond with 1650Hz within 400+-100ms of start of 980Hz. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -4005,19 +4005,19 @@ static int test_ans_06(void) Purpose: To check correct detection of V.23 modem upper channel when preceded by answer tone. Preamble: N/A - Method: Tester transmits ANS for 2.5 seconds followed by 75 ms of no tone then transmits + Method: Tester transmits ANS for 2.5 seconds followed by 75ms of no tone then transmits 1300Hz and starts a 2-s timer. Pass criteria: TUT should respond with 390Hz after 1.7(+0.2-0.0) seconds of start of 1300Hz. Comments: The TUT should indicate that V.23 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -4100,19 +4100,19 @@ static int test_ans_07(void) Purpose: To check correct detection of V.21 modem upper channel when preceded by answer tone and to confirm discrimination between V.21 and V.18 modes. Preamble: N/A - Method: Tester transmits ANS for 2.5 seconds followed by 75 ms of no tone then transmits + Method: Tester transmits ANS for 2.5 seconds followed by 75ms of no tone then transmits 1650Hz and starts a 1-second timer. - Pass criteria: TUT should respond with 980Hz within 400+-100 ms of start of 1650Hz. + Pass criteria: TUT should respond with 980Hz within 400+-100ms of start of 1650Hz. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -4202,14 +4202,14 @@ static int test_ans_08(void) Comments: The TUT should indicate a V.21 connection. The time for which each frequency is transmitted is random and varies between 0.64 and 2.56 seconds. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -4291,21 +4291,21 @@ static int test_ans_09(void) III.5.4.3.9 980Hz calling tone detection Purpose: To confirm correct detection of 980Hz calling tones as defined in V.25. Preamble: N/A - Method: The tester will send bursts of 980Hz signals (a) 400 ms, (b) 500 ms, (c) 700 ms and - (d) 800 ms followed by 1 second of silence. - Pass criteria: 1) The TUT should not respond to bursts of 400 or 800 ms. + Method: The tester will send bursts of 980Hz signals (a) 400ms, (b) 500ms, (c) 700ms and + (d) 800ms followed by 1 second of silence. + Pass criteria: 1) The TUT should not respond to bursts of 400 or 800ms. 2) The TUT should immediately begin probing after a burst of 980Hz for 500 or - 700 ms followed by 1 second of silence. + 700ms followed by 1 second of silence. Comments: The probe sent by the TUT will depend on the country setting. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -4392,14 +4392,14 @@ static int test_ans_10(void) Pass criteria: The TUT should respond with a 1650Hz tone in 1.5+-0.1 seconds. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -4490,14 +4490,14 @@ static int test_ans_11(void) be lost during the detection process. However, the number lost should be minimal. The data bits and parity are specified in Annex C. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -4589,14 +4589,14 @@ static int test_ans_12(void) (1650Hz) probe. However, it is catered for in V.18. It is more likely that this is where CI or TXP characters would be detected (see test ANS-02). */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -4679,22 +4679,22 @@ static int test_ans_13(void) Purpose: To ensure that the TUT returns to the Monitor A state on expiry of timer Tr (2 seconds). Timer Tr is started when a modulated V.21 (1) signal is detected. Preamble: N/A - Method: The tester will transmit 980Hz for 200 ms followed by alternating 980Hz/1180Hz - at 110 bit/s for 100 ms followed by 980Hz for 1 second. + Method: The tester will transmit 980Hz for 200ms followed by alternating 980Hz/1180Hz + at 110 bit/s for 100ms followed by 980Hz for 1 second. Pass criteria: The TUT should begin probing 4+-0.5 seconds after the 980Hz signal is removed. Comments: It is not possible to be precise on timings for this test since the definition of a "modulated signal" as in 5.2.4.4 is not specified. Therefore it is not known exactly when timer Tr will start. It is assumed that timer Ta is restarted on re-entering the Monitor A state. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -4777,19 +4777,19 @@ static int test_ans_14(void) Purpose: To ensure that the TUT returns to the Monitor A on expiry of timer Te (2.7 seconds). Timer Te is started when a 980Hz signal is detected. Preamble: N/A - Method: The tester will transmit 980Hz for 200 ms followed silence for 7 s. + Method: The tester will transmit 980Hz for 200ms followed silence for 7 s. Pass criteria: The TUT should begin probing 5.5+-0.5 seconds after the 980Hz signal is removed. Comments: It is assumed that timer Ta (3 seconds) is restarted on re-entering the Monitor A state. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -4887,14 +4887,14 @@ static int test_ans_15(void) automode answer state. The TUT may then select either 45.45 or 50 bit/s for the transmission. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -4976,21 +4976,21 @@ static int test_ans_16(void) III.5.4.3.16 DTMF signal detection Purpose: To verify whether the TUT correctly recognizes DTMF signals. Preamble: N/A - Method: The tester will send a single DTMF tone of 40 ms duration to TUT. When TUT + Method: The tester will send a single DTMF tone of 40ms duration to TUT. When TUT indicates a connection, type at least 5 characters back to the tester so that correct selection of mode can be confirmed. Pass criteria: Tester will analyse the received characters to confirm DTMF mode selection. Comments: The TUT should indicate that it has selected DTMF mode. The DTMF capabilities of the TUT should comply with ITU-T Q.24 for the Danish Administration. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -5076,14 +5076,14 @@ static int test_ans_17(void) Pass criteria: TUT should respond with 2225Hz tone after 0.7+-0.1 s. Comments: The TUT should indicate that Bell 103 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -5170,14 +5170,14 @@ static int test_ans_18(void) Comments: The TUT should indicate that Bell 103 mode has been selected. Bell 103 modems use 2225Hz as both answer tone and higher frequency of the upper channel. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -5263,14 +5263,14 @@ static int test_ans_19(void) Pass criteria: The TUT should respond with 980Hz after 0.4+-0.2 seconds. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -5352,21 +5352,21 @@ static int test_ans_20(void) III.5.4.3.20 1300Hz calling tone discrimination Purpose: To confirm correct detection of 1300Hz calling tones as defined in ITU-T V.25. Preamble: N/A - Method: The tester will send 1300Hz bursts of (a) 400 ms, (b) 500 ms, (c) 700 ms and - (d) 800 ms followed by 1 second of silence. - Pass criteria: 1) The TUT should not respond to bursts of 400 or 800 ms. + Method: The tester will send 1300Hz bursts of (a) 400ms, (b) 500ms, (c) 700ms and + (d) 800ms followed by 1 second of silence. + Pass criteria: 1) The TUT should not respond to bursts of 400 or 800ms. 2) The TUT should immediately begin probing after a burst of 1300Hz for 500 or - 700 ms followed by 1 second of silence. + 700ms followed by 1 second of silence. Comments: The probe sent by the TUT will depend on the country setting. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -5452,14 +5452,14 @@ static int test_ans_21(void) Pass criteria: The TUT should respond with 390Hz after 1.7+-0.1 seconds. Comments: The TUT should indicate that V.23 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -5542,17 +5542,17 @@ static int test_ans_22(void) Purpose: To ensure correct detection of the XCI signal and selection of V.18 mode. Preamble: N/A Method: The tester sends XCI signal as defined in 3.11. On reception of ANS it will become - silent for 500 ms then transmit the TXP signal in V.21 (1) mode. + silent for 500ms then transmit the TXP signal in V.21 (1) mode. Pass criteria: The TUT should respond with TXP using V.21 (2) and select V.18 mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -5641,14 +5641,14 @@ static int test_ans_23(void) Pass criteria: The TUT should use the orders described in Appendix I. Comments: The order of the probes is not mandatory. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -5737,14 +5737,14 @@ static int test_ans_24(void) modes followed by a pause of Tm (default 3) seconds. Comments: The carrierless modes are those described in Annexes A, B and C. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -5828,19 +5828,19 @@ static int test_ans_25(void) of 20 s after a failed connect attempt. Preamble: The TUT should be configured for the UK country setting. Method: The tester will call the TUT, wait for Ta to expire and then during the pause after - the first Baudot probe it will send a 200 ms burst of 1270Hz followed by silence + the first Baudot probe it will send a 200ms burst of 1270Hz followed by silence for 30 s. Pass criteria: The TUT should transmit silence on detecting the 1270Hz tone and then continue probing starting with the V.23 probe 20 seconds after the end of the 1270Hz signal. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -5926,17 +5926,17 @@ static int test_ans_26(void) Method: The tester will call the TUT, wait for Ta to expire and then monitor the probes sent by the TUT. Pass criteria: The TUT should send the ANS tone (2100Hz) for 1 second followed by silence for - 75+-5 ms and then the 1650Hz, 1300Hz and 2225Hz probes for time Tc. + 75+-5ms and then the 1650Hz, 1300Hz and 2225Hz probes for time Tc. Comments: The carrier modes are those described in Annexes D, E, and F. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -6029,14 +6029,14 @@ static int test_ans_27(void) 390Hz. When the 1300Hz probe is not being transmitted, a 390Hz tone may be interpreted as a 400Hz network tone. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -6120,21 +6120,21 @@ static int test_ans_28(void) of 4 s after a failed connect attempt. Preamble: The TUT should be configured for the UK country setting. Method: The tester will call the TUT, wait for Ta to expire and then during the first V.21 - probe it will send a 200 ms burst of 1270Hz followed by silence for 30 s. + probe it will send a 200ms burst of 1270Hz followed by silence for 30 s. Pass criteria: The TUT should transmit silence on detecting the 1270Hz tone and then continue probing with the Baudot stored message 4 seconds after the end of the 1270Hz burst. Comments: It is most likely that the TUT will return to probing time Ta (3 seconds) after the 1270Hz tone ceases. This condition needs further clarification. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -6224,14 +6224,14 @@ static int test_ans_29(void) Comments: The TUT may not respond to any signals while a carrierless mode probe is being sent since these modes are half duplex. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -6323,14 +6323,14 @@ static int test_ans_30(void) tones may be ignored. Some devices may only provide a visual indication of the presence and cadence of the tones for instance by a flashing light. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -6419,14 +6419,14 @@ static int test_ans_31(void) Comments: This is an optional test as detection of the fax calling tone is not required by ITU-T V.18. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -6515,14 +6515,14 @@ static int test_ans_32(void) Comments: Ideally the TUT should report the presence of speech back to the user. This is an optional test. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -6616,14 +6616,14 @@ static int test_ans_33(void) V.18 mode connection is completed. Comments: The TUT should indicate V.18 mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -6717,14 +6717,14 @@ static int test_mon_21(void) for 1 minute. Pass criteria: The TUT should not start probing. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -6807,22 +6807,22 @@ static int test_mon_22(void) Purpose: To confirm correct detection and reporting of 1300Hz calling tones as defined in ITU-T V.25. Preamble: N/A - Method: The tester will send 1300Hz bursts of (a) 400 ms, (b) 500 ms, (c) 700 ms and - (d) 800 ms followed by 1 second of silence. - Pass criteria: 1) The TUT should not respond to bursts of 400 or 800 ms. + Method: The tester will send 1300Hz bursts of (a) 400ms, (b) 500ms, (c) 700ms and + (d) 800ms followed by 1 second of silence. + Pass criteria: 1) The TUT should not respond to bursts of 400 or 800ms. 2) The TUT should report detection of calling tones to the DTE after a burst of - 1300Hz for 500 or 700 ms followed by 1 second of silence. + 1300Hz for 500 or 700ms followed by 1 second of silence. Comments: In automode answer, the 1300Hz calling causes the DCE to start probing. In monitor mode it should only report detection to the DTE. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -6905,22 +6905,22 @@ static int test_mon_23(void) Purpose: To confirm correct detection and reporting of 980Hz calling tones as defined in ITU-T V.25. Preamble: N/A - Method: The tester will send 980Hz bursts of (a) 400 ms, (b) 500 ms, (c) 700 ms and - (d) 800 ms followed by 1 second of silence. - Pass criteria: 1) The TUT should not respond to bursts of 400 or 800 ms. + Method: The tester will send 980Hz bursts of (a) 400ms, (b) 500ms, (c) 700ms and + (d) 800ms followed by 1 second of silence. + Pass criteria: 1) The TUT should not respond to bursts of 400 or 800ms. 2) The TUT should report detection of calling tones to the DTE after a burst of - 980Hz for 500 or 700 ms followed by 1 second of silence. + 980Hz for 500 or 700ms followed by 1 second of silence. Comments: In automode answer, the 980Hz calling causes the DCE to start probing. In monitor mode it should only report detection to the DTE. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -6989,9 +6989,9 @@ static void x_01_put_text_msg(void *user_data, const uint8_t *msg, int len) { printf("1-1 %d '%s'\n", len, msg); if (user_data == NULL) - strcat(result, (const char *) msg); - else - v18_put(v18[1], "abcdefghij", 10); + strcat(result[0], (const char *) msg); + //else + // v18_put(v18[1], "abcdefghij", 10); } /*- End of function --------------------------------------------------------*/ @@ -7010,26 +7010,26 @@ static int test_x_01(void) /* III.5.4.5.1 Baudot carrier timing and receiver disabling - Purpose: To verify that the TUT sends unmodulated carrier for 150 ms before a new character - and disables its receiver for 300 ms after a character is transmitted. + Purpose: To verify that the TUT sends unmodulated carrier for 150ms before a new character + and disables its receiver for 300ms after a character is transmitted. Preamble: Establish a call between the tester and TUT in Baudot mode. Method: The operator should send a single character from the TUT. The tester will immediately start sending a unique character sequence. Examination of the TUT display will show when its receiver is re-enabled. - Pass criteria: 1) The TUT should send unmodulated carrier for 150 ms before the beginning of + Pass criteria: 1) The TUT should send unmodulated carrier for 150ms before the beginning of the start bit. - 2) The receiver should be re-enabled after 300 ms. + 2) The receiver should be re-enabled after 300ms. 3) The tester will confirm that 1 start bit and at least 1.5 stop bits are used. - Comments: The carrier should be maintained during the 300 ms after a character. + Comments: The carrier should be maintained during the 300ms after a character. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, x_01_put_text_msg, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, x_01_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, x_01_put_text_msg, (void *) (intptr_t) 1); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, x_01_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -7091,9 +7091,9 @@ static int test_x_01(void) v18_free(v18[0]); v18_free(v18[1]); ref = "cdefghij"; - printf("Result:\n%s\n", result); + printf("Result:\n%s\n", result[0]); printf("Reference result:\n%s\n", ref); - if (unexpected_echo || strcmp(result, ref) != 0) + if (unexpected_echo || strcmp(result[0], ref) != 0) return -1; return 1; } @@ -7121,14 +7121,14 @@ static int test_x_02(void) transmit the string "abcdef" at each rate. Pass criteria: The tester will measure the bit timings and confirm the rates. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -7218,14 +7218,14 @@ static int test_x_03(void) Comments: The probe message must be long enough for the tester to establish the bit rate. "GA" may not be sufficient. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -7300,7 +7300,7 @@ static void x_04_put_echo_text_msg(void *user_data, const uint8_t *msg, int len) static void x_04_put_text_msg(void *user_data, const uint8_t *msg, int len) { printf("1-1 %d '%s'\n", len, msg); - strcat(result, (const char *) msg); + strcat(result[0], (const char *) msg); } /*- End of function --------------------------------------------------------*/ @@ -7336,14 +7336,14 @@ static int test_x_04(void) assumed that the character conversion is the same for Baudot at 50 bit/s and any other supported speed. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, x_04_put_echo_text_msg, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, x_04_put_echo_text_msg, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, x_04_put_text_msg, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, x_04_put_text_msg, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -7360,7 +7360,7 @@ static int test_x_04(void) exit(2); } - result[0] = '\0'; + result[0][0] = '\0'; unexpected_echo = FALSE; for (i = 0; i < 127; i++) msg[i] = i + 1; @@ -7409,9 +7409,9 @@ static int test_x_04(void) v18_free(v18[0]); v18_free(v18[1]); - printf("Result:\n%s\n", result); + printf("Result:\n%s\n", result[0]); printf("Reference result:\n%s\n", full_baudot_rx); - if (unexpected_echo || strcmp(result, full_baudot_rx) != 0) + if (unexpected_echo || strcmp(result[0], full_baudot_rx) != 0) return -1; return 0; } @@ -7420,7 +7420,7 @@ static int test_x_04(void) static void x_05_put_text_msg(void *user_data, const uint8_t *msg, int len) { if (user_data == NULL) - strcat(result, (const char *) msg); + strcat(result[0], (const char *) msg); else v18_put(v18[1], "behknqtwz", 9); } @@ -7441,23 +7441,23 @@ static int test_x_05(void) /* III.5.4.5.5 DTMF receiver disabling - Purpose: To verify that the TUT disables its DTMF receiver for 300 ms when a character is + Purpose: To verify that the TUT disables its DTMF receiver for 300ms when a character is transmitted. Preamble: Establish a call between the tester and TUT in DTMF mode. Method: The operator should send a single "e" character from the TUT which will result in sending a single DTMF tone to the tester. The tester will immediately start sending a unique character sequence using single DTMF tones. Examination of the TUT display will show when its receiver is re-enabled. - Pass criteria: The receiver should be re-enabled after 300 ms. + Pass criteria: The receiver should be re-enabled after 300ms. */ v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_05_put_text_msg, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); + span_log_set_tag(logging, "Tester"); v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_05_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -7474,7 +7474,7 @@ static int test_x_05(void) exit(2); } - result[0] = '\0'; + result[0][0] = '\0'; v18_put(v18[0], "e", 1); for (i = 0; i < 1000; i++) @@ -7521,9 +7521,9 @@ static int test_x_05(void) v18_free(v18[0]); v18_free(v18[1]); ref = "knqtwz"; - printf("Result:\n%s\n", result); + printf("Result:\n%s\n", result[0]); printf("Reference result:\n%s\n", ref); - if (strcmp(result, ref) != 0) + if (strcmp(result[0], ref) != 0) return -1; return 0; } @@ -7531,7 +7531,9 @@ static int test_x_05(void) static void x_06_put_text_msg(void *user_data, const uint8_t *msg, int len) { - strcat(result, (const char *) msg); + if (user_data == NULL) + else + strcat(result[1], (const char *) msg); } /*- End of function --------------------------------------------------------*/ @@ -7560,19 +7562,19 @@ static int test_x_06(void) after each one. Each character should be responded to at the TUT by typing the same character. Pass criteria: The tester will verify that each character is correctly echoed back by the TUT. - Comments: The conversion table is specified in Annex B. The receiver at the tester may be re- - enabled 100 ms after transmission of each character to maximize likelihood of + Comments: The conversion table is specified in Annex B. The receiver at the tester may be + re-enabled 100ms after transmission of each character to maximize likelihood of receiving character from the TUT. It is assumed that the echo delay in the test system is negligible. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_06_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_06_put_text_msg, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_06_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -7589,16 +7591,12 @@ static int test_x_06(void) exit(2); } - result[0] = '\0'; for (i = 0; i < 127; i++) msg[i] = i + 1; msg[127] = '\0'; printf("Original:\n%s\n", msg); - v18_encode_dtmf(NULL, dtmf, msg); - printf("DTMF:\n%s\n", dtmf); - v18_decode_dtmf(NULL, result, dtmf); - + result[0][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -7640,23 +7638,27 @@ static int test_x_06(void) v18_rx(v18[1], model_amp[0], samples); } - ref = "\b \n\n\n?\n\n\n %+().+,-.0123456789:;(=)" - "?XABCDEFGHIJKLMNOPQRSTUVWXYZ\xC6\xD8\xC5" + ref = "\b \n\n\n?\n\n\n !%+().+,-.0123456789:;(=)?" + "XABCDEFGHIJKLMNOPQRSTUVWXYZ\xC6\xD8\xC5" " abcdefghijklmnopqrstuvwxyz\xE6\xF8\xE5 \b"; - printf("Result:\n%s\n", result); + printf("Result:\n%s\n", result[0]); printf("Reference result:\n%s\n", ref); v18_free(v18[0]); v18_free(v18[1]); - if (strcmp(result, ref) != 0) + if (strcmp(result[1], ref) != 0) return -1; return 0; } /*- End of function --------------------------------------------------------*/ +static void x_07_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_x_07(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -7669,26 +7671,26 @@ static int test_x_07(void) /* III.5.4.5.7 EDT carrier timing and receiver disabling - Purpose: To verify that the TUT sends unmodulated carrier for 300 ms before a character and - disables its receiver for 300 ms after a character is transmitted. + Purpose: To verify that the TUT sends unmodulated carrier for 300ms before a character and + disables its receiver for 300ms after a character is transmitted. Preamble: Establish a call between the tester and TUT in EDT mode. Method: The operator should send a single character from the TUT. The tester will immediately start sending a unique character sequence. Examination of the TUT display will show when its receiver is re-enabled. - Pass criteria: 1) The TUT should send unmodulated carrier for 300 ms before the beginning of + Pass criteria: 1) The TUT should send unmodulated carrier for 300ms before the beginning of the start bit. - 2) The receiver should be re-enabled after 300 ms. + 2) The receiver should be re-enabled after 300ms. 3) The tester will confirm that 1 start bit and at least 1.5 stop bits are used. - Comments: The carrier should be maintained during the 300 ms after a character. + Comments: The carrier should be maintained during the 300ms after a character. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_07_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_07_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -7753,9 +7755,13 @@ static int test_x_07(void) } /*- End of function --------------------------------------------------------*/ +static void x_08_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_x_08(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -7776,14 +7782,14 @@ static int test_x_08(void) 2) The tester should confirm that 1 start bit, 7 data bits, 1 even parity bit and 2 stop bits are used. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_08_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_08_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -7848,9 +7854,13 @@ static int test_x_08(void) } /*- End of function --------------------------------------------------------*/ +static void x_09_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_x_09(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -7874,14 +7884,14 @@ static int test_x_09(void) that there are no duplicate characters on the TUT display. 3) The received string should be correctly displayed despite the incorrect parity. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_09_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_09_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -7946,9 +7956,13 @@ static int test_x_09(void) } /*- End of function --------------------------------------------------------*/ +static void x_10_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_x_10(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -7975,14 +7989,14 @@ static int test_x_10(void) Comments: This test is only applicable to Minitel Dialogue terminals. Prestel and Minitel Normal terminals cannot operate in this mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_10_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_10_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -8047,9 +8061,13 @@ static int test_x_10(void) } /*- End of function --------------------------------------------------------*/ +static void x_11_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_x_11(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -8074,14 +8092,14 @@ static int test_x_11(void) 4) The last five characters on the TUT display should be "12345" (no "6") correctly displayed despite the incorrect parity. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_11_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_11_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -8146,9 +8164,13 @@ static int test_x_11(void) } /*- End of function --------------------------------------------------------*/ +static void x_12_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_x_12(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -8170,14 +8192,14 @@ static int test_x_12(void) Pass criteria: The tester should confirm UTF8 encoded UNICODE characters are used with the controls specified in ITU-T T.140. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_12_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); + span_log_set_tag(logging, "Tester"); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_12_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_tag(logging, "B"); + span_log_set_tag(logging, "TUT"); if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, @@ -8474,8 +8496,8 @@ int main(int argc, char *argv[]) printf("Test not found\n"); exit(2); } - basic_tests(V18_MODE_5BIT_45); - basic_tests(V18_MODE_5BIT_45 | 0x100); + basic_tests(V18_MODE_5BIT_4545); + basic_tests(V18_MODE_5BIT_4545 | V18_MODE_REPETITIVE_SHIFTS_OPTION); if (log_audio) { if (sf_close_telephony(outhandle)) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index b46b9ee396..03d7297edd 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -150,11 +150,11 @@ static int get_v18_mode(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); const char *var; - int r = V18_MODE_5BIT_45; + int r = V18_MODE_5BIT_4545; if ((var = switch_channel_get_variable(channel, "v18_mode"))) { if (!strcasecmp(var, "5BIT_45") || !strcasecmp(var, "baudot")) { - r = V18_MODE_5BIT_45; + r = V18_MODE_5BIT_4545; } else if (!strcasecmp(var, "5BIT_50")) { r = V18_MODE_5BIT_50; } else if (!strcasecmp(var, "DTMF")) { From abcf4ac7e60726ba78b4b3f02955ea3f714aecb1 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 23 Jul 2013 08:43:12 -0500 Subject: [PATCH 08/88] update status command to include new stats --- src/mod/applications/mod_commands/mod_commands.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 627d812738..ef91f36a8d 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2013,6 +2013,7 @@ SWITCH_STANDARD_API(status_function) { switch_core_time_duration_t duration = { 0 }; int sps = 0, last_sps = 0, max_sps = 0, max_sps_fivemin = 0; + int sessions_peak = 0, sessions_peak_fivemin = 0; /* Max Concurrent Sessions buffers */ switch_bool_t html = SWITCH_FALSE; /* shortcut to format.html */ char * nl = "\n"; /* shortcut to format.nl */ stream_format format = { 0 }; @@ -2056,11 +2057,14 @@ SWITCH_STANDARD_API(status_function) switch_core_ready() ? "ready" : "not ready", nl); stream->write_function(stream, "%" SWITCH_SIZE_T_FMT " session(s) since startup%s", switch_core_session_id() - 1, nl); + switch_core_session_ctl(SCSC_SESSIONS_PEAK, &sessions_peak); + switch_core_session_ctl(SCSC_SESSIONS_PEAK_FIVEMIN, &sessions_peak_fivemin); + stream->write_function(stream, "%d session(s) - peak %d, last 5min %d %s", switch_core_session_count(), sessions_peak, sessions_peak_fivemin, nl); switch_core_session_ctl(SCSC_LAST_SPS, &last_sps); switch_core_session_ctl(SCSC_SPS, &sps); switch_core_session_ctl(SCSC_SPS_PEAK, &max_sps); switch_core_session_ctl(SCSC_SPS_PEAK_FIVEMIN, &max_sps_fivemin); - stream->write_function(stream, "%d session(s) - %d out of max %d per sec peak %d (%d last 5min) %s", switch_core_session_count(), last_sps, sps, max_sps, max_sps_fivemin, nl); + stream->write_function(stream, "%d session(s) per Sec out of max %d, peak %d, last 5min %d %s", last_sps, sps, max_sps, max_sps_fivemin, nl); stream->write_function(stream, "%d session(s) max%s", switch_core_session_limit(0), nl); stream->write_function(stream, "min idle cpu %0.2f/%0.2f%s", switch_core_min_idle_cpu(-1.0), switch_core_idle_cpu(), nl); From c1e51752909124eed7a2dc4342b5ff1955351b2b Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 24 Jul 2013 00:21:23 +0800 Subject: [PATCH 09/88] Tweaks to spandsp --- libs/spandsp/src/t30.c | 115 ++-- libs/spandsp/src/t4_rx.c | 24 +- libs/spandsp/src/t4_tx.c | 184 +++-- libs/spandsp/tests/v18_tests.c | 1159 ++++++++++++++++++++++---------- 4 files changed, 1014 insertions(+), 468 deletions(-) diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index 9dd571fe5d..c93636a265 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -435,7 +435,6 @@ static void decode_20digit_msg(t30_state_t *s, char *msg, const uint8_t *pkt, in static void decode_url_msg(t30_state_t *s, char *msg, const uint8_t *pkt, int len); static int decode_nsf_nss_nsc(t30_state_t *s, uint8_t *msg[], const uint8_t *pkt, int len); static void set_min_scan_time(t30_state_t *s); -static int send_cfr_sequence(t30_state_t *s, int start); static void timer_t2_start(t30_state_t *s); static void timer_t2a_start(t30_state_t *s); static void timer_t2b_start(t30_state_t *s); @@ -1217,24 +1216,6 @@ int t30_build_dis_or_dtc(t30_state_t *s) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE); } - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_COLOUR)) - set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE); - - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T42_T81)) - set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T43)) - { - /* Note 25 of table 2/T.30 */ - set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE); - set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); - } - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T45)) - set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_SYCC_T81)) - { - set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); - set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE); - } //if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T88)) //{ // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T88_CAPABILITY_1); @@ -1242,14 +1223,37 @@ int t30_build_dis_or_dtc(t30_state_t *s) // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T88_CAPABILITY_3); //} - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_12BIT)) - set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE); + //if ((s->supported_compressions & (T4_SUPPORT_COMPRESSION_COLOUR | T4_SUPPORT_COMPRESSION_GRAYSCALE))) + { + if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_COLOUR)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE); - //if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_NO_SUBSAMPLING)) - // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING); + if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T42_T81)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); + if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T43)) + { + /* Note 25 of table 2/T.30 */ + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE); + /* No plane interleave */ + } + if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T45)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE); + if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_SYCC_T81)) + { + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE); + } - /* No custom illuminant */ - /* No custom gamut range */ + if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_12BIT)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE); + + //if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_NO_SUBSAMPLING)) + // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING); + + /* No custom illuminant */ + /* No custom gamut range */ + } } if ((s->supported_t30_features & T30_SUPPORT_FIELD_NOT_VALID)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FNV_CAPABLE); @@ -1257,12 +1261,6 @@ int t30_build_dis_or_dtc(t30_state_t *s) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_MULTIPLE_SELECTIVE_POLLING_CAPABLE); if ((s->supported_t30_features & T30_SUPPORT_POLLED_SUB_ADDRESSING)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE); - - /* No plane interleave */ - /* No G.726 */ - /* No extended voice coding */ - /* Superfine minimum scan line time pattern follows fine */ - if ((s->supported_t30_features & T30_SUPPORT_SELECTIVE_POLLING)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE); if ((s->supported_t30_features & T30_SUPPORT_SUB_ADDRESSING)) @@ -1270,10 +1268,16 @@ int t30_build_dis_or_dtc(t30_state_t *s) if ((s->supported_t30_features & T30_SUPPORT_IDENTIFICATION)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_PASSWORD); + /* No G.726 */ + /* No extended voice coding */ + /* Superfine minimum scan line time pattern follows fine */ + /* Ready to transmit a data file (polling) */ if (s->tx_file[0]) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_TRANSMIT_DATA_FILE); + /* No simple phase C BFT negotiations */ + /* No extended BFT negotiations */ /* No Binary file transfer (BFT) */ /* No Document transfer mode (DTM) */ /* No Electronic data interchange (EDI) */ @@ -1295,11 +1299,9 @@ int t30_build_dis_or_dtc(t30_state_t *s) /* No HFX40-I hashing */ /* No alternative hashing system number 2 */ /* No alternative hashing system number 3 */ - /* No T.44 (mixed raster content) */ + /* No T.44 (mixed raster content) */ /* No page length maximum strip size for T.44 (mixed raster content) */ - /* No simple phase C BFT negotiations */ - /* No extended BFT negotiations */ if ((s->supported_t30_features & T30_SUPPORT_INTERNET_SELECTIVE_POLLING_ADDRESS)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS); @@ -1353,9 +1355,9 @@ int t30_build_dis_or_dtc(t30_state_t *s) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_100_100_CAPABLE); if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_R8_STANDARD | T4_SUPPORT_RESOLUTION_R8_FINE | T4_SUPPORT_RESOLUTION_R8_SUPERFINE | T4_SUPPORT_RESOLUTION_R16_SUPERFINE))) - set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED); - if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_200_100 | T4_SUPPORT_RESOLUTION_200_200 | T4_SUPPORT_RESOLUTION_200_400 | T4_SUPPORT_RESOLUTION_300_300 | T4_SUPPORT_RESOLUTION_300_600 | T4_SUPPORT_RESOLUTION_400_400 | T4_SUPPORT_RESOLUTION_400_800 | T4_SUPPORT_RESOLUTION_600_600 | T4_SUPPORT_RESOLUTION_600_1200 | T4_SUPPORT_RESOLUTION_1200_1200))) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED); + if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_200_100 | T4_SUPPORT_RESOLUTION_200_200 | T4_SUPPORT_RESOLUTION_200_400 | T4_SUPPORT_RESOLUTION_300_300 | T4_SUPPORT_RESOLUTION_300_600 | T4_SUPPORT_RESOLUTION_400_400 | T4_SUPPORT_RESOLUTION_400_800 | T4_SUPPORT_RESOLUTION_600_600 | T4_SUPPORT_RESOLUTION_600_1200 | T4_SUPPORT_RESOLUTION_1200_1200))) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED); /* No double sided printing (alternate mode) */ /* No double sided printing (continuous mode) */ @@ -1426,11 +1428,11 @@ static int build_dcs(t30_state_t *s) int image_type; /* Reacquire page information, in case the image was resized, flattened, etc. */ - s->x_resolution = t4_tx_get_x_resolution(&s->t4.tx); - s->y_resolution = t4_tx_get_y_resolution(&s->t4.tx); - s->current_page_resolution = t4_tx_get_resolution(&s->t4.tx); - s->image_width = t4_tx_get_image_width(&s->t4.tx); - image_type = t4_tx_get_image_type(&s->t4.tx); + s->current_page_resolution = t4_tx_get_tx_resolution(&s->t4.tx); + s->x_resolution = t4_tx_get_tx_x_resolution(&s->t4.tx); + s->y_resolution = t4_tx_get_tx_y_resolution(&s->t4.tx); + s->image_width = t4_tx_get_tx_image_width(&s->t4.tx); + image_type = t4_tx_get_tx_image_type(&s->t4.tx); /* Make a DCS frame based on local issues and the latest received DIS/DTC frame. Negotiate the result based on what both parties can do. */ @@ -2399,11 +2401,9 @@ static int step_fallback_entry(t30_state_t *s) } if (fallback_sequence[s->current_fallback].which == 0) return -1; - /* TODO: This only sets the minimum row time for future pages. It doesn't fix up the - current page, though it is benign - fallback will only result in an excessive - minimum. */ + /* We need to update the minimum scan time, in case we are in non-ECM mode. */ set_min_scan_time(s); - /* We need to rebuild the DCS message we will send. */ + /* Now we need to rebuild the DCS message we will send. */ build_dcs(s); return s->current_fallback; } @@ -2669,16 +2669,18 @@ static void set_min_scan_time(t30_state_t *s) } span_log(&s->logging, SPAN_LOG_FLOW, "Remote FAX does not support fine resolution. Squashing image.\n"); /* Fall through */ - default: case T4_Y_RESOLUTION_STANDARD: case T4_Y_RESOLUTION_100: s->min_scan_time_code = translate_min_scan_time[0][min_bits_field]; break; + default: + s->min_scan_time_code = T30_MIN_SCAN_0MS; + break; } - if (!s->error_correcting_mode && (s->iaf & T30_IAF_MODE_NO_FILL_BITS)) + if ((s->iaf & T30_IAF_MODE_NO_FILL_BITS)) min_row_bits = 0; else - min_row_bits = fallback_sequence[s->current_fallback].bit_rate*min_scan_times[s->min_scan_time_code]/1000; + min_row_bits = (fallback_sequence[s->current_fallback].bit_rate*min_scan_times[s->min_scan_time_code])/1000; span_log(&s->logging, SPAN_LOG_FLOW, "Minimum bits per row will be %d\n", min_row_bits); t4_tx_set_min_bits_per_row(&s->t4.tx, min_row_bits); } @@ -2714,10 +2716,11 @@ static int start_sending_document(t30_state_t *s) return -1; } - s->x_resolution = t4_tx_get_x_resolution(&s->t4.tx); - s->y_resolution = t4_tx_get_y_resolution(&s->t4.tx); - s->image_width = t4_tx_get_image_width(&s->t4.tx); - /* The minimum scan time to be used can't be evaluated until we know the Y resolution. */ + s->x_resolution = t4_tx_get_tx_x_resolution(&s->t4.tx); + s->y_resolution = t4_tx_get_tx_y_resolution(&s->t4.tx); + s->image_width = t4_tx_get_tx_image_width(&s->t4.tx); + /* The minimum scan time to be used can't be evaluated until we know the Y resolution, and + must be evaluated before the minimum scan row bits can be evaluated. */ set_min_scan_time(s); if (s->error_correcting_mode) @@ -6483,7 +6486,8 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status) { /* Send the end of page or partial page message */ set_phase(s, T30_PHASE_D_TX); - s->next_tx_step = check_next_tx_step(s); + if (s->ecm_at_page_end) + s->next_tx_step = check_next_tx_step(s); if (send_pps_frame(s) == T30_NULL) set_state(s, T30_STATE_IV_PPS_NULL); else @@ -6808,7 +6812,10 @@ SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s, s->supported_compressions = T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D; s->supported_bilevel_resolutions = T4_SUPPORT_RESOLUTION_R8_STANDARD | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_R8_SUPERFINE; + | T4_SUPPORT_RESOLUTION_R8_SUPERFINE + | T4_SUPPORT_RESOLUTION_200_100 + | T4_SUPPORT_RESOLUTION_200_200 + | T4_SUPPORT_RESOLUTION_200_400; s->supported_image_sizes = T4_SUPPORT_WIDTH_215MM | T4_SUPPORT_LENGTH_US_LETTER | T4_SUPPORT_LENGTH_US_LEGAL diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index 7723e14eb2..247b9ae726 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -371,6 +371,7 @@ static int set_tiff_directory_info(t4_rx_state_t *s) break; #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: + s->metadata.image_length = t88_decode_get_image_length(&s->decoder.t88); break; #endif case T4_COMPRESSION_T42_T81: @@ -383,6 +384,7 @@ static int set_tiff_directory_info(t4_rx_state_t *s) #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: + s->metadata.image_length = t45_decode_get_image_length(&s->decoder.t45); break; #endif } @@ -884,7 +886,7 @@ SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_rx_state_t *s, t4_row_write_han return t85_decode_set_row_write_handler(&s->decoder.t85, handler, user_data); #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: - break; + return t88_decode_set_row_write_handler(&s->decoder.t88, handler, user_data); #endif case T4_COMPRESSION_T42_T81: return t42_decode_set_row_write_handler(&s->decoder.t42, handler, user_data); @@ -894,7 +896,7 @@ SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_rx_state_t *s, t4_row_write_han #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: - break; + return t45_decode_set_row_write_handler(&s->decoder.t45, handler, user_data); #endif } return -1; @@ -942,7 +944,7 @@ SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t break; #endif case T4_COMPRESSION_T42_T81: - t->type = 0; + t->type = T4_IMAGE_TYPE_COLOUR_8BIT; //T4_IMAGE_TYPE_GRAY_8BIT; t->width = t42_decode_get_image_width(&s->decoder.t42); t->length = t42_decode_get_image_length(&s->decoder.t42); t->image_type = t->type; @@ -952,7 +954,7 @@ SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t break; #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: - t->type = 0; + t->type = T4_IMAGE_TYPE_COLOUR_8BIT; t->width = t43_decode_get_image_width(&s->decoder.t43); t->length = t43_decode_get_image_length(&s->decoder.t43); t->image_type = t->type; @@ -986,6 +988,7 @@ SPAN_DECLARE(int) t4_rx_start_page(t4_rx_state_t *s) break; #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: + t88_decode_restart(&s->decoder.t88); break; #endif case T4_COMPRESSION_T42_T81: @@ -998,6 +1001,7 @@ SPAN_DECLARE(int) t4_rx_start_page(t4_rx_state_t *s) #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: + t45_decode_restart(&s->decoder.t45); break; #endif } @@ -1052,11 +1056,17 @@ SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s) break; #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: + t88_decode_put(&s->decoder.t88, NULL, 0); + length = t88_decode_get_image_length(&s->decoder.t88); break; #endif case T4_COMPRESSION_T42_T81: t42_decode_put(&s->decoder.t42, NULL, 0); length = t42_decode_get_image_length(&s->decoder.t42); + if (s->decoder.t42.samples_per_pixel == 3) + select_tiff_compression(s, T4_IMAGE_TYPE_COLOUR_8BIT); + else + select_tiff_compression(s, T4_IMAGE_TYPE_GRAY_8BIT); break; #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: @@ -1066,6 +1076,8 @@ SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s) #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: + t45_decode_put(&s->decoder.t45, NULL, 0); + length = t45_decode_get_image_length(&s->decoder.t45); break; #endif } @@ -1156,7 +1168,7 @@ SPAN_DECLARE(int) t4_rx_release(t4_rx_state_t *s) return t85_decode_release(&s->decoder.t85); #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: - break; + return t88_decode_release(&s->decoder.t88); #endif case T4_COMPRESSION_T42_T81: return t42_decode_release(&s->decoder.t42); @@ -1166,7 +1178,7 @@ SPAN_DECLARE(int) t4_rx_release(t4_rx_state_t *s) #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: - break; + return t45_decode_release(&s->decoder.t45); #endif } return -1; diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index ee0d6202d9..d0001aa720 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -485,7 +485,7 @@ static int test_tiff_directory_info(t4_tx_state_t *s) parm32 = 0; TIFFGetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, &parm32); - if (s->metadata.image_width != (int) parm32) + if (s->tiff.image_width != (int) parm32) return 1; x_resolution = 0.0f; TIFFGetField(t->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution); @@ -541,16 +541,16 @@ static int tiff_row_read_handler(void *user_data, uint8_t buf[], size_t len) int j; s = (t4_tx_state_t *) user_data; - if (s->tiff.row >= s->metadata.image_length) + if (s->tiff.row >= s->tiff.image_length) return 0; memcpy(buf, &s->tiff.image_buffer[s->tiff.row*len], len); s->tiff.row++; /* If this is a bi-level image which has more vertical resolution than the far end will accept, we need to squash it down to size. */ - for (i = 1; i < s->row_squashing_ratio && s->tiff.row < s->metadata.image_length; i++) + for (i = 1; i < s->row_squashing_ratio && s->tiff.row < s->tiff.image_length; i++) { - for (j = 0; j < s->metadata.image_width/8; j++) + for (j = 0; j < s->tiff.image_width/8; j++) buf[j] |= s->tiff.image_buffer[s->tiff.row*len + j]; s->tiff.row++; } @@ -604,7 +604,6 @@ static int read_tiff_t85_image(t4_tx_state_t *s) { int biggest; int num_strips; - int total_len; int len; int i; int result; @@ -615,8 +614,8 @@ static int read_tiff_t85_image(t4_tx_state_t *s) /* Size up and allocate the buffer for the raw data */ num_strips = TIFFNumberOfStrips(s->tiff.tiff_file); - biggest = TIFFRawStripSize(s->tiff.tiff_file, 0); - for (i = 1; i < num_strips; i++) + biggest = 0; + for (i = 0; i < num_strips; i++) { len = TIFFRawStripSize(s->tiff.tiff_file, i); if (len > biggest) @@ -625,11 +624,14 @@ static int read_tiff_t85_image(t4_tx_state_t *s) if ((raw_data = malloc(biggest)) == NULL) return -1; - s->tiff.image_size = s->metadata.image_length*((s->metadata.image_width + 7)/8); + s->tiff.image_size = s->tiff.image_length*((s->tiff.image_width + 7)/8); if (s->tiff.image_size >= s->tiff.image_buffer_size) { if ((t = realloc(s->tiff.image_buffer, s->tiff.image_size)) == NULL) + { + free(raw_data); return -1; + } s->tiff.image_buffer_size = s->tiff.image_size; s->tiff.image_buffer = t; } @@ -640,14 +642,14 @@ static int read_tiff_t85_image(t4_tx_state_t *s) t85_decode_init(&t85, packing_row_write_handler, &pack); t85_decode_set_comment_handler(&t85, 1000, embedded_comment_handler, s); - total_len = 0; result = -1; - for (i = 0; i < num_strips; i++, total_len += len) + for (i = 0; i < num_strips; i++) { len = TIFFRawStripSize(s->tiff.tiff_file, i); if ((len = TIFFReadRawStrip(s->tiff.tiff_file, i, raw_data, len)) < 0) { - span_log(&s->logging, SPAN_LOG_WARNING, "%s: ReadRaw error.\n", s->tiff.file); + span_log(&s->logging, SPAN_LOG_WARNING, "%s: TIFFReadRawStrip error.\n", s->tiff.file); + free(raw_data); return -1; } result = t85_decode_put(&t85, raw_data, len); @@ -658,7 +660,7 @@ static int read_tiff_t85_image(t4_tx_state_t *s) result = t85_decode_put(&t85, NULL, 0); len = t85_decode_get_compressed_image_size(&t85); - span_log(&s->logging, SPAN_LOG_WARNING, "Compressed image is %d bytes, %d rows\n", len/8, s->metadata.image_length); + span_log(&s->logging, SPAN_LOG_WARNING, "Compressed image is %d bytes, %d rows\n", len/8, s->tiff.image_length); t85_decode_release(&t85); free(raw_data); return 0; @@ -717,20 +719,26 @@ static int read_tiff_t43_image(t4_tx_state_t *s, uint8_t **buf) #endif #if 0 -static int read_tiff_t42_t81_image(t4_tx_state_t *s, uint8_t **buf) +static int read_tiff_t42_t81_image(t4_tx_state_t *s) { int total_len; int len; int i; int num_strips; int total_image_len; - int image_size; + uint8_t *t; uint8_t *raw_data; uint8_t *jpeg_table; uint32_t jpeg_table_len; - uint32_t w; - uint32_t h; - tsize_t off; + packer_t pack; + uint16_t bits_per_sample; + uint16_t samples_per_pixel; + t42_decode_state_t t42; + + bits_per_sample = 1; + TIFFGetField(s->tiff.tiff_file, TIFFTAG_BITSPERSAMPLE, &bits_per_sample); + samples_per_pixel = 1; + TIFFGetField(s->tiff.tiff_file, TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel); num_strips = TIFFNumberOfStrips(s->tiff.tiff_file); total_image_len = 0; @@ -753,7 +761,8 @@ static int read_tiff_t42_t81_image(t4_tx_state_t *s, uint8_t **buf) { if ((len = TIFFReadRawStrip(s->tiff.tiff_file, i, &raw_data[total_len], total_image_len - total_len)) < 0) { - span_log(&s->logging, SPAN_LOG_FLOW, "TIFF read error.\n"); + span_log(&s->logging, SPAN_LOG_WARNING, "%s: TIFFReadRawStrip error.\n", s->tiff.file); + free(raw_data); return -1; } } @@ -763,18 +772,30 @@ static int read_tiff_t42_t81_image(t4_tx_state_t *s, uint8_t **buf) if (total_len != total_image_len) span_log(&s->logging, SPAN_LOG_FLOW, "Size mismatch %d %d\n", (int) total_len, (int) total_image_len); - image_size = 3*s->metadata.image_length*s->metadata.image_width; - if ((*buf = malloc(image_size)) == NULL) - return -1; - - off = 0; - if (!t42_itulab_to_srgb(&s->logging, &s->lab_params, *buf, &off, raw_data, total_image_len, &w, &h)) + s->tiff.image_size = samples_per_pixel*s->tiff.image_width*s->tiff.image_length; + if (s->tiff.image_size >= s->tiff.image_buffer_size) { - span_log(&s->logging, SPAN_LOG_FLOW, "Failed to convert from ITULAB.\n"); - return -1; + if ((t = realloc(s->tiff.image_buffer, s->tiff.image_size)) == NULL) + { + free(raw_data); + return -1; + } + s->tiff.image_buffer_size = s->tiff.image_size; + s->tiff.image_buffer = t; } + + t42_decode_init(&t42, packing_row_write_handler, &pack); + + pack.buf = s->tiff.image_buffer; + pack.ptr = 0; + pack.row = 0; + + t42_decode_put(&t42, raw_data, total_image_len); + t42_decode_put(&t42, NULL, 0); + + t42_decode_release(&t42); free(raw_data); - return image_size; + return s->tiff.image_size; } /*- End of function --------------------------------------------------------*/ #endif @@ -789,7 +810,7 @@ static int read_tiff_decompressed_image(t4_tx_state_t *s) /* Decode the whole image into a buffer */ /* Let libtiff handle the decompression */ - s->tiff.image_size = s->metadata.image_length*TIFFScanlineSize(s->tiff.tiff_file); + s->tiff.image_size = s->tiff.image_length*TIFFScanlineSize(s->tiff.tiff_file); if (s->tiff.image_size >= s->tiff.image_buffer_size) { if ((t = realloc(s->tiff.image_buffer, s->tiff.image_size)) == NULL) @@ -798,14 +819,13 @@ static int read_tiff_decompressed_image(t4_tx_state_t *s) s->tiff.image_buffer = t; } - /* Allow for the image being stored in multiple strips, although it is rare to find - a stripped image in a T.4 or T.6 encoded file. */ + /* Allow for the image being stored in multiple strips. */ num_strips = TIFFNumberOfStrips(s->tiff.tiff_file); for (i = 0, total_len = 0; i < num_strips; i++, total_len += len) { if ((len = TIFFReadEncodedStrip(s->tiff.tiff_file, i, &s->tiff.image_buffer[total_len], s->tiff.image_size - total_len)) < 0) { - span_log(&s->logging, SPAN_LOG_WARNING, "%s: Read error.\n", s->tiff.file); + span_log(&s->logging, SPAN_LOG_WARNING, "%s: TIFFReadEncodedStrip error.\n", s->tiff.file); return -1; } } @@ -935,7 +955,7 @@ static int set_row_read_handler(t4_tx_state_t *s, t4_row_read_handler_t handler, return t85_encode_set_row_read_handler(&s->encoder.t85, handler, user_data); #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: - break; + return t88_encode_set_row_read_handler(&s->encoder.t88, handler, user_data); #endif case T4_COMPRESSION_T42_T81: case T4_COMPRESSION_SYCC_T81: @@ -946,7 +966,7 @@ static int set_row_read_handler(t4_tx_state_t *s, t4_row_read_handler_t handler, #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: - break; + return t45_encode_set_row_read_handler(&s->encoder.t45, handler, user_data); #endif } return -1; @@ -997,7 +1017,8 @@ static int make_header(t4_tx_state_t *s) static int header_row_read_handler(void *user_data, uint8_t buf[], size_t len) { - int repeats; + int x_repeats; + int y_repeats; int pattern; int pos; int row; @@ -1008,28 +1029,30 @@ static int header_row_read_handler(void *user_data, uint8_t buf[], size_t len) switch (s->metadata.y_resolution) { case T4_Y_RESOLUTION_1200: - repeats = 12; + y_repeats = 12; break; case T4_Y_RESOLUTION_800: - repeats = 8; + y_repeats = 8; break; case T4_Y_RESOLUTION_600: - repeats = 6; + y_repeats = 6; break; case T4_Y_RESOLUTION_SUPERFINE: - repeats = 4; + case T4_Y_RESOLUTION_400: + y_repeats = 4; break; case T4_Y_RESOLUTION_300: - repeats = 3; + y_repeats = 3; break; case T4_Y_RESOLUTION_FINE: - repeats = 2; + case T4_Y_RESOLUTION_200: + y_repeats = 2; break; default: - repeats = 1; + y_repeats = 1; break; } - repeats /= s->row_squashing_ratio; + y_repeats /= s->row_squashing_ratio; if (s->header_overlays_image) { /* Read and dump a row of the real image, allowing for the possibility @@ -1040,7 +1063,7 @@ static int header_row_read_handler(void *user_data, uint8_t buf[], size_t len) return len; } } - row = s->header_row/repeats; + row = s->header_row/y_repeats; pos = 0; for (t = s->header_text; *t && pos <= len - 2; t++) { @@ -1051,7 +1074,7 @@ static int header_row_read_handler(void *user_data, uint8_t buf[], size_t len) while (pos < len) buf[pos++] = 0; s->header_row++; - if (s->header_row >= 16*repeats) + if (s->header_row >= 16*y_repeats) { /* End of header. Change to normal image row data. */ set_row_read_handler(s, s->row_handler, s->row_handler_user_data); @@ -1089,10 +1112,10 @@ SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_tx_state_t *s, t4_row_read_handl } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) +SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int compression) { { - switch (encoding) + switch (compression) { case T4_COMPRESSION_T4_1D: case T4_COMPRESSION_T4_2D: @@ -1104,12 +1127,12 @@ SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) case T4_COMPRESSION_T6: break; default: - t4_t6_encode_init(&s->encoder.t4_t6, encoding, s->metadata.image_width, s->metadata.image_length, s->row_handler, s->row_handler_user_data); + t4_t6_encode_init(&s->encoder.t4_t6, compression, s->metadata.image_width, s->metadata.image_length, s->row_handler, s->row_handler_user_data); t4_t6_encode_set_max_2d_rows_per_1d_row(&s->encoder.t4_t6, -s->metadata.y_resolution); break; } - s->metadata.compression = encoding; - if (t4_t6_encode_set_encoding(&s->encoder.t4_t6, encoding)) + s->metadata.compression = compression; + if (t4_t6_encode_set_encoding(&s->encoder.t4_t6, compression)) return -1; return s->metadata.compression; case T4_COMPRESSION_T85: @@ -1123,7 +1146,7 @@ SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) t85_encode_init(&s->encoder.t85, s->metadata.image_width, s->metadata.image_length, s->row_handler, s->row_handler_user_data); break; } - s->metadata.compression = encoding; + s->metadata.compression = compression; return s->metadata.compression; #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: @@ -1132,9 +1155,10 @@ SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) case T4_COMPRESSION_T88: break; default: + t88_encode_init(&s->encoder.t88, s->metadata.image_width, s->metadata.image_length, s->row_handler, s->row_handler_user_data); break; } - s->metadata.compression = encoding; + s->metadata.compression = compression; return s->metadata.compression; #endif case T4_COMPRESSION_T42_T81: @@ -1148,7 +1172,7 @@ SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) t42_encode_init(&s->encoder.t42, s->metadata.image_width, s->metadata.image_length, s->row_handler, s->row_handler_user_data); break; } - s->metadata.compression = encoding; + s->metadata.compression = compression; return s->metadata.compression; #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: @@ -1160,7 +1184,7 @@ SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) t43_encode_init(&s->encoder.t43, s->metadata.image_width, s->metadata.image_length, s->row_handler, s->row_handler_user_data); break; } - s->metadata.compression = encoding; + s->metadata.compression = compression; return s->metadata.compression; #endif #if defined(SPANDSP_SUPPORT_T45) @@ -1170,9 +1194,10 @@ SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) case T4_COMPRESSION_T45: break; default: + t45_encode_init(&s->encoder.t45, s->metadata.image_width, s->metadata.image_length, s->row_handler, s->row_handler_user_data); break; } - s->metadata.compression = encoding; + s->metadata.compression = compression; return s->metadata.compression; #endif } @@ -1194,6 +1219,42 @@ SPAN_DECLARE(void) t4_tx_set_min_bits_per_row(t4_tx_state_t *s, int bits) } /*- End of function --------------------------------------------------------*/ +SPAN_DECLARE(int) t4_tx_get_tx_compression(t4_tx_state_t *s) +{ + return s->metadata.compression; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_tx_image_type(t4_tx_state_t *s) +{ + return s->metadata.image_type; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_tx_resolution(t4_tx_state_t *s) +{ + return s->metadata.resolution_code; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_tx_x_resolution(t4_tx_state_t *s) +{ + return s->metadata.x_resolution; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_tx_y_resolution(t4_tx_state_t *s) +{ + return s->metadata.y_resolution; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_tx_image_width(t4_tx_state_t *s) +{ + return s->metadata.image_width; +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(void) t4_tx_set_image_width(t4_tx_state_t *s, int image_width) { s->metadata.image_width = image_width; @@ -1210,6 +1271,7 @@ SPAN_DECLARE(void) t4_tx_set_image_width(t4_tx_state_t *s, int image_width) break; #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: + t88_encode_set_image_width(&s->encoder.t88, image_width); break; #endif case T4_COMPRESSION_T42_T81: @@ -1223,6 +1285,7 @@ SPAN_DECLARE(void) t4_tx_set_image_width(t4_tx_state_t *s, int image_width) #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: + t45_encode_set_image_width(&s->encoder.t45, image_width); break; #endif } @@ -1240,6 +1303,7 @@ static void t4_tx_set_image_length(t4_tx_state_t *s, uint32_t image_length) break; #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: + t88_encode_set_image_length(&s->encoder.t88, image_length); break; #endif case T4_COMPRESSION_T42_T81: @@ -1253,6 +1317,7 @@ static void t4_tx_set_image_length(t4_tx_state_t *s, uint32_t image_length) #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: + t45_encode_set_image_length(&s->encoder.t45, image_length); break; #endif } @@ -1382,6 +1447,9 @@ SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_tx_state_t *s, t4_stats_t *t break; #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: + t->width = t88_encode_get_image_width(&s->encoder.t88); + t->length = t88_encode_get_image_length(&s->encoder.t88); + t->line_image_size = t88_encode_get_compressed_image_size(&s->encoder.t88)/8; break; #endif case T4_COMPRESSION_T42_T81: @@ -1401,6 +1469,9 @@ SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_tx_state_t *s, t4_stats_t *t #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: + t->width = t45_encode_get_image_width(&s->encoder.t45); + t->length = t45_encode_get_image_length(&s->encoder.t45); + t->line_image_size = t45_encode_get_compressed_image_size(&s->encoder.t45)/8; break; #endif } @@ -1471,7 +1542,7 @@ SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len) return t85_encode_get(&s->encoder.t85, buf, max_len); #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: - break; + return t88_encode_get(&s->encoder.t88, buf, max_len); #endif case T4_COMPRESSION_T42_T81: case T4_COMPRESSION_SYCC_T81: @@ -1482,7 +1553,7 @@ SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len) #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: - break; + return t45_encode_get(&s->encoder.t45, buf, max_len); #endif } #endif @@ -1548,7 +1619,6 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_tx_state_t *s) s->image_get_handler = NULL; break; } - /* If there is a page header, create that first */ if (s->metadata.image_type == T4_IMAGE_TYPE_BILEVEL && s->header_info && s->header_info[0] && make_header(s) == 0) //if (s->header_info && s->header_info[0] && make_header(s) == 0) diff --git a/libs/spandsp/tests/v18_tests.c b/libs/spandsp/tests/v18_tests.c index 0cb6d93b8f..0c12678c80 100644 --- a/libs/spandsp/tests/v18_tests.c +++ b/libs/spandsp/tests/v18_tests.c @@ -88,7 +88,6 @@ static void put_text_msg(void *user_data, const uint8_t *msg, int len) static void basic_tests(int mode) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -133,6 +132,8 @@ static void basic_tests(int mode) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { if (push == 0) @@ -204,9 +205,13 @@ static void basic_tests(int mode) } /*- End of function --------------------------------------------------------*/ +static void misc_01_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_misc_01(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -223,15 +228,15 @@ static int test_misc_01(void) Preamble: N/A Method: A call is made to the TUT from the tester which remains off hook for 10 minutes without sending any signal. - Pass criteria: The TUT should answer the call and enter the probing state after 3 seconds. The + Pass criteria: The TUT should answer the call and enter the probing state after 3s. The TUT should continue to probe until the test is terminated. Comments: This feature should also be verified by observation during the automoding tests. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_01_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_01_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -251,6 +256,8 @@ static int test_misc_01(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -299,9 +306,13 @@ static int test_misc_01(void) } /*- End of function --------------------------------------------------------*/ +static void misc_02_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_misc_02(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -315,22 +326,22 @@ static int test_misc_02(void) /* III.5.4.1.2 Automatic resumption of automoding Purpose: To ensure that the DCE can be configured to automatically re-assume the automode - calling state after 10 s of no valid signal. + calling state after 10s of no valid signal. Preamble: The TUT should be configured to automatically re-assume the initial automoding state. Method: The tester should set up a call to the TUT in V.21 mode and then drop the carrier. - The tester will then transmit silence for 11 seconds followed by a 1300Hz tone for - 5 seconds (i.e. V.23). - Pass criteria: 1) Ten seconds after dropping the carrier the TUT should return to state Monitor 1. - 2) After 2.7+-0.3 seconds the TUT should select V.23 mode and send a 390Hz tone. + The tester will then transmit silence for 11s followed by a 1300Hz tone for + 5s (i.e. V.23). + Pass criteria: 1) 10s after dropping the carrier the TUT should return to state Monitor 1. + 2) After 2.7+-0.3s the TUT should select V.23 mode and send a 390Hz tone. Comments: The TUT should indicate that carrier has been lost at some time after the 1650Hz signal is lost. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_02_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_02_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -350,6 +361,8 @@ static int test_misc_02(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -398,9 +411,13 @@ static int test_misc_02(void) } /*- End of function --------------------------------------------------------*/ +static void misc_03_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_misc_03(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -418,18 +435,18 @@ static int test_misc_03(void) Preamble: The TUT should be configured to remain in the selected transmission mode when the carrier is lost. Method: The tester should set up a call to the TUT in V.21 mode, for example. It will drop - the carrier for 9 seconds and then re-start transmission of the same carrier for - 1 second followed by a short message. + the carrier for 9s and then re-start transmission of the same carrier for + 1s followed by a short message. Pass criteria: The TUT should resume operation in V.21 mode and capture the entire test message. Comments: The TUT should indicate that carrier has been lost at some time after the carrier signal is removed and not disconnect. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_03_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_03_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -449,6 +466,8 @@ static int test_misc_03(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -497,9 +516,13 @@ static int test_misc_03(void) } /*- End of function --------------------------------------------------------*/ +static void misc_04_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_misc_04(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -523,11 +546,11 @@ static int test_misc_04(void) automatically hang up when busy tone is detected. PABX busy tones may differ in frequency and cadence from national parameters. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_04_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_04_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -547,6 +570,8 @@ static int test_misc_04(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -595,9 +620,13 @@ static int test_misc_04(void) } /*- End of function --------------------------------------------------------*/ +static void misc_05_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_misc_05(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -618,11 +647,11 @@ static int test_misc_05(void) Pass criteria: The RINGING condition should be visually indicated by the TUT. Comments: This test should be repeated across a range of valid timings and ring voltages. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_05_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_05_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -642,6 +671,8 @@ static int test_misc_05(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -690,9 +721,13 @@ static int test_misc_05(void) } /*- End of function --------------------------------------------------------*/ +static void misc_06_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_misc_06(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -716,11 +751,11 @@ static int test_misc_06(void) mode. There may be other cases, e.g. where the V.18 DCE is used in a gateway, when automatic disconnection is required. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_06_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_06_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -740,6 +775,8 @@ static int test_misc_06(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -788,9 +825,13 @@ static int test_misc_06(void) } /*- End of function --------------------------------------------------------*/ +static void misc_07_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_misc_07(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -812,11 +853,11 @@ static int test_misc_07(void) However, this may possibly not be indicated by the DTE. Comments: The possible modes are: V.21, V.23, Baudot 45, Baudot 50, EDT, Bell 103, DTMF. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_07_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_07_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -836,6 +877,8 @@ static int test_misc_07(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -884,9 +927,13 @@ static int test_misc_07(void) } /*- End of function --------------------------------------------------------*/ +static void misc_08_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_misc_08(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -902,18 +949,18 @@ static int test_misc_08(void) Purpose: To ensure that the DCE implements circuit 135 or an equivalent way of indicating presence of a signal. Preamble: N/A - Method: A call from the TUT should be answered in voice mode after 20 seconds. The tester + Method: A call from the TUT should be answered in voice mode after 20s. The tester will transmit sampled voice messages. V.24 circuit 135 or its equivalent should be observed. Pass criteria: The ring tone and speech shall be indicated by circuit 135. Comment: The response times and signal level thresholds of Circuit 135 are not specified in ITU-T V.18 or V.24 and therefore the pattern indicated may vary. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_08_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_08_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -933,6 +980,8 @@ static int test_misc_08(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -981,9 +1030,13 @@ static int test_misc_08(void) } /*- End of function --------------------------------------------------------*/ +static void misc_09_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_misc_09(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -1003,11 +1056,11 @@ static int test_misc_09(void) Pass criteria: TBD Comment: TBD */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_09_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, misc_09_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -1027,6 +1080,8 @@ static int test_misc_09(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -1075,9 +1130,13 @@ static int test_misc_09(void) } /*- End of function --------------------------------------------------------*/ +static void org_01_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_01(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -1098,19 +1157,19 @@ static int test_org_01(void) check for correct coding and timing of the signal. Pass criteria: 1) No signal should be transmitted for one second after connecting to the line. 2) Four CI patterns are transmitted for each repetition. - 3) No signal is transmitted for two seconds after the end of each CI. + 3) No signal is transmitted for 2s after the end of each CI. 4) Each CI must have the correct bit pattern. - 5) The CI patterns followed by two seconds of silence must be repeated twice. + 5) The CI patterns followed by 2s of silence must be repeated twice. 6) One second after every 3 blocks CI an XCI signal must be transmitted. 7) The XCI should have the structure defined in 3.11. 8) The whole sequence should be repeated until the call is cleared. 9) When V.18 to V.18, the XCI must not force V.23 or Minitel mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_01_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_01_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -1130,6 +1189,8 @@ static int test_org_01(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -1178,9 +1239,13 @@ static int test_org_01(void) } /*- End of function --------------------------------------------------------*/ +static void org_02_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_02(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -1198,17 +1263,16 @@ static int test_org_02(void) Preamble: Make a V.18 call from the TUT. Method: The Test System waits for the TUT to stop transmitting a CI and responds with an ANS signal. The V.21 demodulator is used to decode the TXP sequence and a timer - measures the silence intervals between them. ANS should be transmitted for 2 - seconds. - Pass criteria: 1) No signal should be transmitted by TUT for 0.5 seconds from detection of ANS. + measures the silence intervals between them. ANS should be transmitted for 2s. + Pass criteria: 1) No signal should be transmitted by TUT for 0.5s from detection of ANS. 2) The TUT should reply with transmission of TXP as defined in 5.1.2. 3) Verify that TXP sequence has correct bit pattern. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_02_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_02_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -1228,6 +1292,8 @@ static int test_org_02(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -1276,9 +1342,13 @@ static int test_org_02(void) } /*- End of function --------------------------------------------------------*/ +static void org_03_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_03(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -1294,16 +1364,16 @@ static int test_org_03(void) Purpose: The TUT should stop sending TXP at the end of the current sequence when the ANS tone ceases. Preamble: Test ORG-02 should be successfully completed immediately prior to this test. - Method: The tester sends ANS for 2 seconds followed by silence. The tester will then + Method: The tester sends ANS for 2s followed by silence. The tester will then monitor for cessation of TXP at the end of the answer tone. Pass criteria: The TUT should stop sending TXP at the end of the current sequence when ANS tone ceases. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_03_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_03_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -1323,6 +1393,8 @@ static int test_org_03(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -1371,9 +1443,13 @@ static int test_org_03(void) } /*- End of function --------------------------------------------------------*/ +static void org_04_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_04(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -1388,21 +1464,21 @@ static int test_org_04(void) III.5.4.2.4 ANS tone followed by TXP Purpose: To check correct detection of V.18 modem. Preamble: Tests ORG-02 and ORG-03 should be successfully completed prior to this test. - Method: Tester transmits ANS for 2.5 seconds followed by 75ms of no tone then transmits - 3 TXP sequences using V.21 (2) and starts a 1 s timer. It will then transmit 1650Hz - for 5 seconds. + Method: Tester transmits ANS for 2.5s followed by 75ms of no tone then transmits + 3 TXP sequences using V.21 (2) and starts a 1s timer. It will then transmit 1650Hz + for 5s. Pass criteria: 1) TUT should initially respond with TXP. - 2) TUT should stop sending TXP within 0.2 seconds of end of ANS. - 3) TUT should respond with 980Hz carrier within 1 second of end of 3 TXP sequences. + 2) TUT should stop sending TXP within 0.2s of end of ANS. + 3) TUT should respond with 980Hz carrier within 1s of end of 3 TXP sequences. 4) Data should be transmitted and received according to ITU-T T.140 to comply with the V.18 operational requirements. Comments: The TUT should indicate that V.18 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_04_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_04_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -1422,6 +1498,8 @@ static int test_org_04(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -1470,9 +1548,13 @@ static int test_org_04(void) } /*- End of function --------------------------------------------------------*/ +static void org_05_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_05(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -1488,21 +1570,21 @@ static int test_org_05(void) Purpose: To check correct detection of V.21 modem upper channel when preceded by answer tone and to confirm discrimination between V.21 and V.18 modes. Preamble: Tests ORG-02 and ORG-03 should be successfully completed prior to this test. - Method: Tester transmits ANS for 2.5 seconds followed by 75ms of no tone then transmits + Method: Tester transmits ANS for 2.5s followed by 75ms of no tone then transmits 1650Hz and starts a 0.7 second timer. Pass criteria: 1) TUT should initially respond with TXP. - 2) TUT should stop sending TXP within 0.2 seconds of end of ANS. - 3) TUT should respond with 980Hz at 0.5(+0.2-0.0) seconds of start of 1650Hz. + 2) TUT should stop sending TXP within 0.2s of end of ANS. + 3) TUT should respond with 980Hz at 0.5(+0.2-0.0)s of start of 1650Hz. 4) Data should be transmitted and received at 300 bit/s complying with Annex F. Comments: Selection of ITU-T V.21 as opposed to ITU-T V.18 should be confirmed by examination of TUT. If there is no visual indication, verify by use of ITU-T T.50 for ITU-T V.21 as opposed to UTF-8 coded ISO 10646 character set for ITU-T V.18. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_05_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_05_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -1522,6 +1604,8 @@ static int test_org_05(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -1570,9 +1654,13 @@ static int test_org_05(void) } /*- End of function --------------------------------------------------------*/ +static void org_06_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_06(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -1588,20 +1676,20 @@ static int test_org_06(void) Purpose: To check correct detection of V.23 modem upper channel when preceded by answer tone. Preamble: Tests ORG-02 and ORG-03 should be successfully completed prior to this test. - Method: Tester transmits ANS for 2.5 seconds followed by 75ms of no tone then transmits - 1300Hz and starts a 2.7 s timer. + Method: Tester transmits ANS for 2.5s followed by 75ms of no tone then transmits + 1300Hz and starts a 2.7s timer. Pass criteria: 1) TUT should initially respond with TXP. - 2) TUT should stop sending TXP within 0.2 seconds of end of ANS. - 3) TUT should respond with 390Hz after 1.7(+0.2-0.0) seconds of start of 1300Hz. + 2) TUT should stop sending TXP within 0.2s of end of ANS. + 3) TUT should respond with 390Hz after 1.7(+0.2-0.0)s of start of 1300Hz. 4) Data should be transmitted and received at 75 bit/s and 1200 bit/s respectively by the TUT to comply with Annex E. Comments: The TUT should indicate that V.23 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_06_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_06_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -1621,6 +1709,8 @@ static int test_org_06(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -1669,9 +1759,13 @@ static int test_org_06(void) } /*- End of function --------------------------------------------------------*/ +static void org_07_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_07(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -1686,21 +1780,21 @@ static int test_org_07(void) III.5.4.2.7 ANS tone followed by no tone Purpose: To confirm that TUT does not lock up under this condition. Preamble: Tests ORG-02 and ORG-03 should be successfully completed prior to this test. - Method: Tester transmits ANS for 2.5 seconds followed by no tone for 10 s. It then transmits - DTMF tones for 2 seconds. + Method: Tester transmits ANS for 2.5s followed by no tone for 10 s. It then transmits + DTMF tones for 2s. Pass criteria: 1) TUT should initially respond with TXP. - 2) TUT should stop sending TXP within 0.2 seconds of end of ANS. + 2) TUT should stop sending TXP within 0.2s of end of ANS. 3) TUT should return to Monitor 1 state and then connect in DTMF mode within - 12 seconds of the end of ANS tone. + 12s of the end of ANS tone. Comments: This condition would cause the terminal to lock up if the V.18 standard is followed literally. It may however, occur when connected to certain Swedish textphones if the handset is lifted just after the start of an automatically answered incoming call. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_07_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_07_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -1720,6 +1814,8 @@ static int test_org_07(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -1768,9 +1864,13 @@ static int test_org_07(void) } /*- End of function --------------------------------------------------------*/ +static void org_08_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_08(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -1786,16 +1886,16 @@ static int test_org_08(void) Purpose: To verify that the TUT correctly detects the Bell 103 upper channel signal during the 2-second interval between transmission of CI sequences. Preamble: N/A - Method: The tester waits for a CI and then sends a 2225Hz signal for 5 seconds. - Pass criteria: 1) The TUT should respond with a 1270Hz tone in 0.5+-0.1 seconds. + Method: The tester waits for a CI and then sends a 2225Hz signal for 5s. + Pass criteria: 1) The TUT should respond with a 1270Hz tone in 0.5+-0.1s. 2) Data should be transmitted and received at 300 bit/s to comply with Annex D. Comments: The TUT should indicate that Bell 103 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_08_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_08_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -1815,6 +1915,8 @@ static int test_org_08(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -1863,9 +1965,13 @@ static int test_org_08(void) } /*- End of function --------------------------------------------------------*/ +static void org_09_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_09(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -1881,16 +1987,16 @@ static int test_org_09(void) Purpose: To verify that the TUT correctly detects the V.21 upper channel signal during the 2-second interval between transmission of CI sequences. Preamble: N/A - Method: The tester waits for a CI and then sends a 1650Hz signal for 5 seconds. - Pass criteria: 1) The TUT should respond with a 980Hz tone in 0.5+-0.1 seconds. + Method: The tester waits for a CI and then sends a 1650Hz signal for 5s. + Pass criteria: 1) The TUT should respond with a 980Hz tone in 0.5+-0.1s. 2) Data should be transmitted and received at 300 bit/s to comply with Annex F. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_09_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_09_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -1910,6 +2016,8 @@ static int test_org_09(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -1958,9 +2066,13 @@ static int test_org_09(void) } /*- End of function --------------------------------------------------------*/ +static void org_10_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_10(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -1976,17 +2088,17 @@ static int test_org_10(void) Purpose: To verify that the TUT correctly detects the V.23 upper channel signal during the 2-second interval between transmission of CI sequences. Preamble: N/A - Method: The tester waits for a CI and then sends a 1300Hz signal for 5 seconds. - Pass criteria: 1) The TUT should respond with a 390Hz tone in 1.7+-0.1 seconds. + Method: The tester waits for a CI and then sends a 1300Hz signal for 5s. + Pass criteria: 1) The TUT should respond with a 390Hz tone in 1.7+-0.1s. 2) Data should be transmitted and received at 75 bit/s and 1200 bit/s respectively by the TUT to comply with Annex E. Comments: The TUT should indicate that V.23 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_10_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_10_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -2006,6 +2118,8 @@ static int test_org_10(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -2054,9 +2168,13 @@ static int test_org_10(void) } /*- End of function --------------------------------------------------------*/ +static void org_11_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_11(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -2072,20 +2190,20 @@ static int test_org_11(void) Purpose: To confirm correct selection of V.23 reverse mode during sending of XCI. Preamble: N/A Method: The tester should wait for the start of the XCI signal and then send 390Hz to TUT - for 5 seconds. + for 5s. Pass criteria: 1) The TUT should complete the XCI as normal. 2) The TUT should then maintain the 1300Hz tone while the 390Hz test tone is present. 3) Data should be transmitted and received at 1200 bit/s and 75 bit/s respectively by the TUT to comply with Annex E when connection is indicated. - Comments: The TUT should indicate that V.23 mode has been selected at least 3 seconds after + Comments: The TUT should indicate that V.23 mode has been selected at least 3s after the start of the 390Hz tone. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_11_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_11_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -2105,6 +2223,8 @@ static int test_org_11(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -2153,9 +2273,13 @@ static int test_org_11(void) } /*- End of function --------------------------------------------------------*/ +static void org_12_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_12(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -2185,11 +2309,11 @@ static int test_org_12(void) automode answer state. The TUT may then select either 45.45 or 50 bit/s for the transmission. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_12_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_12_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -2209,6 +2333,8 @@ static int test_org_12(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -2257,9 +2383,13 @@ static int test_org_12(void) } /*- End of function --------------------------------------------------------*/ +static void org_13_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_13(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -2283,11 +2413,11 @@ static int test_org_13(void) TUT should comply with ITU-T Q.24 for the Danish Administration while receiving for best possible performance. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_13_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_13_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -2307,6 +2437,8 @@ static int test_org_13(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -2355,9 +2487,13 @@ static int test_org_13(void) } /*- End of function --------------------------------------------------------*/ +static void org_14_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_14(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -2383,11 +2519,11 @@ static int test_org_14(void) the number lost should be minimal. The data bits and parity are specified in Annex C. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_14_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_14_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -2407,6 +2543,8 @@ static int test_org_14(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -2455,9 +2593,13 @@ static int test_org_14(void) } /*- End of function --------------------------------------------------------*/ +static void org_15_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_15(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -2473,16 +2615,16 @@ static int test_org_15(void) Purpose: To verify the presence of 980/1180Hz at a different signalling rate than 110 bit/s returns the TUT modem to the "monitor A" state. Preamble: N/A - Method: The tester transmits 980/1180Hz signals at 300 bit/s for 2 seconds. + Method: The tester transmits 980/1180Hz signals at 300 bit/s for 2s. Pass criteria: The TUT should not select EDT or any other mode and should continue to transmit the CI signal. Comments: Echoes of the CI sequences may be detected at 300 bit/s. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_15_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_15_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -2502,6 +2644,8 @@ static int test_org_15(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -2550,9 +2694,13 @@ static int test_org_15(void) } /*- End of function --------------------------------------------------------*/ +static void org_16_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_16(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -2567,17 +2715,17 @@ static int test_org_16(void) III.5.4.2.16 980Hz detection Purpose: To confirm correct selection of V.21 reverse mode. Preamble: N/A - Method: The tester sends 980Hz to TUT for 5 seconds. - Pass criteria: 1) TUT should respond with 1650Hz tone after 1.5+-0.1 seconds after start of + Method: The tester sends 980Hz to TUT for 5s. + Pass criteria: 1) TUT should respond with 1650Hz tone after 1.5+-0.1s after start of 980Hz tone. 2) Data should be transmitted and received at 300 bit/s complying with Annex F. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_16_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_16_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -2597,6 +2745,8 @@ static int test_org_16(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -2645,9 +2795,13 @@ static int test_org_16(void) } /*- End of function --------------------------------------------------------*/ +static void org_17_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_17(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -2662,15 +2816,15 @@ static int test_org_17(void) III.5.4.2.17 Loss of signal after 980Hz Purpose: To confirm that TUT returns to the Monitor 1 state if 980Hz signal disappears. Preamble: N/A - Method: The tester sends 980Hz to TUT for 1.2 seconds followed by silence for 5 seconds. + Method: The tester sends 980Hz to TUT for 1.2s followed by silence for 5s. Pass criteria: TUT should not respond to the 980Hz tone and resume sending CI signals after a - maximum of 2.4 seconds from the end of the 980Hz tone. + maximum of 2.4s from the end of the 980Hz tone. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_17_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_17_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -2690,6 +2844,8 @@ static int test_org_17(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -2738,9 +2894,13 @@ static int test_org_17(void) } /*- End of function --------------------------------------------------------*/ +static void org_18_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_18(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -2755,17 +2915,17 @@ static int test_org_18(void) III.5.4.2.18 Tr timer Purpose: To confirm that TUT returns to the Monitor 1 state if Timer Tr expires. Preamble: N/A - Method: The tester sends 980Hz to TUT for 1.2 seconds followed by 1650Hz for 5 seconds + Method: The tester sends 980Hz to TUT for 1.2s followed by 1650Hz for 5s with no pause. - Pass criteria: TUT should respond with 980Hz after 1.3+-0.1 seconds of 1650Hz. - Comments: This implies timer Tr has expired 2 seconds after the start of the 980Hz tone and - then 1650Hz has been detected for 0.5 seconds. + Pass criteria: TUT should respond with 980Hz after 1.3+-0.1s of 1650Hz. + Comments: This implies timer Tr has expired 2s after the start of the 980Hz tone and + then 1650Hz has been detected for 0.5s. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_18_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_18_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -2785,6 +2945,8 @@ static int test_org_18(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -2833,9 +2995,13 @@ static int test_org_18(void) } /*- End of function --------------------------------------------------------*/ +static void org_19_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_19(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -2850,16 +3016,16 @@ static int test_org_19(void) III.5.4.2.19 Bell 103 (1270Hz signal) detection Purpose: To confirm correct selection of Bell 103 reverse mode. Preamble: N/A - Method: The tester sends 1270Hz to TUT for 5 seconds. + Method: The tester sends 1270Hz to TUT for 5s. Pass criteria: 1) TUT should respond with 2225Hz tone after 0.7+-0.1 s. 2) Data should be transmitted and received at 300 bit/s complying with Annex D. Comments: The TUT should indicate that Bell 103 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_19_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_19_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -2879,6 +3045,8 @@ static int test_org_19(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -2927,9 +3095,13 @@ static int test_org_19(void) } /*- End of function --------------------------------------------------------*/ +static void org_20_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_20(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -2956,11 +3128,11 @@ static int test_org_20(void) presence and cadence of the tones for instance by a flashing light. The TUT may disconnect on reception of tones indicating a failed call attempt. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_20_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_20_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -2980,6 +3152,8 @@ static int test_org_20(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -3028,9 +3202,13 @@ static int test_org_20(void) } /*- End of function --------------------------------------------------------*/ +static void org_21_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_21(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -3053,11 +3231,11 @@ static int test_org_21(void) Comments: Some high speed modems may fall back to a compatibility mode, e.g. V.21 or V.23 that should be correctly detected by the TUT. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_21_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_21_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -3077,6 +3255,8 @@ static int test_org_21(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -3125,9 +3305,13 @@ static int test_org_21(void) } /*- End of function --------------------------------------------------------*/ +static void org_22_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_22(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -3149,11 +3333,11 @@ static int test_org_22(void) Comments: Ideally the TUT should detect the presence of a fax machine and report it back to the user. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_22_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_22_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -3173,6 +3357,8 @@ static int test_org_22(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -3221,9 +3407,13 @@ static int test_org_22(void) } /*- End of function --------------------------------------------------------*/ +static void org_23_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_23(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -3245,11 +3435,11 @@ static int test_org_23(void) Comments: Ideally the TUT should report the presence of speech back to the user, e.g. via circuit 135. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_23_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_23_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -3269,6 +3459,8 @@ static int test_org_23(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -3317,9 +3509,13 @@ static int test_org_23(void) } /*- End of function --------------------------------------------------------*/ +static void org_24_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_24(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -3337,17 +3533,17 @@ static int test_org_24(void) Preamble: Make a V.18 call from the TUT. Method: The Test System waits for the TUT to stop transmitting a CI and responds with an ANSam signal. The V.21 demodulator is used to decode the CM sequence. ANSam - should be transmitted for 2 seconds. - Pass criteria: 1) No signal should be transmitted by TUT for 0.5 seconds from detection of + should be transmitted for 2s. + Pass criteria: 1) No signal should be transmitted by TUT for 0.5s from detection of ANSam. 2) The TUT should reply with transmission of CM as defined in 5.2.13. 3) Verify that CM sequence has correct bit pattern. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_24_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_24_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -3367,6 +3563,8 @@ static int test_org_24(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -3415,9 +3613,13 @@ static int test_org_24(void) } /*- End of function --------------------------------------------------------*/ +static void org_25_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_org_25(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -3436,11 +3638,11 @@ static int test_org_25(void) Method: The Test System waits for the TUT to start transmitting V.21 carrier (1). Pass criteria: The TUT should connect by sending V.21 carrier (1). */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_25_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, org_25_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -3460,6 +3662,8 @@ static int test_org_25(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -3508,9 +3712,13 @@ static int test_org_25(void) } /*- End of function --------------------------------------------------------*/ +static void ans_01_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_01(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -3523,18 +3731,18 @@ static int test_ans_01(void) /* III.5.4.3.1 Ta timer - Purpose: To ensure that on connecting the call, the DCE starts timer Ta (3 seconds) and on + Purpose: To ensure that on connecting the call, the DCE starts timer Ta (3s) and on expiry begins probing. Preamble: N/A Method: The tester makes a call to the TUT and attempts to determine when the TUT answers the call. It will then monitor for any signal. - Pass criteria: The TUT should start probing 3 seconds after answering the call. + Pass criteria: The TUT should start probing 3s after answering the call. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_01_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_01_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -3554,6 +3762,8 @@ static int test_ans_01(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -3602,9 +3812,13 @@ static int test_ans_01(void) } /*- End of function --------------------------------------------------------*/ +static void ans_02_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_02(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -3619,18 +3833,18 @@ static int test_ans_02(void) III.5.4.3.2 CI signal detection Purpose: To confirm the correct detection and response to the V.18 CI signal. Preamble: N/A - Method: The tester will transmit 2 sequences of 4 CI patterns separated by 2 seconds. It will + Method: The tester will transmit 2 sequences of 4 CI patterns separated by 2s. It will monitor for ANS and measure duration. Pass criteria: 1) The TUT should respond after either the first or second CI with ANSam tone. - 2) ANSam tone should remain for 3 seconds +-0.5 s followed by silence. + 2) ANSam tone should remain for 3s+-0.5s followed by silence. Comments: The ANSam tone is a modulated 2100Hz tone. It may have phase reversals. The XCI signal is tested in a separate test. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_02_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_02_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -3650,6 +3864,8 @@ static int test_ans_02(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -3698,9 +3914,13 @@ static int test_ans_02(void) } /*- End of function --------------------------------------------------------*/ +static void ans_03_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_03(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -3716,8 +3936,8 @@ static int test_ans_03(void) Purpose: To confirm that the TUT will respond correctly to TXP signals, i.e. by stopping ANSam tone on reception of TXP signal. Preamble: N/A - Method: The tester will transmit 2 sequences of 4 CI patterns separated by 2 seconds. On - reception of the ANSam tone the tester will wait 0.5 seconds and then begin + Method: The tester will transmit 2 sequences of 4 CI patterns separated by 2s. On + reception of the ANSam tone the tester will wait 0.5s and then begin transmitting the TXP signal in V.21 (1) mode. Pass criteria: 1) On reception of the TXP signal, the TUT should remain silent for 75+-5ms. 2) The TUT should then transmit 3 TXP sequences in V.21(2) mode. @@ -3726,11 +3946,11 @@ static int test_ans_03(void) V.18 mode connection is completed. Comments: The TUT should indicate V.18 mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_03_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_03_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -3750,6 +3970,8 @@ static int test_ans_03(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -3798,9 +4020,13 @@ static int test_ans_03(void) } /*- End of function --------------------------------------------------------*/ +static void ans_04_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_04(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -3817,14 +4043,14 @@ static int test_ans_04(void) timer Tt expires. Preamble: Successful completion of test ANS-03. Method: After completion of test ANS-03 the tester will continue to monitor for signals. - Pass criteria: The TUT should start probing 3 seconds after ANSam disappears. + Pass criteria: The TUT should start probing 3s after ANSam disappears. Comments: It is assumed that timer Ta is restarted on return to Monitor A. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_04_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_04_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -3844,6 +4070,8 @@ static int test_ans_04(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -3892,9 +4120,13 @@ static int test_ans_04(void) } /*- End of function --------------------------------------------------------*/ +static void ans_05_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_05(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -3910,16 +4142,16 @@ static int test_ans_05(void) Purpose: To check correct detection of V.21 modem lower channel when preceded by answer tone. Preamble: N/A - Method: Tester transmits ANS for 2.5 seconds followed by 75ms of no tone then transmits - 980Hz and starts a 1 s timer. + Method: Tester transmits ANS for 2.5s followed by 75ms of no tone then transmits + 980Hz and starts a 1s timer. Pass criteria: TUT should respond with 1650Hz within 400+-100ms of start of 980Hz. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_05_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_05_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -3939,6 +4171,8 @@ static int test_ans_05(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -3987,9 +4221,13 @@ static int test_ans_05(void) } /*- End of function --------------------------------------------------------*/ +static void ans_06_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_06(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -4005,16 +4243,16 @@ static int test_ans_06(void) Purpose: To check correct detection of V.23 modem upper channel when preceded by answer tone. Preamble: N/A - Method: Tester transmits ANS for 2.5 seconds followed by 75ms of no tone then transmits + Method: Tester transmits ANS for 2.5s followed by 75ms of no tone then transmits 1300Hz and starts a 2-s timer. - Pass criteria: TUT should respond with 390Hz after 1.7(+0.2-0.0) seconds of start of 1300Hz. + Pass criteria: TUT should respond with 390Hz after 1.7(+0.2-0.0)s of start of 1300Hz. Comments: The TUT should indicate that V.23 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_06_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_06_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -4034,6 +4272,8 @@ static int test_ans_06(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -4082,9 +4322,13 @@ static int test_ans_06(void) } /*- End of function --------------------------------------------------------*/ +static void ans_07_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_07(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -4100,16 +4344,16 @@ static int test_ans_07(void) Purpose: To check correct detection of V.21 modem upper channel when preceded by answer tone and to confirm discrimination between V.21 and V.18 modes. Preamble: N/A - Method: Tester transmits ANS for 2.5 seconds followed by 75ms of no tone then transmits + Method: Tester transmits ANS for 2.5s followed by 75ms of no tone then transmits 1650Hz and starts a 1-second timer. Pass criteria: TUT should respond with 980Hz within 400+-100ms of start of 1650Hz. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_07_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_07_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -4129,6 +4373,8 @@ static int test_ans_07(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -4177,9 +4423,13 @@ static int test_ans_07(void) } /*- End of function --------------------------------------------------------*/ +static void ans_08_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_08(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -4200,13 +4450,13 @@ static int test_ans_08(void) Pass criteria: The TUT should respond with the appropriate carrier depending on when it connects. Comments: The TUT should indicate a V.21 connection. The time for which each frequency is - transmitted is random and varies between 0.64 and 2.56 seconds. + transmitted is random and varies between 0.64 and 2.56s. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_08_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_08_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -4226,6 +4476,8 @@ static int test_ans_08(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -4274,9 +4526,13 @@ static int test_ans_08(void) } /*- End of function --------------------------------------------------------*/ +static void ans_09_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_09(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -4292,17 +4548,17 @@ static int test_ans_09(void) Purpose: To confirm correct detection of 980Hz calling tones as defined in V.25. Preamble: N/A Method: The tester will send bursts of 980Hz signals (a) 400ms, (b) 500ms, (c) 700ms and - (d) 800ms followed by 1 second of silence. - Pass criteria: 1) The TUT should not respond to bursts of 400 or 800ms. - 2) The TUT should immediately begin probing after a burst of 980Hz for 500 or - 700ms followed by 1 second of silence. + (d) 800ms followed by 1s of silence. + Pass criteria: 1) The TUT should not respond to bursts of 400ms or 800ms. + 2) The TUT should immediately begin probing after a burst of 980Hz for 500ms or + 700ms followed by 1s of silence. Comments: The probe sent by the TUT will depend on the country setting. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_09_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_09_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -4322,6 +4578,8 @@ static int test_ans_09(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -4370,9 +4628,13 @@ static int test_ans_09(void) } /*- End of function --------------------------------------------------------*/ +static void ans_10_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_10(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -4388,15 +4650,15 @@ static int test_ans_10(void) Purpose: To confirm correct selection of V.21 calling modem when the received signal is not modulated, i.e. there is no 1180Hz. Preamble: N/A - Method: The tester sends 980Hz to TUT for 2 seconds. - Pass criteria: The TUT should respond with a 1650Hz tone in 1.5+-0.1 seconds. + Method: The tester sends 980Hz to TUT for 2s. + Pass criteria: The TUT should respond with a 1650Hz tone in 1.5+-0.1s. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_10_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_10_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -4416,6 +4678,8 @@ static int test_ans_10(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -4464,9 +4728,13 @@ static int test_ans_10(void) } /*- End of function --------------------------------------------------------*/ +static void ans_11_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_11(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -4490,11 +4758,11 @@ static int test_ans_11(void) be lost during the detection process. However, the number lost should be minimal. The data bits and parity are specified in Annex C. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_11_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_11_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -4514,6 +4782,8 @@ static int test_ans_11(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -4562,9 +4832,13 @@ static int test_ans_11(void) } /*- End of function --------------------------------------------------------*/ +static void ans_12_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_12(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -4589,11 +4863,11 @@ static int test_ans_12(void) (1650Hz) probe. However, it is catered for in V.18. It is more likely that this is where CI or TXP characters would be detected (see test ANS-02). */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_12_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_12_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -4613,6 +4887,8 @@ static int test_ans_12(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -4661,9 +4937,13 @@ static int test_ans_12(void) } /*- End of function --------------------------------------------------------*/ +static void ans_13_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_13(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -4677,21 +4957,21 @@ static int test_ans_13(void) /* III.5.4.3.13 Tr timer Purpose: To ensure that the TUT returns to the Monitor A state on expiry of timer Tr - (2 seconds). Timer Tr is started when a modulated V.21 (1) signal is detected. + (2s). Timer Tr is started when a modulated V.21 (1) signal is detected. Preamble: N/A Method: The tester will transmit 980Hz for 200ms followed by alternating 980Hz/1180Hz - at 110 bit/s for 100ms followed by 980Hz for 1 second. - Pass criteria: The TUT should begin probing 4+-0.5 seconds after the 980Hz signal is removed. + at 110 bit/s for 100ms followed by 980Hz for 1s. + Pass criteria: The TUT should begin probing 4+-0.5s after the 980Hz signal is removed. Comments: It is not possible to be precise on timings for this test since the definition of a "modulated signal" as in 5.2.4.4 is not specified. Therefore it is not known exactly when timer Tr will start. It is assumed that timer Ta is restarted on re-entering the Monitor A state. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_13_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_13_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -4711,6 +4991,8 @@ static int test_ans_13(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -4759,9 +5041,13 @@ static int test_ans_13(void) } /*- End of function --------------------------------------------------------*/ +static void ans_14_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_14(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -4775,18 +5061,18 @@ static int test_ans_14(void) /* III.5.4.3.14 Te timer Purpose: To ensure that the TUT returns to the Monitor A on expiry of timer Te - (2.7 seconds). Timer Te is started when a 980Hz signal is detected. + (2.7s). Timer Te is started when a 980Hz signal is detected. Preamble: N/A Method: The tester will transmit 980Hz for 200ms followed silence for 7 s. - Pass criteria: The TUT should begin probing 5.5+-0.5 seconds after the 980Hz signal is removed. - Comments: It is assumed that timer Ta (3 seconds) is restarted on re-entering the Monitor A + Pass criteria: The TUT should begin probing 5.5+-0.5s after the 980Hz signal is removed. + Comments: It is assumed that timer Ta (3s) is restarted on re-entering the Monitor A state. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_14_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_14_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -4806,6 +5092,8 @@ static int test_ans_14(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -4854,9 +5142,13 @@ static int test_ans_14(void) } /*- End of function --------------------------------------------------------*/ +static void ans_15_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_15(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -4887,11 +5179,11 @@ static int test_ans_15(void) automode answer state. The TUT may then select either 45.45 or 50 bit/s for the transmission. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_15_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_15_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -4911,6 +5203,8 @@ static int test_ans_15(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -4959,9 +5253,13 @@ static int test_ans_15(void) } /*- End of function --------------------------------------------------------*/ +static void ans_16_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_16(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -4983,11 +5281,11 @@ static int test_ans_16(void) Comments: The TUT should indicate that it has selected DTMF mode. The DTMF capabilities of the TUT should comply with ITU-T Q.24 for the Danish Administration. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_16_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_16_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -5007,6 +5305,8 @@ static int test_ans_16(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -5055,9 +5355,13 @@ static int test_ans_16(void) } /*- End of function --------------------------------------------------------*/ +static void ans_17_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_17(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -5072,15 +5376,15 @@ static int test_ans_17(void) III.5.4.3.17 Bell 103 (1270Hz signal) detection Purpose: To ensure correct detection and selection of Bell 103 modems. Preamble: N/A - Method: The tester sends 1270Hz to TUT for 5 seconds. - Pass criteria: TUT should respond with 2225Hz tone after 0.7+-0.1 s. + Method: The tester sends 1270Hz to TUT for 5s. + Pass criteria: TUT should respond with 2225Hz tone after 0.7+-0.1s. Comments: The TUT should indicate that Bell 103 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_17_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_17_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -5100,6 +5404,8 @@ static int test_ans_17(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -5148,9 +5454,13 @@ static int test_ans_17(void) } /*- End of function --------------------------------------------------------*/ +static void ans_18_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_18(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -5165,16 +5475,16 @@ static int test_ans_18(void) III.5.4.3.18 Bell 103 (2225Hz signal) detection Purpose: To ensure correct detection and selection of Bell 103 modems in reverse mode. Preamble: N/A - Method: The tester sends 2225Hz to TUT for 5 seconds. - Pass criteria: The TUT should respond with 1270Hz after 1+-0.2 seconds. + Method: The tester sends 2225Hz to TUT for 5s. + Pass criteria: The TUT should respond with 1270Hz after 1+-0.2s. Comments: The TUT should indicate that Bell 103 mode has been selected. Bell 103 modems use 2225Hz as both answer tone and higher frequency of the upper channel. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_18_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_18_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -5194,6 +5504,8 @@ static int test_ans_18(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -5242,9 +5554,13 @@ static int test_ans_18(void) } /*- End of function --------------------------------------------------------*/ +static void ans_19_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_19(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -5259,15 +5575,15 @@ static int test_ans_19(void) III.5.4.3.19 V.21 Reverse mode (1650Hz) detection Purpose: To ensure correct detection and selection of V.21 reverse mode. Preamble: N/A - Method: The tester sends 1650Hz to TUT for 5 seconds. - Pass criteria: The TUT should respond with 980Hz after 0.4+-0.2 seconds. + Method: The tester sends 1650Hz to TUT for 5s. + Pass criteria: The TUT should respond with 980Hz after 0.4+-0.2s. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_19_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_19_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -5287,6 +5603,8 @@ static int test_ans_19(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -5335,9 +5653,13 @@ static int test_ans_19(void) } /*- End of function --------------------------------------------------------*/ +static void ans_20_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_20(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -5353,17 +5675,17 @@ static int test_ans_20(void) Purpose: To confirm correct detection of 1300Hz calling tones as defined in ITU-T V.25. Preamble: N/A Method: The tester will send 1300Hz bursts of (a) 400ms, (b) 500ms, (c) 700ms and - (d) 800ms followed by 1 second of silence. - Pass criteria: 1) The TUT should not respond to bursts of 400 or 800ms. - 2) The TUT should immediately begin probing after a burst of 1300Hz for 500 or - 700ms followed by 1 second of silence. + (d) 800ms followed by 1s of silence. + Pass criteria: 1) The TUT should not respond to bursts of 400ms or 800ms. + 2) The TUT should immediately begin probing after a burst of 1300Hz for 500ms or + 700ms followed by 1s of silence. Comments: The probe sent by the TUT will depend on the country setting. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_20_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_20_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -5383,6 +5705,8 @@ static int test_ans_20(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -5431,9 +5755,13 @@ static int test_ans_20(void) } /*- End of function --------------------------------------------------------*/ +static void ans_21_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_21(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -5448,15 +5776,15 @@ static int test_ans_21(void) III.5.4.3.21 V.23 Reverse mode (1300Hz) detection Purpose: To ensure correct detection and selection of V.23 reverse mode. Preamble: N/A - Method: The tester sends 1300Hz only, with no XCI signals, to TUT for 5 seconds. - Pass criteria: The TUT should respond with 390Hz after 1.7+-0.1 seconds. + Method: The tester sends 1300Hz only, with no XCI signals, to TUT for 5s. + Pass criteria: The TUT should respond with 390Hz after 1.7+-0.1s. Comments: The TUT should indicate that V.23 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_21_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_21_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -5476,6 +5804,8 @@ static int test_ans_21(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -5524,9 +5854,13 @@ static int test_ans_21(void) } /*- End of function --------------------------------------------------------*/ +static void ans_22_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_22(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -5545,11 +5879,11 @@ static int test_ans_22(void) silent for 500ms then transmit the TXP signal in V.21 (1) mode. Pass criteria: The TUT should respond with TXP using V.21 (2) and select V.18 mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_22_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_22_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -5569,6 +5903,8 @@ static int test_ans_22(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -5617,9 +5953,13 @@ static int test_ans_22(void) } /*- End of function --------------------------------------------------------*/ +static void ans_23_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_23(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -5641,11 +5981,11 @@ static int test_ans_23(void) Pass criteria: The TUT should use the orders described in Appendix I. Comments: The order of the probes is not mandatory. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_23_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_23_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -5665,6 +6005,8 @@ static int test_ans_23(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -5713,9 +6055,13 @@ static int test_ans_23(void) } /*- End of function --------------------------------------------------------*/ +static void ans_24_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_24(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -5734,14 +6080,14 @@ static int test_ans_24(void) Method: The tester will call the TUT, wait for Ta to expire and then monitor the probes sent by the TUT. Pass criteria: The TUT should send the user defined probe message for Annexes A, B, and C - modes followed by a pause of Tm (default 3) seconds. + modes followed by a pause of Tm (default 3)s. Comments: The carrierless modes are those described in Annexes A, B and C. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_24_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_24_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -5761,6 +6107,8 @@ static int test_ans_24(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -5809,9 +6157,13 @@ static int test_ans_24(void) } /*- End of function --------------------------------------------------------*/ +static void ans_25_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_25(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -5825,19 +6177,19 @@ static int test_ans_25(void) /* III.5.4.3.25 Interrupted carrierless mode probe Purpose: To ensure that the TUT continues probing from the point of interruption a maximum - of 20 s after a failed connect attempt. + of 20s after a failed connect attempt. Preamble: The TUT should be configured for the UK country setting. Method: The tester will call the TUT, wait for Ta to expire and then during the pause after the first Baudot probe it will send a 200ms burst of 1270Hz followed by silence - for 30 s. + for 30s. Pass criteria: The TUT should transmit silence on detecting the 1270Hz tone and then continue - probing starting with the V.23 probe 20 seconds after the end of the 1270Hz signal. + probing starting with the V.23 probe 20s after the end of the 1270Hz signal. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_25_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_25_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -5857,6 +6209,8 @@ static int test_ans_25(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -5905,9 +6259,13 @@ static int test_ans_25(void) } /*- End of function --------------------------------------------------------*/ +static void ans_26_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_26(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -5920,20 +6278,20 @@ static int test_ans_26(void) /* III.5.4.3.26 Stimulate carrier mode probe time - Purpose: To ensure that the TUT sends each carrier mode for time Tc (default 6 seconds) + Purpose: To ensure that the TUT sends each carrier mode for time Tc (default 6s) preceded by the correct answer tone. Preamble: None. Method: The tester will call the TUT, wait for Ta to expire and then monitor the probes sent by the TUT. - Pass criteria: The TUT should send the ANS tone (2100Hz) for 1 second followed by silence for + Pass criteria: The TUT should send the ANS tone (2100Hz) for 1s followed by silence for 75+-5ms and then the 1650Hz, 1300Hz and 2225Hz probes for time Tc. Comments: The carrier modes are those described in Annexes D, E, and F. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_26_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_26_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -5953,6 +6311,8 @@ static int test_ans_26(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -6001,9 +6361,13 @@ static int test_ans_26(void) } /*- End of function --------------------------------------------------------*/ +static void ans_27_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_27(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -6019,21 +6383,21 @@ static int test_ans_27(void) Purpose: To confirm correct selection of V.23 mode. Preamble: N/A Method: The tester waits until the 1300Hz probe is detected from the TUT and then - transmits 390Hz for 11 seconds. - Pass criteria: 1) After 3 seconds of the 390Hz signal the TUT should indicate that V.23 has + transmits 390Hz for 11s. + Pass criteria: 1) After 3s of the 390Hz signal the TUT should indicate that V.23 has been selected. 2) The tester will confirm that the 1300Hz carrier is maintained for at least - 4 seconds beyond the normal probe duration, i.e. Tc (= 6 s default) + 4 s = - 10 seconds total. + 4s beyond the normal probe duration, i.e. Tc (= 6s default) + 4s = + 10s total. Comments: All known V.23 devices need to receive 1300Hz tone before they will respond with 390Hz. When the 1300Hz probe is not being transmitted, a 390Hz tone may be interpreted as a 400Hz network tone. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_27_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_27_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -6053,6 +6417,8 @@ static int test_ans_27(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -6101,9 +6467,13 @@ static int test_ans_27(void) } /*- End of function --------------------------------------------------------*/ +static void ans_28_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_28(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -6117,21 +6487,21 @@ static int test_ans_28(void) /* III.5.4.3.28 Interrupted carrier mode probe Purpose: To ensure that the TUT continues probing from the point of interruption a maximum - of 4 s after a failed connect attempt. + of 4s after a failed connect attempt. Preamble: The TUT should be configured for the UK country setting. Method: The tester will call the TUT, wait for Ta to expire and then during the first V.21 - probe it will send a 200ms burst of 1270Hz followed by silence for 30 s. + probe it will send a 200ms burst of 1270Hz followed by silence for 30s. Pass criteria: The TUT should transmit silence on detecting the 1270Hz tone and then continue - probing with the Baudot stored message 4 seconds after the end of the 1270Hz + probing with the Baudot stored message 4s after the end of the 1270Hz burst. - Comments: It is most likely that the TUT will return to probing time Ta (3 seconds) after the + Comments: It is most likely that the TUT will return to probing time Ta (3s) after the 1270Hz tone ceases. This condition needs further clarification. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_28_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_28_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -6151,6 +6521,8 @@ static int test_ans_28(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -6199,9 +6571,13 @@ static int test_ans_28(void) } /*- End of function --------------------------------------------------------*/ +static void ans_29_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_29(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -6224,11 +6600,11 @@ static int test_ans_29(void) Comments: The TUT may not respond to any signals while a carrierless mode probe is being sent since these modes are half duplex. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_29_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_29_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -6248,6 +6624,8 @@ static int test_ans_29(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -6296,9 +6674,13 @@ static int test_ans_29(void) } /*- End of function --------------------------------------------------------*/ +static void ans_30_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_30(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -6323,11 +6705,11 @@ static int test_ans_30(void) tones may be ignored. Some devices may only provide a visual indication of the presence and cadence of the tones for instance by a flashing light. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_30_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_30_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -6347,6 +6729,8 @@ static int test_ans_30(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -6395,9 +6779,13 @@ static int test_ans_30(void) } /*- End of function --------------------------------------------------------*/ +static void ans_31_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_31(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -6413,17 +6801,17 @@ static int test_ans_31(void) Purpose: To determine whether the TUT can discriminate fax calling tones. Preamble: N/A Method: The tester will call the TUT and send the fax calling tone, CNG. This is an 1100Hz - tone with cadence of 0.5 seconds ON and 3 seconds OFF as defined in ITU-T T.30. + tone with cadence of 0.5s ON and 3s OFF as defined in ITU-T T.30. Pass criteria: The TUT should not respond to this signal and may report it as being a calling fax machine. Comments: This is an optional test as detection of the fax calling tone is not required by ITU-T V.18. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_31_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_31_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -6443,6 +6831,8 @@ static int test_ans_31(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -6491,9 +6881,13 @@ static int test_ans_31(void) } /*- End of function --------------------------------------------------------*/ +static void ans_32_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_32(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -6515,11 +6909,11 @@ static int test_ans_32(void) Comments: Ideally the TUT should report the presence of speech back to the user. This is an optional test. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_32_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_32_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -6539,6 +6933,8 @@ static int test_ans_32(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -6587,9 +6983,13 @@ static int test_ans_32(void) } /*- End of function --------------------------------------------------------*/ +static void ans_33_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_ans_33(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -6605,8 +7005,8 @@ static int test_ans_33(void) Purpose: To confirm that the TUT will respond correctly to CM signals and connect according to V.8 procedures. Preamble: N/A - Method: The tester will transmit 2 sequences of 4 CI patterns separated by 2 seconds. On - reception of the ANSam tone the tester will wait 0.5 seconds and then begin + Method: The tester will transmit 2 sequences of 4 CI patterns separated by 2s. On + reception of the ANSam tone the tester will wait 0.5s and then begin transmitting the CM signal with textphone and V.21 specified. Pass criteria: 1) On reception of the CM signal, the TUT should transmit JM with textphone and V.21. @@ -6616,11 +7016,11 @@ static int test_ans_33(void) V.18 mode connection is completed. Comments: The TUT should indicate V.18 mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_33_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, ans_33_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -6640,6 +7040,8 @@ static int test_ans_33(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -6688,6 +7090,11 @@ static int test_ans_33(void) } /*- End of function --------------------------------------------------------*/ +static void mon_01_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_mon_01(void) { printf("Test not yet implemented\n"); @@ -6695,9 +7102,13 @@ static int test_mon_01(void) } /*- End of function --------------------------------------------------------*/ +static void mon_21_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_mon_21(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -6710,18 +7121,18 @@ static int test_mon_21(void) /* III.5.4.4.1 Automode monitor Ta timer test - Purpose: To ensure that on entering monitor mode, timer Ta (3 seconds) is not active and that + Purpose: To ensure that on entering monitor mode, timer Ta (3s) is not active and that the TUT does not enter the probing state. Preamble: N/A Method: The TUT should be put into monitor state. The tester will then monitor for signals for 1 minute. Pass criteria: The TUT should not start probing. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, mon_21_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, mon_21_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -6741,6 +7152,8 @@ static int test_mon_21(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -6789,9 +7202,13 @@ static int test_mon_21(void) } /*- End of function --------------------------------------------------------*/ +static void mon_22_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_mon_22(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -6808,18 +7225,18 @@ static int test_mon_22(void) ITU-T V.25. Preamble: N/A Method: The tester will send 1300Hz bursts of (a) 400ms, (b) 500ms, (c) 700ms and - (d) 800ms followed by 1 second of silence. - Pass criteria: 1) The TUT should not respond to bursts of 400 or 800ms. + (d) 800ms followed by 1s of silence. + Pass criteria: 1) The TUT should not respond to bursts of 400ms or 800ms. 2) The TUT should report detection of calling tones to the DTE after a burst of - 1300Hz for 500 or 700ms followed by 1 second of silence. + 1300Hz for 500ms or 700ms followed by 1s of silence. Comments: In automode answer, the 1300Hz calling causes the DCE to start probing. In monitor mode it should only report detection to the DTE. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, mon_22_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, mon_22_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -6839,6 +7256,8 @@ static int test_mon_22(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -6887,9 +7306,13 @@ static int test_mon_22(void) } /*- End of function --------------------------------------------------------*/ +static void mon_23_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_mon_23(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -6906,18 +7329,18 @@ static int test_mon_23(void) ITU-T V.25. Preamble: N/A Method: The tester will send 980Hz bursts of (a) 400ms, (b) 500ms, (c) 700ms and - (d) 800ms followed by 1 second of silence. - Pass criteria: 1) The TUT should not respond to bursts of 400 or 800ms. + (d) 800ms followed by 1s of silence. + Pass criteria: 1) The TUT should not respond to bursts of 400ms or 800ms. 2) The TUT should report detection of calling tones to the DTE after a burst of - 980Hz for 500 or 700ms followed by 1 second of silence. + 980Hz for 500ms or 700ms followed by 1s of silence. Comments: In automode answer, the 980Hz calling causes the DCE to start probing. In monitor mode it should only report detection to the DTE. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, mon_23_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, mon_23_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -6937,6 +7360,8 @@ static int test_mon_23(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -6989,7 +7414,7 @@ static void x_01_put_text_msg(void *user_data, const uint8_t *msg, int len) { printf("1-1 %d '%s'\n", len, msg); if (user_data == NULL) - strcat(result[0], (const char *) msg); + strcat(result[1], (const char *) msg); //else // v18_put(v18[1], "abcdefghij", 10); } @@ -7046,6 +7471,8 @@ static int test_x_01(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; v18_put(v18[0], "z", 1); for (i = 0; i < 10000; i++) { @@ -7093,15 +7520,19 @@ static int test_x_01(void) ref = "cdefghij"; printf("Result:\n%s\n", result[0]); printf("Reference result:\n%s\n", ref); - if (unexpected_echo || strcmp(result[0], ref) != 0) + if (unexpected_echo || strcmp(result[1], ref) != 0) return -1; return 1; } /*- End of function --------------------------------------------------------*/ +static void x_02_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_x_02(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -7121,11 +7552,11 @@ static int test_x_02(void) transmit the string "abcdef" at each rate. Pass criteria: The tester will measure the bit timings and confirm the rates. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, x_02_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, x_02_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -7145,6 +7576,8 @@ static int test_x_02(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -7193,9 +7626,13 @@ static int test_x_02(void) } /*- End of function --------------------------------------------------------*/ +static void x_03_put_text_msg(void *user_data, const uint8_t *msg, int len) +{ +} +/*- End of function --------------------------------------------------------*/ + static int test_x_03(void) { - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -7218,11 +7655,11 @@ static int test_x_03(void) Comments: The probe message must be long enough for the tester to establish the bit rate. "GA" may not be sufficient. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 0); + v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_4545, V18_AUTOMODING_USA, x_03_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, NULL, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_4545, V18_AUTOMODING_USA, x_03_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -7242,6 +7679,8 @@ static int test_x_03(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -7290,24 +7729,27 @@ static int test_x_03(void) } /*- End of function --------------------------------------------------------*/ -static void x_04_put_echo_text_msg(void *user_data, const uint8_t *msg, int len) -{ - printf("Unexpected ECHO received (%d) '%s'\n", len, msg); - unexpected_echo = TRUE; -} -/*- End of function --------------------------------------------------------*/ - static void x_04_put_text_msg(void *user_data, const uint8_t *msg, int len) { + if (user_data == NULL) + { + strcat(result[0], (const char *) msg); +printf("Unexpected ECHO received (%d) '%s'\n", len, msg); + unexpected_echo = TRUE; + } + else + { printf("1-1 %d '%s'\n", len, msg); - strcat(result[0], (const char *) msg); + strcat(result[1], (const char *) msg); + /* Echo each received character */ + //v18_put(v18[1], msg, len); + } } /*- End of function --------------------------------------------------------*/ static int test_x_04(void) { char msg[1024]; - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -7336,11 +7778,11 @@ static int test_x_04(void) assumed that the character conversion is the same for Baudot at 50 bit/s and any other supported speed. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, x_04_put_echo_text_msg, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_4545 | V18_MODE_REPETITIVE_SHIFTS_OPTION, V18_AUTOMODING_GLOBAL, x_04_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_4545, V18_AUTOMODING_GLOBAL, x_04_put_text_msg, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_4545 | V18_MODE_REPETITIVE_SHIFTS_OPTION, V18_AUTOMODING_GLOBAL, x_04_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "TUT"); @@ -7360,14 +7802,15 @@ static int test_x_04(void) exit(2); } - result[0][0] = '\0'; + result[0][0] = + result[1][0] = '\0'; unexpected_echo = FALSE; for (i = 0; i < 127; i++) msg[i] = i + 1; msg[127] = '\0'; v18_put(v18[0], msg, 127); - for (i = 0; i < 1000; i++) + for (i = 0; i < 2000; i++) { for (j = 0; j < 2; j++) { @@ -7410,8 +7853,9 @@ static int test_x_04(void) v18_free(v18[0]); v18_free(v18[1]); printf("Result:\n%s\n", result[0]); + printf("Result:\n%s\n", result[1]); printf("Reference result:\n%s\n", full_baudot_rx); - if (unexpected_echo || strcmp(result[0], full_baudot_rx) != 0) + if (unexpected_echo || strcmp(result[1], full_baudot_rx) != 0) return -1; return 0; } @@ -7450,7 +7894,7 @@ static int test_x_05(void) display will show when its receiver is re-enabled. Pass criteria: The receiver should be re-enabled after 300ms. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_05_put_text_msg, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_05_put_text_msg, (void *) (intptr_t) 0); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "Tester"); @@ -7474,7 +7918,8 @@ static int test_x_05(void) exit(2); } - result[0][0] = '\0'; + result[0][0] = + result[1][0] = '\0'; v18_put(v18[0], "e", 1); for (i = 0; i < 1000; i++) @@ -7532,6 +7977,7 @@ static int test_x_05(void) static void x_06_put_text_msg(void *user_data, const uint8_t *msg, int len) { if (user_data == NULL) + ; else strcat(result[1], (const char *) msg); } @@ -7540,9 +7986,7 @@ static void x_06_put_text_msg(void *user_data, const uint8_t *msg, int len) static int test_x_06(void) { char msg[128]; - char dtmf[1024]; const char *ref; - v18_state_t *v18[2]; logging_state_t *logging; int16_t amp[2][SAMPLES_PER_CHUNK]; int16_t model_amp[2][SAMPLES_PER_CHUNK]; @@ -7591,12 +8035,13 @@ static int test_x_06(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 127; i++) msg[i] = i + 1; msg[127] = '\0'; - printf("Original:\n%s\n", msg); + v18_put(v18[0], msg, 127); - result[0][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -7707,6 +8152,8 @@ static int test_x_07(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -7806,6 +8253,8 @@ static int test_x_08(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -7908,6 +8357,8 @@ static int test_x_09(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -8013,6 +8464,8 @@ static int test_x_10(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -8116,6 +8569,8 @@ static int test_x_11(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) @@ -8216,6 +8671,8 @@ static int test_x_12(void) exit(2); } + result[0][0] = + result[1][0] = '\0'; for (i = 0; i < 10000; i++) { for (j = 0; j < 2; j++) From 1f43148015fd8dcdc4ef56d1b874c19aa6f0fc2f Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 24 Jul 2013 00:32:53 +0800 Subject: [PATCH 10/88] Added some missing definitions to a spandsp header --- libs/spandsp/src/spandsp/t4_tx.h | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/libs/spandsp/src/spandsp/t4_tx.h b/libs/spandsp/src/spandsp/t4_tx.h index c5e08265f4..7a28f89c02 100644 --- a/libs/spandsp/src/spandsp/t4_tx.h +++ b/libs/spandsp/src/spandsp/t4_tx.h @@ -275,6 +275,54 @@ SPAN_DECLARE(int) t4_tx_get_bit(t4_tx_state_t *s); indicates that the end of the document has been reached. */ SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len); +/*! \brief Get the compression for the encoded data. + \param s The T.4 context. + \return the chosen compression for success, otherwise -1. */ +SPAN_DECLARE(int) t4_tx_get_tx_compression(t4_tx_state_t *s); + +/*! \brief Get the image type of the encoded data. + \param s The T.4 context. + \return the chosen image type for success, otherwise -1. */ +SPAN_DECLARE(int) t4_tx_get_tx_image_type(t4_tx_state_t *s); + +/*! \brief Get the X and Y resolution code of the current page. + \param s The T.4 context. + \return The resolution code,. */ +SPAN_DECLARE(int) t4_tx_get_tx_resolution(t4_tx_state_t *s); + +/*! \brief Get the column-to-column (x) resolution of the current page. + \param s The T.4 context. + \return The resolution, in pixels per metre. */ +SPAN_DECLARE(int) t4_tx_get_tx_x_resolution(t4_tx_state_t *s); + +/*! \brief Get the row-to-row (y) resolution of the current page. + \param s The T.4 context. + \return The resolution, in pixels per metre. */ +SPAN_DECLARE(int) t4_tx_get_tx_y_resolution(t4_tx_state_t *s); + +/*! \brief Get the width of the encoded data. + \param s The T.4 context. + \return the width, in pixels, for success, otherwise -1. */ +SPAN_DECLARE(int) t4_tx_get_tx_image_width(t4_tx_state_t *s); + +/*! \brief Get the width code of the encoded data. + \param s The T.4 context. + \return the width code, for success, otherwise -1. */ +SPAN_DECLARE(int) t4_tx_get_tx_image_width_code(t4_tx_state_t *s); + +/*! \brief Auto-select the format in which to send the image. + \param s The T.4 context. + \param supported_compressions The set of compressions supported for this transmission + \param supported_image_sizes The set of image sizes supported for this transmission + \param supported_bilevel_resolutions The set of bi-level resolutions supported for this transmission + \param supported_colour_resolutions The set of gray scale and colour resolutions supported for this transmission + \return A t4_image_format_status_t result code */ +SPAN_DECLARE(int) t4_tx_set_tx_image_format(t4_tx_state_t *s, + int supported_compressions, + int supported_image_sizes, + int supported_bilevel_resolutions, + int supported_colour_resolutions); + /*! \brief Set the compression for the encoded data. \param s The T.4 context. \param encoding The encoding. From 9046143f2b27196920c843669b2a7a6d8d8bcd44 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 24 Jul 2013 00:46:47 +0800 Subject: [PATCH 11/88] Cleanup of some T.4 functions which are obsolete --- libs/spandsp/src/spandsp/t4_tx.h | 25 ------------------------- libs/spandsp/src/t4_tx.c | 30 ------------------------------ libs/spandsp/tests/t4_tests.c | 6 +++--- 3 files changed, 3 insertions(+), 58 deletions(-) diff --git a/libs/spandsp/src/spandsp/t4_tx.h b/libs/spandsp/src/spandsp/t4_tx.h index 7a28f89c02..b411892c78 100644 --- a/libs/spandsp/src/spandsp/t4_tx.h +++ b/libs/spandsp/src/spandsp/t4_tx.h @@ -387,31 +387,6 @@ SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_tx_state_t *s, t4_row_read_handl \param row_squashing_ratio Vertical squashing ratio. */ SPAN_DECLARE(void) t4_tx_set_row_squashing_ratio(t4_tx_state_t *s, int row_squashing_ratio); -/*! \brief Get the row-to-row (y) resolution of the current page. - \param s The T.4 context. - \return The resolution, in pixels per metre. */ -SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_tx_state_t *s); - -/*! \brief Get the column-to-column (x) resolution of the current page. - \param s The T.4 context. - \return The resolution, in pixels per metre. */ -SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_tx_state_t *s); - -/*! \brief Get the X and Y resolution code of the current page. - \param s The T.4 context. - \return The resolution code,. */ -SPAN_DECLARE(int) t4_tx_get_resolution(t4_tx_state_t *s); - -/*! \brief Get the width of the current page, in pixel columns. - \param s The T.4 context. - \return The number of columns. */ -SPAN_DECLARE(int) t4_tx_get_image_width(t4_tx_state_t *s); - -/*! \brief Get the type of the current page, in pixel columns. - \param s The T.4 context. - \return The type. */ -SPAN_DECLARE(int) t4_tx_get_image_type(t4_tx_state_t *s); - /*! \brief Get the number of pages in the file. \param s The T.4 context. \return The number of pages, or -1 if there is an error. */ diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index d0001aa720..83eca0253a 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -1337,12 +1337,6 @@ SPAN_DECLARE(void) t4_tx_set_max_2d_rows_per_1d_row(t4_tx_state_t *s, int max) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t4_tx_get_image_width(t4_tx_state_t *s) -{ - return s->metadata.image_width; -} -/*- End of function --------------------------------------------------------*/ - SPAN_DECLARE(void) t4_tx_set_header_overlays_image(t4_tx_state_t *s, int header_overlays_image) { s->header_overlays_image = header_overlays_image; @@ -1367,30 +1361,6 @@ SPAN_DECLARE(void) t4_tx_set_header_tz(t4_tx_state_t *s, struct tz_s *tz) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_tx_state_t *s) -{ - return s->metadata.y_resolution; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_tx_state_t *s) -{ - return s->metadata.x_resolution; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_tx_get_resolution(t4_tx_state_t *s) -{ - return s->metadata.resolution_code; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_tx_get_image_type(t4_tx_state_t *s) -{ - return s->metadata.image_type; -} -/*- End of function --------------------------------------------------------*/ - SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_tx_state_t *s) { int max; diff --git a/libs/spandsp/tests/t4_tests.c b/libs/spandsp/tests/t4_tests.c index 2d4eba4ab2..ac682bd620 100644 --- a/libs/spandsp/tests/t4_tests.c +++ b/libs/spandsp/tests/t4_tests.c @@ -554,9 +554,9 @@ int main(int argc, char *argv[]) if (t4_tx_start_page(send_state)) break; - t4_rx_set_x_resolution(receive_state, t4_tx_get_x_resolution(send_state)); - t4_rx_set_y_resolution(receive_state, t4_tx_get_y_resolution(send_state)); - t4_rx_set_image_width(receive_state, t4_tx_get_image_width(send_state)); + t4_rx_set_x_resolution(receive_state, t4_tx_get_tx_x_resolution(send_state)); + t4_rx_set_y_resolution(receive_state, t4_tx_get_tx_y_resolution(send_state)); + t4_rx_set_image_width(receive_state, t4_tx_get_tx_image_width(send_state)); } t4_rx_start_page(receive_state); detect_non_ecm_page_end(-1, compression); From 43e2f86c0f8dbdd415ce5ad3d87ab62f4cef8a45 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 24 Jul 2013 01:38:07 +0800 Subject: [PATCH 12/88] More tweaks to spandsp --- libs/spandsp/src/fsk.c | 9 +++++++++ libs/spandsp/src/spandsp/t4_t6_encode.h | 6 ++++++ libs/spandsp/src/spandsp/v18.h | 21 +++++++++++---------- libs/spandsp/src/t4_t6_encode.c | 6 ++++++ 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/libs/spandsp/src/fsk.c b/libs/spandsp/src/fsk.c index 56f155169e..2c1d326d84 100644 --- a/libs/spandsp/src/fsk.c +++ b/libs/spandsp/src/fsk.c @@ -69,6 +69,7 @@ const fsk_spec_t preset_fsk_specs[] = 300*100 }, { + /* This is mode 2 of the V.23 spec. Mode 1 (the 600baud mode) is not defined here */ "V23 ch 1", 1700 + 400, 1700 - 400, @@ -124,6 +125,14 @@ const fsk_spec_t preset_fsk_specs[] = -30, 50*100 }, + { + "Weitbrecht 47.6", /* Used for V.18 probing */ + 1600 + 200, + 1600 - 200, + -14, + -30, + 4760 + }, { "V21 (110bps) ch 1", 1080 + 100, diff --git a/libs/spandsp/src/spandsp/t4_t6_encode.h b/libs/spandsp/src/spandsp/t4_t6_encode.h index a157b444b9..81c6ddb3e4 100644 --- a/libs/spandsp/src/spandsp/t4_t6_encode.h +++ b/libs/spandsp/src/spandsp/t4_t6_encode.h @@ -77,6 +77,12 @@ SPAN_DECLARE(int) t4_t6_encode_set_encoding(t4_t6_encode_state_t *s, int encodin \return 0 for success, otherwise -1. */ SPAN_DECLARE(int) t4_t6_encode_set_image_width(t4_t6_encode_state_t *s, int image_width); +/*! \brief Set the length of the image. + \param s The T.4/T.6 context. + \param image_length The image length, in pixels. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_t6_encode_set_image_length(t4_t6_encode_state_t *s, int image_length); + /*! \brief Get the width of the image. \param s The T.4/T.6 context. \return The width of the image, in pixels. */ diff --git a/libs/spandsp/src/spandsp/v18.h b/libs/spandsp/src/spandsp/v18.h index 970d2a3f22..32814d9c65 100644 --- a/libs/spandsp/src/spandsp/v18.h +++ b/libs/spandsp/src/spandsp/v18.h @@ -38,24 +38,25 @@ typedef struct v18_state_s v18_state_t; enum { - V18_MODE_NONE = 0, + V18_MODE_NONE = 0x0001, /* V.18 Annex A - Weitbrecht TDD at 45.45bps (US TTY), half-duplex, 5 bit baudot (USA). */ - V18_MODE_5BIT_4545 = 1, + V18_MODE_5BIT_4545 = 0x0002, /* V.18 Annex A - Weitbrecht TDD at 50bps (International TTY), half-duplex, 5 bit baudot (UK, Australia and others). */ - V18_MODE_5BIT_50 = 2, + V18_MODE_5BIT_50 = 0x0004, /* V.18 Annex B - DTMF encoding of ASCII (Denmark, Holland and others). */ - V18_MODE_DTMF = 3, + V18_MODE_DTMF = 0x0008, /* V.18 Annex C - EDT (European Deaf Telephone) 110bps, V.21, half-duplex, ASCII (Germany, Austria, Switzerland and others). */ - V18_MODE_EDT = 4, + V18_MODE_EDT = 0x0010, /* V.18 Annex D - 300bps, Bell 103, duplex, ASCII (USA). */ - V18_MODE_BELL103 = 5, + V18_MODE_BELL103 = 0x0020, /* V.18 Annex E - 1200bps Videotex terminals, ASCII (France). */ - V18_MODE_V23VIDEOTEX = 6, + V18_MODE_V23VIDEOTEX = 0x0040, /* V.18 Annex F - V.21 text telephone, V.21, duplex, ASCII (Sweden, Norway and Finland). */ - V18_MODE_V21TEXTPHONE = 7, + V18_MODE_V21TEXTPHONE = 0x0080, /* V.18 Annex G - V.18 text telephone mode. */ - V18_MODE_V18TEXTPHONE = 8, - V18_MODE_5BIT_476 = 9, + V18_MODE_V18TEXTPHONE = 0x0100, + /* V.18 Annex A - Used during probing. */ + V18_MODE_5BIT_476 = 0x0200, /* Use repetitive shift characters where character set shifts are used */ V18_MODE_REPETITIVE_SHIFTS_OPTION = 0x1000 }; diff --git a/libs/spandsp/src/t4_t6_encode.c b/libs/spandsp/src/t4_t6_encode.c index ddb8b33a06..4ed063e063 100644 --- a/libs/spandsp/src/t4_t6_encode.c +++ b/libs/spandsp/src/t4_t6_encode.c @@ -1040,6 +1040,12 @@ SPAN_DECLARE(int) t4_t6_encode_set_image_width(t4_t6_encode_state_t *s, int imag } /*- End of function --------------------------------------------------------*/ +SPAN_DECLARE(int) t4_t6_encode_set_image_length(t4_t6_encode_state_t *s, int image_length) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(uint32_t) t4_t6_encode_get_image_width(t4_t6_encode_state_t *s) { return s->image_width; From 1912bf013a76a5d93926fecd7c2c785070cb5308 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 24 Jul 2013 01:48:28 +0800 Subject: [PATCH 13/88] Tweaks --- libs/spandsp/src/t4_tx.c | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index 83eca0253a..3419894c64 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -1488,7 +1488,6 @@ SPAN_DECLARE(int) t4_tx_get_bit(t4_tx_state_t *s) SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len) { -#if 0 if (s->pre_encoded_len > 0) { if (max_len > (s->pre_encoded_len - s->pre_encoded_ptr)) @@ -1500,33 +1499,6 @@ SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len) if (s->image_get_handler) return s->image_get_handler((void *) &s->encoder, buf, max_len); -#else - switch (s->metadata.compression) - { - case T4_COMPRESSION_T4_1D: - case T4_COMPRESSION_T4_2D: - case T4_COMPRESSION_T6: - return t4_t6_encode_get(&s->encoder.t4_t6, buf, max_len); - case T4_COMPRESSION_T85: - case T4_COMPRESSION_T85_L0: - return t85_encode_get(&s->encoder.t85, buf, max_len); -#if defined(SPANDSP_SUPPORT_T88) - case T4_COMPRESSION_T88: - return t88_encode_get(&s->encoder.t88, buf, max_len); -#endif - case T4_COMPRESSION_T42_T81: - case T4_COMPRESSION_SYCC_T81: - return t42_encode_get(&s->encoder.t42, buf, max_len); -#if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_T43: - return t43_encode_get(&s->encoder.t43, buf, max_len); -#endif -#if defined(SPANDSP_SUPPORT_T45) - case T4_COMPRESSION_T45: - return t45_encode_get(&s->encoder.t45, buf, max_len); -#endif - } -#endif return 0; } /*- End of function --------------------------------------------------------*/ From 01d45ae506f50cdefa9ccfb9c5d08c3b5adbdfec Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 23 Jul 2013 11:08:48 -0700 Subject: [PATCH 14/88] mod_valet_parking: add valet_lot_extension chan var - stores the current park location of the channel --- src/mod/applications/mod_valet_parking/mod_valet_parking.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/applications/mod_valet_parking/mod_valet_parking.c b/src/mod/applications/mod_valet_parking/mod_valet_parking.c index 76cf7b218e..a428f82684 100644 --- a/src/mod/applications/mod_valet_parking/mod_valet_parking.c +++ b/src/mod/applications/mod_valet_parking/mod_valet_parking.c @@ -650,6 +650,8 @@ SWITCH_STANDARD_APP(valet_parking_function) switch_event_fire(&event); } + switch_channel_set_variable(channel, "valet_lot_extension", ext); + valet_send_presence(lot_name, lot, token, SWITCH_TRUE); if ((rf.exten = switch_channel_get_variable(channel, "valet_parking_orbit_exten"))) { From 7c9039629430a6e15b7b5b3b218a4c09b3cd159e Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 24 Jul 2013 02:19:40 +0800 Subject: [PATCH 15/88] More tweaks to spandsp --- libs/spandsp/src/t4_rx.c | 63 ++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index 247b9ae726..5852de3ae6 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -663,31 +663,31 @@ SPAN_DECLARE(int) t4_rx_put_bit(t4_rx_state_t *s, int bit) SPAN_DECLARE(int) t4_rx_put(t4_rx_state_t *s, const uint8_t buf[], size_t len) { + uint8_t *buf2; + s->line_image_size += 8*len; - switch (s->metadata.compression) + + if (s->pre_encoded_len > 0) { - case T4_COMPRESSION_T4_1D: - case T4_COMPRESSION_T4_2D: - case T4_COMPRESSION_T6: - return t4_t6_decode_put(&s->decoder.t4_t6, buf, len); - case T4_COMPRESSION_T85: - case T4_COMPRESSION_T85_L0: - return t85_decode_put(&s->decoder.t85, buf, len); -#if defined(SPANDSP_SUPPORT_T88) - case T4_COMPRESSION_T88: - break; -#endif - case T4_COMPRESSION_T42_T81: - return t42_decode_put(&s->decoder.t42, buf, len); -#if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_T43: - return t43_decode_put(&s->decoder.t43, buf, len); -#endif -#if defined(SPANDSP_SUPPORT_T45) - case T4_COMPRESSION_T45: - break; -#endif + if (s->pre_encoded_len < s->pre_encoded_ptr + 65536) + { + s->pre_encoded_len += 65536; + if ((buf2 = realloc(s->pre_encoded_buf, s->pre_encoded_len)) == NULL) + { + if (s->pre_encoded_buf) + free(s->pre_encoded_buf); + return -1; + } + s->pre_encoded_buf = buf2; + } + memcpy(&s->pre_encoded_buf[s->pre_encoded_ptr], buf, len); + s->pre_encoded_ptr += len; + return T4_DECODE_MORE_DATA; } + + if (s->image_put_handler) + return s->image_put_handler((void *) &s->decoder, buf, len); + return T4_DECODE_OK; } /*- End of function --------------------------------------------------------*/ @@ -977,31 +977,42 @@ SPAN_DECLARE(int) t4_rx_start_page(t4_rx_state_t *s) switch (s->metadata.compression) { + case 0: + s->pre_encoded_ptr = 0; + s->pre_encoded_len = 0; + s->image_put_handler = NULL; + break; case T4_COMPRESSION_T4_1D: case T4_COMPRESSION_T4_2D: case T4_COMPRESSION_T6: t4_t6_decode_restart(&s->decoder.t4_t6, s->metadata.image_width); + s->image_put_handler = (t4_image_put_handler_t) t4_t6_decode_put; break; case T4_COMPRESSION_T85: case T4_COMPRESSION_T85_L0: t85_decode_restart(&s->decoder.t85); + s->image_put_handler = (t4_image_put_handler_t) t85_decode_put; break; #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: t88_decode_restart(&s->decoder.t88); + s->image_put_handler = (t4_image_put_handler_t) t88_decode_put; break; #endif case T4_COMPRESSION_T42_T81: t42_decode_restart(&s->decoder.t42); + s->image_put_handler = (t4_image_put_handler_t) t42_decode_put; break; #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: t43_decode_restart(&s->decoder.t43); + s->image_put_handler = (t4_image_put_handler_t) t43_decode_put; break; #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: t45_decode_restart(&s->decoder.t45); + s->image_put_handler = (t4_image_put_handler_t) t45_decode_put; break; #endif } @@ -1041,27 +1052,25 @@ SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s) int length; length = 0; + if (s->image_put_handler) + s->image_put_handler((void *) &s->decoder, NULL, 0); switch (s->metadata.compression) { case T4_COMPRESSION_T4_1D: case T4_COMPRESSION_T4_2D: case T4_COMPRESSION_T6: - t4_t6_decode_put(&s->decoder.t4_t6, NULL, 0); length = t4_t6_decode_get_image_length(&s->decoder.t4_t6); break; case T4_COMPRESSION_T85: case T4_COMPRESSION_T85_L0: - t85_decode_put(&s->decoder.t85, NULL, 0); length = t85_decode_get_image_length(&s->decoder.t85); break; #if defined(SPANDSP_SUPPORT_T88) case T4_COMPRESSION_T88: - t88_decode_put(&s->decoder.t88, NULL, 0); length = t88_decode_get_image_length(&s->decoder.t88); break; #endif case T4_COMPRESSION_T42_T81: - t42_decode_put(&s->decoder.t42, NULL, 0); length = t42_decode_get_image_length(&s->decoder.t42); if (s->decoder.t42.samples_per_pixel == 3) select_tiff_compression(s, T4_IMAGE_TYPE_COLOUR_8BIT); @@ -1070,13 +1079,11 @@ SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s) break; #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: - t43_decode_put(&s->decoder.t43, NULL, 0); length = t43_decode_get_image_length(&s->decoder.t43); break; #endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: - t45_decode_put(&s->decoder.t45, NULL, 0); length = t45_decode_get_image_length(&s->decoder.t45); break; #endif From 3ddbad4dd386f30b3a5fe29763e04b965f8b0dfa Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 23 Jul 2013 13:52:49 -0500 Subject: [PATCH 16/88] let sofia recover work in some tcp situations --- src/mod/endpoints/mod_sofia/sofia.c | 2 +- src/mod/endpoints/mod_sofia/sofia_glue.c | 11 ++++++----- src/switch_core_media.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 276c87a858..35c325fefa 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -253,7 +253,7 @@ static void extract_header_vars(sofia_profile_t *profile, sip_t const *sip, switch_channel_set_variable(channel, "sip_full_via", (char *)stream.data); - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND || switch_stristr("TCP", (char *)stream.data)) { switch_channel_set_variable(channel, "sip_recover_via", (char *)stream.data); } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index fccc577fa8..ea403e7d38 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -986,7 +986,6 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) switch_channel_set_variable(channel, "sip_to_host", sofia_glue_get_host(to_str, switch_core_session_get_pool(session))); switch_channel_set_variable(channel, "sip_from_host", sofia_glue_get_host(from_str, switch_core_session_get_pool(session))); - if (!(tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL, NUTAG_URL(url_str), TAG_IF(call_id, SIPTAG_CALL_ID_STR(call_id)), @@ -1221,6 +1220,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) "Local SDP:\n%s\n", tech_pvt->mparams.local_sdp_str); } + if (sofia_use_soa(tech_pvt)) { nua_invite(tech_pvt->nh, NUTAG_AUTOANSWER(0), @@ -1850,10 +1850,13 @@ int sofia_recover_callback(switch_core_session_t *session) tech_pvt->redirected = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_contact_uri")); if (zstr(rr)) { - switch_channel_set_variable_printf(channel, "sip_invite_route_uri", "", + switch_channel_set_variable_printf(channel, "sip_invite_route_uri", "", switch_channel_get_variable(channel, "sip_from_user"), - switch_channel_get_variable(channel, "sip_network_ip"), switch_channel_get_variable(channel, "sip_network_port") + switch_channel_get_variable(channel, "sip_network_ip"), + switch_channel_get_variable(channel, "sip_network_port"), + switch_channel_get_variable(channel,"sip_via_protocol") ); + } tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_from_uri")); @@ -1889,8 +1892,6 @@ int sofia_recover_callback(switch_core_session_t *session) if (session) { const char *use_uuid; - switch_channel_set_flag(channel, CF_RECOVERING); - if ((use_uuid = switch_channel_get_variable(channel, "origination_uuid"))) { if (switch_core_session_set_uuid(session, use_uuid) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s set UUID=%s\n", switch_channel_get_name(channel), diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 989aacb361..22e082d90d 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -7478,7 +7478,7 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s ip = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE); port = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE); - + switch_channel_set_flag(session->channel, CF_RECOVERING); if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) || !(ip && port)) { return; From b6a4e392f87cd2ef7e9e0f45b4002ec0439931ba Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 24 Jul 2013 03:25:42 +0800 Subject: [PATCH 17/88] More tweaks to spandsp --- libs/spandsp/src/t4_rx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index 5852de3ae6..14910dfd98 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -1052,8 +1052,10 @@ SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s) int length; length = 0; + if (s->image_put_handler) s->image_put_handler((void *) &s->decoder, NULL, 0); + switch (s->metadata.compression) { case T4_COMPRESSION_T4_1D: From 612c81c13d97f0ee713988031e1d6dd447c3f708 Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 23 Jul 2013 17:22:15 -0500 Subject: [PATCH 18/88] You can't prefix this one with MWI as it ends up in the body of the MWI notify causing some devices to have a heart attack --- src/mod/applications/mod_voicemail/mod_voicemail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 0d3a7973a9..41f7cef5d6 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1918,7 +1918,7 @@ static void update_mwi(vm_profile_t *profile, const char *id, const char *domain yn = "yes"; } switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", yn); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MWI-Update-Reason", update_reason); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Update-Reason", update_reason); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", "%s@%s", id, domain_name); /* switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", total_new_messages, total_saved_messages, From 3ae87091e1c6aabcfd8a3854f52adba9561748db Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 24 Jul 2013 11:58:36 +0800 Subject: [PATCH 19/88] Reworked some of the definition names and values in preparation for colour FAX --- libs/spandsp/src/spandsp/t4_rx.h | 133 ++----- libs/spandsp/src/t30.c | 224 ++++++------ libs/spandsp/src/t30_api.c | 79 +++-- libs/spandsp/src/t4_rx.c | 12 +- .../etsi/fax/generate_etsi_300_242_pages.c | 50 +-- .../test-data/itu/fax/generate_dithered_tif.c | 10 +- .../test-data/itu/fax/generate_sized_pages.c | 335 +++++++++++++++--- .../itu/fax/generate_striped_pages.c | 9 +- libs/spandsp/tests/fax_tests.c | 108 +++--- libs/spandsp/tests/fax_tests.sh | 132 ++++++- libs/spandsp/tests/t38_decode.c | 4 +- libs/spandsp/tests/tsb85_tests.c | 30 +- .../mod_spandsp/mod_spandsp_fax.c | 20 +- 13 files changed, 736 insertions(+), 410 deletions(-) diff --git a/libs/spandsp/src/spandsp/t4_rx.h b/libs/spandsp/src/spandsp/t4_rx.h index ed56cbcf8f..bef9b3196a 100644 --- a/libs/spandsp/src/spandsp/t4_rx.h +++ b/libs/spandsp/src/spandsp/t4_rx.h @@ -49,68 +49,44 @@ typedef int (*t4_row_write_handler_t)(void *user_data, const uint8_t buf[], size typedef enum { /*! No compression */ - T4_COMPRESSION_NONE = 0, - /*! T.1 1D compression */ - T4_COMPRESSION_T4_1D = 1, + T4_COMPRESSION_NONE = 0x01, + /*! T.4 1D compression */ + T4_COMPRESSION_T4_1D = 0x02, /*! T.4 2D compression */ - T4_COMPRESSION_T4_2D = 2, + T4_COMPRESSION_T4_2D = 0x04, /*! T.6 2D compression */ - T4_COMPRESSION_T6 = 3, + T4_COMPRESSION_T6 = 0x08, /*! T.85 monochrome JBIG coding with L0 fixed. */ - T4_COMPRESSION_T85 = 4, + T4_COMPRESSION_T85 = 0x10, /*! T.85 monochrome JBIG coding with L0 variable. */ - T4_COMPRESSION_T85_L0 = 5, + T4_COMPRESSION_T85_L0 = 0x20, /*! T.43 gray-scale/colour JBIG coding */ - T4_COMPRESSION_T43 = 6, + T4_COMPRESSION_T43 = 0x40, /*! T.45 run length colour compression */ - T4_COMPRESSION_T45 = 7, + T4_COMPRESSION_T45 = 0x80, /*! T.42 + T.81 + T.30 Annex E colour JPEG coding */ - T4_COMPRESSION_T42_T81 = 8, + T4_COMPRESSION_T42_T81 = 0x100, /*! T.42 + T.81 + T.30 Annex K colour sYCC-JPEG coding */ - T4_COMPRESSION_SYCC_T81 = 9, + T4_COMPRESSION_SYCC_T81 = 0x200, /*! T.88 monochrome JBIG2 compression */ - T4_COMPRESSION_T88 = 10 -} t4_image_compression_t; - -enum -{ - /*! No compression */ - T4_SUPPORT_COMPRESSION_NONE = 0x01, - /*! T.1 1D compression */ - T4_SUPPORT_COMPRESSION_T4_1D = 0x02, - /*! T.4 2D compression */ - T4_SUPPORT_COMPRESSION_T4_2D = 0x04, - /*! T.6 2D compression */ - T4_SUPPORT_COMPRESSION_T6 = 0x08, - /*! T.85 monochrome JBIG compression, with fixed L0 */ - T4_SUPPORT_COMPRESSION_T85 = 0x10, - /*! T.85 monochrome JBIG compression, with variable L0 */ - T4_SUPPORT_COMPRESSION_T85_L0 = 0x20, - /*! T.43 colour JBIG compression */ - T4_SUPPORT_COMPRESSION_T43 = 0x40, - /*! T.45 run length colour compression */ - T4_SUPPORT_COMPRESSION_T45 = 0x80, - /*! T.81 + T.30 Annex E colour JPEG compression */ - T4_SUPPORT_COMPRESSION_T42_T81 = 0x100, - /*! T.81 + T.30 Annex K colour sYCC-JPEG compression */ - T4_SUPPORT_COMPRESSION_SYCC_T81 = 0x200, - /*! T.88 monochrome JBIG2 compression */ - T4_SUPPORT_COMPRESSION_T88 = 0x400, + T4_COMPRESSION_T88 = 0x400, + /*! Support solour compression without sub-sampling */ + T4_COMPRESSION_NO_SUBSAMPLING = 0x800000, /*! Gray-scale support by multi-level codecs */ - T4_SUPPORT_COMPRESSION_GRAYSCALE = 0x1000000, + T4_COMPRESSION_GRAYSCALE = 0x1000000, /*! Colour support by multi-level codecs */ - T4_SUPPORT_COMPRESSION_COLOUR = 0x2000000, + T4_COMPRESSION_COLOUR = 0x2000000, /*! 12 bit mode for gray-scale and colour */ - T4_SUPPORT_COMPRESSION_12BIT = 0x4000000, + T4_COMPRESSION_12BIT = 0x4000000, /*! Convert a colour image to a gray-scale one */ - T4_SUPPORT_COMPRESSION_COLOUR_TO_GRAY = 0x8000000, + T4_COMPRESSION_COLOUR_TO_GRAY = 0x8000000, /*! Dither a gray-scale image down a simple bilevel image, with rescaling to fit a FAX page */ - T30_SUPPORT_GRAY_TO_BILEVEL = 0x10000000, + T4_COMPRESSION_GRAY_TO_BILEVEL = 0x10000000, /*! Dither a colour image down a simple bilevel image, with rescaling to fit a FAX page */ - T30_SUPPORT_COLOUR_TO_BILEVEL = 0x20000000, + T4_COMPRESSION_COLOUR_TO_BILEVEL = 0x20000000, /*! Rescale an image (except a bi-level image) to fit a permitted FAX width when necessary */ - T4_SUPPORT_COMPRESSION_RESCALING = 0x40000000 -}; + T4_COMPRESSION_RESCALING = 0x40000000 +} t4_image_compression_t; /*! Image type */ typedef enum @@ -169,71 +145,36 @@ typedef enum enum { /*! Standard FAX resolution 204dpi x 98dpi - bi-level only */ - T4_RESOLUTION_R8_STANDARD = 1, + T4_RESOLUTION_R8_STANDARD = 0x1, /*! Fine FAX resolution 204dpi x 196dpi - bi-level only */ - T4_RESOLUTION_R8_FINE = 2, + T4_RESOLUTION_R8_FINE = 0x2, /*! Super-fine FAX resolution 204dpi x 391dpi - bi-level only */ - T4_RESOLUTION_R8_SUPERFINE = 3, + T4_RESOLUTION_R8_SUPERFINE = 0x4, /*! Double FAX resolution 408dpi x 391dpi - bi-level only */ - T4_RESOLUTION_R16_SUPERFINE = 4, + T4_RESOLUTION_R16_SUPERFINE = 0x8, /*! 100dpi x 100dpi - gray-scale and colour only */ - T4_RESOLUTION_100_100 = 5, + T4_RESOLUTION_100_100 = 0x10, /*! 200dpi x 100dpi - bi-level only */ - T4_RESOLUTION_200_100 = 6, + T4_RESOLUTION_200_100 = 0x20, /*! 200dpi x 200dpi */ - T4_RESOLUTION_200_200 = 7, + T4_RESOLUTION_200_200 = 0x40, /*! 200dpi x 400dpi - bi-level only */ - T4_RESOLUTION_200_400 = 8, + T4_RESOLUTION_200_400 = 0x80, /*! 300dpi x 300dpi */ - T4_RESOLUTION_300_300 = 9, + T4_RESOLUTION_300_300 = 0x100, /*! 300dpi x 600dpi - bi-level only */ - T4_RESOLUTION_300_600 = 10, + T4_RESOLUTION_300_600 = 0x200, /*! 400dpi x 400dpi */ - T4_RESOLUTION_400_400 = 11, + T4_RESOLUTION_400_400 = 0x400, /*! 400dpi x 800dpi - bi-level only */ - T4_RESOLUTION_400_800 = 12, + T4_RESOLUTION_400_800 = 0x800, /*! 600dpi x 600dpi */ - T4_RESOLUTION_600_600 = 13, + T4_RESOLUTION_600_600 = 0x1000, /*! 600dpi x 1200dpi - bi-level only */ - T4_RESOLUTION_600_1200 = 14, + T4_RESOLUTION_600_1200 = 0x2000, /*! 1200dpi x 1200dpi */ - T4_RESOLUTION_1200_1200 = 15 -}; - -enum -{ - /*! Support standard FAX resolution 204dpi x 98dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_R8_STANDARD = 0x1, - /*! Support fine FAX resolution 204dpi x 196dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_R8_FINE = 0x2, - /*! Support super-fine FAX resolution 204dpi x 391dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_R8_SUPERFINE = 0x4, - /*! Support double FAX resolution 408dpi x 391dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_R16_SUPERFINE = 0x8, - - /*! Support 100dpi x 100dpi - gray-scale and colour only */ - T4_SUPPORT_RESOLUTION_100_100 = 0x10, - /*! Support 200dpi x 100dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_200_100 = 0x20, - /*! Support 200dpi x 200dpi */ - T4_SUPPORT_RESOLUTION_200_200 = 0x40, - /*! Support 200dpi x 400dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_200_400 = 0x80, - /*! Support 300dpi x 300dpi */ - T4_SUPPORT_RESOLUTION_300_300 = 0x100, - /*! Support 300dpi x 600dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_300_600 = 0x200, - /*! Support 400dpi x 400dpi */ - T4_SUPPORT_RESOLUTION_400_400 = 0x400, - /*! Support 400dpi x 800dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_400_800 = 0x800, - /*! Support 600dpi x 600dpi */ - T4_SUPPORT_RESOLUTION_600_600 = 0x1000, - /*! Support 600dpi x 1200dpi - bi-level only */ - T4_SUPPORT_RESOLUTION_600_1200 = 0x2000, - /*! Support 1200dpi x 1200dpi */ - T4_SUPPORT_RESOLUTION_1200_1200 = 0x4000 + T4_RESOLUTION_1200_1200 = 0x4000 }; /*! diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index c93636a265..1e3107b0b2 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -1194,9 +1194,9 @@ int t30_build_dis_or_dtc(t30_state_t *s) /* No scan-line padding required, but some may be specified by the application. */ set_ctrl_bits(s->local_dis_dtc_frame, s->local_min_scan_time_code, T30_DIS_BIT_MIN_SCAN_LINE_TIME_CAPABILITY_1); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T4_2D)) + if ((s->supported_compressions & T4_COMPRESSION_T4_2D)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_NONE)) + if ((s->supported_compressions & T4_COMPRESSION_NONE)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_UNCOMPRESSED_CAPABLE); if (s->ecm_allowed) { @@ -1205,50 +1205,50 @@ int t30_build_dis_or_dtc(t30_state_t *s) /* Only offer the option of fancy compression schemes, if we are also offering the ECM option needed to support them. */ - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T6)) + if ((s->supported_compressions & T4_COMPRESSION_T6)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T85)) + if ((s->supported_compressions & T4_COMPRESSION_T85)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE); /* Bit 79 set with bit 78 clear is invalid, so only check for L0 support here. */ - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T85_L0)) + if ((s->supported_compressions & T4_COMPRESSION_T85_L0)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE); } - //if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T88)) + //if ((s->supported_compressions & T4_COMPRESSION_T88)) //{ // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T88_CAPABILITY_1); // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T88_CAPABILITY_2); // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T88_CAPABILITY_3); //} - //if ((s->supported_compressions & (T4_SUPPORT_COMPRESSION_COLOUR | T4_SUPPORT_COMPRESSION_GRAYSCALE))) + //if ((s->supported_compressions & (T4_COMPRESSION_COLOUR | T4_COMPRESSION_GRAYSCALE))) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_COLOUR)) + if ((s->supported_compressions & T4_COMPRESSION_COLOUR)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T42_T81)) + if ((s->supported_compressions & T4_COMPRESSION_T42_T81)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T43)) + if ((s->supported_compressions & T4_COMPRESSION_T43)) { /* Note 25 of table 2/T.30 */ set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE); /* No plane interleave */ } - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T45)) + if ((s->supported_compressions & T4_COMPRESSION_T45)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE); - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_SYCC_T81)) + if ((s->supported_compressions & T4_COMPRESSION_SYCC_T81)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE); } - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_12BIT)) + if ((s->supported_compressions & T4_COMPRESSION_12BIT)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE); - //if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_NO_SUBSAMPLING)) + //if ((s->supported_compressions & T4_COMPRESSION_NO_SUBSAMPLING)) // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING); /* No custom illuminant */ @@ -1308,55 +1308,55 @@ int t30_build_dis_or_dtc(t30_state_t *s) if ((s->supported_t30_features & T30_SUPPORT_INTERNET_ROUTING_ADDRESS)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_ROUTING_ADDRESS); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_1200_1200)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_1200_1200)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_1200_1200_CAPABLE); - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_1200_1200)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_1200_1200)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_1200_1200_CAPABLE); } - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_1200)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_1200)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_600)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_600)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE); - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_600_600)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_600_600)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_600_600_CAPABLE); } - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_800)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_800)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_800_CAPABLE); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R16_SUPERFINE)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R16_SUPERFINE)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_400)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_400)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE); - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_400_400)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_400_400)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE); } - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_600)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_600)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_300)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_300)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE); - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_300_300)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_300_300)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE); } - if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_200_400 | T4_SUPPORT_RESOLUTION_R8_SUPERFINE))) + if ((s->supported_bilevel_resolutions & (T4_RESOLUTION_200_400 | T4_RESOLUTION_R8_SUPERFINE))) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_FINE)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R8_FINE)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE); - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_200)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_200_200)) { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE); - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_200_200)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_200_200)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE); } /* Standard FAX resolution bi-level image support goes without saying */ - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_100_100)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_100_100)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_100_100_CAPABLE); - if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_R8_STANDARD | T4_SUPPORT_RESOLUTION_R8_FINE | T4_SUPPORT_RESOLUTION_R8_SUPERFINE | T4_SUPPORT_RESOLUTION_R16_SUPERFINE))) + if ((s->supported_bilevel_resolutions & (T4_RESOLUTION_R8_STANDARD | T4_RESOLUTION_R8_FINE | T4_RESOLUTION_R8_SUPERFINE | T4_RESOLUTION_R16_SUPERFINE))) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED); - if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_200_100 | T4_SUPPORT_RESOLUTION_200_200 | T4_SUPPORT_RESOLUTION_200_400 | T4_SUPPORT_RESOLUTION_300_300 | T4_SUPPORT_RESOLUTION_300_600 | T4_SUPPORT_RESOLUTION_400_400 | T4_SUPPORT_RESOLUTION_400_800 | T4_SUPPORT_RESOLUTION_600_600 | T4_SUPPORT_RESOLUTION_600_1200 | T4_SUPPORT_RESOLUTION_1200_1200))) + if ((s->supported_bilevel_resolutions & (T4_RESOLUTION_200_100 | T4_RESOLUTION_200_200 | T4_RESOLUTION_200_400 | T4_RESOLUTION_300_300 | T4_RESOLUTION_300_600 | T4_RESOLUTION_400_400 | T4_RESOLUTION_400_800 | T4_RESOLUTION_600_600 | T4_RESOLUTION_600_1200 | T4_RESOLUTION_1200_1200))) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED); /* No double sided printing (alternate mode) */ @@ -1831,40 +1831,40 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) if (!s->error_correcting_mode) { /* Remove any compression schemes which need error correction to work. */ - s->mutual_compressions &= (0xF0000000 | T4_SUPPORT_COMPRESSION_NONE | T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D); + s->mutual_compressions &= (0xF0000000 | T4_COMPRESSION_NONE | T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D); if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T4_2D; + s->mutual_compressions &= ~T4_COMPRESSION_T4_2D; } else { /* Check the bi-level capabilities */ if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T4_2D; + s->mutual_compressions &= ~T4_COMPRESSION_T4_2D; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T6; + s->mutual_compressions &= ~T4_COMPRESSION_T6; /* T.85 L0 capable without T.85 capable is an invalid combination, so let just zap both capabilities if the far end is not T.85 capable. */ if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE)) - s->mutual_compressions &= ~(T4_SUPPORT_COMPRESSION_T85 | T4_SUPPORT_COMPRESSION_T85_L0); + s->mutual_compressions &= ~(T4_COMPRESSION_T85 | T4_COMPRESSION_T85_L0); if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T85_L0; + s->mutual_compressions &= ~T4_COMPRESSION_T85_L0; /* Check for full colour or only gray-scale from the multi-level codecs */ if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_COLOUR; + s->mutual_compressions &= ~T4_COMPRESSION_COLOUR; /* Check the colour capabilities */ if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T42_T81; + s->mutual_compressions &= ~T4_COMPRESSION_T42_T81; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_SYCC_T81; + s->mutual_compressions &= ~T4_COMPRESSION_SYCC_T81; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T43; + s->mutual_compressions &= ~T4_COMPRESSION_T43; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T45; + s->mutual_compressions &= ~T4_COMPRESSION_T45; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE)) - s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_12BIT; + s->mutual_compressions &= ~T4_COMPRESSION_12BIT; //if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING)) // ???? = T4_COMPRESSION_T42_T81_SUBSAMPLING; @@ -1876,75 +1876,75 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) s->mutual_colour_resolutions = s->supported_colour_resolutions; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_1200_1200_CAPABLE)) { - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_1200_1200; - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_1200_1200; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_1200_1200; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_1200_1200; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_1200_1200_CAPABLE)) - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_1200_1200; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_1200_1200; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_600_1200; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_600_1200; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE)) { - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_600_600; - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_600_600; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_600_600; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_600_600; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_600_600_CAPABLE)) - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_600_600; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_600_600; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_400_800_CAPABLE)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_400_800; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_400_800; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE)) { - s->mutual_bilevel_resolutions &= ~(T4_SUPPORT_RESOLUTION_400_400 | T4_SUPPORT_RESOLUTION_R16_SUPERFINE); - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_400_400; + s->mutual_bilevel_resolutions &= ~(T4_RESOLUTION_400_400 | T4_RESOLUTION_R16_SUPERFINE); + s->mutual_colour_resolutions &= ~T4_RESOLUTION_400_400; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE)) - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_400_400; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_400_400; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_300_600; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_300_600; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE)) { - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_300_300; - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_300_300; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_300_300; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_300_300; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE)) - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_300_300; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_300_300; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE)) { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_200_400; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_400; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_R8_SUPERFINE; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_R8_SUPERFINE; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE)) { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_200_200; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_200; if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_R8_FINE; - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_200_200; + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_R8_FINE; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_200_200; } else { if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_200_200; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_200_200; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) - s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_200_100; - /* Never suppress T4_SUPPORT_RESOLUTION_R8_STANDARD */ + s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_100; + /* Never suppress T4_RESOLUTION_R8_STANDARD */ if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_100_100_CAPABLE)) - s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_100_100; + s->mutual_colour_resolutions &= ~T4_RESOLUTION_100_100; s->mutual_image_sizes = s->supported_image_sizes; /* 215mm wide is always supported */ @@ -2070,7 +2070,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) /* Note 35 of Table 2/T.30 */ if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_FULL_COLOUR_MODE)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_COMPRESSION_COLOUR)) + if ((s->supported_colour_resolutions & T4_COMPRESSION_COLOUR)) { /* We are going to work in full colour mode */ } @@ -2078,7 +2078,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_12BIT_COMPONENT)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_COMPRESSION_12BIT)) + if ((s->supported_colour_resolutions & T4_COMPRESSION_12BIT)) { /* We are going to work in 12 bit mode */ } @@ -2086,17 +2086,17 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_NO_SUBSAMPLING)) { - //???? = T4_SUPPORT_COMPRESSION_T42_T81_SUBSAMPLING; + //???? = T4_COMPRESSION_T42_T81_SUBSAMPLING; } if (!test_ctrl_bit(dcs_frame, T30_DCS_BIT_PREFERRED_HUFFMAN_TABLES)) { - //???? = T4_SUPPORT_COMPRESSION_T42_T81_HUFFMAN; + //???? = T4_COMPRESSION_T42_T81_HUFFMAN; } if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_1200_1200)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_1200_1200)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_1200_1200)) { s->x_resolution = T4_X_RESOLUTION_1200; s->y_resolution = T4_Y_RESOLUTION_1200; @@ -2106,7 +2106,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_600_600)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_600_600)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_600_600)) { s->x_resolution = T4_X_RESOLUTION_600; s->y_resolution = T4_Y_RESOLUTION_600; @@ -2116,7 +2116,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_400)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_400_400)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_400_400)) { s->x_resolution = T4_X_RESOLUTION_400; s->y_resolution = T4_Y_RESOLUTION_400; @@ -2126,7 +2126,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_300_300)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_300_300)) { s->x_resolution = T4_X_RESOLUTION_300; s->y_resolution = T4_Y_RESOLUTION_300; @@ -2136,7 +2136,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_200_200)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_200_200)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_200_200)) { s->x_resolution = T4_X_RESOLUTION_200; s->y_resolution = T4_Y_RESOLUTION_200; @@ -2146,7 +2146,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_100_100)) { - if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_100_100)) + if ((s->supported_colour_resolutions & T4_RESOLUTION_100_100)) { s->x_resolution = T4_X_RESOLUTION_100; s->y_resolution = T4_Y_RESOLUTION_100; @@ -2158,22 +2158,22 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) /* Check which compression the far end has decided to use. */ if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T81_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T42_T81)) + if ((s->supported_compressions & T4_COMPRESSION_T42_T81)) s->line_compression = T4_COMPRESSION_T42_T81; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T43_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T43)) + if ((s->supported_compressions & T4_COMPRESSION_T43)) s->line_compression = T4_COMPRESSION_T43; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T45_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T45)) + if ((s->supported_compressions & T4_COMPRESSION_T45)) s->line_compression = T4_COMPRESSION_T45; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_SYCC_T81_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_SYCC_T81)) + if ((s->supported_compressions & T4_COMPRESSION_SYCC_T81)) s->line_compression = T4_COMPRESSION_SYCC_T81; } } @@ -2182,7 +2182,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) /* Bi-level image */ if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_1200_1200)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_1200_1200)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_1200_1200)) { s->x_resolution = T4_X_RESOLUTION_1200; s->y_resolution = T4_Y_RESOLUTION_1200; @@ -2192,7 +2192,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_1200)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_1200)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_1200)) { s->x_resolution = T4_X_RESOLUTION_600; s->y_resolution = T4_Y_RESOLUTION_1200; @@ -2202,7 +2202,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_600)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_600)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_600)) { s->x_resolution = T4_X_RESOLUTION_600; s->y_resolution = T4_Y_RESOLUTION_600; @@ -2212,7 +2212,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_800)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_800)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_800)) { s->x_resolution = T4_X_RESOLUTION_400; s->y_resolution = T4_Y_RESOLUTION_800; @@ -2224,7 +2224,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) { if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_INCH_RESOLUTION)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_400)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_400)) { s->x_resolution = T4_X_RESOLUTION_400; s->y_resolution = T4_Y_RESOLUTION_400; @@ -2234,7 +2234,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R16_SUPERFINE)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R16_SUPERFINE)) { s->x_resolution = T4_X_RESOLUTION_R16; s->y_resolution = T4_Y_RESOLUTION_SUPERFINE; @@ -2245,7 +2245,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_600)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_600)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_600)) { s->x_resolution = T4_X_RESOLUTION_300; s->y_resolution = T4_Y_RESOLUTION_600; @@ -2255,7 +2255,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_300)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_300)) { s->x_resolution = T4_X_RESOLUTION_300; s->y_resolution = T4_Y_RESOLUTION_300; @@ -2267,7 +2267,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) { if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_INCH_RESOLUTION)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_400)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_200_400)) { s->x_resolution = T4_X_RESOLUTION_200; s->y_resolution = T4_Y_RESOLUTION_400; @@ -2277,7 +2277,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_SUPERFINE)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R8_SUPERFINE)) { s->x_resolution = T4_X_RESOLUTION_R8; s->y_resolution = T4_Y_RESOLUTION_SUPERFINE; @@ -2290,7 +2290,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) { if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_INCH_RESOLUTION)) { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_200)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_200_200)) { s->x_resolution = T4_X_RESOLUTION_200; s->y_resolution = T4_Y_RESOLUTION_200; @@ -2300,7 +2300,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } else { - if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_FINE)) + if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R8_FINE)) { s->x_resolution = T4_X_RESOLUTION_R8; s->y_resolution = T4_Y_RESOLUTION_FINE; @@ -2334,32 +2334,32 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) || test_ctrl_bit(dcs_frame, T30_DCS_BIT_T88_MODE_3)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T88)) + if ((s->supported_compressions & T4_COMPRESSION_T88)) s->line_compression = T4_COMPRESSION_T88; } if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_L0_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T85_L0)) + if ((s->supported_compressions & T4_COMPRESSION_T85_L0)) s->line_compression = T4_COMPRESSION_T85_L0; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T85)) + if ((s->supported_compressions & T4_COMPRESSION_T85)) s->line_compression = T4_COMPRESSION_T85; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T6_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T6)) + if ((s->supported_compressions & T4_COMPRESSION_T6)) s->line_compression = T4_COMPRESSION_T6; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_2D_MODE)) { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T4_2D)) + if ((s->supported_compressions & T4_COMPRESSION_T4_2D)) s->line_compression = T4_COMPRESSION_T4_2D; } else { - if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T4_1D)) + if ((s->supported_compressions & T4_COMPRESSION_T4_1D)) s->line_compression = T4_COMPRESSION_T4_1D; } } @@ -2796,13 +2796,13 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) } /* Choose a compression scheme from amongst those mutually available */ - if ((s->mutual_compressions & T4_SUPPORT_COMPRESSION_T85_L0)) + if ((s->mutual_compressions & T4_COMPRESSION_T85_L0)) s->line_compression = T4_COMPRESSION_T85_L0; - else if ((s->mutual_compressions & T4_SUPPORT_COMPRESSION_T85)) + else if ((s->mutual_compressions & T4_COMPRESSION_T85)) s->line_compression = T4_COMPRESSION_T85; - else if ((s->mutual_compressions & T4_SUPPORT_COMPRESSION_T6)) + else if ((s->mutual_compressions & T4_COMPRESSION_T6)) s->line_compression = T4_COMPRESSION_T6; - else if ((s->mutual_compressions & T4_SUPPORT_COMPRESSION_T4_2D)) + else if ((s->mutual_compressions & T4_COMPRESSION_T4_2D)) s->line_compression = T4_COMPRESSION_T4_2D; else s->line_compression = T4_COMPRESSION_T4_1D; @@ -6809,13 +6809,13 @@ SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s, /* Default to the basic modems. */ s->supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; - s->supported_compressions = T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D; - s->supported_bilevel_resolutions = T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_R8_SUPERFINE - | T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_200_400; + s->supported_compressions = T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D; + s->supported_bilevel_resolutions = T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400; s->supported_image_sizes = T4_SUPPORT_WIDTH_215MM | T4_SUPPORT_LENGTH_US_LETTER | T4_SUPPORT_LENGTH_US_LEGAL diff --git a/libs/spandsp/src/t30_api.c b/libs/spandsp/src/t30_api.c index af90452d91..7ab68677c3 100644 --- a/libs/spandsp/src/t30_api.c +++ b/libs/spandsp/src/t30_api.c @@ -685,29 +685,32 @@ SPAN_DECLARE(int) t30_set_supported_modems(t30_state_t *s, int supported_modems) SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_compressions) { /* Mask out the ones we actually support today. */ - supported_compressions &= T4_SUPPORT_COMPRESSION_T4_1D - | T4_SUPPORT_COMPRESSION_T4_2D - | T4_SUPPORT_COMPRESSION_T6 - | T4_SUPPORT_COMPRESSION_T85 - | T4_SUPPORT_COMPRESSION_T85_L0 + supported_compressions &= T4_COMPRESSION_T4_1D + | T4_COMPRESSION_T4_2D + | T4_COMPRESSION_T6 + | T4_COMPRESSION_T85 + | T4_COMPRESSION_T85_L0 #if defined(SPANDSP_SUPPORT_T88) - | T4_SUPPORT_COMPRESSION_T88 + | T4_COMPRESSION_T88 +#endif + //| T4_COMPRESSION_T42_T81 +#if defined(SPANDSP_SUPPORT_SYCC_T81) + | T4_COMPRESSION_SYCC_T81 #endif - //| T4_SUPPORT_COMPRESSION_T81 #if defined(SPANDSP_SUPPORT_T43) - | T4_SUPPORT_COMPRESSION_T43 + | T4_COMPRESSION_T43 #endif #if defined(SPANDSP_SUPPORT_T45) - | T4_SUPPORT_COMPRESSION_T45 + | T4_COMPRESSION_T45 #endif #if 0 - | T4_SUPPORT_COMPRESSION_GRAYSCALE - | T4_SUPPORT_COMPRESSION_COLOUR - | T4_SUPPORT_COMPRESSION_12BIT - | T4_SUPPORT_COMPRESSION_COLOUR_TO_GRAY - | T4_SUPPORT_COMPRESSION_GRAY_TO_BILEVEL - | T4_SUPPORT_COMPRESSION_COLOUR_TO_BILEVEL - | T4_SUPPORT_COMPRESSION_RESCALING + | T4_COMPRESSION_GRAYSCALE + | T4_COMPRESSION_COLOUR + | T4_COMPRESSION_12BIT + | T4_COMPRESSION_COLOUR_TO_GRAY + | T4_COMPRESSION_GRAY_TO_BILEVEL + | T4_COMPRESSION_COLOUR_TO_BILEVEL + | T4_COMPRESSION_RESCALING #endif | 0; s->supported_compressions = supported_compressions; @@ -718,23 +721,23 @@ SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_c SPAN_DECLARE(int) t30_set_supported_bilevel_resolutions(t30_state_t *s, int supported_resolutions) { - supported_resolutions &= T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_R8_SUPERFINE - | T4_SUPPORT_RESOLUTION_R16_SUPERFINE - | T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_200_400 - | T4_SUPPORT_RESOLUTION_300_300 - | T4_SUPPORT_RESOLUTION_300_600 - | T4_SUPPORT_RESOLUTION_400_400 - | T4_SUPPORT_RESOLUTION_400_800 - | T4_SUPPORT_RESOLUTION_600_600 - | T4_SUPPORT_RESOLUTION_600_1200 - | T4_SUPPORT_RESOLUTION_1200_1200; + supported_resolutions &= T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_R16_SUPERFINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_300_600 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_400_800 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_600_1200 + | T4_RESOLUTION_1200_1200; /* Make sure anything needed for colour is enabled as a bi-level image, as that is a rule from T.30. 100x100 is an exception, as it doesn't exist as a bi-level resolution. */ - supported_resolutions |= (s->supported_colour_resolutions & ~T4_SUPPORT_RESOLUTION_100_100); + supported_resolutions |= (s->supported_colour_resolutions & ~T4_RESOLUTION_100_100); s->supported_bilevel_resolutions = supported_resolutions; t30_build_dis_or_dtc(s); return 0; @@ -743,16 +746,16 @@ SPAN_DECLARE(int) t30_set_supported_bilevel_resolutions(t30_state_t *s, int supp SPAN_DECLARE(int) t30_set_supported_colour_resolutions(t30_state_t *s, int supported_resolutions) { - supported_resolutions &= T4_SUPPORT_RESOLUTION_100_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_300_300 - | T4_SUPPORT_RESOLUTION_400_400 - | T4_SUPPORT_RESOLUTION_600_600 - | T4_SUPPORT_RESOLUTION_1200_1200; + supported_resolutions &= T4_RESOLUTION_100_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_1200_1200; s->supported_colour_resolutions = supported_resolutions; /* Make sure anything needed for colour is enabled as a bi-level image, as that is a rule from T.30. 100x100 is an exception, as it doesn't exist as a bi-level resolution. */ - s->supported_bilevel_resolutions |= (s->supported_colour_resolutions & ~T4_SUPPORT_RESOLUTION_100_100); + s->supported_bilevel_resolutions |= (s->supported_colour_resolutions & ~T4_RESOLUTION_100_100); t30_build_dis_or_dtc(s); return 0; } diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index 14910dfd98..616452a406 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -740,20 +740,20 @@ static void select_tiff_compression(t4_rx_state_t *s, int output_image_type) { /* Only provide for one form of coding throughout the file, even though the coding on the wire could change between pages. */ - if ((s->supported_tiff_compressions & T4_SUPPORT_COMPRESSION_T85)) + if ((s->supported_tiff_compressions & T4_COMPRESSION_T85)) s->tiff.compression = T4_COMPRESSION_T85; - else if ((s->supported_tiff_compressions & T4_SUPPORT_COMPRESSION_T6)) + else if ((s->supported_tiff_compressions & T4_COMPRESSION_T6)) s->tiff.compression = T4_COMPRESSION_T6; - else if ((s->supported_tiff_compressions & T4_SUPPORT_COMPRESSION_T4_2D)) + else if ((s->supported_tiff_compressions & T4_COMPRESSION_T4_2D)) s->tiff.compression = T4_COMPRESSION_T4_2D; - else if ((s->supported_tiff_compressions & T4_SUPPORT_COMPRESSION_T4_1D)) + else if ((s->supported_tiff_compressions & T4_COMPRESSION_T4_1D)) s->tiff.compression = T4_COMPRESSION_T4_1D; } else { - if ((s->supported_tiff_compressions & T4_SUPPORT_COMPRESSION_T42_T81)) + if ((s->supported_tiff_compressions & T4_COMPRESSION_T42_T81)) s->tiff.compression = T4_COMPRESSION_T42_T81; - else if ((s->supported_tiff_compressions & T4_SUPPORT_COMPRESSION_T43)) + else if ((s->supported_tiff_compressions & T4_COMPRESSION_T43)) s->tiff.compression = T4_COMPRESSION_T43; } } diff --git a/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c b/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c index c862a2ba80..be425bb765 100644 --- a/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c +++ b/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c @@ -63,7 +63,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 1002, COMPRESSION_CCITT_T4, 0 }, @@ -72,7 +72,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 1002, COMPRESSION_CCITT_T4, 1 }, @@ -81,7 +81,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 237, COMPRESSION_CCITT_T4, 2 }, @@ -90,7 +90,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 237, COMPRESSION_CCITT_T4, 3 }, @@ -99,7 +99,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 400, COMPRESSION_CCITT_T4, 4 }, @@ -108,7 +108,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 1079, COMPRESSION_CCITT_T4, 5 }, @@ -117,7 +117,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 1728, COMPRESSION_CCITT_T4, 6 }, @@ -153,7 +153,7 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100, + 1079, COMPRESSION_CCITT_T4, 5 }, @@ -178,12 +178,6 @@ struct int photo_metric = PHOTOMETRIC_MINISWHITE; int fill_order = FILLORDER_LSB2MSB; -static void clear_row(uint8_t buf[], int width) -{ - memset(buf, 0, width/8 + 1); -} -/*- End of function --------------------------------------------------------*/ - static void set_pixel(uint8_t buf[], int row, int pixel) { row--; @@ -191,13 +185,6 @@ static void set_pixel(uint8_t buf[], int row, int pixel) } /*- End of function --------------------------------------------------------*/ -static void clear_pixel(uint8_t buf[], int row, int pixel) -{ - row--; - buf[row*1728/8 + pixel/8] &= ~(0x80 >> (pixel & 0x07)); -} -/*- End of function --------------------------------------------------------*/ - static void set_pixel_range(uint8_t buf[], int row, int start, int end) { int i; @@ -207,6 +194,13 @@ static void set_pixel_range(uint8_t buf[], int row, int start, int end) } /*- End of function --------------------------------------------------------*/ +static void clear_pixel(uint8_t buf[], int row, int pixel) +{ + row--; + buf[row*1728/8 + pixel/8] &= ~(0x80 >> (pixel & 0x07)); +} +/*- End of function --------------------------------------------------------*/ + static void clear_pixel_range(uint8_t buf[], int row, int start, int end) { int i; @@ -216,6 +210,12 @@ static void clear_pixel_range(uint8_t buf[], int row, int start, int end) } /*- End of function --------------------------------------------------------*/ +static void clear_row(uint8_t buf[], int width) +{ + memset(buf, 0, width/8 + 1); +} +/*- End of function --------------------------------------------------------*/ + static int create_white_page(TIFF *tiff_file) { uint8_t image_buffer[8192]; @@ -593,7 +593,6 @@ int main(int argc, char *argv[]) TIFFSetField(tiff_file, TIFFTAG_BITSPERSAMPLE, 1); TIFFSetField(tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); TIFFSetField(tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1); - TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, -1L); TIFFSetField(tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, photo_metric); TIFFSetField(tiff_file, TIFFTAG_FILLORDER, fill_order); @@ -625,6 +624,7 @@ int main(int argc, char *argv[]) image_length = sequence[i].length; TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1); TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN); + TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, 128); TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, image_length); TIFFCheckpointDirectory(tiff_file); @@ -665,7 +665,11 @@ int main(int argc, char *argv[]) break; } /* ....then the directory entry, and libtiff is happy. */ - TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, image_length); + if (image_length != sequence[i].length) + { + printf("Length mismatch - %d: %d vs %d\n", i, image_length, sequence[i].length); + exit(2); + } TIFFWriteDirectory(tiff_file); } diff --git a/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c b/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c index 550d4e1e21..857ccbee72 100644 --- a/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c +++ b/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c @@ -63,7 +63,6 @@ int main(int argc, char *argv[]) { int image_width; int row; - int resunit; int output_compression; int output_t4_options; uint8_t image_buffer[1024]; @@ -99,7 +98,6 @@ int main(int argc, char *argv[]) TIFFSetField(tiff_file, TIFFTAG_BITSPERSAMPLE, 1); TIFFSetField(tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); TIFFSetField(tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1); - TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, -1L); TIFFSetField(tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE); TIFFSetField(tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB); @@ -108,16 +106,15 @@ int main(int argc, char *argv[]) y_resolution = y_res/100.0f; TIFFSetField(tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*2.54f + 0.5f)); TIFFSetField(tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*2.54f + 0.5f)); - resunit = RESUNIT_INCH; - TIFFSetField(tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit); + TIFFSetField(tiff_file, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); - TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "spandsp"); if (gethostname(buf, sizeof(buf)) == 0) TIFFSetField(tiff_file, TIFFTAG_HOSTCOMPUTER, buf); + TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "Spandsp"); TIFFSetField(tiff_file, TIFFTAG_IMAGEDESCRIPTION, "Checkerboard or dithered ones"); TIFFSetField(tiff_file, TIFFTAG_MAKE, "soft-switch.org"); - TIFFSetField(tiff_file, TIFFTAG_MODEL, "test data"); + TIFFSetField(tiff_file, TIFFTAG_MODEL, "testy"); time(&now); tm = localtime(&now); @@ -131,6 +128,7 @@ int main(int argc, char *argv[]) tm->tm_sec); TIFFSetField(tiff_file, TIFFTAG_DATETIME, buf); + TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, image_length); TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, image_length); TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1); TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN); diff --git a/libs/spandsp/test-data/itu/fax/generate_sized_pages.c b/libs/spandsp/test-data/itu/fax/generate_sized_pages.c index 66932c6e82..dcede55457 100644 --- a/libs/spandsp/test-data/itu/fax/generate_sized_pages.c +++ b/libs/spandsp/test-data/itu/fax/generate_sized_pages.c @@ -2,7 +2,7 @@ * SpanDSP - a series of DSP components for telephony * * generate_sized_pages.c - Create a series of TIFF files in the various page sizes - * and resolutions. + * and resolutions. * * Written by Steve Underwood * @@ -55,6 +55,7 @@ struct int y_res; int width; int length; + int squashing_factor; } sequence[] = { { @@ -62,304 +63,531 @@ struct T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A4, - 1100 + 1100, + 1 }, { "bilevel_R8_385_B4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_B4, - 1200 + 1200, + 1 }, { "bilevel_R8_385_A3.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_STANDARD, T4_WIDTH_R8_A3, - 1556 + 1556, + 1 }, { "bilevel_R8_77_A4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_FINE, T4_WIDTH_R8_A4, - 1100*2 + 1100*2, + 1 }, { "bilevel_R8_77_B4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_FINE, T4_WIDTH_R8_B4, - 1200*2 + 1200*2, + 1 }, { "bilevel_R8_77_A3.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_FINE, T4_WIDTH_R8_A3, - 1556*2 + 1556*2, + 1 }, { "bilevel_R8_154_A4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R8_A4, - 1100*4 + 1100*4, + 1 }, { "bilevel_R8_154_B4.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R8_B4, - 1200*4 + 1200*4, + 1 }, { "bilevel_R8_154_A3.tif", T4_X_RESOLUTION_R8, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R8_A3, - 1556*4 + 1556*4, + 1 }, { "bilevel_R16_154_A4.tif", T4_X_RESOLUTION_R16, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R16_A4, - 1100*4 + 1100*4, + 1 }, { "bilevel_R16_154_B4.tif", T4_X_RESOLUTION_R16, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R16_B4, - 1200*4 + 1200*4, + 1 }, { "bilevel_R16_154_A3.tif", T4_X_RESOLUTION_R16, T4_Y_RESOLUTION_SUPERFINE, T4_WIDTH_R16_A3, - 1556*4 + 1556*4, + 1 }, { "bilevel_200_100_A4.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_100, T4_WIDTH_200_A4, - 1100 + 1100, + 1 }, { "bilevel_200_100_B4.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_100, T4_WIDTH_200_B4, - 1200 + 1200, + 1 }, { "bilevel_200_100_A3.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_100, T4_WIDTH_200_A3, - 1556 + 1556, + 1 }, { "bilevel_200_200_A4.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_200, T4_WIDTH_200_A4, - 1100*2 + 1100*2, + 1 }, { "bilevel_200_200_B4.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_200, T4_WIDTH_200_B4, - 1200*2 + 1200*2, + 1 }, { "bilevel_200_200_A3.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_200, T4_WIDTH_200_A3, - 1556*2 + 1556*2, + 1 }, { "bilevel_200_400_A4.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_400, T4_WIDTH_200_A4, - 1100*4 + 1100*4, + 1 }, { "bilevel_200_400_B4.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_400, T4_WIDTH_200_B4, - 1200*4 + 1200*4, + 1 }, { "bilevel_200_400_A3.tif", T4_X_RESOLUTION_200, T4_Y_RESOLUTION_400, T4_WIDTH_200_A3, - 1556*4 + 1556*4, + 1 }, { "bilevel_300_300_A4.tif", T4_X_RESOLUTION_300, T4_Y_RESOLUTION_300, T4_WIDTH_300_A4, - 1100*3 + 1100*3, + 1 }, { "bilevel_300_300_B4.tif", T4_X_RESOLUTION_300, T4_Y_RESOLUTION_300, T4_WIDTH_300_B4, - 1200*3 + 1200*3, + 1 }, { "bilevel_300_300_A3.tif", T4_X_RESOLUTION_300, T4_Y_RESOLUTION_300, T4_WIDTH_300_A3, - 1556*3 + 1556*3, + 1 }, { "bilevel_300_600_A4.tif", T4_X_RESOLUTION_300, T4_Y_RESOLUTION_600, T4_WIDTH_300_A4, - 1100*6 + 1100*6, + 1 }, { "bilevel_300_600_B4.tif", T4_X_RESOLUTION_300, T4_Y_RESOLUTION_600, T4_WIDTH_300_B4, - 1200*6 + 1200*6, + 1 }, { "bilevel_300_600_A3.tif", T4_X_RESOLUTION_300, T4_Y_RESOLUTION_600, T4_WIDTH_300_A3, - 1556*6 + 1556*6, + 1 }, { "bilevel_400_400_A4.tif", T4_X_RESOLUTION_400, T4_Y_RESOLUTION_400, T4_WIDTH_400_A4, - 1100*4 + 1100*4, + 1 }, { "bilevel_400_400_B4.tif", T4_X_RESOLUTION_400, T4_Y_RESOLUTION_400, T4_WIDTH_400_B4, - 1200*4 + 1200*4, + 1 }, { "bilevel_400_400_A3.tif", T4_X_RESOLUTION_400, T4_Y_RESOLUTION_400, T4_WIDTH_400_A3, - 1556*4 + 1556*4, + 1 }, { "bilevel_400_800_A4.tif", T4_X_RESOLUTION_400, T4_Y_RESOLUTION_800, T4_WIDTH_400_A4, - 1100*8 + 1100*8, + 1 }, { "bilevel_400_800_B4.tif", T4_X_RESOLUTION_400, T4_Y_RESOLUTION_800, T4_WIDTH_400_B4, - 1200*8 + 1200*8, + 1 }, { "bilevel_400_800_A3.tif", T4_X_RESOLUTION_400, T4_Y_RESOLUTION_800, T4_WIDTH_400_A3, - 1556*8 + 1556*8, + 1 }, { "bilevel_600_600_A4.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_600, T4_WIDTH_600_A4, - 1100*6 + 1100*6, + 1 }, { "bilevel_600_600_B4.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_600, T4_WIDTH_600_B4, - 1200*6 + 1200*6, + 1 }, { "bilevel_600_600_A3.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_600, T4_WIDTH_600_A3, - 1556*6 + 1556*6, + 1 }, { "bilevel_600_1200_A4.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_1200, T4_WIDTH_600_A4, - 1100*12 + 1100*12, + 1 }, { "bilevel_600_1200_B4.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_1200, T4_WIDTH_600_B4, - 1200*12 + 1200*12, + 1 }, { "bilevel_600_1200_A3.tif", T4_X_RESOLUTION_600, T4_Y_RESOLUTION_1200, T4_WIDTH_600_A3, - 1556*12 + 1556*12, + 1 }, { "bilevel_1200_1200_A4.tif", T4_X_RESOLUTION_1200, T4_Y_RESOLUTION_1200, T4_WIDTH_1200_A4, - 1100*12 + 1100*12, + 1 }, { "bilevel_1200_1200_B4.tif", T4_X_RESOLUTION_1200, T4_Y_RESOLUTION_1200, T4_WIDTH_1200_B4, - 1200*12 + 1200*12, + 1 }, { "bilevel_1200_1200_A3.tif", T4_X_RESOLUTION_1200, T4_Y_RESOLUTION_1200, T4_WIDTH_1200_A3, - 1556*12 + 1556*12, + 1 + }, + { + "bilevel_R8_77SQ_A4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + 2 + }, + { + "bilevel_R8_77SQ_B4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_B4, + 1200, + 2 + }, + { + "bilevel_R8_77SQ_A3.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A3, + 1556, + 2 + }, + { + "bilevel_R8_154SQSQ_A4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + 4 + }, + { + "bilevel_R8_154SQSQ_B4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_B4, + 1200, + 4 + }, + { + "bilevel_R8_154SQSQ_A3.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A3, + 1556, + 4 + }, + { + "bilevel_R8_154SQ_A4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_FINE, + T4_WIDTH_R8_A4, + 1100*2, + 2 + }, + { + "bilevel_R8_154SQ_B4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_FINE, + T4_WIDTH_R8_B4, + 1200*2, + 2 + }, + { + "bilevel_R8_154SQ_A3.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_FINE, + T4_WIDTH_R8_A3, + 1556*2, + 2 + }, + { + "bilevel_200_200SQ_A4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_A4, + 1100, + 2 + }, + { + "bilevel_200_200SQ_B4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_B4, + 1200, + 2 + }, + { + "bilevel_200_200SQ_A3.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_A3, + 1556, + 2 + }, + { + "bilevel_200_400SQSQ_A4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_A4, + 1100, + 4 + }, + { + "bilevel_200_400SQSQ_B4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_B4, + 1200, + 4 + }, + { + "bilevel_200_400SQSQ_A3.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_100, + T4_WIDTH_200_A3, + 1556, + 4 + }, + { + "bilevel_200_400SQ_A4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_200, + T4_WIDTH_200_A4, + 1100*2, + 2 + }, + { + "bilevel_200_400SQ_B4.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_200, + T4_WIDTH_200_B4, + 1200*2, + 2 + }, + { + "bilevel_200_400SQ_A3.tif", + T4_X_RESOLUTION_200, + T4_Y_RESOLUTION_200, + T4_WIDTH_200_A3, + 1556*2, + 2 }, { NULL, 0, 0, 0, + 0, 0 }, }; +static void set_pixel(uint8_t buf[], int row, int pixel) +{ + row--; + buf[row*1728/8 + pixel/8] |= (0x80 >> (pixel & 0x07)); +} +/*- End of function --------------------------------------------------------*/ + +static void set_pixel_range(uint8_t buf[], int row, int start, int end) +{ + int i; + + for (i = start; i <= end; i++) + set_pixel(buf, row, i); +} +/*- End of function --------------------------------------------------------*/ + +#if 0 +static void clear_pixel(uint8_t buf[], int row, int pixel) +{ + row--; + buf[row*1728/8 + pixel/8] &= ~(0x80 >> (pixel & 0x07)); +} +/*- End of function --------------------------------------------------------*/ + +static void clear_pixel_range(uint8_t buf[], int row, int start, int end) +{ + int i; + + for (i = start; i <= end; i++) + clear_pixel(buf, row, i); +} +/*- End of function --------------------------------------------------------*/ +#endif + +static void clear_row(uint8_t buf[], int width) +{ + memset(buf, 0, width/8 + 1); +} +/*- End of function --------------------------------------------------------*/ + int main(int argc, char *argv[]) { int row; @@ -371,6 +599,8 @@ int main(int argc, char *argv[]) float x_resolution; float y_resolution; int i; + int j; + int k; int opt; int compression; int photo_metric; @@ -424,7 +654,6 @@ int main(int argc, char *argv[]) TIFFSetField(tiff_file, TIFFTAG_BITSPERSAMPLE, 1); TIFFSetField(tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); TIFFSetField(tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1); - TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, -1L); TIFFSetField(tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, photo_metric); TIFFSetField(tiff_file, TIFFTAG_FILLORDER, fill_order); @@ -435,13 +664,13 @@ int main(int argc, char *argv[]) TIFFSetField(tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*2.54f + 0.5f)); TIFFSetField(tiff_file, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); - TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "spandsp"); if (gethostname(buf, sizeof(buf)) == 0) TIFFSetField(tiff_file, TIFFTAG_HOSTCOMPUTER, buf); - TIFFSetField(tiff_file, TIFFTAG_IMAGEDESCRIPTION, "Blank test image"); + TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "Spandsp"); + TIFFSetField(tiff_file, TIFFTAG_IMAGEDESCRIPTION, "Diagonally striped test image"); TIFFSetField(tiff_file, TIFFTAG_MAKE, "soft-switch.org"); - TIFFSetField(tiff_file, TIFFTAG_MODEL, "test data"); + TIFFSetField(tiff_file, TIFFTAG_MODEL, "testy"); time(&now); tm = localtime(&now); @@ -455,6 +684,7 @@ int main(int argc, char *argv[]) tm->tm_sec); TIFFSetField(tiff_file, TIFFTAG_DATETIME, buf); + TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, sequence[i].length); TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, sequence[i].length); TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1); TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN); @@ -462,9 +692,18 @@ int main(int argc, char *argv[]) TIFFCheckpointDirectory(tiff_file); /* Write the image first.... */ + /* Produce a pattern of diagonal bands */ for (row = 0; row < sequence[i].length; row++) { - memset(image_buffer, 0, sequence[i].width/8 + 1); + clear_row(image_buffer, sequence[i].width); + for (j = 0; j < sequence[i].squashing_factor; j++) + { + k = row*sequence[i].squashing_factor + j; + if (((k/sequence[i].width) & 1) == 0) + set_pixel_range(image_buffer, 1, k%sequence[i].width, sequence[i].width - 1); + else + set_pixel_range(image_buffer, 1, 0, k%sequence[i].width); + } if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) { printf("Write error at row %d.\n", row); diff --git a/libs/spandsp/test-data/itu/fax/generate_striped_pages.c b/libs/spandsp/test-data/itu/fax/generate_striped_pages.c index 1232ca6896..8ad5098ca4 100644 --- a/libs/spandsp/test-data/itu/fax/generate_striped_pages.c +++ b/libs/spandsp/test-data/itu/fax/generate_striped_pages.c @@ -81,11 +81,14 @@ int main(int argc, char *argv[]) TIFFSetField(tiff_file, TIFFTAG_XRESOLUTION, 204.0f); TIFFSetField(tiff_file, TIFFTAG_YRESOLUTION, 196.0f); TIFFSetField(tiff_file, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); - TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "Spandsp"); - TIFFSetField(tiff_file, TIFFTAG_HOSTCOMPUTER, "host"); TIFFSetField(tiff_file, TIFFTAG_FAXSUBADDRESS, "1111"); + + if (gethostname(buf, sizeof(buf)) == 0) + TIFFSetField(tiff_file, TIFFTAG_HOSTCOMPUTER, buf); + + TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "Spandsp"); TIFFSetField(tiff_file, TIFFTAG_IMAGEDESCRIPTION, "Image in stripes"); - TIFFSetField(tiff_file, TIFFTAG_MAKE, "spandsp"); + TIFFSetField(tiff_file, TIFFTAG_MAKE, "soft-switch.org"); TIFFSetField(tiff_file, TIFFTAG_MODEL, "testy"); time(&now); diff --git a/libs/spandsp/tests/fax_tests.c b/libs/spandsp/tests/fax_tests.c index f89f86f98f..502da1bbbd 100644 --- a/libs/spandsp/tests/fax_tests.c +++ b/libs/spandsp/tests/fax_tests.c @@ -860,81 +860,95 @@ int main(int argc, char *argv[]) case 0: /* Allow anything */ t30_set_supported_bilevel_resolutions(t30_state[i], - T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_R8_SUPERFINE - | T4_SUPPORT_RESOLUTION_R16_SUPERFINE - | T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_200_400 - | T4_SUPPORT_RESOLUTION_300_300 - | T4_SUPPORT_RESOLUTION_300_600 - | T4_SUPPORT_RESOLUTION_400_400 - | T4_SUPPORT_RESOLUTION_400_800 - | T4_SUPPORT_RESOLUTION_600_600 - | T4_SUPPORT_RESOLUTION_600_1200 - | T4_SUPPORT_RESOLUTION_1200_1200); + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_R16_SUPERFINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_300_600 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_400_800 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_600_1200 + | T4_RESOLUTION_1200_1200); break; case 1: /* Allow anything metric */ t30_set_supported_bilevel_resolutions(t30_state[i], - T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_R8_SUPERFINE - | T4_SUPPORT_RESOLUTION_R16_SUPERFINE); + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_R16_SUPERFINE); break; case 2: /* Allow anything inch based */ t30_set_supported_bilevel_resolutions(t30_state[i], - T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_200_400 - | T4_SUPPORT_RESOLUTION_300_300 - | T4_SUPPORT_RESOLUTION_300_600 - | T4_SUPPORT_RESOLUTION_400_400 - | T4_SUPPORT_RESOLUTION_400_800 - | T4_SUPPORT_RESOLUTION_600_600 - | T4_SUPPORT_RESOLUTION_600_1200 - | T4_SUPPORT_RESOLUTION_1200_1200); + T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_300_600 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_400_800 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_600_1200 + | T4_RESOLUTION_1200_1200); break; case 3: /* Allow only restricted length resolution */ t30_set_supported_bilevel_resolutions(t30_state[i], - T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200); + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200); break; case 4: /* Allow only more restricted length resolution */ t30_set_supported_bilevel_resolutions(t30_state[i], - T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_200_100); + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_200_100); break; } if (colour_enabled) { t30_set_supported_colour_resolutions(t30_state[i], - T4_SUPPORT_RESOLUTION_100_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_300_300 - | T4_SUPPORT_RESOLUTION_400_400 - | T4_SUPPORT_RESOLUTION_600_600 - | T4_SUPPORT_RESOLUTION_1200_1200); + T4_RESOLUTION_100_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_1200_1200); } else { t30_set_supported_colour_resolutions(t30_state[i], 0); } - t30_set_supported_output_compressions(t30_state[i], T4_SUPPORT_COMPRESSION_T4_2D); + t30_set_supported_output_compressions(t30_state[i], T4_COMPRESSION_T4_2D); t30_set_ecm_capability(t30_state[i], use_ecm); t30_set_supported_compressions(t30_state[i], - T4_SUPPORT_COMPRESSION_T4_1D - | T4_SUPPORT_COMPRESSION_T4_2D - | T4_SUPPORT_COMPRESSION_T6 - //| T4_SUPPORT_COMPRESSION_t42_T81 - | T4_SUPPORT_COMPRESSION_T85 - | T4_SUPPORT_COMPRESSION_T85_L0); + T4_COMPRESSION_T4_1D + | T4_COMPRESSION_T4_2D + | T4_COMPRESSION_T6 + | T4_COMPRESSION_T85 + | T4_COMPRESSION_T85_L0 +#if 0 + //| T4_COMPRESSION_T88 + | T4_COMPRESSION_T43 + | T4_COMPRESSION_T45 + | T4_COMPRESSION_T42_T81 + | T4_COMPRESSION_SYCC_T81 + | T4_COMPRESSION_GRAYSCALE + | T4_COMPRESSION_COLOUR + | T4_COMPRESSION_12BIT + | T4_COMPRESSION_COLOUR_TO_GRAY + | T4_COMPRESSION_GRAY_TO_BILEVEL + | T4_COMPRESSION_COLOUR_TO_BILEVEL + | T4_COMPRESSION_RESCALING +#endif + | 0); t30_set_minimum_scan_line_time(t30_state[i], scan_line_time); if (mode[i] == T38_GATEWAY_FAX) diff --git a/libs/spandsp/tests/fax_tests.sh b/libs/spandsp/tests/fax_tests.sh index 1fa6d4e19a..b09609e3f3 100755 --- a/libs/spandsp/tests/fax_tests.sh +++ b/libs/spandsp/tests/fax_tests.sh @@ -39,6 +39,31 @@ run_fax_test() echo tested ${FILE} } +run_fax_squash_test() +{ + # Test with lengthwise squashing of a bilevel image + rm -f fax_tests.tif + echo ./fax_tests -b ${SQ} ${OPTS} -i ${IN_FILE} + ./fax_tests -b ${SQ} ${OPTS} -i ${IN_FILE} >xyzzy 2>xyzzy2 + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo fax_tests failed! + exit $RETVAL + fi + # Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t + # option means the normal differences in tags will be ignored. + tiffcmp -t ${OUT_FILE} fax_tests.tif >/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo fax_tests failed! + exit $RETVAL + fi + rm -f fax_tests.tif + echo tested ${FILE} +} + run_colour_fax_test() { rm -f fax_tests.tif @@ -96,20 +121,20 @@ do # run_colour_fax_test done -# Colour/gray -> colour/gray by allowing ECM +# Colour/gray -> colour/gray for OPTS in "-p AA -C -e" "-p TT -C -e" "-p GG -C -e" "-p TG -C -e" "-p GT -C -e" do echo Colour to colour tests disabled # IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" -# OUT_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" +# OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-out.tif" # run_colour_fax_test # IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif" -# OUT_FILE="${LOCALTESTS_DIR}/lenna-bw.tif" +# OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-out.tif" # run_colour_fax_test # IN_FILE="${TIFFFX_DIR}/c03x_02x.tif" -# OUT_FILE="${TIFFFX_DIR}/c03x_02x.tif" +# OUT_FILE="${TIFFFX_DIR}/c03x_02x-out.tif" # run_colour_fax_test # IN_FILE="${TIFFFX_DIR}/l02x_02x.tif" @@ -121,6 +146,105 @@ do # run_colour_fax_test done +# Bi-level tests with image squashing +for OPTS in "-p AA" "-p AA -e" "-p TT" "-p TT -e" "-p GG" "-p GG -e" "-p TG" "-p TG -e" "-p GT" "-p GT -e" +do + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_77_A4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_77SQ_A4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_77_B4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_77SQ_B4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_77_A3.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_77SQ_A3.tif" + SQ=4 + run_fax_squash_test + + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQ_A4.tif" + SQ=3 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_B4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQ_B4.tif" + SQ=3 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A3.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQ_A3.tif" + SQ=3 + run_fax_squash_test + + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQSQ_A4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_B4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQSQ_B4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A3.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQSQ_A3.tif" + SQ=4 + run_fax_squash_test + + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_200_A4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_200SQ_A4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_200_B4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_200SQ_B4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_200_A3.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_200SQ_A3.tif" + SQ=4 + run_fax_squash_test + + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQ_A4.tif" + SQ=3 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_B4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQ_B4.tif" + SQ=3 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A3.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQ_A3.tif" + SQ=3 + run_fax_squash_test + + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQSQ_A4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_B4.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQSQ_B4.tif" + SQ=4 + run_fax_squash_test + + IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A3.tif" + OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQSQ_A3.tif" + SQ=4 + run_fax_squash_test +done + # Bi-level tests for OPTS in "-p AA" "-p AA -e" "-p TT" "-p TT -e" "-p GG" "-p GG -e" "-p TG" "-p TG -e" "-p GT" "-p GT -e" do diff --git a/libs/spandsp/tests/t38_decode.c b/libs/spandsp/tests/t38_decode.c index 47716ca7bf..c65cb2027d 100644 --- a/libs/spandsp/tests/t38_decode.c +++ b/libs/spandsp/tests/t38_decode.c @@ -440,7 +440,7 @@ int main(int argc, char *argv[]) t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A'); t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A'); t30_set_ecm_capability(t30, use_ecm); - t30_set_supported_compressions(t30, T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D | T4_SUPPORT_COMPRESSION_T6 | T4_SUPPORT_COMPRESSION_T85); + t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D | T4_COMPRESSION_T6 | T4_COMPRESSION_T85); if (pcap_scan_pkts(input_file_name, src_addr, src_port, dest_addr, dest_port, t38_terminal_timing_update, process_packet, NULL)) exit(2); @@ -497,7 +497,7 @@ int main(int argc, char *argv[]) t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'B'); t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'B'); t30_set_ecm_capability(t30, use_ecm); - t30_set_supported_compressions(t30, T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D | T4_SUPPORT_COMPRESSION_T6); + t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D | T4_COMPRESSION_T6); logging = fax_get_logging_state(fax_state); span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); diff --git a/libs/spandsp/tests/tsb85_tests.c b/libs/spandsp/tests/tsb85_tests.c index 74f397d819..d8f626520c 100644 --- a/libs/spandsp/tests/tsb85_tests.c +++ b/libs/spandsp/tests/tsb85_tests.c @@ -393,23 +393,23 @@ static void fax_prepare(void) | T4_SUPPORT_LENGTH_US_LEGAL | T4_SUPPORT_LENGTH_UNLIMITED); t30_set_supported_bilevel_resolutions(t30, - T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_R8_SUPERFINE - | T4_SUPPORT_RESOLUTION_R16_SUPERFINE - | T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_200_400 - | T4_SUPPORT_RESOLUTION_300_300 - | T4_SUPPORT_RESOLUTION_300_600 - | T4_SUPPORT_RESOLUTION_400_400 - | T4_SUPPORT_RESOLUTION_400_800 - | T4_SUPPORT_RESOLUTION_600_600 - | T4_SUPPORT_RESOLUTION_600_1200 - | T4_SUPPORT_RESOLUTION_1200_1200); + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_R16_SUPERFINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_300_600 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_400_800 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_600_1200 + | T4_RESOLUTION_1200_1200); t30_set_supported_colour_resolutions(t30, 0); t30_set_supported_modems(t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17); - t30_set_supported_compressions(t30, T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D | T4_SUPPORT_COMPRESSION_T6); + t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D | T4_COMPRESSION_T6); t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'A'); t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A'); t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A'); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 0dceef6a37..02623fd20e 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -879,14 +879,14 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) T4_SUPPORT_LENGTH_US_LETTER | T4_SUPPORT_LENGTH_US_LEGAL | T4_SUPPORT_LENGTH_UNLIMITED | T4_SUPPORT_WIDTH_215MM | T4_SUPPORT_WIDTH_255MM | T4_SUPPORT_WIDTH_303MM); t30_set_supported_bilevel_resolutions(t30, - T4_SUPPORT_RESOLUTION_R8_STANDARD - | T4_SUPPORT_RESOLUTION_R8_FINE - | T4_SUPPORT_RESOLUTION_R8_SUPERFINE - | T4_SUPPORT_RESOLUTION_R16_SUPERFINE - | T4_SUPPORT_RESOLUTION_200_100 - | T4_SUPPORT_RESOLUTION_200_200 - | T4_SUPPORT_RESOLUTION_200_400 - | T4_SUPPORT_RESOLUTION_400_400); + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_R16_SUPERFINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400 + | T4_RESOLUTION_400_400); t30_set_supported_colour_resolutions(t30, 0); if (pvt->disable_v17) { @@ -898,11 +898,11 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) } if (pvt->use_ecm) { - t30_set_supported_compressions(t30, T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D | T4_SUPPORT_COMPRESSION_T6 | T4_SUPPORT_COMPRESSION_T85 | T4_SUPPORT_COMPRESSION_T85_L0); + t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D | T4_COMPRESSION_T6 | T4_COMPRESSION_T85 | T4_COMPRESSION_T85_L0); t30_set_ecm_capability(t30, TRUE); switch_channel_set_variable(channel, "fax_ecm_requested", "1"); } else { - t30_set_supported_compressions(t30, T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D); + t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D); switch_channel_set_variable(channel, "fax_ecm_requested", "0"); } From b8a5cac2d779e4ed07a60c9589fcc5ce896f32b5 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Wed, 24 Jul 2013 10:03:39 -0500 Subject: [PATCH 20/88] disable ldap things as this doesnt build right at this time --- freeswitch.spec | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/freeswitch.spec b/freeswitch.spec index c8276c023a..b15c28bc14 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -116,7 +116,7 @@ Source2: http://files.freeswitch.org/downloads/libs/flite-1.5.1-current.tar.bz2 Source3: http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz Source4: http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz Source5: http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz -Source6: http://files.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz +#Source6: http://files.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz Source7: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.7.tar.gz Source8: http://files.freeswitch.org/downloads/libs/soundtouch-1.6.0.tar.gz Source9: http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz @@ -137,7 +137,7 @@ Prefix: %{prefix} #BuildRequires: openldap2-devel BuildRequires: lzo-devel %else -BuildRequires: openldap-devel +#BuildRequires: openldap-devel %endif BuildRequires: autoconf BuildRequires: automake @@ -182,7 +182,7 @@ Requires: ncurses Requires: openssl Requires: unixODBC Requires: libjpeg -Requires: openldap +#Requires: openldap Requires: db4 Requires: gdbm Requires: zlib @@ -778,13 +778,13 @@ Theora Video Codec support for FreeSWITCH open source telephony platform. # FreeSWITCH Directory Modules ###################################################################################################################### -%package directory-ldap -Summary: LDAP Directory support for FreeSWITCH open source telephony platform -Group: System/Libraries -Requires: %{name} = %{version}-%{release} +#%package directory-ldap +#Summary: LDAP Directory support for FreeSWITCH open source telephony platform +#Group: System/Libraries +#Requires: %{name} = %{version}-%{release} -%description directory-ldap -LDAP Directory support for FreeSWITCH open source telephony platform. +#%description directory-ldap +#LDAP Directory support for FreeSWITCH open source telephony platform. ###################################################################################################################### # FreeSWITCH Endpoint Modules @@ -2084,9 +2084,9 @@ fi # ###################################################################################################################### -%files directory-ldap -%defattr(-,freeswitch,daemon) -%{MODINSTDIR}/mod_theora.so* +#%files directory-ldap +#%defattr(-,freeswitch,daemon) +#%{MODINSTDIR}/mod_theora.so* ###################################################################################################################### # From 12fab353f30e6ca71fdae4531110956eaea0aefb Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Wed, 24 Jul 2013 10:14:08 -0500 Subject: [PATCH 21/88] FS-5636 --resolve hold active lines when receiving a call --- src/mod/endpoints/mod_skinny/skinny_server.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index bc06b9bdb3..feac761cc3 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -700,6 +700,8 @@ switch_status_t skinny_session_answer(switch_core_session_t *session, listener_t switch_assert(listener); switch_assert(listener->profile); + skinny_hold_active_calls(listener); + channel = switch_core_session_get_channel(session); tech_pvt = switch_core_session_get_private(session); From 569dd9c5407c004d1d174f78818251eb6dfa674b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 24 Jul 2013 11:23:38 -0500 Subject: [PATCH 22/88] FS-5634 --resolve this patch should fix it but comment it out instead in the old version to get the same effect --- src/mod/endpoints/mod_sofia/sofia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 35c325fefa..83e4ae5444 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4272,7 +4272,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } else if (!strcasecmp(val, "contact") || switch_true(val)) { sofia_set_pflag(profile, PFLAG_MULTIREG); sofia_set_pflag(profile, PFLAG_MULTIREG_CONTACT); - } else if (switch_true(val)) { + } else if (!switch_true(val)) { sofia_clear_pflag(profile, PFLAG_MULTIREG); //sofia_clear_pflag(profile, PFLAG_MULTIREG_CONTACT); } From 2c4287ed540b1d4b74c0cf8859dfdbad3b60feca Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 24 Jul 2013 11:38:01 -0500 Subject: [PATCH 23/88] FS-5633 --resolve --- src/mod/applications/mod_fifo/mod_fifo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index a2acd21a26..05652d2c23 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -934,7 +934,7 @@ struct call_helper { switch_memory_pool_t *pool; }; -#define MAX_ROWS 25 +#define MAX_ROWS 250 struct callback_helper { int need; switch_memory_pool_t *pool; From ab670497ec4e1a0b0b0f3cbc79b99bbc30e4b2a6 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Wed, 24 Jul 2013 12:50:20 -0500 Subject: [PATCH 24/88] tweak to the spec file --- freeswitch.spec | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/freeswitch.spec b/freeswitch.spec index b15c28bc14..57446a168b 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -117,13 +117,13 @@ Source3: http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz Source4: http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz Source5: http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz #Source6: http://files.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz -Source7: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.7.tar.gz -Source8: http://files.freeswitch.org/downloads/libs/soundtouch-1.6.0.tar.gz -Source9: http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz -Source10: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz -Source11: http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz -Source12: http://files.freeswitch.org/downloads/libs/json-c-0.9.tar.gz -Source13: http://files.freeswitch.org/downloads/libs/opus-0.9.0.tar.gz +Source6: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.7.tar.gz +Source7: http://files.freeswitch.org/downloads/libs/soundtouch-1.6.0.tar.gz +Source8: http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz +Source9: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz +Source10: http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz +Source11: http://files.freeswitch.org/downloads/libs/json-c-0.9.tar.gz +Source12: http://files.freeswitch.org/downloads/libs/opus-0.9.0.tar.gz Prefix: %{prefix} From 88eb14a7be3b3ad65b0a8ce42a7780522f76ebdf Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Wed, 24 Jul 2013 13:38:59 -0500 Subject: [PATCH 25/88] another tweak to the spec file --- freeswitch.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/freeswitch.spec b/freeswitch.spec index 57446a168b..1454aa6779 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -1274,7 +1274,6 @@ cp %{SOURCE9} libs/ cp %{SOURCE10} libs/ cp %{SOURCE11} libs/ cp %{SOURCE12} libs/ -cp %{SOURCE13} libs/ ###################################################################################################################### # From 82f2ea07df0d8850b8368e275ca14b7e9304ad26 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 24 Jul 2013 19:33:48 +0000 Subject: [PATCH 26/88] Add docs/SubmittingPatches to document our process This document is intended to get new people started with how to create and submit source code patches to us. It attempts to demonstrate our workflow as well as some best practices. --- docs/SubmittingPatches | 102 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 docs/SubmittingPatches diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches new file mode 100644 index 0000000000..4be7eaefca --- /dev/null +++ b/docs/SubmittingPatches @@ -0,0 +1,102 @@ +How to Contribute Patches to FreeSWITCH +======================================= + +Download the Source Code +------------------------ + + git clone git://git.freeswitch.org/freeswitch.git + cd freeswitch + +Create Your Patch +----------------- + + # create a topic/feature branch in your local repository + git checkout -b myfeature + + # make your change + emacs . + + # commit the results locally; see below for how to write a good + # commit message + git commit -va + + # create more commits as needed such that each commit represents a + # logically separate change + #while true; do emacs .; git commit -va; done + + # create patch files + git format-patch origin/master..HEAD + + # you'll now have a number of *.patch files in your current + # directory + + # navigate to the FreeSWITCH JIRA + chromium http://jira.freeswitch.org/ + + # create an account in JIRA and create a new issue; + # attach the patch file(s) you created to the issue + +Writing a Good Commit Message +----------------------------- + +Your commit message consists of two parts: the subject and the body. + +The subject is like the subject in an email message. It should be +short -- typically less than 50 characters -- and it should concisely +describe the purpose or effect of your change. + +If you're having a difficult time writing a short subject for your +commit, perhaps your commit should be broken into smaller separate +commits. + +The commit body can be longer and can consist of multiple paragraphs. +The text of the body should be hard wrapped to 68-72 characters. + +When writing the commit body, describe in detail the problem that your +commit aims to solve, how your commit solves the problem, and any +changes in behavior that result from your change, such as new +variables, command flags, or breaks in backward compatibility. + +Your commit message should be written in the present tense in +imperative style. Your message should talk about what the patch +*does*, not what you *did* to write it. + +The commit subject is the first line of your commit message, then +there is an empty line, then your commit body starts. A good commit +message might look like this: + +> Add frobinator support to mod_sofia +> +> Without proper frobinator support users had to make multiple calls +> to shell scripts to do the sort of frobbing needed in high call +> volume environments. +> +> With this change, we now link to libfrob and support the IETF +> draft-cross-voip-frobbing API. +> +> After appropriate amounts of frobbing have been done, a new variable +> `frobbing_done` is set in the caller's channel. + +Where to Go for Help +-------------------- + +If you have any questions or run into any roadblocks please reach out +to us. You can send an email to our development mailing list: + +> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev + +Note that while you're free to send a patch to that list for questions +or for review, patches sent to the mailing list will not be considered +for inclusion. Patches that you want included in FreeSWITCH must be +submitted to JIRA. + +You can also reach us on freenode.net at: + +> #freeswitch-dev + +Finally, feel free to join us in our weekly conference call. Many of +the core developers are often on the call and you'll have an +opportunity at the beginning or end of the call to ask your questions: + +> http://wiki.freeswitch.org/wiki/Weekly_Conference_Call + From fb34ff9ade7a497b31647da7cd899d457ed12e55 Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 24 Jul 2013 18:40:31 -0500 Subject: [PATCH 27/88] adding transfer-sound to ivr menu so you can specifiy a sound file to pay when a transfer takes place --- src/include/switch_cpp.h | 1 + src/include/switch_ivr.h | 2 ++ src/switch_cpp.cpp | 3 ++- src/switch_ivr_menu.c | 12 ++++++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index 43aa6c0bef..bccf71a3a1 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -90,6 +90,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod const char *short_greeting_sound, const char *invalid_sound, const char *exit_sound, + const char *transfer_sound, const char *confirm_macro, const char *confirm_key, const char *tts_engine, diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 74f9a8e738..c0ba440c99 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -787,6 +787,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw *\param short_greeting_sound Optional pointer to a shorter main sound for subsequent loops. *\param invalid_sound Optional pointer to a sound to play after invalid input. *\param exit_sound Optional pointer to a sound to play upon exiting the menu. + *\param transfer_sound Optional pointer to a sound to play upon transfer away from the menu. *\param confirm_macro phrase macro name to confirm input *\param confirm_key the dtmf key required for positive confirmation *\param tts_engine the tts engine to use for this menu @@ -807,6 +808,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_me const char *short_greeting_sound, const char *invalid_sound, const char *exit_sound, + const char *transfer_sound, const char *confirm_macro, const char *confirm_key, const char *tts_engine, diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index e8a8a1513e..f7f6a4a5b8 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -161,6 +161,7 @@ SWITCH_DECLARE_CONSTRUCTOR IVRMenu::IVRMenu(IVRMenu *main, const char *short_greeting_sound, const char *invalid_sound, const char *exit_sound, + const char *transfer_sound, const char *confirm_macro, const char *confirm_key, const char *tts_engine, @@ -180,7 +181,7 @@ SWITCH_DECLARE_CONSTRUCTOR IVRMenu::IVRMenu(IVRMenu *main, } switch_ivr_menu_init(&menu, main ? main->menu : NULL, name, greeting_sound, short_greeting_sound, invalid_sound, - exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, + exit_sound, transfer_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts, pool); diff --git a/src/switch_ivr_menu.c b/src/switch_ivr_menu.c index 639ff58f29..e3dfa5c848 100644 --- a/src/switch_ivr_menu.c +++ b/src/switch_ivr_menu.c @@ -40,6 +40,7 @@ struct switch_ivr_menu { char *short_greeting_sound; char *invalid_sound; char *exit_sound; + char *transfer_sound; char *buf; char *ptr; char *confirm_macro; @@ -105,6 +106,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_me const char *short_greeting_sound, const char *invalid_sound, const char *exit_sound, + const char *transfer_sound, const char *confirm_macro, const char *confirm_key, const char *tts_engine, @@ -158,6 +160,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_me menu->invalid_sound = switch_core_strdup(menu->pool, invalid_sound); } + if (!zstr(transfer_sound)) { + menu->transfer_sound = switch_core_strdup(menu->pool, transfer_sound); + } + if (!zstr(exit_sound)) { menu->exit_sound = switch_core_strdup(menu->pool, exit_sound); } @@ -588,6 +594,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s } if ((application_interface = switch_loadable_module_get_application_interface(app_name))) { + if (!zstr(menu->transfer_sound) && !strcmp(app_name, "transfer")) { + status = play_and_collect(session, menu, menu->transfer_sound, 0); + } + switch_core_session_exec(session, application_interface, app_arg); UNPROTECT_INTERFACE(application_interface); status = SWITCH_STATUS_SUCCESS; @@ -822,6 +832,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_ const char *greet_short = switch_xml_attr(xml_menu, "greet-short"); /* if the attr doesn't exist, return NULL */ const char *invalid_sound = switch_xml_attr(xml_menu, "invalid-sound"); /* if the attr doesn't exist, return NULL */ const char *exit_sound = switch_xml_attr(xml_menu, "exit-sound"); /* if the attr doesn't exist, return NULL */ + const char *transfer_sound = switch_xml_attr(xml_menu, "transfer-sound"); /* if the attr doesn't exist, return NULL */ const char *timeout = switch_xml_attr_soft(xml_menu, "timeout"); /* if the attr doesn't exist, return "" */ const char *max_failures = switch_xml_attr_soft(xml_menu, "max-failures"); /* if the attr doesn't exist, return "" */ const char *max_timeouts = switch_xml_attr_soft(xml_menu, "max-timeouts"); @@ -853,6 +864,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_ greet_short, invalid_sound, exit_sound, + transfer_sound, confirm_macro, confirm_key, tts_engine, From ac700966e9c963ab60c5249ad13c1892d5d8f595 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 24 Jul 2013 18:42:50 -0500 Subject: [PATCH 28/88] swigall --- .../src/org/freeswitch/swig/CoreSession.java | 4 + .../org/freeswitch/swig/freeswitchJNI.java | 1 + .../languages/mod_java/switch_swig_wrap.cpp | 25 ++++ src/mod/languages/mod_lua/mod_lua_wrap.cpp | 31 +++++ .../languages/mod_managed/freeswitch_wrap.cxx | 129 ++++++++++++++++-- src/mod/languages/mod_managed/managed/swig.cs | 104 +++++++++++++- src/mod/languages/mod_perl/freeswitch.pm | 1 + src/mod/languages/mod_perl/mod_perl_wrap.cpp | 50 +++++++ src/mod/languages/mod_python/freeswitch.py | 1 + .../languages/mod_python/mod_python_wrap.cpp | 46 +++++++ 10 files changed, 376 insertions(+), 16 deletions(-) diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java index 92c400658b..d00693fa86 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java @@ -313,4 +313,8 @@ public class CoreSession { return new SWIGTYPE_p_switch_status_t(freeswitchJNI.CoreSession_run_dtmf_callback(swigCPtr, this, SWIGTYPE_p_void.getCPtr(input), SWIGTYPE_p_switch_input_type_t.getCPtr(itype)), true); } + public void consoleLog(String level_str, String msg) { + freeswitchJNI.CoreSession_consoleLog(swigCPtr, this, level_str, msg); + } + } diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java index cb802262ee..564c23cfed 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java @@ -157,6 +157,7 @@ class freeswitchJNI { public final static native long CoreSession_get_cb_args(long jarg1, CoreSession jarg1_); public final static native void CoreSession_check_hangup_hook(long jarg1, CoreSession jarg1_); public final static native long CoreSession_run_dtmf_callback(long jarg1, CoreSession jarg1_, long jarg2, long jarg3); + public final static native void CoreSession_consoleLog(long jarg1, CoreSession jarg1_, String jarg2, String jarg3); public final static native void console_log(String jarg1, String jarg2); public final static native void console_clean_log(String jarg1); public final static native void msleep(long jarg1); diff --git a/src/mod/languages/mod_java/switch_swig_wrap.cpp b/src/mod/languages/mod_java/switch_swig_wrap.cpp index 2b704563ee..24693243b3 100644 --- a/src/mod/languages/mod_java/switch_swig_wrap.cpp +++ b/src/mod/languages/mod_java/switch_swig_wrap.cpp @@ -3091,6 +3091,31 @@ SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1run } +SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1consoleLog(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(CoreSession **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return ; + } + (arg1)->consoleLog(arg2,arg3); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); +} + + SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_console_1log(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2) { char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index 2f4bffbff1..e882607adc 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -6140,6 +6140,36 @@ fail: } +static int _wrap_CoreSession_consoleLog(lua_State* L) { + int SWIG_arg = -1; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + + SWIG_check_num_args("consoleLog",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("consoleLog",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("consoleLog",2,"char *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("consoleLog",3,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_consoleLog",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); + (arg1)->consoleLog(arg2,arg3); + SWIG_arg=0; + + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + static void swig_delete_CoreSession(void *obj) { CoreSession *arg1 = (CoreSession *) obj; delete arg1; @@ -6192,6 +6222,7 @@ static swig_lua_method swig_CoreSession_methods[] = { {"get_cb_args", _wrap_CoreSession_get_cb_args}, {"check_hangup_hook", _wrap_CoreSession_check_hangup_hook}, {"run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback}, + {"consoleLog", _wrap_CoreSession_consoleLog}, {0,0} }; static swig_lua_attribute swig_CoreSession_attributes[] = { diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 840c08a27f..ae1bf97e9e 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -11813,6 +11813,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_get_results(void * jarg1, void } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_get_result_headers(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ; + switch_event_t **arg2 = (switch_event_t **) 0 ; + switch_asr_flag_t *arg3 = (switch_asr_flag_t *) 0 ; + switch_status_t result; + + arg1 = (switch_asr_handle_t *)jarg1; + arg2 = (switch_event_t **)jarg2; + arg3 = (switch_asr_flag_t *)jarg3; + result = (switch_status_t)switch_core_asr_get_result_headers(arg1,arg2,arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_load_grammar(void * jarg1, char * jarg2, char * jarg3) { int jresult ; switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ; @@ -13959,6 +13975,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_refresh_video(void * jarg1 } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_stream_system_fork(char * jarg1, void * jarg2) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_stream_handle_t *arg2 = (switch_stream_handle_t *) 0 ; + int result; + + arg1 = (char *)jarg1; + arg2 = (switch_stream_handle_t *)jarg2; + result = (int)switch_stream_system_fork((char const *)arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) { switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; char *arg2 = (char *) 0 ; @@ -22483,6 +22513,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_get_results_get(vo } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_get_result_headers_set(void * jarg1, void * jarg2) { + switch_asr_interface *arg1 = (switch_asr_interface *) 0 ; + switch_status_t (*arg2)(switch_asr_handle_t *,switch_event_t **,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,switch_event_t **,switch_asr_flag_t *)) 0 ; + + arg1 = (switch_asr_interface *)jarg1; + arg2 = (switch_status_t (*)(switch_asr_handle_t *,switch_event_t **,switch_asr_flag_t *))jarg2; + if (arg1) (arg1)->asr_get_result_headers = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_get_result_headers_get(void * jarg1) { + void * jresult ; + switch_asr_interface *arg1 = (switch_asr_interface *) 0 ; + switch_status_t (*result)(switch_asr_handle_t *,switch_event_t **,switch_asr_flag_t *) = 0 ; + + arg1 = (switch_asr_interface *)jarg1; + result = (switch_status_t (*)(switch_asr_handle_t *,switch_event_t **,switch_asr_flag_t *)) ((arg1)->asr_get_result_headers); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_start_input_timers_set(void * jarg1, void * jarg2) { switch_asr_interface *arg1 = (switch_asr_interface *) 0 ; switch_status_t (*arg2)(switch_asr_handle_t *) = (switch_status_t (*)(switch_asr_handle_t *)) 0 ; @@ -32469,6 +32522,24 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_play_and_detect_speech(void * jarg1 } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_init(void * jarg1, char * jarg2, char * jarg3, void * jarg4) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + switch_asr_handle_t *arg4 = (switch_asr_handle_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (switch_asr_handle_t *)jarg4; + result = (switch_status_t)switch_ivr_detect_speech_init(arg1,(char const *)arg2,(char const *)arg3,arg4); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, void * jarg6) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -33559,7 +33630,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_set_terminator( } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_init(void * jarg1, void * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, char * jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, void * jarg18) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_init(void * jarg1, void * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, char * jarg11, char * jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, int jarg18, void * jarg19) { int jresult ; switch_ivr_menu_t **arg1 = (switch_ivr_menu_t **) 0 ; switch_ivr_menu_t *arg2 = (switch_ivr_menu_t *) 0 ; @@ -33572,13 +33643,14 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_init(void * jarg1, void * jarg char *arg9 = (char *) 0 ; char *arg10 = (char *) 0 ; char *arg11 = (char *) 0 ; - int arg12 ; + char *arg12 = (char *) 0 ; int arg13 ; int arg14 ; int arg15 ; int arg16 ; int arg17 ; - switch_memory_pool_t *arg18 = (switch_memory_pool_t *) 0 ; + int arg18 ; + switch_memory_pool_t *arg19 = (switch_memory_pool_t *) 0 ; switch_status_t result; arg1 = (switch_ivr_menu_t **)jarg1; @@ -33592,14 +33664,15 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_init(void * jarg1, void * jarg arg9 = (char *)jarg9; arg10 = (char *)jarg10; arg11 = (char *)jarg11; - arg12 = (int)jarg12; + arg12 = (char *)jarg12; arg13 = (int)jarg13; arg14 = (int)jarg14; arg15 = (int)jarg15; arg16 = (int)jarg16; arg17 = (int)jarg17; - arg18 = (switch_memory_pool_t *)jarg18; - result = (switch_status_t)switch_ivr_menu_init(arg1,arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18); + arg18 = (int)jarg18; + arg19 = (switch_memory_pool_t *)jarg19; + result = (switch_status_t)switch_ivr_menu_init(arg1,arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,(char const *)arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19); jresult = result; return jresult; } @@ -34071,6 +34144,26 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_user(void * jarg1, char * jarg2 } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_user_xml(void * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + switch_xml_t arg5 = (switch_xml_t) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (char *)jarg4; + arg5 = (switch_xml_t)jarg5; + result = (switch_status_t)switch_ivr_set_user_xml(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_sound_test(void * jarg1) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -35289,6 +35382,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_set_ssrc(void * jarg1, unsigned lon } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_set_remote_ssrc(void * jarg1, unsigned long jarg2) { + int jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + uint32_t arg2 ; + switch_status_t result; + + arg1 = (switch_rtp_t *)jarg1; + arg2 = (uint32_t)jarg2; + result = (switch_status_t)switch_rtp_set_remote_ssrc(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_rtp_set_end_port(unsigned short jarg1) { unsigned short jresult ; switch_port_t arg1 ; @@ -39685,7 +39792,7 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_email(char * jarg1, char * jarg2, cha } -SWIGEXPORT void * SWIGSTDCALL CSharp_new_IvrMenu(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16) { +SWIGEXPORT void * SWIGSTDCALL CSharp_new_IvrMenu(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, char * jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17) { void * jresult ; IVRMenu *arg1 = (IVRMenu *) 0 ; char *arg2 = (char *) 0 ; @@ -39697,12 +39804,13 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_new_IvrMenu(void * jarg1, char * jarg2, cha char *arg8 = (char *) 0 ; char *arg9 = (char *) 0 ; char *arg10 = (char *) 0 ; - int arg11 ; + char *arg11 = (char *) 0 ; int arg12 ; int arg13 ; int arg14 ; int arg15 ; int arg16 ; + int arg17 ; IVRMenu *result = 0 ; arg1 = (IVRMenu *)jarg1; @@ -39715,13 +39823,14 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_new_IvrMenu(void * jarg1, char * jarg2, cha arg8 = (char *)jarg8; arg9 = (char *)jarg9; arg10 = (char *)jarg10; - arg11 = (int)jarg11; + arg11 = (char *)jarg11; arg12 = (int)jarg12; arg13 = (int)jarg13; arg14 = (int)jarg14; arg15 = (int)jarg15; arg16 = (int)jarg16; - result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,arg12,arg13,arg14,arg15,arg16); + arg17 = (int)jarg17; + result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,arg12,arg13,arg14,arg15,arg16,arg17); jresult = (void *)result; return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index a18e0c4d6e..308728144b 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -801,7 +801,7 @@ public class IvrMenu : IDisposable { } } - public IvrMenu(IvrMenu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts) : this(freeswitchPINVOKE.new_IvrMenu(IvrMenu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts), true) { + public IvrMenu(IvrMenu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string transfer_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts) : this(freeswitchPINVOKE.new_IvrMenu(IvrMenu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, transfer_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts), true) { } public void bindAction(string action, string arg, string bind) { @@ -1480,6 +1480,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t { private HandleRef swigCPtr; @@ -8226,6 +8256,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_asr_get_result_headers(switch_asr_handle ah, SWIGTYPE_p_p_switch_event headers, SWIGTYPE_p_unsigned_long flags) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_get_result_headers(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_p_switch_event.getCPtr(headers), SWIGTYPE_p_unsigned_long.getCPtr(flags)); + return ret; + } + public static switch_status_t switch_core_asr_load_grammar(switch_asr_handle ah, string grammar, string name) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_load_grammar(switch_asr_handle.getCPtr(ah), grammar, name); return ret; @@ -8898,6 +8933,11 @@ public class freeswitch { return ret; } + public static int switch_stream_system_fork(string cmd, switch_stream_handle stream) { + int ret = freeswitchPINVOKE.switch_stream_system_fork(cmd, switch_stream_handle.getCPtr(stream)); + return ret; + } + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); return ret; @@ -10898,6 +10938,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_detect_speech_init(SWIGTYPE_p_switch_core_session session, string mod_name, string dest, switch_asr_handle ah) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_init(SWIGTYPE_p_switch_core_session.getCPtr(session), mod_name, dest, switch_asr_handle.getCPtr(ah)); + return ret; + } + public static switch_status_t switch_ivr_detect_speech(SWIGTYPE_p_switch_core_session session, string mod_name, string grammar, string name, string dest, switch_asr_handle ah) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session), mod_name, grammar, name, dest, switch_asr_handle.getCPtr(ah)); return ret; @@ -11230,8 +11275,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu new_menu, SWIGTYPE_p_switch_ivr_menu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts, SWIGTYPE_p_apr_pool_t pool) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu.getCPtr(new_menu), SWIGTYPE_p_switch_ivr_menu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts, SWIGTYPE_p_apr_pool_t.getCPtr(pool)); + public static switch_status_t switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu new_menu, SWIGTYPE_p_switch_ivr_menu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string transfer_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts, SWIGTYPE_p_apr_pool_t pool) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu.getCPtr(new_menu), SWIGTYPE_p_switch_ivr_menu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, transfer_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts, SWIGTYPE_p_apr_pool_t.getCPtr(pool)); return ret; } @@ -11374,6 +11419,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_set_user_xml(SWIGTYPE_p_switch_core_session session, string prefix, string user, string domain, switch_xml x_user) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_set_user_xml(SWIGTYPE_p_switch_core_session.getCPtr(session), prefix, user, domain, switch_xml.getCPtr(x_user)); + return ret; + } + public static switch_status_t switch_ivr_sound_test(SWIGTYPE_p_switch_core_session session) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_sound_test(SWIGTYPE_p_switch_core_session.getCPtr(session)); return ret; @@ -11543,6 +11593,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_rtp_set_remote_ssrc(SWIGTYPE_p_switch_rtp rtp_session, uint ssrc) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_set_remote_ssrc(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), ssrc); + return ret; + } + public static ushort switch_rtp_set_end_port(ushort port) { ushort ret = freeswitchPINVOKE.switch_rtp_set_end_port(port); return ret; @@ -15589,6 +15644,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_get_results")] public static extern int switch_core_asr_get_results(HandleRef jarg1, ref string jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_get_result_headers")] + public static extern int switch_core_asr_get_result_headers(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_load_grammar")] public static extern int switch_core_asr_load_grammar(HandleRef jarg1, string jarg2, string jarg3); @@ -16108,6 +16166,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_refresh_video")] public static extern int switch_core_session_refresh_video(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_system_fork")] + public static extern int switch_stream_system_fork(string jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")] public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2); @@ -18118,6 +18179,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_get_results_get")] public static extern IntPtr switch_asr_interface_asr_get_results_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_get_result_headers_set")] + public static extern void switch_asr_interface_asr_get_result_headers_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_get_result_headers_get")] + public static extern IntPtr switch_asr_interface_asr_get_result_headers_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_start_input_timers_set")] public static extern void switch_asr_interface_asr_start_input_timers_set(HandleRef jarg1, HandleRef jarg2); @@ -20497,6 +20564,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_play_and_detect_speech")] public static extern int switch_ivr_play_and_detect_speech(HandleRef jarg1, string jarg2, string jarg3, string jarg4, ref string jarg5, uint jarg6, HandleRef jarg7); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_init")] + public static extern int switch_ivr_detect_speech_init(HandleRef jarg1, string jarg2, string jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech")] public static extern int switch_ivr_detect_speech(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, HandleRef jarg6); @@ -20696,7 +20766,7 @@ class freeswitchPINVOKE { public static extern int switch_ivr_digit_stream_parser_set_terminator(HandleRef jarg1, char jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_init")] - public static extern int switch_ivr_menu_init(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, string jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, HandleRef jarg18); + public static extern int switch_ivr_menu_init(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, string jarg11, string jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, int jarg18, HandleRef jarg19); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_bind_action")] public static extern int switch_ivr_menu_bind_action(HandleRef jarg1, int jarg2, string jarg3, string jarg4); @@ -20782,6 +20852,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_set_user")] public static extern int switch_ivr_set_user(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_set_user_xml")] + public static extern int switch_ivr_set_user_xml(HandleRef jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_sound_test")] public static extern int switch_ivr_sound_test(HandleRef jarg1); @@ -21061,6 +21134,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_ssrc")] public static extern int switch_rtp_set_ssrc(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_remote_ssrc")] + public static extern int switch_rtp_set_remote_ssrc(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_end_port")] public static extern ushort switch_rtp_set_end_port(ushort jarg1); @@ -22103,7 +22179,7 @@ class freeswitchPINVOKE { public static extern bool email(string jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7); [DllImport("mod_managed", EntryPoint="CSharp_new_IvrMenu")] - public static extern IntPtr new_IvrMenu(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16); + public static extern IntPtr new_IvrMenu(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, string jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17); [DllImport("mod_managed", EntryPoint="CSharp_delete_IvrMenu")] public static extern void delete_IvrMenu(HandleRef jarg1); @@ -23893,6 +23969,17 @@ public class switch_asr_interface : IDisposable { } } + public SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t asr_get_result_headers { + set { + freeswitchPINVOKE.switch_asr_interface_asr_get_result_headers_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_get_result_headers_get(swigCPtr); + SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t(cPtr, false); + return ret; + } + } + public SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t asr_start_input_timers { set { freeswitchPINVOKE.switch_asr_interface_asr_start_input_timers_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.getCPtr(value)); @@ -25771,6 +25858,7 @@ public enum switch_channel_flag_t { CF_DTLS_OK, CF_VIDEO_PASSIVE, CF_NOVIDEO, + CF_VIDEO_ECHO, CF_FLAG_MAX } @@ -34915,7 +35003,11 @@ public enum switch_session_ctl_t { SCSC_DEBUG_SQL, SCSC_SQL, SCSC_API_EXPANSION, - SCSC_RECOVER + SCSC_RECOVER, + SCSC_SPS_PEAK, + SCSC_SPS_PEAK_FIVEMIN, + SCSC_SESSIONS_PEAK, + SCSC_SESSIONS_PEAK_FIVEMIN } } diff --git a/src/mod/languages/mod_perl/freeswitch.pm b/src/mod/languages/mod_perl/freeswitch.pm index 99a7e87952..93f024e28f 100644 --- a/src/mod/languages/mod_perl/freeswitch.pm +++ b/src/mod/languages/mod_perl/freeswitch.pm @@ -458,6 +458,7 @@ sub DESTROY { *get_cb_args = *freeswitchc::CoreSession_get_cb_args; *check_hangup_hook = *freeswitchc::CoreSession_check_hangup_hook; *run_dtmf_callback = *freeswitchc::CoreSession_run_dtmf_callback; +*consoleLog = *freeswitchc::CoreSession_consoleLog; sub DISOWN { my $self = shift; my $ptr = tied(%$self); diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 1e266d7b2b..686b892b51 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -8040,6 +8040,55 @@ XS(_wrap_CoreSession_run_dtmf_callback) { } +XS(_wrap_CoreSession_consoleLog) { + { + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 3) || (items > 3)) { + SWIG_croak("Usage: CoreSession_consoleLog(self,level_str,msg);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_consoleLog" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_consoleLog" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_consoleLog" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + (arg1)->consoleLog(arg2,arg3); + + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + SWIG_croak_null(); + } +} + + XS(_wrap_console_log) { { char *arg1 = (char *) 0 ; @@ -9873,6 +9922,7 @@ static swig_command_info swig_commands[] = { {"freeswitchc::CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args}, {"freeswitchc::CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook}, {"freeswitchc::CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback}, +{"freeswitchc::CoreSession_consoleLog", _wrap_CoreSession_consoleLog}, {"freeswitchc::console_log", _wrap_console_log}, {"freeswitchc::console_clean_log", _wrap_console_clean_log}, {"freeswitchc::msleep", _wrap_msleep}, diff --git a/src/mod/languages/mod_python/freeswitch.py b/src/mod/languages/mod_python/freeswitch.py index a3d06ec0f4..27ed50a7c5 100644 --- a/src/mod/languages/mod_python/freeswitch.py +++ b/src/mod/languages/mod_python/freeswitch.py @@ -317,6 +317,7 @@ class CoreSession(_object): def get_cb_args(*args): return _freeswitch.CoreSession_get_cb_args(*args) def check_hangup_hook(*args): return _freeswitch.CoreSession_check_hangup_hook(*args) def run_dtmf_callback(*args): return _freeswitch.CoreSession_run_dtmf_callback(*args) + def consoleLog(*args): return _freeswitch.CoreSession_consoleLog(*args) CoreSession_swigregister = _freeswitch.CoreSession_swigregister CoreSession_swigregister(CoreSession) diff --git a/src/mod/languages/mod_python/mod_python_wrap.cpp b/src/mod/languages/mod_python/mod_python_wrap.cpp index d89b5ddad4..3faae3bc82 100644 --- a/src/mod/languages/mod_python/mod_python_wrap.cpp +++ b/src/mod/languages/mod_python/mod_python_wrap.cpp @@ -8250,6 +8250,51 @@ fail: } +SWIGINTERN PyObject *_wrap_CoreSession_consoleLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_consoleLog",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_consoleLog" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_consoleLog" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_consoleLog" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + (arg1)->consoleLog(arg2,arg3); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + SWIGINTERN PyObject *CoreSession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; @@ -9392,6 +9437,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args, METH_VARARGS, NULL}, { (char *)"CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook, METH_VARARGS, NULL}, { (char *)"CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback, METH_VARARGS, NULL}, + { (char *)"CoreSession_consoleLog", _wrap_CoreSession_consoleLog, METH_VARARGS, NULL}, { (char *)"CoreSession_swigregister", CoreSession_swigregister, METH_VARARGS, NULL}, { (char *)"console_log", _wrap_console_log, METH_VARARGS, NULL}, { (char *)"console_clean_log", _wrap_console_clean_log, METH_VARARGS, NULL}, From 5f2dca72b3a537a5eae5a9de1ca8887fa03b5692 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 24 Jul 2013 18:49:27 -0500 Subject: [PATCH 29/88] swigall --- src/mod/languages/mod_lua/mod_lua_wrap.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index e882607adc..130eab949a 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -1706,15 +1706,16 @@ static int _wrap_new_IVRMenu(lua_State* L) { char *arg8 = (char *) 0 ; char *arg9 = (char *) 0 ; char *arg10 = (char *) 0 ; - int arg11 ; + char *arg11 = (char *) 0 ; int arg12 ; int arg13 ; int arg14 ; int arg15 ; int arg16 ; + int arg17 ; IVRMenu *result = 0 ; - SWIG_check_num_args("IVRMenu",16,16) + SWIG_check_num_args("IVRMenu",17,17) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *"); if(!lua_isstring(L,2)) SWIG_fail_arg("IVRMenu",2,"char const *"); if(!lua_isstring(L,3)) SWIG_fail_arg("IVRMenu",3,"char const *"); @@ -1725,12 +1726,13 @@ static int _wrap_new_IVRMenu(lua_State* L) { if(!lua_isstring(L,8)) SWIG_fail_arg("IVRMenu",8,"char const *"); if(!lua_isstring(L,9)) SWIG_fail_arg("IVRMenu",9,"char const *"); if(!lua_isstring(L,10)) SWIG_fail_arg("IVRMenu",10,"char const *"); - if(!lua_isnumber(L,11)) SWIG_fail_arg("IVRMenu",11,"int"); + if(!lua_isstring(L,11)) SWIG_fail_arg("IVRMenu",11,"char const *"); if(!lua_isnumber(L,12)) SWIG_fail_arg("IVRMenu",12,"int"); if(!lua_isnumber(L,13)) SWIG_fail_arg("IVRMenu",13,"int"); if(!lua_isnumber(L,14)) SWIG_fail_arg("IVRMenu",14,"int"); if(!lua_isnumber(L,15)) SWIG_fail_arg("IVRMenu",15,"int"); if(!lua_isnumber(L,16)) SWIG_fail_arg("IVRMenu",16,"int"); + if(!lua_isnumber(L,17)) SWIG_fail_arg("IVRMenu",17,"int"); if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){ SWIG_fail_ptr("new_IVRMenu",1,SWIGTYPE_p_IVRMenu); @@ -1745,13 +1747,14 @@ static int _wrap_new_IVRMenu(lua_State* L) { arg8 = (char *)lua_tostring(L, 8); arg9 = (char *)lua_tostring(L, 9); arg10 = (char *)lua_tostring(L, 10); - arg11 = (int)lua_tonumber(L, 11); + arg11 = (char *)lua_tostring(L, 11); arg12 = (int)lua_tonumber(L, 12); arg13 = (int)lua_tonumber(L, 13); arg14 = (int)lua_tonumber(L, 14); arg15 = (int)lua_tonumber(L, 15); arg16 = (int)lua_tonumber(L, 16); - result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,arg12,arg13,arg14,arg15,arg16); + arg17 = (int)lua_tonumber(L, 17); + result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,arg12,arg13,arg14,arg15,arg16,arg17); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_IVRMenu,1); SWIG_arg++; return SWIG_arg; From 292e39187c5cc44b5421e1d357f2b34c613d67cc Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 24 Jul 2013 22:11:01 -0500 Subject: [PATCH 30/88] vs2010 reswig --- .../mod_managed/freeswitch_wrap.2010.cxx | 140 ++++++++++++++++-- .../mod_managed/managed/swig.2010.cs | 112 +++++++++++++- 2 files changed, 236 insertions(+), 16 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 90c1a2e68c..9afb1d2758 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -11441,6 +11441,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_get_results(void * jarg1, void } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_get_result_headers(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ; + switch_event_t **arg2 = (switch_event_t **) 0 ; + switch_asr_flag_t *arg3 = (switch_asr_flag_t *) 0 ; + switch_status_t result; + + arg1 = (switch_asr_handle_t *)jarg1; + arg2 = (switch_event_t **)jarg2; + arg3 = (switch_asr_flag_t *)jarg3; + result = (switch_status_t)switch_core_asr_get_result_headers(arg1,arg2,arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_load_grammar(void * jarg1, char * jarg2, char * jarg3) { int jresult ; switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ; @@ -13575,6 +13591,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_refresh_video(void * jarg1 } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_stream_system_fork(char * jarg1, void * jarg2) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_stream_handle_t *arg2 = (switch_stream_handle_t *) 0 ; + int result; + + arg1 = (char *)jarg1; + arg2 = (switch_stream_handle_t *)jarg2; + result = (int)switch_stream_system_fork((char const *)arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) { switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; char *arg2 = (char *) 0 ; @@ -21887,6 +21917,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_get_results_get(vo } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_get_result_headers_set(void * jarg1, void * jarg2) { + switch_asr_interface *arg1 = (switch_asr_interface *) 0 ; + switch_status_t (*arg2)(switch_asr_handle_t *,switch_event_t **,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,switch_event_t **,switch_asr_flag_t *)) 0 ; + + arg1 = (switch_asr_interface *)jarg1; + arg2 = (switch_status_t (*)(switch_asr_handle_t *,switch_event_t **,switch_asr_flag_t *))jarg2; + if (arg1) (arg1)->asr_get_result_headers = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_get_result_headers_get(void * jarg1) { + void * jresult ; + switch_asr_interface *arg1 = (switch_asr_interface *) 0 ; + switch_status_t (*result)(switch_asr_handle_t *,switch_event_t **,switch_asr_flag_t *) = 0 ; + + arg1 = (switch_asr_interface *)jarg1; + result = (switch_status_t (*)(switch_asr_handle_t *,switch_event_t **,switch_asr_flag_t *)) ((arg1)->asr_get_result_headers); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_start_input_timers_set(void * jarg1, void * jarg2) { switch_asr_interface *arg1 = (switch_asr_interface *) 0 ; switch_status_t (*arg2)(switch_asr_handle_t *) = (switch_status_t (*)(switch_asr_handle_t *)) 0 ; @@ -31647,6 +31699,24 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_play_and_detect_speech(void * jarg1 } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_init(void * jarg1, char * jarg2, char * jarg3, void * jarg4) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + switch_asr_handle_t *arg4 = (switch_asr_handle_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (switch_asr_handle_t *)jarg4; + result = (switch_status_t)switch_ivr_detect_speech_init(arg1,(char const *)arg2,(char const *)arg3,arg4); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, void * jarg6) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -32737,7 +32807,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_set_terminator( } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_init(void * jarg1, void * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, char * jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, void * jarg18) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_init(void * jarg1, void * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, char * jarg11, char * jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, int jarg18, void * jarg19) { int jresult ; switch_ivr_menu_t **arg1 = (switch_ivr_menu_t **) 0 ; switch_ivr_menu_t *arg2 = (switch_ivr_menu_t *) 0 ; @@ -32750,13 +32820,14 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_init(void * jarg1, void * jarg char *arg9 = (char *) 0 ; char *arg10 = (char *) 0 ; char *arg11 = (char *) 0 ; - int arg12 ; + char *arg12 = (char *) 0 ; int arg13 ; int arg14 ; int arg15 ; int arg16 ; int arg17 ; - switch_memory_pool_t *arg18 = (switch_memory_pool_t *) 0 ; + int arg18 ; + switch_memory_pool_t *arg19 = (switch_memory_pool_t *) 0 ; switch_status_t result; arg1 = (switch_ivr_menu_t **)jarg1; @@ -32770,14 +32841,15 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_init(void * jarg1, void * jarg arg9 = (char *)jarg9; arg10 = (char *)jarg10; arg11 = (char *)jarg11; - arg12 = (int)jarg12; + arg12 = (char *)jarg12; arg13 = (int)jarg13; arg14 = (int)jarg14; arg15 = (int)jarg15; arg16 = (int)jarg16; arg17 = (int)jarg17; - arg18 = (switch_memory_pool_t *)jarg18; - result = (switch_status_t)switch_ivr_menu_init(arg1,arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18); + arg18 = (int)jarg18; + arg19 = (switch_memory_pool_t *)jarg19; + result = (switch_status_t)switch_ivr_menu_init(arg1,arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,(char const *)arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19); jresult = result; return jresult; } @@ -33249,6 +33321,26 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_user(void * jarg1, char * jarg2 } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_user_xml(void * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + switch_xml_t arg5 = (switch_xml_t) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (char *)jarg4; + arg5 = (switch_xml_t)jarg5; + result = (switch_status_t)switch_ivr_set_user_xml(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_sound_test(void * jarg1) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -34446,6 +34538,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_set_ssrc(void * jarg1, unsigned lon } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_set_remote_ssrc(void * jarg1, unsigned long jarg2) { + int jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + uint32_t arg2 ; + switch_status_t result; + + arg1 = (switch_rtp_t *)jarg1; + arg2 = (uint32_t)jarg2; + result = (switch_status_t)switch_rtp_set_remote_ssrc(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_rtp_set_end_port(unsigned short jarg1) { unsigned short jresult ; switch_port_t arg1 ; @@ -38787,7 +38893,7 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_email(char * jarg1, char * jarg2, cha } -SWIGEXPORT void * SWIGSTDCALL CSharp_new_IvrMenu(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16) { +SWIGEXPORT void * SWIGSTDCALL CSharp_new_IvrMenu(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, char * jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17) { void * jresult ; IVRMenu *arg1 = (IVRMenu *) 0 ; char *arg2 = (char *) 0 ; @@ -38799,12 +38905,13 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_new_IvrMenu(void * jarg1, char * jarg2, cha char *arg8 = (char *) 0 ; char *arg9 = (char *) 0 ; char *arg10 = (char *) 0 ; - int arg11 ; + char *arg11 = (char *) 0 ; int arg12 ; int arg13 ; int arg14 ; int arg15 ; int arg16 ; + int arg17 ; IVRMenu *result = 0 ; arg1 = (IVRMenu *)jarg1; @@ -38817,13 +38924,14 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_new_IvrMenu(void * jarg1, char * jarg2, cha arg8 = (char *)jarg8; arg9 = (char *)jarg9; arg10 = (char *)jarg10; - arg11 = (int)jarg11; + arg11 = (char *)jarg11; arg12 = (int)jarg12; arg13 = (int)jarg13; arg14 = (int)jarg14; arg15 = (int)jarg15; arg16 = (int)jarg16; - result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,arg12,arg13,arg14,arg15,arg16); + arg17 = (int)jarg17; + result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,arg12,arg13,arg14,arg15,arg16,arg17); jresult = (void *)result; return jresult; } @@ -40541,6 +40649,18 @@ SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_check_hangup_hook(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_consoleLog(void * jarg1, char * jarg2, char * jarg3) { + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + + arg1 = (CoreSession *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + (arg1)->consoleLog(arg2,arg3); +} + + SWIGEXPORT void SWIGSTDCALL CSharp_console_log(char * jarg1, char * jarg2) { char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index ac74b01bb2..3aff242242 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -505,6 +505,10 @@ public class CoreSession : IDisposable { freeswitchPINVOKE.CoreSession_check_hangup_hook(swigCPtr); } + public void consoleLog(string level_str, string msg) { + freeswitchPINVOKE.CoreSession_consoleLog(swigCPtr, level_str, msg); + } + } } @@ -2460,6 +2464,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_asr_get_result_headers(switch_asr_handle ah, SWIGTYPE_p_p_switch_event headers, SWIGTYPE_p_unsigned_long flags) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_get_result_headers(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_p_switch_event.getCPtr(headers), SWIGTYPE_p_unsigned_long.getCPtr(flags)); + return ret; + } + public static switch_status_t switch_core_asr_load_grammar(switch_asr_handle ah, string grammar, string name) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_load_grammar(switch_asr_handle.getCPtr(ah), grammar, name); return ret; @@ -3132,6 +3141,11 @@ public class freeswitch { return ret; } + public static int switch_stream_system_fork(string cmd, switch_stream_handle stream) { + int ret = freeswitchPINVOKE.switch_stream_system_fork(cmd, switch_stream_handle.getCPtr(stream)); + return ret; + } + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); return ret; @@ -5132,6 +5146,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_detect_speech_init(SWIGTYPE_p_switch_core_session session, string mod_name, string dest, switch_asr_handle ah) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_init(SWIGTYPE_p_switch_core_session.getCPtr(session), mod_name, dest, switch_asr_handle.getCPtr(ah)); + return ret; + } + public static switch_status_t switch_ivr_detect_speech(SWIGTYPE_p_switch_core_session session, string mod_name, string grammar, string name, string dest, switch_asr_handle ah) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session), mod_name, grammar, name, dest, switch_asr_handle.getCPtr(ah)); return ret; @@ -5464,8 +5483,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu new_menu, SWIGTYPE_p_switch_ivr_menu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts, SWIGTYPE_p_apr_pool_t pool) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu.getCPtr(new_menu), SWIGTYPE_p_switch_ivr_menu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts, SWIGTYPE_p_apr_pool_t.getCPtr(pool)); + public static switch_status_t switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu new_menu, SWIGTYPE_p_switch_ivr_menu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string transfer_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts, SWIGTYPE_p_apr_pool_t pool) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu.getCPtr(new_menu), SWIGTYPE_p_switch_ivr_menu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, transfer_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts, SWIGTYPE_p_apr_pool_t.getCPtr(pool)); return ret; } @@ -5608,6 +5627,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_set_user_xml(SWIGTYPE_p_switch_core_session session, string prefix, string user, string domain, switch_xml x_user) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_set_user_xml(SWIGTYPE_p_switch_core_session.getCPtr(session), prefix, user, domain, switch_xml.getCPtr(x_user)); + return ret; + } + public static switch_status_t switch_ivr_sound_test(SWIGTYPE_p_switch_core_session session) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_sound_test(SWIGTYPE_p_switch_core_session.getCPtr(session)); return ret; @@ -5777,6 +5801,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_rtp_set_remote_ssrc(SWIGTYPE_p_switch_rtp rtp_session, uint ssrc) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_set_remote_ssrc(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), ssrc); + return ret; + } + public static ushort switch_rtp_set_end_port(ushort port) { ushort ret = freeswitchPINVOKE.switch_rtp_set_end_port(port); return ret; @@ -9827,6 +9856,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_get_results")] public static extern int switch_core_asr_get_results(HandleRef jarg1, ref string jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_get_result_headers")] + public static extern int switch_core_asr_get_result_headers(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_load_grammar")] public static extern int switch_core_asr_load_grammar(HandleRef jarg1, string jarg2, string jarg3); @@ -10346,6 +10378,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_refresh_video")] public static extern int switch_core_session_refresh_video(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_system_fork")] + public static extern int switch_stream_system_fork(string jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")] public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2); @@ -12356,6 +12391,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_get_results_get")] public static extern IntPtr switch_asr_interface_asr_get_results_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_get_result_headers_set")] + public static extern void switch_asr_interface_asr_get_result_headers_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_get_result_headers_get")] + public static extern IntPtr switch_asr_interface_asr_get_result_headers_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_start_input_timers_set")] public static extern void switch_asr_interface_asr_start_input_timers_set(HandleRef jarg1, HandleRef jarg2); @@ -14735,6 +14776,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_play_and_detect_speech")] public static extern int switch_ivr_play_and_detect_speech(HandleRef jarg1, string jarg2, string jarg3, string jarg4, ref string jarg5, uint jarg6, HandleRef jarg7); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_init")] + public static extern int switch_ivr_detect_speech_init(HandleRef jarg1, string jarg2, string jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech")] public static extern int switch_ivr_detect_speech(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, HandleRef jarg6); @@ -14934,7 +14978,7 @@ class freeswitchPINVOKE { public static extern int switch_ivr_digit_stream_parser_set_terminator(HandleRef jarg1, char jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_init")] - public static extern int switch_ivr_menu_init(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, string jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, HandleRef jarg18); + public static extern int switch_ivr_menu_init(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, string jarg11, string jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, int jarg18, HandleRef jarg19); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_bind_action")] public static extern int switch_ivr_menu_bind_action(HandleRef jarg1, int jarg2, string jarg3, string jarg4); @@ -15020,6 +15064,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_set_user")] public static extern int switch_ivr_set_user(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_set_user_xml")] + public static extern int switch_ivr_set_user_xml(HandleRef jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_sound_test")] public static extern int switch_ivr_sound_test(HandleRef jarg1); @@ -15299,6 +15346,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_ssrc")] public static extern int switch_rtp_set_ssrc(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_remote_ssrc")] + public static extern int switch_rtp_set_remote_ssrc(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_end_port")] public static extern ushort switch_rtp_set_end_port(ushort jarg1); @@ -16341,7 +16391,7 @@ class freeswitchPINVOKE { public static extern bool email(string jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7); [DllImport("mod_managed", EntryPoint="CSharp_new_IvrMenu")] - public static extern IntPtr new_IvrMenu(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16); + public static extern IntPtr new_IvrMenu(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, string jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17); [DllImport("mod_managed", EntryPoint="CSharp_delete_IvrMenu")] public static extern void delete_IvrMenu(HandleRef jarg1); @@ -16745,6 +16795,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_check_hangup_hook")] public static extern void CoreSession_check_hangup_hook(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_consoleLog")] + public static extern void CoreSession_consoleLog(HandleRef jarg1, string jarg2, string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_console_log")] public static extern void console_log(string jarg1, string jarg2); @@ -17272,7 +17325,7 @@ public class IvrMenu : IDisposable { } } - public IvrMenu(IvrMenu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts) : this(freeswitchPINVOKE.new_IvrMenu(IvrMenu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts), true) { + public IvrMenu(IvrMenu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string transfer_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts) : this(freeswitchPINVOKE.new_IvrMenu(IvrMenu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, transfer_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts), true) { } public void bindAction(string action, string arg, string bind) { @@ -18081,6 +18134,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.1 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t { private HandleRef swigCPtr; @@ -23930,6 +24013,17 @@ public class switch_asr_interface : IDisposable { } } + public SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t asr_get_result_headers { + set { + freeswitchPINVOKE.switch_asr_interface_asr_get_result_headers_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_get_result_headers_get(swigCPtr); + SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t(cPtr, false); + return ret; + } + } + public SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t asr_start_input_timers { set { freeswitchPINVOKE.switch_asr_interface_asr_start_input_timers_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.getCPtr(value)); @@ -25827,6 +25921,8 @@ public enum switch_channel_flag_t { CF_VERBOSE_SDP, CF_DTLS_OK, CF_VIDEO_PASSIVE, + CF_NOVIDEO, + CF_VIDEO_ECHO, CF_FLAG_MAX } @@ -35097,7 +35193,11 @@ public enum switch_session_ctl_t { SCSC_DEBUG_SQL, SCSC_SQL, SCSC_API_EXPANSION, - SCSC_RECOVER + SCSC_RECOVER, + SCSC_SPS_PEAK, + SCSC_SPS_PEAK_FIVEMIN, + SCSC_SESSIONS_PEAK, + SCSC_SESSIONS_PEAK_FIVEMIN } } From 185917edfe2f6e42dd9595dfbcf32c40c18d06ea Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 25 Jul 2013 10:50:14 -0500 Subject: [PATCH 31/88] swigall --- .../src/org/freeswitch/swig/IVRMenu.java | 4 +-- .../org/freeswitch/swig/freeswitchJNI.java | 2 +- .../languages/mod_java/switch_swig_wrap.cpp | 15 ++++++--- src/mod/languages/mod_perl/mod_perl_wrap.cpp | 33 ++++++++++++------- .../languages/mod_python/mod_python_wrap.cpp | 32 ++++++++++++------ 5 files changed, 58 insertions(+), 28 deletions(-) diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/IVRMenu.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/IVRMenu.java index f49dd182db..f459a116d0 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/IVRMenu.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/IVRMenu.java @@ -33,8 +33,8 @@ public class IVRMenu { swigCPtr = 0; } - public IVRMenu(IVRMenu main, String name, String greeting_sound, String short_greeting_sound, String invalid_sound, String exit_sound, String confirm_macro, String confirm_key, String tts_engine, String tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts) { - this(freeswitchJNI.new_IVRMenu(IVRMenu.getCPtr(main), main, name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts), true); + public IVRMenu(IVRMenu main, String name, String greeting_sound, String short_greeting_sound, String invalid_sound, String exit_sound, String transfer_sound, String confirm_macro, String confirm_key, String tts_engine, String tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts) { + this(freeswitchJNI.new_IVRMenu(IVRMenu.getCPtr(main), main, name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, transfer_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts), true); } public void bindAction(String action, String arg, String bind) { diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java index 564c23cfed..8069552b94 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java @@ -15,7 +15,7 @@ class freeswitchJNI { public final static native void consoleCleanLog(String jarg1); public final static native boolean running(); public final static native boolean email(String jarg1, String jarg2, String jarg3, String jarg4, String jarg5, String jarg6, String jarg7); - public final static native long new_IVRMenu(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4, String jarg5, String jarg6, String jarg7, String jarg8, String jarg9, String jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16); + public final static native long new_IVRMenu(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4, String jarg5, String jarg6, String jarg7, String jarg8, String jarg9, String jarg10, String jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17); public final static native void delete_IVRMenu(long jarg1); public final static native void IVRMenu_bindAction(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4); public final static native void IVRMenu_execute(long jarg1, IVRMenu jarg1_, long jarg2, CoreSession jarg2_, String jarg3); diff --git a/src/mod/languages/mod_java/switch_swig_wrap.cpp b/src/mod/languages/mod_java/switch_swig_wrap.cpp index 24693243b3..eaf160ba9c 100644 --- a/src/mod/languages/mod_java/switch_swig_wrap.cpp +++ b/src/mod/languages/mod_java/switch_swig_wrap.cpp @@ -360,7 +360,7 @@ SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_email(JNIEnv } -SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1IVRMenu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jstring jarg6, jstring jarg7, jstring jarg8, jstring jarg9, jstring jarg10, jint jarg11, jint jarg12, jint jarg13, jint jarg14, jint jarg15, jint jarg16) { +SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1IVRMenu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jstring jarg6, jstring jarg7, jstring jarg8, jstring jarg9, jstring jarg10, jstring jarg11, jint jarg12, jint jarg13, jint jarg14, jint jarg15, jint jarg16, jint jarg17) { jlong jresult = 0 ; IVRMenu *arg1 = (IVRMenu *) 0 ; char *arg2 = (char *) 0 ; @@ -372,12 +372,13 @@ SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1IVRMenu(JNI char *arg8 = (char *) 0 ; char *arg9 = (char *) 0 ; char *arg10 = (char *) 0 ; - int arg11 ; + char *arg11 = (char *) 0 ; int arg12 ; int arg13 ; int arg14 ; int arg15 ; int arg16 ; + int arg17 ; IVRMenu *result = 0 ; (void)jenv; @@ -429,13 +430,18 @@ SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1IVRMenu(JNI arg10 = (char *)jenv->GetStringUTFChars(jarg10, 0); if (!arg10) return 0; } - arg11 = (int)jarg11; + arg11 = 0; + if (jarg11) { + arg11 = (char *)jenv->GetStringUTFChars(jarg11, 0); + if (!arg11) return 0; + } arg12 = (int)jarg12; arg13 = (int)jarg13; arg14 = (int)jarg14; arg15 = (int)jarg15; arg16 = (int)jarg16; - result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,arg12,arg13,arg14,arg15,arg16); + arg17 = (int)jarg17; + result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,arg12,arg13,arg14,arg15,arg16,arg17); *(IVRMenu **)&jresult = result; if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); @@ -446,6 +452,7 @@ SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1IVRMenu(JNI if (arg8) jenv->ReleaseStringUTFChars(jarg8, (const char *)arg8); if (arg9) jenv->ReleaseStringUTFChars(jarg9, (const char *)arg9); if (arg10) jenv->ReleaseStringUTFChars(jarg10, (const char *)arg10); + if (arg11) jenv->ReleaseStringUTFChars(jarg11, (const char *)arg11); return jresult; } diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 686b892b51..6f1b81cabe 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -2186,12 +2186,13 @@ XS(_wrap_new_IVRMenu) { char *arg8 = (char *) 0 ; char *arg9 = (char *) 0 ; char *arg10 = (char *) 0 ; - int arg11 ; + char *arg11 = (char *) 0 ; int arg12 ; int arg13 ; int arg14 ; int arg15 ; int arg16 ; + int arg17 ; IVRMenu *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -2222,8 +2223,9 @@ XS(_wrap_new_IVRMenu) { int res10 ; char *buf10 = 0 ; int alloc10 = 0 ; - int val11 ; - int ecode11 = 0 ; + int res11 ; + char *buf11 = 0 ; + int alloc11 = 0 ; int val12 ; int ecode12 = 0 ; int val13 ; @@ -2234,11 +2236,13 @@ XS(_wrap_new_IVRMenu) { int ecode15 = 0 ; int val16 ; int ecode16 = 0 ; + int val17 ; + int ecode17 = 0 ; int argvi = 0; dXSARGS; - if ((items < 16) || (items > 16)) { - SWIG_croak("Usage: new_IVRMenu(main,name,greeting_sound,short_greeting_sound,invalid_sound,exit_sound,confirm_macro,confirm_key,tts_engine,tts_voice,confirm_attempts,inter_timeout,digit_len,timeout,max_failures,max_timeouts);"); + if ((items < 17) || (items > 17)) { + SWIG_croak("Usage: new_IVRMenu(main,name,greeting_sound,short_greeting_sound,invalid_sound,exit_sound,transfer_sound,confirm_macro,confirm_key,tts_engine,tts_voice,confirm_attempts,inter_timeout,digit_len,timeout,max_failures,max_timeouts);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 ); if (!SWIG_IsOK(res1)) { @@ -2290,11 +2294,11 @@ XS(_wrap_new_IVRMenu) { SWIG_exception_fail(SWIG_ArgError(res10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "char const *""'"); } arg10 = reinterpret_cast< char * >(buf10); - ecode11 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(10), &val11); - if (!SWIG_IsOK(ecode11)) { - SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "int""'"); - } - arg11 = static_cast< int >(val11); + res11 = SWIG_AsCharPtrAndSize(ST(10), &buf11, NULL, &alloc11); + if (!SWIG_IsOK(res11)) { + SWIG_exception_fail(SWIG_ArgError(res11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "char const *""'"); + } + arg11 = reinterpret_cast< char * >(buf11); ecode12 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(11), &val12); if (!SWIG_IsOK(ecode12)) { SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12"" of type '" "int""'"); @@ -2320,7 +2324,12 @@ XS(_wrap_new_IVRMenu) { SWIG_exception_fail(SWIG_ArgError(ecode16), "in method '" "new_IVRMenu" "', argument " "16"" of type '" "int""'"); } arg16 = static_cast< int >(val16); - result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,arg12,arg13,arg14,arg15,arg16); + ecode17 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(16), &val17); + if (!SWIG_IsOK(ecode17)) { + SWIG_exception_fail(SWIG_ArgError(ecode17), "in method '" "new_IVRMenu" "', argument " "17"" of type '" "int""'"); + } + arg17 = static_cast< int >(val17); + result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,arg12,arg13,arg14,arg15,arg16,arg17); ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_OWNER | SWIG_SHADOW); argvi++ ; if (alloc2 == SWIG_NEWOBJ) delete[] buf2; @@ -2332,6 +2341,7 @@ XS(_wrap_new_IVRMenu) { if (alloc8 == SWIG_NEWOBJ) delete[] buf8; if (alloc9 == SWIG_NEWOBJ) delete[] buf9; if (alloc10 == SWIG_NEWOBJ) delete[] buf10; + if (alloc11 == SWIG_NEWOBJ) delete[] buf11; @@ -2350,6 +2360,7 @@ XS(_wrap_new_IVRMenu) { if (alloc8 == SWIG_NEWOBJ) delete[] buf8; if (alloc9 == SWIG_NEWOBJ) delete[] buf9; if (alloc10 == SWIG_NEWOBJ) delete[] buf10; + if (alloc11 == SWIG_NEWOBJ) delete[] buf11; diff --git a/src/mod/languages/mod_python/mod_python_wrap.cpp b/src/mod/languages/mod_python/mod_python_wrap.cpp index 3faae3bc82..caecd70d5b 100644 --- a/src/mod/languages/mod_python/mod_python_wrap.cpp +++ b/src/mod/languages/mod_python/mod_python_wrap.cpp @@ -3265,12 +3265,13 @@ SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject char *arg8 = (char *) 0 ; char *arg9 = (char *) 0 ; char *arg10 = (char *) 0 ; - int arg11 ; + char *arg11 = (char *) 0 ; int arg12 ; int arg13 ; int arg14 ; int arg15 ; int arg16 ; + int arg17 ; IVRMenu *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -3301,8 +3302,9 @@ SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject int res10 ; char *buf10 = 0 ; int alloc10 = 0 ; - int val11 ; - int ecode11 = 0 ; + int res11 ; + char *buf11 = 0 ; + int alloc11 = 0 ; int val12 ; int ecode12 = 0 ; int val13 ; @@ -3313,6 +3315,8 @@ SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject int ecode15 = 0 ; int val16 ; int ecode16 = 0 ; + int val17 ; + int ecode17 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -3329,8 +3333,9 @@ SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject PyObject * obj13 = 0 ; PyObject * obj14 = 0 ; PyObject * obj15 = 0 ; + PyObject * obj16 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOOOO:new_IVRMenu",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13,&obj14,&obj15)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOOOOO:new_IVRMenu",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13,&obj14,&obj15,&obj16)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'"); @@ -3381,11 +3386,11 @@ SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject SWIG_exception_fail(SWIG_ArgError(res10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "char const *""'"); } arg10 = reinterpret_cast< char * >(buf10); - ecode11 = SWIG_AsVal_int(obj10, &val11); - if (!SWIG_IsOK(ecode11)) { - SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "int""'"); - } - arg11 = static_cast< int >(val11); + res11 = SWIG_AsCharPtrAndSize(obj10, &buf11, NULL, &alloc11); + if (!SWIG_IsOK(res11)) { + SWIG_exception_fail(SWIG_ArgError(res11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "char const *""'"); + } + arg11 = reinterpret_cast< char * >(buf11); ecode12 = SWIG_AsVal_int(obj11, &val12); if (!SWIG_IsOK(ecode12)) { SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12"" of type '" "int""'"); @@ -3411,7 +3416,12 @@ SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject SWIG_exception_fail(SWIG_ArgError(ecode16), "in method '" "new_IVRMenu" "', argument " "16"" of type '" "int""'"); } arg16 = static_cast< int >(val16); - result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,arg12,arg13,arg14,arg15,arg16); + ecode17 = SWIG_AsVal_int(obj16, &val17); + if (!SWIG_IsOK(ecode17)) { + SWIG_exception_fail(SWIG_ArgError(ecode17), "in method '" "new_IVRMenu" "', argument " "17"" of type '" "int""'"); + } + arg17 = static_cast< int >(val17); + result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,arg12,arg13,arg14,arg15,arg16,arg17); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_POINTER_NEW | 0 ); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; if (alloc3 == SWIG_NEWOBJ) delete[] buf3; @@ -3422,6 +3432,7 @@ SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject if (alloc8 == SWIG_NEWOBJ) delete[] buf8; if (alloc9 == SWIG_NEWOBJ) delete[] buf9; if (alloc10 == SWIG_NEWOBJ) delete[] buf10; + if (alloc11 == SWIG_NEWOBJ) delete[] buf11; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; @@ -3433,6 +3444,7 @@ fail: if (alloc8 == SWIG_NEWOBJ) delete[] buf8; if (alloc9 == SWIG_NEWOBJ) delete[] buf9; if (alloc10 == SWIG_NEWOBJ) delete[] buf10; + if (alloc11 == SWIG_NEWOBJ) delete[] buf11; return NULL; } From 84c3e3ade2c4fb44965d87c9919bfcaff15d34e8 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 25 Jul 2013 14:12:26 -0500 Subject: [PATCH 32/88] FS-5572 --resolve set new variable by doing export bypass_keep_codec=true to force re-invite with the same codec it was using previously --- src/switch_core_media.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 22e082d90d..1230fbb254 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -6701,6 +6701,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se } switch_core_media_set_local_sdp(session, NULL, SWITCH_FALSE); + if (switch_true(switch_channel_get_variable(session->channel, "bypass_keep_codec"))) { + switch_channel_set_variable(session->channel, "absolute_codec_string", switch_channel_get_variable(session->channel, "ep_codec_string")); + } + + if ((uuid = switch_channel_get_partner_uuid(session->channel)) && (other_session = switch_core_session_locate(uuid))) { other_channel = switch_core_session_get_channel(other_session); From d4c7ae05fe20a8aa8f854d0b7e7f49ae09bb705a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 25 Jul 2013 14:53:11 -0500 Subject: [PATCH 33/88] let sched_cancel operate on both task id and group id --- src/mod/applications/mod_dptools/mod_dptools.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 0b07a72438..61440cfbef 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1343,7 +1343,16 @@ SWITCH_STANDARD_APP(sched_cancel_function) if (zstr(group)) { group = switch_core_session_get_uuid(session); } - switch_scheduler_del_task_group(group); + + if (switch_is_digit_string(group)) { + int64_t tmp; + tmp = (uint32_t) atoi(group); + if (tmp > 0) { + switch_scheduler_del_task_id((uint32_t) tmp); + } + } else { + switch_scheduler_del_task_group(group); + } } static void base_set (switch_core_session_t *session, const char *data, switch_stack_t stack) From b79932550f835cbc72677cf44a682a6c94d1d625 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 26 Jul 2013 01:12:59 +0000 Subject: [PATCH 34/88] Fix memset invocation in mod_skypopen We were previously clearing a pointer's worth of memory rather than clearing a full element. This also fixes the build as gcc-4.8 catches this error. --- src/mod/endpoints/mod_skypopen/skypopen_protocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 320c95483b..b1542a39cc 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -522,7 +522,7 @@ int skypopen_signaling_read(private_t *tech_pvt) tech_pvt->chatmessages[i].from_handle, tech_pvt->chatmessages[i].from_dispname, tech_pvt->chatmessages[i].body); if (strcmp(tech_pvt->chatmessages[i].from_handle, tech_pvt->skype_user)) { //if the message was not sent by myself incoming_chatmessage(tech_pvt, i); - memset(&tech_pvt->chatmessages[i], '\0', sizeof(&tech_pvt->chatmessages[i])); + memset(&tech_pvt->chatmessages[i], '\0', sizeof(tech_pvt->chatmessages[i])); sprintf(msg_to_skype, "SET CHATMESSAGE %s SEEN", id); skypopen_signaling_write(tech_pvt, msg_to_skype); @@ -531,7 +531,7 @@ int skypopen_signaling_read(private_t *tech_pvt) ("CHATMESSAGE %s is in position %d in the chatmessages array, type=%s, id=%s, chatname=%s, from_handle=%s, from_dispname=%s, body=%s NOT DELETED\n", SKYPOPEN_P_LOG, id, i, tech_pvt->chatmessages[i].type, tech_pvt->chatmessages[i].id, tech_pvt->chatmessages[i].chatname, tech_pvt->chatmessages[i].from_handle, tech_pvt->chatmessages[i].from_dispname, tech_pvt->chatmessages[i].body); - memset(&tech_pvt->chatmessages[i], '\0', sizeof(&tech_pvt->chatmessages[i])); + memset(&tech_pvt->chatmessages[i], '\0', sizeof(tech_pvt->chatmessages[i])); DEBUGA_SKYPE("chatmessage %s HAS BEEN DELETED\n", SKYPOPEN_P_LOG, id); } From a4bc98a775db896b0fef7cfc0fd584eee9a6e8dc Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 26 Jul 2013 10:24:19 -0500 Subject: [PATCH 35/88] FS-5643 --resolve this is the kind of regressions we need to keep an eye on from the refactoring of the media code. I removed the codec_ms from the engine in addition to applying your patch --- src/switch_core_media.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 1230fbb254..96ab5f7892 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -117,7 +117,6 @@ typedef struct switch_rtp_engine_s { switch_codec_implementation_t read_impl; switch_codec_implementation_t write_impl; - uint32_t codec_ms; switch_size_t last_ts; uint32_t check_frames; uint32_t mismatch_count; @@ -1360,7 +1359,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session engine->last_codec_ms = codec_ms; if (engine->mismatch_count > MAX_MISMATCH_FRAMES) { - if (switch_rtp_ready(engine->rtp_session) && codec_ms != engine->codec_ms) { + if (switch_rtp_ready(engine->rtp_session) && codec_ms != engine->codec_params.codec_ms) { const char *val; int rtp_timeout_sec = 0; int rtp_hold_timeout_sec = 0; @@ -1376,17 +1375,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session engine->read_frame.datalen = 0; - if (codec_ms != engine->codec_ms) { + if (codec_ms != engine->codec_params.codec_ms) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Asynchronous PTIME not supported, changing our end from %d to %d\n", - (int) engine->codec_ms, + (int) engine->codec_params.codec_ms, (int) codec_ms ); switch_channel_set_variable_printf(session->channel, "rtp_h_X-Broken-PTIME", "Adv=%d;Sent=%d", - (int) engine->codec_ms, (int) codec_ms); + (int) engine->codec_params.codec_ms, (int) codec_ms); - engine->codec_ms = codec_ms; + engine->codec_params.codec_ms = codec_ms; } From bc851de2007626e76276152842cb93b1d37a2488 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 26 Jul 2013 11:27:45 -0500 Subject: [PATCH 36/88] FS-5642 FS-5556 --resolve I have not tested this yet for the connect but I fixed the seg for sure which was an outstanding issue in 5556 reopen 5642 if connect still doesnt work --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/tport/tport.c | 16 ++++++++++------ .../libsofia-sip-ua/tport/tport_type_ws.c | 6 +++++- libs/sofia-sip/libsofia-sip-ua/tport/ws.c | 14 ++++++++++++-- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 17253549d1..4dc866b6d6 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Thu Jul 11 17:38:06 CDT 2013 +Fri Jul 26 11:26:00 CDT 2013 diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport.c index 6cbb4336ce..50050e2289 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport.c @@ -885,12 +885,16 @@ tport_t *tport_alloc_secondary(tport_primary_t *pri, self->tp_stime = self->tp_ktime = self->tp_rtime = su_now(); if (pri->pri_vtable->vtp_init_secondary && - pri->pri_vtable->vtp_init_secondary(self, socket, accepted, - return_reason) < 0) { - if (pri->pri_vtable->vtp_deinit_secondary) - pri->pri_vtable->vtp_deinit_secondary(self); - su_home_zap(self->tp_home); - return NULL; + + pri->pri_vtable->vtp_init_secondary(self, socket, accepted, return_reason) < 0) { + + if (pri->pri_vtable->vtp_deinit_secondary) { + pri->pri_vtable->vtp_deinit_secondary(self); + } + su_timer_destroy(self->tp_timer); + su_home_zap(self->tp_home); + + return NULL; } /* Set IP TOS if it is set in primary */ diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c index 22c56ef07f..67f78148fb 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c @@ -456,13 +456,17 @@ int tport_ws_init_secondary(tport_t *self, int socket, int accepted, if ( wspri->ws_secure ) wstp->ws_secure = 1; memset(&wstp->ws, 0, sizeof(wstp->ws)); - + if (ws_init(&wstp->ws, socket, wstp->ws_secure ? wspri->ssl_ctx : NULL, 0) < 0) { + ws_destroy(&wstp->ws); + su_close(socket); + wstp->ws_initialized = -1; return *return_reason = "WS_INIT", -1; } wstp->ws_initialized = 1; self->tp_pre_framed = 1; + return 0; diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c index 33d984a9d5..35fb4c0f22 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c @@ -242,6 +242,10 @@ int ws_handshake(wsh_t *wsh) } } + if (bytes > sizeof(wsh->buffer)) { + goto err; + } + *(wsh->buffer+bytes) = '\0'; if (strncasecmp(wsh->buffer, "GET ", 4)) { @@ -325,7 +329,8 @@ issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes) #else if (x++) Sleep(10); #endif - } while (r == -1 && (errno == EAGAIN || errno == EINTR) && x < 100); + } while (r == -1 && (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK || + errno == 35 || errno == 730035 || errno == 2 || errno == 60) && x < 100); if (x >= 100) { r = -1; @@ -462,7 +467,12 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock) } while (!wsh->down && !wsh->handshake) { - ws_handshake(wsh); + int r = ws_handshake(wsh); + + if (r < 0) { + wsh->down = 1; + return -1; + } } if (wsh->down) { From 9fc3990e0420d528c5d917879f1f8fafa7dba7aa Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 3 Jul 2013 06:31:59 +0000 Subject: [PATCH 37/88] Add -reincarnate flag to FS When FS is given the -reincarnate flag, FS will be automatically restarted after any uncontrolled exit. --- src/switch.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/switch.c b/src/switch.c index cdd383f7a2..6afdbcbd38 100644 --- a/src/switch.c +++ b/src/switch.c @@ -357,6 +357,32 @@ static void daemonize(int *fds) return; } +static void reincarnate_protect(char **argv) { + int i; + refork: + if ((i=fork())) { /* parent */ + int s; pid_t r; + rewait: + r = waitpid(i, &s, 0); + if (r == (pid_t)-1) { + if (errno == EINTR) goto rewait; + exit(EXIT_FAILURE); + } + if (r != i) goto rewait; + if (WIFEXITED(s) + && (WEXITSTATUS(s) == EXIT_SUCCESS + || WEXITSTATUS(s) == EXIT_FAILURE)) { + exit(WEXITSTATUS(s)); + } + if (WIFEXITED(s) || WIFSIGNALED(s)) { + if (argv) { + execv(argv[0], argv); return; + } else goto refork; + } + goto rewait; + } +} + #endif static const char usage[] = @@ -369,6 +395,8 @@ static const char usage[] = "\t-monotonic-clock -- use monotonic clock as timer source\n" #else "\t-nf -- no forking\n" + "\t-reincarnate -- restart the switch on an uncontrolled exit\n" + "\t-reincarnate-reexec -- run execv on a restart (helpful for upgrades)\n" "\t-u [user] -- specify user to switch to\n" "\t-g [group] -- specify group to switch to\n" #endif @@ -437,6 +465,7 @@ int main(int argc, char *argv[]) switch_bool_t do_wait = SWITCH_FALSE; char *runas_user = NULL; char *runas_group = NULL; + switch_bool_t reincarnate = SWITCH_FALSE, reincarnate_reexec = SWITCH_FALSE; int fds[2] = { 0, 0 }; #else switch_bool_t win32_service = SWITCH_FALSE; @@ -612,6 +641,14 @@ int main(int argc, char *argv[]) nf = SWITCH_TRUE; } + else if (!strcmp(local_argv[x], "-reincarnate")) { + reincarnate = SWITCH_TRUE; + } + else if (!strcmp(local_argv[x], "-reincarnate-reexec")) { + reincarnate = SWITCH_TRUE; + reincarnate_reexec = SWITCH_TRUE; + } + else if (!strcmp(local_argv[x], "-version")) { fprintf(stdout, "FreeSWITCH version: %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_REVISION_HUMAN); exit(EXIT_SUCCESS); @@ -994,6 +1031,10 @@ int main(int argc, char *argv[]) } #endif } +#ifndef WIN32 + if (reincarnate) + reincarnate_protect(reincarnate_reexec ? argv : NULL); +#endif switch (priority) { case 2: From 9959096559df3014d18b1ab98943baca52ea90e6 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 26 Jul 2013 03:35:46 +0000 Subject: [PATCH 38/88] Handle signals better with -reincarnate If we receive SIGTERM or SIGILL we should propagate the signal to the child FS process. As FS normally handles these signals, we need to restore the handler before we refork. FS may also add a handler for SIGCHLD; we need the default action here instead for the parent. --- src/switch.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/switch.c b/src/switch.c index 6afdbcbd38..2a68db473c 100644 --- a/src/switch.c +++ b/src/switch.c @@ -357,11 +357,25 @@ static void daemonize(int *fds) return; } +static pid_t reincarnate_child = 0; +static void reincarnate_handle_sigterm (int sig) { + if (!sig) return; + if (reincarnate_child) kill(reincarnate_child, sig); + return; +} + static void reincarnate_protect(char **argv) { - int i; + int i; struct sigaction sa, sa_dfl, sa4_prev, sa15_prev, sa17_prev; + memset(&sa, 0, sizeof(sa)); memset(&sa_dfl, 0, sizeof(sa_dfl)); + sa.sa_handler = reincarnate_handle_sigterm; + sa_dfl.sa_handler = SIG_DFL; refork: if ((i=fork())) { /* parent */ int s; pid_t r; + reincarnate_child = i; + sigaction(SIGILL, &sa, &sa4_prev); + sigaction(SIGTERM, &sa, &sa15_prev); + sigaction(SIGCHLD, &sa_dfl, &sa17_prev); rewait: r = waitpid(i, &s, 0); if (r == (pid_t)-1) { @@ -375,6 +389,9 @@ static void reincarnate_protect(char **argv) { exit(WEXITSTATUS(s)); } if (WIFEXITED(s) || WIFSIGNALED(s)) { + sigaction(SIGILL, &sa4_prev, NULL); + sigaction(SIGTERM, &sa15_prev, NULL); + sigaction(SIGCHLD, &sa17_prev, NULL); if (argv) { execv(argv[0], argv); return; } else goto refork; From 1ab16bbd92b0634350ea5161e8071b4de7913b12 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 26 Jul 2013 03:53:34 +0000 Subject: [PATCH 39/88] Kill FS if -reincarnate parent dies unexpectedly This only works on Linux. --- src/switch.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/switch.c b/src/switch.c index 2a68db473c..6ae8e584db 100644 --- a/src/switch.c +++ b/src/switch.c @@ -44,6 +44,10 @@ #endif #endif +#ifdef __linux__ +#include +#endif + #include #include #include "private/switch_core_pvt.h" @@ -397,6 +401,10 @@ static void reincarnate_protect(char **argv) { } else goto refork; } goto rewait; + } else { /* child */ +#ifdef __linux__ + prctl(PR_SET_PDEATHSIG, SIGTERM); +#endif } } From 1a2ca102038d035bbecfa3bc22589a319e9494a2 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 26 Jul 2013 14:30:10 -0500 Subject: [PATCH 40/88] add last_sched_id var --- src/mod/applications/mod_dptools/mod_dptools.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 61440cfbef..ede2d5f742 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1052,6 +1052,8 @@ SWITCH_STANDARD_APP(sched_transfer_function) if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) { if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) { time_t when; + uint32_t id; + char ids[80] = ""; if (*argv[0] == '+') { when = switch_epoch_time_now(NULL) + atol(argv[0] + 1); @@ -1059,7 +1061,9 @@ SWITCH_STANDARD_APP(sched_transfer_function) when = atol(argv[0]); } - switch_ivr_schedule_transfer(when, switch_core_session_get_uuid(session), argv[1], argv[2], argv[3]); + id = switch_ivr_schedule_transfer(when, switch_core_session_get_uuid(session), argv[1], argv[2], argv[3]); + snprintf(ids, sizeof(ids), "%u", id); + switch_channel_set_variable(switch_core_session_get_channel(session), "last_sched_id", ids); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Args\n"); } @@ -1114,6 +1118,8 @@ SWITCH_STANDARD_APP(sched_broadcast_function) if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) { time_t when; switch_media_flag_t flags = SMF_NONE; + uint32_t id; + char ids[80] = ""; if (*argv[0] == '+') { when = switch_epoch_time_now(NULL) + atol(argv[0] + 1); @@ -1133,7 +1139,9 @@ SWITCH_STANDARD_APP(sched_broadcast_function) flags |= SMF_ECHO_ALEG; } - switch_ivr_schedule_broadcast(when, switch_core_session_get_uuid(session), argv[1], flags); + id = switch_ivr_schedule_broadcast(when, switch_core_session_get_uuid(session), argv[1], flags); + snprintf(ids, sizeof(ids), "%u", id); + switch_channel_set_variable(switch_core_session_get_channel(session), "last_sched_id", ids); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Args\n"); } From 7973b7be7aeafe19dda857026a08481eff98191b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 26 Jul 2013 15:56:31 -0500 Subject: [PATCH 41/88] add global mutex to cdr_csv to protech the fd_hash --- src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c b/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c index e7ef5addfc..a268e8d158 100644 --- a/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c +++ b/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c @@ -48,6 +48,7 @@ const char *default_template = static struct { switch_memory_pool_t *pool; + switch_mutex_t *mutex; switch_hash_t *fd_hash; switch_hash_t *template_hash; char *log_dir; @@ -130,6 +131,7 @@ static void write_cdr(const char *path, const char *log_line) unsigned int bytes_in, bytes_out; int loops = 0; + switch_mutex_lock(globals.mutex); if (!(fd = switch_core_hash_find(globals.fd_hash, path))) { fd = switch_core_alloc(globals.pool, sizeof(*fd)); switch_assert(fd); @@ -139,6 +141,7 @@ static void write_cdr(const char *path, const char *log_line) fd->path = switch_core_strdup(globals.pool, path); switch_core_hash_insert(globals.fd_hash, path, fd); } + switch_mutex_unlock(globals.mutex); switch_mutex_lock(fd->mutex); bytes_out = (unsigned) strlen(log_line); @@ -275,6 +278,7 @@ static void do_rotate_all() return; } + switch_mutex_lock(globals.mutex); for (hi = switch_hash_first(NULL, globals.fd_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, NULL, NULL, &val); fd = (cdr_fd_t *) val; @@ -282,6 +286,7 @@ static void do_rotate_all() do_rotate(fd); switch_mutex_unlock(fd->mutex); } + switch_mutex_unlock(globals.mutex); } @@ -410,6 +415,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_csv_load) load_config(pool); + switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); + if ((status = switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, pool)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir); return status; From d0a9574fa94ad3b77b43fd845c218535ec58d0bc Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 26 Jul 2013 21:46:54 +0000 Subject: [PATCH 42/88] debian: Include the .dll file for mod_managed Note that we don't actually support building mod_managed at this time for Debian. FS-5317 --resolve Thanks-to: Artur Kraev --- debian/bootstrap.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 5843872904..41cb413638 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -777,6 +777,9 @@ print_mod_install () { cat < Date: Fri, 26 Jul 2013 21:56:07 +0000 Subject: [PATCH 43/88] debian: Handle mod_managed .dll more idiomatically --- debian/bootstrap.sh | 3 --- debian/freeswitch-mod-managed.install.tmpl | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) create mode 100644 debian/freeswitch-mod-managed.install.tmpl diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 41cb413638..5843872904 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -777,9 +777,6 @@ print_mod_install () { cat < Date: Fri, 26 Jul 2013 22:28:49 +0000 Subject: [PATCH 44/88] debian: Add additional module files for mod_spidermonkey Note that we don't actually support building mod_spidermonkey for Debian at the moment. FS-4552 --- debian/freeswitch-mod-spidermonkey.install.tmpl | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 debian/freeswitch-mod-spidermonkey.install.tmpl diff --git a/debian/freeswitch-mod-spidermonkey.install.tmpl b/debian/freeswitch-mod-spidermonkey.install.tmpl new file mode 100644 index 0000000000..cb98d43c5d --- /dev/null +++ b/debian/freeswitch-mod-spidermonkey.install.tmpl @@ -0,0 +1,5 @@ +/usr/lib/freeswitch/mod/mod_spidermonkey_core_db.so +/usr/lib/freeswitch/mod/mod_spidermonkey_curl.so +/usr/lib/freeswitch/mod/mod_spidermonkey_odbc.so +/usr/lib/freeswitch/mod/mod_spidermonkey_socket.so +/usr/lib/freeswitch/mod/mod_spidermonkey_teletone.so From b9ff5799feb9834355485ad1b7ffb58f13d48609 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 27 Jul 2013 02:58:11 +0000 Subject: [PATCH 45/88] Remove freeswitch.serial from fscomm/conf freeswitch.serial is used by ZRTP as a ZID, so it should not be shared between systems and definitely should not be distributed as a default value by us. --- fscomm/conf/freeswitch.serial | Bin 13 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 fscomm/conf/freeswitch.serial diff --git a/fscomm/conf/freeswitch.serial b/fscomm/conf/freeswitch.serial deleted file mode 100644 index 1ed544960745d0895c01207cc508c32b864f6fbd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13 UcmYdFG&C|aur#qSPBLHs02d4b@&Et; From 5ca22767112b052758b405592d02d3698d832b03 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 27 Jul 2013 03:16:11 +0000 Subject: [PATCH 46/88] Remove autogenerated file from tree This file is specifically ignored by our .gitignore. Brian added this ignore on 2013-06-06 but neglected to remove the file. I've now bulid-tested without the file to be sure that it is indeed generated correctly and so can be removed safely. --- libs/spandsp/src/cielab_luts.h | 4358 -------------------------------- 1 file changed, 4358 deletions(-) delete mode 100644 libs/spandsp/src/cielab_luts.h diff --git a/libs/spandsp/src/cielab_luts.h b/libs/spandsp/src/cielab_luts.h deleted file mode 100644 index 0a3c697915..0000000000 --- a/libs/spandsp/src/cielab_luts.h +++ /dev/null @@ -1,4358 +0,0 @@ -static const float srgb_to_linear[256] = -{ - 0.000000, - 0.000302, - 0.000605, - 0.000907, - 0.001209, - 0.001512, - 0.001814, - 0.002116, - 0.002419, - 0.002721, - 0.003023, - 0.003333, - 0.003661, - 0.004007, - 0.004371, - 0.004754, - 0.005156, - 0.005577, - 0.006017, - 0.006477, - 0.006957, - 0.007457, - 0.007977, - 0.008518, - 0.009080, - 0.009663, - 0.010267, - 0.010893, - 0.011540, - 0.012209, - 0.012900, - 0.013614, - 0.014350, - 0.015109, - 0.015890, - 0.016695, - 0.017523, - 0.018375, - 0.019250, - 0.020149, - 0.021072, - 0.022019, - 0.022991, - 0.023987, - 0.025008, - 0.026054, - 0.027125, - 0.028221, - 0.029343, - 0.030490, - 0.031663, - 0.032862, - 0.034087, - 0.035338, - 0.036616, - 0.037920, - 0.039250, - 0.040608, - 0.041993, - 0.043404, - 0.044844, - 0.046310, - 0.047804, - 0.049326, - 0.050876, - 0.052454, - 0.054060, - 0.055694, - 0.057357, - 0.059049, - 0.060769, - 0.062518, - 0.064296, - 0.066103, - 0.067940, - 0.069806, - 0.071701, - 0.073626, - 0.075581, - 0.077566, - 0.079581, - 0.081627, - 0.083702, - 0.085808, - 0.087945, - 0.090112, - 0.092311, - 0.094540, - 0.096800, - 0.099092, - 0.101414, - 0.103769, - 0.106155, - 0.108572, - 0.111021, - 0.113503, - 0.116016, - 0.118562, - 0.121139, - 0.123750, - 0.126392, - 0.129068, - 0.131776, - 0.134517, - 0.137291, - 0.140098, - 0.142938, - 0.145812, - 0.148719, - 0.151659, - 0.154633, - 0.157641, - 0.160683, - 0.163758, - 0.166868, - 0.170012, - 0.173190, - 0.176403, - 0.179650, - 0.182932, - 0.186248, - 0.189599, - 0.192985, - 0.196407, - 0.199863, - 0.203354, - 0.206881, - 0.210443, - 0.214041, - 0.217675, - 0.221344, - 0.225049, - 0.228789, - 0.232566, - 0.236379, - 0.240229, - 0.244114, - 0.248036, - 0.251995, - 0.255990, - 0.260022, - 0.264090, - 0.268196, - 0.272338, - 0.276518, - 0.280734, - 0.284988, - 0.289280, - 0.293609, - 0.297975, - 0.302379, - 0.306821, - 0.311301, - 0.315818, - 0.320374, - 0.324967, - 0.329599, - 0.334269, - 0.338978, - 0.343725, - 0.348510, - 0.353334, - 0.358197, - 0.363099, - 0.368040, - 0.373019, - 0.378038, - 0.383096, - 0.388193, - 0.393329, - 0.398505, - 0.403721, - 0.408976, - 0.414270, - 0.419605, - 0.424979, - 0.430393, - 0.435848, - 0.441342, - 0.446877, - 0.452452, - 0.458067, - 0.463722, - 0.469419, - 0.475156, - 0.480933, - 0.486751, - 0.492610, - 0.498510, - 0.504452, - 0.510434, - 0.516457, - 0.522522, - 0.528628, - 0.534775, - 0.540964, - 0.547194, - 0.553466, - 0.559780, - 0.566136, - 0.572533, - 0.578973, - 0.585455, - 0.591978, - 0.598544, - 0.605152, - 0.611803, - 0.618496, - 0.625232, - 0.632010, - 0.638831, - 0.645694, - 0.652600, - 0.659550, - 0.666542, - 0.673577, - 0.680656, - 0.687777, - 0.694942, - 0.702151, - 0.709402, - 0.716698, - 0.724036, - 0.731419, - 0.738845, - 0.746315, - 0.753829, - 0.761386, - 0.768988, - 0.776634, - 0.784324, - 0.792058, - 0.799837, - 0.807660, - 0.815527, - 0.823439, - 0.831396, - 0.839397, - 0.847443, - 0.855534, - 0.863669, - 0.871850, - 0.880075, - 0.888346, - 0.896662, - 0.905023, - 0.913429, - 0.921881, - 0.930378, - 0.938921, - 0.947509, - 0.956143, - 0.964823, - 0.973548, - 0.982319, - 0.991137 -}; -static const uint8_t linear_to_srgb[4096] = -{ - 0, - 0, - 1, - 2, - 3, - 4, - 4, - 5, - 6, - 7, - 8, - 8, - 9, - 10, - 11, - 12, - 12, - 13, - 14, - 14, - 15, - 15, - 16, - 17, - 17, - 18, - 18, - 19, - 19, - 20, - 20, - 21, - 21, - 22, - 22, - 23, - 23, - 23, - 24, - 24, - 25, - 25, - 25, - 26, - 26, - 27, - 27, - 27, - 28, - 28, - 28, - 29, - 29, - 30, - 30, - 30, - 31, - 31, - 31, - 32, - 32, - 32, - 33, - 33, - 33, - 33, - 34, - 34, - 34, - 35, - 35, - 35, - 36, - 36, - 36, - 36, - 37, - 37, - 37, - 38, - 38, - 38, - 38, - 39, - 39, - 39, - 39, - 40, - 40, - 40, - 40, - 41, - 41, - 41, - 41, - 42, - 42, - 42, - 42, - 43, - 43, - 43, - 43, - 44, - 44, - 44, - 44, - 45, - 45, - 45, - 45, - 45, - 46, - 46, - 46, - 46, - 47, - 47, - 47, - 47, - 47, - 48, - 48, - 48, - 48, - 49, - 49, - 49, - 49, - 49, - 50, - 50, - 50, - 50, - 50, - 51, - 51, - 51, - 51, - 51, - 52, - 52, - 52, - 52, - 52, - 53, - 53, - 53, - 53, - 53, - 54, - 54, - 54, - 54, - 54, - 54, - 55, - 55, - 55, - 55, - 55, - 56, - 56, - 56, - 56, - 56, - 56, - 57, - 57, - 57, - 57, - 57, - 57, - 58, - 58, - 58, - 58, - 58, - 59, - 59, - 59, - 59, - 59, - 59, - 60, - 60, - 60, - 60, - 60, - 60, - 61, - 61, - 61, - 61, - 61, - 61, - 62, - 62, - 62, - 62, - 62, - 62, - 62, - 63, - 63, - 63, - 63, - 63, - 63, - 64, - 64, - 64, - 64, - 64, - 64, - 65, - 65, - 65, - 65, - 65, - 65, - 65, - 66, - 66, - 66, - 66, - 66, - 66, - 66, - 67, - 67, - 67, - 67, - 67, - 67, - 68, - 68, - 68, - 68, - 68, - 68, - 68, - 69, - 69, - 69, - 69, - 69, - 69, - 69, - 70, - 70, - 70, - 70, - 70, - 70, - 70, - 70, - 71, - 71, - 71, - 71, - 71, - 71, - 71, - 72, - 72, - 72, - 72, - 72, - 72, - 72, - 73, - 73, - 73, - 73, - 73, - 73, - 73, - 73, - 74, - 74, - 74, - 74, - 74, - 74, - 74, - 75, - 75, - 75, - 75, - 75, - 75, - 75, - 75, - 76, - 76, - 76, - 76, - 76, - 76, - 76, - 76, - 77, - 77, - 77, - 77, - 77, - 77, - 77, - 77, - 78, - 78, - 78, - 78, - 78, - 78, - 78, - 78, - 79, - 79, - 79, - 79, - 79, - 79, - 79, - 79, - 80, - 80, - 80, - 80, - 80, - 80, - 80, - 80, - 80, - 81, - 81, - 81, - 81, - 81, - 81, - 81, - 81, - 82, - 82, - 82, - 82, - 82, - 82, - 82, - 82, - 82, - 83, - 83, - 83, - 83, - 83, - 83, - 83, - 83, - 83, - 84, - 84, - 84, - 84, - 84, - 84, - 84, - 84, - 84, - 85, - 85, - 85, - 85, - 85, - 85, - 85, - 85, - 85, - 86, - 86, - 86, - 86, - 86, - 86, - 86, - 86, - 86, - 87, - 87, - 87, - 87, - 87, - 87, - 87, - 87, - 87, - 88, - 88, - 88, - 88, - 88, - 88, - 88, - 88, - 88, - 89, - 89, - 89, - 89, - 89, - 89, - 89, - 89, - 89, - 89, - 90, - 90, - 90, - 90, - 90, - 90, - 90, - 90, - 90, - 90, - 91, - 91, - 91, - 91, - 91, - 91, - 91, - 91, - 91, - 92, - 92, - 92, - 92, - 92, - 92, - 92, - 92, - 92, - 92, - 93, - 93, - 93, - 93, - 93, - 93, - 93, - 93, - 93, - 93, - 94, - 94, - 94, - 94, - 94, - 94, - 94, - 94, - 94, - 94, - 95, - 95, - 95, - 95, - 95, - 95, - 95, - 95, - 95, - 95, - 95, - 96, - 96, - 96, - 96, - 96, - 96, - 96, - 96, - 96, - 96, - 97, - 97, - 97, - 97, - 97, - 97, - 97, - 97, - 97, - 97, - 97, - 98, - 98, - 98, - 98, - 98, - 98, - 98, - 98, - 98, - 98, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 100, - 100, - 100, - 100, - 100, - 100, - 100, - 100, - 100, - 100, - 100, - 101, - 101, - 101, - 101, - 101, - 101, - 101, - 101, - 101, - 101, - 101, - 102, - 102, - 102, - 102, - 102, - 102, - 102, - 102, - 102, - 102, - 102, - 103, - 103, - 103, - 103, - 103, - 103, - 103, - 103, - 103, - 103, - 103, - 103, - 104, - 104, - 104, - 104, - 104, - 104, - 104, - 104, - 104, - 104, - 104, - 105, - 105, - 105, - 105, - 105, - 105, - 105, - 105, - 105, - 105, - 105, - 105, - 106, - 106, - 106, - 106, - 106, - 106, - 106, - 106, - 106, - 106, - 106, - 106, - 107, - 107, - 107, - 107, - 107, - 107, - 107, - 107, - 107, - 107, - 107, - 107, - 108, - 108, - 108, - 108, - 108, - 108, - 108, - 108, - 108, - 108, - 108, - 108, - 109, - 109, - 109, - 109, - 109, - 109, - 109, - 109, - 109, - 109, - 109, - 109, - 110, - 110, - 110, - 110, - 110, - 110, - 110, - 110, - 110, - 110, - 110, - 110, - 111, - 111, - 111, - 111, - 111, - 111, - 111, - 111, - 111, - 111, - 111, - 111, - 111, - 112, - 112, - 112, - 112, - 112, - 112, - 112, - 112, - 112, - 112, - 112, - 112, - 113, - 113, - 113, - 113, - 113, - 113, - 113, - 113, - 113, - 113, - 113, - 113, - 113, - 114, - 114, - 114, - 114, - 114, - 114, - 114, - 114, - 114, - 114, - 114, - 114, - 114, - 115, - 115, - 115, - 115, - 115, - 115, - 115, - 115, - 115, - 115, - 115, - 115, - 115, - 116, - 116, - 116, - 116, - 116, - 116, - 116, - 116, - 116, - 116, - 116, - 116, - 116, - 117, - 117, - 117, - 117, - 117, - 117, - 117, - 117, - 117, - 117, - 117, - 117, - 117, - 118, - 118, - 118, - 118, - 118, - 118, - 118, - 118, - 118, - 118, - 118, - 118, - 118, - 118, - 119, - 119, - 119, - 119, - 119, - 119, - 119, - 119, - 119, - 119, - 119, - 119, - 119, - 120, - 120, - 120, - 120, - 120, - 120, - 120, - 120, - 120, - 120, - 120, - 120, - 120, - 120, - 121, - 121, - 121, - 121, - 121, - 121, - 121, - 121, - 121, - 121, - 121, - 121, - 121, - 121, - 122, - 122, - 122, - 122, - 122, - 122, - 122, - 122, - 122, - 122, - 122, - 122, - 122, - 122, - 123, - 123, - 123, - 123, - 123, - 123, - 123, - 123, - 123, - 123, - 123, - 123, - 123, - 123, - 124, - 124, - 124, - 124, - 124, - 124, - 124, - 124, - 124, - 124, - 124, - 124, - 124, - 124, - 125, - 125, - 125, - 125, - 125, - 125, - 125, - 125, - 125, - 125, - 125, - 125, - 125, - 125, - 125, - 126, - 126, - 126, - 126, - 126, - 126, - 126, - 126, - 126, - 126, - 126, - 126, - 126, - 126, - 127, - 127, - 127, - 127, - 127, - 127, - 127, - 127, - 127, - 127, - 127, - 127, - 127, - 127, - 127, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 129, - 129, - 129, - 129, - 129, - 129, - 129, - 129, - 129, - 129, - 129, - 129, - 129, - 129, - 129, - 130, - 130, - 130, - 130, - 130, - 130, - 130, - 130, - 130, - 130, - 130, - 130, - 130, - 130, - 130, - 131, - 131, - 131, - 131, - 131, - 131, - 131, - 131, - 131, - 131, - 131, - 131, - 131, - 131, - 131, - 131, - 132, - 132, - 132, - 132, - 132, - 132, - 132, - 132, - 132, - 132, - 132, - 132, - 132, - 132, - 132, - 133, - 133, - 133, - 133, - 133, - 133, - 133, - 133, - 133, - 133, - 133, - 133, - 133, - 133, - 133, - 133, - 134, - 134, - 134, - 134, - 134, - 134, - 134, - 134, - 134, - 134, - 134, - 134, - 134, - 134, - 134, - 135, - 135, - 135, - 135, - 135, - 135, - 135, - 135, - 135, - 135, - 135, - 135, - 135, - 135, - 135, - 135, - 136, - 136, - 136, - 136, - 136, - 136, - 136, - 136, - 136, - 136, - 136, - 136, - 136, - 136, - 136, - 136, - 137, - 137, - 137, - 137, - 137, - 137, - 137, - 137, - 137, - 137, - 137, - 137, - 137, - 137, - 137, - 137, - 137, - 138, - 138, - 138, - 138, - 138, - 138, - 138, - 138, - 138, - 138, - 138, - 138, - 138, - 138, - 138, - 138, - 139, - 139, - 139, - 139, - 139, - 139, - 139, - 139, - 139, - 139, - 139, - 139, - 139, - 139, - 139, - 139, - 139, - 140, - 140, - 140, - 140, - 140, - 140, - 140, - 140, - 140, - 140, - 140, - 140, - 140, - 140, - 140, - 140, - 141, - 141, - 141, - 141, - 141, - 141, - 141, - 141, - 141, - 141, - 141, - 141, - 141, - 141, - 141, - 141, - 141, - 142, - 142, - 142, - 142, - 142, - 142, - 142, - 142, - 142, - 142, - 142, - 142, - 142, - 142, - 142, - 142, - 142, - 143, - 143, - 143, - 143, - 143, - 143, - 143, - 143, - 143, - 143, - 143, - 143, - 143, - 143, - 143, - 143, - 143, - 144, - 144, - 144, - 144, - 144, - 144, - 144, - 144, - 144, - 144, - 144, - 144, - 144, - 144, - 144, - 144, - 144, - 145, - 145, - 145, - 145, - 145, - 145, - 145, - 145, - 145, - 145, - 145, - 145, - 145, - 145, - 145, - 145, - 145, - 145, - 146, - 146, - 146, - 146, - 146, - 146, - 146, - 146, - 146, - 146, - 146, - 146, - 146, - 146, - 146, - 146, - 146, - 147, - 147, - 147, - 147, - 147, - 147, - 147, - 147, - 147, - 147, - 147, - 147, - 147, - 147, - 147, - 147, - 147, - 147, - 148, - 148, - 148, - 148, - 148, - 148, - 148, - 148, - 148, - 148, - 148, - 148, - 148, - 148, - 148, - 148, - 148, - 148, - 149, - 149, - 149, - 149, - 149, - 149, - 149, - 149, - 149, - 149, - 149, - 149, - 149, - 149, - 149, - 149, - 149, - 149, - 150, - 150, - 150, - 150, - 150, - 150, - 150, - 150, - 150, - 150, - 150, - 150, - 150, - 150, - 150, - 150, - 150, - 150, - 151, - 151, - 151, - 151, - 151, - 151, - 151, - 151, - 151, - 151, - 151, - 151, - 151, - 151, - 151, - 151, - 151, - 151, - 151, - 152, - 152, - 152, - 152, - 152, - 152, - 152, - 152, - 152, - 152, - 152, - 152, - 152, - 152, - 152, - 152, - 152, - 152, - 153, - 153, - 153, - 153, - 153, - 153, - 153, - 153, - 153, - 153, - 153, - 153, - 153, - 153, - 153, - 153, - 153, - 153, - 153, - 154, - 154, - 154, - 154, - 154, - 154, - 154, - 154, - 154, - 154, - 154, - 154, - 154, - 154, - 154, - 154, - 154, - 154, - 154, - 155, - 155, - 155, - 155, - 155, - 155, - 155, - 155, - 155, - 155, - 155, - 155, - 155, - 155, - 155, - 155, - 155, - 155, - 155, - 156, - 156, - 156, - 156, - 156, - 156, - 156, - 156, - 156, - 156, - 156, - 156, - 156, - 156, - 156, - 156, - 156, - 156, - 156, - 157, - 157, - 157, - 157, - 157, - 157, - 157, - 157, - 157, - 157, - 157, - 157, - 157, - 157, - 157, - 157, - 157, - 157, - 157, - 158, - 158, - 158, - 158, - 158, - 158, - 158, - 158, - 158, - 158, - 158, - 158, - 158, - 158, - 158, - 158, - 158, - 158, - 158, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 159, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 160, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 161, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 162, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 163, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 164, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 165, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 166, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 167, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 168, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 169, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 171, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 172, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 173, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 174, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 175, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 176, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 177, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 178, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 179, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 180, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 181, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 182, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 183, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 184, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 185, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 186, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 187, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 188, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 189, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 190, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 191, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 193, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 194, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 195, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 196, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 197, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 198, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 199, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 201, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 202, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 203, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 204, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 205, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 206, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 207, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 208, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 209, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 210, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 211, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 214, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 215, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 217, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 218, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 219, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 220, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 221, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 222, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 223, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 225, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 226, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 227, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 228, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 229, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 230, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 231, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 232, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 233, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 234, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 235, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 236, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 237, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 238, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 239, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 240, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 241, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 242, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 243, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 244, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 245, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 246, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 247, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 248, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 249, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 251, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 252, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 253, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255, - 255 -}; From 6a5595b049075a58240c327718129cf3870c285c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 27 Jul 2013 02:54:26 +0000 Subject: [PATCH 47/88] Improve our .gitignore files Avoid ignoring files actually in our tree, and ignore some generated files that were not being ignored previously. --- .gitignore | 6 +++--- libs/.gitignore | 43 ++++++++++++++++++++++++++++++++++++++++- libs/freetdm/.gitignore | 3 +++ libs/openzap/.gitignore | 3 +++ src/mod/.gitignore | 6 +++++- 5 files changed, 56 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 69f8cb476e..514e756904 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ *.tbz2 *.deb *.swp +*.serial aclocal.m4 autom4te.cache config.cache @@ -153,7 +154,8 @@ Release/ /src/mod/applications/mod_osp/Makefile.in /src/mod/applications/mod_rss/Makefile /src/mod/applications/mod_snipe_hunt/Makefile -/src/mod/codecs/mod_com_g729/ +/src/mod/codecs/mod_com_g729/Makefile +/src/mod/codecs/mod_com_g729/Makefile.in /src/mod/codecs/mod_dahdi_codec/Makefile /src/mod/dialplans/mod_dialplan_directory/Makefile /src/mod/formats/mod_shell_stream/Makefile @@ -170,8 +172,6 @@ Release/ BuildLog.htm -Win32/ -win32/ !/libs/win32/ !/libs/speex/win32/ !/src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib-1.10-patched-13ubuntu/win32/ diff --git a/libs/.gitignore b/libs/.gitignore index 9bf6e4bab6..8fca0c8c42 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -238,16 +238,48 @@ opal /ldns/Makefile /ldns/packaging/ldns-config /libcodec2/src/c2dec +/libcodec2/src/c2demo /libcodec2/src/c2enc /libcodec2/src/c2sim +/libcodec2/src/codebook.c +/libcodec2/src/codebookd.c +/libcodec2/src/codebookdt.c +/libcodec2/src/codebookge.c +/libcodec2/src/codebookjnd.c +/libcodec2/src/codebookjvm.c +/libcodec2/src/codebookvqanssi.c +/libcodec2/src/fdmdv_demod +/libcodec2/src/fdmdv_get_test_bits +/libcodec2/src/fdmdv_interleave +/libcodec2/src/fdmdv_mod +/libcodec2/src/fdmdv_put_test_bits +/libcodec2/src/generate_codebook +/libcodec2/src/genlspdtcb +/libcodec2/unittest/create_interleaver +/libcodec2/unittest/de /libcodec2/unittest/extract +/libcodec2/unittest/genampdata /libcodec2/unittest/genlsp +/libcodec2/unittest/genphdata /libcodec2/unittest/genres +/libcodec2/unittest/lspsync +/libcodec2/unittest/polar2rect +/libcodec2/unittest/pre +/libcodec2/unittest/scalarlsptest +/libcodec2/unittest/t48_8 /libcodec2/unittest/tcodec2 +/libcodec2/unittest/tfdmdv +/libcodec2/unittest/tfifo /libcodec2/unittest/tinterp +/libcodec2/unittest/tlspsens /libcodec2/unittest/tnlp +/libcodec2/unittest/tprede /libcodec2/unittest/tquant +/libcodec2/unittest/vq_train_jvm /libcodec2/unittest/vqtrain +/libcodec2/unittest/vqtrainjnd +/libcodec2/unittest/vqtrainph +/libcodec2/unittest/vqtrainsp /libdingaling/build/compile /libdingaling/Makefile /libdingaling/Makefile.in @@ -355,6 +387,11 @@ opal /libwebsockets/compile /libwebsockets/test-server/Makefile /libwebsockets/test-server/Makefile.in +/libwebsockets/test-server/libwebsockets-test-client +/libwebsockets/test-server/libwebsockets-test-fraggle +/libwebsockets/test-server/libwebsockets-test-ping +/libwebsockets/test-server/libwebsockets-test-server +/libwebsockets/test-server/libwebsockets-test-server-extpoll /mongo-cxx-driver-v*/ /mpg123/ /libmpg123/ @@ -925,9 +962,12 @@ opal /sipcc/Makefile /sipcc/Makefile.in -/yaml/ +/yaml/Makefile /yaml/config.h +/yaml/include/Makefile +/yaml/src/Makefile /yaml/stamp-h1 +/yaml/tests/Makefile /yaml/tests/example-deconstructor /yaml/tests/example-deconstructor-alt /yaml/tests/example-reformatter @@ -937,6 +977,7 @@ opal /yaml/tests/run-loader /yaml/tests/run-parser /yaml/tests/run-scanner + /zeromq-*/ /jpeg-8d/ diff --git a/libs/freetdm/.gitignore b/libs/freetdm/.gitignore index ff2a46a071..da2caa7d87 100644 --- a/libs/freetdm/.gitignore +++ b/libs/freetdm/.gitignore @@ -26,6 +26,9 @@ testr2 testsangomaboost testtones +!/msvc/testanalog/ +!/msvc/testboost/ + !/sample/boost/Makefile !/sample/dso/Makefile diff --git a/libs/openzap/.gitignore b/libs/openzap/.gitignore index b0dc177c9a..48d9684d18 100644 --- a/libs/openzap/.gitignore +++ b/libs/openzap/.gitignore @@ -22,3 +22,6 @@ testisdn testpri testr2 testtones + +!/msvc/testanalog/ +!/msvc/testisdn/ diff --git a/src/mod/.gitignore b/src/mod/.gitignore index 1aa253520e..bfcc02ab70 100644 --- a/src/mod/.gitignore +++ b/src/mod/.gitignore @@ -24,16 +24,19 @@ /applications/mod_stress/Makefile /applications/mod_stress/Makefile.in /applications/mod_stress/mod_stress.log +/applications/mod_translate/Makefile /applications/mod_valet_parking/Makefile /applications/mod_voicemail/Makefile /asr_tts/mod_unimrcp/Makefile /asr_tts/mod_unimrcp/Makefile.in /asr_tts/mod_unimrcp/mod_unimrcp.log /asr_tts/mod_flite/*/*/mod_flite_manifest.rc +/codecs/mod_b64/Makefile /codecs/mod_skel_codec/Makefile /codecs/mod_vp8/Makefile /dialplans/mod_dialplan_asterisk/Makefile /dialplans/mod_dialplan_xml/Makefile +/endpoints/mod_html5/mod_html5.log /endpoints/mod_portaudio/Makefile /endpoints/mod_portaudio/Makefile.in /endpoints/mod_portaudio/mod_portaudio.log @@ -55,8 +58,9 @@ /formats/mod_portaudio_stream/Makefile.in /formats/mod_portaudio_stream/mod_portaudio_stream.log /formats/mod_tone_stream/Makefile -/languages/mod_java/freeswitch.jar /languages/mod_java/Makefile +/languages/mod_java/classes/ +/languages/mod_java/freeswitch.jar /languages/mod_lua/Makefile /languages/mod_lua/Makefile.in /languages/mod_lua/mod_lua.log From ee0383f03c1dfb9c2386939ffa1c5cf6607be7da Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sat, 27 Jul 2013 10:40:06 -0500 Subject: [PATCH 48/88] add missing cielab_luts to spandsp build --- Freeswitch.2012.sln | 20 +++++- libs/spandsp/src/libspandsp.2012.vcxproj | 3 + .../src/msvc/make_cielab_luts.2010.vcxproj | 65 ++++++++++++++++++ .../src/msvc/make_cielab_luts.2012.vcxproj | 66 +++++++++++++++++++ 4 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj create mode 100644 libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj diff --git a/Freeswitch.2012.sln b/Freeswitch.2012.sln index 7e2d13e128..242ebc85b6 100644 --- a/Freeswitch.2012.sln +++ b/Freeswitch.2012.sln @@ -575,6 +575,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_math_fixed_tables", "l EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcbt", "libs\win32\libcbt\libcbt.2012.vcxproj", "{77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_cielab_luts", "libs\spandsp\src\msvc\make_cielab_luts.2012.vcxproj", "{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -3801,6 +3803,21 @@ Global {77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}.Release|x64.Build.0 = Release|x64 {77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}.Release|x64 Setup.ActiveCfg = Release|Win32 {77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}.Release|x86 Setup.ActiveCfg = Release|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.Build.0 = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x64.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x64 Setup.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x86 Setup.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.Build.0 = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64 Setup.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x86 Setup.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.Build.0 = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64 Setup.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x86 Setup.ActiveCfg = All|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3915,8 +3932,9 @@ Global {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {C13CC324-0032-4492-9A30-310A6BD64FF5} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} - {77BC1DD2-C9A1-44D7-BFFA-1320370CACB9} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {2386B892-35F5-46CF-A0F0-10394D2FBF9B} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} + {77BC1DD2-C9A1-44D7-BFFA-1320370CACB9} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {EC3E5C7F-EE09-47E2-80FE-546363D14A98} = {B8F5B47B-8568-46EB-B320-64C17D2A98BC} {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000} {ACFFF684-4D19-4D48-AF12-88EA1D778BDF} = {0C808854-54D1-4230-BFF5-77B5FD905000} diff --git a/libs/spandsp/src/libspandsp.2012.vcxproj b/libs/spandsp/src/libspandsp.2012.vcxproj index 1c5ce3c257..92ddbbe0c9 100644 --- a/libs/spandsp/src/libspandsp.2012.vcxproj +++ b/libs/spandsp/src/libspandsp.2012.vcxproj @@ -431,6 +431,9 @@ {dee932ab-5911-4700-9eeb-8c7090a0a330} false + + {85f0cf8c-c7ab-48f6-ba19-cc94cf87f981} + {2386b892-35f5-46cf-a0f0-10394d2fbf9b} diff --git a/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj b/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj new file mode 100644 index 0000000000..a027a75704 --- /dev/null +++ b/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj @@ -0,0 +1,65 @@ + + + + + All + Win32 + + + + make_cielab_luts + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981} + make_cielab_luts + Win32Proj + + + + Application + Unicode + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\make_at_dictionary\$(Configuration)\ + false + + + + $(IntDir)BuildLog $(ProjectName).htm + + + Disabled + .;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;.\generated;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + $(IntDir)$(TargetName).pdb + Level3 + ProgramDatabase + + + true + Console + MachineX86 + + + "$(TargetPath)" >"$(ProjectDir)..\make_cielab_luts.h" + + + + + + + + + \ No newline at end of file diff --git a/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj b/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj new file mode 100644 index 0000000000..59f6210c22 --- /dev/null +++ b/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj @@ -0,0 +1,66 @@ + + + + + All + Win32 + + + + make_cielab_luts + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981} + make_cielab_luts + Win32Proj + + + + Application + Unicode + v110 + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\make_at_dictionary\$(Configuration)\ + false + + + + $(IntDir)BuildLog $(ProjectName).htm + + + Disabled + .;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;.\generated;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + $(IntDir)$(TargetName).pdb + Level3 + ProgramDatabase + + + true + Console + MachineX86 + + + "$(TargetPath)" >"$(ProjectDir)..\make_cielab_luts.h" + + + + + + + + + \ No newline at end of file From 734d5f57ca327988a5eaac8fc86977aeeb57d454 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sat, 27 Jul 2013 10:43:04 -0500 Subject: [PATCH 49/88] add missing to last commit --- libs/spandsp/src/libspandsp.2010.vcxproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/spandsp/src/libspandsp.2010.vcxproj b/libs/spandsp/src/libspandsp.2010.vcxproj index d3793f5b18..1697ba19a5 100644 --- a/libs/spandsp/src/libspandsp.2010.vcxproj +++ b/libs/spandsp/src/libspandsp.2010.vcxproj @@ -427,6 +427,9 @@ {dee932ab-5911-4700-9eeb-8c7090a0a330} false + + {85f0cf8c-c7ab-48f6-ba19-cc94cf87f981} + {9d04a840-ce18-4ff5-a6d3-0a2bb92ff2e6} From 7e1418d634cb22a583cb80dbc51704fa03dc9a6d Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sat, 27 Jul 2013 11:28:08 -0500 Subject: [PATCH 50/88] add missing --- Freeswitch.2010.sln | 18 ++++++++++++++++++ .../src/msvc/make_cielab_luts.2010.vcxproj | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index d620087405..65ade0314f 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -570,6 +570,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_math_fixed_tables", "l EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcbt", "libs\win32\libcbt\libcbt.2010.vcxproj", "{77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_cielab_luts", "libs\spandsp\src\msvc\make_cielab_luts.2010.vcxproj", "{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -3791,6 +3793,21 @@ Global {77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}.Release|x64.Build.0 = Release|x64 {77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}.Release|x64 Setup.ActiveCfg = Release|Win32 {77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}.Release|x86 Setup.ActiveCfg = Release|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.Build.0 = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x64.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x64 Setup.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x86 Setup.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.Build.0 = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64 Setup.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x86 Setup.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.Build.0 = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64 Setup.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x86 Setup.ActiveCfg = All|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3907,6 +3924,7 @@ Global {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {77BC1DD2-C9A1-44D7-BFFA-1320370CACB9} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {EC3E5C7F-EE09-47E2-80FE-546363D14A98} = {B8F5B47B-8568-46EB-B320-64C17D2A98BC} {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000} {ACFFF684-4D19-4D48-AF12-88EA1D778BDF} = {0C808854-54D1-4230-BFF5-77B5FD905000} diff --git a/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj b/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj index a027a75704..282cc186cf 100644 --- a/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj +++ b/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj @@ -53,7 +53,7 @@ MachineX86 - "$(TargetPath)" >"$(ProjectDir)..\make_cielab_luts.h" + "$(TargetPath)" >"$(ProjectDir)..\cielab_luts.h" From 4fc8bc769691a3a8a9b7919cbe94c5dce8e776c9 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sat, 27 Jul 2013 22:13:47 -0500 Subject: [PATCH 51/88] more fixes for last commit --- libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj b/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj index 59f6210c22..881c035554 100644 --- a/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj +++ b/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj @@ -54,7 +54,7 @@ MachineX86 - "$(TargetPath)" >"$(ProjectDir)..\make_cielab_luts.h" + "$(TargetPath)" >"$(ProjectDir)..\cielab_luts.h" From f0a0e469e819509a55deec5905b6262c6e84cc0c Mon Sep 17 00:00:00 2001 From: Seven Du Date: Mon, 29 Jul 2013 20:04:32 +0800 Subject: [PATCH 52/88] add ws --- src/mod/xml_int/mod_xml_rpc/ws.c | 771 +++++++++++++++++++++++++++++++ src/mod/xml_int/mod_xml_rpc/ws.h | 99 ++++ 2 files changed, 870 insertions(+) create mode 100644 src/mod/xml_int/mod_xml_rpc/ws.c create mode 100644 src/mod/xml_int/mod_xml_rpc/ws.h diff --git a/src/mod/xml_int/mod_xml_rpc/ws.c b/src/mod/xml_int/mod_xml_rpc/ws.c new file mode 100644 index 0000000000..35fb4c0f22 --- /dev/null +++ b/src/mod/xml_int/mod_xml_rpc/ws.c @@ -0,0 +1,771 @@ +#include "ws.h" +#include + +#ifndef _MSC_VER +#include +#endif + +#define SHA1_HASH_SIZE 20 +struct globals_s globals; + +#ifndef WSS_STANDALONE + +void init_ssl(void) +{ + SSL_library_init(); +} +void deinit_ssl(void) +{ + return; +} + +#else +static unsigned long pthreads_thread_id(void); +static void pthreads_locking_callback(int mode, int type, const char *file, int line); + +static pthread_mutex_t *lock_cs; +static long *lock_count; + + + +static void thread_setup(void) +{ + int i; + + lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t)); + lock_count = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long)); + + for (i = 0; i < CRYPTO_num_locks(); i++) { + lock_count[i] = 0; + pthread_mutex_init(&(lock_cs[i]), NULL); + } + + CRYPTO_set_id_callback(pthreads_thread_id); + CRYPTO_set_locking_callback(pthreads_locking_callback); +} + +static void thread_cleanup(void) +{ + int i; + + CRYPTO_set_locking_callback(NULL); + + for (i=0; i buflen - 1) { + cplen = buflen -1; + } else { + cplen = len; + } + + strncpy(buf, v, cplen); + *(buf+cplen) = '\0'; + return 1; + } + + } + } + return 0; +} + +static int b64encode(unsigned char *in, size_t ilen, unsigned char *out, size_t olen) +{ + int y=0,bytes=0; + size_t x=0; + unsigned int b=0,l=0; + + if(olen) { + } + + for(x=0;x= 6) { + out[bytes++] = c64[(b>>(l-=6))%64]; + if(++y!=72) { + continue; + } + //out[bytes++] = '\n'; + y=0; + } + } + + if (l > 0) { + out[bytes++] = c64[((b%16)<<(6-l))%64]; + } + if (l != 0) while (l < 6) { + out[bytes++] = '=', l += 2; + } + + return 0; +} + +#ifdef NO_OPENSSL +static void sha1_digest(char *digest, unsigned char *in) +{ + SHA1Context sha; + char *p; + int x; + + + SHA1Init(&sha); + SHA1Update(&sha, in, strlen(in)); + SHA1Final(&sha, digest); +} +#else + +static void sha1_digest(unsigned char *digest, char *in) +{ + SHA_CTX sha; + + SHA1_Init(&sha); + SHA1_Update(&sha, in, strlen(in)); + SHA1_Final(digest, &sha); + +} + +#endif + +int ws_handshake(wsh_t *wsh) +{ + char key[256] = ""; + char version[5] = ""; + char proto[256] = ""; + char uri[256] = ""; + char input[256] = ""; + unsigned char output[SHA1_HASH_SIZE] = ""; + char b64[256] = ""; + char respond[512] = ""; + issize_t bytes; + char *p, *e = 0; + + if (wsh->sock == ws_sock_invalid) { + return -3; + } + + while((bytes = ws_raw_read(wsh, wsh->buffer + wsh->datalen, wsh->buflen - wsh->datalen)) > 0) { + wsh->datalen += bytes; + if (strstr(wsh->buffer, "\r\n\r\n") || strstr(wsh->buffer, "\n\n")) { + break; + } + } + + if (bytes > sizeof(wsh->buffer)) { + goto err; + } + + *(wsh->buffer+bytes) = '\0'; + + if (strncasecmp(wsh->buffer, "GET ", 4)) { + goto err; + } + + p = wsh->buffer + 4; + + e = strchr(p, ' '); + if (!e) { + goto err; + } + + strncpy(uri, p, e-p); + + cheezy_get_var(wsh->buffer, "Sec-WebSocket-Key", key, sizeof(key)); + cheezy_get_var(wsh->buffer, "Sec-WebSocket-Version", version, sizeof(version)); + cheezy_get_var(wsh->buffer, "Sec-WebSocket-Protocol", proto, sizeof(proto)); + + if (!*key) { + goto err; + } + + snprintf(input, sizeof(input), "%s%s", key, WEBSOCKET_GUID); + sha1_digest(output, input); + b64encode((unsigned char *)output, SHA1_HASH_SIZE, (unsigned char *)b64, sizeof(b64)); + + snprintf(respond, sizeof(respond), + "HTTP/1.1 101 Switching Protocols\r\n" + "Upgrade: websocket\r\n" + "Connection: Upgrade\r\n" + "Sec-WebSocket-Accept: %s\r\n" + "Sec-WebSocket-Protocol: %s\r\n\r\n", + b64, + proto); + + + ws_raw_write(wsh, respond, strlen(respond)); + wsh->handshake = 1; + + return 0; + + err: + + snprintf(respond, sizeof(respond), "HTTP/1.1 400 Bad Request\r\n" + "Sec-WebSocket-Version: 13\r\n\r\n"); + + //printf("ERR:\n%s\n", respond); + + + ws_raw_write(wsh, respond, strlen(respond)); + + ws_close(wsh, WS_NONE); + + return -1; + +} + +issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes) +{ + issize_t r; + int x = 0; + + if (wsh->ssl) { + do { + r = SSL_read(wsh->ssl, data, bytes); +#ifndef _MSC_VER + if (x++) usleep(10000); +#else + if (x++) Sleep(10); +#endif + } while (r == -1 && SSL_get_error(wsh->ssl, r) == SSL_ERROR_WANT_READ && x < 100); + + return r; + } + + do { + r = recv(wsh->sock, data, bytes, 0); +#ifndef _MSC_VER + if (x++) usleep(10000); +#else + if (x++) Sleep(10); +#endif + } while (r == -1 && (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK || + errno == 35 || errno == 730035 || errno == 2 || errno == 60) && x < 100); + + if (x >= 100) { + r = -1; + } + + return r; +} + +issize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes) +{ + size_t r; + + if (wsh->ssl) { + do { + r = SSL_write(wsh->ssl, data, bytes); + } while (r == -1 && SSL_get_error(wsh->ssl, r) == SSL_ERROR_WANT_WRITE); + + return r; + } + + do { + r = send(wsh->sock, data, bytes, 0); + } while (r == -1 && (errno == EAGAIN || errno == EINTR)); + + //if (r<0) { + //printf("wRITE FAIL: %s\n", strerror(errno)); + //} + + return r; +} + +#ifdef _MSC_VER +static int setup_socket(ws_socket_t sock) +{ + unsigned long v = 1; + + if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) { + return -1; + } + + return 0; + +} + +static int restore_socket(ws_socket_t sock) +{ + unsigned long v = 0; + + if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) { + return -1; + } + + return 0; + +} + +#else + +static int setup_socket(ws_socket_t sock) +{ + int flags = fcntl(sock, F_GETFL, 0); + return fcntl(sock, F_SETFL, flags | O_NONBLOCK); +} + +static int restore_socket(ws_socket_t sock) +{ + int flags = fcntl(sock, F_GETFL, 0); + + flags &= ~O_NONBLOCK; + + return fcntl(sock, F_SETFL, flags); + +} + +#endif + + + +int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock) +{ + memset(wsh, 0, sizeof(*wsh)); + wsh->sock = sock; + + if (!ssl_ctx) { + ssl_ctx = globals.ssl_ctx; + } + + if (close_sock) { + wsh->close_sock = 1; + } + + wsh->buflen = sizeof(wsh->buffer); + wsh->secure = ssl_ctx ? 1 : 0; + + setup_socket(sock); + + if (wsh->secure) { + int code; + int sanity = 500; + + wsh->ssl = SSL_new(ssl_ctx); + assert(wsh->ssl); + + SSL_set_fd(wsh->ssl, wsh->sock); + + do { + code = SSL_accept(wsh->ssl); + + if (code == 1) { + break; + } + + if (code == 0) { + return -1; + } + + if (code < 0) { + if (code == -1 && SSL_get_error(wsh->ssl, code) != SSL_ERROR_WANT_READ) { + return -1; + } + } +#ifndef _MSC_VER + usleep(10000); +#else + Sleep(10); +#endif + + } while (--sanity > 0); + + if (!sanity) { + return -1; + } + + } + + while (!wsh->down && !wsh->handshake) { + int r = ws_handshake(wsh); + + if (r < 0) { + wsh->down = 1; + return -1; + } + } + + if (wsh->down) { + return -1; + } + + return 0; +} + +void ws_destroy(wsh_t *wsh) +{ + + if (!wsh) { + return; + } + + if (!wsh->down) { + ws_close(wsh, WS_NONE); + } + + if (wsh->down > 1) { + return; + } + + wsh->down = 2; + + if (wsh->ssl) { + int code; + do { + code = SSL_shutdown(wsh->ssl); + } while (code == -1 && SSL_get_error(wsh->ssl, code) == SSL_ERROR_WANT_READ); + + SSL_free(wsh->ssl); + wsh->ssl = NULL; + } +} + +issize_t ws_close(wsh_t *wsh, int16_t reason) +{ + + if (wsh->down) { + return -1; + } + + wsh->down = 1; + + if (reason && wsh->sock != ws_sock_invalid) { + uint16_t *u16; + uint8_t fr[4] = {WSOC_CLOSE | 0x80, 2, 0}; + + u16 = (uint16_t *) &fr[2]; + *u16 = htons((int16_t)reason); + ws_raw_write(wsh, fr, 4); + } + + restore_socket(wsh->sock); + + if (wsh->close_sock) { + close(wsh->sock); + } + + wsh->sock = ws_sock_invalid; + + return reason * -1; + +} + +issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) +{ + + issize_t need = 2; + char *maskp; + + again: + need = 2; + maskp = NULL; + *data = NULL; + + if (wsh->down) { + return -1; + } + + if (!wsh->handshake) { + return ws_close(wsh, WS_PROTO_ERR); + } + + if ((wsh->datalen = ws_raw_read(wsh, wsh->buffer, 14)) < need) { + if ((wsh->datalen += ws_raw_read(wsh, wsh->buffer + wsh->datalen, 14 - wsh->datalen)) < need) { + /* too small - protocol err */ + return ws_close(wsh, WS_PROTO_ERR); + } + } + + *oc = *wsh->buffer & 0xf; + + switch(*oc) { + case WSOC_CLOSE: + { + wsh->plen = wsh->buffer[1] & 0x7f; + *data = (uint8_t *) &wsh->buffer[2]; + return ws_close(wsh, 1000); + } + break; + case WSOC_CONTINUATION: + case WSOC_TEXT: + case WSOC_BINARY: + case WSOC_PING: + case WSOC_PONG: + { + //int fin = (wsh->buffer[0] >> 7) & 1; + int mask = (wsh->buffer[1] >> 7) & 1; + + if (mask) { + need += 4; + + if (need > wsh->datalen) { + /* too small - protocol err */ + *oc = WSOC_CLOSE; + return ws_close(wsh, WS_PROTO_ERR); + } + } + + wsh->plen = wsh->buffer[1] & 0x7f; + wsh->payload = &wsh->buffer[2]; + + if (wsh->plen == 127) { + uint64_t *u64; + + need += 8; + + if (need > wsh->datalen) { + /* too small - protocol err */ + *oc = WSOC_CLOSE; + return ws_close(wsh, WS_PROTO_ERR); + } + + u64 = (uint64_t *) wsh->payload; + wsh->payload += 8; + + wsh->plen = ntohl((u_long)*u64); + + } else if (wsh->plen == 126) { + uint16_t *u16; + + need += 2; + + if (need > wsh->datalen) { + /* too small - protocol err */ + *oc = WSOC_CLOSE; + return ws_close(wsh, WS_PROTO_ERR); + } + + u16 = (uint16_t *) wsh->payload; + wsh->payload += 2; + wsh->plen = ntohs(*u16); + } + + if (mask) { + maskp = (char *)wsh->payload; + wsh->payload += 4; + } + + need = (wsh->plen - (wsh->datalen - need)); + + if ((need + wsh->datalen) > (issize_t)wsh->buflen) { + /* too big - Ain't nobody got time fo' dat */ + *oc = WSOC_CLOSE; + return ws_close(wsh, WS_DATA_TOO_BIG); + } + + wsh->rplen = wsh->plen - need; + + while(need) { + issize_t r = ws_raw_read(wsh, wsh->payload + wsh->rplen, need); + + if (r < 1) { + /* invalid read - protocol err .. */ + *oc = WSOC_CLOSE; + return ws_close(wsh, WS_PROTO_ERR); + } + + wsh->datalen += r; + wsh->rplen += r; + need -= r; + } + + if (mask && maskp) { + issize_t i; + + for (i = 0; i < wsh->datalen; i++) { + wsh->payload[i] ^= maskp[i % 4]; + } + } + + + if (*oc == WSOC_PING) { + ws_write_frame(wsh, WSOC_PONG, wsh->payload, wsh->rplen); + goto again; + } + + + *(wsh->payload+wsh->rplen) = '\0'; + *data = (uint8_t *)wsh->payload; + + //printf("READ[%ld][%d]-----------------------------:\n[%s]\n-------------------------------\n", wsh->rplen, *oc, (char *)*data); + + + return wsh->rplen; + } + break; + default: + { + /* invalid op code - protocol err .. */ + *oc = WSOC_CLOSE; + return ws_close(wsh, WS_PROTO_ERR); + } + break; + } +} + +issize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes) +{ + + if (bytes + wsh->wdatalen > wsh->buflen) { + return -1; + } + + memcpy(wsh->wbuffer + wsh->wdatalen, data, bytes); + + wsh->wdatalen += bytes; + + return bytes; +} + +issize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc) +{ + issize_t r = 0; + + if (!wsh->wdatalen) { + return -1; + } + + r = ws_write_frame(wsh, oc, wsh->wbuffer, wsh->wdatalen); + + wsh->wdatalen = 0; + + return r; +} + + +issize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes) +{ + uint8_t hdr[14] = { 0 }; + size_t hlen = 2; + + if (wsh->down) { + return -1; + } + + //printf("WRITE[%ld]-----------------------------:\n[%s]\n-----------------------------------\n", bytes, (char *) data); + + hdr[0] = (uint8_t)(oc | 0x80); + + if (bytes < 126) { + hdr[1] = (uint8_t)bytes; + } else if (bytes < 0x10000) { + uint16_t *u16; + + hdr[1] = 126; + hlen += 2; + + u16 = (uint16_t *) &hdr[2]; + *u16 = htons((uint16_t) bytes); + + } else { + uint64_t *u64; + + hdr[1] = 127; + hlen += 8; + + u64 = (uint64_t *) &hdr[2]; + *u64 = htonl(bytes); + } + + if (ws_raw_write(wsh, (void *) &hdr[0], hlen) != (issize_t)hlen) { + return -1; + } + + if (ws_raw_write(wsh, data, bytes) != (issize_t)bytes) { + return -2; + } + + return bytes; +} + + diff --git a/src/mod/xml_int/mod_xml_rpc/ws.h b/src/mod/xml_int/mod_xml_rpc/ws.h new file mode 100644 index 0000000000..81368158b3 --- /dev/null +++ b/src/mod/xml_int/mod_xml_rpc/ws.h @@ -0,0 +1,99 @@ +#ifndef _WS_H +#define _WS_H + +//#define WSS_STANDALONE 1 + +#define WEBSOCKET_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" +#define B64BUFFLEN 1024 + +#include +#ifndef _MSC_VER +#include +#include +#include +#else +#pragma warning(disable:4996) +#endif +#include +#include +#include +#include +#include +#include +#include +#include +//#include "sha1.h" +#include +#include + + +struct globals_s { + const SSL_METHOD *ssl_method; + SSL_CTX *ssl_ctx; + char cert[512]; + char key[512]; +}; + +extern struct globals_s globals; + +typedef int ws_socket_t; +#define ws_sock_invalid -1 + + +typedef enum { + WS_NONE = 0, + WS_NORMAL = 1000, + WS_PROTO_ERR = 1002, + WS_DATA_TOO_BIG = 1009 +} ws_cause_t; + +typedef enum { + WSOC_CONTINUATION = 0x0, + WSOC_TEXT = 0x1, + WSOC_BINARY = 0x2, + WSOC_CLOSE = 0x8, + WSOC_PING = 0x9, + WSOC_PONG = 0xA +} ws_opcode_t; + +typedef struct wsh_s { + ws_socket_t sock; + char buffer[65536]; + char wbuffer[65536]; + size_t buflen; + issize_t datalen; + issize_t wdatalen; + char *payload; + issize_t plen; + issize_t rplen; + SSL *ssl; + int handshake; + uint8_t down; + int secure; + uint8_t close_sock; +} wsh_t; + +issize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc); +issize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes); + + +issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes); +issize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes); +issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data); +issize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes); +int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock); +issize_t ws_close(wsh_t *wsh, int16_t reason); +void ws_destroy(wsh_t *wsh); +void init_ssl(void); +void deinit_ssl(void); + + +#ifndef _MSC_VER +static inline uint64_t get_unaligned_uint64(const void *p) +{ + const struct { uint64_t d; } __attribute__((packed)) *pp = p; + return pp->d; +} +#endif + +#endif From 253880f586ba10f87a3a76a23ec7e4ab76bcd1df Mon Sep 17 00:00:00 2001 From: Seven Du Date: Mon, 29 Jul 2013 23:06:12 +0800 Subject: [PATCH 53/88] make websocket work with abyss --- src/mod/xml_int/mod_xml_rpc/Makefile | 4 +- src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c | 175 +++++++++++++++++++++- src/mod/xml_int/mod_xml_rpc/ws.c | 120 +++++++-------- src/mod/xml_int/mod_xml_rpc/ws.h | 9 +- 4 files changed, 245 insertions(+), 63 deletions(-) diff --git a/src/mod/xml_int/mod_xml_rpc/Makefile b/src/mod/xml_int/mod_xml_rpc/Makefile index cfc0276204..f0585dc324 100644 --- a/src/mod/xml_int/mod_xml_rpc/Makefile +++ b/src/mod/xml_int/mod_xml_rpc/Makefile @@ -60,10 +60,12 @@ $(XMLRPC_DIR)/src/xmlrpc_server_abyss.o\ $(XMLRPC_DIR)/src/xmlrpc_server_cgi.o\ $(XMLRPC_DIR)/src/xmlrpc_string.o\ $(XMLRPC_DIR)/src/xmlrpc_struct.o\ -$(XMLRPC_DIR)/lib/expat/xmltok/xmltok.o +$(XMLRPC_DIR)/lib/expat/xmltok/xmltok.o\ +ws.o LOCAL_CFLAGS = -w -I$(XMLRPC_DIR)/lib/expat/xmlparse -I$(XMLRPC_DIR)/lib/expat/xmltok -I$(XMLRPC_DIR) -I$(XMLRPC_DIR)/include LOCAL_CFLAGS+= -I$(XMLRPC_DIR)/lib/abyss/src -I$(XMLRPC_DIR)/lib/util/include -D_THREAD -D__EXTENSIONS__ +LOCAL_CFLAGS+= -I. -I../../../../libs/sofia-sip/libsofia-sip-ua/su include $(BASE)/build/modmake.rules diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c index d25009f8fb..9b791b6c53 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c @@ -26,6 +26,7 @@ * Anthony Minessale II * John Wehle * Garmt Boekholt + * Seven Du * * mod_xml_rpc.c -- XML RPC * @@ -69,6 +70,7 @@ #include <../lib/abyss/src/token.h> #include <../lib/abyss/src/http.h> #include <../lib/abyss/src/session.h> +#include "ws.h" SWITCH_MODULE_LOAD_FUNCTION(mod_xml_rpc_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_rpc_shutdown); @@ -87,6 +89,7 @@ static struct { switch_bool_t virtual_host; TServer abyssServer; xmlrpc_registry *registryP; + switch_bool_t enable_websocket; } globals; SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_realm, globals.realm); @@ -126,6 +129,8 @@ static switch_status_t do_config(void) default_domain = val; } else if (!strcasecmp(var, "virtual-host")) { globals.virtual_host = switch_true(val); + } else if (!strcasecmp(var, "enable-websocket")) { + globals.enable_websocket = switch_true(val); } } } @@ -541,11 +546,160 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name) return rval; } +void stop_hook_event_handler(switch_event_t *event) { + char *json; + wsh_t *wsh = (TSession *)event->bind_user_data; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "got websocket::stophook, closing\n"); + wsh->down++; +} + +void event_handler(switch_event_t *event) { + char *json; + wsh_t *wsh = (TSession *)event->bind_user_data; + switch_event_serialize_json(event, &json); + ws_write_frame(wsh, WSOC_TEXT, json, strlen(json)); + free(json); +} + +#define MAX_EVENT_BIND_SLOTS SWITCH_EVENT_ALL + +abyss_bool websocket_hook(TSession *r) +{ + wsh_t wsh; + int ret; + int i; + ws_opcode_t opcode; + uint8_t *data; + switch_event_node_t *nodes[MAX_EVENT_BIND_SLOTS]; + int node_count = 0; + char *p; + char *key = TableFind(&r->requestHeaderFields, "sec-websocket-key"); + char *version = TableFind(&r->requestHeaderFields, "sec-websocket-version"); + char *proto = TableFind(&r->requestHeaderFields, "sec-websocket-protocol"); + char *upgrade = TableFind(&r->requestHeaderFields, "connection"); + + if (!key || !version || !proto || !upgrade) return FALSE; + if (strncasecmp(upgrade, "Upgrade", 7) || strncasecmp(proto, "websocket", 9)) return FALSE; + + for (i = 0; i < r->requestHeaderFields.size; ++i) { + TTableItem * const fieldP = &r->requestHeaderFields.item[i]; + const char * const fieldValue = fieldP->value; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "headers %s: %s\n", fieldP->name, fieldValue); + } + + ret = ws_init(&wsh, r, NULL, 0); + if (ret != 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "websocket error %d\n", ret); + return FALSE; + } + + while(!wsh.down && !wsh.handshake) { + ret = ws_handshake_kvp(&wsh, key, version, proto); + if (ret < 0) wsh.down = 1; + } + + if (ret != 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "handshake error %d\n", ret); + return FALSE; + } + + if (switch_event_bind_removable("websocket", SWITCH_EVENT_CUSTOM, "websocket::stophook", stop_hook_event_handler, &wsh, &nodes[node_count++]) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't bind!\n"); + node_count--; + } + + while (!wsh.down) { + int bytes = ws_read_frame(&wsh, &opcode, &data); + + if (bytes < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d %s\n", opcode, (char *)data); + switch_yield(1000); + continue; + } + + switch (opcode) { + case WSOC_CLOSE: + ws_close(&wsh, 1000); + break; + case WSOC_CONTINUATION: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "continue\n"); + continue; + case WSOC_TEXT: + p = data; + if (!p) continue; + if (!strncasecmp(data, "event ", 6)) { + switch_event_types_t type; + char *subclass; + + if (node_count == MAX_EVENT_BIND_SLOTS - 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot subscribe more than %d events\n", node_count); + continue; + } + p += 6; + if (p = strchr(p, ' ')) p++; + if (!strncasecmp(p, "json ", 5)) { + p += 5; + } else if (!strncasecmp(p, "xml ", 4)) { + p += 4; + } else if (!strncasecmp(p, "plain ", 6)) { + p += 6; + } + if (!*p) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "missing event type in [%s]\n", data); + break; + } else { + } + if (subclass = strchr(p, ' ')) { + *subclass++ = '\0'; + if (!*subclass) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "missing subclass\n"); + continue; + } + } else { + subclass = SWITCH_EVENT_SUBCLASS_ANY; + } + + if (switch_name_event(p, &type) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown event %s\n", p); + continue; + } + + if (switch_event_bind_removable("websocket", type, subclass, event_handler, &wsh, &nodes[node_count++]) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't bind!\n"); + node_count--; + continue; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Bind %s\n", data); + } + + } + break; + default: + break; + } + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "wsh.down = %d, node_count = %d\n", wsh.down, node_count); + + switch_yield(2000); + while (--node_count >= 0) switch_event_unbind(&nodes[node_count]); + + return FALSE; +} + abyss_bool auth_hook(TSession * r) { char *domain_name, *e; abyss_bool ret = FALSE; + if (globals.enable_websocket && !strncmp(r->requestInfo.uri, "/socket", 7)) { + // Chrome has no Authorization support yet + // https://code.google.com/p/chromium/issues/detail?id=123862 + return websocket_hook(r); + } + if (!strncmp(r->requestInfo.uri, "/domains/", 9)) { domain_name = strdup(r->requestInfo.uri + 9); switch_assert(domain_name); @@ -1059,7 +1213,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_xml_rpc_runtime) ServerAddHandler(&globals.abyssServer, auth_hook); ServerSetKeepaliveTimeout(&globals.abyssServer, 5); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Starting HTTP Port %d, DocRoot [%s]\n", globals.port, SWITCH_GLOBAL_dirs.htdocs_dir); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Starting HTTP Port %d, DocRoot [%s]%s\n", + globals.port, SWITCH_GLOBAL_dirs.htdocs_dir, globals.enable_websocket ? " with websocket." : ""); ServerRun(&globals.abyssServer); switch_yield(1000000); @@ -1069,10 +1224,28 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_xml_rpc_runtime) return SWITCH_STATUS_TERM; } +void stop_all_websockets() +{ + switch_event_t *event; + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, "websocket::stophook") != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "Failed to create event!\n"); + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "stop", "now"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "stopping all websockets ...\n"); + if (switch_event_fire(&event) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "Failed to fire the event!\n"); + switch_event_destroy(&event); + return false; + } +} + /* upon module unload */ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_rpc_shutdown) { + /* Cann't find a way to stop the websockets, use this for a workaround before finding the real one that works */ + stop_all_websockets(); + /* this makes the worker thread (ServerRun) stop */ ServerTerminate(&globals.abyssServer); diff --git a/src/mod/xml_int/mod_xml_rpc/ws.c b/src/mod/xml_int/mod_xml_rpc/ws.c index 35fb4c0f22..1ef76e3cc9 100644 --- a/src/mod/xml_int/mod_xml_rpc/ws.c +++ b/src/mod/xml_int/mod_xml_rpc/ws.c @@ -218,11 +218,8 @@ static void sha1_digest(unsigned char *digest, char *in) #endif -int ws_handshake(wsh_t *wsh) +int ws_handshake_kvp(wsh_t *wsh, char *key, char *version, char *proto) { - char key[256] = ""; - char version[5] = ""; - char proto[256] = ""; char uri[256] = ""; char input[256] = ""; unsigned char output[SHA1_HASH_SIZE] = ""; @@ -231,44 +228,14 @@ int ws_handshake(wsh_t *wsh) issize_t bytes; char *p, *e = 0; - if (wsh->sock == ws_sock_invalid) { + if (!wsh->tsession) { return -3; } - while((bytes = ws_raw_read(wsh, wsh->buffer + wsh->datalen, wsh->buflen - wsh->datalen)) > 0) { - wsh->datalen += bytes; - if (strstr(wsh->buffer, "\r\n\r\n") || strstr(wsh->buffer, "\n\n")) { - break; - } - } - - if (bytes > sizeof(wsh->buffer)) { + if (!*key || !*version || !*proto) { goto err; } - *(wsh->buffer+bytes) = '\0'; - - if (strncasecmp(wsh->buffer, "GET ", 4)) { - goto err; - } - - p = wsh->buffer + 4; - - e = strchr(p, ' '); - if (!e) { - goto err; - } - - strncpy(uri, p, e-p); - - cheezy_get_var(wsh->buffer, "Sec-WebSocket-Key", key, sizeof(key)); - cheezy_get_var(wsh->buffer, "Sec-WebSocket-Version", version, sizeof(version)); - cheezy_get_var(wsh->buffer, "Sec-WebSocket-Protocol", proto, sizeof(proto)); - - if (!*key) { - goto err; - } - snprintf(input, sizeof(input), "%s%s", key, WEBSOCKET_GUID); sha1_digest(output, input); b64encode((unsigned char *)output, SHA1_HASH_SIZE, (unsigned char *)b64, sizeof(b64)); @@ -282,7 +249,6 @@ int ws_handshake(wsh_t *wsh) b64, proto); - ws_raw_write(wsh, respond, strlen(respond)); wsh->handshake = 1; @@ -308,7 +274,9 @@ issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes) { issize_t r; int x = 0; + TConn *conn = wsh->tsession->connP; +#if 0 if (wsh->ssl) { do { r = SSL_read(wsh->ssl, data, bytes); @@ -321,21 +289,50 @@ issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes) return r; } - - do { - r = recv(wsh->sock, data, bytes, 0); -#ifndef _MSC_VER - if (x++) usleep(10000); -#else - if (x++) Sleep(10); #endif - } while (r == -1 && (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK || - errno == 35 || errno == 730035 || errno == 2 || errno == 60) && x < 100); - - if (x >= 100) { - r = -1; + + if (!wsh->handshake) { + r = wsh->tsession->connP->buffersize; + memcpy(data, conn->buffer.b, r); + printf("%s\n", conn->buffer.t); + ConnReadInit(conn); + return r; + } else { + const char *readError = NULL; + + // printf(" pos=%d size=%d need=%d\n", conn->bufferpos, conn->buffersize, bytes); + + r = conn->buffersize - conn->bufferpos; + + if (r < 0) { + printf("348 Read Error %d!\n", r); + return 0; + } else if (r == 0) { + ConnRead(conn, 2, NULL, NULL, &readError); + + if (readError) { + // printf("354 Read Error %s\n", readError); + xmlrpc_strfree(readError); + return 0; + } + + r = conn->buffersize - conn->bufferpos; + } + + if (r <= bytes) { + memcpy(data, conn->buffer.b + conn->bufferpos, r); + // ConnReadInit(conn); + conn->bufferpos = conn->buffersize; + ConnReadInit(conn); + return r; + } else { + memcpy(data, conn->buffer.b + conn->bufferpos, bytes); + conn->bufferpos += bytes; + return bytes; + } + } - + return r; } @@ -351,9 +348,11 @@ issize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes) return r; } - do { - r = send(wsh->sock, data, bytes, 0); - } while (r == -1 && (errno == EAGAIN || errno == EINTR)); + if (ConnWrite(wsh->tsession->connP, data, bytes)) { + return bytes; + } else { + return 0; + } //if (r<0) { //printf("wRITE FAIL: %s\n", strerror(errno)); @@ -408,11 +407,10 @@ static int restore_socket(ws_socket_t sock) #endif - -int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock) +int ws_init(wsh_t *wsh, ws_tsession_t *tsession, SSL_CTX *ssl_ctx, int close_sock) { memset(wsh, 0, sizeof(*wsh)); - wsh->sock = sock; + wsh->tsession = tsession; if (!ssl_ctx) { ssl_ctx = globals.ssl_ctx; @@ -425,7 +423,7 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock) wsh->buflen = sizeof(wsh->buffer); wsh->secure = ssl_ctx ? 1 : 0; - setup_socket(sock); + // setup_socket(sock); if (wsh->secure) { int code; @@ -466,6 +464,7 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock) } +/* while (!wsh->down && !wsh->handshake) { int r = ws_handshake(wsh); @@ -474,6 +473,7 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock) return -1; } } +*/ if (wsh->down) { return -1; @@ -560,8 +560,10 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) } if ((wsh->datalen = ws_raw_read(wsh, wsh->buffer, 14)) < need) { - if ((wsh->datalen += ws_raw_read(wsh, wsh->buffer + wsh->datalen, 14 - wsh->datalen)) < need) { - /* too small - protocol err */ + while (!wsh->down && (wsh->datalen += ws_raw_read(wsh, wsh->buffer + wsh->datalen, 14 - wsh->datalen)) < need) ; + + if (0 && (wsh->datalen += ws_raw_read(wsh, wsh->buffer + wsh->datalen, 14 - wsh->datalen)) < need) { + /* too small - protocol err */ return ws_close(wsh, WS_PROTO_ERR); } } diff --git a/src/mod/xml_int/mod_xml_rpc/ws.h b/src/mod/xml_int/mod_xml_rpc/ws.h index 81368158b3..06fd3b2594 100644 --- a/src/mod/xml_int/mod_xml_rpc/ws.h +++ b/src/mod/xml_int/mod_xml_rpc/ws.h @@ -25,7 +25,10 @@ //#include "sha1.h" #include #include +#include <../lib/abyss/src/session.h> +#include <../lib/abyss/src/conn.h> +typedef TSession ws_tsession_t; struct globals_s { const SSL_METHOD *ssl_method; @@ -34,7 +37,7 @@ struct globals_s { char key[512]; }; -extern struct globals_s globals; +// extern struct globals_s globals; typedef int ws_socket_t; #define ws_sock_invalid -1 @@ -71,6 +74,7 @@ typedef struct wsh_s { uint8_t down; int secure; uint8_t close_sock; + ws_tsession_t *tsession; } wsh_t; issize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc); @@ -81,11 +85,12 @@ issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes); issize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes); issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data); issize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes); -int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock); +int ws_init(wsh_t *wsh, ws_tsession_t *tsession, SSL_CTX *ssl_ctx, int close_sock); issize_t ws_close(wsh_t *wsh, int16_t reason); void ws_destroy(wsh_t *wsh); void init_ssl(void); void deinit_ssl(void); +int ws_handshake_kvp(wsh_t *wsh, char *key, char *version, char *proto); #ifndef _MSC_VER From 39ad7996836e4f69e22dd15b689ef2e3e3912766 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 29 Jul 2013 10:18:05 -0500 Subject: [PATCH 54/88] FS-4932 FS-5090 --resolve --- src/include/switch_core_media.h | 3 +- src/include/switch_types.h | 9 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 4 +- src/mod/endpoints/mod_sofia/sofia.c | 11 +- src/switch_core_media.c | 253 +++++++++++++++--------- src/switch_rtp.c | 3 +- 6 files changed, 186 insertions(+), 97 deletions(-) diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h index 844a1bbb76..122f9f2b65 100644 --- a/src/include/switch_core_media.h +++ b/src/include/switch_core_media.h @@ -68,6 +68,7 @@ typedef enum { SCMF_RUNNING, SCMF_DISABLE_TRANSCODING, SCMF_AUTOFIX_TIMING, + SCMF_AUTOFIX_PT, SCMF_CODEC_GREEDY, SCMF_CODEC_SCROOGE, SCMF_DISABLE_HOLD, @@ -242,7 +243,7 @@ SWITCH_DECLARE(switch_rtp_stats_t *) switch_core_media_get_stats(switch_core_ses SWITCH_DECLARE(void) switch_core_media_set_sdp_codec_string(switch_core_session_t *session, const char *r_sdp); -SWITCH_DECLARE(void) switch_core_media_reset_autofix_timing(switch_core_session_t *session, switch_media_type_t type); +SWITCH_DECLARE(void) switch_core_media_reset_autofix(switch_core_session_t *session, switch_media_type_t type); SWITCH_DECLARE(void) switch_core_media_check_outgoing_proxy(switch_core_session_t *session, switch_core_session_t *o_session); SWITCH_DECLARE(switch_status_t) switch_core_media_codec_chosen(switch_core_session_t *session, switch_media_type_t media); SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *session); diff --git a/src/include/switch_types.h b/src/include/switch_types.h index a847006e09..7f3aade715 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -762,10 +762,17 @@ typedef enum { If this setting is enabled it will NOT do this (old behaviour). */ - RTP_BUG_FLUSH_JB_ON_DTMF = (1 << 10) + RTP_BUG_FLUSH_JB_ON_DTMF = (1 << 10), /* FLUSH JITTERBUFFER When getting RFC2833 to reduce bleed through */ + RTP_BUG_ACCEPT_ANY_PAYLOAD = (1 << 11) + + /* + Make FS accept any payload type instead of dropping and returning CNG frame. Workaround while FS only supports a single payload per rtp session. + This can be used by endpoint modules to detect payload changes and act appropriately (ex: sofia could send a reINVITE with single codec). + This should probably be a flag, but flag enum is already full! + */ } switch_rtp_bug_flag_t; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 561a887aea..50261d7f4e 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1273,8 +1273,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi switch_channel_set_flag(tech_pvt->channel, CF_SECURE); } - if (sofia_test_media_flag(tech_pvt->profile, SCMF_AUTOFIX_TIMING)) { - switch_core_media_reset_autofix_timing(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO); + if (sofia_test_media_flag(tech_pvt->profile, SCMF_AUTOFIX_TIMING) || sofia_test_media_flag(tech_pvt->profile, SCMF_AUTOFIX_PT)) { + switch_core_media_reset_autofix(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO); } } break; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index a95010539a..b87b5a35ef 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3714,6 +3714,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) sofia_set_pflag(profile, PFLAG_DISABLE_100REL); profile->auto_restart = 1; sofia_set_media_flag(profile, SCMF_AUTOFIX_TIMING); + sofia_set_media_flag(profile, SCMF_AUTOFIX_PT); sofia_set_media_flag(profile, SCMF_RTP_AUTOFLUSH_DURING_BRIDGE); profile->contact_user = SOFIA_DEFAULT_CONTACT_USER; sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID); @@ -4325,6 +4326,12 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } else { sofia_clear_media_flag(profile, SCMF_AUTOFIX_TIMING); } + } else if (!strcasecmp(var, "rtp-autofix-pt")) { + if (switch_true(val)) { + sofia_set_media_flag(profile, SCMF_AUTOFIX_PT); + } else { + sofia_clear_media_flag(profile, SCMF_AUTOFIX_PT); + } } else if (!strcasecmp(var, "contact-user")) { profile->contact_user = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "nat-options-ping")) { @@ -5188,8 +5195,8 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status sofia_update_callee_id(session, profile, sip, SWITCH_FALSE); - if (sofia_test_media_flag(tech_pvt->profile, SCMF_AUTOFIX_TIMING)) { - switch_core_media_reset_autofix_timing(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO); + if (sofia_test_media_flag(tech_pvt->profile, SCMF_AUTOFIX_TIMING) || sofia_test_media_flag(tech_pvt->profile, SCMF_AUTOFIX_PT)) { + switch_core_media_reset_autofix(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO); } } diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 96ab5f7892..6dde6cf3e6 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -591,6 +591,14 @@ SWITCH_DECLARE(void) switch_core_media_parse_rtp_bugs(switch_rtp_bug_flag_t *fla *flag_pole &= ~RTP_BUG_ACCEPT_ANY_PACKETS; } + if (switch_stristr("ACCEPT_ANY_PAYLOAD", str)) { + *flag_pole |= RTP_BUG_ACCEPT_ANY_PAYLOAD; + } + + if (switch_stristr("~ACCEPT_ANY_PAYLOAD", str)) { + *flag_pole &= ~RTP_BUG_ACCEPT_ANY_PAYLOAD; + } + if (switch_stristr("GEN_ONE_GEN_ALL", str)) { *flag_pole |= RTP_BUG_GEN_ONE_GEN_ALL; } @@ -1333,8 +1341,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session return SWITCH_STATUS_GENERR; } - if ((engine->read_frame.datalen % 10) == 0 && - (smh->media_flags[SCMF_AUTOFIX_TIMING]) && engine->check_frames < MAX_CODEC_CHECK_FRAMES) { + /* check for timing or codec issues */ + if ((smh->media_flags[SCMF_AUTOFIX_TIMING] || smh->media_flags[SCMF_AUTOFIX_PT]) && + engine->check_frames < MAX_CODEC_CHECK_FRAMES) { + + int reset_codec = 0; + engine->check_frames++; if (!engine->read_impl.encoded_bytes_per_packet) { @@ -1342,111 +1354,172 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session goto skip; } - if (engine->last_ts && engine->read_frame.datalen != engine->read_impl.encoded_bytes_per_packet) { - uint32_t codec_ms = (int) (engine->read_frame.timestamp - - engine->last_ts) / (engine->read_impl.samples_per_second / 1000); + /* autofix payload type */ + if (smh->media_flags[SCMF_AUTOFIX_PT] && + engine->read_frame.payload != smh->mparams->cng_pt && + engine->read_frame.payload != smh->mparams->recv_te && + engine->read_frame.payload != smh->mparams->te && + engine->read_frame.payload != engine->codec_params.recv_pt && + engine->read_frame.payload != engine->codec_params.agreed_pt && + engine->read_frame.payload != engine->codec_params.pt) { - if ((codec_ms % 10) != 0 || codec_ms > engine->read_impl.samples_per_packet * 10) { - engine->last_ts = 0; - goto skip; + int i = 0; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "Invalid payload received (received %d, expecting %d). " + "FS doesn't support multiple payload types in a single RTP session.\n", + (int) engine->read_frame.payload, (int) engine->codec_params.agreed_pt); + + /* search for payload type */ + for (i = 0; i < smh->mparams->num_codecs; i++) { + if (engine->read_frame.payload == smh->ianacodes[i]) { + const switch_codec_implementation_t *imp = smh->codecs[i]; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "Changing current codec to %s (payload type %d).\n", + imp->iananame, (int) engine->read_frame.payload); + + engine->codec_params.iananame = switch_core_session_strdup(smh->session, imp->iananame); + engine->codec_params.pt = imp->ianacode; + engine->codec_params.agreed_pt = imp->ianacode; + engine->codec_params.recv_pt = imp->ianacode; + engine->codec_params.rm_encoding = switch_core_session_strdup(smh->session, imp->iananame); + engine->codec_params.rm_fmtp = NULL; + engine->codec_params.rm_rate = imp->samples_per_second; + engine->codec_params.codec_ms = imp->microseconds_per_packet / 1000; + engine->codec_params.bitrate = imp->bits_per_second; + engine->codec_params.channels = 1; + + /* mark to re-set codec */ + reset_codec = 1; + break; + } } - - if (engine->last_codec_ms && engine->last_codec_ms == codec_ms) { - engine->mismatch_count++; + if (!reset_codec) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "Could not change to payload type %d, ignoring...\n", + (int) engine->read_frame.payload); } - engine->last_codec_ms = codec_ms; + /* autofix timing */ + } else if (smh->media_flags[SCMF_AUTOFIX_TIMING] && (engine->read_frame.datalen % 10) == 0) { - if (engine->mismatch_count > MAX_MISMATCH_FRAMES) { - if (switch_rtp_ready(engine->rtp_session) && codec_ms != engine->codec_params.codec_ms) { - const char *val; - int rtp_timeout_sec = 0; - int rtp_hold_timeout_sec = 0; + if (engine->last_ts && engine->read_frame.datalen != engine->read_impl.encoded_bytes_per_packet) { - if (codec_ms > 120) { /* yeah right */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, - "Your phone is trying to send timestamps that suggest an increment of %dms per packet\n" - "That seems hard to believe so I am going to go on ahead and um ignore that, mmkay?\n", - (int) codec_ms); - engine->check_frames = MAX_CODEC_CHECK_FRAMES; - goto skip; - } + uint32_t codec_ms = (int) (engine->read_frame.timestamp - + engine->last_ts) / (engine->read_impl.samples_per_second / 1000); - engine->read_frame.datalen = 0; - - if (codec_ms != engine->codec_params.codec_ms) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, - "Asynchronous PTIME not supported, changing our end from %d to %d\n", - (int) engine->codec_params.codec_ms, - (int) codec_ms - ); - - switch_channel_set_variable_printf(session->channel, "rtp_h_X-Broken-PTIME", "Adv=%d;Sent=%d", - (int) engine->codec_params.codec_ms, (int) codec_ms); - - engine->codec_params.codec_ms = codec_ms; - } - - - if (switch_core_media_set_codec(session, 2, 0) != SWITCH_STATUS_SUCCESS) { - *frame = NULL; - return SWITCH_STATUS_GENERR; - } - - if ((val = switch_channel_get_variable(session->channel, "rtp_timeout_sec"))) { - int v = atoi(val); - if (v >= 0) { - rtp_timeout_sec = v; - } - } - - if ((val = switch_channel_get_variable(session->channel, "rtp_hold_timeout_sec"))) { - int v = atoi(val); - if (v >= 0) { - rtp_hold_timeout_sec = v; - } - } - - if (rtp_timeout_sec) { - engine->max_missed_packets = (engine->read_impl.samples_per_second * rtp_timeout_sec) / - engine->read_impl.samples_per_packet; - - switch_rtp_set_max_missed_packets(engine->rtp_session, engine->max_missed_packets); - if (!rtp_hold_timeout_sec) { - rtp_hold_timeout_sec = rtp_timeout_sec * 10; - } - } - - if (rtp_hold_timeout_sec) { - engine->max_missed_hold_packets = (engine->read_impl.samples_per_second * rtp_hold_timeout_sec) / - engine->read_impl.samples_per_packet; - } - - - engine->check_frames = 0; + if ((codec_ms % 10) != 0 || codec_ms > engine->read_impl.samples_per_packet * 10) { engine->last_ts = 0; - - *frame = &engine->read_frame; - switch_set_flag((*frame), SFF_CNG); - (*frame)->datalen = engine->read_impl.encoded_bytes_per_packet; - memset((*frame)->data, 0, (*frame)->datalen); - return SWITCH_STATUS_SUCCESS; + goto skip; } + + if (engine->last_codec_ms && engine->last_codec_ms == codec_ms) { + engine->mismatch_count++; + } + + engine->last_codec_ms = codec_ms; + + if (engine->mismatch_count > MAX_MISMATCH_FRAMES) { + if (codec_ms != engine->codec_params.codec_ms) { + + if (codec_ms > 120) { /* yeah right */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "Your phone is trying to send timestamps that suggest an increment of %dms per packet\n" + "That seems hard to believe so I am going to go on ahead and um ignore that, mmkay?\n", + (int) codec_ms); + engine->check_frames = MAX_CODEC_CHECK_FRAMES; + goto skip; + } + + engine->read_frame.datalen = 0; + + if (codec_ms != engine->codec_params.codec_ms) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "Asynchronous PTIME not supported, changing our end from %d to %d\n", + (int) engine->codec_params.codec_ms, + (int) codec_ms + ); + + switch_channel_set_variable_printf(session->channel, "rtp_h_X-Broken-PTIME", "Adv=%d;Sent=%d", + (int) engine->codec_params.codec_ms, (int) codec_ms); + + engine->codec_params.codec_ms = codec_ms; + + /* mark to re-set codec */ + reset_codec = 2; + } + } + } + + } else { + engine->mismatch_count = 0; } + engine->last_ts = engine->read_frame.timestamp; + + } else { engine->mismatch_count = 0; + engine->last_ts = 0; } - engine->last_ts = engine->read_frame.timestamp; + /* re-set codec if necessary */ + if (reset_codec > 0) { + const char *val; + int rtp_timeout_sec = 0; + int rtp_hold_timeout_sec = 0; + if (switch_rtp_ready(engine->rtp_session)) { + if (switch_core_media_set_codec(session, 2, 0) != SWITCH_STATUS_SUCCESS) { + *frame = NULL; + return SWITCH_STATUS_GENERR; + } - } else { - engine->mismatch_count = 0; - engine->last_ts = 0; + if ((val = switch_channel_get_variable(session->channel, "rtp_timeout_sec"))) { + int v = atoi(val); + if (v >= 0) { + rtp_timeout_sec = v; + } + } + + if ((val = switch_channel_get_variable(session->channel, "rtp_hold_timeout_sec"))) { + int v = atoi(val); + if (v >= 0) { + rtp_hold_timeout_sec = v; + } + } + + if (rtp_timeout_sec) { + engine->max_missed_packets = (engine->read_impl.samples_per_second * rtp_timeout_sec) / + engine->read_impl.samples_per_packet; + + switch_rtp_set_max_missed_packets(engine->rtp_session, engine->max_missed_packets); + if (!rtp_hold_timeout_sec) { + rtp_hold_timeout_sec = rtp_timeout_sec * 10; + } + } + + if (rtp_hold_timeout_sec) { + engine->max_missed_hold_packets = (engine->read_impl.samples_per_second * rtp_hold_timeout_sec) / + engine->read_impl.samples_per_packet; + } + } + + engine->check_frames = 0; + engine->last_ts = 0; + + /* return CNG for now */ + *frame = &engine->read_frame; + switch_set_flag((*frame), SFF_CNG); + (*frame)->datalen = engine->read_impl.encoded_bytes_per_packet; + memset((*frame)->data, 0, (*frame)->datalen); + return SWITCH_STATUS_SUCCESS; + } } + skip: if ((bytes = engine->read_impl.encoded_bytes_per_packet)) { @@ -3372,7 +3445,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_proxy_remote_addr(switch_core_ /* Reactivate the NAT buster flag. */ switch_rtp_set_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_AUTOADJ); } - if (switch_media_handle_test_media_flag(smh, SCMF_AUTOFIX_TIMING)) { + if (switch_media_handle_test_media_flag(smh, SCMF_AUTOFIX_TIMING) || switch_media_handle_test_media_flag(smh, SCMF_AUTOFIX_PT)) { v_engine->check_frames = 0; } } @@ -3410,7 +3483,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_proxy_remote_addr(switch_core_ /* Reactivate the NAT buster flag. */ switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_AUTOADJ); } - if (switch_media_handle_test_media_flag(smh, SCMF_AUTOFIX_TIMING)) { + if (switch_media_handle_test_media_flag(smh, SCMF_AUTOFIX_TIMING) || switch_media_handle_test_media_flag(smh, SCMF_AUTOFIX_PT)) { a_engine->check_frames = 0; } status = SWITCH_STATUS_SUCCESS; @@ -3514,7 +3587,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_ext_address_lookup(switch_core } //? -SWITCH_DECLARE(void) switch_core_media_reset_autofix_timing(switch_core_session_t *session, switch_media_type_t type) +SWITCH_DECLARE(void) switch_core_media_reset_autofix(switch_core_session_t *session, switch_media_type_t type) { switch_rtp_engine_t *engine; switch_media_handle_t *smh; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 785d51fbb0..d961d7df58 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -4819,7 +4819,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ rtp_session->recv_msg.header.pt != 13 && rtp_session->recv_msg.header.pt != rtp_session->recv_te && (!rtp_session->cng_pt || rtp_session->recv_msg.header.pt != rtp_session->cng_pt) && - rtp_session->recv_msg.header.pt != rtp_session->rpayload && !(rtp_session->rtp_bugs & RTP_BUG_ACCEPT_ANY_PACKETS)) { + rtp_session->recv_msg.header.pt != rtp_session->rpayload && + !(rtp_session->rtp_bugs & RTP_BUG_ACCEPT_ANY_PAYLOAD) && !(rtp_session->rtp_bugs & RTP_BUG_ACCEPT_ANY_PACKETS)) { /* drop frames of incorrect payload number and return CNG frame instead */ return_cng_frame(); } From 0d4964f7b7025afaaec0420099c1f13808144003 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Mon, 29 Jul 2013 23:59:06 +0800 Subject: [PATCH 55/88] add settings disabled by default The new websocket stuff breaks windows build so please fix, thanks --- .../xml_int/mod_xml_rpc/conf/autoload_configs/xml_rpc.conf.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/xml_int/mod_xml_rpc/conf/autoload_configs/xml_rpc.conf.xml b/src/mod/xml_int/mod_xml_rpc/conf/autoload_configs/xml_rpc.conf.xml index 714a909907..b5f0bc317c 100644 --- a/src/mod/xml_int/mod_xml_rpc/conf/autoload_configs/xml_rpc.conf.xml +++ b/src/mod/xml_int/mod_xml_rpc/conf/autoload_configs/xml_rpc.conf.xml @@ -6,5 +6,7 @@ + + From bd71934e81eabf70ffb26f5aba7ea61df6fc08de Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 30 Jul 2013 02:10:52 +0800 Subject: [PATCH 56/88] show live calls --- htdocs/portal/assets/js/fsportal.js | 26 ++++++++++++++++++++++++++ htdocs/portal/index.html | 1 + 2 files changed, 27 insertions(+) diff --git a/htdocs/portal/assets/js/fsportal.js b/htdocs/portal/assets/js/fsportal.js index 618b3d5004..4738f90143 100644 --- a/htdocs/portal/assets/js/fsportal.js +++ b/htdocs/portal/assets/js/fsportal.js @@ -263,6 +263,10 @@ App.callsController = Ember.ArrayController.create({ }); }, + delete: function(uuid) { + var obj = this.content.findProperty("uuid", uuid); + if (obj) this.content.removeObject(obj);// else alert(uuid); + }, dump: function(uuid) { var obj = this.content.findProperty("uuid", uuid); console.log(obj.getProperties(["uuid", "cid_num"])); @@ -724,8 +728,30 @@ function eventCallback(data) { direction: data["Call-Direction"] } App.channelsController.pushObject(App.Channel.create(channel)); + App.callsController.pushObject(App.Call.create(channel)); } else if (data["Event-Name"] == "CHANNEL_HANGUP_COMPLETE") { App.channelsController.delete(data["Unique-ID"]); + App.callsController.delete(data["Unique-ID"]); + } else if (data["Event-Name"] == "CHANNEL_BRIDGE") { + App.callsController.delete(data["Unique-ID"]); + App.callsController.delete(data["Other-Leg-Unique-ID"]); + + var call = { + uuid: data["Unique-ID"], + b_uuid: data["Other-Leg-Unique-ID"], + cid_num: data["Caller-Caller-ID-Number"], + b_cid_num: data["Other-Leg-Caller-ID-Number"], + dest: data["Caller-Destination-Number"], + b_dest: data["Other-Leg-Destination-Number"], + callstate: data["Channel-Call-State"], + b_callstate: data["Channel-Call-State"], + direction: data["Call-Direction"], + b_direction: data["Other-Leg-Direction"], + created: data["Caller-Channel-Created-Time"] + }; + + App.callsController.pushObject(App.Call.create(call)); + } else if (data["Event-Name"] == "CHANNEL_CALLSTATE") { var obj = App.channelsController.content.findProperty("uuid", data["Unique-ID"]); if (obj) { diff --git a/htdocs/portal/index.html b/htdocs/portal/index.html index 8771a8f09e..6f49e85501 100644 --- a/htdocs/portal/index.html +++ b/htdocs/portal/index.html @@ -709,6 +709,7 @@ $('#ws-status').html('Socket Connected').css("color", "green"); // socket.send("event json all"); socket.send("event json CHANNEL_CREATE"); + socket.send("event json CHANNEL_BRIDGE"); socket.send("event json CHANNEL_HANGUP_COMPLETE"); socket.send("event json CHANNEL_CALLSTATE"); } From b97103d6be5844684381c57deda19d4af3672afd Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 30 Jul 2013 02:18:14 +0800 Subject: [PATCH 57/88] Oops, we already have auto_update with pulling Only use events to update calls when not pulling --- htdocs/portal/assets/js/fsportal.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/htdocs/portal/assets/js/fsportal.js b/htdocs/portal/assets/js/fsportal.js index 4738f90143..ab99306846 100644 --- a/htdocs/portal/assets/js/fsportal.js +++ b/htdocs/portal/assets/js/fsportal.js @@ -728,11 +728,28 @@ function eventCallback(data) { direction: data["Call-Direction"] } App.channelsController.pushObject(App.Channel.create(channel)); + + var x = $('#auto_update_calls')[0]; + if (typeof x != "undefined" && x.checked) { + return; + } + App.callsController.pushObject(App.Call.create(channel)); } else if (data["Event-Name"] == "CHANNEL_HANGUP_COMPLETE") { App.channelsController.delete(data["Unique-ID"]); + + var x = $('#auto_update_calls')[0]; + if (typeof x != "undefined" && x.checked) { + return; + } + App.callsController.delete(data["Unique-ID"]); } else if (data["Event-Name"] == "CHANNEL_BRIDGE") { + var x = $('#auto_update_calls')[0]; + if (typeof x != "undefined" && x.checked) { + return; + } + App.callsController.delete(data["Unique-ID"]); App.callsController.delete(data["Other-Leg-Unique-ID"]); From d00c8a6abf1f9447bee468fc6206816b535df001 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 29 Jul 2013 16:06:56 -0500 Subject: [PATCH 58/88] FS-5641 --resolve --- libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c index a9fed48ffe..c5400dd4ca 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c @@ -1062,11 +1062,15 @@ int nua_client_response(nua_client_request_t *cr, sip_method_t method = cr->cr_method; int terminated, graceful = 1; - if (status < 700) - terminated = sip_response_terminates_dialog(status, method, &graceful); - else - /* XXX - terminate usage by all internal error responses */ - terminated = 0, graceful = 1; + if (status < 700) { + terminated = sip_response_terminates_dialog(status, method, &graceful); + if (terminated && !cr->cr_initial) { + terminated = 0, graceful = 1; + } + } else { + /* XXX - terminate usage by all internal error responses */ + terminated = 0, graceful = 1; + } if (terminated < 0) cr->cr_terminated = terminated; From 143b1c44ebf28716ddfab8bd8ff7c614e2d3e45e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 29 Jul 2013 16:07:34 -0500 Subject: [PATCH 59/88] rebuild --- libs/sofia-sip/.update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 4dc866b6d6..eba02f5caf 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Fri Jul 26 11:26:00 CDT 2013 +Mon Jul 29 16:07:25 CDT 2013 From 511efc5cf02b68f4d5009142a5d3ae7584325b3d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 29 Jul 2013 16:55:16 -0500 Subject: [PATCH 60/88] FS-5652 --resolve --- src/mod/endpoints/mod_sofia/sofia.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b87b5a35ef..c9c09b233e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -8015,6 +8015,8 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia if (!strcmp(network_ip, profile->sipip) && network_port == profile->sip_port) { calling_myself++; } else { + switch_event_create(&v_event, SWITCH_EVENT_REQUEST_PARAMS); + if (sofia_reg_handle_register(nua, profile, nh, sip, de, REG_INVITE, key, sizeof(key), &v_event, NULL, NULL, &x_user)) { if (v_event) { switch_event_destroy(&v_event); @@ -8035,7 +8037,6 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia - tech_pvt->mparams.remote_ip = switch_core_session_strdup(session, network_ip); tech_pvt->mparams.remote_port = network_port; @@ -8112,6 +8113,12 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia const char *ruser = NULL, *rdomain = NULL, *user = switch_xml_attr(x_user, "id"), *domain = switch_xml_attr(x_user, "domain-name"); if (v_event) { + switch_event_header_t *hp; + + for (hp = v_event->headers; hp; hp = hp->next) { + switch_channel_set_variable(channel, hp->name, hp->value); + } + ruser = switch_event_get_header(v_event, "username"); rdomain = switch_event_get_header(v_event, "domain_name"); From d8a02dc2449769870c400688f77f78054eb05b30 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 30 Jul 2013 16:35:46 +0800 Subject: [PATCH 61/88] add timeout options to mod_curl --- src/mod/applications/mod_curl/mod_curl.c | 36 +++++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c index bcc5335513..74ab3c1d88 100644 --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -25,6 +25,7 @@ * * Rupa Schomaker * Yossi Neiman + * Seven Du * * mod_curl.c -- API for performing http queries * @@ -106,6 +107,12 @@ struct callback_obj { }; typedef struct callback_obj callback_t; +struct curl_options_obj { + long connect_timeout; + long timeout; +}; +typedef struct curl_options_obj curl_options_t; + static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data) { register unsigned int realsize = (unsigned int) (size * nmemb); @@ -138,7 +145,7 @@ static size_t header_callback(void *ptr, size_t size, size_t nmemb, void *data) return realsize; } -static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, const char *method, const char *data, const char *content_type) +static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, const char *method, const char *data, const char *content_type, curl_options_t *options) { switch_CURL *curl_handle = NULL; long httpRes = 0; @@ -156,9 +163,19 @@ static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, c method = "get"; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "method: %s, url: %s, content-type: %s\n", method, url, content_type); curl_handle = switch_curl_easy_init(); + if (options) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%ld %ld\n", options->connect_timeout, options->timeout); + if (options->connect_timeout) { + switch_curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, options->connect_timeout); + } + + if (options->timeout) { + switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, options->timeout); + } + } + if (!strncasecmp(url, "https", 5)) { switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0); switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0); @@ -710,6 +727,8 @@ SWITCH_STANDARD_APP(curl_app_function) switch_curl_slist_t *slist = NULL; switch_stream_handle_t stream = { 0 }; int i = 0; + curl_options_t options = { 0 }; + const char *curl_timeout; if (session) { pool = switch_core_session_get_pool(session); @@ -750,7 +769,16 @@ SWITCH_STANDARD_APP(curl_app_function) } } - http_data = do_lookup_url(pool, url, method, postdata, content_type); + curl_timeout = switch_channel_get_variable(channel, "curl_connect_timeout"); + + if (curl_timeout) options.connect_timeout = atoi(curl_timeout); + + curl_timeout = switch_channel_get_variable(channel, "curl_timeout"); + + if (curl_timeout) options.timeout = atoi(curl_timeout); + + + http_data = do_lookup_url(pool, url, method, postdata, content_type, &options); if (do_json) { switch_channel_set_variable(channel, "curl_response_data", print_json(pool, http_data)); } else { @@ -843,7 +871,7 @@ SWITCH_STANDARD_API(curl_function) } } - http_data = do_lookup_url(pool, url, method, postdata, content_type); + http_data = do_lookup_url(pool, url, method, postdata, content_type, NULL); if (do_json) { stream->write_function(stream, "%s", print_json(pool, http_data)); } else { From b5e1725d529665ef70a08c8150594c01df28efc5 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 30 Jul 2013 18:02:08 +0800 Subject: [PATCH 62/88] remove debug --- src/mod/applications/mod_curl/mod_curl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c index 74ab3c1d88..858b28f0b4 100644 --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -166,7 +166,6 @@ static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, c curl_handle = switch_curl_easy_init(); if (options) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%ld %ld\n", options->connect_timeout, options->timeout); if (options->connect_timeout) { switch_curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, options->connect_timeout); } From 92d945e8935430580c047a0905899493c9ce6b0a Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 30 Jul 2013 22:12:58 +0800 Subject: [PATCH 63/88] add back the log line deleted by accident --- src/mod/applications/mod_curl/mod_curl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c index 858b28f0b4..7d62342c4a 100644 --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -163,6 +163,7 @@ static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, c method = "get"; } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "method: %s, url: %s, content-type: %s\n", method, url, content_type); curl_handle = switch_curl_easy_init(); if (options) { From 28a58f5436d5556d83433ba2818457af31ae7330 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 30 Jul 2013 19:37:17 +0500 Subject: [PATCH 64/88] add -certs command line switch --- src/switch.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/switch.c b/src/switch.c index 6ae8e584db..8624682bc5 100644 --- a/src/switch.c +++ b/src/switch.c @@ -461,6 +461,7 @@ static const char usage[] = "\t-scripts [scriptsdir] -- alternate directory for scripts\n" "\t-temp [directory] -- alternate directory for temporary files\n" "\t-grammar [directory] -- alternate directory for grammar files\n" + "\t-certs [directory] -- alternate directory for certificates\n" "\t-recordings [directory] -- alternate directory for recordings\n" "\t-storage [directory] -- alternate directory for voicemail storage\n" "\t-sounds [directory] -- alternate directory for sound files\n"; @@ -944,6 +945,21 @@ int main(int argc, char *argv[]) strcpy(SWITCH_GLOBAL_dirs.grammar_dir, local_argv[x]); } + else if (!strcmp(local_argv[x], "-certs")) { + x++; + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { + fprintf(stderr, "When using -certs you must specify a grammar directory\n"); + return 255; + } + + SWITCH_GLOBAL_dirs.certs_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.certs_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.certs_dir, local_argv[x]); + } + else if (!strcmp(local_argv[x], "-sounds")) { x++; if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { From 8133e58acbb7feea8e30c1add795766e9853b04f Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 30 Jul 2013 23:43:22 +0800 Subject: [PATCH 65/88] update FreeSWITCH Portal About page --- htdocs/portal/index.html | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/htdocs/portal/index.html b/htdocs/portal/index.html index 6f49e85501..d9a8d5ab51 100644 --- a/htdocs/portal/index.html +++ b/htdocs/portal/index.html @@ -529,6 +529,66 @@ The FreeSWITCH Portal Project is Created by Seven Du. Available with MPL1.1 licence - Same as FreeSWITCH.

+ + +

The FreeSWITCH Portal Project is designed to show an intuitive view of the FreeSWITCH internals. It can be used by FreeSWITCH funs, administrators, developers etc. It does not aims to replace GUIs such as FusionPBX or blue.box. It would be very easy to use and super helpful for new FreeSWITCH users. + +


+

Philosophy

+ +

To provide a GUI out of the box without depends on external resources like PHP or a webserver such as Apache or Nginx. + +

Mainly developed with static html and Javascripts, and perhaps some lua scripts can help do some more magic things later. + +

Install

+ +

If you see this page it means you already installed. Remember it works Out of the Box! + +

Todo

+ + +
  • Modify users: A raw idea to add a new user would be something like below and reloadxml. + +
    sed -e 's/1000/new-user/g' 1000.xml > new-user.xml
    + +
  • Modify dialplan and/or other XMLs: possible to use some online XML editor and + can save the XML with some lua or C code at the backend, + although there are security concerns. + +
  • Store information in DB: I guess the Dbh handle in lua should can do something like this. + +
  • Web terminal: With terminal.js like things and websocket we can really build a web version of fs_cli + +
  • rtmp web client support to make and receive calls + +
  • WebRTC? + +
  • Logging, Event Debugging or SIP tracing: Yeah, more magic + +
  • i18n + +

    Security

    + +

    The primary goal is to help new users learn and use FreeSWITCH. + Please DON'T put this on your production server as + I haven't think anything about security. + +

    You can disable this by delete or move the portal directory out of /usr/local/freeswitch/htdocs . e.g. + +

    mv /usr/local/freeswitch/htdocs/portal /usr/local/freeswitch/
    + + And move back any time you want. + +

    Development

    + +
  • I started this project to learn how to use bootstrap and ember.js, + the latter said it is a framework for creating ambitious web applications. + +
  • Contributions and patches are welcome. +
    +
    +
    +
    From 878c232b06a4c09cf507b2df481ab8dc3d7003d4 Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Tue, 30 Jul 2013 14:35:39 -0500 Subject: [PATCH 68/88] mod_skinny: initial reg wasn't able to clean up due to missing device name, add new function to clean up given explicit device name, also add more logging --- src/mod/endpoints/mod_skinny/mod_skinny.c | 55 ++++++++++++++++++++ src/mod/endpoints/mod_skinny/mod_skinny.h | 1 + src/mod/endpoints/mod_skinny/skinny_server.c | 11 ++-- 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 407aa65499..72cc82f9fa 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1326,12 +1326,64 @@ static int flush_listener_callback(void *pArg, int argc, char **argv, char **col return 0; } +void skinny_clean_device_from_db(listener_t *listener, char *device_name) +{ + if(!zstr(device_name)) { + skinny_profile_t *profile = listener->profile; + char *sql; + + skinny_log_l(listener, SWITCH_LOG_DEBUG, + "Clean device from DB with name '%s'\n", + device_name); + + if ((sql = switch_mprintf( + "DELETE FROM skinny_devices " + "WHERE name='%s'", + device_name))) { + skinny_execute_sql(profile, sql, profile->sql_mutex); + switch_safe_free(sql); + } + + if ((sql = switch_mprintf( + "DELETE FROM skinny_lines " + "WHERE device_name='%s'", + device_name))) { + skinny_execute_sql(profile, sql, profile->sql_mutex); + switch_safe_free(sql); + } + + if ((sql = switch_mprintf( + "DELETE FROM skinny_buttons " + "WHERE device_name='%s'", + device_name))) { + skinny_execute_sql(profile, sql, profile->sql_mutex); + switch_safe_free(sql); + } + + if ((sql = switch_mprintf( + "DELETE FROM skinny_active_lines " + "WHERE device_name='%s'", + device_name))) { + skinny_execute_sql(profile, sql, profile->sql_mutex); + switch_safe_free(sql); + } + + } else { + skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, + "Clean device from DB, missing device name.\n"); + } +} + void skinny_clean_listener_from_db(listener_t *listener) { if(!zstr(listener->device_name)) { skinny_profile_t *profile = listener->profile; char *sql; + skinny_log_l(listener, SWITCH_LOG_DEBUG, + "Clean listener from DB with name '%s' and instance '%d'\n", + listener->device_name, listener->device_instance); + if ((sql = switch_mprintf( "DELETE FROM skinny_devices " "WHERE name='%s' and instance=%d", @@ -1364,6 +1416,9 @@ void skinny_clean_listener_from_db(listener_t *listener) switch_safe_free(sql); } + } else { + skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, + "Clean listener from DB, missing device name.\n"); } } diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index 76ca8017ac..d8ed1b03bf 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -276,6 +276,7 @@ uint8_t listener_is_ready(listener_t *listener); switch_status_t kill_listener(listener_t *listener, void *pvt); switch_status_t keepalive_listener(listener_t *listener, void *pvt); void skinny_clean_listener_from_db(listener_t *listener); +void skinny_clean_device_from_db(listener_t *listener, char *device_name); /*****************************************************************************/ /* CHANNEL FUNCTIONS */ diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index feac761cc3..95d486d3e0 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -975,6 +975,9 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r skinny_device_event(listener, ¶ms, SWITCH_EVENT_REQUEST_PARAMS, SWITCH_EVENT_SUBCLASS_ANY); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", "skinny-auth"); + /* clean up all traces before adding to database */ + skinny_clean_device_from_db(listener, request->data.reg.device_name); + if (switch_xml_locate_user("id", request->data.reg.device_name, profile->domain, "", &xroot, &xdomain, &xuser, &xgroup, params) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't find device [%s@%s]\n" "You must define a domain called '%s' in your directory and add a user with id=\"%s\".\n" @@ -984,6 +987,11 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r goto end; } + /* we clean up device above, so this below block will never trigger. I don't + know the full details of why there would be multiple listeners with + the same device - maybe a VGC or similar? Not really high priority for + support at the moment, but may need to revisit this later */ + skinny_profile_find_listener_by_device_name_and_instance(listener->profile, request->data.reg.device_name, request->data.reg.instance, &listener2); if (listener2) { @@ -995,9 +1003,6 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r goto end; } - /* clean up all traces before adding to database */ - skinny_clean_listener_from_db(listener); - if ((sql = switch_mprintf( "INSERT INTO skinny_devices " "(name, user_id, instance, ip, type, max_streams, codec_string) " From da29531c08074ee55cd31005959033915becfd5a Mon Sep 17 00:00:00 2001 From: Seven Du Date: Wed, 31 Jul 2013 15:34:20 +0800 Subject: [PATCH 69/88] cleanup code, less dependency --- src/mod/xml_int/mod_xml_rpc/Makefile | 2 +- src/mod/xml_int/mod_xml_rpc/ws.c | 1 - src/mod/xml_int/mod_xml_rpc/ws.h | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mod/xml_int/mod_xml_rpc/Makefile b/src/mod/xml_int/mod_xml_rpc/Makefile index f0585dc324..bc7e4c1de4 100644 --- a/src/mod/xml_int/mod_xml_rpc/Makefile +++ b/src/mod/xml_int/mod_xml_rpc/Makefile @@ -65,7 +65,7 @@ ws.o LOCAL_CFLAGS = -w -I$(XMLRPC_DIR)/lib/expat/xmlparse -I$(XMLRPC_DIR)/lib/expat/xmltok -I$(XMLRPC_DIR) -I$(XMLRPC_DIR)/include LOCAL_CFLAGS+= -I$(XMLRPC_DIR)/lib/abyss/src -I$(XMLRPC_DIR)/lib/util/include -D_THREAD -D__EXTENSIONS__ -LOCAL_CFLAGS+= -I. -I../../../../libs/sofia-sip/libsofia-sip-ua/su +LOCAL_CFLAGS+= -I. include $(BASE)/build/modmake.rules diff --git a/src/mod/xml_int/mod_xml_rpc/ws.c b/src/mod/xml_int/mod_xml_rpc/ws.c index 1ef76e3cc9..40829ffe40 100644 --- a/src/mod/xml_int/mod_xml_rpc/ws.c +++ b/src/mod/xml_int/mod_xml_rpc/ws.c @@ -1,5 +1,4 @@ #include "ws.h" -#include #ifndef _MSC_VER #include diff --git a/src/mod/xml_int/mod_xml_rpc/ws.h b/src/mod/xml_int/mod_xml_rpc/ws.h index 06fd3b2594..f5cb5e820a 100644 --- a/src/mod/xml_int/mod_xml_rpc/ws.h +++ b/src/mod/xml_int/mod_xml_rpc/ws.h @@ -11,24 +11,24 @@ #include #include #include +#include #else #pragma warning(disable:4996) +#define snprintf _snprintf #endif #include -#include #include #include #include #include #include #include -//#include "sha1.h" #include -#include #include <../lib/abyss/src/session.h> #include <../lib/abyss/src/conn.h> typedef TSession ws_tsession_t; +typedef int issize_t; struct globals_s { const SSL_METHOD *ssl_method; From 89eb8c4624c1055c85bec106573b81a072e60558 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Wed, 31 Jul 2013 16:19:58 +0800 Subject: [PATCH 70/88] trying to fix windows build --- .../mod_xml_rpc/mod_xml_rpc.2010.vcxproj | 14 +++++++++----- .../mod_xml_rpc/mod_xml_rpc.2012.vcxproj | 18 ++++++++++++++---- src/mod/xml_int/mod_xml_rpc/ws.h | 1 - 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2010.vcxproj b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2010.vcxproj index f95e975efe..6420eb41e5 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2010.vcxproj +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2010.vcxproj @@ -66,7 +66,7 @@ - $(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) + $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) ABYSS_WIN32;%(PreprocessorDefinitions) @@ -83,7 +83,7 @@ X64 - $(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) + $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) ABYSS_WIN32;%(PreprocessorDefinitions) @@ -98,7 +98,7 @@ - $(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) + $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) ABYSS_WIN32;%(PreprocessorDefinitions) @@ -115,7 +115,7 @@ X64 - $(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) + $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) ABYSS_WIN32;%(PreprocessorDefinitions) @@ -130,6 +130,7 @@ + @@ -149,7 +150,10 @@ false + + + - \ No newline at end of file + diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2012.vcxproj b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2012.vcxproj index 1a65b391e0..af3305a50c 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2012.vcxproj +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2012.vcxproj @@ -70,7 +70,7 @@ - $(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) + $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) ABYSS_WIN32;%(PreprocessorDefinitions) @@ -87,7 +87,7 @@ X64 - $(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) + $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) ABYSS_WIN32;%(PreprocessorDefinitions) @@ -102,7 +102,7 @@ - $(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) + $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) ABYSS_WIN32;%(PreprocessorDefinitions) @@ -119,7 +119,7 @@ X64 - $(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) + $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) ABYSS_WIN32;%(PreprocessorDefinitions) @@ -134,8 +134,15 @@ + + + {d331904d-a00a-4694-a5a3-fcff64ab5dbe} + + + {b4b62169-5ad4-4559-8707-3d933ac5db39} + {d2396dd7-7d38-473a-abb7-6f96d65ae1b9} @@ -153,6 +160,9 @@ false + + + diff --git a/src/mod/xml_int/mod_xml_rpc/ws.h b/src/mod/xml_int/mod_xml_rpc/ws.h index f5cb5e820a..09dfd282da 100644 --- a/src/mod/xml_int/mod_xml_rpc/ws.h +++ b/src/mod/xml_int/mod_xml_rpc/ws.h @@ -11,7 +11,6 @@ #include #include #include -#include #else #pragma warning(disable:4996) #define snprintf _snprintf From cbe7612ed5f65e50413a046388b425b3f1a8f0ca Mon Sep 17 00:00:00 2001 From: Seven Du Date: Wed, 31 Jul 2013 16:27:56 +0800 Subject: [PATCH 71/88] more cleanup --- src/mod/xml_int/mod_xml_rpc/ws.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/mod/xml_int/mod_xml_rpc/ws.c b/src/mod/xml_int/mod_xml_rpc/ws.c index 40829ffe40..a9a31c2b8b 100644 --- a/src/mod/xml_int/mod_xml_rpc/ws.c +++ b/src/mod/xml_int/mod_xml_rpc/ws.c @@ -219,13 +219,10 @@ static void sha1_digest(unsigned char *digest, char *in) int ws_handshake_kvp(wsh_t *wsh, char *key, char *version, char *proto) { - char uri[256] = ""; char input[256] = ""; unsigned char output[SHA1_HASH_SIZE] = ""; char b64[256] = ""; char respond[512] = ""; - issize_t bytes; - char *p, *e = 0; if (!wsh->tsession) { return -3; @@ -258,9 +255,6 @@ int ws_handshake_kvp(wsh_t *wsh, char *key, char *version, char *proto) snprintf(respond, sizeof(respond), "HTTP/1.1 400 Bad Request\r\n" "Sec-WebSocket-Version: 13\r\n\r\n"); - //printf("ERR:\n%s\n", respond); - - ws_raw_write(wsh, respond, strlen(respond)); ws_close(wsh, WS_NONE); From bb2832eb115d9c1937e79e99abbbc5b7a82d6a72 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Wed, 31 Jul 2013 07:16:23 -0400 Subject: [PATCH 72/88] mod_spandsp: added UUID command completion to start/stop_tone_detect commands --- src/mod/applications/mod_spandsp/mod_spandsp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index 91c907426a..51e2505758 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -648,7 +648,7 @@ switch_status_t load_configuration(switch_bool_t reload) "Unable to add tone_descriptor: %s, tone: %s. (too many tones)\n", name, tone_name); switch_goto_status(SWITCH_STATUS_FALSE, done); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Adding tone_descriptor: %s, tone: %s(%d)\n", name, tone_name, id); /* add elements to tone */ for (element = switch_xml_child(tone, "element"); element; element = switch_xml_next(element)) { @@ -683,7 +683,7 @@ switch_status_t load_configuration(switch_bool_t reload) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid element param.\n"); switch_goto_status(SWITCH_STATUS_FALSE, done); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Adding tone_descriptor: %s, tone: %s(%d), element (%d, %d, %d, %d)\n", name, tone_name, id, freq1, freq2, min, max); tone_descriptor_add_tone_element(descriptor, id, freq1, freq2, min, max); } @@ -713,7 +713,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init) *module_interface = switch_loadable_module_create_module_interface(pool, modname); switch_mutex_init(&spandsp_globals.mutex, SWITCH_MUTEX_NESTED, pool); - SWITCH_ADD_APP(app_interface, "t38_gateway", "Convert to T38 Gateway if tones are heard", "Convert to T38 Gateway if tones are heard", + SWITCH_ADD_APP(app_interface, "t38_gateway", "Convert to T38 Gateway if tones are heard", "Convert to T38 Gateway if tones are heard", t38_gateway_function, "", SAF_MEDIA_TAP); SWITCH_ADD_APP(app_interface, "rxfax", "FAX Receive Application", "FAX Receive Application", spanfax_rx_function, SPANFAX_RX_USAGE, @@ -734,7 +734,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init) SWITCH_ADD_APP(app_interface, "spandsp_send_tdd", "Send TDD data", "Send TDD data", tdd_send_function, "", SAF_NONE); - SWITCH_ADD_APP(app_interface, "spandsp_start_fax_detect", "start fax detect", "start fax detect", spandsp_fax_detect_session_function, + SWITCH_ADD_APP(app_interface, "spandsp_start_fax_detect", "start fax detect", "start fax detect", spandsp_fax_detect_session_function, "[ ][ ][ ]", SAF_NONE); SWITCH_ADD_APP(app_interface, "spandsp_stop_fax_detect", "stop fax detect", "stop fax detect", spandsp_stop_fax_detect_session_function, "", SAF_NONE); @@ -752,9 +752,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init) SWITCH_ADD_APP(app_interface, "stop_tone_detect", "Stop background tone detection with cadence", "", stop_tone_detect_app, "", SAF_NONE); SWITCH_ADD_API(api_interface, "start_tone_detect", "Start background tone detection with cadence", start_tone_detect_api, " "); SWITCH_ADD_API(api_interface, "stop_tone_detect", "Stop background tone detection with cadence", stop_tone_detect_api, ""); + switch_console_set_complete("add start_tone_detect ::console::list_uuid"); + switch_console_set_complete("add stop_tone_detect ::console::list_uuid"); } - SWITCH_ADD_API(api_interface, "start_tdd_detect", "Start background tdd detection", start_tdd_detect_api, ""); SWITCH_ADD_API(api_interface, "stop_tdd_detect", "Stop background tdd detection", stop_tdd_detect_api, ""); From 358b6e08353a0db69e3ebe60c85d43e0193eb30a Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Wed, 31 Jul 2013 17:16:43 -0500 Subject: [PATCH 73/88] mod_skinny: filter sip mwi events --- src/mod/endpoints/mod_skinny/mod_skinny.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 72cc82f9fa..165624a303 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -2253,6 +2253,10 @@ static void skinny_message_waiting_event_handler(switch_event_t *event) return; } + if (!strncmp("sip:", account, 4)) { + return; + } + if (!(yn = switch_event_get_header(event, "mwi-messages-waiting"))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing required Header 'MWI-Messages-Waiting'\n"); return; From 6c8eb054ad06771d92e86703ea0b55896febcf93 Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Wed, 31 Jul 2013 17:17:07 -0500 Subject: [PATCH 74/88] mod_skinny: allow to work with native pgsql --- src/mod/endpoints/mod_skinny/mod_skinny.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 165624a303..dc83c47294 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1850,14 +1850,8 @@ switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, c profile->keep_alive = atoi(val); } else if (!strcasecmp(var, "date-format")) { strncpy(profile->date_format, val, 6); - } else if (!strcasecmp(var, "odbc-dsn")) { - if (!zstr(val)) { - if (switch_odbc_available()) { - profile->odbc_dsn = switch_core_strdup(profile->pool, val); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n"); - } - } + } else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) { + profile->odbc_dsn = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "debug")) { profile->debug = atoi(val); } else if (!strcasecmp(var, "auto-restart")) { From f255f65a82e2cfe1aed1f44aa2459e5faaed150e Mon Sep 17 00:00:00 2001 From: Seven Du Date: Thu, 1 Aug 2013 09:50:51 +0800 Subject: [PATCH 75/88] add SHORT_DATE_TIME support --- src/mod/say/mod_say_zh/mod_say_zh.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/say/mod_say_zh/mod_say_zh.c b/src/mod/say/mod_say_zh/mod_say_zh.c index 87ab0042b8..ac5ba32e42 100644 --- a/src/mod/say/mod_say_zh/mod_say_zh.c +++ b/src/mod/say/mod_say_zh/mod_say_zh.c @@ -497,6 +497,7 @@ static switch_status_t zh_say(switch_core_session_t *session, char *tosay, switc case SST_CURRENT_DATE: case SST_CURRENT_TIME: case SST_CURRENT_DATE_TIME: + case SST_SHORT_DATE_TIME: say_cb = zh_say_time; break; case SST_IP_ADDRESS: From b71fe0031dd618bea21763bbf79af4e3c9015031 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 31 Jul 2013 21:45:18 -0500 Subject: [PATCH 76/88] FS-5655 try this --- .../src/msvc/make_cielab_luts.2010.vcxproj | 2 +- .../src/msvc/make_cielab_luts.2012.vcxproj | 2 +- .../msvc/make_math_fixed_tables.2010.vcxproj | 2 +- .../msvc/make_math_fixed_tables.2012.vcxproj | 2 +- .../mod_xml_rpc/mod_xml_rpc.2010.vcxproj | 324 +++++++++--------- .../mod_xml_rpc/mod_xml_rpc.2012.vcxproj | 6 + 6 files changed, 175 insertions(+), 163 deletions(-) diff --git a/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj b/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj index 282cc186cf..de83ac7306 100644 --- a/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj +++ b/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj @@ -27,7 +27,7 @@ <_ProjectFileVersion>10.0.30319.1 $(PlatformName)\$(Configuration)\ - $(PlatformName)\make_at_dictionary\$(Configuration)\ + $(PlatformName)\make_cielab_luts\$(Configuration)\ false diff --git a/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj b/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj index 881c035554..d7c54ca97f 100644 --- a/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj +++ b/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj @@ -28,7 +28,7 @@ <_ProjectFileVersion>10.0.30319.1 $(PlatformName)\$(Configuration)\ - $(PlatformName)\make_at_dictionary\$(Configuration)\ + $(PlatformName)\make_cielab_luts\$(Configuration)\ false diff --git a/libs/spandsp/src/msvc/make_math_fixed_tables.2010.vcxproj b/libs/spandsp/src/msvc/make_math_fixed_tables.2010.vcxproj index a71f70e556..61465917f1 100644 --- a/libs/spandsp/src/msvc/make_math_fixed_tables.2010.vcxproj +++ b/libs/spandsp/src/msvc/make_math_fixed_tables.2010.vcxproj @@ -27,7 +27,7 @@ <_ProjectFileVersion>10.0.30319.1 $(PlatformName)\$(Configuration)\ - $(PlatformName)\make_at_dictionary\$(Configuration)\ + $(PlatformName)\make_math_fixed_tables\$(Configuration)\ false diff --git a/libs/spandsp/src/msvc/make_math_fixed_tables.2012.vcxproj b/libs/spandsp/src/msvc/make_math_fixed_tables.2012.vcxproj index 610bb28625..ab6b648bcb 100644 --- a/libs/spandsp/src/msvc/make_math_fixed_tables.2012.vcxproj +++ b/libs/spandsp/src/msvc/make_math_fixed_tables.2012.vcxproj @@ -28,7 +28,7 @@ <_ProjectFileVersion>10.0.30319.1 $(PlatformName)\$(Configuration)\ - $(PlatformName)\make_at_dictionary\$(Configuration)\ + $(PlatformName)\make_math_fixed_tables\$(Configuration)\ false diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2010.vcxproj b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2010.vcxproj index 6420eb41e5..76e7eb0b29 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2010.vcxproj +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2010.vcxproj @@ -1,159 +1,165 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mod_xml_rpc - {CBEC7225-0C21-4DA8-978E-1F158F8AD950} - mod_xml_rpc - Win32Proj - - - - DynamicLibrary - MultiByte - - - DynamicLibrary - MultiByte - - - DynamicLibrary - MultiByte - - - DynamicLibrary - MultiByte - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) - ABYSS_WIN32;%(PreprocessorDefinitions) - - - - - ..\..\..\..\libs\xmlrpc\lib;..\..\..\..\libs\xmlrpc\lib\abyss\src\$(OutDir);..\..\..\..\libs\apr-util\xml\expat\lib\LibD;%(AdditionalLibraryDirectories) - false - - - - - - - X64 - - - $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) - ABYSS_WIN32;%(PreprocessorDefinitions) - - - - - %(AdditionalLibraryDirectories) - false - - - MachineX64 - - - - - $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) - ABYSS_WIN32;%(PreprocessorDefinitions) - - - - - ..\..\..\..\libs\xmlrpc\lib;..\..\..\..\libs\xmlrpc\lib\abyss\src\$(OutDir);..\..\..\..\libs\apr-util\xml\expat\lib\LibR;%(AdditionalLibraryDirectories) - false - - - - - - - X64 - - - $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) - ABYSS_WIN32;%(PreprocessorDefinitions) - - - - - %(AdditionalLibraryDirectories) - false - - - MachineX64 - - - - - - - - - {d2396dd7-7d38-473a-abb7-6f96d65ae1b9} - - - {0d108721-eae8-4baf-8102-d8960ec93647} - - - {cee544a9-0303-44c2-8ece-efa7d7bcbbba} - - - {b535402e-38d2-4d54-8360-423acbd17192} - - - {202d7a4e-760d-4d0e-afa1-d7459ced30ff} - false - - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mod_xml_rpc + {CBEC7225-0C21-4DA8-978E-1F158F8AD950} + mod_xml_rpc + Win32Proj + + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) + ABYSS_WIN32;%(PreprocessorDefinitions) + + + + + ..\..\..\..\libs\xmlrpc\lib;..\..\..\..\libs\xmlrpc\lib\abyss\src\$(OutDir);..\..\..\..\libs\apr-util\xml\expat\lib\LibD;%(AdditionalLibraryDirectories) + false + + + + + + + X64 + + + $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) + ABYSS_WIN32;%(PreprocessorDefinitions) + + + + + %(AdditionalLibraryDirectories) + false + + + MachineX64 + + + + + $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) + ABYSS_WIN32;%(PreprocessorDefinitions) + + + + + ..\..\..\..\libs\xmlrpc\lib;..\..\..\..\libs\xmlrpc\lib\abyss\src\$(OutDir);..\..\..\..\libs\apr-util\xml\expat\lib\LibR;%(AdditionalLibraryDirectories) + false + + + + + + + X64 + + + $(SolutionDir)libs\openssl-1.0.1c\include;$(SolutionDir)libs\xmlrpc-c\include;$(SolutionDir)libs\xmlrpc-c\lib\abyss\src;$(SolutionDir)libs\xmlrpc-c\lib\util\include;%(AdditionalIncludeDirectories) + ABYSS_WIN32;%(PreprocessorDefinitions) + + + + + %(AdditionalLibraryDirectories) + false + + + MachineX64 + + + + + + + + + {d331904d-a00a-4694-a5a3-fcff64ab5dbe} + + + {b4b62169-5ad4-4559-8707-3d933ac5db39} + + + {d2396dd7-7d38-473a-abb7-6f96d65ae1b9} + + + {0d108721-eae8-4baf-8102-d8960ec93647} + + + {cee544a9-0303-44c2-8ece-efa7d7bcbbba} + + + {b535402e-38d2-4d54-8360-423acbd17192} + + + {202d7a4e-760d-4d0e-afa1-d7459ced30ff} + false + + + + + + + + + \ No newline at end of file diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2012.vcxproj b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2012.vcxproj index af3305a50c..afd6d9f0c5 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2012.vcxproj +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2012.vcxproj @@ -137,6 +137,12 @@ + + {d331904d-a00a-4694-a5a3-fcff64ab5dbe} + + + {b4b62169-5ad4-4559-8707-3d933ac5db39} + {d331904d-a00a-4694-a5a3-fcff64ab5dbe} From 8d2805fc4291a2c93078098fe084071072354290 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Thu, 1 Aug 2013 13:56:30 -0400 Subject: [PATCH 77/88] FS-5659 --resolve Add logging for spandsp dtmf detector when dtmf_verbose channel variable is set to true --- .../applications/mod_spandsp/mod_spandsp.h | 4 +- .../mod_spandsp/mod_spandsp_dsp.c | 21 +++-- .../mod_spandsp/mod_spandsp_fax.c | 88 +++++++++---------- .../mod_spandsp/mod_spandsp_modem.c | 10 +-- 4 files changed, 64 insertions(+), 59 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index fafccae693..323ff07a45 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2012, Anthony Minessale II * @@ -141,7 +141,7 @@ switch_status_t spandsp_fax_detect_session(switch_core_session_t *session, int hits, const char *app, const char *data, switch_tone_detect_callback_t callback); switch_status_t spandsp_fax_stop_detect_session(switch_core_session_t *session); -void spanfax_log_message(void *user_data, int level, const char *msg); +void mod_spandsp_log_message(void *session, int level, const char *msg); switch_status_t load_configuration(switch_bool_t reload); void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t self, switch_bool_t on); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index 03d7297edd..42e31d1ef5 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -349,6 +349,7 @@ switch_status_t spandsp_tdd_decode_session(switch_core_session_t *session) typedef struct { switch_core_session_t *session; dtmf_rx_state_t *dtmf_detect; + int verbose; char last_digit; uint32_t samples; uint32_t last_digit_end; @@ -394,6 +395,10 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da switch (type) { case SWITCH_ABC_TYPE_INIT: { pvt->dtmf_detect = dtmf_rx_init(NULL, NULL, NULL); + span_log_set_message_handler(dtmf_rx_get_logging_state(pvt->dtmf_detect), mod_spandsp_log_message, pvt->session); + if (pvt->verbose) { + span_log_set_level(dtmf_rx_get_logging_state(pvt->dtmf_detect), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + } dtmf_rx_parms(pvt->dtmf_detect, pvt->filter_dialtone, pvt->twist, pvt->reverse_twist, pvt->threshold); dtmf_rx_set_realtime_callback(pvt->dtmf_detect, spandsp_dtmf_rx_realtime_callback, pvt); break; @@ -500,6 +505,10 @@ switch_status_t spandsp_inband_dtmf_session(switch_core_session_t *session) pvt->filter_dialtone = 0; } + if ((value = switch_channel_get_variable(channel, "dtmf_verbose"))) { + pvt->verbose = switch_true(value); + } + if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; } @@ -554,7 +563,7 @@ static switch_bool_t callprogress_detector_process_buffer(switch_media_bug_t *bu * Allocate the tone descriptor * * @param descriptor the descriptor to create - * @param name the descriptor name + * @param name the descriptor name * @param memory_pool the pool to use * @return SWITCH_STATUS_SUCCESS if successful */ @@ -632,7 +641,7 @@ static void tone_report_callback(void *user_data, int code, int level, int delay /** * Process tone segment report from spandsp (for debugging) - * + * * @param user_data the tone_detector * @param f1 the first frequency of the segment * @param f2 the second frequency of the segment @@ -705,7 +714,7 @@ static switch_bool_t tone_detector_process_buffer(tone_detector_t *detector, voi * Destroy the tone detector * @param detector the detector to destroy */ -static void tone_detector_destroy(tone_detector_t *detector) +static void tone_detector_destroy(tone_detector_t *detector) { if (detector) { if (detector->spandsp_detector) { @@ -720,7 +729,7 @@ static void tone_detector_destroy(tone_detector_t *detector) * Start call progress detection * * @param session the session to detect - * @param name of the descriptor to use + * @param name of the descriptor to use * @return SWITCH_STATUS_SUCCESS if successful */ switch_status_t callprogress_detector_start(switch_core_session_t *session, const char *name) @@ -759,7 +768,7 @@ switch_status_t callprogress_detector_start(switch_core_session_t *session, cons /** * Process a buffer of audio data for call progress tones * - * @param bug the session's media bug + * @param bug the session's media bug * @param user_data the detector * @param type the type of data available from the bug * @return SWITCH_TRUE @@ -817,7 +826,7 @@ static switch_bool_t callprogress_detector_process_buffer(switch_media_bug_t *bu /** * Stop call progress detection - * @param session the session to stop + * @param session the session to stop * @return SWITCH_STATUS_SUCCESS if successful */ switch_status_t callprogress_detector_stop(switch_core_session_t *session) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 02623fd20e..21a9cc51dc 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2012, Anthony Minessale II * @@ -167,7 +167,7 @@ static int del_pvt(pvt_t *del_pvt) r = 1; break; } - + l = p; } @@ -259,15 +259,11 @@ static void counter_increment(void) switch_mutex_unlock(spandsp_globals.mutex); } -void spanfax_log_message(void *user_data, int level, const char *msg) +void mod_spandsp_log_message(void *user_data, int level, const char *msg) { int fs_log_level; - switch_core_session_t *session; - pvt_t *pvt; - - pvt = (pvt_t *) user_data; - session = pvt->session; - + switch_core_session_t *session = (switch_core_session_t *)user_data; + switch (level) { case SPAN_LOG_NONE: return; @@ -329,7 +325,7 @@ static int phase_b_handler(t30_state_t *s, void *user_data, int result) switch_channel_set_variable(channel, "fax_remote_model", switch_str_nil(t30_get_rx_model(s))); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "=== Negotiation Result =======================================================\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "=== Negotiation Result =======================================================\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote station id: %s\n", far_ident); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Local station id: %s\n", local_ident); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Transfer Rate: %i\n", t30_stats.bit_rate); @@ -339,7 +335,7 @@ static int phase_b_handler(t30_state_t *s, void *user_data, int result) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote vendor: %s\n", switch_str_nil(t30_get_rx_vendor(s))); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote model: %s\n", switch_str_nil(t30_get_rx_model(s))); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "==============================================================================\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "==============================================================================\n"); switch_channel_execute_on(channel, "execute_on_fax_phase_b"); @@ -673,9 +669,9 @@ static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uin if (r < 0) { t30_state_t *t30; - + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "TERMINATING T30 STATE\n"); - + if (pvt->t38_state && (t30 = t38_terminal_get_t30_state(pvt->t38_state))) { t30_terminate(t30); } @@ -733,8 +729,8 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) fax_set_transmit_on_idle(fax, TRUE); - span_log_set_message_handler(fax_get_logging_state(fax), spanfax_log_message, pvt); - span_log_set_message_handler(t30_get_logging_state(t30), spanfax_log_message, pvt); + span_log_set_message_handler(fax_get_logging_state(fax), mod_spandsp_log_message, pvt->session); + span_log_set_message_handler(t30_get_logging_state(t30), mod_spandsp_log_message, pvt->session); if (pvt->verbose) { span_log_set_level(fax_get_logging_state(fax), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); @@ -772,7 +768,7 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) pvt->t38_core = t38_terminal_get_t38_core_state(pvt->t38_state); - if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries, + if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries, (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); return SWITCH_STATUS_FALSE; @@ -789,8 +785,8 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) } } - span_log_set_message_handler(t38_terminal_get_logging_state(t38), spanfax_log_message, pvt); - span_log_set_message_handler(t30_get_logging_state(t30), spanfax_log_message, pvt); + span_log_set_message_handler(t38_terminal_get_logging_state(t38), mod_spandsp_log_message, pvt->session); + span_log_set_message_handler(t30_get_logging_state(t30), mod_spandsp_log_message, pvt->session); if (pvt->verbose) { span_log_set_level(t38_terminal_get_logging_state(t38), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); @@ -811,13 +807,13 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n"); t38_gateway_free(pvt->t38_gateway_state); pvt->t38_gateway_state = NULL; - + return SWITCH_STATUS_FALSE; } pvt->t38_core = t38_gateway_get_t38_core_state(pvt->t38_gateway_state); - if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries, + if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries, (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); t38_gateway_free(pvt->t38_gateway_state); @@ -843,8 +839,8 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) t38_gateway_set_ecm_capability(pvt->t38_gateway_state, TRUE); } - span_log_set_message_handler(t38_gateway_get_logging_state(pvt->t38_gateway_state), spanfax_log_message, pvt); - span_log_set_message_handler(t38_core_get_logging_state(pvt->t38_core), spanfax_log_message, pvt); + span_log_set_message_handler(t38_gateway_get_logging_state(pvt->t38_gateway_state), mod_spandsp_log_message, pvt->session); + span_log_set_message_handler(t38_core_get_logging_state(pvt->t38_core), mod_spandsp_log_message, pvt->session); if (pvt->verbose) { span_log_set_level(t38_gateway_get_logging_state(pvt->t38_gateway_state), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); @@ -988,7 +984,7 @@ static t38_mode_t configure_t38(pvt_t *pvt) t38_set_jbig_transcoding(pvt->t38_core, t38_options->T38FaxTranscodingJBIG); t38_set_max_datagram_size(pvt->t38_core, t38_options->T38FaxMaxDatagram); - if (t38_options->T38FaxRateManagement) { + if (t38_options->T38FaxRateManagement) { if (!strcasecmp(t38_options->T38FaxRateManagement, "transferredTCF")) { method = 2; } else { @@ -1043,7 +1039,7 @@ static t38_mode_t negotiate_t38(pvt_t *pvt) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxMaxDatagram = %d\n", t38_options->T38FaxMaxDatagram); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxUdpEC = '%s'\n", t38_options->T38FaxUdpEC); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38VendorInfo = '%s'\n", switch_str_nil(t38_options->T38VendorInfo)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "ip = '%s'\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "ip = '%s'\n", t38_options->remote_ip ? t38_options->remote_ip : "Not specified"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "port = %d\n", t38_options->remote_port); @@ -1128,7 +1124,7 @@ static t38_mode_t request_t38(pvt_t *pvt) } if ((t38_options = switch_channel_get_private(channel, "t38_options"))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s already has T.38 data\n", switch_channel_get_name(channel)); enabled = 0; } @@ -1427,11 +1423,11 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat int tx = 0; switch_status_t status; - /* + /* if we are in T.38 mode, we should: 1- initialize the ptv->t38_state stuff, if not done and then set some callbacks when reading frames. The only thing we need, then, in this loop, is: - - read a frame without blocking + - read a frame without blocking - eventually feed that frame in spandsp, - call t38_terminal_send_timeout(), sleep for a while @@ -1458,7 +1454,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); spanfax_init(pvt, T38_MODE); configure_t38(pvt); - + /* This will change the rtp stack to udptl mode */ msg.from = __FILE__; msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; @@ -1475,7 +1471,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat request_t38(pvt); } } - + if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { if (negotiate_t38(pvt) == T38_MODE_NEGOTIATED) { /* is is safe to call this again, it was already called above in AUDIO_MODE */ @@ -1493,11 +1489,11 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat /* dunno what to do, most likely you will not get too many of these since we turn off the timer in udptl mode */ continue; } - + if (switch_test_flag(read_frame, SFF_UDPTL_PACKET) && read_frame->packet && read_frame->packetlen) { /* now we know we can cast frame->packet to a udptl structure */ //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "READ %d udptl bytes\n", read_frame->packetlen); - + udptl_rx_packet(pvt->udptl_state, read_frame->packet, read_frame->packetlen); } } @@ -1602,7 +1598,7 @@ static switch_status_t t38_gateway_on_soft_execute(switch_core_session_t *sessio if (!(other_session = switch_core_session_locate(peer_uuid))) { switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Cannot locate channel with uuid %s", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Cannot locate channel with uuid %s", switch_channel_get_name(channel), peer_uuid); goto end; } @@ -1829,13 +1825,13 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi switch_ivr_sleep(session, 0, SWITCH_TRUE, NULL); if (switch_true(t38_trace)) { - trace_read = switch_core_session_sprintf(session, "%s%s%s_read.raw", SWITCH_GLOBAL_dirs.temp_dir, + trace_read = switch_core_session_sprintf(session, "%s%s%s_read.raw", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Tracing inbound audio to %s\n", trace_read); switch_channel_set_variable(channel, "t38_trace_read", trace_read); - trace_write = switch_core_session_sprintf(session, "%s%s%s_write.raw", SWITCH_GLOBAL_dirs.temp_dir, + trace_write = switch_core_session_sprintf(session, "%s%s%s_write.raw", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Tracing outbound audio to %s\n", trace_write); @@ -1865,7 +1861,7 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi } else { if (read_fd != FAX_INVALID_SOCKET) { switch_ssize_t rv; - do { rv = write(read_fd, read_frame->data, read_frame->datalen); } while (rv == -1 && errno == EINTR); + do { rv = write(read_fd, read_frame->data, read_frame->datalen); } while (rv == -1 && errno == EINTR); } if (t38_gateway_rx(pvt->t38_gateway_state, (int16_t *) read_frame->data, read_frame->samples)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "fax_rx reported an error\n"); @@ -1994,7 +1990,7 @@ switch_bool_t t38_gateway_start(switch_core_session_t *session, const char *app, switch_channel_set_variable(peer ? channel : other_channel, "t38_gateway_format", "audio"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s starting gateway mode to %s\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s starting gateway mode to %s\n", switch_channel_get_name(peer ? channel : other_channel), switch_channel_get_name(peer ? other_channel : channel)); @@ -2033,20 +2029,20 @@ typedef struct { int expires; int default_sleep; int default_expires; - switch_tone_detect_callback_t callback; + switch_tone_detect_callback_t callback; modem_connect_tones_rx_state_t rx_tones; switch_media_bug_t *bug; switch_core_session_t *session; int bug_running; - + } spandsp_fax_tone_container_t; static switch_status_t tone_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction) { switch_channel_t *channel = switch_core_session_get_channel(session); spandsp_fax_tone_container_t *cont = switch_channel_get_private(channel, "_fax_tone_detect_"); - + if (!cont || dtmf->digit != 'f') { return SWITCH_STATUS_SUCCESS; @@ -2060,7 +2056,7 @@ static switch_status_t tone_on_dtmf(switch_core_session_t *session, const switch switch_core_session_execute_application_async(cont->session, cont->app, cont->data); } } - + return SWITCH_STATUS_SUCCESS; } @@ -2085,13 +2081,13 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da case SWITCH_ABC_TYPE_WRITE_REPLACE: { int skip = 0; - + if (type == SWITCH_ABC_TYPE_READ_REPLACE) { frame = switch_core_media_bug_get_read_replace_frame(bug); } else { frame = switch_core_media_bug_get_write_replace_frame(bug); } - + if (cont->sleep) { cont->sleep--; if (cont->sleep) { @@ -2122,7 +2118,7 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da if (cont->hits) { switch_event_t *event; - + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_DEBUG, "Fax Tone Detected. [%s][%s]\n", cont->app, switch_str_nil(cont->data)); @@ -2134,7 +2130,7 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da switch_core_session_execute_application_async(cont->session, cont->app, cont->data); } } - + if (switch_event_create(&event, SWITCH_EVENT_DETECTED_TONE) == SWITCH_STATUS_SUCCESS) { switch_event_t *dup; @@ -2148,7 +2144,7 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da channel = switch_core_session_get_channel(session); if (channel) switch_channel_event_set_data(channel, event); } - + if (switch_event_dup(&dup, event) == SWITCH_STATUS_SUCCESS) { switch_event_fire(&dup); } @@ -2163,7 +2159,7 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da rval = SWITCH_FALSE; } - + } break; case SWITCH_ABC_TYPE_WRITE: diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c index b1a794a387..dec93970a0 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c @@ -346,23 +346,23 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl if (spandsp_globals.modem_verbose) { logging = t31_get_logging_state(modem->t31_state); - span_log_set_message_handler(logging, spanfax_log_message, NULL); + span_log_set_message_handler(logging, mod_spandsp_log_message, NULL); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); logging = v17_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v17_rx); - span_log_set_message_handler(logging, spanfax_log_message, NULL); + span_log_set_message_handler(logging, mod_spandsp_log_message, NULL); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); logging = v29_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v29_rx); - span_log_set_message_handler(logging, spanfax_log_message, NULL); + span_log_set_message_handler(logging, mod_spandsp_log_message, NULL); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); logging = v27ter_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v27ter_rx); - span_log_set_message_handler(logging, spanfax_log_message, NULL); + span_log_set_message_handler(logging, mod_spandsp_log_message, NULL); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); logging = t38_core_get_logging_state(modem->t38_core); - span_log_set_message_handler(logging, spanfax_log_message, NULL); + span_log_set_message_handler(logging, mod_spandsp_log_message, NULL); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); } From fed93fd49ecf242cb79e9397686768f298b70c25 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 1 Aug 2013 13:29:51 -0500 Subject: [PATCH 78/88] mod_xml_rpc revert extra stuff --- src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2012.vcxproj | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2012.vcxproj b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2012.vcxproj index afd6d9f0c5..af3305a50c 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2012.vcxproj +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2012.vcxproj @@ -137,12 +137,6 @@ - - {d331904d-a00a-4694-a5a3-fcff64ab5dbe} - - - {b4b62169-5ad4-4559-8707-3d933ac5db39} - {d331904d-a00a-4694-a5a3-fcff64ab5dbe} From 40c983beeb525ebca68568d97071234557a4cc09 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Thu, 1 Aug 2013 14:37:28 -0400 Subject: [PATCH 79/88] FS-5657 --resolve fix mod_rayo build errors in CentOS 5 --- src/mod/event_handlers/mod_rayo/Makefile | 2 + src/mod/event_handlers/mod_rayo/iks_helpers.c | 87 +++++++++++++ src/mod/event_handlers/mod_rayo/iks_helpers.h | 97 ++------------- .../event_handlers/mod_rayo/rayo_elements.c | 117 ++++++++++++++++++ .../event_handlers/mod_rayo/rayo_elements.h | 82 ++---------- 5 files changed, 221 insertions(+), 164 deletions(-) create mode 100644 src/mod/event_handlers/mod_rayo/rayo_elements.c diff --git a/src/mod/event_handlers/mod_rayo/Makefile b/src/mod/event_handlers/mod_rayo/Makefile index d15ae1cbb1..6fccfdf318 100644 --- a/src/mod/event_handlers/mod_rayo/Makefile +++ b/src/mod/event_handlers/mod_rayo/Makefile @@ -10,6 +10,7 @@ LOCAL_OBJS= $(IKS_LA) \ iks_helpers.o \ nlsml.o \ rayo_components.o \ + rayo_elements.o \ rayo_input_component.o \ rayo_output_component.o \ rayo_prompt_component.o \ @@ -21,6 +22,7 @@ LOCAL_SOURCES= \ iks_helpers.c \ nlsml.c \ rayo_components.c \ + rayo_elements.c \ rayo_input_component.c \ rayo_output_component.c \ rayo_prompt_component.c \ diff --git a/src/mod/event_handlers/mod_rayo/iks_helpers.c b/src/mod/event_handlers/mod_rayo/iks_helpers.c index 46fd1c4cea..0b5616a1f3 100644 --- a/src/mod/event_handlers/mod_rayo/iks_helpers.c +++ b/src/mod/event_handlers/mod_rayo/iks_helpers.c @@ -305,6 +305,93 @@ int value_matches(const char *value, const char *rule) return 0; } +/** + * Validate boolean + * @param value + * @return SWTICH_TRUE if boolean + */ +int iks_attrib_is_bool(const char *value) +{ + if (value && *value && (!strcasecmp("true", value) || !strcasecmp("false", value))) { + return SWITCH_TRUE; + } + return SWITCH_FALSE; +} + +/** + * Validate integer + * @param value + * @return SWTICH_TRUE if not negative + */ +int iks_attrib_is_not_negative(const char *value) +{ + if (value && *value && switch_is_number(value)) { + int value_i = atoi(value); + if (value_i >= 0) { + return SWITCH_TRUE; + } + } + return SWITCH_FALSE; +} + +/** + * Validate integer + * @param value + * @return SWTICH_TRUE if positive + */ +int iks_attrib_is_positive(const char *value) +{ + if (value && *value && switch_is_number(value)) { + int value_i = atoi(value); + if (value_i > 0) { + return SWITCH_TRUE; + } + } + return SWITCH_FALSE; +} + +/** + * Validate integer + * @param value + * @return SWTICH_TRUE if positive or -1 + */ +int iks_attrib_is_positive_or_neg_one(const char *value) +{ + if (value && *value && switch_is_number(value)) { + int value_i = atoi(value); + if (value_i == -1 || value_i > 0) { + return SWITCH_TRUE; + } + } + return SWITCH_FALSE; +} + +/** + * Validate string + * @param value + * @return SWTICH_TRUE + */ +int iks_attrib_is_any(const char *value) +{ + return SWITCH_TRUE; +} + +/** + * Validate decimal + * @param value + * @return SWTICH_TRUE if 0.0 <= x <= 1.0 + */ +int iks_attrib_is_decimal_between_zero_and_one(const char *value) +{ + if (value && *value && switch_is_number(value)) { + double value_d = atof(value); + if (value_d >= 0.0 || value_d <= 1.0) { + return SWITCH_TRUE; + } + } + return SWITCH_FALSE; +} + #define IKS_SHA256_HEX_DIGEST_LENGTH ((SHA256_DIGEST_LENGTH * 2) + 1) /** diff --git a/src/mod/event_handlers/mod_rayo/iks_helpers.h b/src/mod/event_handlers/mod_rayo/iks_helpers.h index 442722a267..90a5ca688d 100644 --- a/src/mod/event_handlers/mod_rayo/iks_helpers.h +++ b/src/mod/event_handlers/mod_rayo/iks_helpers.h @@ -73,101 +73,20 @@ extern char *iks_server_dialback_key(const char *secret, const char *receiving_s /** A function to validate attribute value */ typedef int (*iks_attrib_validation_function)(const char *); -#define ELEMENT(name) inline int VALIDATE_##name(iks *node) { int result = 1; if (!node) return 0; +#define ELEMENT_DECL(name) extern int VALIDATE_##name(iks *node); +#define ELEMENT(name) int VALIDATE_##name(iks *node) { int result = 1; if (!node) return 0; #define ATTRIB(name, def, rule) result &= iks_attrib_is_##rule(iks_find_attrib_default(node, #name, #def)); #define STRING_ATTRIB(name, def, rule) result &= value_matches(iks_find_attrib_default(node, #name, #def), rule); #define ELEMENT_END return result; } extern int value_matches(const char *value, const char *rule); -#define ATTRIB_RULE(rule) inline int iks_attrib_is_ ## rule (const char *value) - -/** - * Validate boolean - * @param value - * @return SWTICH_TRUE if boolean - */ -ATTRIB_RULE(bool) -{ - if (value && *value && (!strcasecmp("true", value) || !strcasecmp("false", value))) { - return SWITCH_TRUE; - } - return SWITCH_FALSE; -} - -/** - * Validate integer - * @param value - * @return SWTICH_TRUE if not negative - */ -ATTRIB_RULE(not_negative) -{ - if (value && *value && switch_is_number(value)) { - int value_i = atoi(value); - if (value_i >= 0) { - return SWITCH_TRUE; - } - } - return SWITCH_FALSE; -} - -/** - * Validate integer - * @param value - * @return SWTICH_TRUE if positive - */ -ATTRIB_RULE(positive) -{ - if (value && *value && switch_is_number(value)) { - int value_i = atoi(value); - if (value_i > 0) { - return SWITCH_TRUE; - } - } - return SWITCH_FALSE; -} - -/** - * Validate integer - * @param value - * @return SWTICH_TRUE if positive or -1 - */ -ATTRIB_RULE(positive_or_neg_one) -{ - if (value && *value && switch_is_number(value)) { - int value_i = atoi(value); - if (value_i == -1 || value_i > 0) { - return SWITCH_TRUE; - } - } - return SWITCH_FALSE; -} - -/** - * Validate string - * @param value - * @return SWTICH_TRUE - */ -ATTRIB_RULE(any) -{ - return SWITCH_TRUE; -} - -/** - * Validate decimal - * @param value - * @return SWTICH_TRUE if 0.0 <= x <= 1.0 - */ -ATTRIB_RULE(decimal_between_zero_and_one) -{ - if (value && *value && switch_is_number(value)) { - double value_d = atof(value); - if (value_d >= 0.0 || value_d <= 1.0) { - return SWITCH_TRUE; - } - } - return SWITCH_FALSE; -} +extern int iks_attrib_is_bool(const char *value); +extern int iks_attrib_is_not_negative(const char *value); +extern int iks_attrib_is_positive(const char *value); +extern int iks_attrib_is_positive_or_neg_one(const char *value); +extern int iks_attrib_is_any(const char *value); +extern int iks_attrib_is_decimal_between_zero_and_one(const char *value); #endif diff --git a/src/mod/event_handlers/mod_rayo/rayo_elements.c b/src/mod/event_handlers/mod_rayo/rayo_elements.c new file mode 100644 index 0000000000..07051c1474 --- /dev/null +++ b/src/mod/event_handlers/mod_rayo/rayo_elements.c @@ -0,0 +1,117 @@ +/* + * mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2013, Grasshopper + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is Grasshopper + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Chris Rienzo + * + * rayo_elements.c -- Rayo XML element definition + * + */ +#include "rayo_elements.h" + +/** + * component validation + */ +ELEMENT(RAYO_INPUT) + STRING_ATTRIB(mode, any, "any,dtmf,voice") + ATTRIB(terminator,, any) + ATTRIB(recognizer,, any) + ATTRIB(language, en-US, any) + ATTRIB(initial-timeout, -1, positive_or_neg_one) + ATTRIB(inter-digit-timeout, -1, positive_or_neg_one) + ATTRIB(sensitivity, 0.5, decimal_between_zero_and_one) + ATTRIB(min-confidence, 0, decimal_between_zero_and_one) + ATTRIB(max-silence, -1, positive_or_neg_one) + /* for now, only NLSML */ + STRING_ATTRIB(match-content-type, application/nlsml+xml, "application/nlsml+xml") + /* internal attribs for prompt support */ + ATTRIB(barge-event, false, bool) + ATTRIB(start-timers, true, bool) +ELEMENT_END + +/** + * component validation + */ +ELEMENT(RAYO_OUTPUT) + ATTRIB(start-offset, 0, not_negative) + ATTRIB(start-paused, false, bool) + ATTRIB(repeat-interval, 0, not_negative) + ATTRIB(repeat-times, 1, not_negative) + ATTRIB(max-time, -1, positive_or_neg_one) + ATTRIB(renderer,, any) + ATTRIB(voice,, any) +ELEMENT_END + +/** + * validation + */ +ELEMENT(RAYO_OUTPUT_SEEK) + STRING_ATTRIB(direction,, "forward,back") + ATTRIB(amount,-1, positive) +ELEMENT_END + +/** + * component validation + */ +ELEMENT(RAYO_PROMPT) + ATTRIB(barge-in, true, bool) +ELEMENT_END + +/** + * component validation + */ +ELEMENT(RAYO_RECORD) + ATTRIB(format, mp3, any) + ATTRIB(start-beep, false, bool) + ATTRIB(stop-beep, false, bool) + ATTRIB(start-paused, false, bool) + ATTRIB(max-duration, -1, positive_or_neg_one) + ATTRIB(initial-timeout, -1, positive_or_neg_one) + ATTRIB(final-timeout, -1, positive_or_neg_one) + STRING_ATTRIB(direction, duplex, "duplex,send,recv") + ATTRIB(mix, false, bool) +ELEMENT_END + +/** + * command validation + */ +ELEMENT(RAYO_JOIN) + /* for now, only allow duplex + STRING_ATTRIB(direction, duplex, "send,recv,duplex"); */ + STRING_ATTRIB(direction, duplex, "duplex") + STRING_ATTRIB(media, bridge, "bridge,direct") + ATTRIB(call-uri,, any) + ATTRIB(mixer-name,, any) +ELEMENT_END + + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet + */ + diff --git a/src/mod/event_handlers/mod_rayo/rayo_elements.h b/src/mod/event_handlers/mod_rayo/rayo_elements.h index be2d68d054..c780f160cf 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_elements.h +++ b/src/mod/event_handlers/mod_rayo/rayo_elements.h @@ -23,7 +23,7 @@ * Contributor(s): * Chris Rienzo * - * rayo_elements.h -- Rayo XML element definition + * rayo_elements.h -- Rayo XML elements * */ #ifndef RAYO_ELEMENTS_H @@ -31,80 +31,12 @@ #include "iks_helpers.h" -/** - * component validation - */ -ELEMENT(RAYO_INPUT) - STRING_ATTRIB(mode, any, "any,dtmf,voice") - ATTRIB(terminator,, any) - ATTRIB(recognizer,, any) - ATTRIB(language, en-US, any) - ATTRIB(initial-timeout, -1, positive_or_neg_one) - ATTRIB(inter-digit-timeout, -1, positive_or_neg_one) - ATTRIB(sensitivity, 0.5, decimal_between_zero_and_one) - ATTRIB(min-confidence, 0, decimal_between_zero_and_one) - ATTRIB(max-silence, -1, positive_or_neg_one) - /* for now, only NLSML */ - STRING_ATTRIB(match-content-type, application/nlsml+xml, "application/nlsml+xml") - /* internal attribs for prompt support */ - ATTRIB(barge-event, false, bool) - ATTRIB(start-timers, true, bool) -ELEMENT_END - -/** - * component validation - */ -ELEMENT(RAYO_OUTPUT) - ATTRIB(start-offset, 0, not_negative) - ATTRIB(start-paused, false, bool) - ATTRIB(repeat-interval, 0, not_negative) - ATTRIB(repeat-times, 1, not_negative) - ATTRIB(max-time, -1, positive_or_neg_one) - ATTRIB(renderer,, any) - ATTRIB(voice,, any) -ELEMENT_END - -/** - * validation - */ -ELEMENT(RAYO_OUTPUT_SEEK) - STRING_ATTRIB(direction,, "forward,back") - ATTRIB(amount,-1, positive) -ELEMENT_END - -/** - * component validation - */ -ELEMENT(RAYO_PROMPT) - ATTRIB(barge-in, true, bool) -ELEMENT_END - -/** - * component validation - */ -ELEMENT(RAYO_RECORD) - ATTRIB(format, mp3, any) - ATTRIB(start-beep, false, bool) - ATTRIB(stop-beep, false, bool) - ATTRIB(start-paused, false, bool) - ATTRIB(max-duration, -1, positive_or_neg_one) - ATTRIB(initial-timeout, -1, positive_or_neg_one) - ATTRIB(final-timeout, -1, positive_or_neg_one) - STRING_ATTRIB(direction, duplex, "duplex,send,recv") - ATTRIB(mix, false, bool) -ELEMENT_END - -/** - * command validation - */ -ELEMENT(RAYO_JOIN) - /* for now, only allow duplex - STRING_ATTRIB(direction, duplex, "send,recv,duplex"); */ - STRING_ATTRIB(direction, duplex, "duplex") - STRING_ATTRIB(media, bridge, "bridge,direct") - ATTRIB(call-uri,, any) - ATTRIB(mixer-name,, any) -ELEMENT_END +ELEMENT_DECL(RAYO_INPUT) +ELEMENT_DECL(RAYO_OUTPUT) +ELEMENT_DECL(RAYO_OUTPUT_SEEK) +ELEMENT_DECL(RAYO_PROMPT) +ELEMENT_DECL(RAYO_RECORD) +ELEMENT_DECL(RAYO_JOIN) #endif From 76f3cb5b468154d9657cf90535db645cc72a0908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20Czu=C5=82ada?= Date: Fri, 2 Aug 2013 10:23:38 +0200 Subject: [PATCH 80/88] Describe patches related to JIRA issues --- docs/SubmittingPatches | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index 4be7eaefca..d65e62bbb8 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -77,6 +77,21 @@ message might look like this: > After appropriate amounts of frobbing have been done, a new variable > `frobbing_done` is set in the caller's channel. +Patches related to JIRA issues +------------------------------ + +If your patch is related to an JIRA issue, you should add its name +(i.e. FS-555) to your commit message. You can also use some JIRA +directives, like '--resolve'. For example, if your patch fixes some +error reported by case FS-555, just add the following line somewhere +in your commit message: + +> FS-555 --resolve + +or modify the subject: + +> FS-555 --resolve Add frobinator support to mod_sofia + Where to Go for Help -------------------- From 8fd514df6bcfb32c035b5632d71dc3ef3098ea3f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 2 Aug 2013 14:37:54 +0000 Subject: [PATCH 81/88] Tweak style and content of last commit The directions here anticipate planned improvements to our JIRA bot to allow issues to be resolved by placing the JIRA directives in the body of the commit message. --- docs/SubmittingPatches | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index d65e62bbb8..e839ff128d 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -76,21 +76,21 @@ message might look like this: > > After appropriate amounts of frobbing have been done, a new variable > `frobbing_done` is set in the caller's channel. +> +> FS-XXXX --resolve -Patches related to JIRA issues +Patches Related to JIRA Issues ------------------------------ -If your patch is related to an JIRA issue, you should add its name -(i.e. FS-555) to your commit message. You can also use some JIRA -directives, like '--resolve'. For example, if your patch fixes some -error reported by case FS-555, just add the following line somewhere -in your commit message: +When your patch is related to an issue logged in JIRA, add the +identifier for the issue (e.g. FS-XXXX) to the body of your commit +message at the beginning of a line, typically the last line or just +before "Signed-off-by:" and "Thanks-to:" lines. This helps our JIRA +bot do useful things by relating the commit to the issue. -> FS-555 --resolve - -or modify the subject: - -> FS-555 --resolve Add frobinator support to mod_sofia +If you believe your patch resolves the issue in question, follow the +issue number with a space and the "--resolve" directive as in the +example above. Where to Go for Help -------------------- From f184953570bc4d3013ce2b45997f81ae01768b94 Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Fri, 2 Aug 2013 10:54:46 -0500 Subject: [PATCH 82/88] mod_skinny: add minimal handling of MeetMe button to send to a conference creation extension --- .../mod_skinny/conf/skinny_profiles/internal.xml | 1 + src/mod/endpoints/mod_skinny/mod_skinny.c | 9 +++++++++ src/mod/endpoints/mod_skinny/mod_skinny.h | 1 + src/mod/endpoints/mod_skinny/skinny_api.c | 1 + src/mod/endpoints/mod_skinny/skinny_server.c | 6 +++++- src/mod/endpoints/mod_skinny/skinny_tables.c | 2 +- src/mod/endpoints/mod_skinny/skinny_tables.h | 2 +- 7 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/conf/skinny_profiles/internal.xml b/src/mod/endpoints/mod_skinny/conf/skinny_profiles/internal.xml index 39ce60fe4a..74cb86701b 100644 --- a/src/mod/endpoints/mod_skinny/conf/skinny_profiles/internal.xml +++ b/src/mod/endpoints/mod_skinny/conf/skinny_profiles/internal.xml @@ -14,6 +14,7 @@ + diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index dc83c47294..18b0f3c3f5 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -171,6 +171,7 @@ switch_status_t skinny_profile_dump(const skinny_profile_t *profile, switch_stre stream->write_function(stream, "Listener-Threads \t%d\n", profile->listener_threads); stream->write_function(stream, "Ext-Voicemail \t%s\n", profile->ext_voicemail); stream->write_function(stream, "Ext-Redial \t%s\n", profile->ext_redial); + stream->write_function(stream, "Ext-MeetMe \t%s\n", profile->ext_meetme); stream->write_function(stream, "%s\n", line); return SWITCH_STATUS_SUCCESS; @@ -1864,6 +1865,10 @@ switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, c if (!profile->ext_redial || strcmp(val, profile->ext_redial)) { profile->ext_redial = switch_core_strdup(profile->pool, val); } + } else if (!strcasecmp(var, "ext-meetme")) { + if (!profile->ext_meetme || strcmp(val, profile->ext_meetme)) { + profile->ext_meetme = switch_core_strdup(profile->pool, val); + } } else { return SWITCH_STATUS_FALSE; } @@ -1956,6 +1961,10 @@ static switch_status_t load_skinny_config(void) skinny_profile_set(profile, "ext-redial", "redial"); } + if (!profile->ext_meetme) { + skinny_profile_set(profile, "ext-meetme", "conference"); + } + if (profile->port == 0) { profile->port = 2000; } diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index d8ed1b03bf..39faed4388 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -117,6 +117,7 @@ struct skinny_profile { /* extensions */ char *ext_voicemail; char *ext_redial; + char *ext_meetme; /* db */ char *dbname; char *odbc_dsn; diff --git a/src/mod/endpoints/mod_skinny/skinny_api.c b/src/mod/endpoints/mod_skinny/skinny_api.c index 604b8509f7..94318c8de0 100644 --- a/src/mod/endpoints/mod_skinny/skinny_api.c +++ b/src/mod/endpoints/mod_skinny/skinny_api.c @@ -233,6 +233,7 @@ static switch_status_t skinny_api_list_settings(const char *line, const char *cu switch_console_push_match(&my_matches, "auto-restart"); switch_console_push_match(&my_matches, "ext-voicemail"); switch_console_push_match(&my_matches, "ext-redial"); + switch_console_push_match(&my_matches, "ext-meetme"); if (my_matches) { *matches = my_matches; diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 95d486d3e0..f2d8eb8abe 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -76,7 +76,7 @@ uint32_t soft_key_template_default_events[] = { SOFTKEY_CONF, SOFTKEY_PARK, SOFTKEY_JOIN, - SOFTKEY_MEETMECONF, + SOFTKEY_MEETME, SOFTKEY_CALLPICKUP, SOFTKEY_GRPCALLPICKUP, SOFTKEY_DND, @@ -1929,6 +1929,10 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn } } break; + case SOFTKEY_MEETME: + skinny_create_incoming_session(listener, &line_instance, &session); + skinny_session_process_dest(session, listener, line_instance, listener->profile->ext_meetme, '\0', 0); + break; default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown SoftKeyEvent type: %d.\n", request->data.soft_key_event.event); diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c index 9f04f8cd63..ea29918cbb 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.c +++ b/src/mod/endpoints/mod_skinny/skinny_tables.c @@ -239,7 +239,7 @@ SKINNY_DECLARE_STR2ID(skinny_str2button, SKINNY_BUTTONS, -1) {SOFTKEY_CONF, "SoftkeyConf"}, {SOFTKEY_PARK, "SoftkeyPark"}, {SOFTKEY_JOIN, "SoftkeyJoin"}, - {SOFTKEY_MEETMECONF, "SoftkeyMeetmeconfrm"}, + {SOFTKEY_MEETME, "SoftkeyMeetme"}, {SOFTKEY_CALLPICKUP, "SoftkeyCallpickup"}, {SOFTKEY_GRPCALLPICKUP, "SoftkeyGrpcallpickup"}, {SOFTKEY_DND, "SoftkeyDnd"}, diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h index 1e35a7d208..647837f212 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.h +++ b/src/mod/endpoints/mod_skinny/skinny_tables.h @@ -192,7 +192,7 @@ enum skinny_soft_key_event { SOFTKEY_CONF = 0x0D, SOFTKEY_PARK = 0x0E, SOFTKEY_JOIN = 0x0F, - SOFTKEY_MEETMECONF = 0x10, + SOFTKEY_MEETME = 0x10, SOFTKEY_CALLPICKUP = 0x11, SOFTKEY_GRPCALLPICKUP = 0x12, SOFTKEY_DND = 0x13, From d1268e81036ce8ce00de8ee22f387cdbf43a7203 Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Fri, 2 Aug 2013 11:21:40 -0500 Subject: [PATCH 83/88] make default conf example work properly based on FS-5335 feedback/testing --- src/mod/endpoints/mod_skinny/conf/dialplan/skinny-patterns.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_skinny/conf/dialplan/skinny-patterns.xml b/src/mod/endpoints/mod_skinny/conf/dialplan/skinny-patterns.xml index b37d8eed82..69419f36c2 100644 --- a/src/mod/endpoints/mod_skinny/conf/dialplan/skinny-patterns.xml +++ b/src/mod/endpoints/mod_skinny/conf/dialplan/skinny-patterns.xml @@ -15,7 +15,7 @@ - + From c2d5d47078b9a2b0698469a06d2058147402890e Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Fri, 2 Aug 2013 13:53:29 -0500 Subject: [PATCH 84/88] mod_skinny: implement per device setting of ext- extensions --- .../conf/directory/default/skinny-example.xml | 7 ++++-- src/mod/endpoints/mod_skinny/mod_skinny.h | 9 +++++++ src/mod/endpoints/mod_skinny/skinny_server.c | 24 +++++++++++++++---- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/conf/directory/default/skinny-example.xml b/src/mod/endpoints/mod_skinny/conf/directory/default/skinny-example.xml index 357eb72f12..8b8fad5812 100644 --- a/src/mod/endpoints/mod_skinny/conf/directory/default/skinny-example.xml +++ b/src/mod/endpoints/mod_skinny/conf/directory/default/skinny-example.xml @@ -2,8 +2,11 @@ diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index 39faed4388..7c9dcdb314 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -35,6 +35,12 @@ #include +/*****************************************************************************/ +/* UTILITY MACROS */ +/*****************************************************************************/ +#define empty_null(a) ((a)?(a):NULL) +#define empty_null2(a,b) ((a)?(a):empty_null(b)) + /*****************************************************************************/ /* LOGGING FUNCTIONS */ /*****************************************************************************/ @@ -183,6 +189,9 @@ struct listener { uint32_t flags; time_t expire_time; struct listener *next; + char *ext_voicemail; + char *ext_redial; + char *ext_meetme; }; typedef struct listener listener_t; diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index f2d8eb8abe..d648cac7e5 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1034,6 +1034,18 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r strncpy(listener->firmware_version, value, 16); } else if (!strcasecmp(name, "skinny-soft-key-set-set")) { listener->soft_key_set_set = switch_core_strdup(profile->pool, value); + } else if (!strcasecmp(name, "ext-voicemail")) { + if (!listener->ext_voicemail || strcmp(value,listener->ext_voicemail)) { + listener->ext_voicemail = switch_core_strdup(profile->pool, value); + } + } else if (!strcasecmp(name, "ext-redial")) { + if (!listener->ext_redial || strcmp(value,listener->ext_redial)) { + listener->ext_redial = switch_core_strdup(profile->pool, value); + } + } else if (!strcasecmp(name, "ext-meetme")) { + if (!listener->ext_meetme || strcmp(value,listener->ext_meetme)) { + listener->ext_meetme = switch_core_strdup(profile->pool, value); + } } } } @@ -1267,7 +1279,8 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess switch(request->data.stimulus.instance_type) { case SKINNY_BUTTON_LAST_NUMBER_REDIAL: skinny_create_incoming_session(listener, &line_instance, &session); - skinny_session_process_dest(session, listener, line_instance, listener->profile->ext_redial, '\0', 0); + skinny_session_process_dest(session, listener, line_instance, + empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0); break; case SKINNY_BUTTON_SPEED_DIAL: skinny_speed_dial_get(listener, request->data.stimulus.instance, &button_speed_dial); @@ -1296,7 +1309,8 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess break; case SKINNY_BUTTON_VOICEMAIL: skinny_create_incoming_session(listener, &line_instance, &session); - skinny_session_process_dest(session, listener, line_instance, listener->profile->ext_voicemail, '\0', 0); + skinny_session_process_dest(session, listener, line_instance, + empty_null2(listener->ext_voicemail, listener->profile->ext_voicemail), '\0', 0); break; case SKINNY_BUTTON_LINE: @@ -1871,7 +1885,8 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn switch(request->data.soft_key_event.event) { case SOFTKEY_REDIAL: status = skinny_create_incoming_session(listener, &line_instance, &session); - skinny_session_process_dest(session, listener, line_instance, listener->profile->ext_redial, '\0', 0); + skinny_session_process_dest(session, listener, line_instance, + empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0); break; case SOFTKEY_NEWCALL: status = skinny_create_incoming_session(listener, &line_instance, &session); @@ -1931,7 +1946,8 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn break; case SOFTKEY_MEETME: skinny_create_incoming_session(listener, &line_instance, &session); - skinny_session_process_dest(session, listener, line_instance, listener->profile->ext_meetme, '\0', 0); + skinny_session_process_dest(session, listener, line_instance, + empty_null2(listener->ext_meetme, listener->profile->ext_meetme), '\0', 0); break; default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, From 7dbf80ed8b20be01f26a91f19f0eec79bba6bba2 Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Fri, 2 Aug 2013 14:12:03 -0500 Subject: [PATCH 85/88] FS-5662 --resolve implement call pickup group functionality in mod_skinny. Currently treats callPickup and grpCallPickup identically, may revisit when I find out more about what's different between the two --- .../conf/directory/default/skinny-example.xml | 8 ++++++++ src/mod/endpoints/mod_skinny/mod_skinny.c | 9 +++++++++ src/mod/endpoints/mod_skinny/mod_skinny.h | 2 ++ src/mod/endpoints/mod_skinny/skinny_api.c | 1 + src/mod/endpoints/mod_skinny/skinny_server.c | 10 ++++++++++ 5 files changed, 30 insertions(+) diff --git a/src/mod/endpoints/mod_skinny/conf/directory/default/skinny-example.xml b/src/mod/endpoints/mod_skinny/conf/directory/default/skinny-example.xml index 8b8fad5812..c51b5ce9cf 100644 --- a/src/mod/endpoints/mod_skinny/conf/directory/default/skinny-example.xml +++ b/src/mod/endpoints/mod_skinny/conf/directory/default/skinny-example.xml @@ -8,6 +8,14 @@ --> + + + + diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 18b0f3c3f5..ab4398a898 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -172,6 +172,7 @@ switch_status_t skinny_profile_dump(const skinny_profile_t *profile, switch_stre stream->write_function(stream, "Ext-Voicemail \t%s\n", profile->ext_voicemail); stream->write_function(stream, "Ext-Redial \t%s\n", profile->ext_redial); stream->write_function(stream, "Ext-MeetMe \t%s\n", profile->ext_meetme); + stream->write_function(stream, "Ext-PickUp \t%s\n", profile->ext_pickup); stream->write_function(stream, "%s\n", line); return SWITCH_STATUS_SUCCESS; @@ -1869,6 +1870,10 @@ switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, c if (!profile->ext_meetme || strcmp(val, profile->ext_meetme)) { profile->ext_meetme = switch_core_strdup(profile->pool, val); } + } else if (!strcasecmp(var, "ext-pickup")) { + if (!profile->ext_pickup || strcmp(val, profile->ext_pickup)) { + profile->ext_pickup = switch_core_strdup(profile->pool, val); + } } else { return SWITCH_STATUS_FALSE; } @@ -1965,6 +1970,10 @@ static switch_status_t load_skinny_config(void) skinny_profile_set(profile, "ext-meetme", "conference"); } + if (!profile->ext_pickup) { + skinny_profile_set(profile, "ext-pickup", "pickup"); + } + if (profile->port == 0) { profile->port = 2000; } diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index 7c9dcdb314..df876d0894 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -124,6 +124,7 @@ struct skinny_profile { char *ext_voicemail; char *ext_redial; char *ext_meetme; + char *ext_pickup; /* db */ char *dbname; char *odbc_dsn; @@ -192,6 +193,7 @@ struct listener { char *ext_voicemail; char *ext_redial; char *ext_meetme; + char *ext_pickup; }; typedef struct listener listener_t; diff --git a/src/mod/endpoints/mod_skinny/skinny_api.c b/src/mod/endpoints/mod_skinny/skinny_api.c index 94318c8de0..db9338b000 100644 --- a/src/mod/endpoints/mod_skinny/skinny_api.c +++ b/src/mod/endpoints/mod_skinny/skinny_api.c @@ -234,6 +234,7 @@ static switch_status_t skinny_api_list_settings(const char *line, const char *cu switch_console_push_match(&my_matches, "ext-voicemail"); switch_console_push_match(&my_matches, "ext-redial"); switch_console_push_match(&my_matches, "ext-meetme"); + switch_console_push_match(&my_matches, "ext-pickup"); if (my_matches) { *matches = my_matches; diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index d648cac7e5..b30a0004d6 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1046,6 +1046,10 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r if (!listener->ext_meetme || strcmp(value,listener->ext_meetme)) { listener->ext_meetme = switch_core_strdup(profile->pool, value); } + } else if (!strcasecmp(name, "ext-pickup")) { + if (!listener->ext_pickup || strcmp(value,listener->ext_pickup)) { + listener->ext_pickup = switch_core_strdup(profile->pool, value); + } } } } @@ -1949,6 +1953,12 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn skinny_session_process_dest(session, listener, line_instance, empty_null2(listener->ext_meetme, listener->profile->ext_meetme), '\0', 0); break; + case SOFTKEY_CALLPICKUP: + case SOFTKEY_GRPCALLPICKUP: + skinny_create_incoming_session(listener, &line_instance, &session); + skinny_session_process_dest(session, listener, line_instance, + empty_null2(listener->ext_pickup, listener->profile->ext_pickup), '\0', 0); + break; default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown SoftKeyEvent type: %d.\n", request->data.soft_key_event.event); From 118614e44772569daf7d70f12b9c273cb1ec169e Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Fri, 2 Aug 2013 21:11:56 -0500 Subject: [PATCH 86/88] mod_skinny work on FS-5632 - first pass --- .../endpoints/mod_skinny/skinny_protocol.c | 260 ++++++++++-------- .../endpoints/mod_skinny/skinny_protocol.h | 19 +- src/mod/endpoints/mod_skinny/skinny_server.c | 88 +++--- 3 files changed, 198 insertions(+), 169 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.c b/src/mod/endpoints/mod_skinny/skinny_protocol.c index 677c703b39..2de3b87e27 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.c +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.c @@ -463,16 +463,15 @@ switch_status_t perform_send_keep_alive_ack(listener_t *listener, const char *file, const char *func, int line) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12); - message->type = KEEP_ALIVE_ACK_MESSAGE; - message->length = 4; + + skinny_create_empty_message(message, KEEP_ALIVE_ACK_MESSAGE); if ( listener->profile->debug >= 10 ) { skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Sending Keep Alive Ack%s\n", ""); } - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_register_ack(listener_t *listener, @@ -484,9 +483,9 @@ switch_status_t perform_send_register_ack(listener_t *listener, char *reserved2) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.reg_ack)); - message->type = REGISTER_ACK_MESSAGE; - message->length = 4 + sizeof(message->data.reg_ack); + + skinny_create_message(message, REGISTER_ACK_MESSAGE, reg_ack); + message->data.reg_ack.keep_alive = keep_alive; strncpy(message->data.reg_ack.date_format, date_format, 6); strncpy(message->data.reg_ack.reserved, reserved, 2); @@ -497,7 +496,7 @@ switch_status_t perform_send_register_ack(listener_t *listener, "Sending Register Ack with Keep Alive (%d), Date Format (%s), Secondary Keep Alive (%d)\n", keep_alive, date_format, secondary_keep_alive); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_speed_dial_stat_res(listener_t *listener, @@ -507,9 +506,8 @@ switch_status_t perform_send_speed_dial_stat_res(listener_t *listener, char *speed_label) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.speed_dial_res)); - message->type = SPEED_DIAL_STAT_RES_MESSAGE; - message->length = 4 + sizeof(message->data.speed_dial_res); + + skinny_create_message(message, SPEED_DIAL_STAT_RES_MESSAGE, speed_dial_res); message->data.speed_dial_res.number = number; strncpy(message->data.speed_dial_res.line, speed_line, 24); @@ -519,7 +517,7 @@ switch_status_t perform_send_speed_dial_stat_res(listener_t *listener, "Sending Speed Dial Stat Res with Number (%d), Line (%s), Label (%s)\n", number, speed_line, speed_label); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_start_tone(listener_t *listener, @@ -530,9 +528,9 @@ switch_status_t perform_send_start_tone(listener_t *listener, uint32_t call_id) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.start_tone)); - message->type = START_TONE_MESSAGE; - message->length = 4 + sizeof(message->data.start_tone); + + skinny_create_message(message, START_TONE_MESSAGE, start_tone); + message->data.start_tone.tone = tone; message->data.start_tone.reserved = reserved; message->data.start_tone.line_instance = line_instance; @@ -542,7 +540,7 @@ switch_status_t perform_send_start_tone(listener_t *listener, "Sending Start Tone with Tone (%s), Line Instance (%d), Call ID (%d)\n", skinny_tone2str(tone), line_instance, call_id); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_stop_tone(listener_t *listener, @@ -551,16 +549,16 @@ switch_status_t perform_send_stop_tone(listener_t *listener, uint32_t call_id) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.stop_tone)); - message->type = STOP_TONE_MESSAGE; - message->length = 4 + sizeof(message->data.stop_tone); + + skinny_create_message(message, STOP_TONE_MESSAGE, stop_tone); + message->data.stop_tone.line_instance = line_instance; message->data.stop_tone.call_id = call_id; skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Sending Stop Tone with Line Instance (%d), Call ID (%d)\n", line_instance, call_id); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_set_ringer(listener_t *listener, @@ -571,9 +569,9 @@ switch_status_t perform_send_set_ringer(listener_t *listener, uint32_t call_id) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.ringer)); - message->type = SET_RINGER_MESSAGE; - message->length = 4 + sizeof(message->data.ringer); + + skinny_create_message(message, SET_RINGER_MESSAGE, ringer); + message->data.ringer.ring_type = ring_type; message->data.ringer.ring_mode = ring_mode; message->data.ringer.line_instance = line_instance; @@ -583,7 +581,7 @@ switch_status_t perform_send_set_ringer(listener_t *listener, "Sending SetRinger with Ring Type (%s), Mode (%s), Line Instance (%d), Call ID (%d)\n", skinny_ring_type2str(ring_type), skinny_ring_mode2str(ring_mode), line_instance, call_id); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_set_lamp(listener_t *listener, @@ -593,9 +591,9 @@ switch_status_t perform_send_set_lamp(listener_t *listener, uint32_t mode) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.lamp)); - message->type = SET_LAMP_MESSAGE; - message->length = 4 + sizeof(message->data.lamp); + + skinny_create_message(message, SET_LAMP_MESSAGE, lamp); + message->data.lamp.stimulus = stimulus; message->data.lamp.stimulus_instance = stimulus_instance; message->data.lamp.mode = mode; @@ -604,7 +602,7 @@ switch_status_t perform_send_set_lamp(listener_t *listener, "Sending Set Lamp with Stimulus (%s), Stimulus Instance (%d), Mode (%s)\n", skinny_button2str(stimulus), stimulus_instance, skinny_lamp_mode2str(mode)); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_set_speaker_mode(listener_t *listener, @@ -612,15 +610,15 @@ switch_status_t perform_send_set_speaker_mode(listener_t *listener, uint32_t mode) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.speaker_mode)); - message->type = SET_SPEAKER_MODE_MESSAGE; - message->length = 4 + sizeof(message->data.speaker_mode); + + skinny_create_message(message, SET_SPEAKER_MODE_MESSAGE, speaker_mode); + message->data.speaker_mode.mode = mode; skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Sending Set Speaker Mode with Mode (%s)\n", skinny_speaker_mode2str(mode)); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_srvreq_response(listener_t *listener, @@ -629,9 +627,7 @@ switch_status_t perform_send_srvreq_response(listener_t *listener, { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.serv_res_mess)); - message->type = SERVER_RESPONSE_MESSAGE; - message->length = 4 + sizeof(message->data.serv_res_mess); + skinny_create_message(message, SERVER_RESPONSE_MESSAGE, serv_res_mess); message->data.serv_res_mess.serverListenPort[0] = port; switch_inet_pton(AF_INET,ip, &message->data.serv_res_mess.serverIpAddr[0]); @@ -640,7 +636,7 @@ switch_status_t perform_send_srvreq_response(listener_t *listener, skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Sending Server Request Response with IP (%s) and Port (%d)\n", ip, port); - return skinny_send_reply(listener, message); + return skinny_send_reply(listener, message, SWITCH_TRUE); } switch_status_t perform_send_start_media_transmission(listener_t *listener, @@ -657,9 +653,9 @@ switch_status_t perform_send_start_media_transmission(listener_t *listener, uint32_t g723_bitrate) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.start_media)); - message->type = START_MEDIA_TRANSMISSION_MESSAGE; - message->length = 4 + sizeof(message->data.start_media); + + skinny_create_message(message, START_MEDIA_TRANSMISSION_MESSAGE, start_media); + message->data.start_media.conference_id = conference_id; message->data.start_media.pass_thru_party_id = pass_thru_party_id; message->data.start_media.remote_ip = remote_ip; @@ -676,7 +672,7 @@ switch_status_t perform_send_start_media_transmission(listener_t *listener, "Send Start Media Transmission with Conf ID(%d), Passthrough Party ID (%d), ...\n", conference_id, pass_thru_party_id); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_stop_media_transmission(listener_t *listener, @@ -686,9 +682,9 @@ switch_status_t perform_send_stop_media_transmission(listener_t *listener, uint32_t conference_id2) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.stop_media)); - message->type = STOP_MEDIA_TRANSMISSION_MESSAGE; - message->length = 4 + sizeof(message->data.stop_media); + + skinny_create_message(message, STOP_MEDIA_TRANSMISSION_MESSAGE, stop_media); + message->data.stop_media.conference_id = conference_id; message->data.stop_media.pass_thru_party_id = pass_thru_party_id; message->data.stop_media.conference_id2 = conference_id2; @@ -698,7 +694,7 @@ switch_status_t perform_send_stop_media_transmission(listener_t *listener, "Send Stop Media Transmission with Conf ID (%d), Passthrough Party ID (%d), Conf ID2 (%d)\n", conference_id, pass_thru_party_id, conference_id2); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_call_info(listener_t *listener, @@ -725,9 +721,9 @@ switch_status_t perform_send_call_info(listener_t *listener, uint32_t party_pi_restriction_bits) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.call_info)); - message->type = CALL_INFO_MESSAGE; - message->length = 4 + sizeof(message->data.call_info); + + skinny_create_message(message, CALL_INFO_MESSAGE, call_info); + strncpy(message->data.call_info.calling_party_name, calling_party_name, 40); strncpy(message->data.call_info.calling_party, calling_party, 24); strncpy(message->data.call_info.called_party_name, called_party_name, 40); @@ -752,7 +748,7 @@ switch_status_t perform_send_call_info(listener_t *listener, skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Send Call Info with Line Instance (%d)...\n", line_instance); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_define_time_date(listener_t *listener, @@ -768,9 +764,9 @@ switch_status_t perform_send_define_time_date(listener_t *listener, uint32_t timestamp) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.define_time_date)); - message->type = DEFINE_TIME_DATE_MESSAGE; - message->length = 4+sizeof(message->data.define_time_date); + + skinny_create_message(message, DEFINE_TIME_DATE_MESSAGE, define_time_date); + message->data.define_time_date.year = year; message->data.define_time_date.month = month; message->data.define_time_date.day_of_week = day_of_week; @@ -785,7 +781,7 @@ switch_status_t perform_send_define_time_date(listener_t *listener, "Send Define Time Date with %.4d-%.2d-%.2d %.2d:%.2d:%.2d.%d, Timestamp (%d), DOW (%d)\n", year, month, day, hour, minute, seconds, milliseconds, timestamp, day_of_week); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_define_current_time_date(listener_t *listener, @@ -812,14 +808,13 @@ switch_status_t perform_send_capabilities_req(listener_t *listener, const char *file, const char *func, int line) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12); - message->type = CAPABILITIES_REQ_MESSAGE; - message->length = 4; + + skinny_create_empty_message(message, CAPABILITIES_REQ_MESSAGE); skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Send Capabilities Req%s\n", ""); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_version(listener_t *listener, @@ -827,15 +822,15 @@ switch_status_t perform_send_version(listener_t *listener, char *version) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.version)); - message->type = VERSION_MESSAGE; - message->length = 4+ sizeof(message->data.version); + + skinny_create_message(message, VERSION_MESSAGE, version); + strncpy(message->data.version.version, version, 16); skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Send Version with Version(%s)\n", version); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_register_reject(listener_t *listener, @@ -843,15 +838,15 @@ switch_status_t perform_send_register_reject(listener_t *listener, char *error) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.reg_rej)); - message->type = REGISTER_REJECT_MESSAGE; - message->length = 4 + sizeof(message->data.reg_rej); + + skinny_create_message(message, REGISTER_REJECT_MESSAGE, reg_rej); + strncpy(message->data.reg_rej.error, error, 33); skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Send Register Reject with Error (%s)\n", error); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_open_receive_channel(listener_t *listener, @@ -866,9 +861,9 @@ switch_status_t perform_send_open_receive_channel(listener_t *listener, uint32_t reserved[10]) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.open_receive_channel)); - message->type = OPEN_RECEIVE_CHANNEL_MESSAGE; - message->length = 4 + sizeof(message->data.open_receive_channel); + + skinny_create_message(message, OPEN_RECEIVE_CHANNEL_MESSAGE, open_receive_channel); + message->data.open_receive_channel.conference_id = conference_id; message->data.open_receive_channel.pass_thru_party_id = pass_thru_party_id; message->data.open_receive_channel.ms_per_packet = ms_per_packet; @@ -892,7 +887,7 @@ switch_status_t perform_send_open_receive_channel(listener_t *listener, skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Send Open Receive Channel with Conf ID (%d), ...\n", conference_id); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_close_receive_channel(listener_t *listener, @@ -902,9 +897,9 @@ switch_status_t perform_send_close_receive_channel(listener_t *listener, uint32_t conference_id2) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.close_receive_channel)); - message->type = CLOSE_RECEIVE_CHANNEL_MESSAGE; - message->length = 4 + sizeof(message->data.close_receive_channel); + + skinny_create_message(message, CLOSE_RECEIVE_CHANNEL_MESSAGE, close_receive_channel); + message->data.close_receive_channel.conference_id = conference_id; message->data.close_receive_channel.pass_thru_party_id = pass_thru_party_id; message->data.close_receive_channel.conference_id2 = conference_id2; @@ -912,7 +907,7 @@ switch_status_t perform_send_close_receive_channel(listener_t *listener, skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Send Close Receive Channel with Conf ID (%d), ...\n", conference_id); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_select_soft_keys(listener_t *listener, @@ -923,9 +918,9 @@ switch_status_t perform_send_select_soft_keys(listener_t *listener, uint32_t valid_key_mask) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.select_soft_keys)); - message->type = SELECT_SOFT_KEYS_MESSAGE; - message->length = 4 + sizeof(message->data.select_soft_keys); + + skinny_create_message(message, SELECT_SOFT_KEYS_MESSAGE, select_soft_keys); + message->data.select_soft_keys.line_instance = line_instance; message->data.select_soft_keys.call_id = call_id; message->data.select_soft_keys.soft_key_set = soft_key_set; @@ -935,7 +930,7 @@ switch_status_t perform_send_select_soft_keys(listener_t *listener, "Send Select Soft Keys with Line Instance (%d), Call ID (%d), Soft Key Set (%d), Valid Key Mask (%x)\n", line_instance, call_id, soft_key_set, valid_key_mask); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_call_state(listener_t *listener, @@ -945,9 +940,9 @@ switch_status_t perform_send_call_state(listener_t *listener, uint32_t call_id) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.call_state)); - message->type = CALL_STATE_MESSAGE; - message->length = 4 + sizeof(message->data.call_state); + + skinny_create_message(message, CALL_STATE_MESSAGE, call_state); + message->data.call_state.call_state = call_state; message->data.call_state.line_instance = line_instance; message->data.call_state.call_id = call_id; @@ -956,7 +951,7 @@ switch_status_t perform_send_call_state(listener_t *listener, "Send Call State with State (%s), Line Instance (%d), Call ID (%d)\n", skinny_call_state2str(call_state), line_instance, call_id); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_display_prompt_status(listener_t *listener, @@ -969,9 +964,8 @@ switch_status_t perform_send_display_prompt_status(listener_t *listener, skinny_message_t *message; char *tmp; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.display_prompt_status)); - message->type = DISPLAY_PROMPT_STATUS_MESSAGE; - message->length = 4 + sizeof(message->data.display_prompt_status); + skinny_create_message(message, DISPLAY_PROMPT_STATUS_MESSAGE, display_prompt_status); + message->data.display_prompt_status.timeout = timeout; strncpy(message->data.display_prompt_status.display, display, 32); message->data.display_prompt_status.line_instance = line_instance; @@ -985,7 +979,7 @@ switch_status_t perform_send_display_prompt_status(listener_t *listener, switch_safe_free(tmp); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_display_prompt_status_textid(listener_t *listener, @@ -997,9 +991,9 @@ switch_status_t perform_send_display_prompt_status_textid(listener_t *listener, { skinny_message_t *message; char *label; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.display_prompt_status)); - message->type = DISPLAY_PROMPT_STATUS_MESSAGE; - message->length = 4 + sizeof(message->data.display_prompt_status); + + skinny_create_message(message, DISPLAY_PROMPT_STATUS_MESSAGE, display_prompt_status); + message->data.display_prompt_status.timeout = timeout; label = skinny_textid2raw(display_textid); @@ -1013,7 +1007,7 @@ switch_status_t perform_send_display_prompt_status_textid(listener_t *listener, "Send Display Prompt Status with Timeout (%d), Display (%s), Line Instance (%d), Call ID (%d)\n", timeout, skinny_textid2str(display_textid), line_instance, call_id); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_clear_prompt_status(listener_t *listener, @@ -1022,9 +1016,9 @@ switch_status_t perform_send_clear_prompt_status(listener_t *listener, uint32_t call_id) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.clear_prompt_status)); - message->type = CLEAR_PROMPT_STATUS_MESSAGE; - message->length = 4 + sizeof(message->data.clear_prompt_status); + + skinny_create_message(message, CLEAR_PROMPT_STATUS_MESSAGE, clear_prompt_status); + message->data.clear_prompt_status.line_instance = line_instance; message->data.clear_prompt_status.call_id = call_id; @@ -1032,7 +1026,7 @@ switch_status_t perform_send_clear_prompt_status(listener_t *listener, "Send Clear Prompt Status with Line Instance (%d), Call ID (%d)\n", line_instance, call_id); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_activate_call_plane(listener_t *listener, @@ -1040,15 +1034,15 @@ switch_status_t perform_send_activate_call_plane(listener_t *listener, uint32_t line_instance) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.activate_call_plane)); - message->type = ACTIVATE_CALL_PLANE_MESSAGE; - message->length = 4 + sizeof(message->data.activate_call_plane); + + skinny_create_message(message, ACTIVATE_CALL_PLANE_MESSAGE, activate_call_plane); + message->data.activate_call_plane.line_instance = line_instance; skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Send Activate Call Plane with Line Instance (%d)\n", line_instance); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_back_space_request(listener_t *listener, @@ -1057,9 +1051,9 @@ switch_status_t perform_send_back_space_request(listener_t *listener, uint32_t call_id) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.back_space_req)); - message->type = BACK_SPACE_REQ_MESSAGE; - message->length = 4 + sizeof(message->data.back_space_req); + + skinny_create_message(message, BACK_SPACE_REQ_MESSAGE, back_space_req); + message->data.back_space_req.line_instance = line_instance; message->data.back_space_req.call_id = call_id; @@ -1067,7 +1061,7 @@ switch_status_t perform_send_back_space_request(listener_t *listener, "Send Back Space Request with Line Instance (%d), Call ID (%d)\n", line_instance, call_id); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } @@ -1078,9 +1072,9 @@ switch_status_t perform_send_dialed_number(listener_t *listener, uint32_t call_id) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.dialed_number)); - message->type = DIALED_NUMBER_MESSAGE; - message->length = 4 + sizeof(message->data.dialed_number); + + skinny_create_message(message, DIALED_NUMBER_MESSAGE, dialed_number); + strncpy(message->data.dialed_number.called_party, called_party, 24); message->data.dialed_number.line_instance = line_instance; message->data.dialed_number.call_id = call_id; @@ -1089,7 +1083,7 @@ switch_status_t perform_send_dialed_number(listener_t *listener, "Send Dialed Number with Number (%s), Line Instance (%d), Call ID (%d)\n", called_party, line_instance, call_id); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_display_pri_notify(listener_t *listener, @@ -1099,9 +1093,9 @@ switch_status_t perform_send_display_pri_notify(listener_t *listener, char *notify) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.display_pri_notify)); - message->type = DISPLAY_PRI_NOTIFY_MESSAGE; - message->length = 4 + sizeof(message->data.display_pri_notify); + + skinny_create_message(message, DISPLAY_PRI_NOTIFY_MESSAGE, display_pri_notify); + message->data.display_pri_notify.message_timeout = message_timeout; message->data.display_pri_notify.priority = priority; strncpy(message->data.display_pri_notify.notify, notify, 32); @@ -1110,7 +1104,7 @@ switch_status_t perform_send_display_pri_notify(listener_t *listener, "Send Display Pri Notify with Timeout (%d), Priority (%d), Message (%s)\n", message_timeout, priority, notify); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } @@ -1119,15 +1113,15 @@ switch_status_t perform_send_reset(listener_t *listener, uint32_t reset_type) { skinny_message_t *message; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.reset)); - message->type = RESET_MESSAGE; - message->length = 4 + sizeof(message->data.reset); + + skinny_create_message(message, RESET_MESSAGE, reset); + message->data.reset.reset_type = reset_type; skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Send Reset with Type (%s)\n", skinny_device_reset_type2str(reset_type)); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_data(listener_t *listener, @@ -1142,13 +1136,17 @@ switch_status_t perform_send_data(listener_t *listener, { skinny_message_t *message; switch_assert(data_length == strlen(data)); + /* data_length should be a multiple of 4 */ if ((data_length % 4) != 0) { data_length = (data_length / 4 + 1) * 4; } - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.data)+data_length-1); + + /* This one needs explicit allocation */ + message = calloc(12+sizeof(message->data.data)+data_length-1, 1); message->type = message_type; message->length = 4 + sizeof(message->data.data)+data_length-1; + message->data.data.application_id = application_id; message->data.data.line_instance = line_instance; message->data.data.call_id = call_id; @@ -1159,7 +1157,7 @@ switch_status_t perform_send_data(listener_t *listener, skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Send Data with Data Length (%d)\n", data_length); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } switch_status_t perform_send_extended_data(listener_t *listener, @@ -1179,13 +1177,17 @@ switch_status_t perform_send_extended_data(listener_t *listener, { skinny_message_t *message; switch_assert(data_length == strlen(data)); + /* data_length should be a multiple of 4 */ if ((data_length % 4) != 0) { data_length = (data_length / 4 + 1) * 4; } - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.extended_data)+data_length-1); + + /* This one needs explicit allocation */ + message = calloc(12+sizeof(message->data.extended_data)+data_length-1, 1); message->type = message_type; message->length = 4 + sizeof(message->data.extended_data)+data_length-1; + message->data.extended_data.application_id = application_id; message->data.extended_data.line_instance = line_instance; message->data.extended_data.call_id = call_id; @@ -1202,32 +1204,45 @@ switch_status_t perform_send_extended_data(listener_t *listener, "Send Extended Data with Application ID (%d), Line Instance (%d), Call ID (%d), ...\n", application_id, line_instance, call_id ); - return skinny_send_reply_quiet(listener, message); + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } -switch_status_t skinny_perform_send_reply_quiet(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply) +switch_status_t skinny_perform_send_reply_quiet(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply, + switch_bool_t discard) { char *ptr; switch_size_t len; + switch_status_t res; + switch_assert(reply != NULL); + len = reply->length+8; ptr = (char *) reply; if (listener_is_ready(listener)) { - return switch_socket_send(listener->sock, ptr, &len); + res = switch_socket_send(listener->sock, ptr, &len); + + if ( discard ) { switch_safe_free(reply); } + return res; } else { skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_WARNING, "Not sending %s (type=%x,length=%d) while not ready.\n", skinny_message_type2str(reply->type), reply->type, reply->length); + + if ( discard ) { switch_safe_free(reply); } return SWITCH_STATUS_FALSE; } } -switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply) +switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply, + switch_bool_t discard) { char *ptr; switch_size_t len; + switch_status_t res; + switch_assert(reply != NULL); + len = reply->length+8; ptr = (char *) reply; @@ -1237,11 +1252,16 @@ switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file "Sending %s (type=%x,length=%d).\n", skinny_message_type2str(reply->type), reply->type, reply->length); } - return switch_socket_send(listener->sock, ptr, &len); + res = switch_socket_send(listener->sock, ptr, &len); + + if ( discard ) { switch_safe_free(reply); } + return res; } else { skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_WARNING, "Not sending %s (type=%x,length=%d) while not ready.\n", skinny_message_type2str(reply->type), reply->type, reply->length); + + if ( discard ) { switch_safe_free(reply); } return SWITCH_STATUS_FALSE; } } diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index 2fe1336aa6..43b2502e81 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -87,6 +87,17 @@ char* skinny_codec2string(skinny_codecs skinnycodec); /* SKINNY MESSAGE DATA */ /*****************************************************************************/ +#define skinny_create_message(message,msgtype,field) \ + message = calloc(12 + sizeof(message->data.field), 1); \ + message->type = msgtype; \ + message->length = 4 + sizeof(message->data.field) + +#define skinny_create_empty_message(message,msgtype) \ + message = calloc(12, 1); \ + message->type = msgtype; \ + message->length = 4 + + /* KeepAliveMessage */ #define KEEP_ALIVE_MESSAGE 0x0000 @@ -955,11 +966,11 @@ void skinny_speed_dial_get(listener_t *listener, uint32_t instance, struct speed void skinny_service_url_get(listener_t *listener, uint32_t instance, struct service_url_stat_res_message **button); void skinny_feature_get(listener_t *listener, uint32_t instance, struct feature_stat_res_message **button); -switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply); -#define skinny_send_reply(listener, reply) skinny_perform_send_reply(listener, __FILE__, __SWITCH_FUNC__, __LINE__, reply) +switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply, switch_bool_t discard); +#define skinny_send_reply(listener, reply, discard) skinny_perform_send_reply(listener, __FILE__, __SWITCH_FUNC__, __LINE__, reply, discard) -switch_status_t skinny_perform_send_reply_quiet(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply); -#define skinny_send_reply_quiet(listener, reply) skinny_perform_send_reply_quiet(listener, __FILE__, __SWITCH_FUNC__, __LINE__, reply) +switch_status_t skinny_perform_send_reply_quiet(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply, switch_bool_t discard); +#define skinny_send_reply_quiet(listener, reply, discard) skinny_perform_send_reply_quiet(listener, __FILE__, __SWITCH_FUNC__, __LINE__, reply, discard) switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *request); diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index b30a0004d6..36e3f07d04 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -58,8 +58,6 @@ uint32_t soft_key_template_default_textids[] = { SKINNY_TEXTID_IDIVERT }; -#define TEXT_ID_LEN 20 - uint32_t soft_key_template_default_events[] = { SOFTKEY_REDIAL, SOFTKEY_NEWCALL, @@ -1440,15 +1438,13 @@ switch_status_t skinny_handle_forward_stat_req_message(listener_t *listener, ski skinny_check_data_length(request, sizeof(request->data.forward_stat_req)); - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.forward_stat)); - message->type = FORWARD_STAT_MESSAGE; - message->length = 4 + sizeof(message->data.forward_stat); + skinny_create_message(message, FORWARD_STAT_MESSAGE, forward_stat); message->data.forward_stat.line_instance = request->data.forward_stat_req.line_instance; skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Forward Stat Req Message with Line Instance (%d)\n", request->data.forward_stat_req.line_instance); - skinny_send_reply_quiet(listener, message); + skinny_send_reply_quiet(listener, message, SWITCH_TRUE); return SWITCH_STATUS_SUCCESS; } @@ -1475,15 +1471,13 @@ switch_status_t skinny_handle_line_stat_request(listener_t *listener, skinny_mes skinny_check_data_length(request, sizeof(request->data.line_req)); - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.line_res)); - message->type = LINE_STAT_RES_MESSAGE; - message->length = 4 + sizeof(message->data.line_res); + skinny_create_message(message, LINE_STAT_RES_MESSAGE, line_res); skinny_line_get(listener, request->data.line_req.number, &button); memcpy(&message->data.line_res, button, sizeof(struct line_stat_res_message)); - skinny_send_reply(listener, message); + skinny_send_reply(listener, message, SWITCH_TRUE); return SWITCH_STATUS_SUCCESS; } @@ -1521,9 +1515,7 @@ switch_status_t skinny_handle_config_stat_request(listener_t *listener, skinny_m profile = listener->profile; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.config_res)); - message->type = CONFIG_STAT_RES_MESSAGE; - message->length = 4 + sizeof(message->data.config_res); + skinny_create_message(message, CONFIG_STAT_RES_MESSAGE, config_res); if ((sql = switch_mprintf( "SELECT name, user_id, instance, '' AS user_name, '' AS server_name, " @@ -1540,7 +1532,7 @@ switch_status_t skinny_handle_config_stat_request(listener_t *listener, skinny_m skinny_execute_sql_callback(profile, profile->sql_mutex, sql, skinny_config_stat_res_callback, message); switch_safe_free(sql); } - skinny_send_reply(listener, message); + skinny_send_reply(listener, message, SWITCH_TRUE); return SWITCH_STATUS_SUCCESS; } @@ -1591,9 +1583,7 @@ switch_status_t skinny_handle_button_template_request(listener_t *listener, skin profile = listener->profile; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.button_template)); - message->type = BUTTON_TEMPLATE_RES_MESSAGE; - message->length = 4 + sizeof(message->data.button_template); + skinny_create_message(message, BUTTON_TEMPLATE_RES_MESSAGE, button_template); message->data.button_template.button_offset = 0; message->data.button_template.button_count = 0; @@ -1636,9 +1626,7 @@ switch_status_t skinny_handle_button_template_request(listener_t *listener, skin } } - - - return skinny_send_reply(listener, message);; + return skinny_send_reply(listener, message, SWITCH_TRUE); } switch_status_t skinny_handle_version_request(listener_t *listener, skinny_message_t *request) @@ -1856,7 +1844,7 @@ switch_status_t skinny_handle_soft_key_set_request(listener_t *listener, skinny_ skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Soft Key Set Request with Set (%s)\n", "default"); } if (message) { - skinny_send_reply(listener, message); + skinny_send_reply_quiet(listener, message, SWITCH_FALSE); } else { skinny_log_l(listener, SWITCH_LOG_ERROR, "Profile %s doesn't have a default .\n", listener->profile->name); @@ -1980,14 +1968,13 @@ switch_status_t skinny_handle_unregister(listener_t *listener, skinny_message_t skinny_device_event(listener, &event, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_UNREGISTER); switch_event_fire(&event); - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.unregister_ack)); - message->type = UNREGISTER_ACK_MESSAGE; - message->length = 4 + sizeof(message->data.unregister_ack); + skinny_create_message(message, UNREGISTER_ACK_MESSAGE, unregister_ack); + message->data.unregister_ack.unregister_status = 0; /* OK */ skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Unregister with Status (%d)\n", message->data.unregister_ack.unregister_status); - skinny_send_reply_quiet(listener, message); + skinny_send_reply_quiet(listener, message, SWITCH_TRUE); /* Close socket */ switch_clear_flag_locked(listener, LFLAG_RUNNING); @@ -2006,18 +1993,15 @@ switch_status_t skinny_handle_soft_key_template_request(listener_t *listener, sk switch_assert(listener->profile); switch_assert(listener->device_name); - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.soft_key_template)); - message->type = SOFT_KEY_TEMPLATE_RES_MESSAGE; - message->length = 4 + sizeof(message->data.soft_key_template); + skinny_create_message(message, SOFT_KEY_TEMPLATE_RES_MESSAGE, soft_key_template); message->data.soft_key_template.soft_key_offset = 0; message->data.soft_key_template.soft_key_count = 21; message->data.soft_key_template.total_soft_key_count = 21; - memset(message->data.soft_key_template.soft_key, 0, sizeof(message->data.soft_key_template)); - for (i=0; i< TEXT_ID_LEN; i++) { + for (i=0; i < sizeof(soft_key_template_default_textids)/4; i++) { char *label = skinny_textid2raw(soft_key_template_default_textids[i]); - strcpy(message->data.soft_key_template.soft_key[i].soft_key_label, skinny_textid2raw(soft_key_template_default_textids[i])); + strncpy(message->data.soft_key_template.soft_key[i].soft_key_label, label, sizeof(message->data.soft_key_template.soft_key[i].soft_key_label)); switch_safe_free(label); message->data.soft_key_template.soft_key[i].soft_key_event = soft_key_template_default_events[i]; @@ -2025,7 +2009,7 @@ switch_status_t skinny_handle_soft_key_template_request(listener_t *listener, sk skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, "Handle Soft Key Template Request with Default Template\n"); - skinny_send_reply_quiet(listener, message); + skinny_send_reply_quiet(listener, message, SWITCH_TRUE); return SWITCH_STATUS_SUCCESS; } @@ -2078,12 +2062,16 @@ switch_status_t skinny_handle_data_message(listener_t *listener, skinny_message_ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Call-Id", "%d", request->data.data.call_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Transaction-Id", "%d", request->data.data.transaction_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Data-Length", "%d", request->data.data.data_length); - /* Ensure that the body is null-terminated */ + tmp = malloc(request->data.data.data_length + 1); memcpy(tmp, request->data.data.data, request->data.data.data_length); + + /* Ensure that the body is null-terminated */ tmp[request->data.data.data_length] = '\0'; switch_event_add_body(event, "%s", tmp); + switch_safe_free(tmp); + switch_event_fire(&event); return SWITCH_STATUS_SUCCESS; @@ -2096,15 +2084,13 @@ switch_status_t skinny_handle_service_url_stat_request(listener_t *listener, ski skinny_check_data_length(request, sizeof(request->data.service_url_req)); - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.service_url_res)); - message->type = SERVICE_URL_STAT_RES_MESSAGE; - message->length = 4 + sizeof(message->data.service_url_res); + skinny_create_message(message, SERVICE_URL_STAT_RES_MESSAGE, service_url_res); skinny_service_url_get(listener, request->data.service_url_req.service_url_index, &button); memcpy(&message->data.service_url_res, button, sizeof(struct service_url_stat_res_message)); - skinny_send_reply(listener, message); + skinny_send_reply(listener, message, SWITCH_TRUE); return SWITCH_STATUS_SUCCESS; } @@ -2116,15 +2102,13 @@ switch_status_t skinny_handle_feature_stat_request(listener_t *listener, skinny_ skinny_check_data_length(request, sizeof(request->data.feature_req)); - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.feature_res)); - message->type = FEATURE_STAT_RES_MESSAGE; - message->length = 4 + sizeof(message->data.feature_res); + skinny_create_message(message, FEATURE_STAT_RES_MESSAGE, feature_res); skinny_feature_get(listener, request->data.feature_req.feature_index, &button); memcpy(&message->data.feature_res, button, sizeof(struct feature_stat_res_message)); - skinny_send_reply(listener, message); + skinny_send_reply(listener, message, SWITCH_TRUE); return SWITCH_STATUS_SUCCESS; } @@ -2150,32 +2134,46 @@ switch_status_t skinny_handle_extended_data_message(listener_t *listener, skinny switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Conference-Id", "%d", request->data.extended_data.conference_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-App-Instance-Id", "%d", request->data.extended_data.app_instance_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Routing-Id", "%d", request->data.extended_data.routing_id); - /* Ensure that the body is null-terminated */ + tmp = malloc(request->data.data.data_length + 1); memcpy(tmp, request->data.data.data, request->data.data.data_length); + + /* Ensure that the body is null-terminated */ tmp[request->data.data.data_length] = '\0'; switch_event_add_body(event, "%s", tmp); + switch_safe_free(tmp); switch_event_fire(&event); return SWITCH_STATUS_SUCCESS; } + switch_status_t skinny_handle_dialed_phone_book_message(listener_t *listener, skinny_message_t *request) { skinny_message_t *message; skinny_check_data_length(request, sizeof(request->data.dialed_phone_book)); - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.dialed_phone_book_ack)); - message->type = DIALED_PHONE_BOOK_ACK_MESSAGE; - message->length = 4 + sizeof(message->data.dialed_phone_book_ack); + skinny_create_message(message, DIALED_PHONE_BOOK_ACK_MESSAGE, dialed_phone_book_ack); + message->data.dialed_phone_book_ack.number_index = request->data.dialed_phone_book.number_index; message->data.dialed_phone_book_ack.line_instance = request->data.dialed_phone_book.line_instance; message->data.dialed_phone_book_ack.unknown = request->data.dialed_phone_book.unknown; message->data.dialed_phone_book_ack.unknown2 = 0; +#if 0 + /* Not sure why this isn't being sent at this point, need to investigate */ + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Sending Handle Dialed Phone Book Ack Message with Number Index (%d), Line Instance (%d)\n", + request->data.dialed_phone_book.number_index, request->data.dialed_phone_book.line_instance); + + return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); +#else + switch_safe_free(message); return SWITCH_STATUS_SUCCESS; +#endif } + switch_status_t skinny_handle_accessory_status_message(listener_t *listener, skinny_message_t *request) { char *sql; From 4d9ff80a0168593401ba0bf5001f31525119342d Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Fri, 2 Aug 2013 21:25:51 -0500 Subject: [PATCH 87/88] mod_skinny work on FS-5632 - few more cases --- src/mod/endpoints/mod_skinny/mod_skinny.c | 4 +++- src/mod/endpoints/mod_skinny/skinny_protocol.c | 10 +++++++++- src/mod/endpoints/mod_skinny/skinny_server.c | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index ab4398a898..13a94810f8 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1604,9 +1604,11 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) if (skinny_handle_request(listener, request) != SWITCH_STATUS_SUCCESS) { switch_clear_flag_locked(listener, LFLAG_RUNNING); + switch_safe_free(request); break; + } else { + switch_safe_free(request); } - } remove_listener(listener); diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.c b/src/mod/endpoints/mod_skinny/skinny_protocol.c index 2de3b87e27..ce756da34a 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.c +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.c @@ -110,7 +110,7 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) char *ptr; switch_status_t status = SWITCH_STATUS_SUCCESS; - request = switch_core_alloc(listener->pool, SKINNY_MESSAGE_MAXSIZE); + request = calloc(SKINNY_MESSAGE_MAXSIZE,1); if (!request) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate memory.\n"); @@ -122,6 +122,7 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) while (listener_is_ready(listener)) { uint8_t do_sleep = 1; if (listener->expire_time && listener->expire_time < switch_epoch_time_now(NULL)) { + switch_safe_free(request); return SWITCH_STATUS_TIMEOUT; } if(bytes < SKINNY_MESSAGE_FIELD_SIZE) { @@ -135,6 +136,7 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) status = switch_socket_recv(listener->sock, ptr, &mlen); if (listener->expire_time && listener->expire_time < switch_epoch_time_now(NULL)) { + switch_safe_free(request); return SWITCH_STATUS_TIMEOUT; } @@ -143,6 +145,7 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) } if (!switch_status_is_timeup(status) && !SWITCH_STATUS_IS_BREAK(status) && (status != SWITCH_STATUS_SUCCESS)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Socket break with status=%d.\n", status); + switch_safe_free(request); return SWITCH_STATUS_FALSE; } @@ -162,17 +165,20 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Skinny client sent invalid data. Length should be greater than 4 but got %d.\n", request->length); + switch_safe_free(request); return SWITCH_STATUS_FALSE; } if(request->length + 2*SKINNY_MESSAGE_FIELD_SIZE > SKINNY_MESSAGE_MAXSIZE) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Skinny client sent too huge data. Got %d which is above threshold %d.\n", request->length, SKINNY_MESSAGE_MAXSIZE - 2*SKINNY_MESSAGE_FIELD_SIZE); + switch_safe_free(request); return SWITCH_STATUS_FALSE; } if(bytes >= request->length + 2*SKINNY_MESSAGE_FIELD_SIZE) { /* Message body */ *req = request; + /* Do not free here, caller needs to do it */ return SWITCH_STATUS_SUCCESS; } } @@ -181,6 +187,8 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) switch_cond_next(); } } + + switch_safe_free(request); return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 36e3f07d04..f3dda49f1b 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1687,7 +1687,11 @@ switch_status_t skinny_handle_capabilities_response(listener_t *listener, skinny } i = 0; pos = 0; - codec_string = switch_core_alloc(listener->pool, string_len+1); + codec_string = calloc(string_len+1,1); + if ( !codec_string ) { + skinny_log_l_msg(listener, SWITCH_LOG_ERROR, "Unable to allocate memory for codec string.\n"); + return SWITCH_STATUS_FALSE; + } for (string_pos = 0; string_pos < string_len; string_pos++) { char *codec = codec_order[i]; switch_assert(i < n); @@ -1709,6 +1713,7 @@ switch_status_t skinny_handle_capabilities_response(listener_t *listener, skinny switch_safe_free(sql); } skinny_log_l(listener, SWITCH_LOG_DEBUG, "Codecs %s supported.\n", codec_string); + switch_safe_free(codec_string); return SWITCH_STATUS_SUCCESS; } From 80f91682269291fd63ca841fc31b1a9d57ced198 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 3 Aug 2013 18:49:55 +0500 Subject: [PATCH 88/88] FS-5664 --resolve --- src/switch_core_sqldb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index b793121a77..e270a0c29c 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -393,6 +393,7 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h const char *db_name = NULL; const char *odbc_user = NULL; const char *odbc_pass = NULL; + const char *db_type = NULL; while(runtime.max_db_handles && sql_manager.total_handles >= runtime.max_db_handles && sql_manager.total_used_handles >= sql_manager.total_handles) { if (!waiting++) { @@ -416,12 +417,14 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h db_name = connection_options->pgsql_options.dsn; odbc_user = NULL; odbc_pass = NULL; + db_type = "pgsql"; } case SCDB_TYPE_ODBC: { db_name = connection_options->odbc_options.dsn; odbc_user = connection_options->odbc_options.user; odbc_pass = connection_options->odbc_options.pass; + db_type = "odbc"; } break; case SCDB_TYPE_CORE_DB: @@ -429,6 +432,7 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h db_name = connection_options->core_db_options.db_path; odbc_user = NULL; odbc_pass = NULL; + db_type = "core_db"; } break; } @@ -438,9 +442,9 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h } if (odbc_user || odbc_pass) { - snprintf(db_str, sizeof(db_str) - 1, "db=\"%s\";user=\"%s\";pass=\"%s\"", db_name, odbc_user, odbc_pass); + snprintf(db_str, sizeof(db_str) - 1, "db=\"%s\";type=\"%s\"user=\"%s\";pass=\"%s\"", db_name, db_type, odbc_user, odbc_pass); } else { - snprintf(db_str, sizeof(db_str) - 1, "db=\"%s\"", db_name); + snprintf(db_str, sizeof(db_str) - 1, "db=\"%s\",type=\"%s\"", db_name, db_type); } snprintf(db_callsite_str, sizeof(db_callsite_str) - 1, "%s:%d", file, line); snprintf(thread_str, sizeof(thread_str) - 1, "thread=\"%lu\"", (unsigned long) (intptr_t) self);