static char *ast2str(int ast)
{
int x;
- for (x = 0; x < 32; x++) {
+ for (x = 0; x < 19; x++) {
if ((1 << x) == ast) {
return AST_IANA[x].name;
}
unsigned int *format, unsigned int *cababilities, unsigned short *samprate, iax_io_t io)
{
char *dname = NULL;
- //int rate = 8000;
- //int codec_ms = 20;
switch_channel_t *channel;
const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
int num_codecs = 0;
uint32_t interval = 0;
if (globals.codec_string) {
- if ((num_codecs = switch_loadable_module_get_codecs_sorted(codecs, SWITCH_MAX_CODECS, globals.codec_order, globals.codec_order_last)) <= 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
- return SWITCH_STATUS_GENERR;
- }
- } else if (((num_codecs = switch_loadable_module_get_codecs(codecs, SWITCH_MAX_CODECS))) <= 0) {
+ num_codecs = switch_loadable_module_get_codecs_sorted(codecs, SWITCH_MAX_CODECS, globals.codec_order, globals.codec_order_last);
+ } else {
+ num_codecs = switch_loadable_module_get_codecs(codecs, SWITCH_MAX_CODECS);
+ }
+
+ if (num_codecs <= 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
return SWITCH_STATUS_GENERR;
}
}
}
+ switch_assert(codecs[0]);
+
if (io == IAX_SET) {
mixed_cap = (local_cap & *cababilities);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New Inbound Channel %s!\n", iaxevent->ies.calling_name);
if ((session = switch_core_session_request(iax_endpoint_interface, NULL)) != 0) {
- private_t *tech_pvt;
- switch_channel_t *channel;
-
switch_core_session_add_stream(session, NULL);
if ((tech_pvt = (private_t *) switch_core_session_alloc(session, sizeof(private_t))) != 0) {
channel = switch_core_session_get_channel(session);