1. alessandro@luongo.pro IGLU-ASCI
Studente di Informatica @ UniMI
Infrastruttura Voip
opensource con
FreeSWITCH
1
sabato 24 novembre 2012
2. DI COSA NON
PARLERÒ
Il mio primo centralino FreeSWITCH
Sicurezza e antifrode :(
Topologia ... ma di topology hiding si!
2
sabato 24 novembre 2012
3. Q && A
FreeSwitch come progetto OS
Architettura interna di FreeSWITCH
Ripasso SIP: dove e poter usare Freeswitch al meglio.
Accenni di sviluppo su FS.
cat /dev/urandom
3
sabato 24 novembre 2012
5. Quando morirà la telefonia
tradizionale basta su rete
PTSN?
When will the PSTN die? TAC (federal communication commission) cited a
recent study by the National Center for Health Statistics that says it all:
As of May 2010, 23% of respondents lived in a mobile-only household
37% of adults in the 18-24 and 30-34 age groups lived in a mobile-
only household
Only 6% of the US population will still be served by the public switched
telephone network (which is defined as TDM access line service) by the end
of 2018
“Without continued government support, the PSTN would probably
disappear before 2018 since the carriers' cost to maintain the many
miles of copper and the rest of the system doesn't go down nearly as
quickly as revenue from subscribers declines. “
( http://www.quora.com/When-will-PSTN-telephony-die - http://
www.tmcnet.com/topics/articles/193844-death-the-public-switched-
telephone-network-pstn.htm )
5
sabato 24 novembre 2012
7. FREESWITCH?
Extracted from the FreeSWITCH FAQ:
"A PBX is an entity that allows a private company to have its own mini
phone, providing services like voicemail, extensions and conferencing to phones.
The primary focus of a PBX is for multiple phones to find each other and
communicate. A soft-switch is a software application that can connect phone lines
from one network to another, often routing calls from one protocol to another or
to a termination point such as a PBX. FreeSWITCH has the potential to
also implement a PBX but it is not mandated to. Think of it as a lower
level application than a PBX. It’s possible to load several modules into FreeSWITCH
to make it behave exactly like a cluster of PBX applications. This is entirely easier
than trying to make a single monolithic PBX behave as a switch especially when
much of the PBX functionality is permanently built into the core of the PBX
application."
7
sabato 24 novembre 2012
8. AH... SKYPE!
http://wiki.freeswitch.org/wiki/
Mod_skypopen_Skype_Endpoint_and_Trunk
Skypopen is an endpoint (channel driver) that uses
the Skype client as an interface to the Skype
network, and allows incoming and outgoing Skype
calls to/from FreeSWITCH.
“connecting-freeswitch-skype-network-mod_skypopen-scalability-
issues.MP4”
http://www.nch.com.au/skypetosip/
8
sabato 24 novembre 2012
9. QUALE È MEGLIO TRA
FREESWITCH E ASTERISK?!
Ha poco senso comparare due prodotti:
Possono essere complementari tra loro
C’è già molta documentazione su
internet
Sono in continuo sviluppo e
cambiamento
9
sabato 24 novembre 2012
10. ANCHE SE...
WachDog :D
Bug patchati, poi reinseriti :D
Negli anni scorsi non riusciva ad
implementare l’autenticazione su IP
Chiamate su liste gestite male
Ha ottimo supporto per quanto riguarda
TDM ed SS7
10
sabato 24 novembre 2012
11. What are some potential uses
of a PBX for a “power user”?
Tutto il talk
11
sabato 24 novembre 2012
12. Q or A
FreeSwitch come progetto OS
Architettura interna di FreeSWITCH
Ripasso SIP: dove e poter usare Freeswitch al meglio.
Accenni di sviluppo su FS.
cat /dev/urandom
12
sabato 24 novembre 2012
14. FREESWITCH
COME PROGETTO
OPENSOURCE
FS-developing team:
Community molto attiva (ML+IRC)
Supporto HW ormai buono come quello
di Asterisk
( http://www.voipsupply.com/blog/digium-vs-sangoma-which-pci-cards-are-
better )
14
sabato 24 novembre 2012
16. INFORMAZIONI
irc.freenode.org #freeswitch
wiki.freeswitch.org
Mailing List (3000 utenti all’anno)
16
sabato 24 novembre 2012
17. ALCUNE SCELTE DI
SVILUPPO SI SONO
RIVELATE OTTIME...
I moduli di FreeSWITCH invece sono organizzati in
modo tale da essere gestiti tramite le API e
tramite eventi, prestando molta attenzione ad
evitare comportamnti non voluti. Altre scelte
progettuali, come l’utilizzo di uno stack SIP open source
già fatto (da Nokia) hanno consentito ai programmatori
di concentrarsi su altri aspetti.
17
sabato 24 novembre 2012
18. One of the nice things about FreeSWITCH is
the community. The developers themselves
and the users all hang in one channel -
#freeswitch (at freenode). The mailing list is
also a very nice place. In both places they are
very friendly and supportive, unlike the
Asterisk/Digium community. They are also
open-minded. At one point I asked for a
feature (mod_yaml) and the creator of
FreeSWITCH (Anthony Minessale) came up
with this feature in less than 3 hours -
without even knowing what YAML was when
the feature was asked for. It was really
impressive. He came up with a whole new
feature that he hadn't even heard of yet, while
the Asterisk devs can't even fix little bugs.
Here is the proof of this: lists.freeswitch.org/
pipermail/freeswitch-users/2008-June/
003954.html
18
sabato 24 novembre 2012
19. Q or A
Architettura interna di FreeSWITCH
Ripasso SIP: dove e poter usare Freeswitch al meglio.
Accenni di sviluppo su FS.
cat /dev/urandom
19
sabato 24 novembre 2012
27. SIP SOFIA
http://sofia-sip.sourceforge.net/
Latest release is: 1.12.11 (2011-03-11).
Progetto di NOKIA!
Aderisce alle specifiche SIP molto bene.
http://sofia-sip.sourceforge.net/refdocs/nua/
nua_call_model.html
27
sabato 24 novembre 2012
29. Q or A
FreeSwitch come progetto OS
Architettura interna di FreeSWITCH
Ripasso SIP: dove e poter usare Freeswitch al meglio.
Accenni di sviluppo su FS.
cat /dev/urandom
29
sabato 24 novembre 2012
33. PACCHETTO
SIP
•Request-Line:: E’ la prima linea del pacchetto. Contiene il nome del metodo, il Request-URI e la versione del SIP
separati da un singolo spazio.
•Request-URI: E’ un URI SIP o un SIPS. Indica l’utente o il servizio al quale la richiesta è indirizzata.
•To: Indica, tramite l’URI, il destinatario logico della richiesta. Può contenere un URI SIP o SIPS, e un display name.
•From: Questo campo specifica il mittente logico del pacchetto dal quale proviene la richiesta. E’ formato da un
display-name e un URI. Contiene anche un tag (una stringa pseudo-casuale) che identifica il chiamante all’interno del
dialogo.
•Via:E’ un campo che registra la rotta che una richiesta compie. E’ usato per sapere il percorso di risposta in modo
da tornare all’utente originale. E’ l’unico campo dove è importante l’ordinamento. Ogni proxy che forwarda una
richiesta aggiunge in cima a questo header il suo indirizzo. Ogni volta che un proxy aggiunge il proprio indirizzo,
include un tag che contiene un hash crittografico del campo To, From, Call-ID e del campo Request-URI. Per
rispondere, si copia nel pacchetto la lista dei Via Headers. Se il proxy che riceve la risposta, controlla con successo
che il suo indirizzo corrisponda a quello in cima alla lista dell’header e continua a forwardare il pacchetto
rimuovendo il suo URI dalla lista, in caso contrario lo scarta. Viene aggiunto un tag se lo user agent o il proxy che
ricevono il pacchetto di richiesta SIP si accorge che l’IP del mittente è diverso dall’ultimo Via header aggiunto. Ciò
indica che è presente un firewall o del NAT nel percorso del pacchetto. (Computer Science Mailing Lists 2005)
33
sabato 24 novembre 2012
34. PACCHETTO
SIP
•Max-Forward: E’ usato per limitare il numero di HOP che la richiesta può passare prima di essere
terminata. E’ un numero che viene decrementato per ogni passaggio ad ogni server (tuttavia alcune
implementazioni di asterisk non lo fanno). Serve per evitare i loop di rete, in modo che un pacchetto non
viaggi in eterno ma venga fermato quando questo valore arriva a zero. Solitamente parte da 70.
•Call-ID: E’ un identificatore univoco per un gruppo di messaggi. E’ generato dall’UAC dalla
combinazione di una stringa pseudo casuale e l’indirizzo IP del telefono. Deve essere uguale in ogni
registrazione dall’UAC.
•CSeq: E’ un campo usato per identificare le transazioni SIP. Contiene una sequenza di numeri e un
metodo, che deve corrispondere al meodo del pacchetto. Viene creato all’inizio di una transazione, ed
è una sequenza casuale esprimibile come un unsigned int minore di 2^31. E’ incrementato di 1 dopo
ogni messaggio. Viene usato per determinare messaggi non consegnati, o la consegna di un pacchetto
non in ordine.
•Contact: Contiene un SIP o SIPS URI che indicano una rotta diretta all’utente. E’ solitamente
composto da username seguito da una @ e da un FQDN (o un indirizzo IP).
•Content-Type: Descrive il tipo di messggio contenuto nel payload, solitamente è SDP.
•Content-Length: La lunghezza del payload del pacchetto, usata per trovare la fine di ogni
pacchetto SIP in uno stream.
34
sabato 24 novembre 2012
35. B2BUA
IETF standard (RFC 3261) defines a back-to-back user agent as “a logical
entity that receives a request and processes it as a user agent server (UAS).
In order to determine how the request should be answered, it acts as a user
agent client (UAC) and generates requests. Unlike a proxy server, it
maintains a dialogue state and must participate in all requests sent on the
dialogues it has established.”
The standard definition concludes with this: “Since it is a concatenation of
a UAC and UAS, no explicit definitions are needed for its behavior.”
This concise definition is the source of both its flexibility and power, and at
the same time, great confusion and a lack of consensus about its inherent
capabilities.
In poche parole: è coinvolto anche il Media!
35
sabato 24 novembre 2012
36. FREESWITCH
COME SBC OK PER:
Security (encryption)
SIP “translation”
Topology hiding (occhio all’SDP!)
Media trans-coding
FAX
36
sabato 24 novembre 2012
37. ... ALTRI FANNO
MEGLIO:
Load balancer
Proxy registrant
37
sabato 24 novembre 2012
38. APPLICATION
SERVER
Potente dialplan
CDR
IVR
VoiceMail
Conference Call
38
sabato 24 novembre 2012
39. SIP
FRONTEND
A patto di non avere GROSSE necessità di
scalabilità
Usa mod_sofia che è cosa buona e giusta.
39
sabato 24 novembre 2012
41. •
Chiamare il VoIP Phone della vittima, attendere una
risposta e un successivo riaggancio.
•
Quando viene inviato all’attacker il messaggio SIP di BYE, l’attacker
risponde con un pacchetto “407 proxy authentication required”.
SIP ATTACK •
A questo punto il telefono replica il pacchetto di BYE aggiungendo
l’header di autenticazione: questo header è l’auth digest.
•
Ora l’attaccante può eseguire attacchi di bruteforce ed ottenere pieno
controllo dell’account della vittima.
Nella mailing list dei SIP-Implementors, quando è stata sollevata la questione
è emerso che questo è un comportamento del SIP del tutto legittimo. Esso
infatti è pensato probabilmente per impedire session-hijacking di un
attaccante, che potrebbe terminare anticipatamente la chiamata con un
messaggio di BYE non autenticato.
41
sabato 24 novembre 2012
42. Q or A
Comparison with other products
Architettura interna di FS,
Ripasso SIP: dove e poter usare Freeswitch al meglio.
Accenni di sviluppo su FS.
cat /dev/urandom
42
sabato 24 novembre 2012
44. DOCUMENTAZIONE
mod_skel.c
http://wiki.freeswitch.org/wiki/
Documentation/
Developer_Documentation
http://docs.freeswitch.org/
ML
irc.freenode.org #freeswitch
44
sabato 24 novembre 2012
45. COSA
POSSIAMO FARE?
Accedere a tutte le API di sviluppo!
RTP, XML, ODBC, API, CHAT, IVR, DTMF
45
sabato 24 novembre 2012
46. - S W I T C H _ M O D U L E _ S H U T D OW N _ F U N C T I O N ( m o d _ s ke l _ s h u t d o w n ) ;
- S W I T C H _ M O D U L E _ RU N T I M E _ F U N C T I O N ( m o d _ s ke l _ r u n t i m e ) ;
- S W I T C H _ M O D U L E _ L OA D _ F U N C T I O N ( m o d _ s ke l _ l o a d ) ;
- S W I T C H _ M O D U L E _ RU N T I M E _ F U N C T I O N ( m o d _ s ke l _ r u n t i m e ) {
while(looping)
{
switch_cond_next();
}
re t u r n S W I T C H _ S TAT U S _ T E R M ; }
- S W I T C H _ S TA N DA R D _ A P I ( s ke l _ f u n c t i o n )
{
d o _ s t u f f ( S W I T C H _ T RU E ) ;
re t u r n S W I T C H _ S TAT U S _ S U C C E S S ; }
46
sabato 24 novembre 2012
47. Quando viene chiamata la nostra
applicazione dal dialplan (xml, lua... etc)
abbiamo un uuid che identifica la nostra
chiamata all’interno del centralino.
47
sabato 24 novembre 2012
48. MA PER ESEMPIO?
Transcoding
Billing
Routing
Conference
SIP Analysis
Filtering
Media analysis
48
sabato 24 novembre 2012
49. IDEE
Accedere all flusso rtp della chiamata e
registrare i pacchetti, SENZA fare uso di
applicazioni del dialplan (una sorta di
“rootkit audio”)
49
sabato 24 novembre 2012
51. RSS FEED
mod_rss will parse and read an XML based RSS
feed, then read the entries aloud via a TTS
engine such as mod_cepstral. While its reading
you can fast forward through articles, rewind, etc.
http://wiki.freeswitch.org/wiki/Mod_rss
51
sabato 24 novembre 2012