Added a "nation" parameter to v18_init(), in preparation for automoding.

This commit is contained in:
Steve Underwood 2013-07-03 02:39:09 +08:00
parent ba96b391d3
commit 20531a097a
6 changed files with 183 additions and 172 deletions

View File

@ -31,6 +31,7 @@ struct v18_state_s
/*! \brief TRUE if we are the calling modem */
int calling_party;
int mode;
int nation;
put_msg_func_t put_msg;
void *user_data;
int repeat_shifts;

View File

@ -54,12 +54,16 @@ enum
/* V.18 Annex F - V.21 text telephone, V.21, duplex, ASCII (Sweden, Norway and Finland). */
V18_MODE_V21TEXTPHONE = 7,
/* V.18 Annex G - V.18 text telephone mode. */
V18_MODE_V18TEXTPHONE = 8
V18_MODE_V18TEXTPHONE = 8,
/* Use repetitive shift characters where character set shifts are used */
V18_MODE_REPETITIVE_SHIFTS_OPTION = 0x1000
};
/* Automoding sequences for different countries */
enum
{
V18_AUTOMODING_GLOBAL = 0,
/* 5-bit, V.21, V.23, EDT, DTMF, Bell 103 */
V18_AUTOMODING_AUSTRALIA,
V18_AUTOMODING_IRELAND,
@ -89,7 +93,9 @@ enum
/* V.23, EDT, DTMF, 5-bit, V.21, Bell 103 */
V18_AUTOMODING_FRANCE,
V18_AUTOMODING_BELGIUM
V18_AUTOMODING_BELGIUM,
V18_AUTOMODING_END
};
#if defined(__cplusplus)
@ -104,6 +110,7 @@ SPAN_DECLARE(logging_state_t *) v18_get_logging_state(v18_state_t *s);
\param s The V.18 context.
\param calling_party TRUE if caller mode, else answerer mode.
\param mode Mode of operation.
\param nation National variant for automoding.
\param put_msg A callback routine called to deliver the received text
to the application.
\param user_data An opaque pointer for the callback routine.
@ -111,6 +118,7 @@ SPAN_DECLARE(logging_state_t *) v18_get_logging_state(v18_state_t *s);
SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
int calling_party,
int mode,
int nation,
put_msg_func_t put_msg,
void *user_data);

View File

@ -954,6 +954,7 @@ SPAN_DECLARE(logging_state_t *) v18_get_logging_state(v18_state_t *s)
SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
int calling_party,
int mode,
int nation,
put_msg_func_t put_msg,
void *user_data)
{
@ -1024,6 +1025,7 @@ SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_V21CH1], FSK_FRAME_MODE_7E1_FRAMES, v18_textphone_put_async_byte, s);
break;
}
s->nation = nation;
queue_init(&s->queue.queue, 128, QUEUE_READ_ATOMIC | QUEUE_WRITE_ATOMIC);
return s;
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -206,7 +206,7 @@ switch_status_t spandsp_tdd_send_session(switch_core_session_t *session, const c
return SWITCH_STATUS_FALSE;
}
tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), put_text_msg, NULL);
tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL);
v18_put(tdd_state, text, -1);
@ -253,7 +253,7 @@ switch_status_t spandsp_tdd_encode_session(switch_core_session_t *session, const
}
pvt->session = session;
pvt->tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), put_text_msg, NULL);
pvt->tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL);
pvt->head_lead = TDD_LEAD;
v18_put(pvt->tdd_state, text, -1);
@ -331,7 +331,7 @@ switch_status_t spandsp_tdd_decode_session(switch_core_session_t *session)
}
pvt->session = session;
pvt->tdd_state = v18_init(NULL, FALSE, get_v18_mode(session), put_text_msg, pvt);
pvt->tdd_state = v18_init(NULL, FALSE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, pvt);
if ((status = switch_core_media_bug_add(session, "spandsp_tdd_decode", NULL,
tdd_decode_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) {