" +
"
Kick " +
"
Mute " +
+ (confMan.params.hasVid ? "
VMute " : "") +
+ (confMan.params.hasVid ? "
Presenter " : "") +
+ (confMan.params.hasVid ? "
Vid Floor " : "") +
+ (confMan.params.hasVid ? "
Banner " : "") +
"
Vol - " +
"
Vol + " +
"
Transfer " +
@@ -1240,7 +1288,9 @@
$("#" + transfer_id).click(function() {
var xten = prompt("Enter Extension");
- confMan.modCommand("transfer", x, xten);
+ if (xten) {
+ confMan.modCommand("transfer", x, xten);
+ }
});
$("#" + kick_id).click(function() {
@@ -1251,6 +1301,24 @@
confMan.modCommand("tmute", x);
});
+ if (confMan.params.hasVid) {
+ $("#" + tvmute_id).click(function() {
+ confMan.modCommand("tvmute", x);
+ });
+ $("#" + tvpresenter_id).click(function() {
+ confMan.modCommand("vid-res-id", x, "presenter");
+ });
+ $("#" + tvfloor_id).click(function() {
+ confMan.modCommand("vid-floor", x, "force");
+ });
+ $("#" + vbanner_id).click(function() {
+ var text = prompt("Please enter text", "");
+ if (text) {
+ confMan.modCommand("vid-banner", x, escape(text));
+ }
+ });
+ }
+
$("#" + volup_id).click(function() {
confMan.modCommand("volume_in", x, "up");
});
@@ -1269,7 +1337,7 @@
if (confMan.params.laData.role === "moderator") {
atitle = "Action";
- awidth = 200;
+ awidth = 300;
if (confMan.params.mainModID) {
genMainMod($(confMan.params.mainModID));
@@ -1284,16 +1352,47 @@
if (confMan.params.onBroadcast) {
confMan.params.onBroadcast(verto, confMan, e.data);
}
- if (!confMan.destroyed && confMan.params.displayID) {
- $(confMan.params.displayID).html(e.data.response + "
");
- if (confMan.lastTimeout) {
- clearTimeout(confMan.lastTimeout);
- confMan.lastTimeout = 0;
- }
- confMan.lastTimeout = setTimeout(function() { $(confMan.params.displayID).html(confMan.destroyed ? "" : "Moderator Controls Ready
");}, 4000);
- }
+
+ if (e.data["conf-command"] === "list-videoLayouts") {
+ var vlselect_id = "#confman_vl_select_" + confMan.serno;
+ var vlayout_id = "#confman_vid_layout_" + confMan.serno;
+ var x = 0;
+ var options;
+
+ $(vlselect_id).append(new Option("Choose a Layout", "none"));
+
+ if (e.data.responseData) {
+ options = e.data.responseData.sort();
+
+ for (var i in options) {
+ $(vlselect_id).append(new Option(options[i], options[i]));
+ x++;
+ }
+ }
+
+ if (x) {
+ $(vlselect_id).selectmenu('refresh', true);
+ } else {
+ $(vlayout_id).hide();
+ }
+ } else {
+
+ if (!confMan.destroyed && confMan.params.displayID) {
+ $(confMan.params.displayID).html(e.data.response + "
");
+ if (confMan.lastTimeout) {
+ clearTimeout(confMan.lastTimeout);
+ confMan.lastTimeout = 0;
+ }
+ confMan.lastTimeout = setTimeout(function() { $(confMan.params.displayID).html(confMan.destroyed ? "" : "Moderator Controls Ready
");}, 4000);
+ }
+ }
}
});
+
+
+ if (confMan.params.hasVid) {
+ confMan.modCommand("list-videoLayouts", null, null);
+ }
}
var row_callback = null;
@@ -1339,7 +1438,7 @@
},
{
"sTitle": "Status",
- "sWidth": confMan.params.hasVid ? "300px" : "150px"
+ "sWidth": confMan.params.hasVid ? "200px" : "150px"
},
{
"sTitle": atitle,
@@ -1367,16 +1466,18 @@
$.verto.confMan.prototype.modCommand = function(cmd, id, value) {
var confMan = this;
- confMan.verto.sendMethod("verto.broadcast", {
+ confMan.verto.rpcClient.call("verto.broadcast", {
"eventChannel": confMan.params.laData.modChannel,
"data": {
- "application": "conf-control",
- "command": cmd,
- "id": id,
- "value": value
+ "application": "conf-control",
+ "command": cmd,
+ "id": id,
+ "value": value
}
- });
+ });
};
+
+
$.verto.confMan.prototype.destroy = function() {
var confMan = this;
@@ -1402,10 +1503,15 @@
dialog.params = $.extend({
useVideo: verto.options.useVideo,
useStereo: verto.options.useStereo,
+ screenShare: false,
+ useCamera: "any",
+ useMic: "any",
tag: verto.options.tag,
- login: verto.options.login
+ localTag: verto.options.localTag,
+ login: verto.options.login,
+ videoParams: verto.options.videoParams
}, params);
-
+
dialog.verto = verto;
dialog.direction = direction;
dialog.lastState = null;
@@ -1413,13 +1519,16 @@
dialog.callbacks = verto.callbacks;
dialog.answered = false;
dialog.attach = params.attach || false;
+ dialog.screenShare = params.screenShare || false;
+ dialog.useCamera = params.useCamera;
+ dialog.useMic = params.useMic;
if (dialog.params.callID) {
dialog.callID = dialog.params.callID;
} else {
dialog.callID = dialog.params.callID = generateGUID();
}
-
+
if (dialog.params.tag) {
dialog.audioStream = document.getElementById(dialog.params.tag);
@@ -1428,6 +1537,10 @@
}
} //else conjure one TBD
+ if (dialog.params.localTag) {
+ dialog.localVideo = document.getElementById(dialog.params.localTag);
+ }
+
dialog.verto.dialogs[dialog.callID] = dialog;
var RTCcallbacks = {};
@@ -1488,19 +1601,27 @@
}
};
+ RTCcallbacks.onStream = function(rtc, stream) {
+ console.log("stream started");
+ };
+
RTCcallbacks.onError = function(e) {
console.error("ERROR:", e);
- dialog.hangup();
+ dialog.hangup({cause: "Device or Permission Error"});
};
dialog.rtc = new $.FSRTC({
callbacks: RTCcallbacks,
+ localVideo: dialog.localVideo,
useVideo: dialog.videoStream,
useAudio: dialog.audioStream,
useStereo: dialog.params.useStereo,
- videoParams: verto.options.videoParams,
+ videoParams: dialog.params.videoParams,
audioParams: verto.options.audioParams,
- iceServers: verto.options.iceServers
+ iceServers: verto.options.iceServers,
+ screenShare: dialog.screenShare,
+ useCamera: dialog.useCamera,
+ useMic: dialog.useMic
});
dialog.rtc.verto = dialog.verto;
@@ -1604,7 +1725,9 @@
break;
case $.verto.enum.state.destroy:
delete dialog.verto.dialogs[dialog.callID];
- dialog.rtc.stop();
+ if (!dialog.params.screenShare) {
+ dialog.rtc.stop();
+ }
break;
}
@@ -1666,15 +1789,15 @@
if (params) {
if (params.causeCode) {
- dialog.causeCode = params.causeCode;
+ dialog.causeCode = params.causeCode;
}
if (params.cause) {
- dialog.cause = params.cause;
+ dialog.cause = params.cause;
}
}
- if (dialog.state.val > $.verto.enum.state.new.val && dialog.state.val < $.verto.enum.state.hangup.val) {
+ if (dialog.state.val >= $.verto.enum.state.new.val && dialog.state.val < $.verto.enum.state.hangup.val) {
dialog.setState($.verto.enum.state.hangup);
} else if (dialog.state.val < $.verto.enum.state.destroy) {
dialog.setState($.verto.enum.state.destroy);
@@ -1722,10 +1845,20 @@
dialog.videoStream = null;
}
- dialog.rtc.useVideo(dialog.videoStream);
+ dialog.rtc.useVideo(dialog.videoStream, dialog.localVideo);
};
+ $.verto.dialog.prototype.setMute = function(what) {
+ var dialog = this;
+ return dialog.rtc.setMute(what);
+ };
+
+ $.verto.dialog.prototype.getMute = function(what) {
+ var dialog = this;
+ return dialog.rtc.getMute(what);
+ };
+
$.verto.dialog.prototype.useStereo = function(on) {
var dialog = this;
@@ -1809,16 +1942,23 @@
$.verto.dialog.prototype.answer = function(params) {
var dialog = this;
-
+
if (!dialog.answered) {
+ if (!params) {
+ params = {};
+ }
+
+ params.sdp = dialog.params.sdp;
+
if (params) {
if (params.useVideo) {
dialog.useVideo(true);
}
- dialog.params.callee_id_name = params.callee_id_name;
- dialog.params.callee_id_number = params.callee_id_number;
+ dialog.params.callee_id_name = params.callee_id_name;
+ dialog.params.callee_id_number = params.callee_id_number;
}
- dialog.rtc.createAnswer(dialog.params.sdp);
+
+ dialog.rtc.createAnswer(params);
dialog.answered = true;
}
};
@@ -1836,9 +1976,9 @@
dialog.setState($.verto.enum.state.active);
} else {
if (dialog.gotEarly) {
- console.log("Dialog " + dialog.callID + "Got answer while still establishing early media, delaying...");
+ console.log("Dialog " + dialog.callID + " Got answer while still establishing early media, delaying...");
} else {
- console.log("Dialog " + dialog.callID + "Answering Channel");
+ console.log("Dialog " + dialog.callID + " Answering Channel");
dialog.rtc.answer(params.sdp, function() {
dialog.setState($.verto.enum.state.active);
}, function(e) {
@@ -1848,6 +1988,8 @@
console.log("Dialog " + dialog.callID + "ANSWER SDP", params.sdp);
}
}
+
+
};
$.verto.dialog.prototype.cidString = function(enc) {
@@ -1927,7 +2069,8 @@
recovering: 1,
ringing: 1,
destroy: 1,
- answering: 1
+ answering: 1,
+ hangup: 1
},
requesting: {
trying: 1,
@@ -1985,11 +2128,39 @@
for (var i in $.verto.saved) {
var verto = $.verto.saved[i];
if (verto) {
- verto.logout();
verto.purge();
+ verto.logout();
}
}
return $.verto.warnOnUnload;
});
+ $.verto.videoDevices = [];
+ $.verto.audioDevices = [];
+
+ $.verto.findDevices = function(runtime) {
+ var aud = [], vid = [];
+
+ MediaStreamTrack.getSources(function (media_sources) {
+ for (var i = 0; i < media_sources.length; i++) {
+
+ if (media_sources[i].kind == 'video') {
+ vid.push(media_sources[i]);
+ } else {
+ aud.push(media_sources[i]);
+ }
+ }
+
+ $.verto.videoDevices = vid;
+ $.verto.audioDevices = aud;
+
+ console.info("Audio Devices", $.verto.audioDevices);
+ console.info("Video Devices", $.verto.videoDevices);
+ runtime();
+ });
+ }
+
+
+
+
})(jQuery);
diff --git a/libs/spandsp/configure.ac b/libs/spandsp/configure.ac
index 305c75a533..43265fb2a2 100644
--- a/libs/spandsp/configure.ac
+++ b/libs/spandsp/configure.ac
@@ -37,6 +37,27 @@ m4_include(m4/ax_c99_features.m4)
m4_include(m4/ax_check_export_capability.m4)
m4_include(m4/ax_check_arm_neon.m4)
+AC_DEFUN([AC_FUNC_ALIGNED_ALLOC],[
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror"
+ AC_CACHE_CHECK([checking for aligned_alloc],
+ [ac_cv_func_aligned_alloc],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([
+ #define _ISOC11_SOURCE
+ #include
+ ],
+ [
+ aligned_alloc(0,0);
+ ])],
+ [ac_cv_func_aligned_alloc=yes],
+ [ac_cv_func_aligned_alloc=no])])
+
+ if test "x${ac_cv_func_aligned_alloc}" = "xyes" ; then
+ AC_DEFINE([HAVE_ALIGNED_ALLOC], [1], [Define to 1 if you have the aligned_alloc() function.])
+ fi
+CFLAGS="$saved_CFLAGS"
+])
+
AC_CONFIG_SRCDIR([src/tone_generate.c])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
@@ -174,7 +195,7 @@ fi
AX_C99_FLEXIBLE_ARRAY
-AC_CHECK_FUNCS([aligned_alloc])
+AC_FUNC_ALIGNED_ALLOC
AC_CHECK_FUNCS([memalign])
AC_CHECK_FUNCS([posix_memalign])
AC_CHECK_FUNCS([memmove])
@@ -464,6 +485,13 @@ intel)
fi
COMP_VENDOR_LDFLAGS=
;;
+clang*)
+ COMP_VENDOR_CFLAGS="-D_XOPEN_SOURCE=700 -std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
+ if test x"$ac_cv_gcc_unused_but_set_variable" = xyes ; then
+ COMP_VENDOR_CFLAGS="-Wunused-but-set-variable $COMP_VENDOR_CFLAGS"
+ fi
+ COMP_VENDOR_LDFLAGS=
+ ;;
*)
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
if test x"$ac_cv_gcc_unused_but_set_variable" = xyes ; then
diff --git a/libs/spandsp/spandsp/fax-tests.dtd b/libs/spandsp/spandsp/fax-tests.dtd
index 39f97febaa..8299ecbb34 100644
--- a/libs/spandsp/spandsp/fax-tests.dtd
+++ b/libs/spandsp/spandsp/fax-tests.dtd
@@ -19,12 +19,16 @@
name CDATA #IMPLIED
>
-
+
-
+
+
diff --git a/libs/spandsp/spandsp/fax-tests.xml b/libs/spandsp/spandsp/fax-tests.xml
index fcb3b6be5f..2f52468721 100644
--- a/libs/spandsp/spandsp/fax-tests.xml
+++ b/libs/spandsp/spandsp/fax-tests.xml
@@ -147,7 +147,7 @@
-
+
@@ -155,7 +155,7 @@
-
+
@@ -169,7 +169,7 @@
-
+
@@ -177,7 +177,7 @@
-
+
@@ -200,6 +200,7 @@
+
@@ -261,7 +262,7 @@
-
+
@@ -269,7 +270,7 @@
-
+
@@ -283,7 +284,7 @@
-
+
@@ -291,7 +292,7 @@
-
+
@@ -305,7 +306,7 @@
-
+
@@ -313,7 +314,7 @@
-
+
@@ -327,7 +328,7 @@
-
+
@@ -335,7 +336,7 @@
-
+
@@ -357,7 +358,7 @@
-
+
@@ -365,7 +366,7 @@
-
+
@@ -379,5 +380,214 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libs/spandsp/spandsp/tsb85.xml b/libs/spandsp/spandsp/tsb85.xml
index a711100916..c72a863151 100644
--- a/libs/spandsp/spandsp/tsb85.xml
+++ b/libs/spandsp/spandsp/tsb85.xml
@@ -26,7 +26,7 @@
-
+
@@ -171,7 +171,7 @@
-
+
@@ -183,7 +183,7 @@
-
+
@@ -239,7 +239,7 @@
-
+
@@ -255,7 +255,7 @@
-
+
@@ -493,9 +493,9 @@
-
-
-
+
+
+
@@ -507,7 +507,7 @@
-
+
@@ -1356,7 +1356,7 @@
-
+
@@ -1364,7 +1364,7 @@
-
+
@@ -1378,7 +1378,7 @@
-
+
@@ -1386,7 +1386,7 @@
-
+
@@ -1491,7 +1491,7 @@
-
+
@@ -1499,7 +1499,7 @@
-
+
@@ -1539,7 +1539,7 @@
-
+
@@ -1547,7 +1547,7 @@
-
+
@@ -1561,7 +1561,7 @@
-
+
@@ -1569,7 +1569,7 @@
-
+
@@ -1583,7 +1583,7 @@
-
+
@@ -1591,7 +1591,7 @@
-
+
@@ -1605,7 +1605,7 @@
-
+
@@ -1613,7 +1613,7 @@
-
+
@@ -1635,7 +1635,7 @@
-
+
@@ -1643,7 +1643,7 @@
-
+
@@ -1686,7 +1686,7 @@
-
+
@@ -1694,7 +1694,7 @@
-
+
@@ -1708,7 +1708,7 @@
-
+
@@ -1716,7 +1716,7 @@
-
+
@@ -1730,7 +1730,7 @@
-
+
@@ -1738,7 +1738,7 @@
-
+
@@ -1752,7 +1752,7 @@
-
+
@@ -1760,7 +1760,7 @@
-
+
@@ -1782,7 +1782,7 @@
-
+
@@ -1790,7 +1790,7 @@
-
+
@@ -1833,7 +1833,7 @@
-
+
@@ -1841,7 +1841,7 @@
-
+
@@ -1855,7 +1855,7 @@
-
+
@@ -1863,7 +1863,7 @@
-
+
@@ -1877,7 +1877,7 @@
-
+
@@ -1885,7 +1885,7 @@
-
+
@@ -1899,7 +1899,7 @@
-
+
@@ -1907,7 +1907,7 @@
-
+
@@ -1921,7 +1921,7 @@
-
+
@@ -1929,7 +1929,7 @@
-
+
@@ -1980,7 +1980,7 @@
-
+
@@ -1988,7 +1988,7 @@
-
+
@@ -2002,7 +2002,7 @@
-
+
@@ -2010,7 +2010,7 @@
-
+
@@ -2024,7 +2024,7 @@
-
+
@@ -2032,7 +2032,7 @@
-
+
@@ -2046,7 +2046,7 @@
-
+
@@ -2054,7 +2054,7 @@
-
+
@@ -2076,7 +2076,7 @@
-
+
@@ -2084,7 +2084,7 @@
-
+
@@ -2126,7 +2126,7 @@
-
+
@@ -2134,7 +2134,7 @@
-
+
@@ -2148,7 +2148,7 @@
-
+
@@ -2156,7 +2156,7 @@
-
+
@@ -2170,7 +2170,7 @@
-
+
@@ -2178,7 +2178,7 @@
-
+
@@ -2192,7 +2192,7 @@
-
+
@@ -2200,7 +2200,7 @@
-
+
@@ -2251,7 +2251,7 @@
-
+
@@ -2259,7 +2259,7 @@
-
+
@@ -2273,7 +2273,7 @@
-
+
@@ -2281,7 +2281,7 @@
-
+
@@ -5456,166 +5456,14 @@
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -6755,12 +6603,12 @@
-
+
-
-
-
+
+
+
@@ -6770,12 +6618,12 @@
-
+
-
-
-
+
+
+
@@ -6785,10 +6633,10 @@
-
-
-
-
+
+
+
+
@@ -6805,7 +6653,7 @@
-
+
@@ -6817,7 +6665,7 @@
-
+
@@ -6870,7 +6718,7 @@
-
+
@@ -6894,7 +6742,7 @@
-
+
@@ -6909,7 +6757,7 @@
-
+
@@ -6919,7 +6767,7 @@
-
+
@@ -6942,7 +6790,7 @@
-
+
@@ -6993,7 +6841,7 @@
-
+
@@ -7016,7 +6864,7 @@
-
+
@@ -7061,7 +6909,7 @@
-
+
@@ -7123,7 +6971,7 @@
-
+
diff --git a/libs/spandsp/src/ademco_contactid.c b/libs/spandsp/src/ademco_contactid.c
index 975525adb8..d26fab4a2c 100644
--- a/libs/spandsp/src/ademco_contactid.c
+++ b/libs/spandsp/src/ademco_contactid.c
@@ -755,7 +755,7 @@ SPAN_DECLARE(ademco_contactid_receiver_state_t *) ademco_contactid_receiver_init
{
if (s == NULL)
{
- if ((s = (ademco_contactid_receiver_state_t *) span_alloc(sizeof (*s))) == NULL)
+ if ((s = (ademco_contactid_receiver_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -1090,7 +1090,7 @@ SPAN_DECLARE(ademco_contactid_sender_state_t *) ademco_contactid_sender_init(ade
{
if (s == NULL)
{
- if ((s = (ademco_contactid_sender_state_t *) span_alloc(sizeof (*s))) == NULL)
+ if ((s = (ademco_contactid_sender_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
diff --git a/libs/spandsp/src/dtmf.c b/libs/spandsp/src/dtmf.c
index 48a8836337..1ff725ff22 100644
--- a/libs/spandsp/src/dtmf.c
+++ b/libs/spandsp/src/dtmf.c
@@ -417,7 +417,7 @@ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s,
if (s == NULL)
{
- if ((s = (dtmf_rx_state_t *) span_alloc(sizeof (*s))) == NULL)
+ if ((s = (dtmf_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -578,7 +578,7 @@ SPAN_DECLARE(dtmf_tx_state_t *) dtmf_tx_init(dtmf_tx_state_t *s,
{
if (s == NULL)
{
- if ((s = (dtmf_tx_state_t *) span_alloc(sizeof (*s))) == NULL)
+ if ((s = (dtmf_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
diff --git a/libs/spandsp/src/gsm0610_encode.c b/libs/spandsp/src/gsm0610_encode.c
index c810fa2c69..7621f22adc 100644
--- a/libs/spandsp/src/gsm0610_encode.c
+++ b/libs/spandsp/src/gsm0610_encode.c
@@ -116,12 +116,12 @@ SPAN_DECLARE(gsm0610_state_t *) gsm0610_init(gsm0610_state_t *s, int packing)
{
if (s == NULL)
{
- if ((s = (gsm0610_state_t *) span_alloc(sizeof (*s))) == NULL)
+ if ((s = (gsm0610_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
/*endif*/
}
/*endif*/
- memset((char *) s, '\0', sizeof (gsm0610_state_t));
+ memset((char *) s, '\0', sizeof(gsm0610_state_t));
s->nrp = 40;
s->packing = packing;
return s;
diff --git a/libs/spandsp/src/make_at_dictionary.c b/libs/spandsp/src/make_at_dictionary.c
index 6259207368..a34dd6f3a3 100644
--- a/libs/spandsp/src/make_at_dictionary.c
+++ b/libs/spandsp/src/make_at_dictionary.c
@@ -605,6 +605,33 @@ static void dump_trie(void)
}
/*- End of function --------------------------------------------------------*/
+
+static void trie_recursive_free(trie_node_t *t)
+{
+ int i;
+ if (t)
+ {
+ if (t->first <= t->last)
+ {
+ for (i = t->first; i <= t->last; i++)
+ trie_recursive_free(t->child_list[i]);
+ }
+ free(t);
+ }
+}
+/*- End of function --------------------------------------------------------*/
+
+static void trie_free(trie_t *s)
+{
+ if(s)
+ {
+ if(s->root)
+ trie_recursive_free(s->root);
+ free(s);
+ }
+}
+/*- End of function --------------------------------------------------------*/
+
int main(int argc, char *argv[])
{
trie_t *s;
@@ -627,6 +654,8 @@ int main(int argc, char *argv[])
trie_recursive_build_packed_trie(s->root);
dump_trie();
+
+ trie_free(s);
return 0;
}
diff --git a/libs/spandsp/src/modem_connect_tones.c b/libs/spandsp/src/modem_connect_tones.c
index 9c030ad0ed..98262a1cad 100644
--- a/libs/spandsp/src/modem_connect_tones.c
+++ b/libs/spandsp/src/modem_connect_tones.c
@@ -526,7 +526,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
filtered = 0.001599787f*(v1 - s->z15hz_2);
s->z15hz_2 = s->z15hz_1;
s->z15hz_1 = v1;
- s->am_level += abs(lfastrintf(filtered)) - (s->am_level >> 8);
+ s->am_level += abs((int) lfastrintf(filtered)) - (s->am_level >> 8);
//printf("%9.1f %10.4f %9d %9d\n", famp, filtered, s->am_level, s->channel_level);
/* A Cauer notch at 2100Hz, spread just wide enough to meet our detection bandwidth
criteria. */
diff --git a/libs/spandsp/src/msvc/inttypes.h b/libs/spandsp/src/msvc/inttypes.h
index 032ec3c36c..8d680e27db 100644
--- a/libs/spandsp/src/msvc/inttypes.h
+++ b/libs/spandsp/src/msvc/inttypes.h
@@ -33,7 +33,7 @@ typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
-#if !defined(INFINITY)
+#if !defined(INFINITY) && _MSC_VER < 1800
#define INFINITY 0x7FFFFFFF
#endif
diff --git a/libs/spandsp/src/msvc/spandsp.h b/libs/spandsp/src/msvc/spandsp.h
index fb7b1431b1..25d19698de 100644
--- a/libs/spandsp/src/msvc/spandsp.h
+++ b/libs/spandsp/src/msvc/spandsp.h
@@ -53,6 +53,7 @@
#include
#endif
#include
+#include
#include
#include
#include
@@ -96,8 +97,6 @@
#include
#include
#include
-#include
-#include
#include
#include
#include
@@ -105,9 +104,14 @@
#include
#include
#include
+#if defined(SPANDSP_SUPPORT_V32BIS)
+#include
+#endif
#if defined(SPANDSP_SUPPORT_V34)
#include
#endif
+#include
+#include
#include
#include
#include
@@ -125,6 +129,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/libs/spandsp/src/spandsp/at_interpreter.h b/libs/spandsp/src/spandsp/at_interpreter.h
index 1b6e1f7771..67ca4c0b77 100644
--- a/libs/spandsp/src/spandsp/at_interpreter.h
+++ b/libs/spandsp/src/spandsp/at_interpreter.h
@@ -173,7 +173,6 @@ SPAN_DECLARE(void) at_set_class1_handler(at_state_t *s, at_class1_handler_t hand
\return A pointer to the logging context */
SPAN_DECLARE(logging_state_t *) at_get_logging_state(at_state_t *s);
-
SPAN_DECLARE(void) at_set_modem_control_handler(at_state_t *s,
at_modem_control_handler_t modem_control_handler,
void *modem_control_user_data);
diff --git a/libs/spandsp/src/spandsp/bit_operations.h b/libs/spandsp/src/spandsp/bit_operations.h
index c7f4093ab3..7b5b5aface 100644
--- a/libs/spandsp/src/spandsp/bit_operations.h
+++ b/libs/spandsp/src/spandsp/bit_operations.h
@@ -53,13 +53,13 @@ static __inline__ int top_bit(uint32_t bits)
: [res] "=&r" (res)
: [bits] "rm" (bits));
return res;
-#elif defined(__GNUC__x) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
+#elif defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
int res;
__asm__("clz %[res], %[bits]"
: [res] "=r" (res)
: [bits] "r" (bits));
- return res;
+ return 31 - res;
#elif defined(__ppc__) || defined(__powerpc__)
int res;
diff --git a/libs/spandsp/src/spandsp/fir.h b/libs/spandsp/src/spandsp/fir.h
index 554a36c372..85be5d2a6f 100644
--- a/libs/spandsp/src/spandsp/fir.h
+++ b/libs/spandsp/src/spandsp/fir.h
@@ -38,8 +38,6 @@
#include "mmx.h"
#endif
-#include "alloc.h"
-
/*!
16 bit integer FIR descriptor. This defines the working state for a single
instance of an FIR filter using 16 bit integer coefficients.
diff --git a/libs/spandsp/src/spandsp/plc.h b/libs/spandsp/src/spandsp/plc.h
index 6d5c301073..2c2f7ca3fa 100644
--- a/libs/spandsp/src/spandsp/plc.h
+++ b/libs/spandsp/src/spandsp/plc.h
@@ -111,7 +111,6 @@ That's it!
*/
typedef struct plc_state_s plc_state_t;
-
#if defined(__cplusplus)
extern "C"
{
diff --git a/libs/spandsp/src/spandsp/private/time_scale.h b/libs/spandsp/src/spandsp/private/time_scale.h
index 775046161d..1b55a00874 100644
--- a/libs/spandsp/src/spandsp/private/time_scale.h
+++ b/libs/spandsp/src/spandsp/private/time_scale.h
@@ -34,15 +34,27 @@
/*! Audio time scaling descriptor. */
struct time_scale_state_s
{
+ /*! \brief The sample rate of both the incoming and outgoing signal */
int sample_rate;
+ /*! \brief The minimum pitch we will search for, in samples per cycle */
int min_pitch;
+ /*! \brief The maximum pitch we will search for, in samples per cycle */
int max_pitch;
- int buf_len;
+ /*! \brief The playout speed, as the fraction output time/input time.
+ (i.e. >1.0 == slow down, 1.0 == no speed change, <1.0 == speed up) */
float playout_rate;
+ /*! \brief */
double rcomp;
+ /*! \brief The fractional sample adjustment, to allow for non-integer values of lcp. */
double rate_nudge;
- int fill;
+ /*! \brief */
int lcp;
+ /*! \brief The active length of buf at the current sample rate. */
+ int buf_len;
+ /*! \brief The number of samples in buf */
+ int fill;
+ /*! \brief Buffer for residual samples kept over from one call of time_scale() to
+ the next. */
int16_t buf[TIME_SCALE_BUF_LEN];
};
diff --git a/libs/spandsp/src/spandsp/t30_api.h b/libs/spandsp/src/spandsp/t30_api.h
index 90cefc4f58..e6b47fb877 100644
--- a/libs/spandsp/src/spandsp/t30_api.h
+++ b/libs/spandsp/src/spandsp/t30_api.h
@@ -28,11 +28,33 @@
#if !defined(_SPANDSP_T30_API_H_)
#define _SPANDSP_T30_API_H_
+enum
+{
+ T33_NONE = 0,
+ T33_SST = 1,
+ T33_EXT = 2
+};
+
#if defined(__cplusplus)
extern "C"
{
#endif
+/*! Get the specified field from a T.33 formatted string.
+ \brief Get the specified field from a T.33 formatted string.
+ \param field The extracted field.
+ \param t33 The T.33 formatted string.
+ \param field_no The field number to extract. The first field is 0.
+ \return The extracted field type. -1 indicates a over length or badly formatted field. */
+SPAN_DECLARE(int) t33_sub_address_extract_field(uint8_t field[21], const uint8_t t33[], int field_no);
+
+/*! Append the specified field to a T.33 formatted string.
+ \brief Append the specified field to a T.33 formatted string.
+ \param t33 The T.33 formatted string.
+ \param field The field to be adppended.
+ \param type The type of the field to be appended. */
+SPAN_DECLARE(void) t33_sub_address_add_field(uint8_t t33[], const uint8_t field[], int type);
+
/*! Set the transmitted NSF frame to be associated with a T.30 context.
\brief Set the transmitted NSF frame to be associated with a T.30 context.
\param s The T.30 context.
diff --git a/libs/spandsp/src/spandsp/time_scale.h b/libs/spandsp/src/spandsp/time_scale.h
index 666cca7a78..35e8e00fe7 100644
--- a/libs/spandsp/src/spandsp/time_scale.h
+++ b/libs/spandsp/src/spandsp/time_scale.h
@@ -62,25 +62,6 @@ extern "C"
{
#endif
-/*! Initialise a time scale context. This must be called before the first
- use of the context, to initialise its contents.
- \brief Initialise a time scale context.
- \param s The time scale context.
- \param sample_rate The sample rate of the signal.
- \param playout_rate The ratio between the output speed and the input speed.
- \return A pointer to the context, or NULL if there was a problem. */
-SPAN_DECLARE(time_scale_state_t *) time_scale_init(time_scale_state_t *s, int sample_rate, float playout_rate);
-
-/*! \brief Release a time scale context.
- \param s The time scale context.
- \return 0 for OK, else -1. */
-SPAN_DECLARE(int) time_scale_release(time_scale_state_t *s);
-
-/*! \brief Free a time scale context.
- \param s The time scale context.
- \return 0 for OK, else -1. */
-SPAN_DECLARE(int) time_scale_free(time_scale_state_t *s);
-
/*! Change the time scale rate.
\brief Change the time scale rate.
\param s The time scale context.
@@ -108,6 +89,27 @@ SPAN_DECLARE(int) time_scale_max_output_len(time_scale_state_t *s, int input_len
*/
SPAN_DECLARE(int) time_scale(time_scale_state_t *s, int16_t out[], int16_t in[], int len);
+SPAN_DECLARE(int) time_scale_flush(time_scale_state_t *s, int16_t out[]);
+
+/*! Initialise a time scale context. This must be called before the first
+ use of the context, to initialise its contents.
+ \brief Initialise a time scale context.
+ \param s The time scale context.
+ \param sample_rate The sample rate of the signal.
+ \param playout_rate The ratio between the output speed and the input speed.
+ \return A pointer to the context, or NULL if there was a problem. */
+SPAN_DECLARE(time_scale_state_t *) time_scale_init(time_scale_state_t *s, int sample_rate, float playout_rate);
+
+/*! \brief Release a time scale context.
+ \param s The time scale context.
+ \return 0 for OK, else -1. */
+SPAN_DECLARE(int) time_scale_release(time_scale_state_t *s);
+
+/*! \brief Free a time scale context.
+ \param s The time scale context.
+ \return 0 for OK, else -1. */
+SPAN_DECLARE(int) time_scale_free(time_scale_state_t *s);
+
#if defined(__cplusplus)
}
#endif
diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c
index bd24898b3e..3a31893e30 100644
--- a/libs/spandsp/src/t30.c
+++ b/libs/spandsp/src/t30.c
@@ -302,16 +302,18 @@ enum
#define DEFAULT_TIMER_T2 7000
/*! Once HDLC flags begin, T2 is reset, and a 3s timer begins. This timer is unnamed in T.30. Here we
- term it T2A. No tolerance is specified for this timer. T2A specifies the maximum time to wait for the
- end of a frame, after the initial flag has been seen. */
-#define DEFAULT_TIMER_T2A 3000
+ term it T2_FLAGGED. No tolerance is specified for this timer. T2_FLAGGED specifies the maximum
+ time to wait for the end of a frame, after the initial flag has been seen. */
+#define DEFAULT_TIMER_T2_FLAGGED 3000
/*! If the HDLC carrier falls during reception, we need to apply a minimum time before continuing. If we
don't, there are circumstances where we could continue and reply before the incoming signals have
really finished. E.g. if a bad DCS is received in a DCS-TCF sequence, we need wait for the TCF
carrier to pass, before continuing. This timer is specified as 200ms, but no tolerance is specified.
- It is unnamed in T.30. Here we term it T2B */
-#define DEFAULT_TIMER_T2B 200
+ It is unnamed in T.30. Here we term it T2_DROPPED */
+#define DEFAULT_TIMER_T2_DROPPED 200
+
+/*! Timer T2C is a fake timer state for internal use */
/*! Time-out T3 defines the amount of time a terminal will attempt to alert the local operator in
response to a procedural interrupt. Failing to achieve operator intervention, the terminal will
@@ -330,17 +332,19 @@ enum
#define DEFAULT_TIMER_T4 3450
/*! Once HDLC flags begin, T4 is reset, and a 3s timer begins. This timer is unnamed in T.30. Here we
- term it T4A. No tolerance is specified for this timer. T4A specifies the maximum time to wait for the
- end of a frame, after the initial flag has been seen. Note that a different timer is used for the fast
- HDLC in ECM mode, to provide time for physical paper handling. */
-#define DEFAULT_TIMER_T4A 3000
+ term it T4_FLAGGED. No tolerance is specified for this timer. T4_FLAGGED specifies the maximum time
+ to wait for the end of a frame, after the initial flag has been seen. Note that a different timer
+ is used for the fast HDLC in ECM mode, to provide time for physical paper handling. */
+#define DEFAULT_TIMER_T4_FLAGGED 3000
/*! If the HDLC carrier falls during reception, we need to apply a minimum time before continuing. if we
don't, there are circumstances where we could continue and reply before the incoming signals have
- really finished. E.g. if a bad DCS is received in a DCS-TCF sequence, we need wait for the TCF
+ really finished. E.g. if a bad DCS is received in a DCS-TCF sequence, we need to wait for the TCF
carrier to pass, before continuing. This timer is specified as 200ms, but no tolerance is specified.
- It is unnamed in T.30. Here we term it T4B */
-#define DEFAULT_TIMER_T4B 200
+ It is unnamed in T.30. Here we term it T4_DROPPED */
+#define DEFAULT_TIMER_T4_DROPPED 200
+
+/*! Timer T4C is a fake timer state for internal use */
/*! Time-out T5 is defined for the optional T.4 error correction mode. Time-out T5 defines the amount
of time waiting for clearance of the busy condition of the receiving terminal. T5 is 60+-5s and
@@ -386,12 +390,12 @@ enum
TIMER_IS_IDLE = 0,
TIMER_IS_T2,
TIMER_IS_T1A,
- TIMER_IS_T2A,
- TIMER_IS_T2B,
+ TIMER_IS_T2_FLAGGED,
+ TIMER_IS_T2_DROPPED,
TIMER_IS_T2C,
TIMER_IS_T4,
- TIMER_IS_T4A,
- TIMER_IS_T4B,
+ TIMER_IS_T4_FLAGGED,
+ TIMER_IS_T4_DROPPED,
TIMER_IS_T4C
};
@@ -436,13 +440,14 @@ static void decode_20digit_msg(t30_state_t *s, char *msg, const uint8_t *pkt, in
static void decode_url_msg(t30_state_t *s, char *msg, const uint8_t *pkt, int len);
static int decode_nsf_nss_nsc(t30_state_t *s, uint8_t *msg[], const uint8_t *pkt, int len);
static void set_min_scan_time(t30_state_t *s);
+static int send_cfr_sequence(t30_state_t *s, int start);
static int build_dcs(t30_state_t *s);
static void timer_t2_start(t30_state_t *s);
-static void timer_t2a_start(t30_state_t *s);
-static void timer_t2b_start(t30_state_t *s);
+static void timer_t2_flagged_start(t30_state_t *s);
+static void timer_t2_dropped_start(t30_state_t *s);
static void timer_t4_start(t30_state_t *s);
-static void timer_t4a_start(t30_state_t *s);
-static void timer_t4b_start(t30_state_t *s);
+static void timer_t4_flagged_start(t30_state_t *s);
+static void timer_t4_dropped_start(t30_state_t *s);
static void timer_t2_t4_stop(t30_state_t *s);
/*! Test a specified bit within a DIS, DTC or DCS frame */
@@ -463,9 +468,12 @@ static int find_fallback_entry(int dcs_code)
{
if (fallback_sequence[i].dcs_code == dcs_code)
break;
+ /*endif*/
}
+ /*endfor*/
if (fallback_sequence[i].bit_rate == 0)
return -1;
+ /*endif*/
return i;
}
/*- End of function --------------------------------------------------------*/
@@ -476,13 +484,16 @@ static int step_fallback_entry(t30_state_t *s)
{
if ((fallback_sequence[s->current_fallback].which & s->current_permitted_modems))
break;
+ /*endif*/
}
+ /*endwhile*/
if (fallback_sequence[s->current_fallback].bit_rate == 0)
{
/* Reset the fallback sequence */
s->current_fallback = 0;
return -1;
}
+ /*endif*/
/* We need to update the minimum scan time, in case we are in non-ECM mode. */
set_min_scan_time(s);
/* Now we need to rebuild the DCS message we will send. */
@@ -506,6 +517,7 @@ static int terminate_operation_in_progress(t30_state_t *s)
s->operation_in_progress = OPERATION_IN_PROGRESS_POST_T4_RX;
break;
}
+ /*endswitch*/
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -517,6 +529,7 @@ static int tx_start_page(t30_state_t *s)
terminate_operation_in_progress(s);
return -1;
}
+ /*endif*/
s->ecm_block = 0;
s->error_correcting_mode_retries = 0;
span_log(&s->logging, SPAN_LOG_FLOW, "Starting page %d of transfer\n", s->tx_page_number + 1);
@@ -532,6 +545,7 @@ static int tx_end_page(t30_state_t *s)
s->tx_page_number++;
s->ecm_block = 0;
}
+ /*endif*/
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -553,9 +567,11 @@ static int rx_start_page(t30_state_t *s)
if (t4_rx_start_page(&s->t4.rx))
return -1;
+ /*endif*/
/* Clear the ECM buffer */
for (i = 0; i < 256; i++)
s->ecm_len[i] = -1;
+ /*endfor*/
s->ecm_block = 0;
s->ecm_frames = -1;
s->ecm_frames_this_tx_burst = 0;
@@ -571,6 +587,7 @@ static int rx_end_page(t30_state_t *s)
s->rx_page_number++;
s->ecm_block = 0;
}
+ /*endif*/
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -635,6 +652,7 @@ static int copy_quality(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "Page quality is bad\n");
quality = T30_COPY_QUALITY_BAD;
}
+ /*endif*/
return quality;
}
/*- End of function --------------------------------------------------------*/
@@ -652,6 +670,7 @@ static void report_tx_result(t30_state_t *s, int result)
(result) ? "Success" : "Failure",
stats.pages_transferred);
}
+ /*endif*/
}
/*- End of function --------------------------------------------------------*/
@@ -662,88 +681,104 @@ static void release_resources(t30_state_t *s)
span_free(s->tx_info.nsf);
s->tx_info.nsf = NULL;
}
+ /*endif*/
s->tx_info.nsf_len = 0;
if (s->tx_info.nsc)
{
span_free(s->tx_info.nsc);
s->tx_info.nsc = NULL;
}
+ /*endif*/
s->tx_info.nsc_len = 0;
if (s->tx_info.nss)
{
span_free(s->tx_info.nss);
s->tx_info.nss = NULL;
}
+ /*endif*/
s->tx_info.nss_len = 0;
if (s->tx_info.tsa)
{
span_free(s->tx_info.tsa);
s->tx_info.tsa = NULL;
}
+ /*endif*/
if (s->tx_info.ira)
{
span_free(s->tx_info.ira);
s->tx_info.ira = NULL;
}
+ /*endif*/
if (s->tx_info.cia)
{
span_free(s->tx_info.cia);
s->tx_info.cia = NULL;
}
+ /*endif*/
if (s->tx_info.isp)
{
span_free(s->tx_info.isp);
s->tx_info.isp = NULL;
}
+ /*endif*/
if (s->tx_info.csa)
{
span_free(s->tx_info.csa);
s->tx_info.csa = NULL;
}
+ /*endif*/
if (s->rx_info.nsf)
{
span_free(s->rx_info.nsf);
s->rx_info.nsf = NULL;
}
+ /*endif*/
s->rx_info.nsf_len = 0;
if (s->rx_info.nsc)
{
span_free(s->rx_info.nsc);
s->rx_info.nsc = NULL;
}
+ /*endif*/
s->rx_info.nsc_len = 0;
if (s->rx_info.nss)
{
span_free(s->rx_info.nss);
s->rx_info.nss = NULL;
}
+ /*endif*/
s->rx_info.nss_len = 0;
if (s->rx_info.tsa)
{
span_free(s->rx_info.tsa);
s->rx_info.tsa = NULL;
}
+ /*endif*/
if (s->rx_info.ira)
{
span_free(s->rx_info.ira);
s->rx_info.ira = NULL;
}
+ /*endif*/
if (s->rx_info.cia)
{
span_free(s->rx_info.cia);
s->rx_info.cia = NULL;
}
+ /*endif*/
if (s->rx_info.isp)
{
span_free(s->rx_info.isp);
s->rx_info.isp = NULL;
}
+ /*endif*/
if (s->rx_info.csa)
{
span_free(s->rx_info.csa);
s->rx_info.csa = NULL;
}
+ /*endif*/
}
/*- End of function --------------------------------------------------------*/
@@ -758,12 +793,14 @@ static uint8_t check_next_tx_step(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with the same format\n");
return (s->local_interrupt_pending) ? T30_PRI_MPS : T30_MPS;
}
+ /*endif*/
if (res > 0)
{
span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with a different format\n");
s->tx_start_page = t4_tx_get_current_page_in_file(&s->t4.tx) + 1;
return (s->local_interrupt_pending) ? T30_PRI_EOM : T30_EOM;
}
+ /*endif*/
/* Call a user handler, if one is set, to check if another document is to be sent.
If so, we send an EOM, rather than an EOP. Then we will renegotiate, and the new
document will begin. */
@@ -771,13 +808,16 @@ static uint8_t check_next_tx_step(t30_state_t *s)
more = s->document_handler(s->document_user_data, 0);
else
more = false;
+ /*endif*/
if (more)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Another document to send\n");
//if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_MULTIPLE_SELECTIVE_POLLING_CAPABLE))
// return T30_EOS;
+ ///*endif*/
return (s->local_interrupt_pending) ? T30_PRI_EOM : T30_EOM;
}
+ /*endif*/
span_log(&s->logging, SPAN_LOG_FLOW, "No more pages to send\n");
return (s->local_interrupt_pending) ? T30_PRI_EOP : T30_EOP;
}
@@ -797,6 +837,7 @@ static int get_partial_ecm_page(t30_state_t *s)
page signal, which is marked as the final frame. */
for (i = 3; i < 32 + 3; i++)
s->ecm_frame_map[i] = 0xFF;
+ /*endfor*/
for (i = 0; i < 256; i++)
{
s->ecm_len[i] = -1;
@@ -810,6 +851,7 @@ static int get_partial_ecm_page(t30_state_t *s)
len = s->document_get_handler(s->document_get_user_data, &s->ecm_data[i][4], s->octets_per_ecm_frame);
else
len = t4_tx_get(&s->t4.tx, &s->ecm_data[i][4], s->octets_per_ecm_frame);
+ /*endif*/
if (len < s->octets_per_ecm_frame)
{
/* The document is not big enough to fill the entire buffer */
@@ -819,13 +861,16 @@ static int get_partial_ecm_page(t30_state_t *s)
memset(&s->ecm_data[i][4 + len], 0, s->octets_per_ecm_frame - len);
s->ecm_len[i++] = (int16_t) (s->octets_per_ecm_frame + 4);
}
+ /*endif*/
s->ecm_frames = i;
span_log(&s->logging, SPAN_LOG_FLOW, "Partial document buffer contains %d frames (%d per frame)\n", i, s->octets_per_ecm_frame);
s->ecm_at_page_end = true;
return i;
}
+ /*endif*/
s->ecm_len[i] = (int16_t) (4 + len);
}
+ /*endfor*/
/* We filled the entire buffer */
s->ecm_frames = 256;
span_log(&s->logging, SPAN_LOG_FLOW, "Partial page buffer full (%d per frame)\n", s->octets_per_ecm_frame);
@@ -852,9 +897,12 @@ static int send_next_ecm_frame(t30_state_t *s)
s->ecm_frames_this_tx_burst++;
return 0;
}
+ /*endif*/
}
+ /*endfor*/
s->ecm_current_tx_frame = s->ecm_frames;
}
+ /*endif*/
if (s->ecm_current_tx_frame < s->ecm_frames + 3)
{
/* We have sent all the FCD frames. Send three RCP frames, as per
@@ -873,6 +921,7 @@ static int send_next_ecm_frame(t30_state_t *s)
s->short_train = true;
return 0;
}
+ /*endif*/
return -1;
}
/*- End of function --------------------------------------------------------*/
@@ -883,6 +932,7 @@ static void send_rr(t30_state_t *s)
send_simple_frame(s, T30_RR);
else
send_dcn(s);
+ /*endif*/
}
/*- End of function --------------------------------------------------------*/
@@ -910,6 +960,7 @@ static void shut_down_hdlc_tx(t30_state_t *s)
{
if (s->send_hdlc_handler)
s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0);
+ /*endif*/
}
/*- End of function --------------------------------------------------------*/
@@ -919,8 +970,10 @@ static void send_frame(t30_state_t *s, const uint8_t *msg, int len)
if (s->real_time_frame_handler)
s->real_time_frame_handler(s->real_time_frame_user_data, false, msg, len);
+ /*endif*/
if (s->send_hdlc_handler)
s->send_hdlc_handler(s->send_hdlc_user_data, msg, len);
+ /*endif*/
}
/*- End of function --------------------------------------------------------*/
@@ -949,8 +1002,10 @@ static void send_20digit_msg_frame(t30_state_t *s, int cmd, char *msg)
frame[p++] = (uint8_t) (cmd | s->dis_received);
while (len > 0)
frame[p++] = msg[--len];
+ /*endwhile*/
while (p < 23)
frame[p++] = ' ';
+ /*endwhile*/
send_frame(s, frame, 23);
}
/*- End of function --------------------------------------------------------*/
@@ -967,6 +1022,7 @@ static int send_nsf_frame(t30_state_t *s)
send_frame(s, s->tx_info.nsf, s->tx_info.nsf_len + 3);
return true;
}
+ /*endif*/
return false;
}
/*- End of function --------------------------------------------------------*/
@@ -983,6 +1039,7 @@ static int send_nss_frame(t30_state_t *s)
send_frame(s, s->tx_info.nss, s->tx_info.nss_len + 3);
return true;
}
+ /*endif*/
return false;
}
/*- End of function --------------------------------------------------------*/
@@ -999,6 +1056,7 @@ static int send_nsc_frame(t30_state_t *s)
send_frame(s, s->tx_info.nsc, s->tx_info.nsc_len + 3);
return true;
}
+ /*endif*/
return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1012,6 +1070,7 @@ static int send_ident_frame(t30_state_t *s, uint8_t cmd)
send_20digit_msg_frame(s, cmd, s->tx_info.ident);
return true;
}
+ /*endif*/
return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1025,6 +1084,7 @@ static int send_psa_frame(t30_state_t *s)
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE);
return true;
}
+ /*endif*/
clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE);
return false;
}
@@ -1039,6 +1099,7 @@ static int send_sep_frame(t30_state_t *s)
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE);
return true;
}
+ /*endif*/
clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE);
return false;
}
@@ -1054,6 +1115,7 @@ static int send_sid_frame(t30_state_t *s)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SENDER_ID_TRANSMISSION);
return true;
}
+ /*endif*/
clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SENDER_ID_TRANSMISSION);
return false;
}
@@ -1069,6 +1131,7 @@ static int send_pwd_frame(t30_state_t *s)
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_PASSWORD);
return true;
}
+ /*endif*/
clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_PASSWORD);
return false;
}
@@ -1084,6 +1147,7 @@ static int send_sub_frame(t30_state_t *s)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SUBADDRESS_TRANSMISSION);
return true;
}
+ /*endif*/
clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SUBADDRESS_TRANSMISSION);
return false;
}
@@ -1096,6 +1160,7 @@ static int send_tsa_frame(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "Sending transmitting subscriber internet address '%s'\n", "");
return true;
}
+ /*endif*/
return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1108,6 +1173,7 @@ static int send_ira_frame(t30_state_t *s)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INTERNET_ROUTING_ADDRESS_TRANSMISSION);
return true;
}
+ /*endif*/
clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INTERNET_ROUTING_ADDRESS_TRANSMISSION);
return false;
}
@@ -1120,6 +1186,7 @@ static int send_cia_frame(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "Sending calling subscriber internet address '%s'\n", "");
return true;
}
+ /*endif*/
return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1132,6 +1199,7 @@ static int send_isp_frame(t30_state_t *s)
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS);
return true;
}
+ /*endif*/
clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS);
return false;
}
@@ -1145,6 +1213,7 @@ static int send_csa_frame(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "Sending called subscriber internet address '%s'\n", "");
return true;
}
+ /*endif*/
#endif
return false;
}
@@ -1161,7 +1230,7 @@ static int send_pps_frame(t30_state_t *s)
frame[4] = (uint8_t) (s->tx_page_number & 0xFF);
frame[5] = (uint8_t) (s->ecm_block & 0xFF);
frame[6] = (uint8_t) ((s->ecm_frames_this_tx_burst == 0) ? 0 : (s->ecm_frames_this_tx_burst - 1));
- span_log(&s->logging, SPAN_LOG_FLOW, "Sending PPS + %s\n", t30_frametype(frame[3]));
+ span_log(&s->logging, SPAN_LOG_FLOW, "Sending PPS-%s\n", t30_frametype(frame[3]));
send_frame(s, frame, 7);
return frame[3] & 0xFE;
}
@@ -1181,13 +1250,16 @@ int t30_build_dis_or_dtc(t30_state_t *s)
s->local_dis_dtc_frame[2] = (uint8_t) (T30_DIS | s->dis_received);
for (i = 3; i < T30_MAX_DIS_DTC_DCS_LEN; i++)
s->local_dis_dtc_frame[i] = 0x00;
+ /*endfor*/
/* Always say 256 octets per ECM frame preferred, as 64 is never used in the
real world. */
if ((s->iaf & T30_IAF_MODE_T37))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T37);
+ /*endif*/
if ((s->iaf & T30_IAF_MODE_T38))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T38);
+ /*endif*/
/* No 3G mobile */
/* No V.8 */
/* 256 octets preferred - don't bother making this optional, as everything uses 256 */
@@ -1196,35 +1268,44 @@ int t30_build_dis_or_dtc(t30_state_t *s)
/* With no modems set we are actually selecting V.27ter fallback at 2400bps */
if ((s->supported_modems & T30_SUPPORT_V27TER))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_MODEM_TYPE_2);
+ /*endif*/
if ((s->supported_modems & T30_SUPPORT_V29))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_MODEM_TYPE_1);
+ /*endif*/
/* V.17 is only valid when combined with V.29 and V.27ter, so if we enable V.17 we force the others too. */
if ((s->supported_modems & T30_SUPPORT_V17))
s->local_dis_dtc_frame[4] |= (DISBIT6 | DISBIT4 | DISBIT3);
+ /*endif*/
/* 215mm wide is always supported */
if ((s->supported_image_sizes & T4_SUPPORT_WIDTH_303MM))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_215MM_255MM_303MM_WIDTH_CAPABLE);
else if ((s->supported_image_sizes & T4_SUPPORT_WIDTH_255MM))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_215MM_255MM_WIDTH_CAPABLE);
+ /*endif*/
/* A4 is always supported. */
if ((s->supported_image_sizes & T4_SUPPORT_LENGTH_UNLIMITED))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_UNLIMITED_LENGTH_CAPABLE);
else if ((s->supported_image_sizes & T4_SUPPORT_LENGTH_B4))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_A4_B4_LENGTH_CAPABLE);
+ /*endif*/
if ((s->supported_image_sizes & T4_SUPPORT_LENGTH_US_LETTER))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NORTH_AMERICAN_LETTER_CAPABLE);
+ /*endif*/
if ((s->supported_image_sizes & T4_SUPPORT_LENGTH_US_LEGAL))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NORTH_AMERICAN_LEGAL_CAPABLE);
+ /*endif*/
/* No scan-line padding required, but some may be specified by the application. */
set_ctrl_bits(s->local_dis_dtc_frame, s->local_min_scan_time_code, T30_DIS_BIT_MIN_SCAN_LINE_TIME_CAPABILITY_1);
if ((s->supported_compressions & T4_COMPRESSION_T4_2D))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE);
+ /*endif*/
if ((s->supported_compressions & T4_COMPRESSION_NONE))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_UNCOMPRESSED_CAPABLE);
+ /*endif*/
if (s->ecm_allowed)
{
/* ECM allowed */
@@ -1234,6 +1315,7 @@ int t30_build_dis_or_dtc(t30_state_t *s)
also offering the ECM option needed to support them. */
if ((s->supported_compressions & T4_COMPRESSION_T6))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE);
+ /*endif*/
if ((s->supported_compressions & T4_COMPRESSION_T85))
{
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE);
@@ -1241,7 +1323,9 @@ int t30_build_dis_or_dtc(t30_state_t *s)
support here. */
if ((s->supported_compressions & T4_COMPRESSION_T85_L0))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE);
+ /*endif*/
}
+ /*endif*/
//if ((s->supported_compressions & T4_COMPRESSION_T88))
//{
@@ -1249,14 +1333,17 @@ int t30_build_dis_or_dtc(t30_state_t *s)
// set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T88_CAPABILITY_2);
// set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T88_CAPABILITY_3);
//}
+ ///*endif*/
if ((s->supported_compressions & (T4_COMPRESSION_COLOUR | T4_COMPRESSION_GRAYSCALE)))
{
if ((s->supported_compressions & T4_COMPRESSION_COLOUR))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE);
+ /*endif*/
if ((s->supported_compressions & T4_COMPRESSION_T42_T81))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE);
+ /*endif*/
if ((s->supported_compressions & T4_COMPRESSION_T43))
{
/* Note 25 of table 2/T.30 */
@@ -1264,36 +1351,49 @@ int t30_build_dis_or_dtc(t30_state_t *s)
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE);
/* No plane interleave */
}
+ /*endif*/
if ((s->supported_compressions & T4_COMPRESSION_T45))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE);
+ /*endif*/
if ((s->supported_compressions & T4_COMPRESSION_SYCC_T81))
{
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE);
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE);
}
+ /*endif*/
if ((s->supported_compressions & T4_COMPRESSION_12BIT))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE);
+ /*endif*/
if ((s->supported_compressions & T4_COMPRESSION_NO_SUBSAMPLING))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING);
+ /*endif*/
/* No custom illuminant */
/* No custom gamut range */
}
+ /*endif*/
}
+ /*endif*/
if ((s->supported_t30_features & T30_SUPPORT_FIELD_NOT_VALID))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FNV_CAPABLE);
+ /*endif*/
if ((s->supported_t30_features & T30_SUPPORT_MULTIPLE_SELECTIVE_POLLING))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_MULTIPLE_SELECTIVE_POLLING_CAPABLE);
+ /*endif*/
if ((s->supported_t30_features & T30_SUPPORT_POLLED_SUB_ADDRESSING))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE);
+ /*endif*/
if ((s->supported_t30_features & T30_SUPPORT_SELECTIVE_POLLING))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE);
+ /*endif*/
if ((s->supported_t30_features & T30_SUPPORT_SUB_ADDRESSING))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SUBADDRESSING_CAPABLE);
+ /*endif*/
if ((s->supported_t30_features & T30_SUPPORT_IDENTIFICATION))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_PASSWORD);
+ /*endif*/
/* No G.726 */
/* No extended voice coding */
@@ -1302,6 +1402,7 @@ int t30_build_dis_or_dtc(t30_state_t *s)
/* Ready to transmit a data file (polling) */
if (s->tx_file[0])
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_TRANSMIT_DATA_FILE);
+ /*endif*/
/* No simple phase C BFT negotiations */
/* No extended BFT negotiations */
@@ -1309,7 +1410,6 @@ int t30_build_dis_or_dtc(t30_state_t *s)
/* No Document transfer mode (DTM) */
/* No Electronic data interchange (EDI) */
/* No Basic transfer mode (BTM) */
-
/* No mixed mode (polling) */
/* No character mode */
/* No mixed mode (T.4/Annex E) */
@@ -1332,59 +1432,80 @@ int t30_build_dis_or_dtc(t30_state_t *s)
if ((s->supported_t30_features & T30_SUPPORT_INTERNET_SELECTIVE_POLLING_ADDRESS))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS);
+ /*endif*/
if ((s->supported_t30_features & T30_SUPPORT_INTERNET_ROUTING_ADDRESS))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_ROUTING_ADDRESS);
+ /*endif*/
if ((s->supported_bilevel_resolutions & T4_RESOLUTION_1200_1200))
{
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_1200_1200_CAPABLE);
if ((s->supported_colour_resolutions & T4_RESOLUTION_1200_1200))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_1200_1200_CAPABLE);
+ /*endif*/
}
+ /*endif*/
if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_1200))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE);
+ /*endif*/
if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_600))
{
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE);
if ((s->supported_colour_resolutions & T4_RESOLUTION_600_600))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_600_600_CAPABLE);
+ /*endif*/
}
+ /*endif*/
if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_800))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_800_CAPABLE);
+ /*endif*/
if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R16_SUPERFINE))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE);
+ /*endif*/
if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_400))
{
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE);
if ((s->supported_colour_resolutions & T4_RESOLUTION_400_400))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE);
+ /*endif*/
}
+ /*endif*/
if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_600))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE);
+ /*endif*/
if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_300))
{
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE);
if ((s->supported_colour_resolutions & T4_RESOLUTION_300_300))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE);
+ /*endif*/
}
+ /*endif*/
if ((s->supported_bilevel_resolutions & (T4_RESOLUTION_200_400 | T4_RESOLUTION_R8_SUPERFINE)))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE);
+ /*endif*/
if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R8_FINE))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE);
+ /*endif*/
if ((s->supported_bilevel_resolutions & T4_RESOLUTION_200_200))
{
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE);
if ((s->supported_colour_resolutions & T4_RESOLUTION_200_200))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE);
+ /*endif*/
}
+ /*endif*/
/* Standard FAX resolution bi-level image support goes without saying */
if ((s->supported_colour_resolutions & T4_RESOLUTION_100_100))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_100_100_CAPABLE);
+ /*endif*/
if ((s->supported_bilevel_resolutions & (T4_RESOLUTION_R8_STANDARD | T4_RESOLUTION_R8_FINE | T4_RESOLUTION_R8_SUPERFINE | T4_RESOLUTION_R16_SUPERFINE)))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED);
+ /*endif*/
if ((s->supported_bilevel_resolutions & (T4_RESOLUTION_200_100 | T4_RESOLUTION_200_200 | T4_RESOLUTION_200_400 | T4_RESOLUTION_300_300 | T4_RESOLUTION_300_600 | T4_RESOLUTION_400_400 | T4_RESOLUTION_400_800 | T4_RESOLUTION_600_600 | T4_RESOLUTION_600_1200 | T4_RESOLUTION_1200_1200)))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED);
+ /*endif*/
/* No double sided printing (alternate mode) */
/* No double sided printing (continuous mode) */
@@ -1395,9 +1516,11 @@ int t30_build_dis_or_dtc(t30_state_t *s)
if ((s->iaf & T30_IAF_MODE_FLOW_CONTROL))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T38_FLOW_CONTROL_CAPABLE);
+ /*endif*/
/* No k > 4 */
if ((s->iaf & T30_IAF_MODE_CONTINUOUS_FLOW))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T38_FAX_CAPABLE);
+ /*endif*/
/* No T.88/T.89 profile */
s->local_dis_dtc_len = 19;
return 0;
@@ -1414,11 +1537,13 @@ static int set_dis_or_dtc(t30_state_t *s)
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_RECEIVE_FAX_DOCUMENT);
else
clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_RECEIVE_FAX_DOCUMENT);
+ /*endif*/
/* If we have a file name to transmit, then we are ready to transmit (polling) */
if (s->tx_file[0])
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_TRANSMIT_FAX_DOCUMENT);
else
clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_TRANSMIT_FAX_DOCUMENT);
+ /*endif*/
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -1435,12 +1560,15 @@ static int prune_dis_dtc(t30_state_t *s)
/* Check if there is some real message content here */
if (s->local_dis_dtc_frame[i])
break;
+ /*endif*/
}
+ /*endfor*/
s->local_dis_dtc_len = i + 1;
/* Fill in any required extension bits */
s->local_dis_dtc_frame[i] &= ~DISBIT8;
for (i--; i > 4; i--)
s->local_dis_dtc_frame[i] |= DISBIT8;
+ /*endfor*/
t30_decode_dis_dtc_dcs(s, s->local_dis_dtc_frame, s->local_dis_dtc_len);
return s->local_dis_dtc_len;
}
@@ -1466,6 +1594,7 @@ static int build_dcs(t30_state_t *s)
s->dcs_frame[2] = (uint8_t) (T30_DCS | s->dis_received);
for (i = 3; i < T30_MAX_DIS_DTC_DCS_LEN; i++)
s->dcs_frame[i] = 0x00;
+ /*endfor*/
/* We have a file to send, so tell the far end to go into receive mode. */
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_RECEIVE_FAX_DOCUMENT);
@@ -1474,9 +1603,11 @@ static int build_dcs(t30_state_t *s)
/* Check for T.37 simple mode. */
if ((s->iaf & T30_IAF_MODE_T37) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T37))
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T37);
+ /*endif*/
/* Check for T.38 mode. */
if ((s->iaf & T30_IAF_MODE_T38) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38))
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T38);
+ /*endif*/
#endif
/* Set to required modem rate */
@@ -1510,12 +1641,16 @@ static int build_dcs(t30_state_t *s)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T81_MODE);
if (image_type == T4_IMAGE_TYPE_COLOUR_8BIT || image_type == T4_IMAGE_TYPE_COLOUR_12BIT)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_FULL_COLOUR_MODE);
+ /*endif*/
if (image_type == T4_IMAGE_TYPE_GRAY_12BIT || image_type == T4_IMAGE_TYPE_COLOUR_12BIT)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_12BIT_COMPONENT);
+ /*endif*/
//if (???????? & T4_COMPRESSION_NO_SUBSAMPLING))
// set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_NO_SUBSAMPLING);
+ ///*endif*/
//if (???????? & T4_COMPRESSION_?????))
// set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_PREFERRED_HUFFMAN_TABLES);
+ ///*endif*/
set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, T30_DCS_BIT_MIN_SCAN_LINE_TIME_1);
use_bilevel = false;
break;
@@ -1523,8 +1658,10 @@ static int build_dcs(t30_state_t *s)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T43_MODE);
if (image_type == T4_IMAGE_TYPE_COLOUR_8BIT || image_type == T4_IMAGE_TYPE_COLOUR_12BIT)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_FULL_COLOUR_MODE);
+ /*endif*/
if (image_type == T4_IMAGE_TYPE_GRAY_12BIT || image_type == T4_IMAGE_TYPE_COLOUR_12BIT)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_12BIT_COMPONENT);
+ /*endif*/
set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, T30_DCS_BIT_MIN_SCAN_LINE_TIME_1);
use_bilevel = false;
break;
@@ -1542,6 +1679,7 @@ static int build_dcs(t30_state_t *s)
set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, T30_DCS_BIT_MIN_SCAN_LINE_TIME_1);
break;
}
+ /*endswitch*/
/* Set the image width */
switch (s->line_width_code)
@@ -1559,6 +1697,7 @@ static int build_dcs(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "Image width is A3 at %ddpm x %ddpm\n", s->x_resolution, s->y_resolution);
break;
}
+ /*endswitch*/
/* Set the image length */
/* If the other end supports unlimited length, then use that. Otherwise, if the other end supports
@@ -1571,6 +1710,7 @@ static int build_dcs(t30_state_t *s)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_NORTH_AMERICAN_LETTER);
else if ((s->mutual_image_sizes & T4_SUPPORT_LENGTH_US_LEGAL))
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_NORTH_AMERICAN_LEGAL);
+ /*endif*/
/* Set the Y resolution bits */
switch (s->current_page_resolution)
@@ -1580,6 +1720,7 @@ static int build_dcs(t30_state_t *s)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
if (!use_bilevel)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_1200_1200);
+ /*endif*/
break;
case T4_RESOLUTION_600_1200:
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_600_1200);
@@ -1590,6 +1731,7 @@ static int build_dcs(t30_state_t *s)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
if (!use_bilevel)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_600_600);
+ /*endif*/
break;
case T4_RESOLUTION_400_800:
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_800);
@@ -1600,6 +1742,7 @@ static int build_dcs(t30_state_t *s)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
if (!use_bilevel)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_300_300_400_400);
+ /*endif*/
break;
case T4_RESOLUTION_300_600:
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_300_600);
@@ -1610,6 +1753,7 @@ static int build_dcs(t30_state_t *s)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
if (!use_bilevel)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_300_300_400_400);
+ /*endif*/
break;
case T4_RESOLUTION_200_400:
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_400);
@@ -1620,6 +1764,7 @@ static int build_dcs(t30_state_t *s)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
if (!use_bilevel)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_FULL_COLOUR_MODE);
+ /*endif*/
break;
case T4_RESOLUTION_200_100:
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
@@ -1628,6 +1773,7 @@ static int build_dcs(t30_state_t *s)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
if (!use_bilevel)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_100_100);
+ /*endif*/
break;
case T4_RESOLUTION_R16_SUPERFINE:
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_400);
@@ -1642,12 +1788,15 @@ static int build_dcs(t30_state_t *s)
/* Nothing special to set */
break;
}
+ /*endswitch*/
if (s->error_correcting_mode)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_ECM_MODE);
+ /*endif*/
if ((s->iaf & T30_IAF_MODE_FLOW_CONTROL) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38_FLOW_CONTROL_CAPABLE))
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T38_FLOW_CONTROL_CAPABLE);
+ /*endif*/
if ((s->iaf & T30_IAF_MODE_CONTINUOUS_FLOW) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38_FAX_CAPABLE))
{
@@ -1658,6 +1807,7 @@ static int build_dcs(t30_state_t *s)
clr_ctrl_bit(s->local_dis_dtc_frame, T30_DCS_BIT_MODEM_TYPE_4);
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T38_FAX_MODE);
}
+ /*endif*/
s->dcs_len = 19;
return 0;
}
@@ -1675,12 +1825,15 @@ static int prune_dcs(t30_state_t *s)
/* Check if there is some real message content here */
if (s->dcs_frame[i])
break;
+ /*endif*/
}
+ /*endfor*/
s->dcs_len = i + 1;
/* Fill in any required extension bits */
s->local_dis_dtc_frame[i] &= ~DISBIT8;
for (i-- ; i > 4; i--)
s->dcs_frame[i] |= DISBIT8;
+ /*endfor*/
t30_decode_dis_dtc_dcs(s, s->dcs_frame, s->dcs_len);
return s->dcs_len;
}
@@ -1694,17 +1847,21 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
span_log(&s->logging, SPAN_LOG_FLOW, "Short DIS/DTC frame\n");
return -1;
}
+ /*endif*/
if (msg[2] == T30_DIS)
s->dis_received = true;
+ /*endif*/
/* Make a local copy of the message, padded to the maximum possible length with zeros. This allows
us to simply pick out the bits, without worrying about whether they were set from the remote side. */
if (len > T30_MAX_DIS_DTC_DCS_LEN)
len = T30_MAX_DIS_DTC_DCS_LEN;
+ /*endif*/
memcpy(s->far_dis_dtc_frame, msg, len);
if (len < T30_MAX_DIS_DTC_DCS_LEN)
memset(s->far_dis_dtc_frame + len, 0, T30_MAX_DIS_DTC_DCS_LEN - len);
+ /*endif*/
s->error_correcting_mode = (s->ecm_allowed && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_ECM_CAPABLE));
/* Always use 256 octets per ECM frame, whatever the other end says it is capable of */
@@ -1718,43 +1875,56 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
s->mutual_compressions &= (0xFF800000 | T4_COMPRESSION_NONE | T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D);
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE))
s->mutual_compressions &= ~T4_COMPRESSION_T4_2D;
+ /*endif*/
}
else
{
/* Check the bi-level capabilities */
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE))
s->mutual_compressions &= ~T4_COMPRESSION_T4_2D;
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE))
s->mutual_compressions &= ~T4_COMPRESSION_T6;
+ /*endif*/
/* T.85 L0 capable without T.85 capable is an invalid combination, so let
just zap both capabilities if the far end is not T.85 capable. */
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE))
s->mutual_compressions &= ~(T4_COMPRESSION_T85 | T4_COMPRESSION_T85_L0);
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE))
s->mutual_compressions &= ~T4_COMPRESSION_T85_L0;
+ /*endif*/
/* Check for full colour or only gray-scale from the multi-level codecs */
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE))
s->mutual_compressions &= ~T4_COMPRESSION_COLOUR;
+ /*endif*/
/* Check the colour capabilities */
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE))
s->mutual_compressions &= ~T4_COMPRESSION_T42_T81;
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE))
s->mutual_compressions &= ~T4_COMPRESSION_SYCC_T81;
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE))
s->mutual_compressions &= ~T4_COMPRESSION_T43;
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE))
s->mutual_compressions &= ~T4_COMPRESSION_T45;
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE))
s->mutual_compressions &= ~T4_COMPRESSION_12BIT;
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING))
s->mutual_compressions &= ~T4_COMPRESSION_NO_SUBSAMPLING;
+ /*endif*/
/* bit74 custom illuminant */
/* bit75 custom gamut range */
}
+ /*endif*/
s->mutual_bilevel_resolutions = s->supported_bilevel_resolutions;
s->mutual_colour_resolutions = s->supported_colour_resolutions;
@@ -1767,9 +1937,12 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
{
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_1200_1200_CAPABLE))
s->mutual_colour_resolutions &= ~T4_RESOLUTION_1200_1200;
+ /*endif*/
}
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE))
s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_600_1200;
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE))
{
s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_600_600;
@@ -1779,9 +1952,12 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
{
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_600_600_CAPABLE))
s->mutual_colour_resolutions &= ~T4_RESOLUTION_600_600;
+ /*endif*/
}
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_400_800_CAPABLE))
s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_400_800;
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE))
{
s->mutual_bilevel_resolutions &= ~(T4_RESOLUTION_400_400 | T4_RESOLUTION_R16_SUPERFINE);
@@ -1791,9 +1967,12 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
{
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE))
s->mutual_colour_resolutions &= ~T4_RESOLUTION_400_400;
+ /*endif*/
}
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE))
s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_300_600;
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE))
{
s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_300_300;
@@ -1803,19 +1982,25 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
{
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE))
s->mutual_colour_resolutions &= ~T4_RESOLUTION_300_300;
+ /*endif*/
}
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE))
s->mutual_bilevel_resolutions &= ~(T4_RESOLUTION_200_400 | T4_RESOLUTION_R8_SUPERFINE);
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE))
{
s->mutual_bilevel_resolutions &= ~(T4_RESOLUTION_200_200 | T4_RESOLUTION_R8_FINE);
s->mutual_colour_resolutions &= ~T4_RESOLUTION_200_200;
}
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED))
s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_100;
+ /*endif*/
/* Never suppress T4_RESOLUTION_R8_STANDARD */
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_100_100_CAPABLE))
s->mutual_colour_resolutions &= ~T4_RESOLUTION_100_100;
+ /*endif*/
s->mutual_image_sizes = s->supported_image_sizes;
/* 215mm wide is always supported */
@@ -1824,18 +2009,24 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
s->mutual_image_sizes &= ~T4_SUPPORT_WIDTH_303MM;
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_215MM_255MM_WIDTH_CAPABLE))
s->mutual_image_sizes &= ~T4_SUPPORT_WIDTH_255MM;
+ /*endif*/
}
+ /*endif*/
/* A4 is always supported. */
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_UNLIMITED_LENGTH_CAPABLE))
{
s->mutual_image_sizes &= ~T4_SUPPORT_LENGTH_UNLIMITED;
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_A4_B4_LENGTH_CAPABLE))
s->mutual_image_sizes &= ~T4_SUPPORT_LENGTH_B4;
+ /*endif*/
}
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_NORTH_AMERICAN_LETTER_CAPABLE))
s->mutual_image_sizes &= ~T4_SUPPORT_LENGTH_US_LETTER;
+ /*endif*/
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_NORTH_AMERICAN_LEGAL_CAPABLE))
s->mutual_image_sizes &= ~T4_SUPPORT_LENGTH_US_LEGAL;
+ /*endif*/
switch (s->far_dis_dtc_frame[4] & (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3))
{
@@ -1846,6 +2037,7 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
s->current_fallback = T30_V17_FALLBACK_START;
break;
}
+ /*endif*/
/* Fall through */
case (DISBIT4 | DISBIT3):
if ((s->supported_modems & T30_SUPPORT_V29))
@@ -1854,6 +2046,7 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
s->current_fallback = T30_V29_FALLBACK_START;
break;
}
+ /*endif*/
/* Fall through */
case DISBIT4:
s->current_permitted_modems = T30_SUPPORT_V27TER;
@@ -1871,6 +2064,7 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
s->current_fallback = T30_V29_FALLBACK_START;
break;
}
+ /*endif*/
/* Fall through */
default:
span_log(&s->logging, SPAN_LOG_FLOW, "Remote does not support a compatible modem\n");
@@ -1878,6 +2072,7 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
t30_set_status(s, T30_ERR_INCOMPATIBLE);
return -1;
}
+ /*endswitch*/
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -1905,20 +2100,24 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
span_log(&s->logging, SPAN_LOG_FLOW, "Short DCS frame\n");
return -1;
}
+ /*endif*/
/* Make an ASCII string format copy of the message, for logging in the
received file. This string does not include the frame header octets. */
sprintf(s->rx_dcs_string, "%02X", bit_reverse8(msg[3]));
for (i = 4; i < len; i++)
sprintf(s->rx_dcs_string + 3*i - 10, " %02X", bit_reverse8(msg[i]));
+ /*endfor*/
/* Make a local copy of the message, padded to the maximum possible length with zeros. This allows
us to simply pick out the bits, without worrying about whether they were set from the remote side. */
if (len > T30_MAX_DIS_DTC_DCS_LEN)
len = T30_MAX_DIS_DTC_DCS_LEN;
+ /*endif*/
memcpy(dcs_frame, msg, len);
if (len < T30_MAX_DIS_DTC_DCS_LEN)
memset(dcs_frame + len, 0, T30_MAX_DIS_DTC_DCS_LEN - len);
+ /*endif*/
s->error_correcting_mode = (test_ctrl_bit(dcs_frame, T30_DCS_BIT_ECM_MODE) != 0);
s->octets_per_ecm_frame = test_ctrl_bit(dcs_frame, T30_DCS_BIT_64_OCTET_ECM_FRAMES) ? 256 : 64;
@@ -1945,7 +2144,9 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
{
/* We are going to work in full colour mode */
}
+ /*endif*/
}
+ /*endif*/
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_12BIT_COMPONENT))
{
@@ -1953,17 +2154,21 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
{
/* We are going to work in 12 bit mode */
}
+ /*endif*/
}
+ /*endif*/
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_NO_SUBSAMPLING))
{
//???? = T4_COMPRESSION_NO_SUBSAMPLING;
}
+ /*endif*/
if (!test_ctrl_bit(dcs_frame, T30_DCS_BIT_PREFERRED_HUFFMAN_TABLES))
{
//???? = T4_COMPRESSION_T42_T81_HUFFMAN;
}
+ /*endif*/
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_1200_1200))
{
@@ -1974,6 +2179,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_1200_1200;
x = 5;
}
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_600_600))
{
@@ -1984,6 +2190,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_600_600;
x = 4;
}
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_400))
{
@@ -1994,6 +2201,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_400_400;
x = 3;
}
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300))
{
@@ -2004,6 +2212,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_300_300;
x = 2;
}
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_200_200))
{
@@ -2014,6 +2223,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_200_200;
x = 1;
}
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_100_100))
{
@@ -2024,29 +2234,36 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_100_100;
x = 0;
}
+ /*endif*/
}
+ /*endif*/
/* Check which compression the far end has decided to use. */
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T81_MODE))
{
if ((s->supported_compressions & T4_COMPRESSION_T42_T81))
s->line_compression = T4_COMPRESSION_T42_T81;
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T43_MODE))
{
if ((s->supported_compressions & T4_COMPRESSION_T43))
s->line_compression = T4_COMPRESSION_T43;
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T45_MODE))
{
if ((s->supported_compressions & T4_COMPRESSION_T45))
s->line_compression = T4_COMPRESSION_T45;
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_SYCC_T81_MODE))
{
if ((s->supported_compressions & T4_COMPRESSION_SYCC_T81))
s->line_compression = T4_COMPRESSION_SYCC_T81;
+ /*endif*/
}
+ /*endif*/
}
else
{
@@ -2060,6 +2277,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_1200_1200;
x = 5;
}
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_1200))
{
@@ -2070,6 +2288,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_600_1200;
x = 4;
}
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_600))
{
@@ -2080,6 +2299,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_600_600;
x = 4;
}
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_800))
{
@@ -2090,6 +2310,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_400_800;
x = 3;
}
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_400))
{
@@ -2102,6 +2323,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_400_400;
x = 3;
}
+ /*endif*/
}
else
{
@@ -2112,7 +2334,9 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_R16_SUPERFINE;
x = 3;
}
+ /*endif*/
}
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_600))
{
@@ -2123,6 +2347,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_300_600;
x = 2;
}
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300))
{
@@ -2133,6 +2358,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_300_300;
x = 2;
}
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_200_400))
{
@@ -2145,6 +2371,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_200_400;
x = 1;
}
+ /*endif*/
}
else
{
@@ -2155,7 +2382,9 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_R8_SUPERFINE;
x = 1;
}
+ /*endif*/
}
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_200_200))
{
@@ -2168,6 +2397,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_200_200;
x = 1;
}
+ /*endif*/
}
else
{
@@ -2178,7 +2408,9 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_R8_FINE;
x = 1;
}
+ /*endif*/
}
+ /*endif*/
}
else
{
@@ -2196,7 +2428,9 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
s->current_page_resolution = T4_RESOLUTION_R8_STANDARD;
x = 1;
}
+ /*endif*/
}
+ /*endif*/
/* Check which compression the far end has decided to use. */
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T88_MODE_1)
@@ -2207,39 +2441,49 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
{
if ((s->supported_compressions & T4_COMPRESSION_T88))
s->line_compression = T4_COMPRESSION_T88;
+ /*endif*/
}
+ /*endif*/
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_L0_MODE))
{
if ((s->supported_compressions & T4_COMPRESSION_T85_L0))
s->line_compression = T4_COMPRESSION_T85_L0;
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_MODE))
{
if ((s->supported_compressions & T4_COMPRESSION_T85))
s->line_compression = T4_COMPRESSION_T85;
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T6_MODE))
{
if ((s->supported_compressions & T4_COMPRESSION_T6))
s->line_compression = T4_COMPRESSION_T6;
+ /*endif*/
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_2D_MODE))
{
if ((s->supported_compressions & T4_COMPRESSION_T4_2D))
s->line_compression = T4_COMPRESSION_T4_2D;
+ /*endif*/
}
else
{
if ((s->supported_compressions & T4_COMPRESSION_T4_1D))
s->line_compression = T4_COMPRESSION_T4_1D;
+ /*endif*/
}
+ /*endif*/
}
+ /*endif*/
if (s->line_compression == -1)
{
t30_set_status(s, T30_ERR_INCOMPATIBLE);
return -1;
}
+ /*endif*/
span_log(&s->logging, SPAN_LOG_FLOW, "Far end selected compression %s (%d)\n", t4_compression_to_str(s->line_compression), s->line_compression);
if (x < 0)
@@ -2247,18 +2491,21 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
t30_set_status(s, T30_ERR_NORESSUPPORT);
return -1;
}
+ /*endif*/
s->image_width = widths[x][dcs_frame[5] & (DISBIT2 | DISBIT1)];
/* We don't care that much about the image length control bits. Just accept what arrives */
if (!test_ctrl_bit(dcs_frame, T30_DCS_BIT_RECEIVE_FAX_DOCUMENT))
span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Remote is not requesting receive in DCS\n");
+ /*endif*/
if ((s->current_fallback = find_fallback_entry(dcs_frame[4] & (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3))) < 0)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Remote asked for a modem standard we do not support\n");
return -1;
}
+ /*endif*/
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -2274,10 +2521,7 @@ static void send_dcn(t30_state_t *s)
static void return_to_phase_b(t30_state_t *s, int with_fallback)
{
/* This is what we do after things like T30_EOM is exchanged. */
- if (s->calling_party)
- set_state(s, T30_STATE_T);
- else
- set_state(s, T30_STATE_R);
+ set_state(s, (s->calling_party) ? T30_STATE_T : T30_STATE_R);
}
/*- End of function --------------------------------------------------------*/
@@ -2291,6 +2535,7 @@ static int send_dis_or_dtc_sequence(t30_state_t *s, int start)
set_state(s, T30_STATE_R);
s->step = 0;
}
+ /*endif*/
if (!s->dis_received)
{
/* DIS sequence */
@@ -2300,11 +2545,13 @@ static int send_dis_or_dtc_sequence(t30_state_t *s, int start)
s->step++;
if (send_nsf_frame(s))
break;
+ /*endif*/
/* Fall through */
case 1:
s->step++;
if (send_ident_frame(s, T30_CSI))
break;
+ /*endif*/
/* Fall through */
case 2:
s->step++;
@@ -2318,6 +2565,7 @@ static int send_dis_or_dtc_sequence(t30_state_t *s, int start)
default:
return -1;
}
+ /*endswitch*/
}
else
{
@@ -2328,36 +2576,43 @@ static int send_dis_or_dtc_sequence(t30_state_t *s, int start)
s->step++;
if (send_nsc_frame(s))
break;
+ /*endif*/
/* Fall through */
case 1:
s->step++;
if (send_ident_frame(s, T30_CIG))
break;
+ /*endif*/
/* Fall through */
case 2:
s->step++;
if (send_pwd_frame(s))
break;
+ /*endif*/
/* Fall through */
case 3:
s->step++;
if (send_sep_frame(s))
break;
+ /*endif*/
/* Fall through */
case 4:
s->step++;
if (send_psa_frame(s))
break;
+ /*endif*/
/* Fall through */
case 5:
s->step++;
if (send_cia_frame(s))
break;
+ /*endif*/
/* Fall through */
case 6:
s->step++;
if (send_isp_frame(s))
break;
+ /*endif*/
/* Fall through */
case 7:
s->step++;
@@ -2371,7 +2626,9 @@ static int send_dis_or_dtc_sequence(t30_state_t *s, int start)
default:
return -1;
}
+ /*endswitch*/
}
+ /*endif*/
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -2385,37 +2642,44 @@ static int send_dcs_sequence(t30_state_t *s, int start)
set_state(s, T30_STATE_D);
s->step = 0;
}
+ /*endif*/
switch (s->step)
{
case 0:
s->step++;
if (send_nss_frame(s))
break;
+ /*endif*/
/* Fall through */
case 1:
s->step++;
if (send_ident_frame(s, T30_TSI))
break;
+ /*endif*/
/* Fall through */
case 2:
s->step++;
if (send_sub_frame(s))
break;
+ /*endif*/
/* Fall through */
case 3:
s->step++;
if (send_sid_frame(s))
break;
+ /*endif*/
/* Fall through */
case 4:
s->step++;
if (send_tsa_frame(s))
break;
+ /*endif*/
/* Fall through */
case 5:
s->step++;
if (send_ira_frame(s))
break;
+ /*endif*/
/* Fall through */
case 6:
s->step++;
@@ -2429,6 +2693,7 @@ static int send_dcs_sequence(t30_state_t *s, int start)
default:
return -1;
}
+ /*endswitch*/
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -2440,6 +2705,7 @@ static int send_cfr_sequence(t30_state_t *s, int start)
FAXing. */
if (start)
s->step = 0;
+ /*endif*/
switch (s->step)
{
case 0:
@@ -2458,6 +2724,7 @@ static int send_cfr_sequence(t30_state_t *s, int start)
default:
return -1;
}
+ /*endswitch*/
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -2473,6 +2740,7 @@ static void terminate_call(t30_state_t *s)
s->timer_t5 = 0;
if (s->phase_e_handler)
s->phase_e_handler(s->phase_e_user_data, s->current_status);
+ /*endif*/
set_state(s, T30_STATE_CALL_FINISHED);
set_phase(s, T30_PHASE_CALL_FINISHED);
release_resources(s);
@@ -2506,9 +2774,12 @@ static void set_min_scan_time(t30_state_t *s)
and the codes for what we say will be used. We need 0 minimum. */
static const uint8_t translate_min_scan_time[3][8] =
{
- {T30_MIN_SCAN_20MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_20MS, T30_MIN_SCAN_40MS, T30_MIN_SCAN_40MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_0MS}, /* normal */
- {T30_MIN_SCAN_20MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_40MS, T30_MIN_SCAN_20MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_0MS}, /* fine */
- {T30_MIN_SCAN_10MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_20MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_0MS} /* superfine, when half fine time is selected */
+ /* Normal */
+ {T30_MIN_SCAN_20MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_20MS, T30_MIN_SCAN_40MS, T30_MIN_SCAN_40MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_0MS},
+ /* Fine */
+ {T30_MIN_SCAN_20MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_40MS, T30_MIN_SCAN_20MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_0MS},
+ /* Superfine, when half fine time is selected */
+ {T30_MIN_SCAN_10MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_20MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_0MS}
};
/* Translation between the codes for the minimum scan time we will use, and milliseconds. */
static const int min_scan_times[8] =
@@ -2523,6 +2794,7 @@ static void set_min_scan_time(t30_state_t *s)
min_bits_field = T30_MIN_SCAN_0MS;
else
min_bits_field = (s->far_dis_dtc_frame[5] >> 4) & 7;
+ /*endif*/
switch (s->y_resolution)
{
case T4_Y_RESOLUTION_SUPERFINE:
@@ -2541,10 +2813,12 @@ static void set_min_scan_time(t30_state_t *s)
s->min_scan_time_code = T30_MIN_SCAN_0MS;
break;
}
+ /*endswitch*/
if ((s->iaf & T30_IAF_MODE_NO_FILL_BITS))
min_row_bits = 0;
else
min_row_bits = (fallback_sequence[s->current_fallback].bit_rate*min_scan_times[s->min_scan_time_code])/1000;
+ /*endif*/
span_log(&s->logging, SPAN_LOG_FLOW, "Minimum bits per row will be %d\n", min_row_bits);
t4_tx_set_min_bits_per_row(&s->t4.tx, min_row_bits);
}
@@ -2560,6 +2834,7 @@ static int start_sending_document(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "No document to send\n");
return -1;
}
+ /*endif*/
span_log(&s->logging, SPAN_LOG_FLOW, "Start sending document\n");
if (t4_tx_init(&s->t4.tx, s->tx_file, s->tx_start_page, s->tx_stop_page) == NULL)
{
@@ -2567,12 +2842,14 @@ static int start_sending_document(t30_state_t *s)
t30_set_status(s, T30_ERR_FILEERROR);
return -1;
}
+ /*endif*/
s->operation_in_progress = OPERATION_IN_PROGRESS_T4_TX;
t4_tx_set_local_ident(&s->t4.tx, s->tx_info.ident);
t4_tx_set_header_info(&s->t4.tx, s->header_info);
if (s->use_own_tz)
t4_tx_set_header_tz(&s->t4.tx, &s->tz);
+ /*endif*/
t4_tx_get_pages_in_file(&s->t4.tx);
@@ -2601,8 +2878,10 @@ static int start_sending_document(t30_state_t *s)
t30_set_status(s, T30_ERR_BADTIFF);
break;
}
+ /*endswitch*/
return -1;
}
+ /*endif*/
s->line_image_type = t4_tx_get_tx_image_type(&s->t4.tx);
s->line_compression = t4_tx_get_tx_compression(&s->t4.tx);
s->image_width = t4_tx_get_tx_image_width(&s->t4.tx);
@@ -2629,12 +2908,15 @@ static int start_sending_document(t30_state_t *s)
t30_set_status(s, T30_ERR_BADTIFFHDR);
return -1;
}
+ /*endif*/
if (s->error_correcting_mode)
{
if (get_partial_ecm_page(s) == 0)
span_log(&s->logging, SPAN_LOG_WARNING, "No image data to send\n");
+ /*endif*/
}
+ /*endif*/
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -2657,6 +2939,7 @@ static int start_receiving_document(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "No document to receive\n");
return -1;
}
+ /*endif*/
span_log(&s->logging, SPAN_LOG_FLOW, "Start receiving document\n");
s->ecm_block = 0;
send_dis_or_dtc_sequence(s, true);
@@ -2669,6 +2952,7 @@ static void unexpected_non_final_frame(t30_state_t *s, const uint8_t *msg, int l
span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected %s frame in state %s\n", t30_frametype(msg[2]), state_names[s->state]);
if (s->current_status == T30_ERR_OK)
t30_set_status(s, T30_ERR_UNEXPECTED);
+ /*endif*/
}
/*- End of function --------------------------------------------------------*/
@@ -2677,6 +2961,7 @@ static void unexpected_final_frame(t30_state_t *s, const uint8_t *msg, int len)
span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected %s frame in state %s\n", t30_frametype(msg[2]), state_names[s->state]);
if (s->current_status == T30_ERR_OK)
t30_set_status(s, T30_ERR_UNEXPECTED);
+ /*endif*/
send_dcn(s);
}
/*- End of function --------------------------------------------------------*/
@@ -2686,6 +2971,7 @@ static void unexpected_frame_length(t30_state_t *s, const uint8_t *msg, int len)
span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected %s frame length - %d\n", t30_frametype(msg[0]), len);
if (s->current_status == T30_ERR_OK)
t30_set_status(s, T30_ERR_UNEXPECTED);
+ /*endif*/
send_dcn(s);
}
/*- End of function --------------------------------------------------------*/
@@ -2700,6 +2986,7 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
send_dcn(s);
return -1;
}
+ /*endif*/
if (s->phase_b_handler)
{
new_status = s->phase_b_handler(s->phase_b_user_data, msg[2]);
@@ -2711,7 +2998,9 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
send_dcn(s);
return -1;
}
+ /*endif*/
}
+ /*endif*/
/* Try to send something */
if (s->tx_file[0])
{
@@ -2723,17 +3012,20 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
send_dcn(s);
return -1;
}
+ /*endif*/
if (start_sending_document(s))
{
send_dcn(s);
return -1;
}
+ /*endif*/
if (build_dcs(s))
{
span_log(&s->logging, SPAN_LOG_FLOW, "The far end is incompatible\n", s->tx_file);
send_dcn(s);
return -1;
}
+ /*endif*/
/* Start document transmission */
span_log(&s->logging,
SPAN_LOG_FLOW,
@@ -2745,6 +3037,7 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
send_dcs_sequence(s, true);
return 0;
}
+ /*endif*/
span_log(&s->logging, SPAN_LOG_FLOW, "%s - nothing to send\n", t30_frametype(msg[2]));
/* ... then try to receive something */
if (s->rx_file[0])
@@ -2757,21 +3050,25 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
send_dcn(s);
return -1;
}
+ /*endif*/
if (start_receiving_document(s))
{
send_dcn(s);
return -1;
}
+ /*endif*/
if (set_dis_or_dtc(s))
{
t30_set_status(s, T30_ERR_INCOMPATIBLE);
send_dcn(s);
return -1;
}
+ /*endif*/
s->retries = 0;
send_dis_or_dtc_sequence(s, true);
return 0;
}
+ /*endif*/
span_log(&s->logging, SPAN_LOG_FLOW, "%s - nothing to receive\n", t30_frametype(msg[2]));
/* There is nothing to do, or nothing we are able to do. */
send_dcn(s);
@@ -2788,6 +3085,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
send_dcn(s);
return -1;
}
+ /*endif*/
if (s->phase_b_handler)
{
@@ -2800,7 +3098,9 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
send_dcn(s);
return -1;
}
+ /*endif*/
}
+ /*endif*/
/* Start document reception */
span_log(&s->logging,
SPAN_LOG_FLOW,
@@ -2815,6 +3115,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
send_dcn(s);
return -1;
}
+ /*endif*/
if (s->operation_in_progress != OPERATION_IN_PROGRESS_T4_RX)
{
if (t4_rx_init(&s->t4.rx, s->rx_file, s->supported_output_compressions) == NULL)
@@ -2824,8 +3125,10 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
send_dcn(s);
return -1;
}
+ /*endif*/
s->operation_in_progress = OPERATION_IN_PROGRESS_T4_RX;
}
+ /*endif*/
if (!(s->iaf & T30_IAF_MODE_NO_TCF))
{
/* TCF is always sent with long training */
@@ -2834,6 +3137,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
queue_phase(s, T30_PHASE_C_NON_ECM_RX);
timer_t2_start(s);
}
+ /*endif*/
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -2847,6 +3151,7 @@ static int send_response_to_pps(t30_state_t *s)
send_simple_frame(s, T30_MCF);
return true;
}
+ /*endif*/
/* We need to send the PPR frame we have created, to try to fill in the missing/bad data. */
set_state(s, T30_STATE_F_POST_RCP_PPR);
s->ecm_frame_map[0] = ADDRESS_FIELD;
@@ -2875,6 +3180,7 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
span_log(&s->logging, SPAN_LOG_FLOW, "Bad PPS message length %d.\n", len);
return -1;
}
+ /*endif*/
s->last_pps_fcf2 = msg[3] & 0xFE;
/* The frames count is not well specified in T.30. In practice it seems it might be the
@@ -2902,10 +3208,12 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
/* This is probably zero, erroneously rolled over to the maximum count */
frames = 0;
}
+ /*endif*/
}
+ /*endif*/
span_log(&s->logging,
SPAN_LOG_FLOW,
- "Received PPS + %s - page %d, block %d, %d frames\n",
+ "Received PPS-%s - page %d, block %d, %d frames\n",
t30_frametype(msg[3]),
page,
block,
@@ -2935,6 +3243,7 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
/* Clear the ECM buffer */
for (i = 0; i < 256; i++)
s->ecm_len[i] = -1;
+ /*endfor*/
s->ecm_frames = -1;
queue_phase(s, T30_PHASE_D_TX);
set_state(s, T30_STATE_F_POST_RCP_MCF);
@@ -2946,8 +3255,10 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
t30_set_status(s, T30_ERR_RX_ECMPHD);
send_dcn(s);
}
+ /*endif*/
return 0;
}
+ /*endif*/
/* Build a bit map of which frames we now have stored OK */
first_bad_frame = 256;
@@ -2980,24 +3291,33 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
expected_len = 64;
first = false;
}
+ /*endif*/
/* Check the length is consistent with the first frame */
if (s->ecm_len[frame_no] != expected_len)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Bad length ECM frame - %d\n", s->ecm_len[frame_no]);
s->ecm_len[frame_no] = -1;
}
+ /*endif*/
}
+ /*endif*/
}
+ /*endif*/
if (s->ecm_len[frame_no] < 0)
{
s->ecm_frame_map[i + 3] |= (1 << j);
if (frame_no < first_bad_frame)
first_bad_frame = frame_no;
+ /*endif*/
if (frame_no < s->ecm_frames)
s->error_correcting_mode_retries++;
+ /*endif*/
}
+ /*endif*/
}
+ /*endfor*/
}
+ /*endfor*/
s->rx_ecm_block_ok = (first_bad_frame >= s->ecm_frames);
if (s->rx_ecm_block_ok)
{
@@ -3009,6 +3329,7 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
res = s->document_put_handler(s->document_put_user_data, s->ecm_data[i], s->ecm_len[i]);
else
res = t4_rx_put(&s->t4.rx, s->ecm_data[i], s->ecm_len[i]);
+ /*endif*/
if (res != T4_DECODE_MORE_DATA)
{
/* This is the end of the document */
@@ -3016,10 +3337,13 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
span_log(&s->logging, SPAN_LOG_FLOW, "Document ended with status %d\n", res);
break;
}
+ /*endif*/
}
+ /*endfor*/
/* Clear the ECM buffer */
for (i = 0; i < 256; i++)
s->ecm_len[i] = -1;
+ /*endfor*/
s->ecm_block++;
s->ecm_frames = -1;
@@ -3035,10 +3359,13 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
report_rx_ecm_page_result(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, s->last_pps_fcf2);
+ /*endif*/
rx_start_page(s);
break;
}
+ /*endswitch*/
}
+ /*endif*/
switch (s->last_pps_fcf2)
{
@@ -3048,6 +3375,7 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
if (s->remote_interrupts_allowed)
{
}
+ /*endif*/
/* Fall through */
case T30_NULL:
case T30_MPS:
@@ -3073,13 +3401,17 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
s->end_of_procedure_detected = true;
break;
}
+ /*endswitch*/
}
+ /*endif*/
}
+ /*endif*/
break;
default:
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -3101,6 +3433,7 @@ static void process_rx_ppr(t30_state_t *s, const uint8_t *msg, int len)
terminate_call(s);
return;
}
+ /*endif*/
s->retries = 0;
/* Check which frames are OK, and mark them as OK. */
for (i = 0; i < 32; i++)
@@ -3113,6 +3446,7 @@ static void process_rx_ppr(t30_state_t *s, const uint8_t *msg, int len)
{
if (s->ecm_len[frame_no] >= 0)
s->ecm_progress++;
+ /*endif*/
s->ecm_len[frame_no] = -1;
}
else
@@ -3122,14 +3456,19 @@ static void process_rx_ppr(t30_state_t *s, const uint8_t *msg, int len)
span_log(&s->logging, SPAN_LOG_FLOW, "Frame %d to be resent\n", frame_no);
s->error_correcting_mode_retries++;
}
+ /*endif*/
#if 0
/* Diagnostic: See if the other end is complaining about something we didn't even send this time. */
if (s->ecm_len[frame_no] < 0)
span_log(&s->logging, SPAN_LOG_FLOW, "PPR contains complaint about frame %d, which was not sent\n", frame_no);
+ /*endif*/
#endif
}
+ /*endif*/
}
+ /*endfor*/
}
+ /*endfor*/
if (++s->ppr_count >= PPR_LIMIT_BEFORE_CTC_OR_EOR)
{
/* Continue to correct? */
@@ -3159,6 +3498,7 @@ static void process_rx_ppr(t30_state_t *s, const uint8_t *msg, int len)
span_log(&s->logging, SPAN_LOG_FLOW, "Sending EOR + %s\n", t30_frametype(frame[3]));
send_frame(s, frame, 4);
}
+ /*endif*/
}
else
{
@@ -3167,6 +3507,7 @@ static void process_rx_ppr(t30_state_t *s, const uint8_t *msg, int len)
queue_phase(s, T30_PHASE_C_ECM_TX);
send_first_ecm_frame(s);
}
+ /*endif*/
}
/*- End of function --------------------------------------------------------*/
@@ -3194,14 +3535,17 @@ static void process_rx_fcd(t30_state_t *s, const uint8_t *msg, int len)
/* In case we are just after a CTC/CTR exchange, which kicked us back to long training */
s->short_train = true;
}
+ /*endif*/
/* We have received something, so any missing carrier status is out of date */
if (s->current_status == T30_ERR_RX_NOCARRIER)
t30_set_status(s, T30_ERR_OK);
+ /*endif*/
break;
default:
unexpected_non_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3218,6 +3562,7 @@ static void process_rx_rcp(t30_state_t *s, const uint8_t *msg, int len)
/* We have received something, so any missing carrier status is out of date */
if (s->current_status == T30_ERR_RX_NOCARRIER)
t30_set_status(s, T30_ERR_OK);
+ /*endif*/
break;
case T30_STATE_F_POST_DOC_ECM:
/* Just ignore this. It must be an extra RCP. Several are usually sent, to maximise the chance
@@ -3228,6 +3573,7 @@ static void process_rx_rcp(t30_state_t *s, const uint8_t *msg, int len)
unexpected_non_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3240,35 +3586,48 @@ static void process_rx_fnv(t30_state_t *s, const uint8_t *msg, int len)
/* TODO: analyse the message, as per 5.3.6.2.13 */
if (!span_log_test(&s->logging, SPAN_LOG_FLOW))
return;
+ /*endif*/
log = &s->logging;
if ((msg[3] & 0x01))
span_log(log, SPAN_LOG_FLOW, " Incorrect password (PWD).\n");
+ /*endif*/
if ((msg[3] & 0x02))
span_log(log, SPAN_LOG_FLOW, " Selective polling reference (SEP) not known.\n");
+ /*endif*/
if ((msg[3] & 0x04))
span_log(log, SPAN_LOG_FLOW, " Sub-address (SUB) not known.\n");
+ /*endif*/
if ((msg[3] & 0x08))
span_log(log, SPAN_LOG_FLOW, " Sender identity (SID) not known.\n");
+ /*endif*/
if ((msg[3] & 0x10))
span_log(log, SPAN_LOG_FLOW, " Secure fax error.\n");
+ /*endif*/
if ((msg[3] & 0x20))
span_log(log, SPAN_LOG_FLOW, " Transmitting subscriber identity (TSI) not accepted.\n");
+ /*endif*/
if ((msg[3] & 0x40))
span_log(log, SPAN_LOG_FLOW, " Polled sub-address (PSA) not known.\n");
+ /*endif*/
if (len > 4 && (msg[3] & DISBIT8))
{
if ((msg[4] & 0x01))
span_log(log, SPAN_LOG_FLOW, " BFT negotiations request not accepted.\n");
+ /*endif*/
if ((msg[4] & 0x02))
span_log(log, SPAN_LOG_FLOW, " Internet routing address (IRA) not known.\n");
+ /*endif*/
if ((msg[4] & 0x04))
span_log(log, SPAN_LOG_FLOW, " Internet selective polling address (ISP) not known.\n");
+ /*endif*/
}
+ /*endif*/
if (len > 5)
{
span_log(log, SPAN_LOG_FLOW, " FNV sequence number %d.\n", msg[5]);
}
+ /*endif*/
if (len > 6)
{
switch (msg[6])
@@ -3301,12 +3660,15 @@ static void process_rx_fnv(t30_state_t *s, const uint8_t *msg, int len)
x = "???";
break;
}
+ /*endswitch*/
span_log(log, SPAN_LOG_FLOW, " FNV diagnostic info type %s.\n", x);
}
+ /*endif*/
if (len > 7)
{
span_log(log, SPAN_LOG_FLOW, " FNV length %d.\n", msg[7]);
}
+ /*endif*/
/* We've decoded it, but we don't yet know how to deal with it, so treat it as unexpected */
unexpected_final_frame(s, msg, len);
}
@@ -3343,6 +3705,7 @@ static void process_state_answering(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3367,6 +3730,7 @@ static void process_state_b(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3391,6 +3755,7 @@ static void process_state_c(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3417,6 +3782,7 @@ static void process_state_d(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3443,6 +3809,7 @@ static void process_state_d_tcf(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3469,6 +3836,7 @@ static void process_state_d_post_tcf(t30_state_t *s, const uint8_t *msg, int len
set_state(s, T30_STATE_I);
queue_phase(s, T30_PHASE_C_NON_ECM_TX);
}
+ /*endif*/
break;
case T30_FTT:
/* Trainability test failed. Try again. */
@@ -3482,6 +3850,7 @@ static void process_state_d_post_tcf(t30_state_t *s, const uint8_t *msg, int len
send_dcn(s);
break;
}
+ /*endif*/
queue_phase(s, T30_PHASE_B_TX);
send_dcs_sequence(s, true);
break;
@@ -3494,6 +3863,7 @@ static void process_state_d_post_tcf(t30_state_t *s, const uint8_t *msg, int len
send_dcn(s);
break;
}
+ /*endif*/
span_log(&s->logging, SPAN_LOG_FLOW, "Retry number %d\n", s->retries);
queue_phase(s, T30_PHASE_B_TX);
/* TODO: should we reassess the new DIS message, and possibly adjust the DCS we use? */
@@ -3514,6 +3884,7 @@ static void process_state_d_post_tcf(t30_state_t *s, const uint8_t *msg, int len
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3536,6 +3907,7 @@ static void process_state_f_tcf(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3562,6 +3934,7 @@ static void process_state_f_cfr(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3587,6 +3960,7 @@ static void process_state_f_ftt(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3612,6 +3986,7 @@ static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int
if (s->remote_interrupts_allowed)
{
}
+ /*endif*/
/* Fall through */
case T30_MPS:
if (s->image_carrier_attempted)
@@ -3619,6 +3994,7 @@ static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int
/* Treat this as a bad quality page. */
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
s->next_rx_step = fcf;
s->last_rx_page_result = T30_RTN;
queue_phase(s, T30_PHASE_D_TX);
@@ -3630,11 +4006,13 @@ static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int
/* This appears to be a retry, because the far end didn't see our last response */
repeat_last_command(s);
}
+ /*endif*/
break;
case T30_PRI_EOM:
if (s->remote_interrupts_allowed)
{
}
+ /*endif*/
/* Fall through */
case T30_EOM:
case T30_EOS:
@@ -3643,6 +4021,7 @@ static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int
/* Treat this as a bad quality page. */
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
s->next_rx_step = fcf;
s->last_rx_page_result = T30_RTN;
/* Return to phase B */
@@ -3655,11 +4034,13 @@ static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int
/* This appears to be a retry, because the far end didn't see our last response */
repeat_last_command(s);
}
+ /*endif*/
break;
case T30_PRI_EOP:
if (s->remote_interrupts_allowed)
{
}
+ /*endif*/
/* Fall through */
case T30_EOP:
if (s->image_carrier_attempted)
@@ -3667,6 +4048,7 @@ static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int
/* Treat this as a bad quality page. */
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
s->next_rx_step = fcf;
s->last_rx_page_result = T30_RTN;
queue_phase(s, T30_PHASE_D_TX);
@@ -3678,6 +4060,7 @@ static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int
/* This appears to be a retry, because the far end didn't see our last response */
repeat_last_command(s);
}
+ /*endif*/
break;
case T30_DCN:
t30_set_status(s, T30_ERR_RX_DCNDATA);
@@ -3695,6 +4078,7 @@ static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3716,15 +4100,19 @@ static void assess_copy_quality(t30_state_t *s, uint8_t fcf)
/* Some people want to keep even the bad pages */
if (s->keep_bad_pages)
rx_end_page(s);
+ /*endif*/
break;
}
+ /*endswitch*/
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
if (fcf == T30_EOP)
terminate_operation_in_progress(s);
else
rx_start_page(s);
+ /*endif*/
switch (quality)
{
@@ -3740,6 +4128,7 @@ static void assess_copy_quality(t30_state_t *s, uint8_t fcf)
s->last_rx_page_result = T30_RTN;
break;
}
+ /*endswitch*/
set_state(s, T30_STATE_III_Q);
send_simple_frame(s, s->last_rx_page_result);
}
@@ -3756,6 +4145,7 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg,
if (s->remote_interrupts_allowed)
{
}
+ /*endif*/
/* Fall through */
case T30_MPS:
s->next_rx_step = fcf;
@@ -3766,6 +4156,7 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg,
if (s->remote_interrupts_allowed)
{
}
+ /*endif*/
/* Fall through */
case T30_EOM:
case T30_EOS:
@@ -3778,6 +4169,7 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg,
if (s->remote_interrupts_allowed)
{
}
+ /*endif*/
/* Fall through */
case T30_EOP:
span_log(&s->logging, SPAN_LOG_FLOW, "End of procedure detected\n");
@@ -3806,6 +4198,7 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg,
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3835,6 +4228,7 @@ static void process_state_f_doc_and_post_doc_ecm(t30_state_t *s, const uint8_t *
unexpected_frame_length(s, msg, len);
break;
}
+ /*endif*/
fcf2 = msg[3] & 0xFE;
span_log(&s->logging, SPAN_LOG_FLOW, "Received EOR + %s\n", t30_frametype(msg[3]));
switch (fcf2)
@@ -3846,6 +4240,7 @@ static void process_state_f_doc_and_post_doc_ecm(t30_state_t *s, const uint8_t *
{
/* TODO: Alert operator */
}
+ /*endif*/
/* Fall through */
case T30_NULL:
case T30_EOP:
@@ -3862,6 +4257,7 @@ static void process_state_f_doc_and_post_doc_ecm(t30_state_t *s, const uint8_t *
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
break;
case T30_PPS:
process_rx_pps(s, msg, len);
@@ -3872,7 +4268,9 @@ static void process_state_f_doc_and_post_doc_ecm(t30_state_t *s, const uint8_t *
span_log(&s->logging, SPAN_LOG_FLOW, "Modem changed in CTC.\n");
if ((s->current_fallback = find_fallback_entry(msg[4] & (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3))) < 0)
span_log(&s->logging, SPAN_LOG_FLOW, "Remote asked for a modem standard we do not support\n");
+ /*endif*/
}
+ /*endif*/
s->image_carrier_attempted = false;
/* T.30 says we change back to long training here, whether or not the far end changed the modem type. */
s->short_train = false;
@@ -3898,6 +4296,7 @@ static void process_state_f_doc_and_post_doc_ecm(t30_state_t *s, const uint8_t *
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3922,6 +4321,7 @@ static void process_state_f_post_rcp_mcf(t30_state_t *s, const uint8_t *msg, int
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3943,6 +4343,7 @@ static void process_state_f_post_rcp_ppr(t30_state_t *s, const uint8_t *msg, int
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -3974,8 +4375,11 @@ static void process_state_f_post_rcp_rnr(t30_state_t *s, const uint8_t *msg, int
s->end_of_procedure_detected = true;
break;
}
+ /*endswitch*/
}
+ /*endif*/
}
+ /*endif*/
break;
case T30_CRP:
repeat_last_command(s);
@@ -3988,6 +4392,7 @@ static void process_state_f_post_rcp_rnr(t30_state_t *s, const uint8_t *msg, int
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4020,6 +4425,7 @@ static void process_state_r(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4049,6 +4455,7 @@ static void process_state_t(t30_state_t *s, const uint8_t *msg, int len)
t30_set_status(s, T30_ERR_TX_NODIS);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4070,6 +4477,7 @@ static void process_state_i(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4091,6 +4499,7 @@ static void process_state_ii(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4110,7 +4519,9 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
s->phase_d_handler(s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
+ /*endif*/
}
+ /*endif*/
/* Fall through */
case T30_MCF:
switch (s->next_tx_step)
@@ -4120,12 +4531,14 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
/* Transmit the next page */
if (tx_start_page(s))
{
/* TODO: recover */
break;
}
+ /*endif*/
set_state(s, T30_STATE_I);
queue_phase(s, T30_PHASE_C_NON_ECM_TX);
break;
@@ -4135,6 +4548,7 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
terminate_operation_in_progress(s);
report_tx_result(s, true);
return_to_phase_b(s, false);
@@ -4144,11 +4558,13 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
terminate_operation_in_progress(s);
send_dcn(s);
report_tx_result(s, true);
break;
}
+ /*endswitch*/
break;
case T30_RTP:
s->rtp_events++;
@@ -4159,11 +4575,13 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
if (tx_start_page(s))
{
/* TODO: recover */
break;
}
+ /*endif*/
/* Send fresh training, and then the next page */
if (step_fallback_entry(s) < 0)
{
@@ -4172,6 +4590,7 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
send_dcn(s);
break;
}
+ /*endif*/
queue_phase(s, T30_PHASE_B_TX);
restart_sending_document(s);
break;
@@ -4181,6 +4600,7 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
t4_tx_release(&s->t4.tx);
/* TODO: should go back to T, and resend */
return_to_phase_b(s, true);
@@ -4190,10 +4610,12 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
t4_tx_release(&s->t4.tx);
send_dcn(s);
break;
}
+ /*endswitch*/
break;
case T30_PIN:
if (s->remote_interrupts_allowed)
@@ -4204,7 +4626,9 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
s->phase_d_handler(s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
+ /*endif*/
}
+ /*endif*/
/* Fall through */
case T30_RTN:
s->rtn_events++;
@@ -4215,6 +4639,7 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
s->retries = 0;
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
if (!s->retransmit_capable)
{
/* Send the next page, regardless of the problem with the current one. */
@@ -4223,7 +4648,9 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
/* TODO: recover */
break;
}
+ /*endif*/
}
+ /*endif*/
/* Send fresh training */
if (step_fallback_entry(s) < 0)
{
@@ -4232,6 +4659,7 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
send_dcn(s);
break;
}
+ /*endif*/
queue_phase(s, T30_PHASE_B_TX);
restart_sending_document(s);
break;
@@ -4241,6 +4669,7 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
s->retries = 0;
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
if (s->retransmit_capable)
{
/* Wait for DIS */
@@ -4249,12 +4678,14 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
{
return_to_phase_b(s, true);
}
+ /*endif*/
break;
case T30_PRI_EOP:
case T30_EOP:
s->retries = 0;
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
if (s->retransmit_capable)
{
/* Send fresh training, and then repeat the last page */
@@ -4265,6 +4696,7 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
send_dcn(s);
break;
}
+ /*endif*/
queue_phase(s, T30_PHASE_B_TX);
restart_sending_document(s);
}
@@ -4272,8 +4704,10 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
{
send_dcn(s);
}
+ /*endif*/
break;
}
+ /*endswitch*/
break;
case T30_DCN:
switch (s->next_tx_step)
@@ -4298,12 +4732,28 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
case T30_FNV:
process_rx_fnv(s, msg, len);
break;
+ case T30_MPS:
+ case T30_PRI_EOM:
+ case T30_EOM:
+ case T30_EOS:
+ case T30_PRI_EOP:
+ case T30_EOP:
+ if (fcf == s->next_tx_step)
+ {
+ /* It looks like we have received an echo of what we just sent */
+ span_log(&s->logging, SPAN_LOG_FLOW, "Received an echo of our own %s\n", t30_frametype(fcf));
+ timer_t4_start(s);
+ break;
+ }
+ /*endif*/
+ /* Fall through */
default:
/* We don't know what to do with this. */
t30_set_status(s, T30_ERR_TX_INVALRSP);
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4326,6 +4776,7 @@ static void process_state_iii_q(t30_state_t *s, const uint8_t *msg, int len)
case T30_DIS:
if (msg[2] == T30_DTC)
process_rx_dis_dtc(s, msg, len);
+ /*endif*/
break;
case T30_CRP:
repeat_last_command(s);
@@ -4336,6 +4787,7 @@ static void process_state_iii_q(t30_state_t *s, const uint8_t *msg, int len)
case T30_DCN:
if (s->last_rx_page_result == T30_RTN)
t30_set_status(s, T30_ERR_RX_DCNNORTN);
+ /*endif*/
terminate_call(s);
break;
default:
@@ -4343,6 +4795,7 @@ static void process_state_iii_q(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4364,6 +4817,7 @@ static void process_state_iv(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4397,17 +4851,20 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
if (tx_start_page(s))
{
/* TODO: recover */
break;
}
+ /*endif*/
if (get_partial_ecm_page(s) > 0)
{
set_state(s, T30_STATE_IV);
queue_phase(s, T30_PHASE_C_ECM_TX);
send_first_ecm_frame(s);
}
+ /*endif*/
break;
case T30_PRI_EOM:
case T30_EOM:
@@ -4415,6 +4872,7 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
terminate_operation_in_progress(s);
report_tx_result(s, true);
return_to_phase_b(s, false);
@@ -4424,12 +4882,15 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
terminate_operation_in_progress(s);
send_dcn(s);
report_tx_result(s, true);
break;
}
+ /*endswitch*/
}
+ /*endif*/
break;
case T30_PPR:
process_rx_ppr(s, msg, len);
@@ -4437,6 +4898,7 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le
case T30_RNR:
if (s->timer_t5 == 0)
s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5);
+ /*endif*/
queue_phase(s, T30_PHASE_D_TX);
set_state(s, T30_STATE_IV_PPS_RNR);
send_rr(s);
@@ -4451,12 +4913,23 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le
case T30_FNV:
process_rx_fnv(s, msg, len);
break;
+ case T30_PPS:
+ if (msg[3] == s->next_tx_step)
+ {
+ /* It looks like we have received an echo of what we just sent */
+ span_log(&s->logging, SPAN_LOG_FLOW, "Received an echo of our own PPS-%s\n", t30_frametype(msg[3]));
+ timer_t4_start(s);
+ break;
+ }
+ /*endif*/
+ /* Fall through */
default:
/* We don't know what to do with this. */
unexpected_final_frame(s, msg, len);
t30_set_status(s, T30_ERR_TX_ECMPHD);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4476,7 +4949,9 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
s->phase_d_handler(s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
+ /*endif*/
}
+ /*endif*/
/* Fall through */
case T30_MCF:
s->retries = 0;
@@ -4501,17 +4976,20 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
if (tx_start_page(s))
{
/* TODO: recover */
break;
}
+ /*endif*/
if (get_partial_ecm_page(s) > 0)
{
set_state(s, T30_STATE_IV);
queue_phase(s, T30_PHASE_C_ECM_TX);
send_first_ecm_frame(s);
}
+ /*endif*/
break;
case T30_PRI_EOM:
case T30_EOM:
@@ -4519,6 +4997,7 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
terminate_operation_in_progress(s);
report_tx_result(s, true);
return_to_phase_b(s, false);
@@ -4528,16 +5007,20 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
terminate_operation_in_progress(s);
send_dcn(s);
report_tx_result(s, true);
break;
}
+ /*endswitch*/
}
+ /*endif*/
break;
case T30_RNR:
if (s->timer_t5 == 0)
s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5);
+ /*endif*/
queue_phase(s, T30_PHASE_D_TX);
set_state(s, T30_STATE_IV_PPS_RNR);
send_rr(s);
@@ -4555,6 +5038,19 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
case T30_FNV:
process_rx_fnv(s, msg, len);
break;
+ case T30_PPS:
+ if (msg[3] == s->next_tx_step)
+ {
+ /* It looks like we have received an echo of what we just sent */
+ span_log(&s->logging, SPAN_LOG_FLOW, "Received an echo of our own PPS-%s\n", t30_frametype(msg[3]));
+ timer_t4_start(s);
+ break;
+ }
+ /*endif*/
+ /* We don't know what to do with this. */
+ unexpected_final_frame(s, msg, len);
+ t30_set_status(s, T30_ERR_TX_ECMPHD);
+ break;
case T30_PIN:
if (s->remote_interrupts_allowed)
{
@@ -4564,7 +5060,9 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
s->phase_d_handler(s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
+ /*endif*/
}
+ /*endif*/
/* Fall through */
default:
/* We don't know what to do with this. */
@@ -4572,6 +5070,7 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
t30_set_status(s, T30_ERR_TX_ECMPHD);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4591,7 +5090,9 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len
s->phase_d_handler(s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
+ /*endif*/
}
+ /*endif*/
/* Fall through */
case T30_MCF:
s->retries = 0;
@@ -4616,17 +5117,20 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
if (tx_start_page(s))
{
/* TODO: recover */
break;
}
+ /*endif*/
if (get_partial_ecm_page(s) > 0)
{
set_state(s, T30_STATE_IV);
queue_phase(s, T30_PHASE_C_ECM_TX);
send_first_ecm_frame(s);
}
+ /*endif*/
break;
case T30_PRI_EOM:
case T30_EOM:
@@ -4634,6 +5138,7 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
terminate_operation_in_progress(s);
report_tx_result(s, true);
return_to_phase_b(s, false);
@@ -4643,16 +5148,20 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len
tx_end_page(s);
if (s->phase_d_handler)
s->phase_d_handler(s->phase_d_user_data, fcf);
+ /*endif*/
terminate_operation_in_progress(s);
send_dcn(s);
report_tx_result(s, true);
break;
}
+ /*endswitch*/
}
+ /*endif*/
break;
case T30_RNR:
if (s->timer_t5 == 0)
s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5);
+ /*endif*/
queue_phase(s, T30_PHASE_D_TX);
set_state(s, T30_STATE_IV_PPS_RNR);
send_rr(s);
@@ -4667,6 +5176,18 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len
case T30_FNV:
process_rx_fnv(s, msg, len);
break;
+ case T30_PPS:
+ if (msg[3] == s->next_tx_step)
+ {
+ /* It looks like we have received an echo of what we just sent */
+ span_log(&s->logging, SPAN_LOG_FLOW, "Received an echo of our own PPS-%s\n", t30_frametype(msg[3]));
+ timer_t4_start(s);
+ break;
+ }
+ /*endif*/
+ /* We don't know what to do with this. */
+ unexpected_final_frame(s, msg, len);
+ break;
case T30_PIN:
if (s->remote_interrupts_allowed)
{
@@ -4676,13 +5197,16 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len
s->phase_d_handler(s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
+ /*endif*/
}
+ /*endif*/
/* Fall through */
default:
/* We don't know what to do with this. */
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4713,6 +5237,7 @@ static void process_state_iv_ctc(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4726,6 +5251,7 @@ static void process_state_iv_eor(t30_state_t *s, const uint8_t *msg, int len)
case T30_RNR:
if (s->timer_t5 == 0)
s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5);
+ /*endif*/
queue_phase(s, T30_PHASE_D_TX);
set_state(s, T30_STATE_IV_EOR_RNR);
send_rr(s);
@@ -4751,13 +5277,16 @@ static void process_state_iv_eor(t30_state_t *s, const uint8_t *msg, int len)
s->phase_d_handler(s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
+ /*endif*/
}
+ /*endif*/
/* Fall through */
default:
/* We don't know what to do with this. */
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4771,6 +5300,7 @@ static void process_state_iv_eor_rnr(t30_state_t *s, const uint8_t *msg, int len
case T30_RNR:
if (s->timer_t5 == 0)
s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5);
+ /*endif*/
queue_phase(s, T30_PHASE_D_TX);
set_state(s, T30_STATE_IV_EOR_RNR);
send_rr(s);
@@ -4800,13 +5330,16 @@ static void process_state_iv_eor_rnr(t30_state_t *s, const uint8_t *msg, int len
s->phase_d_handler(s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
+ /*endif*/
}
+ /*endif*/
/* Fall through */
default:
/* We don't know what to do with this. */
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -4823,7 +5356,7 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
print_frame(s, "Rx: ", msg, len);
if (s->real_time_frame_handler)
s->real_time_frame_handler(s->real_time_frame_user_data, true, msg, len);
-
+ /*endif*/
if ((msg[1] & 0x10) == 0)
{
/* This is not a final frame */
@@ -4837,17 +5370,19 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
{
case TIMER_IS_T1A:
case TIMER_IS_T2:
- case TIMER_IS_T2A:
- case TIMER_IS_T2B:
- timer_t2a_start(s);
+ case TIMER_IS_T2_FLAGGED:
+ case TIMER_IS_T2_DROPPED:
+ timer_t2_flagged_start(s);
break;
case TIMER_IS_T4:
- case TIMER_IS_T4A:
- case TIMER_IS_T4B:
- timer_t4a_start(s);
+ case TIMER_IS_T4_FLAGGED:
+ case TIMER_IS_T4_DROPPED:
+ timer_t4_flagged_start(s);
break;
}
+ /*endswitch*/
}
+ /*endif*/
/* The following handles all the message types we expect to get without
a final frame tag. If we get one that T.30 says we should not expect
in a particular context, its pretty harmless, so don't worry. */
@@ -4868,10 +5403,13 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
t35_decode(&msg[3], len - 3, &s->country, &s->vendor, &s->model);
if (s->country)
span_log(&s->logging, SPAN_LOG_FLOW, "The remote was made in '%s'\n", s->country);
+ /*endif*/
if (s->vendor)
span_log(&s->logging, SPAN_LOG_FLOW, "The remote was made by '%s'\n", s->vendor);
+ /*endif*/
if (s->model)
span_log(&s->logging, SPAN_LOG_FLOW, "The remote is a '%s'\n", s->model);
+ /*endif*/
s->rx_info.nsf_len = decode_nsf_nss_nsc(s, &s->rx_info.nsf, &msg[2], len - 2);
}
else
@@ -4880,6 +5418,7 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
/* OK in (NSC) (CIG) DTC */
s->rx_info.nsc_len = decode_nsf_nss_nsc(s, &s->rx_info.nsc, &msg[2], len - 2);
}
+ /*endif*/
break;
case (T30_PWD & 0xFE):
if (msg[2] == T30_PWD)
@@ -4893,6 +5432,7 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
{
unexpected_non_final_frame(s, msg, len);
}
+ /*endif*/
break;
case (T30_SEP & 0xFE):
if (msg[2] == T30_SEP)
@@ -4905,6 +5445,7 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
{
unexpected_non_final_frame(s, msg, len);
}
+ /*endif*/
break;
case (T30_PSA & 0xFE):
if (msg[2] == T30_PSA)
@@ -4916,6 +5457,7 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
{
unexpected_non_final_frame(s, msg, len);
}
+ /*endif*/
break;
case (T30_CIA & 0xFE):
if (msg[2] == T30_CIA)
@@ -4927,6 +5469,7 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
{
unexpected_non_final_frame(s, msg, len);
}
+ /*endif*/
break;
case (T30_ISP & 0xFE):
if (msg[2] == T30_ISP)
@@ -4938,6 +5481,7 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
{
unexpected_non_final_frame(s, msg, len);
}
+ /*endif*/
break;
case (T30_TSI & 0xFE):
/* Transmitting subscriber identity */
@@ -4981,6 +5525,7 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
unexpected_non_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
else
{
@@ -5089,7 +5634,9 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
unexpected_final_frame(s, msg, len);
break;
}
+ /*endswitch*/
}
+ /*endif*/
}
/*- End of function --------------------------------------------------------*/
@@ -5105,7 +5652,9 @@ static void queue_phase(t30_state_t *s, int phase)
phase */
if (s->send_hdlc_handler)
s->send_hdlc_handler(s->send_hdlc_user_data, NULL, -1);
+ /*endif*/
}
+ /*endif*/
s->next_phase = phase;
span_log(&s->logging, SPAN_LOG_FLOW, "Queuing phase %s\n", phase_names[s->next_phase]);
}
@@ -5114,6 +5663,7 @@ static void queue_phase(t30_state_t *s, int phase)
/* We don't need to queue the new phase. We can change to it immediately. */
set_phase(s, phase);
}
+ /*endif*/
}
/*- End of function --------------------------------------------------------*/
@@ -5126,13 +5676,16 @@ static void set_phase(t30_state_t *s, int phase)
phase */
if (s->send_hdlc_handler)
s->send_hdlc_handler(s->send_hdlc_user_data, NULL, -1);
+ /*endif*/
}
+ /*endif*/
span_log(&s->logging, SPAN_LOG_FLOW, "Changing from phase %s to %s\n", phase_names[s->phase], phase_names[phase]);
/* We may be killing a receiver before it has declared the end of the
signal. Force the signal present indicator to off, because the
receiver will never be able to. */
if (s->phase != T30_PHASE_A_CED && s->phase != T30_PHASE_A_CNG)
s->rx_signal_present = false;
+ /*endif*/
s->rx_trained = false;
s->rx_frame_received = false;
s->phase = phase;
@@ -5142,21 +5695,27 @@ static void set_phase(t30_state_t *s, int phase)
case T30_PHASE_A_CED:
if (s->set_rx_type_handler)
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, false, true);
+ /*endif*/
if (s->set_tx_type_handler)
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_CED, 0, false, false);
+ /*endif*/
break;
case T30_PHASE_A_CNG:
if (s->set_rx_type_handler)
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, false, true);
+ /*endif*/
if (s->set_tx_type_handler)
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_CNG, 0, false, false);
+ /*endif*/
break;
case T30_PHASE_B_RX:
case T30_PHASE_D_RX:
if (s->set_rx_type_handler)
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, false, true);
+ /*endif*/
if (s->set_tx_type_handler)
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, false, false);
+ /*endif*/
break;
case T30_PHASE_B_TX:
case T30_PHASE_D_TX:
@@ -5165,10 +5724,13 @@ static void set_phase(t30_state_t *s, int phase)
s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T1);
s->far_end_detected = true;
}
+ /*endif*/
if (s->set_rx_type_handler)
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, false, false);
+ /*endif*/
if (s->set_tx_type_handler)
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_V21, 300, false, true);
+ /*endif*/
break;
case T30_PHASE_C_NON_ECM_RX:
if (s->set_rx_type_handler)
@@ -5179,8 +5741,10 @@ static void set_phase(t30_state_t *s, int phase)
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, false, false);
s->set_rx_type_handler(s->set_rx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, false);
}
+ /*endif*/
if (s->set_tx_type_handler)
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, false, false);
+ /*endif*/
break;
case T30_PHASE_C_NON_ECM_TX:
/* Pause before switching from anything to phase C */
@@ -5195,21 +5759,27 @@ static void set_phase(t30_state_t *s, int phase)
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, false, false);
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, false, false);
}
+ /*endif*/
if (s->set_tx_type_handler)
s->set_tx_type_handler(s->set_tx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, false);
+ /*endif*/
break;
case T30_PHASE_C_ECM_RX:
if (s->set_rx_type_handler)
s->set_rx_type_handler(s->set_rx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, true);
+ /*endif*/
if (s->set_tx_type_handler)
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, false, false);
+ /*endif*/
break;
case T30_PHASE_C_ECM_TX:
/* Pause before switching from anything to phase C */
if (s->set_rx_type_handler)
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, false, false);
+ /*endif*/
if (s->set_tx_type_handler)
s->set_tx_type_handler(s->set_tx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, true);
+ /*endif*/
break;
case T30_PHASE_E:
/* Send a little silence before ending things, to ensure the buffers are flushed all they way
@@ -5219,16 +5789,21 @@ static void set_phase(t30_state_t *s, int phase)
s->tcf_most_zeros = 0;
if (s->set_rx_type_handler)
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, false, false);
+ /*endif*/
if (s->set_tx_type_handler)
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_PAUSE, 0, FINAL_FLUSH_TIME, false);
+ /*endif*/
break;
case T30_PHASE_CALL_FINISHED:
if (s->set_rx_type_handler)
s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_DONE, 0, false, false);
+ /*endif*/
if (s->set_tx_type_handler)
s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_DONE, 0, false, false);
+ /*endif*/
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -5239,6 +5814,7 @@ static void set_state(t30_state_t *s, int state)
span_log(&s->logging, SPAN_LOG_FLOW, "Changing from state %s to %s\n", state_names[s->state], state_names[state]);
s->state = state;
}
+ /*endif*/
s->step = 0;
}
/*- End of function --------------------------------------------------------*/
@@ -5266,9 +5842,11 @@ static void repeat_last_command(t30_state_t *s)
t30_set_status(s, T30_ERR_RETRYDCN);
break;
}
+ /*endswitch*/
send_dcn(s);
return;
}
+ /*endif*/
span_log(&s->logging, SPAN_LOG_FLOW, "Retry number %d\n", s->retries);
switch (s->state)
{
@@ -5314,6 +5892,14 @@ static void repeat_last_command(t30_state_t *s)
queue_phase(s, T30_PHASE_B_TX);
send_dcs_sequence(s, true);
break;
+ case T30_STATE_F_POST_RCP_PPR:
+ queue_phase(s, T30_PHASE_D_TX);
+ send_frame(s, s->ecm_frame_map, 3 + 32);
+ break;
+ case T30_STATE_F_POST_RCP_MCF:
+ queue_phase(s, T30_PHASE_D_TX);
+ send_simple_frame(s, T30_MCF);
+ break;
case T30_STATE_F_POST_RCP_RNR:
/* Just ignore */
break;
@@ -5325,6 +5911,7 @@ static void repeat_last_command(t30_state_t *s)
state_names[s->state]);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -5336,7 +5923,7 @@ static void timer_t2_start(t30_state_t *s)
}
/*- End of function --------------------------------------------------------*/
-static void timer_t2a_start(t30_state_t *s)
+static void timer_t2_flagged_start(t30_state_t *s)
{
/* T.30 Annex A says timeout T1 should be used in ECM phase C to time out the
first frame after the flags start. This seems a strange reuse of the name T1
@@ -5349,18 +5936,19 @@ static void timer_t2a_start(t30_state_t *s)
}
else
{
- span_log(&s->logging, SPAN_LOG_FLOW, "Start T2A\n");
- s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T2A);
- s->timer_t2_t4_is = TIMER_IS_T2A;
+ span_log(&s->logging, SPAN_LOG_FLOW, "Start T2-flagged\n");
+ s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T2_FLAGGED);
+ s->timer_t2_t4_is = TIMER_IS_T2_FLAGGED;
}
+ /*endif*/
}
/*- End of function --------------------------------------------------------*/
-static void timer_t2b_start(t30_state_t *s)
+static void timer_t2_dropped_start(t30_state_t *s)
{
- span_log(&s->logging, SPAN_LOG_FLOW, "Start T2B\n");
- s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T2B);
- s->timer_t2_t4_is = TIMER_IS_T2B;
+ span_log(&s->logging, SPAN_LOG_FLOW, "Start T2-dropped\n");
+ s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T2_DROPPED);
+ s->timer_t2_t4_is = TIMER_IS_T2_DROPPED;
}
/*- End of function --------------------------------------------------------*/
@@ -5372,19 +5960,19 @@ static void timer_t4_start(t30_state_t *s)
}
/*- End of function --------------------------------------------------------*/
-static void timer_t4a_start(t30_state_t *s)
+static void timer_t4_flagged_start(t30_state_t *s)
{
- span_log(&s->logging, SPAN_LOG_FLOW, "Start T4A\n");
- s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T4A);
- s->timer_t2_t4_is = TIMER_IS_T4A;
+ span_log(&s->logging, SPAN_LOG_FLOW, "Start T4-flagged\n");
+ s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T4_FLAGGED);
+ s->timer_t2_t4_is = TIMER_IS_T4_FLAGGED;
}
/*- End of function --------------------------------------------------------*/
-static void timer_t4b_start(t30_state_t *s)
+static void timer_t4_dropped_start(t30_state_t *s)
{
- span_log(&s->logging, SPAN_LOG_FLOW, "Start T4B\n");
- s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T4B);
- s->timer_t2_t4_is = TIMER_IS_T4B;
+ span_log(&s->logging, SPAN_LOG_FLOW, "Start T4-dropped\n");
+ s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T4_DROPPED);
+ s->timer_t2_t4_is = TIMER_IS_T4_DROPPED;
}
/*- End of function --------------------------------------------------------*/
@@ -5403,11 +5991,11 @@ static void timer_t2_t4_stop(t30_state_t *s)
case TIMER_IS_T2:
tag = "T2";
break;
- case TIMER_IS_T2A:
- tag = "T2A";
+ case TIMER_IS_T2_FLAGGED:
+ tag = "T2-flagged";
break;
- case TIMER_IS_T2B:
- tag = "T2B";
+ case TIMER_IS_T2_DROPPED:
+ tag = "T2-dropped";
break;
case TIMER_IS_T2C:
tag = "T2C";
@@ -5415,11 +6003,11 @@ static void timer_t2_t4_stop(t30_state_t *s)
case TIMER_IS_T4:
tag = "T4";
break;
- case TIMER_IS_T4A:
- tag = "T4A";
+ case TIMER_IS_T4_FLAGGED:
+ tag = "T4-flagged";
break;
- case TIMER_IS_T4B:
- tag = "T4B";
+ case TIMER_IS_T4_DROPPED:
+ tag = "T4-dropped";
break;
case TIMER_IS_T4C:
tag = "T4C";
@@ -5428,6 +6016,7 @@ static void timer_t2_t4_stop(t30_state_t *s)
tag = "T2/T4";
break;
}
+ /*endswitch*/
span_log(&s->logging, SPAN_LOG_FLOW, "Stop %s (%d remaining)\n", tag, s->timer_t2_t4);
s->timer_t2_t4 = 0;
s->timer_t2_t4_is = TIMER_IS_IDLE;
@@ -5464,6 +6053,7 @@ static void timer_t1_expired(t30_state_t *s)
send_dcn(s);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -5477,8 +6067,9 @@ static void timer_t1a_expired(t30_state_t *s)
static void timer_t2_expired(t30_state_t *s)
{
- if (s->timer_t2_t4_is != TIMER_IS_T2B)
+ if (s->timer_t2_t4_is != TIMER_IS_T2_DROPPED)
span_log(&s->logging, SPAN_LOG_FLOW, "T2 expired in phase %s, state %s\n", phase_names[s->phase], state_names[s->state]);
+ /*endif*/
switch (s->state)
{
case T30_STATE_III_Q:
@@ -5492,12 +6083,13 @@ static void timer_t2_expired(t30_state_t *s)
/* We didn't receive a response to our T30_MCF after T30_EOM, so we must be OK
to proceed to phase B, and pretty much act like its the beginning of a call. */
span_log(&s->logging, SPAN_LOG_FLOW, "Returning to phase B after %s\n", t30_frametype(s->next_rx_step));
+ s->dis_received = false;
set_phase(s, T30_PHASE_B_TX);
timer_t2_start(s);
- s->dis_received = false;
send_dis_or_dtc_sequence(s, true);
return;
}
+ /*endswitch*/
break;
case T30_STATE_F_TCF:
span_log(&s->logging, SPAN_LOG_FLOW, "No TCF data received\n");
@@ -5539,22 +6131,30 @@ static void timer_t2_expired(t30_state_t *s)
case T30_STATE_F_FTT:
break;
}
+ /*endswitch*/
queue_phase(s, T30_PHASE_B_TX);
start_receiving_document(s);
}
/*- End of function --------------------------------------------------------*/
-static void timer_t2a_expired(t30_state_t *s)
+static void timer_t2_flagged_expired(t30_state_t *s)
{
- span_log(&s->logging, SPAN_LOG_FLOW, "T2A expired in phase %s, state %s. An HDLC frame lasted too long.\n", phase_names[s->phase], state_names[s->state]);
+ span_log(&s->logging, SPAN_LOG_FLOW, "T2-flagged expired in phase %s, state %s. An HDLC frame lasted too long.\n", phase_names[s->phase], state_names[s->state]);
t30_set_status(s, T30_ERR_HDLC_CARRIER);
+ /* T.30 says we should retry at this point, but we can't. We would need to
+ wait for the far end to go quiet before sending. Experience says you only
+ get here when the far end is buggy, and it will not go quiet unless you
+ hang up. If we were to retry, how long should we wait for the line to go
+ quiet? T.30 doesn't specify things like that. The only effective strategy,
+ when trying to deal with problems found in logs from real world systems,
+ is to abandon the call. */
terminate_call(s);
}
/*- End of function --------------------------------------------------------*/
-static void timer_t2b_expired(t30_state_t *s)
+static void timer_t2_dropped_expired(t30_state_t *s)
{
- span_log(&s->logging, SPAN_LOG_FLOW, "T2B expired in phase %s, state %s. The line is now quiet.\n", phase_names[s->phase], state_names[s->state]);
+ span_log(&s->logging, SPAN_LOG_FLOW, "T2-dropped expired in phase %s, state %s. The line is now quiet.\n", phase_names[s->phase], state_names[s->state]);
timer_t2_expired(s);
}
/*- End of function --------------------------------------------------------*/
@@ -5571,7 +6171,9 @@ static void timer_t4_expired(t30_state_t *s)
{
/* There was no response (or only a corrupt response) to a command,
within the T4 timeout period. */
- span_log(&s->logging, SPAN_LOG_FLOW, "T4 expired in phase %s, state %s\n", phase_names[s->phase], state_names[s->state]);
+ if (s->timer_t2_t4_is == TIMER_IS_T4)
+ span_log(&s->logging, SPAN_LOG_FLOW, "T4 expired in phase %s, state %s\n", phase_names[s->phase], state_names[s->state]);
+ /*endif*/
/* Of course, things might just be a little late, especially if there are T.38
links in the path. There is no point in simply timing out, and resending,
if we are currently receiving something from the far end - its a half-duplex
@@ -5583,17 +6185,17 @@ static void timer_t4_expired(t30_state_t *s)
}
/*- End of function --------------------------------------------------------*/
-static void timer_t4a_expired(t30_state_t *s)
+static void timer_t4_flagged_expired(t30_state_t *s)
{
- span_log(&s->logging, SPAN_LOG_FLOW, "T4A expired in phase %s, state %s. An HDLC frame lasted too long.\n", phase_names[s->phase], state_names[s->state]);
+ span_log(&s->logging, SPAN_LOG_FLOW, "T4-flagged expired in phase %s, state %s. An HDLC frame lasted too long.\n", phase_names[s->phase], state_names[s->state]);
t30_set_status(s, T30_ERR_HDLC_CARRIER);
terminate_call(s);
}
/*- End of function --------------------------------------------------------*/
-static void timer_t4b_expired(t30_state_t *s)
+static void timer_t4_dropped_expired(t30_state_t *s)
{
- span_log(&s->logging, SPAN_LOG_FLOW, "T4B expired in phase %s, state %s. The line is now quiet.\n", phase_names[s->phase], state_names[s->state]);
+ span_log(&s->logging, SPAN_LOG_FLOW, "T4-dropped expired in phase %s, state %s. The line is now quiet.\n", phase_names[s->phase], state_names[s->state]);
timer_t4_expired(s);
}
/*- End of function --------------------------------------------------------*/
@@ -5614,20 +6216,24 @@ static void decode_20digit_msg(t30_state_t *s, char *msg, const uint8_t *pkt, in
if (msg == NULL)
msg = text;
+ /*endif*/
if (len > T30_MAX_IDENT_LEN + 1)
{
unexpected_frame_length(s, pkt, len);
msg[0] = '\0';
return;
}
+ /*endif*/
p = len;
/* Strip trailing spaces */
while (p > 1 && pkt[p - 1] == ' ')
p--;
+ /*endwhile*/
/* The string is actually backwards in the message */
k = 0;
while (p > 1)
msg[k++] = pkt[--p];
+ /*endwhile*/
msg[k] = '\0';
span_log(&s->logging, SPAN_LOG_FLOW, "Remote gave %s as: \"%s\"\n", t30_frametype(pkt[0]), msg);
}
@@ -5640,12 +6246,14 @@ static void decode_url_msg(t30_state_t *s, char *msg, const uint8_t *pkt, int le
/* TODO: decode properly, as per T.30 5.3.6.2.12 */
if (msg == NULL)
msg = text;
+ /*endif*/
if (len < 3 || len > 77 + 3 || len != pkt[2] + 3)
{
unexpected_frame_length(s, pkt, len);
msg[0] = '\0';
return;
}
+ /*endif*/
/* First octet is the sequence number of the packet.
Bit 7 = 1 for more follows, 0 for last packet in the sequence.
Bits 6-0 = The sequence number, 0 to 0x7F
@@ -5675,6 +6283,7 @@ static int decode_nsf_nss_nsc(t30_state_t *s, uint8_t *msg[], const uint8_t *pkt
if ((t = span_alloc(len - 1)) == NULL)
return 0;
+ /*endif*/
memcpy(t, &pkt[1], len - 1);
*msg = t;
return len - 1;
@@ -5728,6 +6337,7 @@ static void t30_non_ecm_rx_status(void *user_data, int status)
machines send a burst of all 1's before the all 0's. Tolerate this. */
if (s->tcf_current_zeros > s->tcf_most_zeros)
s->tcf_most_zeros = s->tcf_current_zeros;
+ /*endif*/
span_log(&s->logging, SPAN_LOG_FLOW, "Trainability (TCF) test result - %d total bits. longest run of zeros was %d\n", s->tcf_test_bits, s->tcf_most_zeros);
if (s->tcf_most_zeros < fallback_sequence[s->current_fallback].bit_rate)
{
@@ -5745,15 +6355,18 @@ static void t30_non_ecm_rx_status(void *user_data, int status)
set_state(s, T30_STATE_F_CFR);
send_cfr_sequence(s, true);
}
+ /*endif*/
}
+ /*endif*/
break;
case T30_STATE_F_POST_DOC_NON_ECM:
/* Page ended cleanly */
+ /* We have received something, so any missing carrier status is out of date */
if (s->current_status == T30_ERR_RX_NOCARRIER)
t30_set_status(s, T30_ERR_OK);
+ /*endif*/
break;
default:
- /* We should be receiving a document right now, but it did not end cleanly. */
if (was_trained)
{
span_log(&s->logging, SPAN_LOG_WARNING, "Page did not end cleanly\n");
@@ -5762,23 +6375,29 @@ static void t30_non_ecm_rx_status(void *user_data, int status)
set_state(s, T30_STATE_F_POST_DOC_NON_ECM);
set_phase(s, T30_PHASE_D_RX);
timer_t2_start(s);
+ /* We have received something, so any missing carrier status is out of date */
if (s->current_status == T30_ERR_RX_NOCARRIER)
t30_set_status(s, T30_ERR_OK);
+ /*endif*/
}
else
{
span_log(&s->logging, SPAN_LOG_WARNING, "Non-ECM carrier not found\n");
t30_set_status(s, T30_ERR_RX_NOCARRIER);
}
+ /*endif*/
break;
}
+ /*endswitch*/
if (s->next_phase != T30_PHASE_IDLE)
set_phase(s, s->next_phase);
+ /*endif*/
break;
default:
span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected non-ECM rx status - %d!\n", status);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -5792,6 +6411,7 @@ SPAN_DECLARE_NONSTD(void) t30_non_ecm_put_bit(void *user_data, int bit)
t30_non_ecm_rx_status(user_data, bit);
return;
}
+ /*endif*/
s = (t30_state_t *) user_data;
switch (s->state)
{
@@ -5802,12 +6422,14 @@ SPAN_DECLARE_NONSTD(void) t30_non_ecm_put_bit(void *user_data, int bit)
{
if (s->tcf_current_zeros > s->tcf_most_zeros)
s->tcf_most_zeros = s->tcf_current_zeros;
+ /*endif*/
s->tcf_current_zeros = 0;
}
else
{
s->tcf_current_zeros++;
}
+ /*endif*/
break;
case T30_STATE_F_DOC_NON_ECM:
/* Image transfer */
@@ -5816,12 +6438,15 @@ SPAN_DECLARE_NONSTD(void) t30_non_ecm_put_bit(void *user_data, int bit)
/* This is the end of the image */
if (res != T4_DECODE_OK)
span_log(&s->logging, SPAN_LOG_FLOW, "Page ended with status %d\n", res);
+ /*endif*/
set_state(s, T30_STATE_F_POST_DOC_NON_ECM);
queue_phase(s, T30_PHASE_D_RX);
timer_t2_start(s);
}
+ /*endif*/
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -5844,13 +6469,16 @@ SPAN_DECLARE(void) t30_non_ecm_put(void *user_data, const uint8_t buf[], int len
{
if (s->tcf_current_zeros > s->tcf_most_zeros)
s->tcf_most_zeros = s->tcf_current_zeros;
+ /*endif*/
s->tcf_current_zeros = 0;
}
else
{
s->tcf_current_zeros += 8;
}
+ /*endif*/
}
+ /*endfor*/
break;
case T30_STATE_F_DOC_NON_ECM:
/* Image transfer */
@@ -5859,12 +6487,15 @@ SPAN_DECLARE(void) t30_non_ecm_put(void *user_data, const uint8_t buf[], int len
/* This is the end of the image */
if (res != T4_DECODE_OK)
span_log(&s->logging, SPAN_LOG_FLOW, "Page ended with status %d\n", res);
+ /*endif*/
set_state(s, T30_STATE_F_POST_DOC_NON_ECM);
queue_phase(s, T30_PHASE_D_RX);
timer_t2_start(s);
}
+ /*endif*/
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -5884,6 +6515,7 @@ SPAN_DECLARE_NONSTD(int) t30_non_ecm_get_bit(void *user_data)
/* Finished sending training test. */
bit = SIG_STATUS_END_OF_DATA;
}
+ /*endif*/
break;
case T30_STATE_I:
/* Transferring real data. */
@@ -5899,6 +6531,7 @@ SPAN_DECLARE_NONSTD(int) t30_non_ecm_get_bit(void *user_data)
bit = SIG_STATUS_END_OF_DATA;
break;
}
+ /*endswitch*/
return bit;
}
/*- End of function --------------------------------------------------------*/
@@ -5918,7 +6551,9 @@ SPAN_DECLARE(int) t30_non_ecm_get(void *user_data, uint8_t buf[], int max_len)
buf[len] = 0;
if ((s->tcf_test_bits -= 8) < 0)
break;
+ /*endif*/
}
+ /*endfor*/
break;
case T30_STATE_I:
/* Transferring real data. */
@@ -5934,6 +6569,7 @@ SPAN_DECLARE(int) t30_non_ecm_get(void *user_data, uint8_t buf[], int max_len)
len = -1;
break;
}
+ /*endswitch*/
return len;
}
/*- End of function --------------------------------------------------------*/
@@ -5961,15 +6597,16 @@ static void t30_hdlc_rx_status(void *user_data, int status)
s->rx_signal_present = true;
switch (s->timer_t2_t4_is)
{
- case TIMER_IS_T2B:
+ case TIMER_IS_T2_DROPPED:
timer_t2_t4_stop(s);
s->timer_t2_t4_is = TIMER_IS_T2C;
break;
- case TIMER_IS_T4B:
+ case TIMER_IS_T4_DROPPED:
timer_t2_t4_stop(s);
s->timer_t2_t4_is = TIMER_IS_T4C;
break;
}
+ /*endswitch*/
break;
case SIG_STATUS_CARRIER_DOWN:
was_trained = s->rx_trained;
@@ -5993,6 +6630,7 @@ static void t30_hdlc_rx_status(void *user_data, int status)
/* We at least trained, so any missing carrier status is out of date */
if (s->current_status == T30_ERR_RX_NOCARRIER)
t30_set_status(s, T30_ERR_OK);
+ /*endif*/
}
else
{
@@ -6000,7 +6638,9 @@ static void t30_hdlc_rx_status(void *user_data, int status)
span_log(&s->logging, SPAN_LOG_WARNING, "ECM carrier not found\n");
t30_set_status(s, T30_ERR_RX_NOCARRIER);
}
+ /*endif*/
}
+ /*endif*/
if (s->next_phase != T30_PHASE_IDLE)
{
/* The appropriate timer for the next phase should already be in progress */
@@ -6011,16 +6651,18 @@ static void t30_hdlc_rx_status(void *user_data, int status)
switch (s->timer_t2_t4_is)
{
case TIMER_IS_T1A:
- case TIMER_IS_T2A:
+ case TIMER_IS_T2_FLAGGED:
case TIMER_IS_T2C:
- timer_t2b_start(s);
+ timer_t2_dropped_start(s);
break;
- case TIMER_IS_T4A:
+ case TIMER_IS_T4_FLAGGED:
case TIMER_IS_T4C:
- timer_t4b_start(s);
+ timer_t4_dropped_start(s);
break;
}
+ /*endswitch*/
}
+ /*endif*/
break;
case SIG_STATUS_FRAMING_OK:
if (!s->far_end_detected && s->timer_t0_t1 > 0)
@@ -6029,24 +6671,28 @@ static void t30_hdlc_rx_status(void *user_data, int status)
s->far_end_detected = true;
if (s->phase == T30_PHASE_A_CED || s->phase == T30_PHASE_A_CNG)
set_phase(s, T30_PHASE_B_RX);
+ /*endif*/
}
- /* 5.4.3.1 Timer T2 is reset if flag is received. Timer T2A must be started. */
- /* Unstated, but implied, is that timer T4 and T4A are handled the same way. */
+ /*endif*/
+ /* 5.4.3.1 Timer T2 is reset if flag is received. Timer T2_FLAGGED must be started. */
+ /* Unstated, but implied, is that timer T4 and T4_FLAGGED are handled the same way. */
if (s->timer_t2_t4 > 0)
{
switch(s->timer_t2_t4_is)
{
case TIMER_IS_T1A:
case TIMER_IS_T2:
- case TIMER_IS_T2A:
- timer_t2a_start(s);
+ case TIMER_IS_T2_FLAGGED:
+ timer_t2_flagged_start(s);
break;
case TIMER_IS_T4:
- case TIMER_IS_T4A:
- timer_t4a_start(s);
+ case TIMER_IS_T4_FLAGGED:
+ timer_t4_flagged_start(s);
break;
}
+ /*endswitch*/
}
+ /*endif*/
break;
case SIG_STATUS_ABORT:
/* Just ignore these */
@@ -6055,6 +6701,7 @@ static void t30_hdlc_rx_status(void *user_data, int status)
span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected HDLC special length - %d!\n", status);
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -6067,6 +6714,7 @@ SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, i
t30_hdlc_rx_status(user_data, len);
return;
}
+ /*endif*/
s = (t30_state_t *) user_data;
/* The spec. says a command or response is not valid if:
@@ -6092,18 +6740,23 @@ SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, i
queue_phase(s, T30_PHASE_B_TX);
else
queue_phase(s, T30_PHASE_D_TX);
+ /*endif*/
send_simple_frame(s, T30_CRP);
}
else
{
/* Cancel the command or response timer (if one is running) */
span_log(&s->logging, SPAN_LOG_FLOW, "Bad CRC and timer is %d\n", s->timer_t2_t4_is);
- if (s->timer_t2_t4_is == TIMER_IS_T2A)
+ if (s->timer_t2_t4_is == TIMER_IS_T2_FLAGGED)
timer_t2_t4_stop(s);
+ /*endif*/
}
+ /*endif*/
}
+ /*endif*/
return;
}
+ /*endif*/
if (len < 3)
{
@@ -6112,6 +6765,7 @@ SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, i
timer_t2_t4_stop(s);
return;
}
+ /*endif*/
if (msg[0] != ADDRESS_FIELD
||
!(msg[1] == CONTROL_FIELD_NON_FINAL_FRAME || msg[1] == CONTROL_FIELD_FINAL_FRAME))
@@ -6121,6 +6775,7 @@ SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, i
timer_t2_t4_stop(s);
return;
}
+ /*endif*/
s->rx_frame_received = true;
/* Cancel the command or response timer (if one is running) */
timer_t2_t4_stop(s);
@@ -6143,9 +6798,9 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
{
case T30_STATE_ANSWERING:
span_log(&s->logging, SPAN_LOG_FLOW, "Starting answer mode\n");
+ s->dis_received = false;
set_phase(s, T30_PHASE_B_TX);
timer_t2_start(s);
- s->dis_received = false;
send_dis_or_dtc_sequence(s, true);
break;
case T30_STATE_R:
@@ -6155,6 +6810,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
set_phase(s, T30_PHASE_B_RX);
timer_t4_start(s);
}
+ /*endif*/
break;
case T30_STATE_F_CFR:
if (send_cfr_sequence(s, false))
@@ -6171,9 +6827,11 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
set_state(s, T30_STATE_F_DOC_NON_ECM);
queue_phase(s, T30_PHASE_C_NON_ECM_RX);
}
+ /*endif*/
timer_t2_start(s);
s->next_rx_step = T30_MPS;
}
+ /*endif*/
break;
case T30_STATE_F_FTT:
if (s->step == 0)
@@ -6186,6 +6844,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
set_phase(s, T30_PHASE_B_RX);
timer_t2_start(s);
}
+ /*endif*/
break;
case T30_STATE_F_DOC_NON_ECM:
case T30_STATE_III_Q:
@@ -6214,6 +6873,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
set_state(s, T30_STATE_F_DOC_NON_ECM);
queue_phase(s, T30_PHASE_C_NON_ECM_RX);
}
+ /*endif*/
timer_t2_start(s);
break;
case T30_PRI_EOM:
@@ -6234,7 +6894,9 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
terminate_call(s);
break;
}
+ /*endswitch*/
}
+ /*endif*/
break;
case T30_STATE_II_Q:
case T30_STATE_IV_PPS_NULL:
@@ -6256,6 +6918,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
set_phase(s, T30_PHASE_D_RX);
timer_t4_start(s);
}
+ /*endif*/
break;
case T30_STATE_B:
/* We have now allowed time for the last message to flush through
@@ -6274,6 +6937,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
end the call. */
start_final_pause(s);
}
+ /*endif*/
break;
case T30_STATE_D:
if (send_dcs_sequence(s, false))
@@ -6293,6 +6957,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
set_state(s, T30_STATE_I);
queue_phase(s, T30_PHASE_C_NON_ECM_TX);
}
+ /*endif*/
}
else
{
@@ -6302,7 +6967,9 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
set_state(s, T30_STATE_D_TCF);
set_phase(s, T30_PHASE_C_NON_ECM_TX);
}
+ /*endif*/
}
+ /*endif*/
break;
case T30_STATE_D_TCF:
/* Finished sending training test. Listen for the response. */
@@ -6327,6 +6994,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
shut_down_hdlc_tx(s);
s->step++;
}
+ /*endif*/
}
else
{
@@ -6334,11 +7002,14 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
set_phase(s, T30_PHASE_D_TX);
if (s->ecm_at_page_end)
s->next_tx_step = check_next_tx_step(s);
+ /*endif*/
if (send_pps_frame(s) == T30_NULL)
set_state(s, T30_STATE_IV_PPS_NULL);
else
set_state(s, T30_STATE_IV_PPS_Q);
+ /*endif*/
}
+ /*endif*/
break;
case T30_STATE_F_DOC_ECM:
/* This should be the end of a CTR being sent. */
@@ -6353,6 +7024,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
queue_phase(s, T30_PHASE_C_ECM_RX);
timer_t2_start(s);
}
+ /*endif*/
break;
case T30_STATE_CALL_FINISHED:
/* Just ignore anything that happens now. We might get here if a premature
@@ -6362,6 +7034,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
span_log(&s->logging, SPAN_LOG_FLOW, "Bad state for send complete in t30_front_end_status - %s\n", state_names[s->state]);
break;
}
+ /*endswitch*/
break;
case T30_FRONT_END_RECEIVE_COMPLETE:
span_log(&s->logging, SPAN_LOG_FLOW, "Receive complete in phase %s, state %s\n", phase_names[s->phase], state_names[s->state]);
@@ -6377,6 +7050,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
t30_hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN);
break;
}
+ /*endswitch*/
break;
case T30_FRONT_END_SIGNAL_PRESENT:
span_log(&s->logging, SPAN_LOG_FLOW, "A signal is present\n");
@@ -6405,6 +7079,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
s->rx_signal_present = true;
break;
}
+ /*endswitch*/
break;
case T30_FRONT_END_SIGNAL_ABSENT:
span_log(&s->logging, SPAN_LOG_FLOW, "No signal is present\n");
@@ -6419,6 +7094,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
/* TODO: Should we do anything here? */
break;
}
+ /*endswitch*/
}
/*- End of function --------------------------------------------------------*/
@@ -6435,8 +7111,11 @@ SPAN_DECLARE(void) t30_timer_update(t30_state_t *s, int samples)
timer_t1_expired(s);
else
timer_t0_expired(s);
+ /*endif*/
}
+ /*endif*/
}
+ /*endif*/
if (s->timer_t3 > 0)
{
if ((s->timer_t3 -= samples) <= 0)
@@ -6444,7 +7123,9 @@ SPAN_DECLARE(void) t30_timer_update(t30_state_t *s, int samples)
s->timer_t3 = 0;
timer_t3_expired(s);
}
+ /*endif*/
}
+ /*endif*/
if (s->timer_t2_t4 > 0)
{
if ((s->timer_t2_t4 -= samples) <= 0)
@@ -6462,24 +7143,27 @@ SPAN_DECLARE(void) t30_timer_update(t30_state_t *s, int samples)
case TIMER_IS_T2:
timer_t2_expired(s);
break;
- case TIMER_IS_T2A:
- timer_t2a_expired(s);
+ case TIMER_IS_T2_FLAGGED:
+ timer_t2_flagged_expired(s);
break;
- case TIMER_IS_T2B:
- timer_t2b_expired(s);
+ case TIMER_IS_T2_DROPPED:
+ timer_t2_dropped_expired(s);
break;
case TIMER_IS_T4:
timer_t4_expired(s);
break;
- case TIMER_IS_T4A:
- timer_t4a_expired(s);
+ case TIMER_IS_T4_FLAGGED:
+ timer_t4_flagged_expired(s);
break;
- case TIMER_IS_T4B:
- timer_t4b_expired(s);
+ case TIMER_IS_T4_DROPPED:
+ timer_t4_dropped_expired(s);
break;
}
+ /*endswitch*/
}
+ /*endif*/
}
+ /*endif*/
if (s->timer_t5 > 0)
{
if ((s->timer_t5 -= samples) <= 0)
@@ -6487,7 +7171,9 @@ SPAN_DECLARE(void) t30_timer_update(t30_state_t *s, int samples)
s->timer_t5 = 0;
timer_t5_expired(s);
}
+ /*endif*/
}
+ /*endif*/
}
/*- End of function --------------------------------------------------------*/
@@ -6517,10 +7203,13 @@ SPAN_DECLARE(void) t30_terminate(t30_state_t *s)
/* The call terminated prematurely. */
t30_set_status(s, T30_ERR_CALLDROPPED);
}
+ /*endif*/
break;
}
+ /*endswitch*/
terminate_call(s);
}
+ /*endif*/
}
/*- End of function --------------------------------------------------------*/
@@ -6545,6 +7234,7 @@ SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t)
memset(&stats, 0, sizeof(stats));
break;
}
+ /*endswitch*/
t->pages_tx = s->tx_page_number;
t->pages_rx = s->rx_page_number;
t->pages_in_file = stats.pages_in_file;
@@ -6579,6 +7269,7 @@ SPAN_DECLARE(void) t30_local_interrupt_request(t30_state_t *s, int state)
/* TODO: */
send_simple_frame(s, (state) ? T30_PIP : T30_PIN);
}
+ /*endif*/
s->local_interrupt_pending = state;
}
/*- End of function --------------------------------------------------------*/
@@ -6626,6 +7317,7 @@ SPAN_DECLARE(int) t30_restart(t30_state_t *s, bool calling_party)
set_state(s, T30_STATE_ANSWERING);
set_phase(s, T30_PHASE_A_CED);
}
+ /*endif*/
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -6643,7 +7335,9 @@ SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s,
{
if ((s = (t30_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
+ /*endif*/
}
+ /*endif*/
memset(s, 0, sizeof(*s));
s->set_rx_type_handler = set_rx_type_handler;
s->set_rx_type_user_data = set_rx_type_user_data;
diff --git a/libs/spandsp/src/t30_api.c b/libs/spandsp/src/t30_api.c
index 5bf164b998..724dcf9735 100644
--- a/libs/spandsp/src/t30_api.c
+++ b/libs/spandsp/src/t30_api.c
@@ -95,6 +95,65 @@
#include "t30_local.h"
+SPAN_DECLARE(int) t33_sub_address_extract_field(uint8_t num[21], const uint8_t t33[], int field_no)
+{
+ int i;
+ int j;
+ int k;
+ int ch;
+ int type;
+
+ num[0] = '\0';
+ k = 0;
+ for (i = 0; t33[i]; )
+ {
+ if (k++ == field_no)
+ {
+ ch = t33[i++];
+ j = 0;
+ if (ch != '#')
+ {
+ num[j++] = ch;
+ type = T33_EXT;
+ }
+ else
+ {
+ type = T33_SST;
+ }
+ while (t33[i])
+ {
+ ch = t33[i++];
+ if (ch == '#')
+ break;
+ num[j++] = ch;
+ if (j >= 20)
+ return -1;
+ }
+ num[j] = '\0';
+ return type;
+ }
+ /* Skip this field */
+ i++;
+ while (t33[i])
+ {
+ if (t33[i++] == '#')
+ break;
+ }
+ }
+ return T33_NONE;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t33_sub_address_add_field(uint8_t t33[], const uint8_t field[], int type)
+{
+ if (t33[0] != '\0')
+ strcat((char *) t33, "#");
+ if (type == T33_SST)
+ strcat((char *) t33, "#");
+ strcat((char *) t33, (const char *) field);
+}
+/*- End of function --------------------------------------------------------*/
+
SPAN_DECLARE(int) t30_set_tx_ident(t30_state_t *s, const char *id)
{
if (id == NULL)
diff --git a/libs/spandsp/src/t31.c b/libs/spandsp/src/t31.c
index 943063e8a2..e63eb229e8 100644
--- a/libs/spandsp/src/t31.c
+++ b/libs/spandsp/src/t31.c
@@ -2994,7 +2994,7 @@ SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s,
alloced = false;
if (s == NULL)
{
- if ((s = (t31_state_t *) span_alloc(sizeof (*s))) == NULL)
+ if ((s = (t31_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
/*endif*/
alloced = true;
diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c
index 88b17352c4..4467a615ad 100644
--- a/libs/spandsp/src/t38_gateway.c
+++ b/libs/spandsp/src/t38_gateway.c
@@ -662,8 +662,8 @@ static void monitor_control_messages(t38_gateway_state_t *s,
/*endif*/
}
/*endfor*/
- /* If we are processing a message from the modem side, the contents determine the fast receive modem.
- we are to use. If it comes from the T.38 side the contents do not. */
+ /* If we are processing a message from the modem side, the contents determine the fast
+ receive modem we are to use. If it comes from the T.38 side the contents do not. */
s->core.fast_bit_rate = modem_codes[i].bit_rate;
if (from_modem)
s->core.fast_rx_modem = modem_codes[i].modem_type;
@@ -700,8 +700,9 @@ static void monitor_control_messages(t38_gateway_state_t *s,
/*endif*/
}
/*endfor*/
- /* If we are processing a message from the modem side, the contents determine the fast receive modem.
- we are to use. If it comes from the T.38 side the contents do not. */
+ /* If we are processing a DCS message from the modem side, the contents determine the fast
+ receive modem we are to use. If it comes from the T.38 side the contents do not. For a
+ DTC message this is reversed. */
s->core.fast_bit_rate = modem_codes[i].bit_rate;
if ((buf[2] == T30_DTC && !from_modem) || (buf[2] != T30_DTC && from_modem))
s->core.fast_rx_modem = modem_codes[i].modem_type;
diff --git a/libs/spandsp/src/time_scale.c b/libs/spandsp/src/time_scale.c
index 5337e4ad0c..a21e34cc7d 100644
--- a/libs/spandsp/src/time_scale.c
+++ b/libs/spandsp/src/time_scale.c
@@ -78,12 +78,15 @@ static __inline__ int amdf_pitch(int min_pitch, int max_pitch, int16_t amp[], in
acc = 0;
for (j = 0; j < len; j++)
acc += abs(amp[i + j] - amp[j]);
+ /*endfor*/
if (acc < min_acc)
{
min_acc = acc;
pitch = i;
}
+ /*endif*/
}
+ /*endfor*/
return pitch;
}
/*- End of function --------------------------------------------------------*/
@@ -99,9 +102,10 @@ static __inline__ void overlap_add(int16_t amp1[], int16_t amp2[], int len)
for (i = 0; i < len; i++)
{
/* TODO: saturate */
- amp2[i] = (int16_t) ((float) amp1[i]*(1.0f - weight) + (float) amp2[i]*weight);
+ amp1[i] = (int16_t) ((float) amp2[i]*(1.0f - weight) + (float) amp1[i]*weight);
weight += step;
}
+ /*endfor*/
}
/*- End of function --------------------------------------------------------*/
@@ -130,16 +134,166 @@ SPAN_DECLARE(int) time_scale_rate(time_scale_state_t *s, float playout_rate)
}
/*- End of function --------------------------------------------------------*/
+SPAN_DECLARE(int) time_scale(time_scale_state_t *s, int16_t out[], int16_t in[], int len)
+{
+ double lcpf;
+ int pitch;
+ int out_len;
+ int in_len;
+ int k;
+
+ out_len = 0;
+ in_len = 0;
+
+ if (s->playout_rate == 1.0f)
+ {
+ vec_copyi16(out, in, len);
+ return len;
+ }
+ /*endif*/
+
+ /* Top up the buffer */
+ if (s->fill + len < s->buf_len)
+ {
+ /* Cannot continue without more samples */
+ /* Save the residual signal for next time. */
+ vec_copyi16(&s->buf[s->fill], in, len);
+ s->fill += len;
+ return 0;
+ }
+ /*endif*/
+ k = s->buf_len - s->fill;
+ vec_copyi16(&s->buf[s->fill], in, k);
+ in_len += k;
+ s->fill = s->buf_len;
+ while (s->fill == s->buf_len)
+ {
+ while (s->lcp >= s->buf_len)
+ {
+ vec_copyi16(&out[out_len], s->buf, s->buf_len);
+ out_len += s->buf_len;
+ if (len - in_len < s->buf_len)
+ {
+ /* Cannot continue without more samples */
+ /* Save the residual signal for next time. */
+ vec_copyi16(s->buf, &in[in_len], len - in_len);
+ s->fill = len - in_len;
+ s->lcp -= s->buf_len;
+ return out_len;
+ }
+ /*endif*/
+ vec_copyi16(s->buf, &in[in_len], s->buf_len);
+ in_len += s->buf_len;
+ s->lcp -= s->buf_len;
+ }
+ /*endwhile*/
+ if (s->lcp > 0)
+ {
+ vec_copyi16(&out[out_len], s->buf, s->lcp);
+ out_len += s->lcp;
+ vec_movei16(s->buf, &s->buf[s->lcp], s->buf_len - s->lcp);
+ if (len - in_len < s->lcp)
+ {
+ /* Cannot continue without more samples */
+ /* Save the residual signal for next time. */
+ vec_copyi16(&s->buf[s->buf_len - s->lcp], &in[in_len], len - in_len);
+ s->fill = s->buf_len - s->lcp + len - in_len;
+ s->lcp = 0;
+ return out_len;
+ }
+ /*endif*/
+ vec_copyi16(&s->buf[s->buf_len - s->lcp], &in[in_len], s->lcp);
+ in_len += s->lcp;
+ s->lcp = 0;
+ }
+ /*endif*/
+ pitch = amdf_pitch(s->min_pitch, s->max_pitch, s->buf, s->min_pitch);
+ lcpf = (double) pitch*s->rcomp;
+ /* Nudge around to compensate for fractional samples */
+ s->lcp = (int) lcpf;
+ /* Note that s->lcp and lcpf are not the same, as lcpf has a fractional part, and s->lcp doesn't */
+ s->rate_nudge += s->lcp - lcpf;
+ if (s->rate_nudge >= 0.5f)
+ {
+ s->lcp--;
+ s->rate_nudge -= 1.0f;
+ }
+ else if (s->rate_nudge <= -0.5f)
+ {
+ s->lcp++;
+ s->rate_nudge += 1.0f;
+ }
+ /*endif*/
+ if (s->playout_rate < 1.0f)
+ {
+ /* Speed up - drop a pitch period of signal */
+ overlap_add(&s->buf[pitch], s->buf, pitch);
+ vec_copyi16(&s->buf[pitch], &s->buf[2*pitch], s->buf_len - 2*pitch);
+ if (len - in_len < pitch)
+ {
+ /* Cannot continue without more samples */
+ /* Save the residual signal for next time. */
+ vec_copyi16(&s->buf[s->buf_len - pitch], &in[in_len], len - in_len);
+ s->fill += (len - in_len - pitch);
+ return out_len;
+ }
+ /*endif*/
+ vec_copyi16(&s->buf[s->buf_len - pitch], &in[in_len], pitch);
+ in_len += pitch;
+ }
+ else
+ {
+ /* Slow down - insert a pitch period of signal */
+ vec_copyi16(&out[out_len], s->buf, pitch);
+ out_len += pitch;
+ overlap_add(s->buf, &s->buf[pitch], pitch);
+ }
+ /*endif*/
+ }
+ /*endwhile*/
+ return out_len;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) time_scale_flush(time_scale_state_t *s, int16_t out[])
+{
+ int len;
+ int pad;
+
+ if (s->playout_rate < 1.0f)
+ return 0;
+ /*endif*/
+ vec_copyi16(out, s->buf, s->fill);
+ len = s->fill;
+ if (s->playout_rate > 1.0f)
+ {
+ pad = s->fill*(s->playout_rate - 1.0f);
+ vec_zeroi16(&out[len], pad);
+ len += pad;
+ }
+ /*endif*/
+ s->fill = 0;
+ return len;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) time_scale_max_output_len(time_scale_state_t *s, int input_len)
+{
+ return (int) (input_len*s->playout_rate + s->min_pitch + 1);
+}
+/*- End of function --------------------------------------------------------*/
+
SPAN_DECLARE(time_scale_state_t *) time_scale_init(time_scale_state_t *s, int sample_rate, float playout_rate)
{
bool alloced;
if (sample_rate > TIME_SCALE_MAX_SAMPLE_RATE)
return NULL;
+ /*endif*/
alloced = false;
if (s == NULL)
{
- if ((s = (time_scale_state_t *) span_alloc(sizeof (*s))) == NULL)
+ if ((s = (time_scale_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
/*endif*/
alloced = true;
@@ -153,6 +307,7 @@ SPAN_DECLARE(time_scale_state_t *) time_scale_init(time_scale_state_t *s, int sa
{
if (alloced)
span_free(s);
+ /*endif*/
return NULL;
}
/*endif*/
@@ -175,118 +330,4 @@ SPAN_DECLARE(int) time_scale_free(time_scale_state_t *s)
return 0;
}
/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(int) time_scale(time_scale_state_t *s, int16_t out[], int16_t in[], int len)
-{
- double lcpf;
- int pitch;
- int out_len;
- int in_len;
- int k;
-
- out_len = 0;
- in_len = 0;
-
- /* Top up the buffer */
- if (s->fill + len < s->buf_len)
- {
- /* Cannot continue without more samples */
- vec_copyi16(&s->buf[s->fill], in, len);
- s->fill += len;
- return out_len;
- }
- k = s->buf_len - s->fill;
- vec_copyi16(&s->buf[s->fill], in, k);
- in_len += k;
- s->fill = s->buf_len;
- while (s->fill == s->buf_len)
- {
- while (s->lcp >= s->buf_len)
- {
- vec_copyi16(&out[out_len], s->buf, s->buf_len);
- out_len += s->buf_len;
- if (len - in_len < s->buf_len)
- {
- /* Cannot continue without more samples */
- vec_copyi16(s->buf, &in[in_len], len - in_len);
- s->fill = len - in_len;
- s->lcp -= s->buf_len;
- return out_len;
- }
- vec_copyi16(s->buf, &in[in_len], s->buf_len);
- in_len += s->buf_len;
- s->lcp -= s->buf_len;
- }
- if (s->lcp > 0)
- {
- vec_copyi16(&out[out_len], s->buf, s->lcp);
- out_len += s->lcp;
- vec_movei16(s->buf, &s->buf[s->lcp], s->buf_len - s->lcp);
- if (len - in_len < s->lcp)
- {
- /* Cannot continue without more samples */
- vec_copyi16(&s->buf[s->buf_len - s->lcp], &in[in_len], len - in_len);
- s->fill = s->buf_len - s->lcp + len - in_len;
- s->lcp = 0;
- return out_len;
- }
- vec_copyi16(&s->buf[s->buf_len - s->lcp], &in[in_len], s->lcp);
- in_len += s->lcp;
- s->lcp = 0;
- }
- if (s->playout_rate == 1.0f)
- {
- s->lcp = 0x7FFFFFFF;
- }
- else
- {
- pitch = amdf_pitch(s->min_pitch, s->max_pitch, s->buf, s->min_pitch);
- lcpf = (double) pitch*s->rcomp;
- /* Nudge around to compensate for fractional samples */
- s->lcp = (int) lcpf;
- /* Note that s->lcp and lcpf are not the same, as lcpf has a fractional part, and s->lcp doesn't */
- s->rate_nudge += s->lcp - lcpf;
- if (s->rate_nudge >= 0.5f)
- {
- s->lcp--;
- s->rate_nudge -= 1.0f;
- }
- else if (s->rate_nudge <= -0.5f)
- {
- s->lcp++;
- s->rate_nudge += 1.0f;
- }
- if (s->playout_rate < 1.0f)
- {
- /* Speed up - drop a chunk of data */
- overlap_add(s->buf, &s->buf[pitch], pitch);
- vec_copyi16(&s->buf[pitch], &s->buf[2*pitch], s->buf_len - 2*pitch);
- if (len - in_len < pitch)
- {
- /* Cannot continue without more samples */
- vec_copyi16(&s->buf[s->buf_len - pitch], &in[in_len], len - in_len);
- s->fill += (len - in_len - pitch);
- return out_len;
- }
- vec_copyi16(&s->buf[s->buf_len - pitch], &in[in_len], pitch);
- in_len += pitch;
- }
- else
- {
- /* Slow down - insert a chunk of data */
- vec_copyi16(&out[out_len], s->buf, pitch);
- out_len += pitch;
- overlap_add(&s->buf[pitch], s->buf, pitch);
- }
- }
- }
- return out_len;
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(int) time_scale_max_output_len(time_scale_state_t *s, int input_len)
-{
- return (int) (input_len*s->playout_rate + s->min_pitch + 1);
-}
-/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
diff --git a/libs/spandsp/src/v22bis_rx.c b/libs/spandsp/src/v22bis_rx.c
index 42c3e93c2a..102b9a2eb7 100644
--- a/libs/spandsp/src/v22bis_rx.c
+++ b/libs/spandsp/src/v22bis_rx.c
@@ -579,7 +579,7 @@ static __inline__ void process_half_baud(v22bis_state_t *s, const complexf_t *sa
s->rx.gardner_step = 32;
break;
case V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES:
- /* Calling modem only */
+ /* Calling modem only. */
/* The calling modem should initially receive unscrambled ones at 1200bps */
target = &v22bis_constellation[nearest];
track_carrier(s, &z, target);
@@ -621,7 +621,7 @@ static __inline__ void process_half_baud(v22bis_state_t *s, const complexf_t *sa
}
break;
case V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES_SUSTAINING:
- /* Calling modem only */
+ /* Calling modem only. */
/* Wait for the end of the unscrambled ones at 1200bps. */
target = &v22bis_constellation[nearest];
track_carrier(s, &z, target);
@@ -682,7 +682,7 @@ static __inline__ void process_half_baud(v22bis_state_t *s, const complexf_t *sa
/* The transmit side needs to sustain the scrambled ones for a timed period. */
s->tx.training_count = 0;
s->tx.training = V22BIS_TX_TRAINING_STAGE_TIMED_S11;
- /* Normal reception starts immediately */
+ /* Normal reception starts immediately. */
s->rx.training = V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION;
#if defined(SPANDSP_USE_FIXED_POINT)
s->rx.carrier_track_i = 8;
diff --git a/libs/spandsp/tests/ademco_contactid_tests.c b/libs/spandsp/tests/ademco_contactid_tests.c
index b1c9c4f42d..4071999d03 100644
--- a/libs/spandsp/tests/ademco_contactid_tests.c
+++ b/libs/spandsp/tests/ademco_contactid_tests.c
@@ -149,7 +149,7 @@ static void rx_callback(void *user_data, const ademco_contactid_report_t *report
printf(" Event %X\n", report->xyz);
printf(" Group/partition %X\n", report->gg);
printf(" User/Zone information %X\n", report->ccc);
- if (memcmp(&reports[reports_entry], report, sizeof (*report)))
+ if (memcmp(&reports[reports_entry], report, sizeof(*report)))
{
printf("Report mismatch\n");
exit(2);
diff --git a/libs/spandsp/tests/awgn_tests.c b/libs/spandsp/tests/awgn_tests.c
index c105a9b243..09e7884e33 100644
--- a/libs/spandsp/tests/awgn_tests.c
+++ b/libs/spandsp/tests/awgn_tests.c
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
total = 0.0;
if ((noise_source = awgn_init_dbm0(NULL, idum, (float) j)) == NULL)
{
- printf("Failed to allocation AWGN source\n");
+ printf("Failed to allocate AWGN source\n");
exit(2);
}
total_samples = 1000000;
@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
clip_low = 0;
if ((noise_source = awgn_init_dbm0(NULL, idum, -15.0)) == NULL)
{
- printf("Failed to allocation AWGN source\n");
+ printf("Failed to allocate AWGN source\n");
exit(2);
}
total_samples = 10000000;
diff --git a/libs/spandsp/tests/fax_decode.c b/libs/spandsp/tests/fax_decode.c
index 7b624bd6f8..e67d32a120 100644
--- a/libs/spandsp/tests/fax_decode.c
+++ b/libs/spandsp/tests/fax_decode.c
@@ -232,7 +232,11 @@ static int check_rx_dcs(const uint8_t *msg, int len)
image_width = widths[(dcs_frame[8] & DISBIT3) ? 2 : 1][dcs_frame[5] & (DISBIT2 | DISBIT1)];
/* Check which compression we will use. */
- if ((dcs_frame[6] & DISBIT7))
+ if ((dcs_frame[12] & DISBIT7))
+ line_encoding = T4_COMPRESSION_T85_L0;
+ else if ((dcs_frame[12] & DISBIT6))
+ line_encoding = T4_COMPRESSION_T85;
+ else if ((dcs_frame[6] & DISBIT7))
line_encoding = T4_COMPRESSION_T6;
else if ((dcs_frame[4] & DISBIT8))
line_encoding = T4_COMPRESSION_T4_2D;
diff --git a/libs/spandsp/tests/fax_tester.c b/libs/spandsp/tests/fax_tester.c
index 4cd85d68a7..fb5dcc1ac1 100644
--- a/libs/spandsp/tests/fax_tester.c
+++ b/libs/spandsp/tests/fax_tester.c
@@ -33,6 +33,7 @@
#include
#include
#include
+#include
#if defined(HAVE_TGMATH_H)
#include
#endif
@@ -59,10 +60,102 @@
#include "spandsp.h"
+#include "fax_utils.h"
#include "fax_tester.h"
#define HDLC_FRAMING_OK_THRESHOLD 5
+extern const char *output_tiff_file_name;
+
+struct xml_node_parms_s
+{
+ xmlChar *dir;
+ xmlChar *type;
+ xmlChar *modem;
+ xmlChar *value;
+ xmlChar *tag;
+ xmlChar *bad_rows;
+ xmlChar *crc_error;
+ xmlChar *pattern;
+ xmlChar *timein;
+ xmlChar *timeout;
+ xmlChar *min_bits;
+ xmlChar *frame_size;
+ xmlChar *block;
+ xmlChar *compression;
+};
+
+static struct
+{
+ const char *tag;
+ int code;
+} t30_status[] =
+{
+ {"OK", T30_ERR_OK},
+ {"CEDTONE", T30_ERR_CEDTONE},
+ {"T0_EXPIRED", T30_ERR_T0_EXPIRED},
+ {"T1_EXPIRED", T30_ERR_T1_EXPIRED},
+ {"T3_EXPIRED", T30_ERR_T3_EXPIRED},
+ {"HDLC_CARRIER", T30_ERR_HDLC_CARRIER},
+ {"CANNOT_TRAIN", T30_ERR_CANNOT_TRAIN},
+ {"OPER_INT_FAIL", T30_ERR_OPER_INT_FAIL},
+ {"INCOMPATIBLE", T30_ERR_INCOMPATIBLE},
+ {"RX_INCAPABLE", T30_ERR_RX_INCAPABLE},
+ {"TX_INCAPABLE", T30_ERR_TX_INCAPABLE},
+ {"NORESSUPPORT", T30_ERR_NORESSUPPORT},
+ {"NOSIZESUPPORT", T30_ERR_NOSIZESUPPORT},
+ {"UNEXPECTED", T30_ERR_UNEXPECTED},
+ {"TX_BADDCS", T30_ERR_TX_BADDCS},
+ {"TX_BADPG", T30_ERR_TX_BADPG},
+ {"TX_ECMPHD", T30_ERR_TX_ECMPHD},
+ {"TX_GOTDCN", T30_ERR_TX_GOTDCN},
+ {"TX_INVALRSP", T30_ERR_TX_INVALRSP},
+ {"TX_NODIS", T30_ERR_TX_NODIS},
+ {"TX_PHBDEAD", T30_ERR_TX_PHBDEAD},
+ {"TX_PHDDEAD", T30_ERR_TX_PHDDEAD},
+ {"TX_T5EXP", T30_ERR_TX_T5EXP},
+ {"RX_ECMPHD", T30_ERR_RX_ECMPHD},
+ {"RX_GOTDCS", T30_ERR_RX_GOTDCS},
+ {"RX_INVALCMD", T30_ERR_RX_INVALCMD},
+ {"RX_NOCARRIER", T30_ERR_RX_NOCARRIER},
+ {"RX_NOEOL", T30_ERR_RX_NOEOL},
+ {"RX_NOFAX", T30_ERR_RX_NOFAX},
+ {"RX_T2EXPDCN", T30_ERR_RX_T2EXPDCN},
+ {"RX_T2EXPD", T30_ERR_RX_T2EXPD},
+ {"RX_T2EXPFAX", T30_ERR_RX_T2EXPFAX},
+ {"RX_T2EXPMPS", T30_ERR_RX_T2EXPMPS},
+ {"RX_T2EXPRR", T30_ERR_RX_T2EXPRR},
+ {"RX_T2EXP", T30_ERR_RX_T2EXP},
+ {"RX_DCNWHY", T30_ERR_RX_DCNWHY},
+ {"RX_DCNDATA", T30_ERR_RX_DCNDATA},
+ {"RX_DCNFAX", T30_ERR_RX_DCNFAX},
+ {"RX_DCNPHD", T30_ERR_RX_DCNPHD},
+ {"RX_DCNRRD", T30_ERR_RX_DCNRRD},
+ {"RX_DCNNORTN", T30_ERR_RX_DCNNORTN},
+ {"FILEERROR", T30_ERR_FILEERROR},
+ {"NOPAGE", T30_ERR_NOPAGE},
+ {"BADTIFF", T30_ERR_BADTIFF},
+ {"BADPAGE", T30_ERR_BADPAGE},
+ {"BADTAG", T30_ERR_BADTAG},
+ {"BADTIFFHDR", T30_ERR_BADTIFFHDR},
+ {"NOMEM", T30_ERR_NOMEM},
+ {"RETRYDCN", T30_ERR_RETRYDCN},
+ {"CALLDROPPED", T30_ERR_CALLDROPPED},
+ {"NOPOLL", T30_ERR_NOPOLL},
+ {"IDENT_UNACCEPTABLE", T30_ERR_IDENT_UNACCEPTABLE},
+ {"SUB_UNACCEPTABLE", T30_ERR_SUB_UNACCEPTABLE},
+ {"SEP_UNACCEPTABLE", T30_ERR_SEP_UNACCEPTABLE},
+ {"PSA_UNACCEPTABLE", T30_ERR_PSA_UNACCEPTABLE},
+ {"SID_UNACCEPTABLE", T30_ERR_SID_UNACCEPTABLE},
+ {"PWD_UNACCEPTABLE", T30_ERR_PWD_UNACCEPTABLE},
+ {"TSA_UNACCEPTABLE", T30_ERR_TSA_UNACCEPTABLE},
+ {"IRA_UNACCEPTABLE", T30_ERR_IRA_UNACCEPTABLE},
+ {"CIA_UNACCEPTABLE", T30_ERR_CIA_UNACCEPTABLE},
+ {"ISP_UNACCEPTABLE", T30_ERR_ISP_UNACCEPTABLE},
+ {"CSA_UNACCEPTABLE", T30_ERR_CSA_UNACCEPTABLE},
+ {NULL, -1}
+};
+
static void timer_update(faxtester_state_t *s, int len)
{
s->timer += len;
diff --git a/libs/spandsp/tests/g726_tests.c b/libs/spandsp/tests/g726_tests.c
index 75d1a542cd..45f64c228a 100644
--- a/libs/spandsp/tests/g726_tests.c
+++ b/libs/spandsp/tests/g726_tests.c
@@ -90,7 +90,7 @@ uint8_t unpacked[MAX_TEST_VECTOR_LEN];
uint8_t xlaw[MAX_TEST_VECTOR_LEN];
/*
-Table 4 - V Reset and homing sequences for u-law
+Table 4 - Reset and homing sequences for u-law
Normal I-input Overload
Algorithm Input Intermediate Output Input Output Input Intermediate Output
(PCM) (ADPCM) (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM)
@@ -108,7 +108,7 @@ Algorithm Input Intermediate Output Input Output Input
HN40FM.I HN40FM.O HI40FM.O HV40FM.I HV40FM.O
-Table 5 - V Reset and homing sequences for A-law
+Table 5 - Reset and homing sequences for A-law
Normal I-input Overload
Algorithm Input Intermediate Output Input Output Input Intermediate Output
(PCM) (ADPCM) (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM)
diff --git a/libs/spandsp/tests/oki_adpcm_tests.c b/libs/spandsp/tests/oki_adpcm_tests.c
index 84604b69be..a9eef7e1ae 100644
--- a/libs/spandsp/tests/oki_adpcm_tests.c
+++ b/libs/spandsp/tests/oki_adpcm_tests.c
@@ -275,7 +275,6 @@ int main(int argc, char *argv[])
}
}
-
oki_adpcm_free(oki_enc_state);
if (sf_close_telephony(inhandle))
{
diff --git a/libs/spandsp/tests/t42_tests.c b/libs/spandsp/tests/t42_tests.c
index d9f80da5b5..fd42133dfd 100644
--- a/libs/spandsp/tests/t42_tests.c
+++ b/libs/spandsp/tests/t42_tests.c
@@ -43,7 +43,7 @@
#include "spandsp.h"
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
#include
#endif
@@ -157,7 +157,7 @@ int main(int argc, char *argv[])
logging = span_log_init(NULL, SPAN_LOG_FLOW, "T.42");
#endif
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
TIFF_FX_init();
#endif
diff --git a/libs/spandsp/tests/t43_tests.c b/libs/spandsp/tests/t43_tests.c
index 3df17ea7f2..dff6bc1978 100644
--- a/libs/spandsp/tests/t43_tests.c
+++ b/libs/spandsp/tests/t43_tests.c
@@ -43,7 +43,7 @@
#include "spandsp.h"
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
#include
#endif
@@ -63,7 +63,7 @@ typedef struct
int ptr;
} packer_t;
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
/* TIFF-FX related extensions to the tag set supported by libtiff */
static const TIFFFieldInfo tiff_fx_tiff_field_info[] =
{
@@ -184,7 +184,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[])
uint8_t *out_buf;
uint8_t *out_buf2;
packer_t packer;
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
toff_t diroff;
#endif
@@ -222,7 +222,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[])
TIFFSetField(tif, TIFFTAG_MAKE, "soft-switch.org");
TIFFSetField(tif, TIFFTAG_MODEL, "spandsp");
TIFFSetField(tif, TIFFTAG_HOSTCOMPUTER, "i7.coppice.org");
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
/* Make space for this to be filled in later */
TIFFSetField(tif, TIFFTAG_GLOBALPARAMETERSIFD, 0);
#endif
@@ -310,7 +310,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[])
if (!TIFFWriteDirectory(tif))
printf("Failed to write directory.\n");
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
if (!TIFFCreateCustomDirectory(tif, &tiff_fx_field_array))
{
TIFFSetField(tif, TIFFTAG_PROFILETYPE, PROFILETYPE_G3_FAX);
@@ -337,7 +337,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[])
int read_file(meta_t *meta, int page)
{
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
static const char *tiff_fx_fax_profiles[] =
{
"???",
@@ -419,7 +419,7 @@ int read_file(meta_t *meta, int page)
meta->bmax = 0.0f;
break;
}
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
if (TIFFGetField(tif, TIFFTAG_DECODE, &parm16, &fl_parms))
{
meta->lmin = fl_parms[0];
@@ -432,7 +432,7 @@ int read_file(meta_t *meta, int page)
}
#endif
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
printf("Trying to get global parameters\n");
if (TIFFGetField(tif, TIFFTAG_GLOBALPARAMETERSIFD, &diroff))
{
@@ -891,7 +891,7 @@ int main(int argc, char *argv[])
meta_t meta;
int output_compression;
int page_no;
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
toff_t diroff;
#endif
@@ -900,7 +900,7 @@ int main(int argc, char *argv[])
destination_file = OUT_FILE_NAME;
output_compression = (argc > 2) ? atoi(argv[2]) : COMPRESSION_CCITT_T6;
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
TIFF_FX_init();
#endif
@@ -1305,7 +1305,7 @@ int main(int argc, char *argv[])
TIFFSetField(tif, TIFFTAG_MAKE, "soft-switch.org");
TIFFSetField(tif, TIFFTAG_MODEL, "spandsp");
TIFFSetField(tif, TIFFTAG_HOSTCOMPUTER, "i7.coppice.org");
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
/* Make space for this to be filled in later */
TIFFSetField(tif, TIFFTAG_GLOBALPARAMETERSIFD, 0);
#endif
@@ -1379,7 +1379,7 @@ int main(int argc, char *argv[])
if (!TIFFWriteDirectory(tif))
printf("Failed to write directory.\n");
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
if (!TIFFCreateCustomDirectory(tif, &tiff_fx_field_array))
{
TIFFSetField(tif, TIFFTAG_PROFILETYPE, PROFILETYPE_G3_FAX);
diff --git a/libs/spandsp/tests/time_scale_tests.c b/libs/spandsp/tests/time_scale_tests.c
index abd5300fdf..4e902c2eae 100644
--- a/libs/spandsp/tests/time_scale_tests.c
+++ b/libs/spandsp/tests/time_scale_tests.c
@@ -65,6 +65,8 @@ int main(int argc, char *argv[])
int out_frames;
int count;
int max;
+ int samples_in;
+ int samples_out;
time_scale_state_t state;
float rate;
float sample_rate;
@@ -129,9 +131,19 @@ int main(int argc, char *argv[])
max = time_scale_max_output_len(&state, BLOCK_LEN);
printf("Rate is %f, longest output block is %d\n", rate, max);
count = 0;
+ samples_in = 0;
+ samples_out = 0;
while ((frames = sf_readf_short(inhandle, in, BLOCK_LEN)))
{
+ samples_in += frames;
new_frames = time_scale(&state, out, in, frames);
+ if (new_frames > max)
+ {
+ printf("Generated signal has more than the expected maximum samples - %d vs %d\n", new_frames, max);
+ printf("Tests failed\n");
+ exit(2);
+ }
+ samples_out += new_frames;
out_frames = sf_writef_short(outhandle, out, new_frames);
if (out_frames != new_frames)
{
@@ -152,7 +164,27 @@ int main(int argc, char *argv[])
count = 0;
}
}
+ new_frames = time_scale_flush(&state, out);
+ if (new_frames > max)
+ {
+ printf("Generated signal has more than the expected maximum samples - %d vs %d\n", new_frames, max);
+ printf("Tests failed\n");
+ exit(2);
+ }
+ samples_out += new_frames;
+ out_frames = sf_writef_short(outhandle, out, new_frames);
+ if (out_frames != new_frames)
+ {
+ fprintf(stderr, " Error writing audio file\n");
+ exit(2);
+ }
time_scale_release(&state);
+ if ((int) (rate*samples_in) < samples_out - 1 || (int) (rate*samples_in) > samples_out + 1)
+ {
+ printf("%d samples became %d samples\n", (int) (rate*samples_in), samples_out);
+ printf("Tests failed\n");
+ exit(2);
+ }
if (sf_close(inhandle))
{
printf(" Cannot close audio file '%s'\n", in_file_name);
diff --git a/libs/spandsp/tests/tsb85_extra_tests.sh b/libs/spandsp/tests/tsb85_extra_tests.sh
index 7b6a52d46f..d7a3b08d40 100755
--- a/libs/spandsp/tests/tsb85_extra_tests.sh
+++ b/libs/spandsp/tests/tsb85_extra_tests.sh
@@ -17,7 +17,7 @@
run_tsb85_test()
{
- rm -f fax_tests_1.tif
+ rm -f tsb85_tests.tif
echo ./tsb85_tests ${TEST}
./tsb85_tests -x ../spandsp/fax-tests.xml ${TEST} 2>xyzzy2
RETVAL=$?
@@ -28,7 +28,7 @@ run_tsb85_test()
fi
}
-for TEST in PPS-MPS-lost-PPS V17-12000-V29-9600 Phase-D-collision Modem-change-at-CTC
+for TEST in PPS-MPS-lost-PPS V17-12000-V29-9600 Phase-D-collision Modem-change-at-CTC ECM-DCN-clipped Non-ECM-DCN-clipped Tx-EOP-echo Tx-PPS-echo
do
run_tsb85_test
done
diff --git a/libs/spandsp/tests/tsb85_tests.c b/libs/spandsp/tests/tsb85_tests.c
index 4c1559c5dc..624dcb1f6c 100644
--- a/libs/spandsp/tests/tsb85_tests.c
+++ b/libs/spandsp/tests/tsb85_tests.c
@@ -60,8 +60,8 @@
#include "spandsp.h"
#include "spandsp-sim.h"
-#include "fax_tester.h"
#include "fax_utils.h"
+#include "fax_tester.h"
#define OUTPUT_TIFF_FILE_NAME "tsb85.tif"
diff --git a/libs/spandsp/tests/tsb85_tests.sh b/libs/spandsp/tests/tsb85_tests.sh
index ed39b1c524..f20bbfaa97 100755
--- a/libs/spandsp/tests/tsb85_tests.sh
+++ b/libs/spandsp/tests/tsb85_tests.sh
@@ -17,7 +17,7 @@
run_tsb85_test()
{
- rm -f fax_tests_1.tif
+ rm -f tsb85_tests.tif
echo ./tsb85_tests ${TEST}
./tsb85_tests ${TEST} 2>xyzzy2
RETVAL=$?
@@ -33,11 +33,6 @@ do
run_tsb85_test
done
-#MRGN14 fails because we don't adequately distinguish between receiving a
-#bad image signal and receiving none at all.
-#MRGN16 fails because we don't adequately distinguish between receiving a
-#bad image signal and receiving none at all.
-
for TEST in MRGN09 MRGN10 MRGN11 MRGN12 MRGN13 MRGN14 MRGN15 MRGN16 MRGN17
do
run_tsb85_test
@@ -53,10 +48,6 @@ do
run_tsb85_test
done
-# MRGX03 is failing because the V.27ter modem says it trained on HDLC
-# MRGX05 is failing because we don't distinguish MPS immediately after MCF from MPS after
-# a corrupt image signal.
-
for TEST in MRGX01 MRGX02 MRGX03 MRGX04 MRGX05 MRGX06 MRGX07 MRGX08
do
run_tsb85_test
diff --git a/libs/win32/Download 16khz music.2008.vcproj b/libs/win32/Download 16khz music.2008.vcproj
index 4e787856ca..c96daf0c5f 100644
--- a/libs/win32/Download 16khz music.2008.vcproj
+++ b/libs/win32/Download 16khz music.2008.vcproj
@@ -75,7 +75,7 @@
@@ -85,7 +85,7 @@
diff --git a/libs/win32/Download 16khz music.2010.vcxproj b/libs/win32/Download 16khz music.2010.vcxproj
index e133fff984..7d699b75ef 100644
--- a/libs/win32/Download 16khz music.2010.vcxproj
+++ b/libs/win32/Download 16khz music.2010.vcxproj
@@ -64,13 +64,13 @@
Document
Downloading 16khzsound.
set /P SOUND_VERSION=<"$(ProjectDir)..\..\build\moh_version.txt"
-if not exist "$(ProjectDir)..\sounds\music\16000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-16000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
+if not exist "$(ProjectDir)..\sounds\music\16000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-16000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
$(ProjectDir)..\sounds\music\16000;%(Outputs)
Downloading 16khzsound.
set /P SOUND_VERSION=<"$(ProjectDir)..\..\build\moh_version.txt"
-if not exist "$(ProjectDir)..\sounds\music\16000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-16000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
+if not exist "$(ProjectDir)..\sounds\music\16000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-16000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
$(ProjectDir)..\sounds\music\16000;%(Outputs)
@@ -79,4 +79,4 @@ if not exist "$(ProjectDir)..\sounds\music\16000" cscript /nologo "$(ProjectDir)
-
\ No newline at end of file
+
diff --git a/libs/win32/Download 16khz music.2012.vcxproj b/libs/win32/Download 16khz music.2012.vcxproj
index 996134018d..db3417e7ae 100644
--- a/libs/win32/Download 16khz music.2012.vcxproj
+++ b/libs/win32/Download 16khz music.2012.vcxproj
@@ -66,13 +66,13 @@
Document
Downloading 16khzsound.
set /P SOUND_VERSION=<"$(ProjectDir)..\..\build\moh_version.txt"
-if not exist "$(ProjectDir)..\sounds\music\16000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-16000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
+if not exist "$(ProjectDir)..\sounds\music\16000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-16000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
$(ProjectDir)..\sounds\music\16000;%(Outputs)
Downloading 16khzsound.
set /P SOUND_VERSION=<"$(ProjectDir)..\..\build\moh_version.txt"
-if not exist "$(ProjectDir)..\sounds\music\16000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-16000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
+if not exist "$(ProjectDir)..\sounds\music\16000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-16000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
$(ProjectDir)..\sounds\music\16000;%(Outputs)
diff --git a/libs/win32/Download 32khz music.2008.vcproj b/libs/win32/Download 32khz music.2008.vcproj
index 2161fcd5c9..d44ec511a8 100644
--- a/libs/win32/Download 32khz music.2008.vcproj
+++ b/libs/win32/Download 32khz music.2008.vcproj
@@ -75,7 +75,7 @@
@@ -85,7 +85,7 @@
diff --git a/libs/win32/Download 32khz music.2010.vcxproj b/libs/win32/Download 32khz music.2010.vcxproj
index 5fd32268b0..3e6d89db48 100644
--- a/libs/win32/Download 32khz music.2010.vcxproj
+++ b/libs/win32/Download 32khz music.2010.vcxproj
@@ -64,13 +64,13 @@
Document
Downloading 32khzsound.
set /P SOUND_VERSION=<"$(ProjectDir)..\..\build\moh_version.txt"
-if not exist "$(ProjectDir)..\sounds\music\32000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-32000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
+if not exist "$(ProjectDir)..\sounds\music\32000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-32000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
$(ProjectDir)..\sounds\music\32000;%(Outputs)
Downloading 32khzsound.
set /P SOUND_VERSION=<"$(ProjectDir)..\..\build\moh_version.txt"
-if not exist "$(ProjectDir)..\sounds\music\32000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-32000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
+if not exist "$(ProjectDir)..\sounds\music\32000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-32000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
$(ProjectDir)..\sounds\music\32000;%(Outputs)
@@ -79,4 +79,4 @@ if not exist "$(ProjectDir)..\sounds\music\32000" cscript /nologo "$(ProjectDir)
-
\ No newline at end of file
+
diff --git a/libs/win32/Download 32khz music.2012.vcxproj b/libs/win32/Download 32khz music.2012.vcxproj
index 11baeea278..c3d5acefdb 100644
--- a/libs/win32/Download 32khz music.2012.vcxproj
+++ b/libs/win32/Download 32khz music.2012.vcxproj
@@ -66,13 +66,13 @@
Document
Downloading 32khzsound.
set /P SOUND_VERSION=<"$(ProjectDir)..\..\build\moh_version.txt"
-if not exist "$(ProjectDir)..\sounds\music\32000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-32000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
+if not exist "$(ProjectDir)..\sounds\music\32000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-32000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
$(ProjectDir)..\sounds\music\32000;%(Outputs)
Downloading 32khzsound.
set /P SOUND_VERSION=<"$(ProjectDir)..\..\build\moh_version.txt"
-if not exist "$(ProjectDir)..\sounds\music\32000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-32000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
+if not exist "$(ProjectDir)..\sounds\music\32000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-32000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
$(ProjectDir)..\sounds\music\32000;%(Outputs)
diff --git a/libs/win32/Download 8khz music.2008.vcproj b/libs/win32/Download 8khz music.2008.vcproj
index da891ece8b..aa5430325a 100644
--- a/libs/win32/Download 8khz music.2008.vcproj
+++ b/libs/win32/Download 8khz music.2008.vcproj
@@ -75,7 +75,7 @@
@@ -85,7 +85,7 @@
diff --git a/libs/win32/Download 8khz music.2010.vcxproj b/libs/win32/Download 8khz music.2010.vcxproj
index feef7cd991..6936b2a8b6 100644
--- a/libs/win32/Download 8khz music.2010.vcxproj
+++ b/libs/win32/Download 8khz music.2010.vcxproj
@@ -63,12 +63,12 @@
Document
Downloading 8khzsound.
set /P SOUND_VERSION=<"$(ProjectDir)..\..\build\moh_version.txt"
-if not exist "$(ProjectDir)..\sounds\music\8000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-8000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
+if not exist "$(ProjectDir)..\sounds\music\8000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-8000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
$(ProjectDir)..\sounds\music\8000;%(Outputs)
Downloading 8khzsound.
set /P SOUND_VERSION=<"$(ProjectDir)..\..\build\moh_version.txt"
-if not exist "$(ProjectDir)..\sounds\music\8000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-8000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
+if not exist "$(ProjectDir)..\sounds\music\8000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-8000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
$(ProjectDir)..\sounds\music\8000;%(Outputs)
@@ -76,4 +76,4 @@ if not exist "$(ProjectDir)..\sounds\music\8000" cscript /nologo "$(ProjectDir)u
-
\ No newline at end of file
+
diff --git a/libs/win32/Download 8khz music.2012.vcxproj b/libs/win32/Download 8khz music.2012.vcxproj
index fb23e53b42..7099dfb430 100644
--- a/libs/win32/Download 8khz music.2012.vcxproj
+++ b/libs/win32/Download 8khz music.2012.vcxproj
@@ -66,12 +66,12 @@
Document
Downloading 8khzsound.
set /P SOUND_VERSION=<"$(ProjectDir)..\..\build\moh_version.txt"
-if not exist "$(ProjectDir)..\sounds\music\8000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-8000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
+if not exist "$(ProjectDir)..\sounds\music\8000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-8000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
$(ProjectDir)..\sounds\music\8000;%(Outputs)
Downloading 8khzsound.
set /P SOUND_VERSION=<"$(ProjectDir)..\..\build\moh_version.txt"
-if not exist "$(ProjectDir)..\sounds\music\8000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/freeswitch-sounds-music-8000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
+if not exist "$(ProjectDir)..\sounds\music\8000" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-8000-%SOUND_VERSION%.tar.gz "$(ProjectDir)..\sounds"
$(ProjectDir)..\sounds\music\8000;%(Outputs)
diff --git a/libs/win32/util.vbs b/libs/win32/util.vbs
index 1bf4e3fdc4..c3d017202a 100644
--- a/libs/win32/util.vbs
+++ b/libs/win32/util.vbs
@@ -55,7 +55,7 @@ End If
' *******************
Sub WgetSounds(PrimaryName, Freq, DestFolder, VersionFile)
- BaseURL = "http://files.freeswitch.org/freeswitch-sounds"
+ BaseURL = "http://files.freeswitch.org/releases/sounds/freeswitch-sounds"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(VersionFile,1)
Do Until objTextFile.AtEndOfStream
diff --git a/scripts/freeswitch.pkg_deps.sh b/scripts/freeswitch.pkg_deps.sh
index 703cc4be05..34569d5950 100755
--- a/scripts/freeswitch.pkg_deps.sh
+++ b/scripts/freeswitch.pkg_deps.sh
@@ -9,14 +9,14 @@ wget -c http://svn.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz
wget -c http://svn.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-latest.tar.gz
wget -c http://svn.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz
wget -c http://svn.freeswitch.org/downloads/libs/sphinxbase-0.4.99-latest.tar.gz
-wget -c http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.8.tar.gz
-wget -c http://files.freeswitch.org/freeswitch-sounds-music-16000-1.0.8.tar.gz
-wget -c http://files.freeswitch.org/freeswitch-sounds-music-32000-1.0.8.tar.gz
-wget -c http://files.freeswitch.org/freeswitch-sounds-music-48000-1.0.8.tar.gz
-wget -c http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.11.tar.gz
-wget -c http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-1.0.11.tar.gz
-wget -c http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-1.0.11.tar.gz
-wget -c http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-1.0.11.tar.gz
+wget -c http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-8000-1.0.8.tar.gz
+wget -c http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-16000-1.0.8.tar.gz
+wget -c http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-32000-1.0.8.tar.gz
+wget -c http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-48000-1.0.8.tar.gz
+wget -c http://files.freeswitch.org/releases/sounds/freeswitch-sounds-en-us-callie-8000-1.0.11.tar.gz
+wget -c http://files.freeswitch.org/releases/sounds/freeswitch-sounds-en-us-callie-16000-1.0.11.tar.gz
+wget -c http://files.freeswitch.org/releases/sounds/freeswitch-sounds-en-us-callie-32000-1.0.11.tar.gz
+wget -c http://files.freeswitch.org/releases/sounds/freeswitch-sounds-en-us-callie-48000-1.0.11.tar.gz
wget -c http://svn.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz
diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h
index 5411d26332..4b8be156b8 100644
--- a/src/include/private/switch_core_pvt.h
+++ b/src/include/private/switch_core_pvt.h
@@ -222,6 +222,7 @@ struct switch_runtime {
int64_t offset;
switch_event_t *global_vars;
switch_hash_t *mime_types;
+ switch_hash_t *mime_type_exts;
switch_hash_t *ptimes;
switch_memory_pool_t *memory_pool;
const switch_state_handler_table_t *state_handlers[SWITCH_MAX_STATE_HANDLERS];
diff --git a/src/include/switch_core.h b/src/include/switch_core.h
index e783dbd767..c3b31d42a2 100644
--- a/src/include/switch_core.h
+++ b/src/include/switch_core.h
@@ -1574,7 +1574,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec
uint32_t bitrate,
uint32_t flags, const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool);
-SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec,
+ const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_core_codec_parse_fmtp(const char *codec_name, const char *fmtp, uint32_t rate, switch_codec_fmtp_t *codec_fmtp);
SWITCH_DECLARE(switch_status_t) switch_core_codec_reset(switch_codec_t *codec);
@@ -2277,6 +2278,7 @@ SWITCH_DECLARE(uint8_t) switch_core_session_compare(switch_core_session_t *a, sw
SWITCH_DECLARE(uint8_t) switch_core_session_check_interface(switch_core_session_t *session, const switch_endpoint_interface_t *endpoint_interface);
SWITCH_DECLARE(switch_hash_index_t *) switch_core_mime_index(void);
SWITCH_DECLARE(const char *) switch_core_mime_ext2type(const char *ext);
+SWITCH_DECLARE(const char *) switch_core_mime_type2ext(const char *type);
SWITCH_DECLARE(switch_status_t) switch_core_mime_add_type(const char *type, const char *ext);
SWITCH_DECLARE(switch_loadable_module_interface_t *) switch_loadable_module_create_module_interface(switch_memory_pool_t *pool, const char *name);
diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h
index 1915b742ae..808e22fc10 100644
--- a/src/include/switch_core_media.h
+++ b/src/include/switch_core_media.h
@@ -282,7 +282,7 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se
uint32_t channels,
uint8_t negotiated);
-
+SWITCH_DECLARE(switch_status_t) switch_core_media_check_autoadj(switch_core_session_t *session);
SWITCH_DECLARE(switch_rtp_crypto_key_type_t) switch_core_media_crypto_str2type(const char *str);
SWITCH_DECLARE(const char *) switch_core_media_crypto_type2str(switch_rtp_crypto_key_type_t type);
SWITCH_DECLARE(int) switch_core_media_crypto_keylen(switch_rtp_crypto_key_type_t type);
diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h
index 20e1cdfa45..155ba583fb 100644
--- a/src/include/switch_ivr.h
+++ b/src/include/switch_ivr.h
@@ -60,6 +60,7 @@ SWITCH_BEGIN_EXTERN_C struct switch_unicast_conninfo {
int type;
int transport;
int stream_id;
+ switch_thread_t *thread;
};
typedef struct switch_unicast_conninfo switch_unicast_conninfo_t;
diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h
index 395c1b5e16..120e319838 100644
--- a/src/include/switch_utils.h
+++ b/src/include/switch_utils.h
@@ -43,7 +43,7 @@
SWITCH_BEGIN_EXTERN_C
-#define SWITCH_URL_UNSAFE "\r\n \"#%&+:;<=>?@[\\]^`{|}"
+#define SWITCH_URL_UNSAFE "\r\n #%&+:;<=>?@[\\]^`{|}\""
/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii
diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c
index d7eb90b417..a72a6b96af 100644
--- a/src/mod/applications/mod_dptools/mod_dptools.c
+++ b/src/mod/applications/mod_dptools/mod_dptools.c
@@ -515,7 +515,9 @@ SWITCH_STANDARD_APP(play_and_detect_speech_function)
char *grammar = argv[1];
char *result = NULL;
switch_ivr_play_and_detect_speech(session, file, engine, grammar, &result, 0, NULL);
- switch_channel_set_variable(channel, "detect_speech_result", result);
+ if (!zstr(result)) {
+ switch_channel_set_variable(channel, "detect_speech_result", result);
+ }
} else {
/* bad input */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", PLAY_AND_DETECT_SPEECH_SYNTAX);
@@ -625,6 +627,28 @@ SWITCH_STANDARD_APP(rename_function)
}
}
+#define TRANSFER_VARS_SYNTAX "<~variable_prefix|variable>"
+SWITCH_STANDARD_APP(transfer_vars_function)
+{
+ char *argv[1] = { 0 };
+ int argc;
+ char *lbuf = NULL;
+
+ if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
+ && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
+ switch_core_session_t *nsession = NULL;
+
+ switch_core_session_get_partner(session, &nsession);
+
+ if (nsession) {
+ switch_ivr_transfer_variable(session, nsession, argv[0]);
+ switch_core_session_rwunlock(nsession);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", TRANSFER_VARS_SYNTAX);
+ }
+ }
+}
+
#define SOFT_HOLD_SYNTAX " [] []"
SWITCH_STANDARD_APP(soft_hold_function)
{
@@ -5667,7 +5691,112 @@ SWITCH_STANDARD_API(page_api_function)
return SWITCH_STATUS_SUCCESS;
}
+/**
+ * Convert DTMF source to human readable string
+ */
+static const char *to_dtmf_source_string(switch_dtmf_source_t source)
+{
+ switch(source) {
+ case SWITCH_DTMF_ENDPOINT: return "SIP INFO";
+ case SWITCH_DTMF_INBAND_AUDIO: return "INBAND";
+ case SWITCH_DTMF_RTP: return "2833";
+ case SWITCH_DTMF_UNKNOWN: return "UNKNOWN";
+ case SWITCH_DTMF_APP: return "APP";
+ }
+ return "UNKNOWN";
+}
+struct deduplicate_dtmf_filter {
+ int only_rtp;
+ char last_dtmf;
+ switch_dtmf_source_t last_dtmf_source;
+};
+
+/**
+ * Filter incoming DTMF and ignore any duplicates
+ */
+static switch_status_t deduplicate_recv_dtmf_hook(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
+{
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ int only_rtp = 0;
+ struct deduplicate_dtmf_filter *filter = switch_channel_get_private(switch_core_session_get_channel(session), "deduplicate_dtmf_filter");
+
+ if (!filter) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Accept %s digit %c: deduplicate filter missing!\n", to_dtmf_source_string(dtmf->source), dtmf->digit);
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ /* remember current state as it might change */
+ only_rtp = filter->only_rtp;
+
+ /* RTP DTMF is preferred over all others- and if it's demonstrated to be available, inband / info detection is disabled */
+ if (only_rtp) {
+ switch (dtmf->source) {
+ case SWITCH_DTMF_ENDPOINT:
+ switch_channel_set_variable(switch_core_session_get_channel(session), "deduplicate_dtmf_seen_endpoint", "true");
+ break;
+ case SWITCH_DTMF_INBAND_AUDIO:
+ switch_channel_set_variable(switch_core_session_get_channel(session), "deduplicate_dtmf_seen_inband", "true");
+ break;
+ case SWITCH_DTMF_RTP:
+ switch_channel_set_variable(switch_core_session_get_channel(session), "deduplicate_dtmf_seen_rtp", "true");
+ /* pass through */
+ case SWITCH_DTMF_UNKNOWN:
+ case SWITCH_DTMF_APP:
+ /* always allow */
+ status = SWITCH_STATUS_SUCCESS;
+ break;
+ }
+ } else {
+ /* accept everything except duplicates until RTP digit is detected */
+ switch (dtmf->source) {
+ case SWITCH_DTMF_INBAND_AUDIO:
+ switch_channel_set_variable(switch_core_session_get_channel(session), "deduplicate_dtmf_seen_inband", "true");
+ break;
+ case SWITCH_DTMF_RTP:
+ switch_channel_set_variable(switch_core_session_get_channel(session), "deduplicate_dtmf_seen_rtp", "true");
+ /* change state to only allow RTP events */
+ filter->only_rtp = 1;
+
+ /* stop inband detector */
+ switch_ivr_broadcast(switch_core_session_get_uuid(session), "spandsp_stop_dtmf::", SMF_ECHO_ALEG);
+ break;
+ case SWITCH_DTMF_ENDPOINT:
+ switch_channel_set_variable(switch_core_session_get_channel(session), "deduplicate_dtmf_seen_endpoint", "true");
+ break;
+ case SWITCH_DTMF_UNKNOWN:
+ case SWITCH_DTMF_APP:
+ /* always allow */
+ status = SWITCH_STATUS_SUCCESS;
+ break;
+ }
+
+ /* make sure not a duplicate DTMF */
+ if (filter->last_dtmf_source == dtmf->source || filter->last_dtmf != dtmf->digit) {
+ status = SWITCH_STATUS_SUCCESS;
+ }
+ filter->last_dtmf = dtmf->digit;
+ filter->last_dtmf_source = dtmf->source;
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "(%s) %s %s digit %c\n",
+ (only_rtp) ? "ALLOW 2833" : "ALLOW ALL",
+ (status == SWITCH_STATUS_SUCCESS) ? "Accept" : "Ignore", to_dtmf_source_string(dtmf->source), dtmf->digit);
+
+ return status;
+}
+
+SWITCH_STANDARD_APP(deduplicate_dtmf_app_function)
+{
+ struct deduplicate_dtmf_filter *filter = switch_channel_get_private(switch_core_session_get_channel(session), "deduplicate_dtmf_filter");
+ if (!filter) {
+ filter = switch_core_session_alloc(session, sizeof(*filter));
+ filter->only_rtp = !zstr(data) && !strcmp("only_rtp", data);
+ filter->last_dtmf = 0;
+ switch_channel_set_private(switch_core_session_get_channel(session), "deduplicate_dtmf_filter", filter);
+ switch_core_event_hook_add_recv_dtmf(session, deduplicate_recv_dtmf_hook);
+ }
+}
#define SPEAK_DESC "Speak text to a channel via the tts interface"
#define DISPLACE_DESC "Displace audio from a file to the channels input"
@@ -5897,6 +6026,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SWITCH_ADD_APP(app_interface, "media_reset", "Reset all bypass/proxy media flags", "Reset all bypass/proxy media flags", media_reset_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "mkdir", "Create a directory", "Create a directory", mkdir_function, MKDIR_SYNTAX, SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "rename", "Rename file", "Rename file", rename_function, RENAME_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC);
+ SWITCH_ADD_APP(app_interface, "transfer_vars", "Transfer variables", "Transfer variables", transfer_vars_function, TRANSFER_VARS_SYNTAX,
+ SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC);
SWITCH_ADD_APP(app_interface, "soft_hold", "Put a bridged channel on hold", "Put a bridged channel on hold", soft_hold_function, SOFT_HOLD_SYNTAX,
SAF_NONE);
SWITCH_ADD_APP(app_interface, "bind_meta_app", "Bind a key to an application", "Bind a key to an application", dtmf_bind_function, BIND_SYNTAX,
@@ -5966,6 +6097,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SWITCH_ADD_APP(app_interface, "limit_hash_execute", "Limit", LIMITHASHEXECUTE_DESC, limit_hash_execute_function, LIMITHASHEXECUTE_USAGE, SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "pickup", "Pickup", "Pickup a call", pickup_function, PICKUP_SYNTAX, SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "deduplicate_dtmf", "Prevent duplicate inband + 2833 dtmf", "", deduplicate_dtmf_app_function, "[only_rtp]", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_DIALPLAN(dp_interface, "inline", inline_dialplan_hunt);
diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c
index b27790644b..844f1707dd 100644
--- a/src/mod/applications/mod_httapi/mod_httapi.c
+++ b/src/mod/applications/mod_httapi/mod_httapi.c
@@ -2780,12 +2780,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
}
if (zstr(ext) && headers && (ct = switch_event_get_header(headers, "content-type"))) {
- if (switch_strcasecmp_any(ct, "audio/mpeg", "audio/x-mpeg", "audio/mp3", "audio/x-mp3", "audio/mpeg3",
- "audio/x-mpeg3", "audio/mpg", "audio/x-mpg", "audio/x-mpegaudio", NULL)) {
- newext = "mp3";
- } else if (switch_strcasecmp_any(ct, "audio/x-wav", "audio/x-wave", "audio/wav", "audio/wave", NULL)) {
- newext = "wav";
- }
+ newext = switch_core_mime_type2ext(ct);
}
if (newext) {
diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c
index 7f65d7704e..776a80312f 100644
--- a/src/mod/applications/mod_http_cache/mod_http_cache.c
+++ b/src/mod/applications/mod_http_cache/mod_http_cache.c
@@ -87,6 +87,12 @@ struct cached_url {
char *url;
/** The path and name of the cached URL */
char *filename;
+ /** File extension */
+ char *extension;
+ /** Content-Type of this URL (audio/3gpp) */
+ char *content_type;
+ /** Content-Type parameters (codecs=samr) */
+ const char *content_type_params;
/** The size of the cached URL, in bytes */
size_t size;
/** URL use flag */
@@ -120,6 +126,7 @@ static switch_status_t http_get(url_cache_t *cache, http_profile_t *profile, cac
static size_t get_file_callback(void *ptr, size_t size, size_t nmemb, void *get);
static size_t get_header_callback(void *ptr, size_t size, size_t nmemb, void *url);
static void process_cache_control_header(cached_url_t *url, char *data);
+static void process_content_type_header(cached_url_t *url, char *data);
static switch_status_t http_put(url_cache_t *cache, http_profile_t *profile, switch_core_session_t *session, const char *url, const char *filename, int cache_local_file);
@@ -479,8 +486,32 @@ static void process_cache_control_header(cached_url_t *url, char *data)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "setting max age to %u seconds from now\n", (int)max_age);
}
+/**
+ * Content-Type: audio/mpeg; foo=bar
+ */
+static void process_content_type_header(cached_url_t *url, char *data)
+{
+ char *params;
+
+ /* trim whitespace and check if empty */
+ data = trim(data);
+ if (zstr(data)) {
+ return;
+ }
+
+ /* copy header, removing any params */
+ url->content_type = strdup(data);
+ params = strchr(url->content_type, ';');
+ if (params) {
+ *params = '\0';
+ url->content_type_params = trim(++params);
+ }
+}
+
#define CACHE_CONTROL_HEADER "cache-control:"
#define CACHE_CONTROL_HEADER_LEN (sizeof(CACHE_CONTROL_HEADER) - 1)
+#define CONTENT_TYPE_HEADER "content-type:"
+#define CONTENT_TYPE_HEADER_LEN (sizeof(CONTENT_TYPE_HEADER) - 1)
/**
* Called by libcurl to process headers from HTTP GET response
* @param ptr the header data
@@ -508,6 +539,8 @@ static size_t get_header_callback(void *ptr, size_t size, size_t nmemb, void *ge
/* check which header this is and process it */
if (!strncasecmp(CACHE_CONTROL_HEADER, header, CACHE_CONTROL_HEADER_LEN)) {
process_cache_control_header(url, header + CACHE_CONTROL_HEADER_LEN);
+ } else if (!strncasecmp(CONTENT_TYPE_HEADER, header, CONTENT_TYPE_HEADER_LEN)) {
+ process_content_type_header(url, header + CONTENT_TYPE_HEADER_LEN);
}
switch_safe_free(header);
@@ -819,38 +852,51 @@ static http_profile_t *url_cache_http_profile_add(url_cache_t *cache, const char
/**
* Find file extension at end of URL.
- * @return file extension or NULL if it doesn't exist
+ * @param url to search
+ * @param found_extension
+ * @param found_extension_len
*/
-static const char *find_extension(const char *url)
+static void find_extension(const char *url, const char **found_extension, size_t *found_extension_len)
{
const char *ext;
+ size_t ext_len = 0;
/* find extension on the end of URL */
for (ext = &url[strlen(url) - 1]; ext != url; ext--) {
if (*ext == '/' || *ext == '\\') {
break;
}
- if (*ext == '.') {
+ if (*ext == '?' || *ext == '#') {
+ ext_len = 0;
+ } else if (*ext == '.') {
/* found it */
- return ++ext;
+ *found_extension_len = ext_len;
+ *found_extension = ++ext;
+ break;
+ } else {
+ ext_len++;
}
}
- return NULL;
}
/**
* Create a cached URL filename.
- * @param cache the cache
- * @param extension the filename extension
+ * @param cache
+ * @param url
+ * @param extension if set, extension is duplicated here
* @return the cached URL filename. Free when done.
*/
-static char *cached_url_filename_create(url_cache_t *cache, const char *extension)
+static char *cached_url_filename_create(url_cache_t *cache, const char *url, char **extension)
{
char *filename;
char *dirname;
char uuid_dir[3] = { 0 };
switch_uuid_t uuid;
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 };
+ const char *found_extension = NULL;
+ size_t found_extension_len = 0;
+
+ find_extension(url, &found_extension, &found_extension_len);
/* filename is constructed from UUID and is stored in cache dir (first 2 characters of UUID) */
switch_uuid_get(&uuid);
@@ -861,15 +907,47 @@ static char *cached_url_filename_create(url_cache_t *cache, const char *extensio
/* create sub-directory if it doesn't exist */
switch_dir_make_recursive(dirname, SWITCH_DEFAULT_DIR_PERMS, cache->pool);
- if (!zstr(extension)) {
- filename = switch_mprintf("%s%s%s.%s", dirname, SWITCH_PATH_SEPARATOR, &uuid_str[2], extension);
- } else {
+ if (!zstr(found_extension) && found_extension_len > 0) {
+ char *found_extension_dup = strndup(found_extension, found_extension_len);
+ filename = switch_mprintf("%s%s%s.%s", dirname, SWITCH_PATH_SEPARATOR, &uuid_str[2], found_extension_dup);
+ if (extension) {
+ *extension = found_extension_dup;
+ } else {
+ free(found_extension_dup);
+ }
+ } else {
filename = switch_mprintf("%s%s%s", dirname, SWITCH_PATH_SEPARATOR, &uuid_str[2]);
+ if (extension) {
+ *extension = NULL;
+ }
}
free(dirname);
return filename;
}
+/**
+ * Rename cached URL with filename extension if one can be determined
+ * @param url the cached URL
+ */
+static void cached_url_set_extension_from_content_type(cached_url_t *url, switch_core_session_t *session)
+{
+ if (!url->extension && url->content_type) {
+ const char *new_extension = switch_core_mime_type2ext(url->content_type);
+ if (new_extension) {
+ char *new_filename = switch_mprintf("%s.%s", url->filename, new_extension);
+ if (rename(url->filename, new_filename) != -1) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "renamed cached URL to %s\n", new_filename);
+ free(url->filename);
+ url->filename = new_filename;
+ url->extension = strdup(new_extension);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "rename(%s): %s\n", new_filename, strerror(errno));
+ free(new_filename);
+ }
+ }
+ }
+}
+
/**
* Create a cached URL entry
* @param cache the cache
@@ -889,7 +967,7 @@ static cached_url_t *cached_url_create(url_cache_t *cache, const char *url, cons
/* intialize cached URL */
if (zstr(filename)) {
- u->filename = cached_url_filename_create(cache, find_extension(url));
+ u->filename = cached_url_filename_create(cache, url, &u->extension);
} else {
u->filename = strdup(filename);
}
@@ -914,6 +992,8 @@ static void cached_url_destroy(cached_url_t *url, switch_memory_pool_t *pool)
switch_file_remove(url->filename, pool);
}
switch_safe_free(url->filename);
+ switch_safe_free(url->extension);
+ switch_safe_free(url->content_type);
switch_safe_free(url->url);
switch_safe_free(url);
}
@@ -1022,6 +1102,9 @@ static switch_status_t http_get(url_cache_t *cache, http_profile_t *profile, cac
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "URL %s downloaded in %d ms\n", url->url, duration_ms);
}
+ if (!url->extension) {
+ cached_url_set_extension_from_content_type(url, session);
+ }
} else {
url->size = 0; // nothing downloaded or download interrupted
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Received HTTP error %ld trying to fetch %s\n", httpRes, url->url);
@@ -1095,7 +1178,7 @@ SWITCH_STANDARD_API(http_cache_prefetch)
#define HTTP_GET_SYNTAX "{param=val}"
/**
- * Get a file from the cache, download if it isn't cached
+ * Get a file from the cache, download if it isn' cached
*/
SWITCH_STANDARD_API(http_cache_get)
{
@@ -1564,7 +1647,7 @@ static switch_status_t http_cache_file_open(switch_file_handle_t *handle, const
file_flags |= SWITCH_FILE_FLAG_WRITE;
context->write_url = switch_core_strdup(handle->memory_pool, path);
/* allocate local file in cache */
- context->local_path = cached_url_filename_create(&gcache, find_extension(context->write_url));
+ context->local_path = cached_url_filename_create(&gcache, context->write_url, NULL);
} else {
/* READ = HTTP GET */
file_flags |= SWITCH_FILE_FLAG_READ;
diff --git a/src/mod/applications/mod_mongo/conf/autoload_configs/mongo.conf.xml b/src/mod/applications/mod_mongo/conf/autoload_configs/mongo.conf.xml
index 57f9f6566f..041432a232 100644
--- a/src/mod/applications/mod_mongo/conf/autoload_configs/mongo.conf.xml
+++ b/src/mod/applications/mod_mongo/conf/autoload_configs/mongo.conf.xml
@@ -1,11 +1,17 @@
-
-
-
+
+
+
+
+
+
+
+