From: Anthony Minessale Date: Fri, 3 Oct 2008 18:15:04 +0000 (+0000) Subject: write cng frames during sleep X-Git-Tag: v1.0.6~38^2~297 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d8f1d05b4790d5fb9565b4e8cf3d05a3a03c94b;p=thirdparty%2Ffreeswitch.git write cng frames during sleep git-svn-id: http://svn.openzap.org/svn/openzap/trunk@576 a93c3328-9c30-0410-af19-c9cd2b2d52af --- diff --git a/libs/openzap/mod_openzap/mod_openzap.c b/libs/openzap/mod_openzap/mod_openzap.c index 18064e6486..94c2ac7834 100644 --- a/libs/openzap/mod_openzap/mod_openzap.c +++ b/libs/openzap/mod_openzap/mod_openzap.c @@ -364,6 +364,8 @@ static switch_status_t channel_on_init(switch_core_session_t *session) zap_channel_init(tech_pvt->zchan); + switch_channel_set_flag(channel, CF_ACCEPT_CNG); + return SWITCH_STATUS_SUCCESS; } @@ -636,7 +638,8 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; zap_size_t len; - + unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0}; + channel = switch_core_session_get_channel(session); assert(channel != NULL); @@ -653,6 +656,16 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc goto fail; } + if (switch_test_flag(frame, SFF_CNG)) { + frame->data = data; + frame->buflen = sizeof(data); + if ((frame->datalen = tech_pvt->write_codec.implementation->encoded_bytes_per_frame) > frame->buflen) { + goto fail; + } + memset(data, 255, frame->datalen); + } + + len = frame->datalen; if (zap_channel_write(tech_pvt->zchan, frame->data, frame->buflen, &len) != ZAP_SUCCESS) { if (++tech_pvt->wr_error > 10) {