kamailio · what is libon? app available on voip and voip out calls app2app calls and calls to...
TRANSCRIPT
![Page 1: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/1.jpg)
Federico CabidduSenior VoIP Developer
Kamailio in a Mobile World
![Page 2: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/2.jpg)
Kamailio World | © 2015 Orange Vallée
Working in VoIP since 2001
Working with OpenSER/Kamailio since 2005
Libon Voice Team Tech Coordinator
About me
![Page 3: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/3.jpg)
What is Libon?
app available on
VoIP and VoIP out callsApp2app calls and calls to landlines and mobiles in more than 100 destinations.
Free app to app calls.
Instant messagesInstant messaging with Libon and non-
Libon users (OpenChat).
Customized voicemailCreate customized greetings for each
one of your contacts or groups of contacts.
Kamailio World | © 2015 Orange Vallée
![Page 4: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/4.jpg)
Constraints of a mobile VoIP application A commonly used approach Multidevice scenarios The TSILO module Working example
Contents
Kamailio World | © 2015 Orange Vallée
![Page 5: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/5.jpg)
Power consumption Data consumption Socket unreliability Constructor constraints: iOS background mode(s)
Mobile VoIP apps constraints
Kamailio World | © 2015 Orange Vallée
![Page 6: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/6.jpg)
Push notifications
In mobile context: a short message sent to a smartphone through a centralized service and targeted to a specific app.
It can be used to trigger an action from the app.
Kamailio World | © 2015 Orange Vallée
![Page 7: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/7.jpg)
Push notifications & VoIP
Kamailio World | © 2015 Orange Vallée
![Page 8: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/8.jpg)
Pros• Simple way for a service to send
notifications to user's device• Available on several platforms/OS• Reliable (APNS > 99% success rate)• No need to deal with pinhole/NAT• No need to permanently store users'
location• Use resources “on demand”
Kamailio World | © 2015 Orange Vallée
Push notifications
![Page 9: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/9.jpg)
Cons• No immediate delivery status report• No delivery guarantee • Not possible to predict delivery time• Different API per provider• Different UX per OS/Version: –Apple push before iOS 7 vs Apple
“silent push”
Kamailio World | © 2015 Orange Vallée
Push notifications
![Page 10: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/10.jpg)
Users can have many devices Only some of them may be
reachable Each device may have a different
Push Notification system
Kamailio World | © 2015 Orange Vallée
Multi-device: new challenges
![Page 11: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/11.jpg)
How long do we have to wait before relaying the INVITE?
Kamailio World | © 2015 Orange Vallée
Multi-device: the question
![Page 12: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/12.jpg)
“Late” parallel forking
Instead of forking an INVITE just to the currently registered contacts, send the
INVITE to the available ones and continue adding branches as soon as new ones register and as long as the transaction
hasn't got a final reply.
TSILO = Transactions Silo
Kamailio World | © 2015 Orange Vallée
TSILO: concept
![Page 13: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/13.jpg)
Kamailio World | © 2015 Orange Vallée
Push & multi-device
Callee's devices receive the INVITE (5,7,9) as soon as they register (4,6,8)
![Page 14: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/14.jpg)
Kamailio World | © 2015 Orange Vallée
TSILO: details
![Page 15: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/15.jpg)
ts_store()store the current transaction
ts_append(domain¹, ruri)add branches to all the transactionscurrently stored for ruri
ts_append_to(tindex, tlabel, domain¹) add branches to a specific transaction
identified by tindex and tlabel
(1) the table over which the internal lookup is performed
Kamailio World | © 2015 Orange Vallée
TSILO: exported functions
![Page 16: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/16.jpg)
r-uris stored as entries of a hash table (separate chaining with linked lists for
collisions) transactions per r-uri stored as linked list
of the hash table entries t_append*() call lookup_to_dset
(REGISTRAR module) and t_append_branches (TM module)
For each transaction a TM cb for TMCB_DESTROY event is registered
Kamailio World | © 2015 Orange Vallée
TSILO: implementation details
Hibernate
![Page 17: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/17.jpg)
Kamailio World | © 2015 Orange Vallée
TSILO: example (preamble)Based on KamailioWorld 2014 Async Push example
by Daniel Constantin-Mierla
![Page 18: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/18.jpg)
loadmodule “tsilo.so”
# ----- htable params -----modparam("htable", "htable", "vtp=>size=10;autoexpire=120;dbtable=htable;dbmode=0")
request_route { ...
if (is_method(“INVITE”)) {
route(INVITE); }
if (is_method(“REGISTER”)) {
route(REGISTER); } ...
}
Kamailio World | © 2015 Orange Vallée
TSILO: example
![Page 19: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/19.jpg)
# manage incoming INVITEsroute[INVITE] { if (!lookup("location")) { send_reply("100", "Trying"); route(SUSPEND); } else { t_relay();
ts_store();
$sht(vtp=>stored::$rU) = 1; xdbg("stored transaction [$T(id_index):$T(id_label)] $fU
=> $rU\n"); }
route(SENDPUSH);}
Kamailio World | © 2015 Orange Vallée
TSILO: example
![Page 20: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/20.jpg)
# suspend the transactionroute[SUSPEND] { if(!t_suspend()) { xlog("failed suspending trasaction [$T(id_index):$T(id_label)]\n"); send_reply("501", "Unknown destination"); exit; }
xdbg("suspended transaction [$T(id_index):$T(id_label)] $fU => $rU\n");
$sht(vtp=>join::$rU) = "" + $T(id_index) + ":" + $T(id_label);
xdbg("htable key value [$sht(vtp=>join::$rU)]\n");}
Kamailio World | © 2015 Orange Vallée
TSILO: example
![Page 21: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/21.jpg)
route[SENDPUSH] { $var(luaret) = 0; if(lua_runstring("do_push([[$hdr(X-VxTo)]], [[$tU]], [[$hdr(X-VxFrom)]], [[$fU]], [[$ci]])")<0) { send_reply("501", "No link to destination"); exit; } if($var(luaret)!=1) { send_reply("501", "Unknown destination"); exit; }}
# manage incoming REGISTERsroute[REGISTER] { if (!save("location")) sl_reply_error();
route(PUSHJOIN); exit;}
Kamailio World | © 2015 Orange Vallée
TSILO: example
![Page 22: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/22.jpg)
# append branches or resume the transactionroute[PUSHJOIN] { $var(hjoin) = 0; lock("$tU"); $var(hjoin) = $sht(vtp=>join::$tU); $var(hstored) = $sht(vtp=>stored::$tU); $sht(vtp=>join::$tU) = $null; unlock("$tU");
if ($var(hjoin)==0) { if ($var(hstored))
ts_append("location", "$tU"); return; }
$var(id_index) = $(var(hjoin){s.select,0,:}{s.int}); $var(id_label) = $(var(hjoin){s.select,1,:}{s.int}); xdbg("resuming trasaction [$var(id_index):$var(id_label)] $tU ($var(hjoin))\n"); t_continue("$var(id_index)", "$var(id_label)", "INVRESUME");}
Kamailio World | © 2015 Orange Vallée
TSILO: example
![Page 23: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/23.jpg)
# lookup and relay after resuming transactionroute[INVRESUME] { lookup("location"); t_relay();
ts_store();
$sht(vtp=>stored::$rU) = 1; xdbg("stored transaction [$T(id_index):$T(id_label)] $fU =>
$rU\n");}
Kamailio World | © 2015 Orange Vallée
TSILO: example
![Page 24: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/24.jpg)
Kamailio World | © 2015 Orange Vallée
Multi-device without Push & TSILO
![Page 25: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/25.jpg)
Kamailio World | © 2015 Orange Vallée
Multi-device with Push & TSILO
![Page 26: Kamailio · What is Libon? app available on VoIP and VoIP out calls App2app calls and calls to landlines and mobiles in more than 100 destinations. Free app to app calls](https://reader033.vdocuments.net/reader033/viewer/2022042712/5f8bf8e75a6ac15a0850e4ea/html5/thumbnails/26.jpg)
• Stats• More RPC commands• USRLOC callbacks?
Kamailio World | © 2015 Orange Vallée
TSILO: improvements