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> &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 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 & 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"><<a href="mailto:wes-fs@499x.com">wes-fs@499x.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;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. 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. 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 href="http://pastebin.freeswitch.org/16564" target="_blank">http://pastebin.freeswitch.org/16564</a><br>
<br>
logs:<br>
<a 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 href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a> 877-7-4ACLUE<br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote></div><br></div>