<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Thank you! that worked just fine.<br>
    <br>
    On 6/22/2011 11:51 AM, Michael Collins wrote:
    <blockquote
      cite="mid:BANLkTikf8RoG0a-EfG+C_epMD=Xp0A2XEQ@mail.gmail.com"
      type="cite">Wes,
      <div><br>
      </div>
      <div>The "originate" API is very similar to the "bridge" dp
        command - when the far end sends *any* media then the originate
        (or bridge) is considered "successful" and processing continues.
        You have a few choices, but I would start by trying this on your
        originate:</div>
      <div><br>
      </div>
      <div><span class="Apple-style-span" style="color: rgb(51, 51, 51);
          font-family: 'Courier New',Courier,monospace; font-size: 11px;
          background-color: rgb(244, 244, 244);">originate
          {ignore_early_media=true}sofia/gateway/mcw/<span class="nu0">914145551212</span>&nbsp;&amp;lua<span
            class="br0">(</span>hello.lua<span class="br0">)</span></span><br>
        <br>
      </div>
      <div>This will tell the originate not to be "successful" until the
        far end actually answers, as opposed to when the far end simply
        sends media. The drawback here, of course, is that if call
        progress is sent in band, e.g. a busy signal, you are explicitly
        ignoring that information. An alternative is found in the
        "execute_on_xxx" family of channel variables. Check it out:</div>
      <div><a moz-do-not-send="true"
href="http://wiki.freeswitch.org/wiki/Channel_Variables#The_execute_on_family">http://wiki.freeswitch.org/wiki/Channel_Variables#The_execute_on_family</a></div>
      <div><br>
      </div>
      <div>It requires a little more thought, but you end up with more
        fine-tuned control over everything. Look in particular at the
        originate &amp; dialplan example under "execute_on_answer" which
        I believe contains the most complete solution to your problem.</div>
      <div><br>
      </div>
      <div>-MC</div>
      <div><br>
        <div class="gmail_quote">On Wed, Jun 22, 2011 at 7:47 AM, Wes <span
            dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:wes-fs@499x.com">wes-fs@499x.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">
            Hello,<br>
            <br>
            I'm having trouble detecting when a phone call (originated
            from<br>
            freeswitch) is answered by the called party using a lua
            script. &nbsp;I have<br>
            freeswitch connected to a corporate phone system at my
            office via SIP.<br>
            When I call my deskphone at work (914145551212), the script
            waits until<br>
            I answer to start playing the welcome message, and other
            actions. &nbsp;But<br>
            when I call my cellphone (912625551212), the script starts
            before I pick<br>
            up the cellphone, as can be seen in the logs I've pasted
            below.<br>
            <br>
            Even though the lua script isn't properly detecting when the
            cell phone<br>
            has been answered, freeswitch *does* seem to know, as shown
            by the line:<br>
            2011-06-22 09:21:28.334618 [NOTICE] sofia.c:5594 Channel<br>
            [sofia/external/912625551212] has been answered<br>
            which gets logged when I answer the cell, even though the
            script is<br>
            already running.<br>
            <br>
            This fact gives me hope that there will be a way to fix this
            script.<br>
            <br>
            Any suggestions are appreciated!<br>
            thanks.<br>
            <br>
            using:<br>
            FreeSWITCH Version 1.0.head (git-8decee3 2011-06-20 13-21-20
            -0500)<br>
            <br>
            Script<br>
            <a moz-do-not-send="true"
              href="http://pastebin.freeswitch.org/16564"
              target="_blank">http://pastebin.freeswitch.org/16564</a><br>
            <br>
            logs:<br>
            <a moz-do-not-send="true"
              href="http://pastebin.freeswitch.org/16563"
              target="_blank">http://pastebin.freeswitch.org/16563</a><br>
            <br>
            <br>
            _______________________________________________<br>
            Join us at ClueCon 2011, Aug 9-11, Chicago<br>
            <a moz-do-not-send="true" href="http://www.cluecon.com"
              target="_blank">http://www.cluecon.com</a> 877-7-4ACLUE<br>
            <br>
            FreeSWITCH-users mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
              target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
            UNSUBSCRIBE:<a moz-do-not-send="true"
              href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
              target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
            <a moz-do-not-send="true" href="http://www.freeswitch.org"
              target="_blank">http://www.freeswitch.org</a><br>
          </blockquote>
        </div>
        <br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Join us at ClueCon 2011, Aug 9-11, Chicago
<a class="moz-txt-link-freetext" href="http://www.cluecon.com">http://www.cluecon.com</a> 877-7-4ACLUE

FreeSWITCH-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
</pre>
    </blockquote>
  </body>
</html>