[Freeswitch-users] Asterisk dial status

Michael Collins msc at freeswitch.org
Mon Jul 25 19:07:39 MSD 2011


What you are trying to do is not possible in this fashion. The bridge occurs
in the same thread as the perl script. The thread can only do one thing at a
time.

If you need to know the dial status while the thread is still running you'll
want a separate event socket app running and listening for channel status
events. If you just need to know the dial status once the bridge is complete
(i.e. once the call ends) then just use a api_hangup_hook chan var to launch
a script to do whatever it is that you need done.

-MC

On Sun, Jul 24, 2011 at 11:45 AM, Sam <lakersman2006 at yahoo.com> wrote:

> For the life of me I am still unable to get the bridged call status, when I
> subscribe to an "event" I am not here is my perl code snippet below, what am
> I doing wrong?
>
>
> my $fs = new ESL::ESLconnection($host, $port, $password);
>
> $session->answer();
>
> if ($session->ready ())
> {
>     #set bridge settings
>     $session->execute("set", "ringback=$ringback_tone");
>     $session->execute("set", "instant_ringback=true");
>     $session->execute("set", "ignore_early_media=false");
>     $session->execute("set", "call_timeout=60");
>
>     $session->execute("set", "progress_timeout=15");
>     $session->execute("set", "origination_caller_id_number=$caller_id");
>     $session->execute("set", "continue_on_fail=false");
>     $session->execute("bridge",
> "sofia/gateway/provider1/$destination_number");
>
>     $fs->sendRecv("event plain ALL");
>     $fs->send("linger");
>
>     while($fs->connected())
>     {
>         $data = $fs->recvEvent();
>
>         if ( $data =~ m/Answered-State: (\w+)/m )
>         {
>            my $state = $1;
>
>            #print "Channel state is $state\n";
>
>            if ( $state eq 'answered' ) {
>
>              freeswitch::consoleLog("INFO", "CALL ANSWERED\n");
>
>            }
>            else
>            {
>                 freeswitch::consoleLog("INFO", "NO CALLS ANSWERED\n");
>            }
>          }
>     }
> }
>
> $session->hangup();
>
> return 1;
>
>
> --- On *Fri, 7/22/11, Hector Geraldino <Hector.Geraldino at ip-soft.net>*wrote:
>
>
> From: Hector Geraldino <Hector.Geraldino at ip-soft.net>
> Subject: Re: [Freeswitch-users] Asterisk dial status
> To: "FreeSWITCH Users Help" <freeswitch-users at lists.freeswitch.org>
> Date: Friday, July 22, 2011, 2:28 PM
>
>
> It does.
>
>
>
> You can check the events by connecting to FS on inbound mode, or using FS
> outbound socket connection to an application designed by you.
>
>
>
> As you already have a perl script to interact with FS, you can modify it to
> connect to FS (inbound mode) and listen for events. You can subscribe to the
> events of a particular call, or filter an specific set of events. I haven’t
> used Asterisk before so I’m not sure how the AGI fits on the FS
> architecture.
>
>
>
> You can get more info at:
>
> http://wiki.freeswitch.org/wiki/Mod_event_socket
>
>
>
> And a working demo at:
>
> http://wiki.freeswitch.org/wiki/Perl_freeswitch_client_example
>
>
>
>
>
>
>
> *From:* freeswitch-users-bounces at lists.freeswitch.org [mailto:
> freeswitch-users-bounces at lists.freeswitch.org] *On Behalf Of *Sam
> *Sent:* Friday, July 22, 2011 4:23 PM
> *To:* FreeSWITCH Users Help
> *Subject:* Re: [Freeswitch-users] Asterisk dial status
>
>
>
> Sam,
>
> Does this require event sockets? Or how would I check these events?
>
> --- On *Fri, 7/22/11, Hector Geraldino <Hector.Geraldino at ip-soft.net>*wrote:
>
>
> From: Hector Geraldino <Hector.Geraldino at ip-soft.net>
> Subject: Re: [Freeswitch-users] Asterisk dial status
> To: "FreeSWITCH Users Help" <freeswitch-users at lists.freeswitch.org>
> Date: Friday, July 22, 2011, 11:57 AM
>
> Hi Sam,
>
>
>
> My guess is that you can subscribe to the events of the channel and
> evaluate the channel events. Look at:
>
>
>
> http://wiki.freeswitch.org/wiki/Event_List
>
>
>
> specifically the channel events list.
>
>
>
> *From:* freeswitch-users-bounces at lists.freeswitch.org [mailto:
> freeswitch-users-bounces at lists.freeswitch.org] *On Behalf Of *Sam
> *Sent:* Friday, July 22, 2011 2:32 PM
> *To:* freeswitch-users at lists.freeswitch.org
> *Subject:* [Freeswitch-users] Asterisk dial status
>
>
>
> Hi,
>
> I am trying to port over an Asterisk AGI script that does a call bridge to
> Freeswitch using perl, I wanted to know what is the equivalent of the
> asterisk dial status like: ANSWER, NO_ANSWER, CANCEL, BUSY, CONGESTION,
> CHANUNAVAIL ? I wanted to know if what methods can be used to gets these
> statues?
>
>
>
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> Join us at ClueCon 2011, Aug 9-11, Chicago
> http://www.cluecon.com 877-7-4ACLUE
>
> 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
>
>
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> Join us at ClueCon 2011, Aug 9-11, Chicago
> http://www.cluecon.com 877-7-4ACLUE
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org<http://mc/compose?to=FreeSWITCH-users@lists.freeswitch.org>
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
> _______________________________________________
> Join us at ClueCon 2011, Aug 9-11, Chicago
> http://www.cluecon.com 877-7-4ACLUE
>
> 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/20110725/7c79bf75/attachment-0001.html 


More information about the FreeSWITCH-users mailing list