Changeset 3165

The T.38 gateway should now be monitoring for CED from the receiving end, and
should try to kick T.38 into gear if it seems it.

Still need to mute which the T.38 negotiation occurs, and check for when that is
abanoned.

Committed by:  coppice
Date:  Jun 26 2007 * 16:30 (about 1 year ago)

Affected files:

callweaver/trunk/apps/app_t38gateway.c (unified diff)

r3164r3165
102102 struct opbx_frame *fr2;
103103 int timeout = -1;
104104 int running = RUNNING;
105 struct opbx_dsp *dsp = NULL;
105 struct opbx_dsp *dsp_cng = NULL;
106 struct opbx_dsp *dsp_ced = NULL;
106107
107 if ((dsp = opbx_dsp_new()) == NULL)
108 if ((dsp_cng = opbx_dsp_new()) == NULL)
108109 {
109110 opbx_log(LOG_WARNING, "Unable to allocate DSP!\n");
110111 }
111112 else
112113 {
113 opbx_dsp_set_threshold(dsp, 256);
114 opbx_dsp_set_features(dsp, DSP_FEATURE_DTMF_DETECT | DSP_FEATURE_FAX_CNG_DETECT);
115 opbx_dsp_digitmode(dsp, DSP_DIGITMODE_DTMF | DSP_DIGITMODE_RELAXDTMF);
114 opbx_dsp_set_threshold(dsp_cng, 256);
115 opbx_dsp_set_features(dsp_cng, DSP_FEATURE_DTMF_DETECT | DSP_FEATURE_FAX_CNG_DETECT);
116 opbx_dsp_digitmode(dsp_cng, DSP_DIGITMODE_DTMF | DSP_DIGITMODE_RELAXDTMF);
116117 }
117118
119 if ((dsp_ced = opbx_dsp_new()) == NULL)
120 {
121 opbx_log(LOG_WARNING, "Unable to allocate DSP!\n");
122 }
123 else
124 {
125 opbx_dsp_set_threshold(dsp_ced, 256);
126 opbx_dsp_set_features(dsp_ced, DSP_FEATURE_FAX_CED_DETECT);
127 }
128
118129 channels[0] = chan;
119130 channels[1] = peer;
120131
------
126137 if ((f = opbx_read(active)))
127138 {
128139
129 if ((active == chan) && dsp)
140 if ((active == chan) && dsp_cng)
130141 fr2 = opbx_frdup(f);
131142 else
132143 fr2 = NULL;
------
137148 channels[0] = inactive;
138149 channels[1] = active;
139150
140 if ((active == chan) && fr2 && dsp)
151 if (active == chan)
141152 {
142 if ((fr2 = opbx_dsp_process(active, dsp, fr2)))
153 /* Look for FAX CNG tone */
154 if (fr2 && dsp_cng)
143155 {
144 if (fr2->frametype == OPBX_FRAME_DTMF)
156 if ((fr2 = opbx_dsp_process(active, dsp_cng, fr2)))
145157 {
146 if (fr2->subclass == 'f')
158 if (fr2->frametype == OPBX_FRAME_DTMF)
147159 {
148 opbx_log(LOG_DEBUG, "Fax detected in T38 Gateway !!!\n");
149 opbx_app_request_t38(active);
160 if (fr2->subclass == 'f')
161 {
162 opbx_log(LOG_DEBUG, "FAX CNG detected in T38 Gateway !!!\n");
163 opbx_app_request_t38(active);
164 }
150165 }
151166 }
152167 }
153168 }
169 else
170 {
171 /* Look for FAX CED tone or V.21 preamble */
172 if (fr2 && dsp_ced)
173 {
174 if ((fr2 = opbx_dsp_process(active, dsp_ced, fr2)))
175 {
176 if (fr2->frametype == OPBX_FRAME_DTMF)
177 {
178 if (fr2->subclass == 'F')
179 {
180 opbx_log(LOG_DEBUG, "FAX CED detected in T38 Gateway !!!\n");
181 opbx_app_request_t38(active);
182 }
183 }
184 }
185 }
186 }
154187 if (f != fr2)
155188 {
156189 if (fr2)
------
168201 break;
169202 }
170203
171 if (dsp)
172 opbx_dsp_free(dsp);
204 if (dsp_cng)
205 opbx_dsp_free(dsp_cng);
206 if (dsp_ced)
207 opbx_dsp_free(dsp_ced);
173208
174209 return running;
175210 }