Originate call using adhearsion
-
25-09-2019 - |
Question
i have searched google, tried to read adhearsion docs and make sense of the examples. i understand parts of it but am not able to put it together. i can edit extensions.conf and do agi(agi://localhost) and handle incoming calls in the dialplan.rb. i have written an ivr that way which is in use in the real world.
i have edited manager.conf and config/setup.rb and when i do ahn - i see
INFO ami: Successful AMI actions-only connection into ...@127.0.0.1
INFO ami: Successful AMI events-only connection into ...@127.0.0.1
now what i want to know is very specifically the following:
- where and how do i write code that executes when the adhearsion app starts. i.e. without any event or agi call.
- what exactly do i write to dial out.
please dont give me partial responses like
methods_for :dialplan
sub foo
# stuff here
end
please dont give me vague responses like "create component and fork it to the left", or something... i have been reading stuff like that, and i am not able get it. please tell me specific steps.
Solution
Your google foo is quite obviously sub par
Use the 'after_initialized' event namespace for 1
When do you want to dial out? You need to look at either "dial" in the dialplan, or "originate" elsewhere.
OTHER TIPS
extensions.conf
[context]
exten => extension_number,1,Noop()
exten => extension_number,n,AGI(agi://localhost)
in adhearsion project directory.
dialplan.rb
context {
#your code goes here.
dial "SIP/xxxxx"
dial "SIP/xxxxx"
}
for methods:
your_ahn_directory/components/component_name/lib/component_name.rb
methods_for :dialplan do
def sum(n1,n2)
n1+n2
end
end