[Freeswitch-users] Subscribing to ESL Events 'dynamically' per channel

Guillermo Ruiz Camauer grcamauer at gmail.com
Wed Mar 21 22:09:06 UTC 2018


Joshua,

Maybe this can help (from
https://wiki.freeswitch.org/wiki/Event_Socket#event):

filter

Specify event types to listen for. Note, this is not a filter out but
rather a "filter in," that is, when a filter is applied only the filtered
values are received. Multiple filters on a socket connection are allowed.

Usage:

  filter <EventHeader> <ValueToFilter>

Example:

The following example will subscribe to all events and then create two
filters, one to listen for HEARTBEATS and one to listen for CHANNEL_EXECUTE
events.

  events plain all

  Content-Type: command/reply
  Reply-Text: +OK event listener enabled plain


  filter Event-Name CHANNEL_EXECUTE

  Content-Type: command/reply
  Reply-Text: +OK filter added. [filter]=[Event-Name CHANNEL_EXECUTE]


  filter Event-Name HEARTBEAT

  Content-Type: command/reply
  Reply-Text: +OK filter added. [Event-Name]=[HEARTBEAT]

Now only HEARTBEAT and CHANNEL_EXECUTE events will be received. You can
filter on any of the event headers. To filter for a specific channel you
will need to use the uuid:

  filter Unique-ID d29a070f-40ff-43d8-8b9d-d369b2389dfe

This method is an alternative to the myevents
<https://wiki.freeswitch.org/wiki/Mod_event_socket#Special_Case_-_.27myevents.27>
event type. If you need *only* the events for a specific channel then use
*myevents*, otherwise use a combination of filters to narrow down the
events you wish to receive on the socket.

To filter multiple unique IDs, you can just add another filter for events
for each UUID. This can be useful for example if you want to receive
start/stop-talking events for multiple users on a particular conference.

  filter plain all
  filter plain CUSTOM conference::maintenance
  filter Unique-ID $participantB
  filter Unique-ID $participantA
  filter Unique-ID $participantC

This will give you events for Participant A,B and C on any conference. To
receive events for all users on a conference you can use something like:

filter Conference-Unique-ID $ConfUUID

You can filter on any of the parameters you get in a freeSWITCH event:

  filter plain all
  filter call-direction Inbound
  filter Event-Calling-File mod_conference.c
  filter Conference-Unique-ID $ConfUUID

You can use them individually or compound them depending on whatever end
result you desire for the type of events you want to receive
filter delete

Specify the events which you want to revoke the filter. filter delete can
be used when some filters are applied wrongly or when there is no use of
the filter.

Usage:

  filter delete <EventHeader> <ValueToFilter>

Example:

  filter delete Event-Name HEARTBEAT

Now, you will no longer receive HEARTBEAT events. You can delete any filter
that is applied by this way.

  filter delete Unique-ID d29a070f-40ff-43d8-8b9d-d369b2389dfe

This is to delete the filter which is applied for the given unique-id.
After this, you won't receive any events for this unique-id.

  filter delete Unique-ID

This deletes all the filters which are applied based on the unique-id.
Regards,

Guillermo

On Wed, Mar 21, 2018 at 2:27 PM, Joshua Gigg <giggsey at gmail.com> wrote:

> Hi,
>
> We're using the inbound ESL socket to subscribe to certain events.
> However, we receive these events for every call.
>
> Is it possible to dynamically subscribe to events per call via the API?
>
> We're hoping to add/remove certain events at certain points during our
> call flows to avoid unnecessary noise in the events received.
>
> _________________________________________________________________________
> 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
>



-- 
Guillermo Ruiz Camauer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20180321/00512da6/attachment.html>


More information about the FreeSWITCH-users mailing list