architettura voip con freeswitch + gazzurbo
DESCRIPTION
freeswitch antani voip scinawa memeTRANSCRIPT
Infrastruttura Voip opensource con FreeSWITCH
1
Studente di Informatica @ UniMI
IGLU-ASCI
sabato 24 novembre 2012
DI COSA NON PARLERÒ
Il mio primo centralino FreeSWITCHSicurezza e antifrode :(Topologia ... ma di topology hiding si!
2
sabato 24 novembre 2012
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
Q && A
4
sabato 24 novembre 2012
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
AH... SKYPE!
6
sabato 24 novembre 2012
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
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
QUALE È MEGLIO TRA FREESWITCH E ASTERISK?!
Ha poco senso comparare due prodotti:Possono essere complementari tra loroC’è già molta documentazione su internetSono in continuo sviluppo e cambiamento
9
sabato 24 novembre 2012
WachDog :DBug patchati, poi reinseriti :DNegli anni scorsi non riusciva ad implementare l’autenticazione su IPChiamate su liste gestite male Ha ottimo supporto per quanto riguarda TDM ed SS7
ANCHE SE...
10
sabato 24 novembre 2012
What are some potential uses of a PBX for a “power user”?
Tutto il talk
11
sabato 24 novembre 2012
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
FreeSWITCH come progetto OS
13
sabato 24 novembre 2012
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
GIT-HUB!
15
sabato 24 novembre 2012
INFORMAZIONI
irc.freenode.org #freeswitchwiki.freeswitch.orgMailing List (3000 utenti all’anno)
16
sabato 24 novembre 2012
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
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
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
ARCHITETTURA
20
sabato 24 novembre 2012
21
sabato 24 novembre 2012
22
sabato 24 novembre 2012
23
sabato 24 novembre 2012
ESEMPI LUA
-- answer the phonesession:answer();
-- play a filesession:streamFile("hello.wav");
-- hangupsession:hangup();
C SWITCH_STANDARD_APP(demo_function){ switch_channel_t *channel; channel = switch_core_session_get_channel(session);
switch_assert(channel);
switch_channel_answer(channel); switch_core_session_stream_file (session, "hello.wav");
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
}
24
sabato 24 novembre 2012
type,name,ikeycodec,ADPCM (IMA),mod_spandspcodec,AMR,mod_amrcodec,G.711 alaw,CORE_PCM_MODULEcodec,G.711 ulaw,CORE_PCM_MODULEcodec,G.722,mod_spandspcodec,G.723.1 6.3k,mod_g723_1codec,G.726 16k,mod_spandspcodec,G.726 16k (AAL2),mod_spandspcodec,G.726 24k,mod_spandspcodec,G.726 24k (AAL2),mod_spandspcodec,G.726 32k,mod_spandspcodec,G.726 32k (AAL2),mod_spandspcodec,G.726 40k,mod_spandspcodec,G.726 40k (AAL2),mod_spandspcodec,G.729,mod_g729codec,GSM,mod_spandspcodec,H.261 Video (passthru),mod_h26xcodec,H.263 Video (passthru),mod_h26xcodec,H.263+ Video (passthru),mod_h26xcodec,H.263++ Video (passthru),mod_h26xcodec,H.264 Video (passthru),mod_h26xcodec,LPC-10,mod_spandspcodec,PROXY PASS-THROUGH,CORE_PCM_MODULEcodec,PROXY VIDEO PASS-THROUGH,CORE_PCM_MODULEcodec,Polycom(R) G722.1/G722.1C,mod_sirencodec,RAW Signed Linear (16 bit),CORE_PCM_MODULEcodec,Speex,mod_speexcodec,iLBC,mod_ilbc
25
HTTP://WIKI.FREESWITCH.ORG/WIKI/CODECS
Codec Supportati
sabato 24 novembre 2012
26
sabato 24 novembre 2012
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
/DEV/URANDOM
EarlyMediaSIP attacksRSS Reader
28
sabato 24 novembre 2012
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
Ripassiamo il SIP?
30
sabato 24 novembre 2012
CARATTERISTICHE
31
Protocollo testuale ±Molto scalabile +Simile ad HTTP +
∈ ℂ (secondo rfc per dimensione) ±
sabato 24 novembre 2012
32
sabato 24 novembre 2012
PACCHETTO SIP
33
•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)
sabato 24 novembre 2012
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
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.
35
In poche parole: è coinvolto anche il Media!
sabato 24 novembre 2012
FREESWITCH COME SBC OK PER:
Security (encryption)SIP “translation”Topology hiding (occhio all’SDP!)Media trans-codingFAX
36
sabato 24 novembre 2012
... ALTRI FANNO MEGLIO:
Load balancerProxy registrant
37
sabato 24 novembre 2012
APPLICATION SERVER
Potente dialplanCDR IVR VoiceMailConference Call
38
sabato 24 novembre 2012
SIP FRONTEND
A patto di non avere GROSSE necessità di scalabilitàUsa mod_sofia che è cosa buona e giusta.
39
sabato 24 novembre 2012
/DEV/URANDOM
EarlyMediaSIP attacksRSS Reader
40
sabato 24 novembre 2012
SIP ATTACK
• 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”.
• 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
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
ACCENNI DI SVILUPPO SU FreeSWITCH
43
sabato 24 novembre 2012
DOCUMENTAZIONE
mod_skel.chttp://wiki.freeswitch.org/wiki/Documentation/Developer_Documentationhttp://docs.freeswitch.org/ML irc.freenode.org #freeswitch
44
sabato 24 novembre 2012
COSA POSSIAMO FARE?
Accedere a tutte le API di sviluppo!RTP, XML, ODBC, API, CHAT, IVR, DTMF
45
sabato 24 novembre 2012
- SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_ske l_shutdown) ;
- SWITCH_MODULE_RUNTIME_FUNCTION(mod_ske l_runt ime) ;
- SWITCH_MODULE_LOAD_FUNCTION(mod_ske l_ load ) ;
- SWITCH_MODULE_RUNTIME_FUNCTION(mod_ske l_runt ime) {
wh i l e ( loop ing )
{
sw i t ch_cond_next ( ) ;
}
re turn SWITCH_STATUS_TERM; }
- SWITCH_STANDARD_API ( ske l_ func t ion )
{
do_s tu f f ( SWITCH_TRUE) ;
re turn SWITCH_STATUS_SUCCESS ; }
46
sabato 24 novembre 2012
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
Transcoding
Billing
Routing
Conference
SIP Analysis
Filtering
Media analysis
48
MA PER ESEMPIO?
sabato 24 novembre 2012
Accedere all flusso rtp della chiamata e registrare i pacchetti, SENZA fare uso di applicazioni del dialplan (una sorta di “rootkit audio”)
49
IDEE
sabato 24 novembre 2012
LOL
EarlyMediaSIP attacksRSS Reader
50
sabato 24 novembre 2012
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
GRAZIE. #gazzurbo
52
sabato 24 novembre 2012
53
sabato 24 novembre 2012