Demo
• Llamada entre dos números
• Con el número público
Ideas
• Respuesta diferente por horas
• Respuesta diferente en función del CallerID
• Integración con Jabber
• Voicemail
• IVR, colas
• 1000s de cosas mas ...
El dialplan se complica
[efmenu]
include => users5xx
include => rooms
include => efhq
exten => s,1,NoOp(Entering eF main menu for caller ${CALLERID})
exten => s,2,Answer
exten => s,3,Wait(2)
exten => s,4,Playback(beep)
exten => s,5,Background(${SALUDOEN}enter-ext-of-person)
exten => s,6,Background(beep)
exten => s,7,WaitExten(15)
exten => 101,1,Playback(room-service)
exten => 101,2,Goto(efmenu,s,4)
exten => 999,1,Goto(svetdisa,s,1)
exten => 999,2,Goto(efmenu,s,4)
exten => i,1,Playback(pbx-invalid)
exten => i,2,Goto(efmenu,s,6)
exten => t,1,Playback(vm-goodbye)
exten => t,2,Hangup()
Hello World
en /etc/asterisk/extensions.conf
[adhearsion]
exten => 101,1,AGI(agi://127.0.0.1)
$ cd hello1
en extensions.rb
dhearsion {
play 'hello-word'
}
$ ahn start .
internal {
case extension
when 101...200
employee = User.find_by_extension extension
if employee.busy? then voicemail extension
else
dial employee, :for => 10.rings
voicemail unless last_call_successful?
end
when 888
play weather_report(\"Dallas Texas\")
when 999 then +joker_voicemail
end
}
Adhearsion II: Amazon
require 'amazon/search'
r = Amazon::Search::Request.new( '10N1KX1NVQZ2VXXXXXXX')
begin
resp = r.keyword_search( '0596529260', 'books' )
resp.products.each do |p|
unless p.availability =~ /not available/
printf( \"%s (ASIN %s) -- %s\\n\",
p.product_name, p.asin, p.our_price )
end
end
rescue
puts \"No se encuentra.\"
end
$ ruby price2
RESTful Web Services (ASIN 0596529260) -- $26.39
Adhearsion II: Amazon
adhearsion {
require 'amazon/search'
r = Amazon::Search::Request.new( '10N1KX1NVQZ2VXXXXXXX')
begin
resp = r.keyword_search( extension, 'books' )
resp.products.each do |p|
unless p.availability =~ /not available/
play p.our_price
end
end
rescue
play \"no-info-about-number\"
end
}
voxbone {
sleep 2.seconds
play \"hello-world\"
isbn = input()
require 'amazon/search'
r = Amazon::Search::Request.new( '10N1KX1NVQZ2VXXXXXXX')
begin
resp = r.keyword_search( isbn, 'books' )
resp.products.each do |p|
unless p.availability =~ /not available/
play p.our_price
end
end
rescue
play \"no-info-about-number\"
end
}
Telegraph y AGI
exten => 105, 1, AGI(agi://127.0.0.1/my_route?param1=value)
wants.voice do
render_voice do |voice|
voice.play “hello-world”
voice.link_to_dtmf 'bank-lineitem-menu' do
link 1, :action=>\"new\"
link 2, :action=>\"list\"
link 3, :action=>\"index\"
end
end
end
respond_to
def index
respond_to do |wants|
wants.html { render }
wants.voice { render_voice }
end
end
$ vi app/views/alumnos/index.voice
voice.play_sound \"hello-world\"
index
# index.rhtml
<h1>Consultas</h1>
<ul>
<li> <%= link_to \"Faltas\", :action=>\"faltas\" %> </li>
<li> <%= link_to \"Notas\", :action=>\"notas\" %> </li>
</ul>
# index.voice
voice.play_sound 'thank-you-for-calling'
voice.link_to_dtmf 'presione1-2' do
link 1, :controller => \"alumnos\", :action => \"faltas\"
link 2, :action => \"notas\"
end
formulario
# notas.rhtml
<h1>Consultar notas</h1>
<% form_tag '/alumnos/show_notas' do %>
DNI: <%= text_field_tag 'dni' %>
<%= submit_tag 'Ver notas' %>
<% end %>
# notas.voice
voice.form :url=>{:controller =>
'alumnos', :action=>'show_notas'} do |form|
form.numeric_input 'dni', 'dni', :max_digits=>8
end
resultados
# show_notas rhtml
<h3>Notas de <%= @alumno.nombre %></h3>
<table class=\"list\">
<% @notas.each do |nota| %>
<tr>
<td class=\"list\"><%= nota.asignatura %></td>
<td class=\"list\"><%= nota.nota %></td>
</tr>
<% end %>
</table>
# show.voice
@notas.each do |nota|
voice.play nota.asignatura.to_slug
voice.play nota.nota
end
sleep 2.seconds
voice.play \"vm-goodbye\"
No hay que pasarse
• Web vs Mobile web vs Voz
• ej: 466453.com
Telegraph con AMI
$ script/generate ami_model AMIModel
# environment.rb (user y password en manager.conf):
Telegraph::AMIManager.establish_connection!(
:host=> 'your.host.name.com',
:username=>'user',
:secret=>'password')
$ script/ami_server
# usar así:
AMIModel.create(:call, :channel=>'SIP/101', :context=>'default',
:exten => 'outgoing', :priority=>1)
0 comments
Post a comment