Skip to main content

mod_dptools: event

About

Event application can be used to fire aribtrary events.

Usage

Event Event-Name=$event_name[,Event-Subclass=$event_subclass][,header=value,header=value]

This application may be run inline from the XML dialplan.

Examples

by Pawel Pierscionek

<action application="event" data="Event-Subclass=myevent::notify,Event-Name=CUSTOM,key1=value1,key2=value2"/>

I find it useful in driving inbound event socket finite state machines that do not subscribe to CHANNEL_EXECUTE* events yet need signals when some actions of inline dialplans are completed. Eg: fire a custom notification that a file has been played and the channel is now waiting for more instructions while the customer listens to MOH.

<extension name="ACDIntro">
<condition field="destination_number" expression="^queue_beta$">
<action application="set" data="acd_line_ext=150"/>
<action application="answer" />
<action application="playback" data="intro.wav" />
<action application="event" data="Event-Subclass=VoiceWorks.pl::ACDnotify,Event-Name=CUSTOM,state=Intro,condition=IntroPlayed"/>
<action application="playback" data="local_stream://moh" />
</condition>
</extension>

This is how such an event appears on the wire:

Core-UUID: 1ebe7b98-1533-11de-a612-0b68f08ca0e3
FreeSWITCH-Hostname: acd2.urtho.dev
FreeSWITCH-IPv4: 192.168.0.144
[...]
Event-Subclass: VoiceWorks.pl%3A%3AACDnotify
Event-Name: CUSTOM
state: Intro
condition: IntroPlayed

If you wish to schedule an event to be triggered from a dialplan, you can use the following approach:

<action application="set" data="api_result=${sched_api(+5 ${uuid} uuid_broadcast ${uuid} event::Event-Subclass=myevent-notify,Event-Name=CUSTOM)}"/>

See Also