[Freeswitch-users] mod_spandsp keeps returning "error reading frame"
Benoit Raymond
benoit.raymond at amiconcept.com
Wed Jan 9 06:15:07 MSK 2013
Hi,
I've been playing with spandsp for a couple of days already and couldn't
find much discussion about it to make it work.
First, I have tried it from the dialplan:
<condition field="destination_number" expression="1234" break="never">
<action application="log" data="INFO Making a call to 1234 and
detecting for the tone"/>
<action application="start_tone_detect" data="alarm_panel" />
<action application="bridge" data="sofia/gateway/${default_gw}/1234"/>
<action application="hangup"/>
</condition>
Then I thought it was due to the fact the call hasn't been answered yet so
reverted to create a lua script and test again.
This is the lua code I used:
originate_base =
"{ignore_early_media=true,originate_timeout=90,hangup_after_bridge=true,leg=
1}";
dialstr = "sofia/gateway/mygw/1234";
mySession = null;
ostr = originate_base..dialstr;
con = freeswitch.EventConsumer("DETECTED_TONE");
freeswitch.consoleLog("info", "Dialing Leg: " .. ostr .. "\n");
mySession = freeswitch.Session(ostr);
local hcause = mySession:hangupCause();
if ( mySession:ready() ) then
freeswitch.consoleLog("info", "We are connected. Start tone detection\n");
mySession:execute("sleep", 250);
mySession:execute("start_tone_detect", "alarm_panel");
-- Wait for the HANDSHAKE
freeswitch.consoleLog("info", "Now we wait for the HANDSHAKE\n");
mySession:execute("sleep", 5000);
freeswitch.consoleLog("info", "After the 5 seconds sleep\n");
for e in (function() return con:pop(1,2000) end) do
freeswitch.consoleLog("info", "Got an Event: " .. e:serialize("xml") ..
"\n");
end
-- I guess we are done
mySession:hangup();
end
Nada . while the call is answered already, it is still failing:
2013-01-08 21:40:13.835554 [NOTICE] switch_cpp.cpp:78 bound to DETECTED_TONE
2013-01-08 21:40:13.835554 [INFO] switch_cpp.cpp:1227 Dialing Leg:
{ignore_early_media=true,originate_timeout=90,hangup_after_bridge=true,leg=1
,uuid=9876543210}sofia/gateway/mygw/1234
2013-01-08 21:40:13.835554 [NOTICE] switch_channel.c:926 New Channel
sofia/external/1234 [e50a57ac-5a05-11e2-9f6a-996996505a23]
2013-01-08 21:40:14.315558 [NOTICE] sofia.c:6428 Channel
[sofia/external/1234] has been answered
2013-01-08 21:40:14.335571 [INFO] switch_cpp.cpp:1227 We are connected.
Start tone detection
2013-01-08 21:40:14.595560 [INFO] mod_spandsp_dsp.c:464
(sofia/external/1234) initializing tone detector
2013-01-08 21:40:14.595560 [INFO] switch_cpp.cpp:1227 Now we wait for the
HANDSHAKE
2013-01-08 21:40:14.615556 [INFO] mod_spandsp_dsp.c:475
(sofia/external/1234) error reading frame
2013-01-08 21:40:14.615556 [INFO] mod_spandsp_dsp.c:500
(sofia/external/1234) destroying tone detector
2013-01-08 21:40:19.615559 [INFO] switch_cpp.cpp:1227 After the 5 seconds
sleep
2013-01-08 21:40:21.615561 [NOTICE] switch_cpp.cpp:637 Hangup
sofia/external/1234 [CS_SOFT_EXECUTE] [NORMAL_CLEARING]
The spandsp.conf.xml:
<descriptors debug-level="2">
<descriptor name="alarm_panel">
<tone name="HANDSHAKE">
<element freq1="1400" freq2="0" min="95" max="105"/>
<element freq1="0" freq2="0" min="95" max="105"/>
<element freq1="2300" freq2="0" min="95" max="105"/>
</tone>
<tone name="KISSOFF">
<element freq1="1400" freq2="0" min="750" max="1000"/>
</tone>
</descriptor>
It is loading as per the DEBUG output:
2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp.c:449 Adding tone_descriptor:
alarm_panel
2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp.c:470 Adding tone_descriptor:
alarm_panel, tone: HANDSHAKE(0)
2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp.c:505 Adding tone_descriptor:
alarm_panel, tone: HANDSHAKE(0), element (1400, 0, 95, 105)
2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp.c:505 Adding tone_descriptor:
alarm_panel, tone: HANDSHAKE(0), element (0, 0, 95, 105)
2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp.c:505 Adding tone_descriptor:
alarm_panel, tone: HANDSHAKE(0), element (2300, 0, 95, 105)
2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp.c:470 Adding tone_descriptor:
alarm_panel, tone: KISSOFF(1)
2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp.c:505 Adding tone_descriptor:
alarm_panel, tone: KISSOFF(1), element (1400, 0, 750, 1000)
2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp_fax.c:192 FAX timer thread
started.
2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp.c:574 mod_spandsp loaded,
using spandsp library version [20100724 163333]
2013-01-08 22:08:39.900772 [CONSOLE] switch_loadable_module.c:1318
Successfully Loaded [mod_spandsp]
I am using freeswitch 1.2:
freeswitch at internal> version
FreeSWITCH Version 1.2.0 (git-1eae279 2012-05-14 13-07-40 -0500)
I tried using the tone_detect from Freeswitch core but it is not consistent
.
Anyone made mod_spandsp working?
Thanks,
Benoit Raymond
AMI Concept Inc.
Business VoIP Solutions / Web Design
Phone: (450) 553-1231
http://www.amiconcept.com <http://www.amiconcept.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130108/89a38338/attachment.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list