SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Downloaden Sie, um offline zu lesen
Asterisk Basics (SIP)
03/12/10
Budapest / Hungary MÉSZÁROS Mihály
Slide 2 Asterisk Basics (SIP)
OpenSIPS vs Asterisk from SIP point of view
⬤ Opensips
⬛ Proxy, no media handling
⬛ IPv6 and Ipv4 and multicast
⬛ Transport protocols
⬜ sctp,tcp,udp,tls
⬛ RFC3263
⬜ NAPTR, SRV
⬛ Very felxible so you should know
very well what you are doing, so
need more knowledge.
⬛ Commitred to strictly follow the
IETF SIP RFC-s
⬛ Sip register binding AoR to many
SIPURI
⬛ Forking, or sequntial sip
forwarding
⬤ Asterisk
⬛ B2BUA,Media server
⬛ Ipv4 only
⬛ Transport prtocols
⬜ 1.4 only udp!
⬜ 1.6 udp,tcp,tls
⬛ Easy to learn and use
⬛ Lazy and quick and dirty SIP
implementation
⬛ Trancoding and MCU features
⬛ sip register implementation can
only handle AoR <=>ip:port
binding
⬛ MoH is activated if there is
established call with only single
direction media.
⬛ No SRTP
Slide 3 Asterisk Basics (SIP)
Few from asterisk functions
⬤ SIP B2BUA
⬤ GW
⬛ SIP,ISDN/POTS,H.323,MGCP,XMPP etc.
⬤ Media Server
⬛ IVR
⬛ MoH
⬛ Call Park
⬛ Call pickup
⬛ Voicemail
⬛ Monitor (Lawful interception etc.)
⬛ Transcoding
⬛ MCU
⬛ Call Queue
Slide 4 Asterisk Basics (SIP)
History
⬤ Goal:Bridging the gap between Traditional and Network
Telephony
⬤ Asterisk is an IP PBX wit interface to other systems and
protols (IAX,SIP,H.323,XMPP,MGCP,SCCP,ISDN/POTS,etc.)
⬤ Motivation
⬛ Price
⬛ Flexibility
⬛ Security
⬛ Interoperability
⬤ The community led by Mark Spencer of Digium
⬤ Zapta Jim Dixon
⬛ CPU has enough power to software can replace DSP in some cases.
⬤ Digium PC POTS/ISDN cards
Slide 5 Asterisk Basics (SIP)
DAHDI
⬤ The old name: ZAPTEL
⬤ Drivers for Digium PC cards
⬛ ISDN
⬜ Primary rate ISDN
⬜ Basic Rate ISDN
⬛ POTS analog
⬜ FXO/FXS
⬛ DSP for media transcoding
⬛ DSP for echo cancellation
⬤ Asterisk Timer
⬛ ztdummy
⬛ dahdi_dummy
⬛ At least meetme application is depending on it.
Slide 6 Asterisk Basics (SIP)
Versions
⬤ 1.2.x
⬛ obsoleted
⬤ 1.4.x
⬛ Old stable
⬛ 1.4.29
⬜ Branch Release Date: 2006-12-23
⬜ Security only fixes: 2010-12-23
⬜ End of Life (EOL): 2011-12-23
⬤ 1.6.x
⬛ devel
⬤ 1.8.x
⬛ LTS Long Term Support
⬛ Release date: TBD (estimated Q3 2010)
⬤ Roadmap
⬛ https://issues.asterisk.org/roadmap_page.php
Slide 7 Asterisk Basics (SIP)
Architecture
⬤ Architecture
⬛ Core
⬛ Modules
⬜ app
⬜ funct
⬜ format
⬜ chan
⬜ res
⬜ bridge
⬛ API
Slide 8 Asterisk Basics (SIP)
Configuration
⬤ Static File
⬛ configuration
⬜ asterisk.conf
⬜ modules.conf
⬜ sip.conf
⬜ sip_notify.conf
⬜ musiconhold.conf
⬜ rtp.conf
⬜ queue.conf
⬜ voicemail.conf
⬜ meetme.conf
⬜ logger.conf
⬜ cdr.conf
⬜ udptl.conf (T.38)
⬤ Static File
⬛ Runtime reloadable
⬛ Include file
⬤ Realtime
⬛ extconfig.conf
⬛ backends
⬜ SQL
⬜ postgreSQL
⬜ MySQL
⬜ odbc
⬜ Ldap
⬜ etc.
Slide 9 Asterisk Basics (SIP)
Config templating (sip.conf)
[basic-options](!) ; a template
dtmfmode=rfc2833
context=from-office
type=friend
[natted-phone](!,basic-options) ; another template inheriting basic-options
nat=yes
canreinvite=no
host=dynamic
[public-phone](!,basic-options) ; another template inheriting basic-options
nat=no
canreinvite=yes
[my-codecs](!) ; a template for my preferred codecs
disallow=all
allow=ilbc
allow=g729
allow=gsm
allow=g723
allow=ulaw
[ulaw-phone](!) ; and another one for ulaw-only
disallow=all
allow=ulaw
; and finally instantiate a few phones
[2133](natted-phone,my-codecs)
secret = peekaboo
[2134](natted-phone,ulaw-phone)
secret = not_very_secret
[2136](public-phone,ulaw-phone)
secret = not_very_secret_either
Slide 10 Asterisk Basics (SIP)
Logger/Asterisk CLI
⬤ Logger
⬛ logger.conf
⬜ [general]
⬜ [logfiles]
console => notice,warning,error
messages => notice,warning,error
⬛ Type
⬜ debug
⬜ verbose
⬜ notice
⬜ warning
⬜ error
⬤ asterisk -r
⬛ Asterisk -vvvvvvr
increase verbosity level to 6
⬤ asterisk -rx "logger reload"
⬤ Auto-complete <tab>, <?>
⬤ Commands
⬛ Core commands
⬜ debug verosity level
- Core set debug
- Core set verbosity
⬜ codecs
- core show codecs
- core show translation
⬜ Help
- core show applications
- core show function
⬜ Core
- core show uptime
- core show settings
⬜ etc.
Slide 11 Asterisk Basics (SIP)
General dialplan
⬤ Static or dynamic (extensions.conf)
⬤ Dialplan reload from CLI
⬤ Dialplan broken into section called “context” for example
context “blabla” is seems like:
[blabla]
⬤ “,” and “|” as separator char. When Asterisk parses the
dialplan, it converts any commas in the application arguments
to pipes.
⬤ Extensions (number and/or letters)
exten => 3rt45
exten => _361X.
⬤ Applications
⬛ For example application: Dial(),WaitExten(),Goto(),Macro(),
NoOp(),Set(), etc.
Slide 12 Asterisk Basics (SIP)
Dialplan syntax
⬤ Pattern prefixed by “_”
⬛ X
any digit from 0-9
⬛ Z
any digit from 1-9
⬛ N
any digit from 2-9
⬛ [1235-9]
any digit in the brackets (in this
example, 1,2,3,5,6,7,8,9)
⬛ .
wildcard, matches anything remaining
(e.g. _9011. matches anything starting
with 9011 excluding 9011 itself)
⬛ !
wildcard, causes the matching process
to complete as soon as it can
unambiguously determine that no
other matches are possible
⬤ Priority
⬛ 1
integer
⬛ n
next previous+1
regardless of whether the previous priority was
associated with the current extension or not
⬛ s
same
⬛ + int
integer n+2 or s+2
⬛ () label/alias
jump to this with goto()
⬤ Most important standard extensions
⬛ s
start: no extension
⬛ t
timeout
⬛ h
hangup: clean up the call
⬛ i
invalid: unknown extension
Slide 13 Asterisk Basics (SIP)
dialplan / extensions example
[default]
exten => 6245,hint,SIP/Grandstream1&SIP/Xlite1(Joe Schmoe) ; Channel hints for presence
exten => 6245,1,Dial(SIP/Grandstream1,20,rt) ; permit transfer
exten => 6245,n(dial),Dial(${HINT},20,rtT) ; Use hint as listed
exten => 6245,n,Voicemail(6245,u) ; Voicemail (unavailable)
exten => 6245,s+1,Hangup ; s+1, same as n
exten => 6245,dial+101,Voicemail(6245,b) ; Voicemail (busy)
exten => 6361,1,Dial(IAX2/JaneDoe,,rm) ; ring without time limit
exten => 6389,1,Dial(MGCP/aaln/1@192.168.0.14)
include => context1
[context1]
exten => 6391,1,Dial(JINGLE/asterisk@digium.com/mogorman@astjab.org);Dial via jingle
exten => 6390,1,Dial(JINGLE/caller/callee) ; Dial via jingle using labels
Slide 14 Asterisk Basics (SIP)
Dialplan syntax
⬤ Special Contexts
⬛ general
general settings like: static, writeprotect, autofallthrough, priorityjumping
⬛ globals
global variables definition and initiation
⬛ “regcontext” see sip.conf
⬤ example
[context]
exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,...)
⬤ Contexts contain several lines, one for each step of each extension. One may include
another context in the current one as well, optionally with a date and time. Included
contexts are included in the order they are listed. Switches may also be included within a
context. The order of matching within a context is always exact extensions, pattern match
extensions, includes, and switches. Includes are always processed depth-first. So for
example, if you would like a switch "A" to match before context "B", simply put switch "A" in
an included context "C", where "C" is included in your original context before "B".
⬤ Location and mapping
⬛ ENUM E164 Number to URI mapping
⬛ DuNDi Distributed Universal Number Discovery
Slide 15 Asterisk Basics (SIP)
Variables
⬤ Types
⬛ Global
⬜ SetGlobalVar()
⬛ Shared
⬜ Function SHARED()
⬛ Channel
⬜ Set()
⬛ Environment
⬜ ${ENV(foo)}
⬤ String Handling Functions
⬛ ${LEN(foo)}
⬜ String length
⬛ ${foo:offset:length}
⬜ Substring
⬛ ${foo}${bar}
⬜ Concat
⬤ $[expression]
exmple:
exten => 321,1,Set(COUNT=3)
exten => 321,n,Set(NEWCOUNT=$[$
{COUNT} + 1])
exten => 321,n,SayNumber($
{NEWCOUNT})
⬤ Most important predefined channel
variables
⬛ ${CALLERID(all)}
⬜ ${CALLERID(num)}
⬜ ${CALLERID(name)}
⬛ ${DIALSTATUS}
⬜ CHANUNAVAIL, CONGESTION, BUSY,
NOANSWER, ANSWER, CANCEL, HANGUP
⬛ ${CONTEXT}
⬛ ${CHANNEL}
⬛ ${EXTEN}
Slide 16 Asterisk Basics (SIP)
Operators and function
⬤ boolean / logical
⬛ expr1 | expr2
⬛ expr1 & expr2
⬛ !expr1
⬤ comparison
⬛ expr1 = expr2
⬛ expr1 != expr2
⬛ expr1 < expr2
⬛ expr1 > expr2
⬛ expr1 <= expr2
⬛ expr1 >= expr2
⬤ Arithmetic
⬛ expr1 + expr2
⬛ expr1 - expr2
⬛ - expr (unary negation operator)
⬛ expr1 * expr2
⬛ expr1 / expr2
⬛ expr1 % expr2
⬤ Regular expression
⬛ expr1 : regexp2
The regular expression is anchored to the beginning
of the string with an implicit '^'.
⬛ expr1 =~ expr2
The match is not anchored to the beginning of the
string.
⬤ Conditional operator
⬛ expr1 ? expr2 :: expr3
⬤ Operator Precedence
1. Parentheses: (, )
2. Unary operators !, -
3. Regular expression comparison: :, =~
4. Multiplicative arithmetic operators: *, /, %
5. Additive arithmetic operators: +, -
6. Comparison operators: =, !=, <, >, <=, >=
7. Logical operators: |, &
8. Conditional operator: ? :
⬤ Function
⬛ FUNCTION_NAME(argument)
⬛ ${FUNCTION_NAME($
{FUNCTION_NAME(argument)})}
Slide 17 Asterisk Basics (SIP)
Macro
⬤ Example
[macro-xyz]
exten => s,1,Dial(${ARG1},${ARG2},t)
⬛ Macro definition is similar to context
⬛ xyz is the name of the macro
⬛ Can triggered from any context with
[default]
exten => 6601,1,Macro(xyz,SIP/1000,10)
⬛ Where SIP/100 is ARG1 and 10 is Arg2
⬤ In a macro context, extra channel variables are available.
⬛ ${ARG1}: The first argument passed to the macro
⬛ ${ARG2}: The second argument passed to the macro (and so on)
⬛ ${MACRO_CONTEXT}: The context of the extension that triggered this macro
⬛ ${MACRO_EXTEN}: The extension that triggered this macro
⬛ ${MACRO_OFFSET}: Set by a macro to influence the priority where execution will
continue after exiting the macro
⬛ ${MACRO_PRIORITY}: The priority in the extension where this macro was triggered
Slide 18 Asterisk Basics (SIP)
AstDB database
⬤ Berkley DB version 1
⬤ familly, key, value
⬤ Used to store for example SIP registration
⬤ Functions what can be used from dialplan to manipulate data in
this database
⬛ DB(family/key)
Read from or write to the Asterisk database.
⬛ DB_DELETE(family/key)
Return a value from the database and delete it.
⬛ DB_EXISTS(family/key)
Check to see if a key exists in the Asterisk database.
⬤ Example
exten => 456,1,Set(DB(test/count)=1)
exten => 456,n,Set(COUNT=${DB(test/count)})
exten => 456,n,SayNumber(${COUNT})
Slide 19 Asterisk Basics (SIP)
Asterisk as B2BUA vs. reINVITE direct media
Slide 20 Asterisk Basics (SIP)
Sip dial strings
⬤ Sip dial strings
⬛ SIP/devicename
⬛ SIP/username@domain (SIP uri)
⬛ SIP/username[:password[:md5secret[:authna
me[:transport]]]]@host[:port]
⬛ SIP/devicename/extension
⬤ Device is a “UA” []
Slide 21 Asterisk Basics (SIP)
sip.conf
⬤ [general]
⬛ Fax pass trough T.38
⬛ Outgoing registration
⬛ Sip domain
⬛ Realtime
⬛ NAT
⬛ Media
⬛ Subscribe
⬛ Session-timer
⬜ Check call keep-alive sending sip messages
⬛ RTP timer
⬜ Check call keep-alive using rtp timout
⬛ SIP timer
⬤ [authentication]
⬛ Realm,user,pass to auth outgoing
requests it requested by UAS or by
proxy.
⬤ Sip devices
⬛ [devicename]
⬜ type
- User
» search incoming message with the
From: header user part
- Peer
» Search incoming message peer ip
addr
- Friend= User and Peer
» search incoming message with the
From: header user part and after if
no match found then search by src
ip.
⬜ canreinvite
- bridged media
- direct media
⬜ qualify
- SIP Option “ping”
⬜ dtmfmode
⬜ host
Slide 22 Asterisk Basics (SIP)
voicemail.conf
⬤ imap or disk storage
⬛ Default file storage /var/spool/asterisk/voicemail/
⬜ Voicemail files are inside this folder are grouped by context/voicemailbox
⬤ Sections
⬛ [general]
⬜ format
⬜ Email options
⬛ [zonemessages]
⬜ Time zone greetings and date/time format
⬛ Voicemail contexts
⬜ [default]
- Format: mailbox => password,name[,email[,pager_email[,options]]]
- Eample:
4200 => 9855,Mark Spencer,markster@linux-support.net,mypager@digium.com,attach=no|
serveremail=myaddy@digium.com|tz=central|maxmsg=10
⬜ [other]
⬜ [etc]
Slide 23 Asterisk Basics (SIP)
Call parking / MeetMe
⬤ Parking
⬛ features.conf
⬜ parkext
⬜ parkpos
⬜ context
⬜ parkingtime
⬛ Parking lot
⬛ Context parkedcalls
⬛ Applications
⬜ ParkAndAnnounce: Park
and Announce
⬜ ParkedCall:
Answer a parked call.
⬤ MeetMe (MCU)
⬛ meetme.conf
⬜ Example
[rooms]
conf => 600
⬛ Room
⬜ Auth /Pin
⬛ Applications
⬜ MeetMe:
MeetMe conference bridge.
⬜ MeetMeAdmin:
MeetMe conference
administration.
⬜ MeetMeCount:
MeetMe participant count.
Slide 24 Asterisk Basics (SIP)
Programing interfaces AGI / AMI
⬤ Asterisk Gateway Interface
⬛ Programing inerface
⬛ AGI, EAGI, DeadAGI, FastAGI
⬛ STDIN,STDOUT,STDERR
⬛ Interface implementation
perl,php,python etc.
⬛ extension.conf
exten=>123,1,Answer()
exten=>123,2,AGI(agi-test.agi)
⬤ Asterisk Manager Interface
⬛ manager.conf
⬜ Directory manager.d
⬛ Request-respose
⬛ Example
⬤ Call files
⬛ /var/spool/asterisk/outgoing/
⬛ Click-to-call
⬛ !Move file instead of copy!
Action: GetConfig
Filename: users.conf
ActionID: 9873497149817
Response: Success
ActionID: 987397149817
Category-000000: general
Line-000000-000000: fullname=New User
Line-000000-000001: userbase=6000
Line-000000-000002: hasvoicemail=yes
Line-000000-000003: hassip=yes
Line-000000-000004: hasiax=yes
Line-000000-000005: hasmanager=no
Line-000000-000006: callwaiting=yes
Line-000000-000007: threewaycalling=yes
Line-000000-000008: callwaitingcallerid=yes
Line-000000-000009: transfer=yes
Line-000000-000010: canpark=yes
Line-000000-000011: cancallforward=yes
Line-000000-000012: callreturn=yes
Line-000000-000013: callgroup=1
Line-000000-000014: pickupgroup=1
Line-000000-000015: host=dynamic
Slide 25 Asterisk Basics (SIP)
CDR
⬤ calldate: datetime of the started call
⬤ clid: Caller*ID with text (80 characters)
⬤ src: Caller*ID number (string, 80 characters)
⬤ dst: Destination extension (string, 80 characters)
⬤ dcontext: Destination context (string, 80 characters)
⬤ channel: Channel used (80 characters)
⬤ dstchannel: Destination channel if appropriate (80 characters)
⬤ lastapp: Last application if appropriate (80 characters)
⬤ lastdata: Last application data (arguments) (80 characters)
⬤ duration: Total time in system, in seconds (integer), from dial to hangup
⬤ billsec: Total time call is up, in seconds (integer), from answer to hangup
⬤ disposition: What happened to the call: ANSWERED, NO ANSWER, BUSY, FAILED
⬤ amaflags: What flags to use: see amaflags: DOCUMENTATION, BILLING, IGNORE etc.
⬤ accountcode: What account number to use: Asterisk billing account, (string, 20 characters)
⬤ uniqueid: Unique Channel Identifier (32 characters)
(In some cases, uniqueid is appended)
⬤ user field: A user-defined field, maximum 255 characters
Slide 26 Asterisk Basics (SIP)
Accounting / CDR
⬤ CDR
⬛ asterisk-stat
⬤ Billing
⬤ Backends
⬛ CSV
⬛ custom(file)
⬛ Manager interface
⬛ ODBC
⬛ PostgreSQL
⬛ radius
⬛ sqlite
⬛ Tds
⬛ MySQL
⬜ not installed by default
⬜ Can be installed from asterisk addons
packagae
⬤ MySQL
CREATE TABLE `cdr` (
`calldate` datetime NOT NULL default '0000-00-
00 00:00:00',
`clid` varchar(80) NOT NULL default '',
`src` varchar(80) NOT NULL default '',
`dst` varchar(80) NOT NULL default '',
`dcontext` varchar(80) NOT NULL default '',
`channel` varchar(80) NOT NULL default '',
`dstchannel` varchar(80) NOT NULL default '',
`lastapp` varchar(80) NOT NULL default '',
`lastdata` varchar(80) NOT NULL default '',
`duration` int(11) NOT NULL default '0',
`billsec` int(11) NOT NULL default '0',
`disposition` varchar(45) NOT NULL default '',
`amaflags` int(11) NOT NULL default '0',
`accountcode` varchar(20) NOT NULL default '',
`userfield` varchar(255) NOT NULL default ''
);
Slide 27 Asterisk Basics (SIP)
References
⬤ http://www.asterisk.org/
⬤ http://www.digium.com
⬤ http://www.voip-info.org
⬤ http://downloads.oreilly.com/books/9780596510480.pdf
⬤ http://astbook.asteriskdocs.org
⬤ http://www.asteriskguru.com
⬤ http://www.amoocon.de
⬤ http://www.voip-info.org/wiki/view/Asterisk+variables
⬤ http://www.voip-info.org/wiki/index.php?page=Asterisk+config+extensions.conf
⬤ http://www.voip-info.org/wiki/view/Asterisk+Dialplan+Patterns
⬤ http://www.voip-info.org/wiki/view/Asterisk+tips+openhours
⬤ http://www.voip-info.org/wiki/view/Asterisk+priorities
⬤ http://www.voip-info.org/wiki/view/Asterisk+standard+extensions
⬤ http://linuxinnovations.com/index.html
⬤ http://www.panoramisk.com/wp-content/uploads/2007/05/asterisk-call-flow-outbridge.png
⬤ http://www.panoramisk.com/wp-content/uploads/2007/05/asterisk-call-flow-inbridge.png
⬤ http://areski.net/asterisk-stat-v2/about.php
⬤ extensions.conf
Asterisk Basics (SIP) 28
Thank You!

Weitere ähnliche Inhalte

Was ist angesagt?

Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...
Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...
Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...
mfrancis
 
4byte As Number Migration Suggestion
4byte As Number Migration Suggestion4byte As Number Migration Suggestion
4byte As Number Migration Suggestion
Kae Hsu
 

Was ist angesagt? (19)

gRPC or Rest, why not both?
gRPC or Rest, why not both?gRPC or Rest, why not both?
gRPC or Rest, why not both?
 
Make gRPC great again
Make gRPC great againMake gRPC great again
Make gRPC great again
 
VPP for Stateless SRv6/GTP-U Translation
VPP for Stateless SRv6/GTP-U TranslationVPP for Stateless SRv6/GTP-U Translation
VPP for Stateless SRv6/GTP-U Translation
 
Yang in OpenDaylight
Yang in OpenDaylightYang in OpenDaylight
Yang in OpenDaylight
 
Zebra 2.0 in Hybrid Cloud Era
Zebra 2.0 in Hybrid Cloud EraZebra 2.0 in Hybrid Cloud Era
Zebra 2.0 in Hybrid Cloud Era
 
Ovs dpdk hwoffload way to full offload
Ovs dpdk hwoffload way to full offloadOvs dpdk hwoffload way to full offload
Ovs dpdk hwoffload way to full offload
 
Kernel Recipes 2013 - Deciphering Oopsies
Kernel Recipes 2013 - Deciphering OopsiesKernel Recipes 2013 - Deciphering Oopsies
Kernel Recipes 2013 - Deciphering Oopsies
 
LF_OVS_17_OvS manipulation with Go at DigitalOcean
LF_OVS_17_OvS manipulation with Go at DigitalOceanLF_OVS_17_OvS manipulation with Go at DigitalOcean
LF_OVS_17_OvS manipulation with Go at DigitalOcean
 
Cilium – Kernel Native Security & DDOS Mitigation for Microservices with BPF
Cilium – Kernel Native Security & DDOS Mitigation for Microservices with BPFCilium – Kernel Native Security & DDOS Mitigation for Microservices with BPF
Cilium – Kernel Native Security & DDOS Mitigation for Microservices with BPF
 
[En] IPVS for Docker Containers
[En] IPVS for Docker Containers[En] IPVS for Docker Containers
[En] IPVS for Docker Containers
 
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
 
Cisco -Ccie rs quick_review_kit
Cisco -Ccie rs quick_review_kitCisco -Ccie rs quick_review_kit
Cisco -Ccie rs quick_review_kit
 
I Pv6 Enabling Menog 0.4
I Pv6 Enabling Menog 0.4I Pv6 Enabling Menog 0.4
I Pv6 Enabling Menog 0.4
 
IPv6 How To Set Up a Linux IPv6 Lan
IPv6 How To Set Up  a Linux IPv6 LanIPv6 How To Set Up  a Linux IPv6 Lan
IPv6 How To Set Up a Linux IPv6 Lan
 
Linux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network SecurityLinux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network Security
 
Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...
Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...
Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...
 
4byte As Number Migration Suggestion
4byte As Number Migration Suggestion4byte As Number Migration Suggestion
4byte As Number Migration Suggestion
 
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 ImplementationPugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
 
LF_OVS_17_Enabling hardware acceleration in OVS-DPDK using DPDK Framework.
LF_OVS_17_Enabling hardware acceleration in OVS-DPDK using DPDK Framework.LF_OVS_17_Enabling hardware acceleration in OVS-DPDK using DPDK Framework.
LF_OVS_17_Enabling hardware acceleration in OVS-DPDK using DPDK Framework.
 

Ähnlich wie SIP Tutorial/Workshop 3

Os Reindersfinal
Os ReindersfinalOs Reindersfinal
Os Reindersfinal
oscon2007
 
Os Reindersfinal
Os ReindersfinalOs Reindersfinal
Os Reindersfinal
oscon2007
 
Memory Optimization
Memory OptimizationMemory Optimization
Memory Optimization
guest3eed30
 
Memory Optimization
Memory OptimizationMemory Optimization
Memory Optimization
Wei Lin
 

Ähnlich wie SIP Tutorial/Workshop 3 (20)

String Comparison Surprises: Did Postgres lose my data?
String Comparison Surprises: Did Postgres lose my data?String Comparison Surprises: Did Postgres lose my data?
String Comparison Surprises: Did Postgres lose my data?
 
How it's made: C++ compilers (GCC)
How it's made: C++ compilers (GCC)How it's made: C++ compilers (GCC)
How it's made: C++ compilers (GCC)
 
Don't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax TreesDon't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax Trees
 
How Xslate Works
How Xslate WorksHow Xslate Works
How Xslate Works
 
Of Owls and IO Objects
Of Owls and IO ObjectsOf Owls and IO Objects
Of Owls and IO Objects
 
Os Reindersfinal
Os ReindersfinalOs Reindersfinal
Os Reindersfinal
 
Os Reindersfinal
Os ReindersfinalOs Reindersfinal
Os Reindersfinal
 
Evolution of Spark APIs
Evolution of Spark APIsEvolution of Spark APIs
Evolution of Spark APIs
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007
 
05 - Bypassing DEP, or why ASLR matters
05 - Bypassing DEP, or why ASLR matters05 - Bypassing DEP, or why ASLR matters
05 - Bypassing DEP, or why ASLR matters
 
Summary of C++17 features
Summary of C++17 featuresSummary of C++17 features
Summary of C++17 features
 
07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters
 
不深不淺,帶你認識 LLVM (Found LLVM in your life)
不深不淺,帶你認識 LLVM (Found LLVM in your life)不深不淺,帶你認識 LLVM (Found LLVM in your life)
不深不淺,帶你認識 LLVM (Found LLVM in your life)
 
Next Generation Indexes For Big Data Engineering (ODSC East 2018)
Next Generation Indexes For Big Data Engineering (ODSC East 2018)Next Generation Indexes For Big Data Engineering (ODSC East 2018)
Next Generation Indexes For Big Data Engineering (ODSC East 2018)
 
닷넷 개발자를 위한 패턴이야기
닷넷 개발자를 위한 패턴이야기닷넷 개발자를 위한 패턴이야기
닷넷 개발자를 위한 패턴이야기
 
04 - I love my OS, he protects me (sometimes, in specific circumstances)
04 - I love my OS, he protects me (sometimes, in specific circumstances)04 - I love my OS, he protects me (sometimes, in specific circumstances)
04 - I love my OS, he protects me (sometimes, in specific circumstances)
 
Memory Optimization
Memory OptimizationMemory Optimization
Memory Optimization
 
Memory Optimization
Memory OptimizationMemory Optimization
Memory Optimization
 
Modern C++
Modern C++Modern C++
Modern C++
 
Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...
Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...
Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...
 

Mehr von Mihály Mészáros

OAuth and STUN, TURN in WebRTC context RFC7635
OAuth and STUN, TURN  in WebRTC context RFC7635OAuth and STUN, TURN  in WebRTC context RFC7635
OAuth and STUN, TURN in WebRTC context RFC7635
Mihály Mészáros
 

Mehr von Mihály Mészáros (14)

GN4-UP2U update - Moodlemoot19
GN4-UP2U update - Moodlemoot19GN4-UP2U update - Moodlemoot19
GN4-UP2U update - Moodlemoot19
 
Nyílt forráskódú VideoKonferencia mindenkinek! (A GÉANT4 JRA4 T4 és T5 eredmé...
Nyílt forráskódú VideoKonferencia mindenkinek! (A GÉANT4 JRA4 T4 és T5 eredmé...Nyílt forráskódú VideoKonferencia mindenkinek! (A GÉANT4 JRA4 T4 és T5 eredmé...
Nyílt forráskódú VideoKonferencia mindenkinek! (A GÉANT4 JRA4 T4 és T5 eredmé...
 
WebRTC - Hol tartunk ma?
WebRTC - Hol tartunk ma?WebRTC - Hol tartunk ma?
WebRTC - Hol tartunk ma?
 
A jég (ICE), a kanyar (TURN), a bódulat (STUN) és a kijózanító tűzfal (Firewall)
A jég (ICE), a kanyar (TURN), a bódulat (STUN) és a kijózanító tűzfal (Firewall)A jég (ICE), a kanyar (TURN), a bódulat (STUN) és a kijózanító tűzfal (Firewall)
A jég (ICE), a kanyar (TURN), a bódulat (STUN) és a kijózanító tűzfal (Firewall)
 
GÉANT TURN pilot
GÉANT TURN pilotGÉANT TURN pilot
GÉANT TURN pilot
 
WebRTC - Hol tartunk ma?
WebRTC - Hol tartunk ma?WebRTC - Hol tartunk ma?
WebRTC - Hol tartunk ma?
 
SIP Tutorial/Workshop 0
SIP Tutorial/Workshop 0SIP Tutorial/Workshop 0
SIP Tutorial/Workshop 0
 
Webrtc puzzle
Webrtc puzzleWebrtc puzzle
Webrtc puzzle
 
5th tf webrtc-welcome
5th tf webrtc-welcome5th tf webrtc-welcome
5th tf webrtc-welcome
 
OAuth and STUN, TURN in WebRTC context RFC7635
OAuth and STUN, TURN  in WebRTC context RFC7635OAuth and STUN, TURN  in WebRTC context RFC7635
OAuth and STUN, TURN in WebRTC context RFC7635
 
Stun turn poc_pilot
Stun turn poc_pilotStun turn poc_pilot
Stun turn poc_pilot
 
WebRTC Identity in SAML Federations
WebRTC Identity in SAML FederationsWebRTC Identity in SAML Federations
WebRTC Identity in SAML Federations
 
WebRTC eduCONF
WebRTC eduCONFWebRTC eduCONF
WebRTC eduCONF
 
Webrtc
WebrtcWebrtc
Webrtc
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

SIP Tutorial/Workshop 3

  • 1. Asterisk Basics (SIP) 03/12/10 Budapest / Hungary MÉSZÁROS Mihály
  • 2. Slide 2 Asterisk Basics (SIP) OpenSIPS vs Asterisk from SIP point of view ⬤ Opensips ⬛ Proxy, no media handling ⬛ IPv6 and Ipv4 and multicast ⬛ Transport protocols ⬜ sctp,tcp,udp,tls ⬛ RFC3263 ⬜ NAPTR, SRV ⬛ Very felxible so you should know very well what you are doing, so need more knowledge. ⬛ Commitred to strictly follow the IETF SIP RFC-s ⬛ Sip register binding AoR to many SIPURI ⬛ Forking, or sequntial sip forwarding ⬤ Asterisk ⬛ B2BUA,Media server ⬛ Ipv4 only ⬛ Transport prtocols ⬜ 1.4 only udp! ⬜ 1.6 udp,tcp,tls ⬛ Easy to learn and use ⬛ Lazy and quick and dirty SIP implementation ⬛ Trancoding and MCU features ⬛ sip register implementation can only handle AoR <=>ip:port binding ⬛ MoH is activated if there is established call with only single direction media. ⬛ No SRTP
  • 3. Slide 3 Asterisk Basics (SIP) Few from asterisk functions ⬤ SIP B2BUA ⬤ GW ⬛ SIP,ISDN/POTS,H.323,MGCP,XMPP etc. ⬤ Media Server ⬛ IVR ⬛ MoH ⬛ Call Park ⬛ Call pickup ⬛ Voicemail ⬛ Monitor (Lawful interception etc.) ⬛ Transcoding ⬛ MCU ⬛ Call Queue
  • 4. Slide 4 Asterisk Basics (SIP) History ⬤ Goal:Bridging the gap between Traditional and Network Telephony ⬤ Asterisk is an IP PBX wit interface to other systems and protols (IAX,SIP,H.323,XMPP,MGCP,SCCP,ISDN/POTS,etc.) ⬤ Motivation ⬛ Price ⬛ Flexibility ⬛ Security ⬛ Interoperability ⬤ The community led by Mark Spencer of Digium ⬤ Zapta Jim Dixon ⬛ CPU has enough power to software can replace DSP in some cases. ⬤ Digium PC POTS/ISDN cards
  • 5. Slide 5 Asterisk Basics (SIP) DAHDI ⬤ The old name: ZAPTEL ⬤ Drivers for Digium PC cards ⬛ ISDN ⬜ Primary rate ISDN ⬜ Basic Rate ISDN ⬛ POTS analog ⬜ FXO/FXS ⬛ DSP for media transcoding ⬛ DSP for echo cancellation ⬤ Asterisk Timer ⬛ ztdummy ⬛ dahdi_dummy ⬛ At least meetme application is depending on it.
  • 6. Slide 6 Asterisk Basics (SIP) Versions ⬤ 1.2.x ⬛ obsoleted ⬤ 1.4.x ⬛ Old stable ⬛ 1.4.29 ⬜ Branch Release Date: 2006-12-23 ⬜ Security only fixes: 2010-12-23 ⬜ End of Life (EOL): 2011-12-23 ⬤ 1.6.x ⬛ devel ⬤ 1.8.x ⬛ LTS Long Term Support ⬛ Release date: TBD (estimated Q3 2010) ⬤ Roadmap ⬛ https://issues.asterisk.org/roadmap_page.php
  • 7. Slide 7 Asterisk Basics (SIP) Architecture ⬤ Architecture ⬛ Core ⬛ Modules ⬜ app ⬜ funct ⬜ format ⬜ chan ⬜ res ⬜ bridge ⬛ API
  • 8. Slide 8 Asterisk Basics (SIP) Configuration ⬤ Static File ⬛ configuration ⬜ asterisk.conf ⬜ modules.conf ⬜ sip.conf ⬜ sip_notify.conf ⬜ musiconhold.conf ⬜ rtp.conf ⬜ queue.conf ⬜ voicemail.conf ⬜ meetme.conf ⬜ logger.conf ⬜ cdr.conf ⬜ udptl.conf (T.38) ⬤ Static File ⬛ Runtime reloadable ⬛ Include file ⬤ Realtime ⬛ extconfig.conf ⬛ backends ⬜ SQL ⬜ postgreSQL ⬜ MySQL ⬜ odbc ⬜ Ldap ⬜ etc.
  • 9. Slide 9 Asterisk Basics (SIP) Config templating (sip.conf) [basic-options](!) ; a template dtmfmode=rfc2833 context=from-office type=friend [natted-phone](!,basic-options) ; another template inheriting basic-options nat=yes canreinvite=no host=dynamic [public-phone](!,basic-options) ; another template inheriting basic-options nat=no canreinvite=yes [my-codecs](!) ; a template for my preferred codecs disallow=all allow=ilbc allow=g729 allow=gsm allow=g723 allow=ulaw [ulaw-phone](!) ; and another one for ulaw-only disallow=all allow=ulaw ; and finally instantiate a few phones [2133](natted-phone,my-codecs) secret = peekaboo [2134](natted-phone,ulaw-phone) secret = not_very_secret [2136](public-phone,ulaw-phone) secret = not_very_secret_either
  • 10. Slide 10 Asterisk Basics (SIP) Logger/Asterisk CLI ⬤ Logger ⬛ logger.conf ⬜ [general] ⬜ [logfiles] console => notice,warning,error messages => notice,warning,error ⬛ Type ⬜ debug ⬜ verbose ⬜ notice ⬜ warning ⬜ error ⬤ asterisk -r ⬛ Asterisk -vvvvvvr increase verbosity level to 6 ⬤ asterisk -rx "logger reload" ⬤ Auto-complete <tab>, <?> ⬤ Commands ⬛ Core commands ⬜ debug verosity level - Core set debug - Core set verbosity ⬜ codecs - core show codecs - core show translation ⬜ Help - core show applications - core show function ⬜ Core - core show uptime - core show settings ⬜ etc.
  • 11. Slide 11 Asterisk Basics (SIP) General dialplan ⬤ Static or dynamic (extensions.conf) ⬤ Dialplan reload from CLI ⬤ Dialplan broken into section called “context” for example context “blabla” is seems like: [blabla] ⬤ “,” and “|” as separator char. When Asterisk parses the dialplan, it converts any commas in the application arguments to pipes. ⬤ Extensions (number and/or letters) exten => 3rt45 exten => _361X. ⬤ Applications ⬛ For example application: Dial(),WaitExten(),Goto(),Macro(), NoOp(),Set(), etc.
  • 12. Slide 12 Asterisk Basics (SIP) Dialplan syntax ⬤ Pattern prefixed by “_” ⬛ X any digit from 0-9 ⬛ Z any digit from 1-9 ⬛ N any digit from 2-9 ⬛ [1235-9] any digit in the brackets (in this example, 1,2,3,5,6,7,8,9) ⬛ . wildcard, matches anything remaining (e.g. _9011. matches anything starting with 9011 excluding 9011 itself) ⬛ ! wildcard, causes the matching process to complete as soon as it can unambiguously determine that no other matches are possible ⬤ Priority ⬛ 1 integer ⬛ n next previous+1 regardless of whether the previous priority was associated with the current extension or not ⬛ s same ⬛ + int integer n+2 or s+2 ⬛ () label/alias jump to this with goto() ⬤ Most important standard extensions ⬛ s start: no extension ⬛ t timeout ⬛ h hangup: clean up the call ⬛ i invalid: unknown extension
  • 13. Slide 13 Asterisk Basics (SIP) dialplan / extensions example [default] exten => 6245,hint,SIP/Grandstream1&SIP/Xlite1(Joe Schmoe) ; Channel hints for presence exten => 6245,1,Dial(SIP/Grandstream1,20,rt) ; permit transfer exten => 6245,n(dial),Dial(${HINT},20,rtT) ; Use hint as listed exten => 6245,n,Voicemail(6245,u) ; Voicemail (unavailable) exten => 6245,s+1,Hangup ; s+1, same as n exten => 6245,dial+101,Voicemail(6245,b) ; Voicemail (busy) exten => 6361,1,Dial(IAX2/JaneDoe,,rm) ; ring without time limit exten => 6389,1,Dial(MGCP/aaln/1@192.168.0.14) include => context1 [context1] exten => 6391,1,Dial(JINGLE/asterisk@digium.com/mogorman@astjab.org);Dial via jingle exten => 6390,1,Dial(JINGLE/caller/callee) ; Dial via jingle using labels
  • 14. Slide 14 Asterisk Basics (SIP) Dialplan syntax ⬤ Special Contexts ⬛ general general settings like: static, writeprotect, autofallthrough, priorityjumping ⬛ globals global variables definition and initiation ⬛ “regcontext” see sip.conf ⬤ example [context] exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,...) ⬤ Contexts contain several lines, one for each step of each extension. One may include another context in the current one as well, optionally with a date and time. Included contexts are included in the order they are listed. Switches may also be included within a context. The order of matching within a context is always exact extensions, pattern match extensions, includes, and switches. Includes are always processed depth-first. So for example, if you would like a switch "A" to match before context "B", simply put switch "A" in an included context "C", where "C" is included in your original context before "B". ⬤ Location and mapping ⬛ ENUM E164 Number to URI mapping ⬛ DuNDi Distributed Universal Number Discovery
  • 15. Slide 15 Asterisk Basics (SIP) Variables ⬤ Types ⬛ Global ⬜ SetGlobalVar() ⬛ Shared ⬜ Function SHARED() ⬛ Channel ⬜ Set() ⬛ Environment ⬜ ${ENV(foo)} ⬤ String Handling Functions ⬛ ${LEN(foo)} ⬜ String length ⬛ ${foo:offset:length} ⬜ Substring ⬛ ${foo}${bar} ⬜ Concat ⬤ $[expression] exmple: exten => 321,1,Set(COUNT=3) exten => 321,n,Set(NEWCOUNT=$[$ {COUNT} + 1]) exten => 321,n,SayNumber($ {NEWCOUNT}) ⬤ Most important predefined channel variables ⬛ ${CALLERID(all)} ⬜ ${CALLERID(num)} ⬜ ${CALLERID(name)} ⬛ ${DIALSTATUS} ⬜ CHANUNAVAIL, CONGESTION, BUSY, NOANSWER, ANSWER, CANCEL, HANGUP ⬛ ${CONTEXT} ⬛ ${CHANNEL} ⬛ ${EXTEN}
  • 16. Slide 16 Asterisk Basics (SIP) Operators and function ⬤ boolean / logical ⬛ expr1 | expr2 ⬛ expr1 & expr2 ⬛ !expr1 ⬤ comparison ⬛ expr1 = expr2 ⬛ expr1 != expr2 ⬛ expr1 < expr2 ⬛ expr1 > expr2 ⬛ expr1 <= expr2 ⬛ expr1 >= expr2 ⬤ Arithmetic ⬛ expr1 + expr2 ⬛ expr1 - expr2 ⬛ - expr (unary negation operator) ⬛ expr1 * expr2 ⬛ expr1 / expr2 ⬛ expr1 % expr2 ⬤ Regular expression ⬛ expr1 : regexp2 The regular expression is anchored to the beginning of the string with an implicit '^'. ⬛ expr1 =~ expr2 The match is not anchored to the beginning of the string. ⬤ Conditional operator ⬛ expr1 ? expr2 :: expr3 ⬤ Operator Precedence 1. Parentheses: (, ) 2. Unary operators !, - 3. Regular expression comparison: :, =~ 4. Multiplicative arithmetic operators: *, /, % 5. Additive arithmetic operators: +, - 6. Comparison operators: =, !=, <, >, <=, >= 7. Logical operators: |, & 8. Conditional operator: ? : ⬤ Function ⬛ FUNCTION_NAME(argument) ⬛ ${FUNCTION_NAME($ {FUNCTION_NAME(argument)})}
  • 17. Slide 17 Asterisk Basics (SIP) Macro ⬤ Example [macro-xyz] exten => s,1,Dial(${ARG1},${ARG2},t) ⬛ Macro definition is similar to context ⬛ xyz is the name of the macro ⬛ Can triggered from any context with [default] exten => 6601,1,Macro(xyz,SIP/1000,10) ⬛ Where SIP/100 is ARG1 and 10 is Arg2 ⬤ In a macro context, extra channel variables are available. ⬛ ${ARG1}: The first argument passed to the macro ⬛ ${ARG2}: The second argument passed to the macro (and so on) ⬛ ${MACRO_CONTEXT}: The context of the extension that triggered this macro ⬛ ${MACRO_EXTEN}: The extension that triggered this macro ⬛ ${MACRO_OFFSET}: Set by a macro to influence the priority where execution will continue after exiting the macro ⬛ ${MACRO_PRIORITY}: The priority in the extension where this macro was triggered
  • 18. Slide 18 Asterisk Basics (SIP) AstDB database ⬤ Berkley DB version 1 ⬤ familly, key, value ⬤ Used to store for example SIP registration ⬤ Functions what can be used from dialplan to manipulate data in this database ⬛ DB(family/key) Read from or write to the Asterisk database. ⬛ DB_DELETE(family/key) Return a value from the database and delete it. ⬛ DB_EXISTS(family/key) Check to see if a key exists in the Asterisk database. ⬤ Example exten => 456,1,Set(DB(test/count)=1) exten => 456,n,Set(COUNT=${DB(test/count)}) exten => 456,n,SayNumber(${COUNT})
  • 19. Slide 19 Asterisk Basics (SIP) Asterisk as B2BUA vs. reINVITE direct media
  • 20. Slide 20 Asterisk Basics (SIP) Sip dial strings ⬤ Sip dial strings ⬛ SIP/devicename ⬛ SIP/username@domain (SIP uri) ⬛ SIP/username[:password[:md5secret[:authna me[:transport]]]]@host[:port] ⬛ SIP/devicename/extension ⬤ Device is a “UA” []
  • 21. Slide 21 Asterisk Basics (SIP) sip.conf ⬤ [general] ⬛ Fax pass trough T.38 ⬛ Outgoing registration ⬛ Sip domain ⬛ Realtime ⬛ NAT ⬛ Media ⬛ Subscribe ⬛ Session-timer ⬜ Check call keep-alive sending sip messages ⬛ RTP timer ⬜ Check call keep-alive using rtp timout ⬛ SIP timer ⬤ [authentication] ⬛ Realm,user,pass to auth outgoing requests it requested by UAS or by proxy. ⬤ Sip devices ⬛ [devicename] ⬜ type - User » search incoming message with the From: header user part - Peer » Search incoming message peer ip addr - Friend= User and Peer » search incoming message with the From: header user part and after if no match found then search by src ip. ⬜ canreinvite - bridged media - direct media ⬜ qualify - SIP Option “ping” ⬜ dtmfmode ⬜ host
  • 22. Slide 22 Asterisk Basics (SIP) voicemail.conf ⬤ imap or disk storage ⬛ Default file storage /var/spool/asterisk/voicemail/ ⬜ Voicemail files are inside this folder are grouped by context/voicemailbox ⬤ Sections ⬛ [general] ⬜ format ⬜ Email options ⬛ [zonemessages] ⬜ Time zone greetings and date/time format ⬛ Voicemail contexts ⬜ [default] - Format: mailbox => password,name[,email[,pager_email[,options]]] - Eample: 4200 => 9855,Mark Spencer,markster@linux-support.net,mypager@digium.com,attach=no| serveremail=myaddy@digium.com|tz=central|maxmsg=10 ⬜ [other] ⬜ [etc]
  • 23. Slide 23 Asterisk Basics (SIP) Call parking / MeetMe ⬤ Parking ⬛ features.conf ⬜ parkext ⬜ parkpos ⬜ context ⬜ parkingtime ⬛ Parking lot ⬛ Context parkedcalls ⬛ Applications ⬜ ParkAndAnnounce: Park and Announce ⬜ ParkedCall: Answer a parked call. ⬤ MeetMe (MCU) ⬛ meetme.conf ⬜ Example [rooms] conf => 600 ⬛ Room ⬜ Auth /Pin ⬛ Applications ⬜ MeetMe: MeetMe conference bridge. ⬜ MeetMeAdmin: MeetMe conference administration. ⬜ MeetMeCount: MeetMe participant count.
  • 24. Slide 24 Asterisk Basics (SIP) Programing interfaces AGI / AMI ⬤ Asterisk Gateway Interface ⬛ Programing inerface ⬛ AGI, EAGI, DeadAGI, FastAGI ⬛ STDIN,STDOUT,STDERR ⬛ Interface implementation perl,php,python etc. ⬛ extension.conf exten=>123,1,Answer() exten=>123,2,AGI(agi-test.agi) ⬤ Asterisk Manager Interface ⬛ manager.conf ⬜ Directory manager.d ⬛ Request-respose ⬛ Example ⬤ Call files ⬛ /var/spool/asterisk/outgoing/ ⬛ Click-to-call ⬛ !Move file instead of copy! Action: GetConfig Filename: users.conf ActionID: 9873497149817 Response: Success ActionID: 987397149817 Category-000000: general Line-000000-000000: fullname=New User Line-000000-000001: userbase=6000 Line-000000-000002: hasvoicemail=yes Line-000000-000003: hassip=yes Line-000000-000004: hasiax=yes Line-000000-000005: hasmanager=no Line-000000-000006: callwaiting=yes Line-000000-000007: threewaycalling=yes Line-000000-000008: callwaitingcallerid=yes Line-000000-000009: transfer=yes Line-000000-000010: canpark=yes Line-000000-000011: cancallforward=yes Line-000000-000012: callreturn=yes Line-000000-000013: callgroup=1 Line-000000-000014: pickupgroup=1 Line-000000-000015: host=dynamic
  • 25. Slide 25 Asterisk Basics (SIP) CDR ⬤ calldate: datetime of the started call ⬤ clid: Caller*ID with text (80 characters) ⬤ src: Caller*ID number (string, 80 characters) ⬤ dst: Destination extension (string, 80 characters) ⬤ dcontext: Destination context (string, 80 characters) ⬤ channel: Channel used (80 characters) ⬤ dstchannel: Destination channel if appropriate (80 characters) ⬤ lastapp: Last application if appropriate (80 characters) ⬤ lastdata: Last application data (arguments) (80 characters) ⬤ duration: Total time in system, in seconds (integer), from dial to hangup ⬤ billsec: Total time call is up, in seconds (integer), from answer to hangup ⬤ disposition: What happened to the call: ANSWERED, NO ANSWER, BUSY, FAILED ⬤ amaflags: What flags to use: see amaflags: DOCUMENTATION, BILLING, IGNORE etc. ⬤ accountcode: What account number to use: Asterisk billing account, (string, 20 characters) ⬤ uniqueid: Unique Channel Identifier (32 characters) (In some cases, uniqueid is appended) ⬤ user field: A user-defined field, maximum 255 characters
  • 26. Slide 26 Asterisk Basics (SIP) Accounting / CDR ⬤ CDR ⬛ asterisk-stat ⬤ Billing ⬤ Backends ⬛ CSV ⬛ custom(file) ⬛ Manager interface ⬛ ODBC ⬛ PostgreSQL ⬛ radius ⬛ sqlite ⬛ Tds ⬛ MySQL ⬜ not installed by default ⬜ Can be installed from asterisk addons packagae ⬤ MySQL CREATE TABLE `cdr` ( `calldate` datetime NOT NULL default '0000-00- 00 00:00:00', `clid` varchar(80) NOT NULL default '', `src` varchar(80) NOT NULL default '', `dst` varchar(80) NOT NULL default '', `dcontext` varchar(80) NOT NULL default '', `channel` varchar(80) NOT NULL default '', `dstchannel` varchar(80) NOT NULL default '', `lastapp` varchar(80) NOT NULL default '', `lastdata` varchar(80) NOT NULL default '', `duration` int(11) NOT NULL default '0', `billsec` int(11) NOT NULL default '0', `disposition` varchar(45) NOT NULL default '', `amaflags` int(11) NOT NULL default '0', `accountcode` varchar(20) NOT NULL default '', `userfield` varchar(255) NOT NULL default '' );
  • 27. Slide 27 Asterisk Basics (SIP) References ⬤ http://www.asterisk.org/ ⬤ http://www.digium.com ⬤ http://www.voip-info.org ⬤ http://downloads.oreilly.com/books/9780596510480.pdf ⬤ http://astbook.asteriskdocs.org ⬤ http://www.asteriskguru.com ⬤ http://www.amoocon.de ⬤ http://www.voip-info.org/wiki/view/Asterisk+variables ⬤ http://www.voip-info.org/wiki/index.php?page=Asterisk+config+extensions.conf ⬤ http://www.voip-info.org/wiki/view/Asterisk+Dialplan+Patterns ⬤ http://www.voip-info.org/wiki/view/Asterisk+tips+openhours ⬤ http://www.voip-info.org/wiki/view/Asterisk+priorities ⬤ http://www.voip-info.org/wiki/view/Asterisk+standard+extensions ⬤ http://linuxinnovations.com/index.html ⬤ http://www.panoramisk.com/wp-content/uploads/2007/05/asterisk-call-flow-outbridge.png ⬤ http://www.panoramisk.com/wp-content/uploads/2007/05/asterisk-call-flow-inbridge.png ⬤ http://areski.net/asterisk-stat-v2/about.php ⬤ extensions.conf
  • 28. Asterisk Basics (SIP) 28 Thank You!