-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
See inline, but also, I'm going to start documenting on the wiki:
Main page will start here:
https://2600hz.atlassian.net/wiki/display/docs/Internals+Development
ecallmgr:
https://2600hz.atlassian.net/wiki/display/docs/Overview+of+ecallmgr
https://2600hz.atlassian.net/wiki/display/docs/ecallmgr+and+FreeSWITCH
Will need to put the answers below in the wiki at some point, but hope
this helps for now. If you don't have access to edit yet, please email
Darren if you'd like to help create/edit the pages related to this.
Thanks,
James
For the most part. You have to remember that FreeSWITCH appears to
ecallmgr as an Erlang node, so ecallmgr communicates with FreeSWITCH
as such. freeswitch.erl is a convenience wrapper over that Erlang
message passing.
Some processes register themselves (their PID) with the FreeSWITCH
side for certain call events, handling calls, or xml requests (think
mod_xml_curl, but done via native Erlang).
2. Should the callmgr_call_events in #1 be
>>>> ecallmgr_call_control as ecallmgr_call_events is a listener
>>>> of incoming calls?
The incoming calls listener is actually ecallmgr_fs_route. When a call
comes in, ecallmgr_fs_route takes the dialplan fetch request from
FreeSWITCH and publishes a route_req to AMQP. It receives route_resp
messages and converts them to FreeSWITCH dialplan XML (generally
speaking, we just send back the park dialplan action). If FreeSWITCH
replies to our dialplan response with an 'ok', it means our dialplan
"won". Now we know which ecallmgr node is controlling the call, so
that ecallmgr will spin up two new processes, ecallmgr_call_control
and ecallmgr_call_events.
ecallmgr_call_control creates an AMQP queue for receiving dialplan
commands from the AMQP bus (see wapi_dialplan.erl), and also binds its
queue to call events related to its callid. It maintains a queue of
commands to send to FreeSWITCH.
ecallmgr_call_events asks FreeSWITCH to send it events related to the
callid. Things like CHANNEL_EXECUTE, CHANNEL_EXECUTE_COMPLETE,
CHANNEL_PROGRESS, CHANNEL_ANSWER, DTMF, CHANNEL_DESTROY, etc.
FreeSWITCH sends the ecallmgr_call_events process these event
proplists. We filter the fields and do some renaming, and publish the
resulting JSON to our AMQP bus (see wapi_call:publish_event/2).
Obviously I'm glossing over some of the minutia here, but hopefully
this helps some?
3. In one of the previous responses to something
>>>> I'd asked, Darren had said that you (i.e. provide a
>>>> "mod_event_socket"-esque hook to directly send messages to FS
>>>> via the AMQP bus. If #1 and #2 are true, then did what he
>>>> was referring to was ecallmgr and making FS sing and dance
>>>> meant programming/interacting directly with ecallmgr
>>>> module/process(es)?
This is likely ecallmgr_call_events. We publish call events with the
routing key call.event.{UUID} to the callevt exchange.
ecallmgr_fs_node publishes some events as well, one is a successful
registration (we bind to the CUSTOM_EVENT sofia::register for that
one). There are also some custom events that we publish/listen for, to
move calls between FreeSWITCH boxes and some other reasons.
>>>> 4. Is the Kazoo API layer then basically an abstraction of
>>>> the ecallmgr and its various process(es) and modules but
>>>> offers a REST interface to the user to build GUI/Webapps, so
>>>> that for common cases, one only has to write web-apps to
>>>> build their product and not mess around with ecallmgr at
>>>> all?
ecallmgr is an abstraction over FreeSWITCH/VoIP, and we have created a
set of JSON APIs, delivered via AMQP, for interacting with ecallmgr
(and the underlying switches as a result).
We have also created a whapp called Crossbar that exposes JSON APIs
delivered via HTTP/REST, and these focus more on higher level concepts
such as voicemail boxes, users, accounts, billing, etc. We hope these
provide building blocks to then control calls without having to muck
with VoIP concepts (which is what our callflow builder is designed for
- - you can route a call for a DID/extension to a user, and then a
voicemail box if the user doesn't answer in time, all without
understanding what a bridge is, how to send/record audio, how to
upload the stored recording to BigCouch, etc).
5. Does all communication
>>>> within the Kazoo platform happen over the AMQP bus? By "all"
>>>> I mean, ecallmgr <-> FS (as per #1 above), ecallmgr <->
>>>> Whapps layer, ecallmgr <-> BigCouch layer?
Hopefully the overview picture explained this clearly, but the primary
AMQP interaction is between whapps and ecallmgr.
6. What about communication between
>>>> WhApps? Do they communicate with each other over AMQP? or do
>>>> they not talk to each other directly but do so through
>>>> ecallmgr, which is the orchestrator of the whole Kazoo show?
Whapps definitely talk to each other via AMQP. For instance, Crossbar
(REST API whapp) has a mechanism such that every time a document is
created/edited/deleted, we publish that event to the bus. This allows
other whapps that may cache data in-memory (such as the heavily used
callflow whapp) to proactively clear their cache and fetch the new
data on the next request.
Whapp instances talk to each other as well. In the upcoming call
center application (acdc), the queue process(es) use AMQP to publish
when a customer call is available. Agent processes respond via AMQP of
their availability. This allows you to run two or more acdc whapps on
different servers. If one server goes down, the whole acdc doesn't
stop functioning. So AMQP is heavily utilized
7. Is it possible to
>>>> talk to the Whapps layer directly? or is that done through
>>>> the Kazoo API or the ecallmgr?
Not sure what you mean here? Each whapp has at least one AMQP listener
(callflow has a listener for route_req messages published by
ecallmgr_fs_route, for instance). Crossbar has an HTTP interface.
media_mgr has both and AMQP interface and an HTTP interface (AMQP for
asking for the URL for a media file, HTTP for delivering the binary data).
8. There was another question I had
>>>> which I forgot, but I thought of another one instead...when
>>>> the call flow is built using the Kazoo UI with dragging and
>>>> dropping the Whapps, is the configuration pushed down as XML
>>>> into the FS nodes to create dialplan entries or is this
>>>> controlled dynamically by the ecallmgr_call_control by
>>>> following this "recipe" on a per call basis?
NO! The callflow remains in the JSON format the Callflow builder
creates. This is stored in the database. When a call comes in that
will "execute" that callflow, the callflow whapp loads the callflow
JSON tree from the DB and starts sending dialplan commands based on
that tree and the caller's interactions (DMTF, voice, etc).
The only FreeSWITCH XML we generate is for authn_resp and route_resp
messages. Everything else is done via events/dialplan commands
(mod_dptools).
>>>>
>>>> Wish I could remember what that last question was, but if you
>>>> guys can answer the ones above, it will be of GREAT help.
>>>>
>>>> Sorry about so many questions but I couldn't find this
>>>> information in the Wiki but if it's there somewhere then
>>>> please feel free to tell me to go RTFM with a pointer to
>>>> where this is. Also, I've been trying to find a schematic /
>>>> architecture blue-print of the Kazoo platform but don't think
>>>> it's in the Wiki, is that correct?
>>>>
>
>
>>
>
- --
James Aimonetti
Distributed Systems Engineer / DJ MC_
2600hz |
http://2600hz.com
sip:ja...@2600hz.com
tel:
415.886.7905
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla -
http://www.enigmail.net/
iQEcBAEBAgAGBQJQadP+AAoJENc77s1OYoGgiF4IAIT29PV9a8cOxuQ3UoESx5+f
iIO4nwmb+LFxK2XItpy+JA4HQMgx52LV6mc2ve7NQLm0179ZnF0BnrQLPtBW3sNj
+02GDCMnFoh1WqJdGCaUmlUkfdLeAneQS2SjEkVrLizKfr4K8u07+Oq3RDQ/v3Nz
j8/bt7In9Vxr5jVcoybjcToxjJRxpU92wMSWYD3qKmISoogsqYcsrg/i3W/QjnYy
kiTTS82WboXSa6AEOz3mQg10IrKG8rxSLSdBD9EVgQFcGrOjFAtxJDkSzwYsVkwn
QEgLEIleXlaqW6XVoj1c+igmgO+PDuMdbnFV7mp58o1WAxDkWygcgFkd22qIeNE=
=2iIm
-----END PGP SIGNATURE-----