I'm getting started with Asterisk and I have to develop an app that will only be used to call people (an alarm system).
I'm using Java and Asterisk-Java, and I read that on their GitHub:
Did you know you can originate directly into AGI? This is really powerful and eliminates the need for dialplan when doing AGI.
So, if I get it properly, that means I can do without a dialplan.
Though, I can't get Asterisk-Java to work properly, but I don't know it is because I have no dial plan or for some other reason.
Thanks
Yes, you need dialplan for anything except outgoing calling(initiated from asterisk side).
If you using only Originate and not need hangup handlers, caller id etc etc you can go without dialplan.
But in most cases it will be really tricky and usless.
Related
I have a working system that controls a Cisco CUCM IP-PBX to set up and tear down a call between two parties A and B; it makes use of Java's JTAPI to:
make A call B
make B answer (pick up)
(wait for a few seconds)
make either A or B drop the call
Now I want to do the same with an Asterisk PBX (version 13.17.0). From what I have gathered, Asterisks JTAPI implementation doesn't work for recent Asterisks; the latest version that I can find, dates from 2006 and it seems to try and send AMI commands to which Asterisk replies something along the lines of "no such command" - I'm guessing the AMI syntax has changed over the years.
What I'm using now is a library called asterisk-java and more specifically, its AMI support. I'm sending an OriginateAction and the net effect is that:
Asterisk calls A
I have to pick up A's phone manually
A calls B
I have to pick up B's phone manually
finally a call is established between A and B
So instead of a fully automated process like in the Cisco case, I have to do manual work and I can't seem to find an API to just set up a call between A and B and having it drop after a couple of seconds.
Questions: is the AMI the correct API for my use case or is there a better alternative? And what API calls do I have to make to establish and drop a call?
Thanks,
Jan
Does this answered question help with establishing a call without picking up:
Originate a call with Asterisk - without the originating extension ringing
To have a channel drop a call, using AMI, you can use 'BridgeKick' to boot a channel, or 'BridgeDestroy' to cause each channel to 'BridgeLeave':
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+ManagerAction_BridgeKick
Interesting issue I have never run into before with Asterisk.
Using Asterisk 1.8.x (please don't tell me to upgrade, it's not possible at this time).
When someone dial direct into the system to any of the numbers, we Answer, then push them to a queue and either play MOH on Ring sound.
This has always worked fine and still does. Most people forward calls to our numbers from their business line/phone system.
For this one customer and only one customer, there is complete silence for the caller once their phone system initiates the forward to our number. Our Asterisk box answers the call, we have even tried playing sounds using Playback etc but nothing, complete silence until one of the agents answers from the queue.
Really bizarre. canreinvite=no is set so, there shouldn't be any issues with Asterisk getting optimized out.
Any ideas a really appreciated. I know it's on their end but, it would be great to find a way to make Asterisk, make the customer's phone system behave correctly LOL.
You would have to take a wireshark trace at Asterisk box and check INVITE offer and 200OK response from asterisk. Then make sure that media RTP are sent to IP address in connection information line c= and port specified on m= media line. You also should check if rtp payload (codec) match the request and answer. Asterisk probably will respond with one codec from INVITE offer. When media are sent but caller does not hear anything before an agent answer the issue is probably on caller side. Hope helped a bit to tracę the issue.
I had the same problem once, but the other way around. I was the client dialing into someone else's system using my asterisk system. I tried everything in my hand, including pestering my (E1) telephony provider to no avail.
To this day I still don't know the reason for this behaviour, but I've managed to get around by Answering the call originated from my system BEFORE dialing the PSTN, thou this is far from ideal.
Something like this:
Answer()
...
Dial(YADAYADAYADA)
I know this isn't exactly the answer to your problem, but I hope it helps in any way.
Very likly you have issues with codecs. I.e customer use some codec you have no translation module, but agent's customer have
I am trying to collect some info about the ongoing call in asterisk but during hangup I want to log which peer initiated the process of hangup. I am new to asterisk so I have no idea if its possible or not. Please help me if it can be done. I have tried to use HANGUPCAUSE_KEYS but it does not provide much information.
Actually I want to know who has released the line first? If A and B are connected with bridge and B releases I want to record that B has released the channel and vice versa.
Thanks!
I can see 2 ways.
1) Set a Hangup Handler in your dialplan (extensions.conf). Maybe it is the easiest way, but limited. WIKI: Hangup Handler
2) Use AMI and try to monitor the channels. It can be complicated, but almost limitless and powerful. WIKI: Asterisk AMI
i am setting up a DISA in asterisk .
what i would like to do is play a music to the caller while asterisk is receiving the DTMF.
the DTMF would stop playing when it receives DTMF for "#"
i have tried using background() and playback() command , but they do not serve the purpose!
any ideas?
khan
You can try using phpagi. There is a function called fastpass_get_data, where you can get dtmf input while playing a sound.
http://phpagi.sourceforge.net/phpagi22/api-docs/phpAGI/AGI.html#fastpass_get_data
I'm assuming just using the builtin DISA application doesn't meet your needs. If it does, just use that.
There are different ways to program asterisk. You can use normal dialplan, ael dialplan, AGI, AMI, even write your own modules in C.
You can do more things in dialplan, but often using a real language through AGI results in more readable code.
Using the dialplan applications StartMusicOnHold, StopMusicOnHold, and either Read or WaitExten, you should be able to do what you want. Run asterisk -rx 'core show application StartMusicOnHold', etc, to read about each of those.
You basically want to run StartMusicOnHold, then gather digits using Read or WaitExten until you're done (perhaps collecting them into a channel variable), then run StopMusicOnHold.
i am developing an application that shall allow users to access their mail boxes using their phones.
I developped an IVR menu of which users will make use to retrieve their mails. More specifically I write an AGI in perl to retrieve the mails. The issue is that the AGI execution takes quite a long time.To this end, I need to make my users hear some music played back in the background while the agi being executed. That is, i need to make the "AGI" and "MusicOnHold" applications in my dialplan execute simultaneously. Any clue how I can achieve this?
This may not be the answer you expected, but if you plan to create a proper application for doing stuff over the phone, have a look at other solutions apart from asterisk. Both yate and (as far as I know - never tried this one for anything serious) freeswitch implement a more asynchronous interface where you can connect an incoming call to whatever sound source you want without losing control over it. They may be a much better choice for advanced applications.
Asterisk is cool for simple logic, but if you need some processing in the background and leaving the call in some state for an undefined time, it becomes quite hard to manage.
You can issue SET MUSIC ON from you AGI applications, process your calculations, then issue SET MUSIC OFF.
If you want the music to be interruptable, issue this:
CONTROL STREAM FILE <filename> "0123456789*#" "0" "" "" ""
The second parameter is the list of digits able to interrupt the music.
It's better not to mix AGI and dialplan commands.
AGI is capable of everything dialplan is capable of, but AGI is implemented in a full fledged programming language and therefore gives you more control over the execution logic.
Is the complete execution taking a long time or just starting up the app? If the whole execution takes too long then you can do what Quassnoi says, start the music as soon as the AGI program starts.
If startup time is the problem, then you might need to implement something with FastAGI, so that your app is always running and listening for connections over a socket. The performance is much much better in an environment with a lot of AGI calls.