@@ -1216,24 +1216,28 @@ static switch_status_t setup_ringback(originate_global_t *oglobals, originate_st
12161216 }
12171217
12181218 if (!ringback -> asis ) {
1219+ switch_codec_implementation_t peer_read_impl = { 0 };
1220+
12191221 if (switch_test_flag (read_codec , SWITCH_CODEC_FLAG_PASSTHROUGH )) {
12201222 switch_log_printf (SWITCH_CHANNEL_CHANNEL_LOG (caller_channel ), SWITCH_LOG_WARNING , "%s Ringback not supported in passthrough codec mode.\n" ,
12211223 switch_channel_get_name (caller_channel ));
12221224 switch_goto_status (SWITCH_STATUS_GENERR , end );
12231225 }
12241226
1227+ switch_core_session_get_read_impl (originate_status [0 ].peer_session , & peer_read_impl );
1228+
12251229 if (switch_core_codec_init (write_codec ,
12261230 "L16" ,
12271231 NULL ,
1228- read_codec -> implementation -> actual_samples_per_second ,
1229- read_codec -> implementation -> microseconds_per_packet / 1000 ,
1232+ peer_read_impl . actual_samples_per_second ,
1233+ peer_read_impl . microseconds_per_packet / 1000 ,
12301234 1 , SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE , NULL ,
12311235 switch_core_session_get_pool (oglobals -> session )) == SWITCH_STATUS_SUCCESS ) {
12321236
12331237
12341238 switch_log_printf (SWITCH_CHANNEL_SESSION_LOG (oglobals -> session ), SWITCH_LOG_DEBUG ,
12351239 "Raw Codec Activation Success L16@%uhz 1 channel %dms\n" ,
1236- read_codec -> implementation -> actual_samples_per_second , read_codec -> implementation -> microseconds_per_packet / 1000 );
1240+ peer_read_impl . actual_samples_per_second , peer_read_impl . microseconds_per_packet / 1000 );
12371241 write_frame -> codec = write_codec ;
12381242 write_frame -> datalen = read_codec -> implementation -> decoded_bytes_per_packet ;
12391243 write_frame -> samples = write_frame -> datalen / 2 ;
0 commit comments