0
votes


I'm writing simple popup application integrated with Asterisk server. Our test environment is based on FreePBX where we've configured a few SIP trunks. The test is between two extensions 3000 and 3001.

3000, 3001 and other extensions are controlled by SIP client (microsip) for test purposes, later they may become some other sip clients or softphones.

What I need is once someone calls extension 3000, an operator was able to answer the call using regular SIP client, while my application would show some information about the call. I was able to achieve that using AMI. Now I want a button in my application that would allow me to put the call on Hold. I know, that AMI doesn't expose such feature, so I'm trying to use Async AGI. (btw I'm using asternet to communicate with asterisk)

AgiAction agi = new AgiAction(channel, "MusicOnHold");
ManagerResponse resp = manager.SendAction(agi);

Once I've done that I've got a reply

Failed to add AGI command to channel SIP/3000-00000003 queue

I wonder what that means?

Also I've been trying to start "MusicOnHold" command via CLI, and I've got a response

Channel XXXXX is not controlled by AGI"

I did try to add something like that into the dialplan (extensions.conf):

[default]
exten => 3000,1,NoOp(Async AGI)
same => n,AGI(agi:async)

that would remove "Channel XXXXX is not controlled by AGI" error, but still leave the "Failed to add AGI command to channel SIP/3000-00000003 queue" error. And what is worst, once I've got this dial plan, my sip client stopped receiving calls, though AMI was still able to capture that.

I wonder what is correct way to achieve what I want? I'm completely new to asterisk, and maybe I'm missing basic concepts, so I would really appreciate good example. Thank you.

1

1 Answers

0
votes

Async agi is way for channel be controlled via AMI requests, not AGI.

I am unsure what do asternet code you send, consult asternet documentation

Also note, you have no way put on hold call which already in asyncagi(already onhold!!!),unless you stopped hold by some other action