[Freeswitch-users] busy tone detection

Michael Collins msc at freeswitch.org
Mon Dec 29 23:21:51 PST 2008


On Mon, Dec 29, 2008 at 10:45 PM, Baskar <yudha2008 at gmail.com> wrote:

> Hi Michael Jerris,
>
>  I will explain what i am currently doing : I don't understand
>
> Step 1: From the xlite phone I have dialed a number and we were on the
> conversation with one extension (1007 is my extension and my mobile No
> 9841799874)
>
> Step 2: From the freeswitch console I am executing a javascript file with
> tone detect like the one below,
>
> My JavaScript :
>
> session1 = new Session();
>
> session1.originate(session1,"{ignore_early_media=false}sofia/internal/
> 1003 at 172.20.201.67");
>
> session1.execute("tone_detect","busy 480,620 r +30 transfer '1000' 3");
>
I think the above line is part of the problem. The "+30" literally means
'watch for these tones for 30 milliseconds, and then don't watch any more.'
I think what you want here is +30000. Can you try that and see if there's a
difference?


> session1.execute("bridge", "sofia/default/9841799874 at 172.20.191.228");
>
> session1.execute("transfer", "9841799874");
>
> session1.hangup;
>             In the above script and in step1 the telephone numbers are
> same; since the script is not detecting that the phone number is busy.
>
>
>
> Hi Michael S Collins,
>
>             Please let me know the script, so that it would be helpful for
> me.
>
Here's a simple extension that I use for recording. It uses the uuid of the
call for the file name. I don't know if the "pre_answer" application is
absolutely necessary or not, but I do it just to be certain that I get the
early media.

<extension name="record early media">
  <condition field="destination_number" expression="^82(\d+)$"> <!-- 82 +
phone number -->
      <action application="bridge" data="sofia/default/$1 at 172.20.191.228"/>
      <!-- we can skip all this early media stuff if the far end answers -->
      <action application="set" data="execute_on_answer=transfer ANSWERCALL
XML default"/>
      <action application="sleep" data="100"/>
      <action application="pre_answer"/>
      <action application="record_session" data="/tmp/${uuid}__1.wav"/>
      <action application="sleep" data="500"/>
      <!-- If call gets here then probably we're in progress media; get
ready to handle various tones -->
      <!-- Look for busy and SIT tones right away, then wait a bit before
looking for a ring signal -->
      <action application="tone_detect" data="BUSY 480,620 r +25000 set
BUSY=true"/>  <!-- detect busy -->
      <action application="tone_detect" data="SIT1LO 913.8 r +25000 set
SIT1LO=true"/>   <!--1st segment low -->
      <!-- ... look for other SIT tones if you need to; snipped from this
example -->
      <!-- Now sleep while other end is ringing -->
      <action application="sleep" data="25010"/>
      <!-- if far end answers then we never get here...-->
      <!-- Use Lua script to check value of BUSY, SIT1LO, etc. -->
      <!-- If !BUSY and !SIT1LO, etc. then call is a no answer -->
      <!-- I use extensions for each scenario, e.g.
        <condition field="destination_number" expression="ANSWERCALL">
        OR
        <condition field="destination_number" expression="BUSYCALL">
        etc.
      -->
  </condition>
</extension>

In any case, if you call a busy number it should record the early media. You
can change the sleep time from 25010 to a shorter duration, like maybe
10000. You could also insert an info app to dump the channel variables and
see if tone_detect set your channel variable(s).

Hope this helps!
-MC

> Thanks for the Reply,
>
> Warm Regards,
> N.Baskar
>
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20081229/67dc60fe/attachment-0002.html 


More information about the FreeSWITCH-users mailing list