1
votes

I am currently constructing a C#.NET wrapper for the Asterisk Interface Manager.

I can do simple things like transfers and hangups. I am now in the process of building conference calling. I can set up an n-user conference, but I have to do so in terms of "Action: redirect" on existing active channels.

What I'd like to do is route as now non-existent calls (i.e. there is no channel in "core show channels") to my context/extension that puts people in conference rooms.

But I cannot get "Action: originate" to work for anything. What does originate take a channel as an argument when there is not channel yet? What is it that you pass to the channel header? SIP/ does not work for me.

Thanks in advance.

1
I'm sorry, I misread your post. You are writing a new wrapper to the AMI. My first recommendation is, DON'T DO THAT. My second recommendation is that unless you truly understand the issues with using a singular telnet server for all message passing (all clients receive all messages, and pre-connect sometimes cannot discern between the clients), and understand how it was implemented, is again, DON'T DO THAT. Use a fairly well-tested and well-understood library and don't try to re-invent the wheel. - gnxtech3
Thanks. The application is fairly simple and there is no events processing going on, so the traffic into and out of the AMI client application really isn't that bad. - kmarks2

1 Answers

3
votes

What exactly are you trying to do? You can't use a non-existent channel to bridge into a conference room. If you're looking to create a conference, then have people called on their extensions (or on any number, really) and placed into the conference room, that's simple.

I assume you're using Asterisk.NET. The originate command expects a number to dial (this is the channel), a context, and an extension to connect the call to within the dialplan (this can be hard-coded or can presumably be created through the AMI).

Say you set up a conference room on extension 300. Your originate command would look something like this:

OriginateAction oc = new OriginateAction();
oc.Context = "YourDialPlanContext";
oc.Priority = 1;

// Channel is however you're dialing (extensions, SIP, DAHDI, etc.)
oc.Channel = "SIP/12125551212@Your-Sip-Prover-Peer-Name"; 
// or in the alternative
// oc.Channel = "ZAP/ZapChannelName/12125551212";

oc.CallerId = "9998887777";

// This is the extension you want dialed once the call is connected
// 300 in our example
oc.Exten = "300";
oc.Timeout = 60000;               // Our timeout in ms
oc.Variable = "VAR1=ABC|VAR2=25"; // If you need to pass variables to the dialplan

// Async should be set to true, unless you want your code to wait until the call
// is complete
oc.Async = true;         

// Go ahead and place the call
ManagerResponse originateResponse = AsteriskManager.SendAction(oc, oc.Timeout);

Voila! You have now originated a call to your intended conference participant, and upon answering they will be directed into your conference room.