Mod fifo
From FreeSWITCH Wiki
Mod FIFO is a Parking-Like app which allows you to make custom call queues.
<fifo name> [in [<announce file>|undef] [<music file>|undef] | out [wait|nowait] [<announce file>|undef] [<music file>|undef]]
Contents |
Description
FIFO stands for "First In, First Out". As calls enter the queue, they are arranged in order so that the call that has been in the queue for the longest time will be the first call to get answered. Generally FIFO call queues are used in "first come, first served" call scenarios such as customer service call centers.
Dialplan Example
Put a caller into a FIFO queue
<action application="fifo" data="myqueue in /tmp/exit-message.wav /tmp/music-on-hold.wav"/>
The preceding will put a call into "myqueue", playing "/tmp/music-on-hold.wav" over and over again. "/tmp/exit-message.wav" will be played to the user as the user is being taken out of the queue.
Take a caller out of a FIFO queue
<action application="fifo" data="myqueue out nowait /tmp/caller-found.wav /tmp/agent-music-on-hold.wav"/>
This pulls the oldest caller out of "myqueue" and connects them with the agent on the current channel. "/tmp/caller-found.wav" will be played to the agent as the call is taken out of the FIFO.
If there are no calls in the FIFO queue and you have the "wait" parameter set, "/tmp/agent-music-on-hold.wav" will be played to the agent over and over again until a new call arrives. Additionally, after taking a call from the queue which ends without the agent hanging up, the agent will be returned to the FIFO queue.
If you have the "nowait" parameter set and there are no calls in the FIFO queue, processing immediately continues past the FIFO queue. If there are one or more calls in the queue, only one call is retrieved and processing continues past the FIFO queue after that call ends.
Setting MOH and announce sounds
Here are some ways that you can use to se the MOH and announce sounds for both fifo in and fifo out
<action application="set" data="fifo_music=<sound path>"/> <action application="set" data="fifo_announce=<sound path>" /> <action application="set" data="fifo_orbit_announce=<sound path>" /> <action application="set" data="fifo_override_announce=<sound path>" />
Implementing FIFO slots
Each fifo can have 10 priority slots ( default priority is 5 ). Priority 1 has higher priority than 10. With the fifo slot, you can put a caller into one of the ten fifo slots with:
<action application="set" data="fifo_priority=1" />
Consumers can be assigned to pick up callers with specific priority using fifo_pop_order variable, such as follow:
<action application="set" data="fifo_pop_order=1,2" />
You can assign multiple priority orders using a comma-delimited list.
Agent/Caller Example
This scenario has two extensions: 7010 will be for agents who will hear music till someone calls 7011 will be the customer who will hear hold music until an agent is free.
<extension name="Agent_Wait">
<condition field="destination_number" expression="^7010$">
<action application="set" data="fifo_music=$${hold_music}"/>
<action application="answer"/>
<action application="fifo" data="myq out wait"/>
</condition>
</extension>
<extension name="Queue_Call_In">
<condition field="destination_number" expression="^7011$">
<action application="set" data="$${hold_music}"/>
<action application="answer"/>
<action application="fifo" data="myq in"/>
</condition>
</extension>
The agents can dial in to extension 7010 and wait. Callers can be routed/transferred to extension 7011 where they'll be queued until an agent is available.
JavaScript Example
The following are JavaScript versions of the examples above. Here we are adding a call to a queue.
session.execute( "fifo", "myqueue in 'sounds/your-being-picked-up.wav' 'sounds/tunes.wav'" );
You can replace the sound files with "undef" if you don't want them. Here we are taking a call out of a queue without specifying an announcement file.
session.execute( "fifo", "myqueue out wait undef 'sounds/tunes.wav'" );
This call is non blocking when putting a call into the fifo. You still have access to the session but you won't know, for example, when the call is taken off of the queue. If you are interested in these events, watching the event socket is where you should focus.
Details
The agent prompt will play to the agent as the caller hears hold music then the agent will hear nothing as the caller is played their exit message. The agent can end the call with the caller at any time by pressing "*". If the agent hangs up the call while either the agent's prompt or the callers prompt are being played, but before the calls are bridged, the caller will be dropped. (should this be fixed?)
Using bind_meta_app prior to calling 'fifo out x' to refer to, say, *1 to transfer calls will override the '*' hangup functionality. In this case, an additional * is necessary to use this hangup feature. ('**' instead of '*')
The fifo_music channel variable (which can be set globally in freeswitch.xml) will control the music that's played in the fifo.
Note (this applies to fs 1.0.1 and later): setting the variable "fifo_consumer_exit_key" to something, you can override the default "*" key that exits the call on the consumer side.
Additional variables (not yet documented)
This channel uses or sets, for the leg entering the fifo
- "fifo_chime_list"
- "fifo_chime_freq"
- "fifo_orbit_exten"
- "fifo_orbit_announce"
- "fifo_caller_exit_key"
- "fifo_serviced_uuid"
- "fifo_status" ( WAITING, TIMEOUT, ABORTED, DONE )
- "fifo_timestamp"
- "fifo_serviced_by" ( the uuid of the consumer leg that picked-up of the call )
- "fifo_serviced_uuid" ( the uuid of the consumer leg that triggered the pick-up of the call, matches fifo_serviced_by if fifo_consumer_id is not set )
This channel uses or sets, for the consumer part of the fifo
- "fifo_strategy" ( the strategy to get the caller out of the fifo. Can be:"more_ppl" or "waiting_longer" (default) )
- "fifo_consumer_id" ( if set, this indicates which uuid should the fifo consumer call be transferred to, useful when the consumer is another uuid)
- "fifo_record_template" (if set, this is the file where the session will record to, expanded on the caller channell)
- "fifo_status" ( WAITING, TALKING )
- "fifo_target" (the uuid of the call the consumer is talking to)
- "fifo_override_announce" (overrides the consumer announce of the fifo)
- "fifo_consumer_wrapup_sound" ( played at the end of a serviced caller )
- "fifo_consumer_wrapup_key" ( to)
- "fifo_pop_order" ( comma separated list of the priorities this consumer calls for )
