benchpresser
benchpresser

Reputation: 2188

Answer call using asterix (AMI/AGI or anything else)

I am using asterisk to communicate with the PBX and want to answer the incoming call BUT, what I need is:

Example extensions.conf line

exten => 102,1,Agi(agi://192.168.0.X/answer.agi)

fastagi.properties:

answer.agi = org.asteriskjava.examples.fastagi.ExampleCallIn

ExampleCallIn:

public class ExampleCallIn extends BaseAgiScript {
  public void service(AgiRequest request, AgiChannel channel) throws AgiException {
   answer();

I start a call from 101, by telephone device or by software (dial), the service method is triggered and answer invoked, on the telephone 101 I see it enters the talking state because of answer call, but on the 102 (telephone device) nothing happens, it is still ringing (inbound call from 101).

Upvotes: 3

Views: 1401

Answers (1)

arheops
arheops

Reputation: 15259

To answer call which not go other leg via AGI you just need do something like

  print "ANSWER\n"

in any language on your choice.

However if you are already requested call to other leg B, things become much more complex. You need work with destination phone's firmware or you can

1) setup on destination phone autoanswer or mark your call as intercom call

https://www.voip-info.org/wiki/view/Asterisk+Paging+and+Intercom

at this moment when call come in to destination device, it will be automaticaly answered and bridged

2) setup privacy macro https://www.voip-info.org/wiki-Asterisk+cmd+Dial#Dialmacros

3) in macro setup call external script/database whatever for confirmation of call.

That way call technicaly will be ANSWERED, but party A will think it still ringing until you confirm it, end macro with correct result.

However that require above advanced level in programming and asterisk understanding.

Upvotes: 1

Related Questions