2600hz CTO Karl Anderson speaks at Kamailio World 2014
-
Upload
james-solada -
Category
Technology
-
view
1.229 -
download
4
description
Transcript of 2600hz CTO Karl Anderson speaks at Kamailio World 2014
![Page 1: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/1.jpg)
Presented By:
Kamailio and Kazoo
Karl Anderson
![Page 2: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/2.jpg)
Karl AndersonSenior Bit Herder
My name is Karl Anderson, I am one of the senior bit herders at 2600hz. I have no credentials that will “wow” you, but hopefully you will still find this talk informative and at the very least interesting.
![Page 3: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/3.jpg)
www.2600hz.com
What is Kazoo
![Page 4: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/4.jpg)
At 2600hz we are building an ambitious open-source project called Kazoo. Kazoo is a distributed communication platform
![Page 5: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/5.jpg)
This is Kazoo from a high level, it is a control layer focused on the telecom problem domain. It provides modern interfaces to the communication revolution and allows anybody to quickly enter the telecom industry. At the border you can see the SBC, which in our case is Kamailio. We also use Kamailio for as presence and registration servers, which is why we created the Kamailio module db_kazoo to connect to Kazoo’s internal AMQP message bus.
![Page 6: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/6.jpg)
www.2600hz.com
What is AMQP
![Page 7: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/7.jpg)
• Enterprise messaging• Initially John O'Hara with JP Morgan
Chase• 2005 formed a working group, which
grew to include:
Cisco, Bank of America, Red Hat, Microsoft, VM Ware, Goldman Sachs, Software AG and Others
• Originated from the demands of financial services. Completely open, version 1.0 accepted by OASIS (Organization for the Advancement of Structured Information Standards) this year.
• It is a document, standard specification. We use a implementation called RabbitMQ.
• AMQP is a wire-level messaging protocol that offers organizations an efficient, reliable approach to passing real-time data and business transactions with confidence. AMQP provides a platform-agnostic method for ensuring information is safely transported between applications, among organizations, within mobile infrastructures, and across the Cloud.
• Solves the a lot of really hard distributed system problems.
![Page 8: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/8.jpg)
![Page 9: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/9.jpg)
What Does this Mean?
• Messages are published to exchanges, which are often compared to post offices or mailboxes. Exchanges then distribute message copies to queues using rules called bindings. Then AMQP brokers either deliver messages to consumers subscribed to queues, or consumers fetch/pull messages from queues on demand.
• A direct exchange delivers messages to queues based on the message routing key. A direct exchange is ideal for the unicast routing of messages
• A fanout exchange routes messages to all of the queues that are bound to it and the routing key is ignored.
• Topic exchanges route messages to one or many queues based on matching between a message routing key and the pattern that was used to bind a queue to an exchange. The topic exchange type is often used to implement various publish/subscribe pattern variations.
![Page 10: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/10.jpg)
www.2600hz.com
What is db_kazoo
![Page 11: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/11.jpg)
db_kazoo presents the Kazoo AMQP message bus a database type to Kamailio. This allows lookups to preform response/request operations in Kazoo which in turn draw from our database.
Discuss why we use the db interface in Kamailio and how in this architecture Kazoo is a middle man for the Bigcouch, providing a layer of realtime logic…
![Page 12: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/12.jpg)
www.2600hz.com
How do we use it
![Page 13: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/13.jpg)
modparam("auth_db|usrloc", "db_url", "kazoo://guest:[email protected]:5672/callmgr")
modparam("presence", "db_url", "kazoo://guest:[email protected]:5672/dialoginfo")
![Page 14: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/14.jpg)
####### Authentication module ##########
loadmodule "auth.so"
loadmodule "auth_db.so"
modparam("auth_db", "version_table", 0)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "load_credentials", "$avp(password)=password")
####### User Location module ##########
loadmodule "usrloc.so"
modparam("usrloc", "db_mode", 1)
modparam("usrloc", "db_update_as_insert", 1)
route[HANDLE_REGISTER]
{
if (is_method("REGISTER")) {
if (auth_check("$fd", "subscriber", "1")) {
consume_credentials();
save("location");
} else {
auth_challenge("$fd", "0");
}
exit;
}
}
![Page 15: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/15.jpg)
######## Generic Hash Table in shared memory ########
modparam("htable", "htable", "dbkp=>size=16;autoexpire=7200")
######## Presence User Agent ########
loadmodule "pua_dialoginfo.so"
modparam("pua_dialoginfo", "library_mode", 1)
######## Presence Server ########
loadmodule "presence.so"
loadmodule "presence_dialoginfo.so"
modparam("presence", "subs_db_mode", 1)
####### Presence Logic ########
route[HANDLE_SUBSCRIBE]
{
if (is_method("SUBSCRIBE")) {
if (!t_newtran()) {
sl_reply_error();
exit;
}
handle_subscribe();
t_release();
exit;
}
}
![Page 16: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/16.jpg)
•How does it work
![Page 17: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/17.jpg)
int db_kazoo_bind_api(db_func_t *dbb)
{
dbb->init = db_kazoo_init;
dbb->use_table = db_kazoo_use_table;
dbb->close = db_kazoo_close;
dbb->query = db_kazoo_query;
dbb->free_result = db_kazoo_free_result;
dbb->insert = db_kazoo_insert;
dbb->replace = db_kazoo_replace;
dbb->insert_update = db_kazoo_insert_update;
dbb->delete = db_kazoo_delete;
dbb->update = db_kazoo_update;
dbb->raw_query = db_kazoo_raw_query;
dbb->cap = DB_CAP_ALL;
return 0;
}
![Page 18: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/18.jpg)
![Page 19: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/19.jpg)
int dbk_credentials_query(const db1_con_t* _h, ..., db1_res_t** _r) {
amqp_mb.len = sprintf(messagebody, "{\"Method\":\"REGISTER\","
"\"Auth-Realm\":\"%.*s\","
"\"Auth-User\":\"%.*s\","
"\"From\":\"%.*s@%.*s\","
"\"To\":\"%.*s@%.*s\","
"\"Server-ID\":\"%s\","
"\"Node\":\"kamailio@%.*s\","
"\"Msg-ID\":\"%.*s\","
"\"App-Version\":\"%s\","
"\"App-Name\":\"%s\","
"\"Event-Name\":\"authn_req\","
"\"Event-Category\":\"directory\"}",
_v[1].val.str_val.len, _v[1].val.str_val.s,
_v[0].val.str_val.len, _v[0].val.str_val.s,
_v[0].val.str_val.len, _v[0].val.str_val.s,
_v[1].val.str_val.len, _v[1].val.str_val.s,
_v[0].val.str_val.len, _v[0].val.str_val.s,
_v[1].val.str_val.len, _v[1].val.str_val.s,
serverid,
dbk_node_hostname.len, dbk_node_hostname.s,
unique_string.len, unique_string.s,
VERSION, NAME);
amqp_mb.bytes = messagebody;
if (!amqp_basic_publish(rmq->conn, rmq->channel, ..., amqp_mb)) {
goto error;
}
![Page 20: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/20.jpg)
while (body_received < body_target) {
if (dbk_rmq_wait_for_data(rmq->conn) < 0 ) {
goto error;
}
memcpy(body + body_received, frame.payload.body_fragment.bytes,
frame.payload.body_fragment.len);
body_received += frame.payload.body_fragment.len;
if (body_received != body_target) {
goto error;
}
}
body[body_received] = '\0';
db1_res_t* db_res = dbk_creds_build_result(body, _c, _nc);
*_r = db_res;
return 0;
}
![Page 21: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/21.jpg)
www.2600hz.com
What next
![Page 22: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/22.jpg)
www.2600hz.com
Make it More Generic
![Page 23: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/23.jpg)
www.2600hz.com
Commit it Upstream
![Page 24: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/24.jpg)
www.2600hz.com
Add Support to Multiple AMQP Brokers
![Page 25: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/25.jpg)
github.com/2600hz www.2600hz.com
![Page 26: 2600hz CTO Karl Anderson speaks at Kamailio World 2014](https://reader031.fdocuments.in/reader031/viewer/2022020122/556388f6d8b42acc128b4b76/html5/thumbnails/26.jpg)
415-886-7900
www.2600hz.com
CONTACT US
Thank You!
FOLLOW US
/2600hzOfficial
@2600hertz
/2600hzOfficial