<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=FR-CA link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-CA>I’ve been playing with spandsp for a couple of days already and couldn’t find much discussion about it to make it work.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-CA>First, I have tried it from the dialplan:<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> <condition field="destination_number" expression="1234" break="never"><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> <action application="log" data="INFO Making a call to 1234 and detecting for the tone"/><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> <action application="start_tone_detect" data="alarm_panel" /><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> <action application="bridge" data="sofia/gateway/${default_gw}/1234"/><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> </span><span style='font-size:9.0pt;font-family:"Courier New"'><action application="hangup"/><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;font-family:"Courier New"'> </condition><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-CA>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. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-CA>This is the lua code I used:<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'>originate_base = "{ignore_early_media=true,originate_timeout=90,hangup_after_bridge=true,leg=1}";<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'>dialstr = "sofia/gateway/mygw/1234";<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'>mySession = null;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'>ostr = originate_base..dialstr;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'>con = freeswitch.EventConsumer("DETECTED_TONE");<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'>freeswitch.consoleLog("info", "Dialing Leg: " .. ostr .. "\n");<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'>mySession = freeswitch.Session(ostr);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'>local hcause = mySession:hangupCause();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'>if ( mySession:ready() ) then<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> freeswitch.consoleLog("info", "We are connected. Start tone detection\n");<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> mySession:execute("sleep", 250);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> mySession:execute("start_tone_detect", "alarm_panel");<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> -- Wait for the HANDSHAKE<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> freeswitch.consoleLog("info", "Now we wait for the HANDSHAKE\n");<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> mySession:execute("sleep", 5000);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> freeswitch.consoleLog("info", "After the 5 seconds sleep\n");<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> for e in (function() return con:pop(1,2000) end) do<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> freeswitch.consoleLog("info", "Got an Event: " .. e:serialize("xml") .. "\n");<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> end<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> -- I guess we are done<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> mySession:hangup();</span><span style='font-size:9.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;font-family:"Courier New"'>end<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-CA>Nada … while the call is answered already, it is still failing:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 21:40:13.835554 [NOTICE] switch_cpp.cpp:78 bound to DETECTED_TONE <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 21:40:13.835554 [NOTICE] switch_channel.c:926 New Channel sofia/external/1234 [e50a57ac-5a05-11e2-9f6a-996996505a23]<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 21:40:14.315558 [NOTICE] sofia.c:6428 Channel [sofia/external/1234] has been answered<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 21:40:14.335571 [INFO] switch_cpp.cpp:1227 We are connected. Start tone detection<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 21:40:14.595560 [INFO] mod_spandsp_dsp.c:464 (sofia/external/1234) initializing tone detector<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 21:40:14.595560 [INFO] switch_cpp.cpp:1227 Now we wait for the HANDSHAKE<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 21:40:14.615556 [INFO] mod_spandsp_dsp.c:475 (sofia/external/1234) error reading frame<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 21:40:14.615556 [INFO] mod_spandsp_dsp.c:500 (sofia/external/1234) destroying tone detector<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 21:40:19.615559 [INFO] switch_cpp.cpp:1227 After the 5 seconds sleep<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 21:40:21.615561 [NOTICE] switch_cpp.cpp:637 Hangup sofia/external/1234 [CS_SOFT_EXECUTE] [NORMAL_CLEARING]<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-CA>The spandsp.conf.xml:<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> <descriptors debug-level="2"><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> <descriptor name="alarm_panel"><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> <tone name="HANDSHAKE"><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> <element freq1="1400" freq2="0" min="95" max="105"/><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> <element freq1="0" freq2="0" min="95" max="105"/><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> <element freq1="2300" freq2="0" min="95" max="105"/><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> </tone><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> <tone name="KISSOFF"><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> <element freq1="1400" freq2="0" min="750" max="1000"/><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-CA style='font-size:9.0pt;font-family:"Courier New"'> </span><span style='font-size:9.0pt;font-family:"Courier New"'></tone><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;font-family:"Courier New"'> </descriptor><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-CA>It is loading as per the DEBUG output:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp.c:449 Adding tone_descriptor: alarm_panel<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp.c:470 Adding tone_descriptor: alarm_panel, tone: HANDSHAKE(0)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>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)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>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)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>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)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp.c:470 Adding tone_descriptor: alarm_panel, tone: KISSOFF(1)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>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)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp_fax.c:192 FAX timer thread started.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 22:08:39.900772 [DEBUG] mod_spandsp.c:574 mod_spandsp loaded, using spandsp library version [20100724 163333]<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>2013-01-08 22:08:39.900772 [CONSOLE] switch_loadable_module.c:1318 Successfully Loaded [mod_spandsp]<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-CA>I am using freeswitch 1.2:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>freeswitch@internal> version<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA>FreeSWITCH Version 1.2.0 (git-1eae279 2012-05-14 13-07-40 -0500)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-CA>I tried using the tone_detect from Freeswitch core but it is not consistent …<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-CA>Anyone made mod_spandsp working?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-CA>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-CA style='mso-fareast-language:FR-CA'>Benoit Raymond</span></b><span lang=EN-CA style='mso-fareast-language:FR-CA'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA style='mso-fareast-language:FR-CA'>AMI Concept Inc.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA style='mso-fareast-language:FR-CA'>Business VoIP Solutions / Web Design<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA style='mso-fareast-language:FR-CA'>Phone: (450) 553-1231<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:10.0pt;mso-fareast-language:FR-CA'><a href="http://www.amiconcept.com/">http://www.amiconcept.com</a><o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>