SlideShare uma empresa Scribd logo
1 de 36
Pwning Your Phone ,[object Object]
Past & Today ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Adhearsion in a Nutshell ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Why VoIP Rocks ,[object Object],[object Object],[object Object],[object Object],[object Object],(why the lucky stiff???)
Fun VoIP Projects ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Dave Troy’s Asterisk-Powered Roomba Dave’s also writing “Telephony with Ruby”. Will be published by The Prags in November
What is  ? What is  ? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Existing Control Grammars Suck At... ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],...to name just a few things!
Old Dialplan Example [macro-dial-iax] exten => s,1,SetGlobalVar(FOUNDME=ANSWER)  exten => s,2,GotoIf($[${LEN(${ARG1})} = 10]?2:4)  exten => s,3,SetVar(NumToDial=1${ARG1})  exten => s,4,Goto(s,6)  exten => s,5,SetVar(NumToDial=${ARG1}) ... From extensions.conf
Why Use Adhearsion? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Before Adhearsion.
Before Adhearsion. After Adhearsion.
Other Aspects of Adhearsion ,[object Object],[object Object],[object Object],[object Object],[object Object]
Getting Started
Asterisk?! Isn’t that hard to install? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Installing Adhearsion gem install adhearsion [asterisk-context] exten => _.,1,AGI(agi://127.0.0.1)
Writing Adhearsion Dialplans internal { }
Writing Adhearsion Dialplans internal { play ‘hello-world’ }
Writing Adhearsion Dialplans internal { loop { play ‘tt-monkeys’ } }
Writing Adhearsion Dialplans internal { +foo } foo { record { dial SIP/:out_trunk/1234 } }
Writing Adhearsion Dialplans internal { play %w”a-connect-charge-of 16 cents-per-minute will-apply” }
Writing Adhearsion Dialplans internal { case  extension when   10 ... 100 dial  SIP /extension when   6000 ... 6020 ,  7000 .. 7030 join extension when  _ ' 21XX ' if   Time .now.hour.between?  2 ,  10 dial  SIP / " berlin-office " /extension[ 2 .. 4 ] else  speak  " It is not business hours now  in Germany. " end ...
Writing Adhearsion Dialplans ... when   US_NUMBER dial  SIP / ' us-trunk-out ' /extension when   / ^  {11,}$ / dial  IAX / ' intl-trunk-out ' /extension else play  %w' sorry invalid extension please-try-again ' end }
Database-Driven Dialplans Dialplans service { customer = Account.find_by_phone_number callerid usage = customer.usage_this_month if usage >= 100.hours then +beyond_limit else customer.usage_this_month += time do dial IAX2/'main-trunk'/extension end end } beyond_limit { play %w"sorry your-limit-of 100 hours has-been-reached" }
How Does Adhearsion Talk to Asterisk? ,[object Object],[object Object],[object Object],[object Object],[object Object]
Things you can do from Rails ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Helpers
What’s a Helper? ,[object Object],[object Object],[object Object],[object Object]
Helpers require "hpricot" require "open-uri" def lookup number hash = {} url = " http://www.whitepages.com/9901/search/ReversePhone?phone=#{number} " doc = Hpricot open(url) # This div contains all the information we need, unless it's an unlisted number if (results = doc.at "#results_single_listing") then # This div's h3 contains the name of the caller hash[:first_name], hash[:last_name] = results.at('h3').inner_html.split(/,*/).reverse # Now we just need the rest of the information contained in p's. meta = results/'p' meta.pop # Discard the useless p element hash[:number] = meta.pop.inner_html city_info = meta.pop.inner_html city_info = city_info.match /(.+), ([A-Za-z]{2}) ({5})/ hash[:city]  = city_info[1] hash[:state] = city_info[2] hash[:zip]  = city_info[3] hash[:address] = meta.map(&:inner_html) * " " elsif (results = doc.at "#results_single_phone_info") then meta = results/'span' hash[:location] = (meta.pop.inner_html.match /Location: (.*)/)[1] end if hash[:first_name] or hash[:last_name] then hash[:composite] = "#{hash[:first_name]} #{hash[:last_name]}" else hash[:composite] = hash[:location] end hash end
Helpers (in C) (in C) int fast_factorial(int input) { int prod = 1, count = 1; while(count <= input) { prod *= count++; } return sum; }
Micromenus
Micromenus ,[object Object],[object Object],[object Object],[object Object],[object Object]
Micromenus item 'Adhearsion Server Statistics' do item 'View Registered SIP Users' do PBX.sip_users.each do |u| item &quot;SIP user '#{u.username}' on IP #{u.ip}&quot; end end item 'View System Uptime' do item `uptime` end item 'Network' do heading 'Network Interface Info' `ifconfig eth1`.each_line do |line| item line end end end
Micromenus item 'Call an Employee' do item 'Select an employee below.' User.find(:all).each do |user| call user.extension, user.name end end call 'Join main conference' do play 'welcome' join 5555 end
Where Adhearsion is Headed is Headed ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Get Involved! ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Mais conteúdo relacionado

Destaque (6)

8 powodów dla których warto poznać Ruby
8 powodów dla których warto poznać Ruby8 powodów dla których warto poznać Ruby
8 powodów dla których warto poznać Ruby
 
Adhearsion and Telegraph Framework Presentation
Adhearsion and Telegraph Framework PresentationAdhearsion and Telegraph Framework Presentation
Adhearsion and Telegraph Framework Presentation
 
Ruby is Awesome
Ruby is AwesomeRuby is Awesome
Ruby is Awesome
 
IP PBX
IP PBXIP PBX
IP PBX
 
JavaStart - kurs Java Podstawy
JavaStart - kurs Java PodstawyJavaStart - kurs Java Podstawy
JavaStart - kurs Java Podstawy
 
Asterisk, IM and Presence: how?
Asterisk, IM and Presence: how?Asterisk, IM and Presence: how?
Asterisk, IM and Presence: how?
 

Semelhante a Pwning Your Phone with Adhearsion and Asterisk

Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
Satish Verma
 
Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13
Stephan Hochdörfer
 
Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#
Robert Pickering
 

Semelhante a Pwning Your Phone with Adhearsion and Asterisk (20)

Stuff we noticed while building "Asterisk in the cloud"
Stuff we noticed while building "Asterisk in the cloud"Stuff we noticed while building "Asterisk in the cloud"
Stuff we noticed while building "Asterisk in the cloud"
 
Ruby voip
Ruby voipRuby voip
Ruby voip
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat
Build HA Asterisk on Microsoft Azure using DRBD/HeartbeatBuild HA Asterisk on Microsoft Azure using DRBD/Heartbeat
Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat
 
Astricon 2010: Scaling Asterisk installations
Astricon 2010: Scaling Asterisk installationsAstricon 2010: Scaling Asterisk installations
Astricon 2010: Scaling Asterisk installations
 
Enhancing Free PBX with Adhearsion at Fosdem 2012
Enhancing Free PBX with Adhearsion at Fosdem 2012Enhancing Free PBX with Adhearsion at Fosdem 2012
Enhancing Free PBX with Adhearsion at Fosdem 2012
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGIPhpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 
Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Python
 
Aspect-oriented programming in Perl
Aspect-oriented programming in PerlAspect-oriented programming in Perl
Aspect-oriented programming in Perl
 
Aucklug slides - desktop tips and tricks
Aucklug slides - desktop tips and tricksAucklug slides - desktop tips and tricks
Aucklug slides - desktop tips and tricks
 
X-celerate 2019: Iterating fast with the MERN Stack
X-celerate 2019: Iterating fast with the MERN StackX-celerate 2019: Iterating fast with the MERN Stack
X-celerate 2019: Iterating fast with the MERN Stack
 
Kamailio with Docker and Kubernetes
Kamailio with Docker and KubernetesKamailio with Docker and Kubernetes
Kamailio with Docker and Kubernetes
 
The "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/OpsThe "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/Ops
 
Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#
 
Scripting Oracle Develop 2007
Scripting Oracle Develop 2007Scripting Oracle Develop 2007
Scripting Oracle Develop 2007
 
Programming Under Linux In Python
Programming Under Linux In PythonProgramming Under Linux In Python
Programming Under Linux In Python
 

Último

Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
amitlee9823
 
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
dipikadinghjn ( Why You Choose Us? ) Escorts
 
VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...
VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...
VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...
dipikadinghjn ( Why You Choose Us? ) Escorts
 
CBD Belapur Expensive Housewife Call Girls Number-📞📞9833754194 No 1 Vipp HIgh...
CBD Belapur Expensive Housewife Call Girls Number-📞📞9833754194 No 1 Vipp HIgh...CBD Belapur Expensive Housewife Call Girls Number-📞📞9833754194 No 1 Vipp HIgh...
CBD Belapur Expensive Housewife Call Girls Number-📞📞9833754194 No 1 Vipp HIgh...
priyasharma62062
 
VIP Independent Call Girls in Mira Bhayandar 🌹 9920725232 ( Call Me ) Mumbai ...
VIP Independent Call Girls in Mira Bhayandar 🌹 9920725232 ( Call Me ) Mumbai ...VIP Independent Call Girls in Mira Bhayandar 🌹 9920725232 ( Call Me ) Mumbai ...
VIP Independent Call Girls in Mira Bhayandar 🌹 9920725232 ( Call Me ) Mumbai ...
dipikadinghjn ( Why You Choose Us? ) Escorts
 
VIP Kalyan Call Girls 🌐 9920725232 🌐 Make Your Dreams Come True With Mumbai E...
VIP Kalyan Call Girls 🌐 9920725232 🌐 Make Your Dreams Come True With Mumbai E...VIP Kalyan Call Girls 🌐 9920725232 🌐 Make Your Dreams Come True With Mumbai E...
VIP Kalyan Call Girls 🌐 9920725232 🌐 Make Your Dreams Come True With Mumbai E...
roshnidevijkn ( Why You Choose Us? ) Escorts
 

Último (20)

Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
Call Girls Service Pune ₹7.5k Pick Up & Drop With Cash Payment 9352852248 Cal...
Call Girls Service Pune ₹7.5k Pick Up & Drop With Cash Payment 9352852248 Cal...Call Girls Service Pune ₹7.5k Pick Up & Drop With Cash Payment 9352852248 Cal...
Call Girls Service Pune ₹7.5k Pick Up & Drop With Cash Payment 9352852248 Cal...
 
20240419-SMC-submission-Annual-Superannuation-Performance-Test-–-design-optio...
20240419-SMC-submission-Annual-Superannuation-Performance-Test-–-design-optio...20240419-SMC-submission-Annual-Superannuation-Performance-Test-–-design-optio...
20240419-SMC-submission-Annual-Superannuation-Performance-Test-–-design-optio...
 
Top Rated Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...
 
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
 
Webinar on E-Invoicing for Fintech Belgium
Webinar on E-Invoicing for Fintech BelgiumWebinar on E-Invoicing for Fintech Belgium
Webinar on E-Invoicing for Fintech Belgium
 
Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...
Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...
Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...
 
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
 
VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...
VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...
VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...
 
Booking open Available Pune Call Girls Talegaon Dabhade 6297143586 Call Hot ...
Booking open Available Pune Call Girls Talegaon Dabhade  6297143586 Call Hot ...Booking open Available Pune Call Girls Talegaon Dabhade  6297143586 Call Hot ...
Booking open Available Pune Call Girls Talegaon Dabhade 6297143586 Call Hot ...
 
Booking open Available Pune Call Girls Wadgaon Sheri 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Wadgaon Sheri  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Wadgaon Sheri  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Wadgaon Sheri 6297143586 Call Hot Ind...
 
CBD Belapur Expensive Housewife Call Girls Number-📞📞9833754194 No 1 Vipp HIgh...
CBD Belapur Expensive Housewife Call Girls Number-📞📞9833754194 No 1 Vipp HIgh...CBD Belapur Expensive Housewife Call Girls Number-📞📞9833754194 No 1 Vipp HIgh...
CBD Belapur Expensive Housewife Call Girls Number-📞📞9833754194 No 1 Vipp HIgh...
 
(INDIRA) Call Girl Srinagar Call Now 8617697112 Srinagar Escorts 24x7
(INDIRA) Call Girl Srinagar Call Now 8617697112 Srinagar Escorts 24x7(INDIRA) Call Girl Srinagar Call Now 8617697112 Srinagar Escorts 24x7
(INDIRA) Call Girl Srinagar Call Now 8617697112 Srinagar Escorts 24x7
 
Stock Market Brief Deck (Under Pressure).pdf
Stock Market Brief Deck (Under Pressure).pdfStock Market Brief Deck (Under Pressure).pdf
Stock Market Brief Deck (Under Pressure).pdf
 
Kopar Khairane Russian Call Girls Number-9833754194-Navi Mumbai Fantastic Unl...
Kopar Khairane Russian Call Girls Number-9833754194-Navi Mumbai Fantastic Unl...Kopar Khairane Russian Call Girls Number-9833754194-Navi Mumbai Fantastic Unl...
Kopar Khairane Russian Call Girls Number-9833754194-Navi Mumbai Fantastic Unl...
 
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
 
Top Rated Pune Call Girls Viman Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Sex...
Top Rated  Pune Call Girls Viman Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Sex...Top Rated  Pune Call Girls Viman Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Sex...
Top Rated Pune Call Girls Viman Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Sex...
 
VIP Independent Call Girls in Mira Bhayandar 🌹 9920725232 ( Call Me ) Mumbai ...
VIP Independent Call Girls in Mira Bhayandar 🌹 9920725232 ( Call Me ) Mumbai ...VIP Independent Call Girls in Mira Bhayandar 🌹 9920725232 ( Call Me ) Mumbai ...
VIP Independent Call Girls in Mira Bhayandar 🌹 9920725232 ( Call Me ) Mumbai ...
 
VIP Kalyan Call Girls 🌐 9920725232 🌐 Make Your Dreams Come True With Mumbai E...
VIP Kalyan Call Girls 🌐 9920725232 🌐 Make Your Dreams Come True With Mumbai E...VIP Kalyan Call Girls 🌐 9920725232 🌐 Make Your Dreams Come True With Mumbai E...
VIP Kalyan Call Girls 🌐 9920725232 🌐 Make Your Dreams Come True With Mumbai E...
 
Bandra High Profile Sexy Call Girls,9833754194-Khar Road Speciality Call Girl...
Bandra High Profile Sexy Call Girls,9833754194-Khar Road Speciality Call Girl...Bandra High Profile Sexy Call Girls,9833754194-Khar Road Speciality Call Girl...
Bandra High Profile Sexy Call Girls,9833754194-Khar Road Speciality Call Girl...
 

Pwning Your Phone with Adhearsion and Asterisk

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. Dave Troy’s Asterisk-Powered Roomba Dave’s also writing “Telephony with Ruby”. Will be published by The Prags in November
  • 7.
  • 8.
  • 9. Old Dialplan Example [macro-dial-iax] exten => s,1,SetGlobalVar(FOUNDME=ANSWER) exten => s,2,GotoIf($[${LEN(${ARG1})} = 10]?2:4) exten => s,3,SetVar(NumToDial=1${ARG1}) exten => s,4,Goto(s,6) exten => s,5,SetVar(NumToDial=${ARG1}) ... From extensions.conf
  • 10.
  • 13.
  • 15.
  • 16. Installing Adhearsion gem install adhearsion [asterisk-context] exten => _.,1,AGI(agi://127.0.0.1)
  • 18. Writing Adhearsion Dialplans internal { play ‘hello-world’ }
  • 19. Writing Adhearsion Dialplans internal { loop { play ‘tt-monkeys’ } }
  • 20. Writing Adhearsion Dialplans internal { +foo } foo { record { dial SIP/:out_trunk/1234 } }
  • 21. Writing Adhearsion Dialplans internal { play %w”a-connect-charge-of 16 cents-per-minute will-apply” }
  • 22. Writing Adhearsion Dialplans internal { case extension when 10 ... 100 dial SIP /extension when 6000 ... 6020 , 7000 .. 7030 join extension when _ ' 21XX ' if Time .now.hour.between? 2 , 10 dial SIP / &quot; berlin-office &quot; /extension[ 2 .. 4 ] else speak &quot; It is not business hours now in Germany. &quot; end ...
  • 23. Writing Adhearsion Dialplans ... when US_NUMBER dial SIP / ' us-trunk-out ' /extension when / ^ {11,}$ / dial IAX / ' intl-trunk-out ' /extension else play %w' sorry invalid extension please-try-again ' end }
  • 24. Database-Driven Dialplans Dialplans service { customer = Account.find_by_phone_number callerid usage = customer.usage_this_month if usage >= 100.hours then +beyond_limit else customer.usage_this_month += time do dial IAX2/'main-trunk'/extension end end } beyond_limit { play %w&quot;sorry your-limit-of 100 hours has-been-reached&quot; }
  • 25.
  • 26.
  • 28.
  • 29. Helpers require &quot;hpricot&quot; require &quot;open-uri&quot; def lookup number hash = {} url = &quot; http://www.whitepages.com/9901/search/ReversePhone?phone=#{number} &quot; doc = Hpricot open(url) # This div contains all the information we need, unless it's an unlisted number if (results = doc.at &quot;#results_single_listing&quot;) then # This div's h3 contains the name of the caller hash[:first_name], hash[:last_name] = results.at('h3').inner_html.split(/,*/).reverse # Now we just need the rest of the information contained in p's. meta = results/'p' meta.pop # Discard the useless p element hash[:number] = meta.pop.inner_html city_info = meta.pop.inner_html city_info = city_info.match /(.+), ([A-Za-z]{2}) ({5})/ hash[:city] = city_info[1] hash[:state] = city_info[2] hash[:zip] = city_info[3] hash[:address] = meta.map(&:inner_html) * &quot; &quot; elsif (results = doc.at &quot;#results_single_phone_info&quot;) then meta = results/'span' hash[:location] = (meta.pop.inner_html.match /Location: (.*)/)[1] end if hash[:first_name] or hash[:last_name] then hash[:composite] = &quot;#{hash[:first_name]} #{hash[:last_name]}&quot; else hash[:composite] = hash[:location] end hash end
  • 30. Helpers (in C) (in C) int fast_factorial(int input) { int prod = 1, count = 1; while(count <= input) { prod *= count++; } return sum; }
  • 32.
  • 33. Micromenus item 'Adhearsion Server Statistics' do item 'View Registered SIP Users' do PBX.sip_users.each do |u| item &quot;SIP user '#{u.username}' on IP #{u.ip}&quot; end end item 'View System Uptime' do item `uptime` end item 'Network' do heading 'Network Interface Info' `ifconfig eth1`.each_line do |line| item line end end end
  • 34. Micromenus item 'Call an Employee' do item 'Select an employee below.' User.find(:all).each do |user| call user.extension, user.name end end call 'Join main conference' do play 'welcome' join 5555 end
  • 35.
  • 36.