Module use_case_call

Use-Case-Call is a server which can be used to create use cases for Idefisk.

Copyright © 2005-2006 Ericsson

Version: 1.0

Behaviour: gen_server.

Authors: Freek Sanders (freekisanders@gmail.com) [web site: http://www.freeksanders.tk].

Description

Use-Case-Call is a server which can be used to create use cases for Idefisk. In use cases, Use-Case-Call manages all legs and resources of the use case. Use-Case-Call also passes all received messages to the current use case.


Final Note

Use-Case-Call has been implemented using the gen-server behaviour. This means that all function calls returning 'ok' (see below) are gen_server casts, which carry out their function asynchronously. An 'ok' does not mean success. If a function has success or not can only be derived from side-effects and messages printed to the command line.

For more information about the flow of events and an explanation of terms see ext_ast_interface.

Data Types

leg_ids()

leg_ids() = [LegId::integer()]

leg_mode()

leg_mode() = 'NOT ROUTED' | ATTACHED | DETACHED

resource_ids()

resource_ids() = [ResourceId::integer()]

resource_mode()

resource_mode() = 'SOUND PLAYER' | 'SOUND RECORDER' | 'DTMF RECEIVER'

resource_type()

resource_type() = 'SOUND PLAYER' | 'SOUND RECORDER' | 'DTMF RECEIVER'

Function Index

add_leg/4Add a leg to the call's memory.
call_msg/2A incoming call message.
die/1Destroys the call.
get_fun/1Retrieve a fun from the call for sending the messages from Asterisk.
get_leg_state/2Retrieves the state of the leg whose id is equal to LegId.
get_legs/1Retrieves the ids of all legs from memory.
get_legs_where_state/2Retrieves all legs from memory where the state is equal to the given state.
get_resource_state/2Retrieves the state of the resource whose id is equal to ResourceId.
get_resources/1Retrieves the ids of all resources from memory.
leg_msg/4A incoming leg message.
new_leg/3Add a leg to the call's memory.
new_resource/2Add a new resource to memory.
resource_msg/4A incoming resource message.
start_link/3

Function Details

add_leg/4

add_leg(Pid::pid(), OrigAddr::string(), DestAddr::string(), LegId::integer()) -> F::function()

Add a leg to the call's memory. Starts a new Use-Case-Leg (see use_case_leg (link is only valid if this is private documentation)).

Introduced in: 0.2

call_msg/2

call_msg(Pid::pid(), Msg::string()) -> ok

A incoming call message.

Introduced in: 1.0

die/1

die(Pid::pid()) -> ok

Destroys the call.

Introduced in: 0.2

get_fun/1

get_fun(Pid::pid()) -> F::function()

Retrieve a fun from the call for sending the messages from Asterisk.

Introduced in: 1.0

get_leg_state/2

get_leg_state(Pid::pid(), LegId::integer()) -> {LegMode::leg_mode(), MyAddr::string(), OtherAddr::string(), LegId::integer()}

Retrieves the state of the leg whose id is equal to LegId. Uses Use-Case-Leg (see use_case_leg (link is only valid if this is private documentation)), to retrieve the state of the leg.

Introduced in: 0.2

get_legs/1

get_legs(Pid::pid()) -> LegIds::leg_ids()

Retrieves the ids of all legs from memory.

Introduced in: 0.2

get_legs_where_state/2

get_legs_where_state(Pid::pid(), State::leg_mode()) -> LegIds::leg_ids()

Retrieves all legs from memory where the state is equal to the given state. Using Use-Case-Leg it retrieves the state of all legs (see use_case_leg (link is only valid if this is private documentation)), and filters out the ones which are not equal to the given state.

Introduced in: 0.2

get_resource_state/2

get_resource_state(Pid::pid(), RsrcId::integer()) -> {RsrcMode::resource_mode(), Type::resource_type(), File::string(), RsrcId::integer()}

Retrieves the state of the resource whose id is equal to ResourceId. Uses Use-Case-Resource (see use_case_resource (link is only valid if this is private documentation)), to retrieve the state of the resource.

Introduced in: 0.2

get_resources/1

get_resources(Pid::pid()) -> ResourceIds::resource_ids()

Retrieves the ids of all resources from memory.

Introduced in: 0.2

leg_msg/4

leg_msg(Pid::pid(), LegId::integer(), LegPid::pid(), Msg::string()) -> ok

A incoming leg message.

Introduced in: 0.2

new_leg/3

new_leg(Pid::pid(), OrigAddr::string(), DestAddr::string()) -> F::function()

Add a leg to the call's memory. Starts a new Use-Case-Leg (see use_case_leg (link is only valid if this is private documentation)).

Introduced in: 0.2

new_resource/2

new_resource(Pid::pid(), Type::resource_type()) -> F::function()

Add a new resource to memory. Starts a new Use-Case-Resource (see use_case_resource (link is only valid if this is private documentation)).

Introduced in: 0.2

resource_msg/4

resource_msg(Pid::pid(), RsrcId::integer(), RsrcPid::pid(), Msg::string()) -> ok

A incoming resource message.

Introduced in: 0.2

start_link/3

start_link(UseCase, Master, CallId) -> term()