*/
SWITCH_DECLARE(switch_codec_interface_t *) switch_loadable_module_get_codec_interface(const char *name);
+SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit);
+
/*!
\brief Retrieve the dialplan interface by it's registered name
\param name the name of the dialplan
static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *session, switch_codec_t *codec)
{
const char *iananame = "L16";
- int rate = 8000;
- int interval = 20;
+ uint32_t rate = 8000;
+ uint32_t interval = 20;
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_channel_t *channel = switch_core_session_get_channel(session);
const switch_codec_implementation_t *read_impl;
iananame = codec->implementation->iananame;
rate = codec->implementation->samples_per_second;
interval = codec->implementation->microseconds_per_packet / 1000;
+ } else {
+ const char *var;
+
+ if ((var = switch_channel_get_variable(channel, "loopback_initial_codec"))) {
+ char *dup = switch_core_session_strdup(session, var);
+ uint32_t bit;
+ iananame = switch_parse_codec_buf(dup, &interval, &rate, &bit);
+ }
+
}
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
}
-char *parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit)
+SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit)
{
char *cur, *next = NULL, *name, *p;
uint32_t interval = 0, rate = 0, bit = 0;
switch_copy_string(buf, prefs[x], sizeof(buf));
- name = parse_codec_buf(buf, &interval, &rate, &bit);
+ name = switch_parse_codec_buf(buf, &interval, &rate, &bit);
for(j = 0; j < x; j++) {
char *jname;
}
switch_copy_string(jbuf, prefs[j], sizeof(jbuf));
- jname = parse_codec_buf(jbuf, &jinterval, &jrate, &jbit);
+ jname = switch_parse_codec_buf(jbuf, &jinterval, &jrate, &jbit);
if (jinterval == 0) {
jinterval = switch_default_ptime(jname, 0);