[asterisk-commits] irroot: branch irroot/distrotech-customers-1.8 r319063 - in /team/irroot/dist...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon May 16 03:46:14 CDT 2011
Author: irroot
Date: Mon May 16 03:46:10 2011
New Revision: 319063
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=319063
Log:
Restore original audio formats when the framehook is disabled.
Modified:
team/irroot/distrotech-customers-1.8/include/asterisk/res_fax.h
team/irroot/distrotech-customers-1.8/res/res_fax.c
Modified: team/irroot/distrotech-customers-1.8/include/asterisk/res_fax.h
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/include/asterisk/res_fax.h?view=diff&rev=319063&r1=319062&r2=319063
==============================================================================
--- team/irroot/distrotech-customers-1.8/include/asterisk/res_fax.h (original)
+++ team/irroot/distrotech-customers-1.8/include/asterisk/res_fax.h Mon May 16 03:46:10 2011
@@ -221,6 +221,11 @@
int framehook;
/*! bridged*/
int bridged;
+ /*Original audio formats*/
+ unsigned int chan_read_format;
+ unsigned int chan_write_format;
+ unsigned int peer_read_format;
+ unsigned int peer_write_format;
};
/*! \brief used to register a FAX technology module with res_fax */
Modified: team/irroot/distrotech-customers-1.8/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/res/res_fax.c?view=diff&rev=319063&r1=319062&r2=319063
==============================================================================
--- team/irroot/distrotech-customers-1.8/res/res_fax.c (original)
+++ team/irroot/distrotech-customers-1.8/res/res_fax.c Mon May 16 03:46:10 2011
@@ -2579,6 +2579,10 @@
}
/* when we become active change the formats to SLIN for CED detect and T.30*/
if (peer && !gateway->bridged) {
+ gateway->chan_read_format = chan->readformat;
+ gateway->chan_write_format = chan->writeformat;
+ gateway->peer_read_format = peer->readformat;
+ gateway->peer_write_format = peer->writeformat;
ast_set_read_format(chan, AST_FORMAT_SLINEAR);
ast_set_write_format(chan, AST_FORMAT_SLINEAR);
ast_set_read_format(peer, AST_FORMAT_SLINEAR);
@@ -2762,6 +2766,7 @@
{
struct ast_fax_session_gateway *gateway;
struct ast_datastore *datastore;
+ struct ast_channel *peer;
ast_channel_lock(chan);
datastore = ast_channel_datastore_find(chan, &fax_datastore_gateway, NULL);
@@ -2770,6 +2775,17 @@
if (datastore->data) {
gateway = datastore->data;
ast_datastore_free(datastore);
+ /* restore audio formats*/
+ if (gateway->bridged) {
+ ast_set_read_format(chan, gateway->chan_read_format);
+ ast_set_read_format(chan, gateway->chan_write_format);
+ peer = ast_bridged_channel(chan);
+ if (peer) {
+ ast_set_read_format(peer, gateway->peer_read_format);
+ ast_set_read_format(peer, gateway->peer_write_format);
+ ast_channel_make_compatible(chan, peer);
+ }
+ }
ast_framehook_detach(chan, gateway->framehook);
}
ast_channel_unlock(chan);
More information about the asterisk-commits
mailing list