[Freeswitch-users] Inbound or Outbound Socket connection?

David Villasmil david.villasmil.work at gmail.com
Thu Oct 13 19:39:46 MSD 2016


Anis,

Forget the dialplan. What I mean is, you create a perl script /there's a
good example at

/usr/src/freeswitch/libs/esl/perl/dump_events.pl

(If you cloned in /usr/src/) that connects to FS regardless of what FS is
doing. That script registers to receive all events:

$con->events("plain","all");

and print them out.

That's the philosophy, that scripts (or yours) will receive ALL events in
this case. You can register for specific event, see event list:

https://freeswitch.org/confluence/display/FREESWITCH/Event+List

and whenever you get the call you want, do with it whatever you need.

/usr/src/freeswitch/libs/esl/perl/sendevent.pl

might be a good start.
ᐧ

On Thu, Oct 13, 2016 at 5:27 PM, Anis Bedhiafi <anis.bedhiafi at e-volut.io>
wrote:

> Ok David. There are too things here.
>
> I have the dialplan from one side and I have the esl socket from the other
> side.
>
> In the dialplan I should call the esl connection somehow to work on that
> specefic call in progress. Right?
>
> So how can I make this link without an instruction in the dialplan?
>
> Does this make sence?
>
> On 13 Oct 2016 4:20 pm, "David Villasmil" <david.villasmil.work at gmail.com>
> wrote:
>
> You don't need to invoke it, you connect to fs permanently and subscribe
> to the events you're interested in. When you get the events, you can get
> all the info you want and act accordingly.
>
> On Thu, Oct 13, 2016 at 4:36 PM Anis Bedhiafi <anis.bedhiafi at e-volut.io>
> wrote:
>
>> Hi David,
>>
>> Thank you for the answer. In the perl script I need to do some logic to
>> detect the event and send a notify back to the event system. So my concern
>> is how I make freeswitch invokes the perl script in my dialplan where I
>> have already a bridge application?
>>
>> Regards
>>
>> On 13 Oct 2016 3:29 pm, "David Villasmil" <david.villasmil.work at gmail.com>
>> wrote:
>>
>> Hello,
>>
>> Why not connect to fs via perl esl and filter the events? (Inbound) you
>> remove the overhead of creating a new connection everytime a call is
>> executed...
>> you'd connect to fs from perl and keep the connection open.
>>
>> David
>> On Thu, Oct 13, 2016 at 4:21 PM Anis Bedhiafi <anis.bedhiafi at e-volut.io>
>> wrote:
>>
>> Thank you very much.
>>
>> I am digging me too.
>>
>> Thank you again.
>>
>> Best Regards.
>>
>> On 13 Oct 2016 3:19 pm, "Valter Nogueira" <valter at fastway.com.br> wrote:
>>
>> I understood now, when invoking socket with async, it should start a new
>> thread and continue to next step bridging the call.
>>
>> Well, I have never tried such thing before, I will do some testing and
>> when I get any result I return to you.
>>
>> Regards,
>>
>> Valter
>>
>> 2016-10-13 11:06 GMT-03:00 Anis Bedhiafi <anis.bedhiafi at e-volut.io>:
>>
>> Dear Valtar,
>>
>> Thank you for your answer.
>>
>> Yes I am using ESL bind for perl.
>>
>> On 13 Oct 2016 2:59 pm, "Valter Nogueira" <valter at fastway.com.br> wrote:
>>
>> When you are using <action application="socket" data="127.0.0.1:8084
>> async"/> it means you are in outbound mode (from the perspective of FS)
>>
>> Are you using ESL bind for perl or have you written your own
>> implementation?
>>
>> After accepting a connection on 8084 port, you should issue a
>> "connect\n\n" back to FS
>>
>> Valter
>>
>>
>> 2016-10-12 7:08 GMT-03:00 Anis Bedhiafi <anis.bedhiafi at e-volut.io>:
>>
>> Hi Guys,
>>
>> I guess I have a little confusion here between inbound esl and outbound
>> esl.
>>
>> *My Goal:* What I am trying to do is detect if the call is being
>> transferred and notify the caller about it.
>>
>> *My Scenario:*
>>
>> 1- I have an application based on SIP.js client that makes outbound calls
>> via a registered SIP trunk on my Freeswitch box. I upload a list of phone
>> numbers to call and hit Launch button.
>>
>> 2- Some calls can be transferred by the callee endpoint. I want to detect
>> this fact.
>>
>> 3- According to my research, I can do this using Event Socket library.
>> 4- To detect if there is a transfer, I can control the channel variable
>> RDNIS or TRANSFER_TIME. If there is a transfer these variables are not
>> empty.
>> 5- Once I detect there is a transfer I want to send a NOTIFY packet to
>> the client.
>>
>> *My confusion is the following:*
>>
>> I don't know whether to use an Outbound socket connection or an Inbound
>> Connection.
>>
>> I tried to do this with outbound connection as follows:
>>
>> <condition field="destination_number" expression="^1703$">
>>     <action application="set" data="socket_resume=true"/>
>>     <action application="socket" data="127.0.0.1:8084 async"/>
>>     <action application="bridge" data="sofia/gateway/mygateway/$1"/>
>> </condition>
>>
>> I have a perl server listening on port 8084/tcp.
>> In this perl script I subscribe for CHANNEL_ANSWER Events and I filter by
>> the call uuid.
>>
>> The problem is when I call the socket connection, the bridge application
>> never executes.
>>
>> How am I supposed to listen for a specific event and make a bridge call?
>>
>> Is what I am doing wrong. Please correct me.
>>
>> Thank you for your support.
>>
>> Kind regards.
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> 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
>>
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> 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
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> 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
>>
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> 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
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> 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
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> 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
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> 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
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> 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
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> 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/20161013/3fe46b08/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list