<div style="font-family: 'Courier New'; font-size: 13px; ">Tony, I will get it documented tomorrow. Will create a page just for it.<div><br></div><div>Regards,</div></div>
<div><div><br></div><div>-- </div><div>João Mesquita</div><div>Sent with <a href="http://www.sparrowmailapp.com/?sig">Sparrow</a></div><div><br></div></div>
<p style="color: #A0A0A8;">On Sunday, June 24, 2012 at 10:54 PM, Anthony Minessale wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div><div>Thanks for the positive comment. =D</div><div><br></div><div>BTW, that reminds me. I added a new pickup endpoint that you might</div><div>want to have a look at as well.</div><div>It lets you add a special pickup endpoint to a forked dial so say you</div><div>are calling ext 1000, you can do</div><div><br></div><div><action application="bridge" data="user/1000,pickup/1000"/></div><div><br></div><div>Then from another call you can execute:</div><div><br></div><div><action application="pickup" data="1000"/></div><div>And your channel will be returned to that unanswered originate.</div><div><br></div><div>We should probably get it documented.</div><div><br></div><div><br></div><div>On Sat, Jun 23, 2012 at 9:29 AM, Frank Busalacchi Jr</div><div><<a href="mailto:frankjr@mcpeekdodge.com">frankjr@mcpeekdodge.com</a>> wrote:</div><blockquote type="cite"><div><div>Over the last 6 months, I have received all kinds of support and help from</div><div>the freeswitch community (both IRC and this list) in learning to control</div><div>this incredible piece of software. Im truly grateful, thanks everyone.</div><div><br></div><div><br></div><div><br></div><div>I run freeswitch at my car dealership. We have approximately 40 sip</div><div>extensions, an ATT voip connection, and 6 analog outbound fax lines provided</div><div>by freetdm. Prior to freeswitch, I was running an old Lucent/Avaya Merlin</div><div>"key" system. One of the features of the Merlin was that it was pretty easy</div><div>to do "directed callpick". In essence, you would dial *7 + extension you</div><div>wanted to pickup. Provided the call was either on hold or ringing at that</div><div>extension, you would pick it up. When I first started using Freeswitch, I</div><div>was very disappointed in the directed callpick. Before I realized that the</div><div>call pickup that was built into the sample dialplan was really just an</div><div>example to show a simple possibility for using intercept. I was convinced</div><div>that it was a totally useful feature. I couldn't believe that was as good</div><div>as it got... My problem with the directed pickup that is in the sample</div><div>dialplan is that it can steal a live call right from another extension, as</div><div>well as it really only works with the most recent call on that extension.</div><div><br></div><div><br></div><div><br></div><div>Then I woke up, and rolled my own 8-) . In an effort to provide just</div><div>another example, I wanted to share the piece of code I've developed. I will</div><div>warn that this was the first perl script I have ever written, and probably</div><div>is pretty ugly, but it seems to work perfectly in our environment. Bottom</div><div>line, do what you want with it...I'm just trying to help other beginner's</div><div>like myself:</div><div><br></div><div><br></div><div><br></div><div>To all beginners: You will need to build and enable mod_perl for this to</div><div>work...</div><div><br></div><div><br></div><div><br></div><div>First, we need an entry in your XML dialplan to see the user's request to</div><div>interecept a "held" or "ringing" extension. The only 4 digit extensions at</div><div>my company are internal ones so I match on ** + 4-digit-extension.</div><div><br></div><div><br></div><div><br></div><div>In the xML dialplan:</div><div><br></div><div><br></div><div><br></div><div> <extension name="intercept-ext"></div><div> <condition field="destination_number" expression="^\*\*(\d{4})$"></div><div> <action application="answer"/></div><div> <action application="perl"</div><div>data="/usr/local/freeswitch/scripts/<a href="http://myintercept.pl">myintercept.pl</a> $1"/></div><div> <action application="sleep" data="2000"/></div><div> </condition></div><div> </extension></div><div><br></div><div>Then, we need the actual perl script:</div><div><br></div><div>/usr/local/freeswitch/scripts/<a href="http://myintercept.pl">myintercept.pl</a>:</div><div><br></div><div><br></div><div># This is code to allow us to use intercept to grab only calls that are on</div><div>hold or ringing.</div><div>#</div><div># by Frank Busalacchi 2012-06-13</div><div><br></div><div>use strict;</div><div>use Switch;</div><div>use Data::Dumper;</div><div>use XML::Simple;</div><div>use POSIX qw(strftime);</div><div>our $session;</div><div><br></div><div>{</div><div> my $dest_target = $ARGV[0];</div><div><br></div><div> my $api = new freeswitch::API();</div><div> my $xml = new XML::Simple;</div><div> my $chan_xml = $xml->XMLin($api->executeString("show detailed_calls as</div><div>xml"),KeyAttr => 'row', ForceArray => ['row']);</div><div><br></div><div> my %candidates;</div><div> my $result;</div><div><br></div><div> foreach my $row (@{$chan_xml->{row}}) {</div><div> if ($row->{callstate} eq "RINGING" && $row->{dest} eq $dest_target)</div><div>{</div><div> $candidates{ $row->{created_epoch} - 1000 } =</div><div>$row->{call_uuid}; #In the case of a tie, we want to pickup ringing</div><div>calls before held calls...</div><div> next;</div><div> }</div><div><br></div><div> elsif ($row->{callstate} eq "HELD" && $row->{b_sent_callee_num} eq</div><div>$dest_target ) {</div><div> $candidates{ $row->{created_epoch} } = $row->{b_uuid};</div><div> next;</div><div> }</div><div><br></div><div> elsif ($row->{b_callstate} eq "HELD" && $row->{b_callee_num} eq</div><div>$dest_target ) {</div><div> $candidates{ $row->{b_created_epoch} } = $row->{uuid};</div><div> next;</div><div> }</div><div> }</div><div><br></div><div> if( keys( %candidates ) == 0) {</div><div> $result = "[Intercept] No suitable channel to intercept on extension</div><div>$dest_target.";</div><div> freeswitch::consoleLog("INFO","$result\n");</div><div> }</div><div><br></div><div> else {</div><div> my $user = $session->getVariable('caller_id_name');</div><div> my $cid_num = $session->getVariable('caller_id_number');</div><div><br></div><div> for my $winner ( sort keys %candidates ) {</div><div><br></div><div> my $uuid= $candidates{$winner};</div><div><br></div><div> $result = "[Intercept]User:$user" . "[" . "$cid_num" . "]</div><div>intercepting Extension:$dest_target" . ". UUID:" . "$uuid" . "\n";</div><div> freeswitch::consoleLog("INFO","$result\n");</div><div> $session->execute("intercept",$uuid);</div><div> last;</div><div> }</div><div> }</div><div> 1;</div><div>}</div><div><br></div><div><br></div><div><br></div><div>Enjoy!</div><div><br></div><div><br></div><div><br></div><div>-Frank</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>_________________________________________________________________________</div><div>Professional FreeSWITCH Consulting Services:</div><div><a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a></div><div><a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a></div><div><br></div><div>FreeSWITCH-powered IP PBX: The CudaTel Communication Server</div><div><a href="http://www.cudatel.com">http://www.cudatel.com</a></div><div><br></div><div>Official FreeSWITCH Sites</div><div><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></div><div><a href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a></div><div><a href="http://www.cluecon.com">http://www.cluecon.com</a></div><div><br></div><div>Join Us At ClueCon - Aug 7-9, 2012</div><div><br></div><div>FreeSWITCH-users mailing list</div><div><a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a></div><div><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></div><div>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></div><div><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></div></div></blockquote><div><br></div><div><br></div><div><br></div><div>-- </div><div>Anthony Minessale II</div><div><br></div><div>FreeSWITCH <a href="http://www.freeswitch.org">http://www.freeswitch.org</a>/</div><div>ClueCon <a href="http://www.cluecon.com">http://www.cluecon.com</a>/</div><div>Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a></div><div><br></div><div>AIM: anthm</div><div>MSN:<a href="mailto:anthony_minessale@hotmail.com">anthony_minessale@hotmail.com</a></div><div>GTALK/JABBER/PAYPAL:<a href="mailto:anthony.minessale@gmail.com">anthony.minessale@gmail.com</a></div><div>IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch</div><div><br></div><div>FreeSWITCH Developer Conference</div><div>sip:<a href="mailto:888@conference.freeswitch.org">888@conference.freeswitch.org</a></div><div>googletalk:<a href="mailto:conf+888@conference.freeswitch.org">conf+888@conference.freeswitch.org</a></div><div>pstn:+19193869900</div><div><br></div><div>_________________________________________________________________________</div><div>Professional FreeSWITCH Consulting Services:</div><div><a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a></div><div><a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a></div><div><br></div><div>FreeSWITCH-powered IP PBX: The CudaTel Communication Server</div><div><a href="http://www.cudatel.com">http://www.cudatel.com</a></div><div><br></div><div>Official FreeSWITCH Sites</div><div><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></div><div><a href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a></div><div><a href="http://www.cluecon.com">http://www.cluecon.com</a></div><div><br></div><div>Join Us At ClueCon - Aug 7-9, 2012</div><div><br></div><div>FreeSWITCH-users mailing list</div><div><a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a></div><div><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></div><div>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></div><div><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></div></div></div></span>
</blockquote>
<div>
<br>
</div>