Hi All,I'm taking my first steps in Adhearsion, mainly due to the fact that I've been a fair PHP Supporter (I still love PHP).I've managed to run into an interesting issue, which I'll detail below:1. Adding a SIP header using the adhearsion-asterisk sip_add_header function, then issuing a dial method, doesn't
seem to generate a SIP INVITE with the new headers.2. When I do the above using execute - seems to be working correctly.3. Another thing that is odd, if I add options to dial method, like :for 30.seconds, ruby fails on 'seconds' claiming it has
no idea what to do with it.Am I missing some kind of operational construct here? I suspect 1 and 2 relate directly to the fact that
Adhearsion dial is done asynchronously from the first call, thus, anything creating on the first channel,
doesn't have a direct relation to the next channel in line.
Also, in regards to number 3, if I remove the 'seconds' indicator, the function works just as expected - however, it would seem
that the documentation is a little off-base.
Can any shed some light on the matter?
--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adhearsion+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Il giorno 12 mar 2017, alle ore 09:51, Ben Langfeld <b...@langfeld.co.uk> ha scritto:
3. Another thing that is odd, if I add options to dial method, like :for 30.seconds, ruby fails on 'seconds' claiming it has
no idea what to do with it.
Also, in regards to number 3, if I remove the 'seconds' indicator, the function works just as expected - however, it would seem
that the documentation is a little off-base.Indeed, the documentation was probably not updated correctly when ActiveSupport (which implements .seconds amongst a million other things) was removed as a dependency because of its weight.If anyone could submit a patch for the documentation, that would be lovely.
In a project I am working with now, we do need to manipulate with sip invite. I have to use execute command
I will post my dial controller version later, on mobile now
def dial_destination(destination) # this part, that can be processed by adhearsion natively: # dial "SIP/foo", headers: { "X-my-header" => "something" } if destination.sip_headers destination.sip_headers.each_pair do |header, content| execute "SIPAddHeader #{header}:#{content}" end end # Set SIP other SIP invite options # those options can't be set with Adhearsion and I have to use execute command %w(sip_uri_options fromdomain codec codec_inbound codec_outbound).each do |opt| if opt == 'sip_uri_options' && destination.sip_uri_options options = destination.sip_uri_options.map { |option_name, option_value| "#{option_name}=#{option_value}" }.join(';') set_variable '__SIP_URI_OPTIONS', options elsif opt == 'fromdomain' && destination.fromdomain set_variable '__SIPFROMDOMAIN', destination.fromdomain else # set_variable '__SIP_CODEC', 'ulaw' # set_variable '__SIP_CODEC_INBOUND', 'gsm' # set_variable '__SIP_CODEC_OUTBOUND', 'alaw' if data = destination[opt] set_variable "__SIP_#{opt.upcase}", data end end end # construct dial string dialstring = if destination.fromhost if destination.outboundproxy number, host = destination.to.split('@') # system is fully dynamic and managed through API, we don't have SIP trunks, so here we do create # MySQL database record with trunk definition and it's SIP outboundproxy, so Asterisk will send call # to the right destination through correct provider. sp = Sippeer.build host: host, outboundproxy: destination.outboundproxy, fromdomain: destination.fromdomain logger.info "Dialing number #{number} at host #{host} through outboundproxy #{destination.outboundproxy} and fromdomain #{destination.fromdomain}. Sippeer used: #{sp.inspect}" "SIP/#{number}@#{sp.name}!#{number}@#{destination.fromhost},#{duration}" else "SIP/#{destination.to}!#{destination.to.split('@').first}@#{destination.fromhost},#{duration}" end else "SIP/#{destination.to},#{duration}" end logger.info "#{self.class}: dialstring with arguments: #{dialstring}" execute "Dial #{dialstring}" end