To make a outgoing call from other Application(JAVA) I have to use Manager AMI right?I can’t use AGi?I am making a dynamic IVR . This(below) is what I am doing.
My java search database,get a "phone number and filelocation of song ".
Now I want to call that phone number and play the song;
How to pass infromation (phone number and address where the song is) to asterisk dynamically?
Like we have in AGI a streamFile(filename) option where I can choose what to play,what option do I have in AMI to set what to play in dialplan?
I can pass a phone number as an extension which matches the pattern as shown below
[outgoing-call]
exten=>_XXXXXXXXXX,1,Dial(dahdi/g0/${EXTEN})
same=>n,Playback(filename) //This is the issue.How should I pass filename from managerAMI?
same=>n,Hangup();
You don’t understand how Dial works and which channel Playback acts on. The Playback will only happen after the Dial fails and will be played to the channel running the dialplan, not to the one called. The whole through connection runs within the Dial application.
I think you have a lot more reading to do (e.g. see asteriskdocs.org/) and you need to read up on call files and the Originate manager action.
You may not need to use Dial at all for this application.
If you are using analogue FXO modules, make sure that the service provider provides answer supervision and that dahdi is configured to use it.
Also, make sure that you have performing rights clearance for the “songs” you are going to play.
Hii david,
pardon my ignorance.I am new to asterisk.Actually I am creating a medicine Reminder for patients where I have to call patient and play his medicine information.Medicine information are different for different patient and hence the voicefile.
I modified the question a bit.I am using Asterisk-Java.
Suppose I have to call 01234567 and play a song. originateAction = new OriginateAction();
originateAction.setChannel("dahdi/g0/01234567");
originateAction.setContext("medicine");
originateAction.setExten("s");
originateAction.setPriority(1);
originateAction.setTimeout(30000l);
originateAction.setAsync(true);
Extension number, or channel variable, or use the application form of Originate (although, in practice, you will want to confirm that you are talking to someone before starting the announcement). (You could even use priority, although that would be strange.)
Note that “song” is the wrong word. It doesn’t mean recording, even if it is now almost used in that sense in relation to recordings of singing.
Also note that neither Answer nor Hangup do anything useful. With Originate, the call is already answered before the dialplan starts and simply dropping off the end of the dialplan will cause a hangup.
yes,its working..But now how to pass the variable
Can I set variable of the channel using ami and while agi is called can i get it those variables
JAVA CODE: originateAction = new OriginateAction();
originateAction.setChannel("dahdi/g0/01234567");
originateAction.setContext("medicine");
originateAction.setExten("s");
originateAction.setPriority(1);
originateAction.setTimeout(30000l);
originateAction.setAsync(true);
// Here I want to send some values maybe 3 or 4.
Extensions.conf
[medicine]
exten => s,1,Answer()
exten => s,n,AGI(agi://127.0.0.1/hello.agi) //How will I send the values to my AGI?
exten => s,n,Hangup()
AGI
public void service(AgiRequest request, AgiChannel channel)
throws AgiException
{
// How to obtain the variable value??
}
AGI 101?
Maybe you dont have knowledge about asterisk-java but with reference to
only agi and ami can i set a variable in a channel through ami and get it back in agi?
101 is a reference to how American Universities label their course segments. 101 is the very first segment. It means that the question is too easy to justify asking someone who is not being paid to support you.
I don’t see the need to get back to AMI for this. You can just add variables to the OriginateAction:
originateAction = new OriginateAction();
originateAction.setChannel("dahdi/g0/01234567");
originateAction.setContext("medicine");
originateAction.setExten("s");
originateAction.setPriority(1);
originateAction.setTimeout(30000l);
originateAction.setAsync(true);
originateAction.setVariable("announcement",<filename>);
The variable is used in your dialplan like this: