我正在使用'asterisk-ari'宝石来构建一个停滞应用程序,该应用程序连接到星号服务器以进行通话,这对于通常的呼叫来说非常有效。
但是当我从A - >的PRI线路打电话时B其中B是无效移动设备,A仅获得ringing
音调。所以A不知道B的不是无效的事实。在星号或停滞应用程序中是否有任何方法可以检测到错误的号码/忙号并通过自定义拨号音或直接从提供商处通知A?
这是我处理两个频道事件的代码
def handle_channel_events(in_channel, out_channel)
bridge = nil
channels = [out_channel, in_channel]
channels.each do |channel|
channel.on :stasis_end do |e|
AriEvent.exec_callback(:hangup, in_channel.caller.number, in_channel.dialplan.exten, in_channel) if channel == in_channel
AriEvent.log("Channel #{e.channel.name} left Stasis.")
AriEvent.hangup(channels, bridge)
end
end
out_channel.on :stasis_start do |e|
in_channel.answer
AriEvent.log('****** Inside OutGoing channel ******')
AriEvent.exec_callback(:answer, in_channel.caller.number, in_channel.dialplan.exten, in_channel)
bridge = AriEvent.client.bridges.create(type: 'mixing')
bridge.add_channel(channel: "#{in_channel.id},#{out_channel.id}")
#bridge.start_moh()
end
out_channel.on :channel_destroyed do |e|
begin
puts e.cause
puts e.cause_txt, bridge.inspect
AriEvent.log('****** OutGoing channel destroyed ******')
in_channel.hangup(reason: "busy")
rescue => e
puts e.inspect
puts e.backtrace
end
end
end
有人遇到过类似的问题吗?