<br><div class="gmail_quote">On Wed, Jan 20, 2010 at 7:06 PM, Mike van Lammeren <span dir="ltr"><<a href="mailto:mike@van.lammeren.net">mike@van.lammeren.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
So, I've been reading about early media in the wiki, and have made a little progress, which leads to more questions.<div><br></div><div>I understand now why a call is considered connected before one person has picked up the phone. I am also able to get my script to wait for the phone to be picked up, by setting the ignore_early_media variable when starting a new session, like this:</div>
<div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>customerSession = freeswitch.Session("{ignore_early_media=true}sofia/gateway/<a href="http://example.com/" target="_blank">example.com/</a>" .. customerPhoneNumber)</div>
</blockquote><div><br></div><div>After that line, the script waits for the other phone to be picked up.</div><div><br></div><div>However, now I wonder what to do with calls that don't complete, get busy signals, etc.</div>
<div><br></div><div>What do people do in this case? The only related example I can find on the web is for a javascript dialer, which doesn't address any of these cases.</div></div></blockquote><div><br></div><div><br>
</div><div>I guess it depends on what you want to do. For example I have a lua script very similar to what you describe, although there is no confirmation involved. Depending on the hangup cause the session gets, it might try redialing with a different gateway, try again or just hangup.</div>
<div><br></div><div>Take a look here <a href="http://wiki.freeswitch.org/wiki/Hangup_causes">http://wiki.freeswitch.org/wiki/Hangup_causes</a> to see what each hangup cause means. You don't need to have a special case for all of them, only the ones you are interested in.</div>
<div><br></div><div>Here's an example in code which retries a call depending on the hangup cause. It retries max_retries1 times and alternates between 2 different gateways:</div><div><br></div><div><div>session1 = null;</div>
<div>max_retries1 = 3;</div><div>retries = 0;</div><div>ostr = "";</div><div>repeat </div><div> retries = retries + 1;</div><div> if (retries % 2) then ostr = originate_str1;</div><div> else ostr = originate_str12; end</div>
<div> freeswitch.consoleLog("notice", "*********** Dialing Leg1: " .. ostr .. " - Try: "..retries.." ***********\n");</div><div> session1 = freeswitch.Session(ostr);</div>
<div> local hcause = session1:hangupCause();</div><div> freeswitch.consoleLog("notice", "*********** Leg1: " .. hcause .. " - Try: "..retries.." ***********\n");</div>
<div>until not ((hcause == 'NO_ROUTE_DESTINATION' or hcause == 'RECOVERY_ON_TIMER_EXPIRE' or hcause == 'INCOMPATIBLE_DESTINATION' or hcause == 'CALL_REJECTED' or hcause == 'NORMAL_TEMPORARY_FAILURE') and (retries < max_retriesl1))</div>
</div><div><br></div><div><br></div><div>Note: originate_str1 and originate_str2 are two different dial strings for 2 different gateways.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div><br></div><div>Early Media: <a href="http://wiki.freeswitch.org/wiki/Early_media" target="_blank">http://wiki.freeswitch.org/wiki/Early_media</a></div>
<div>ignore_early_media variable: <a href="http://wiki.freeswitch.org/wiki/Variable_ignore_early_media" target="_blank">http://wiki.freeswitch.org/wiki/Variable_ignore_early_media</a></div><div><a href="http://wiki.freeswitch.org/wiki/Variable_ignore_early_media" target="_blank"></a>javascript dialer: <a href="http://alexn.org/docs/dialer.html" target="_blank">http://alexn.org/docs/dialer.html</a></div>
<div><br></div><div><br></div><div><a href="http://alexn.org/docs/dialer.html" target="_blank"></a>Mike van Lammeren<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Wed, Jan 20, 2010 at 4:45 PM, Mike van Lammeren <span dir="ltr"><<a href="mailto:mike@van.lammeren.net" target="_blank">mike@van.lammeren.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Rob!<div><br></div><div>Unfortunately, I have the next few weeks to complete this part of the project. Without a stable release of 1.0.5, I have to stick with 1.0.4. I'm sure that 1.0.4 can detect and report when a phone is picked up. It's just that I can't figure out how to get that information! Either that, or I have something mis-configured.</div>
<div><br></div><font color="#888888"><div>Mike van Lammeren</div></font><div><div></div><div><div><br><br><div class="gmail_quote">On Wed, Jan 20, 2010 at 4:32 PM, Rob Forman <span dir="ltr"><<a href="mailto:rob4manhere@gmail.com" target="_blank">rob4manhere@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Mike,<br><br>I don't think v1.0.4 is supported any longer. You'll have better luck getting assistance by upgrading to trunk or the latest tar and reporting back.<br>
<br>Good luck!<br>Rob<br><br><div class="gmail_quote"><div><div></div><div>
On Wed, Jan 20, 2010 at 3:18 PM, Mike van Lammeren <span dir="ltr"><<a href="mailto:mike@van.lammeren.net" target="_blank">mike@van.lammeren.net</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<div><div></div><div>
Hello!<div><br></div><div>Some day, I'll probably laugh at asking this question, but today I can't figure it out.</div><div><br></div><div>I've written a Lua script that listens for a call, then dials a phone number to a second person. It plays a message, then prompts the second person to hit pound to connect. If the second person hits pound, then it bridges the two calls together.</div>
<div><br></div><div>All that works great, but I can't figure out how to get the session for the second person to wait until that person answers.</div><div><br></div><div>I'm using FreeSWITCH 1.0.4, and although there is a <i>getState</i> function documented in the wiki, it doesn't seem to exist for me.</div>
<div><br></div><div>Any help would be appreciated!</div><div><br></div><font color="#888888"><div><br></div><div>Mike van Lammeren</div><div><br></div>
</font><br></div></div>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">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>
<br></blockquote></div><br>
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">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>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>
<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>
<br></blockquote></div><br>