--- /dev/null
+<configuration name="amrwb.conf">
+ <settings>
+ <!-- AMRWB modes (supported bitrates):
+ mode 8 AMR-WB_23.85 23.85 Kbit/s
+ mode 7 AMR-WB_23.05 23.05 Kbit/s
+ mode 7 AMR-WB_19.85 19.85 Kbit/s
+ mode 6 AMR-WB_18.25 18.25 Kbit/s
+ mode 5 AMR-WB_15.85 15.85 Kbit/s
+ mode 4 AMR-WB_14.25 14.25 Kbit/s
+ mode 3 AMR-WB_12.65 12.65 Kbit/s
+ mode 2 AMR-WB_8.85 8.85 Kbit/s
+ mode 1 AMR-WB_6.60 6.60 Kbit/s
+ -->
+ <param name="default-bitrate" value="8"/>
+ <!-- Enable VoLTE specific FMTP -->
+ <param name="volte" value="1"/>
+ <!-- Enable automatic bitrate variation during the call based on RTCP feedback -->
+ <param name="adjust-bitrate" value="0"/>
+ <!-- force OA when originating -->
+ <param name="force-oa" value="0"/>
+ </settings>
+</configuration>
<configuration name="amrwb.conf">
- <settings>
- <param name="default-bitrate" value="8"/>
- <param name="volte" value="1"/>
- <param name="adjust-bitrate" value="0"/>
+ <settings>
+ <!-- AMRWB modes (supported bitrates):
+ mode 8 AMR-WB_23.85 23.85 Kbit/s
+ mode 7 AMR-WB_23.05 23.05 Kbit/s
+ mode 7 AMR-WB_19.85 19.85 Kbit/s
+ mode 6 AMR-WB_18.25 18.25 Kbit/s
+ mode 5 AMR-WB_15.85 15.85 Kbit/s
+ mode 4 AMR-WB_14.25 14.25 Kbit/s
+ mode 3 AMR-WB_12.65 12.65 Kbit/s
+ mode 2 AMR-WB_8.85 8.85 Kbit/s
+ mode 1 AMR-WB_6.60 6.60 Kbit/s
+ -->
+ <param name="default-bitrate" value="8"/>
+ <!-- Enable VoLTE specific FMTP -->
+ <param name="volte" value="1"/>
+ <!-- Enable automatic bitrate variation during the call based on RTCP feedback -->
+ <param name="adjust-bitrate" value="0"/>
+ <!-- force OA when originating -->
+ <param name="force-oa" value="0"/>
</settings>
</configuration>
switch_byte_t volte; /* enable special fmtp for VoLTE compliance */
switch_byte_t adjust_bitrate;
int debug;
+ switch_byte_t force_oa; /*force OA when originating*/
} globals;
const int switch_amr_frame_sizes[] = {12,13,15,17,19,20,26,31,5,0,0,0,0,0,0,1};
return SWITCH_TRUE;
}
-static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text)
+static switch_bool_t switch_amr_info(switch_codec_t *codec, unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text)
{
uint8_t *tocs;
int framesz, index, not_last_frame, q, ft;
tocs = encoded_buf;
index = (tocs[0] >> 3) & 0x0f;
if (index > SWITCH_AMR_MODES && index != 0xf) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMR decoder (OA): Invalid Table Of Contents (TOC): 0x%x\n", index);
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_ERROR, "AMR decoder (OA): Invalid Table Of Contents (TOC): 0x%x\n", index);
return SWITCH_FALSE;
}
framesz = switch_amr_frame_sizes[index];
ft &= ~(1 << 5); /* Frame Type */
index = (shift_tocs[0] >> 3) & 0x0f;
if (index > SWITCH_AMR_MODES && index != 0xf) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMR decoder (BE): Invalid Table Of Contents (TOC): 0x%x\n", index);
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_ERROR, "AMR decoder (BE): Invalid Table Of Contents (TOC): 0x%x\n", index);
return SWITCH_FALSE;
}
framesz = switch_amr_frame_sizes[index];
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n",
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_DEBUG, "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n",
print_text, payload_format ? "OA":"BE", ft, q, not_last_frame);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): AMR encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n",
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_DEBUG, "%s (%s): AMR encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n",
print_text, payload_format ? "OA":"BE", framesz, encoded_data_len);
return SWITCH_TRUE;
* bandwidth-efficient operation is employed."
*
*/
- switch_clear_flag(context, AMR_OPT_OCTET_ALIGN);
-
+ if (!globals.force_oa) {
+ switch_clear_flag(context, AMR_OPT_OCTET_ALIGN);
+ } else {
+ switch_set_flag(context, AMR_OPT_OCTET_ALIGN);
+ }
if (codec->fmtp_in) {
argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0])));
for (x = 0; x < argc; x++) {
}
if (globals.debug) {
- switch_amr_info(shift_buf, *encoded_data_len, switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, "AMR encoder");
+ switch_amr_info(codec, shift_buf, *encoded_data_len, switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, "AMR encoder");
}
return SWITCH_STATUS_SUCCESS;
}
if (globals.debug) {
- switch_amr_info(buf, encoded_data_len, switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, "AMR decoder");
+ switch_amr_info(codec, buf, encoded_data_len, switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, "AMR decoder");
}
if (switch_test_flag(context, AMR_OPT_OCTET_ALIGN)) {
if (!strcasecmp(var, "adjust-bitrate")) {
globals.adjust_bitrate = (switch_byte_t) atoi(val);
}
+ if (!strcasecmp(var, "force-oa")) {
+ globals.force_oa = (switch_byte_t) atoi(val);
+ }
}
}
}