AMI Asterisk Manager Interface Originate Action

人走茶凉 提交于 2019-12-08 07:08:54

问题


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:


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.



来源:https://stackoverflow.com/questions/7933833/ami-asterisk-manager-interface-originate-action

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!