Skip to content

Instantly share code, notes, and snippets.

@wwalker
Created September 1, 2009 12:54
Show Gist options
  • Save wwalker/179089 to your computer and use it in GitHub Desktop.
Save wwalker/179089 to your computer and use it in GitHub Desktop.
I need to set in_progress (an attr on an ActiveRecord object) to false
when the call is done. Every bit of my code works fine, except...
When the party hangs up before my logic is finished finish_call is never called.
I have set these in startup.rb:
config.end_call_on_hangup = false
config.end_call_on_error = false
Yet, even the finish_call in the rescue is never called...
I can't do events, because I use async originate and have no tie between
my call variables and the Uniqueid in the events. I've manually telnetted
to the manager interface and pasted what adhearsion sends to the manager
and looked at what comes back from asterisk. There is no tie in between
the ActionID we send and the Uniqueid sent later in the event stream.
Anyone see what I am doing wrong?
I have a dialplan.rb that looks like this. NDA prevents showing real code.
my_context_name {
minor_stuff
that_never_raises
begin
if this
a
b
c
d
finish_call(mdr)
return
else
e
if that
f
finish_call(mdr)
else
g
finish_call(mdr)
end
end
rescue => e
ahn_log.error e.message
ahn_log.error e.backtrace.join("\n")
finish_call(mdr)
return
end
}
# in helpers (old project, but uses 0.8.3)
def finish_call(mdr)
mdr.in_progress
mdr.save
other_less_important_stuff
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment