Asterisk issabel auto park - asterisk

I'm trying to connect my issabel Asterisk with my custom CRM. I want my agents to be able to monitor the incoming calls using AMI events and use AMI commands to redirect any call from the list to there phone devices. I'm able to get all the information from AMI.
Now I use custom extension on inbound routes to dial 700 extension and inbound calls goes to parking lots. My only problem is that Asterisk says to caller the parking lot id.
Any other way to auto park this calls without parking lot announcement?

You can create simple patch for main/parking.c which will issue UserEvent with needed info. Should not be very complex 2-3hr of work for C/C++ expert.
Other option is use Stasis app or dialplan with hold for make parking-like behavour. Or just send user to empty conference and record it's ID.

Related

Get the list of all subscribers as well as the namespace they are listening to for monitoring purposes

I need to create a web UI for a client company to allow them to monitor which subscribers (Microservices) are up and if they are part of a worker queue, how many of them are running.
Although this is easy to implement by keeping sending a signal to another instance of NATS (to minimize overheads) for monitoring, I would like to ask if there is any built-in feature that can provide this functionality.
This link suggests that there is a monitoring endpoint built-in but I am not sure if I can get what I need out of it. So do I have to start inventing the wheel, or is there something that can be used out of the box?

Asterisk integration with custom ERP

One of our customers has an Asterisk phone center and want to integrate it with our ERP. The idea is that Asterisk calls an Oracle database procedure when a phone call is transferred to an extension. This Oracle procedure has 2 parameters, incoming phone number and destination extension.
Is it possible to do this with Asterisk API? Where can I find documentation or examples to do it?
I have read official Asterisk API documentation but don't understand how it works and where can I begin to search...
There are no documentation for "just integrate with ERP".
You can use ARI events or AMI events or CEL to make integrations. It will be highly depend of dialplan used
There are probably a dozen ways to do this using the various Asterisk subsystems, such as ARI and AMI, but one of the simplest might be to make a network call embedded in the dialplan.
There are several examples of how this might be done at https://www.voip-info.org/asterisk-call-notification/ ; for example, look at the description for YAC on that page, which shows how to make the call using netcat.
That method uses the System Application. Do be careful not to pass unfiltered text from e.g. the Caller ID information to the system, as someone might inject malicious code into the Caller ID.

How to get all dialer events from Asterisk REST API (ARI)?

I'm making a web application which should be able to monitor calls on my Asterisk server. I can connect to ARI with Javascript WebSocket on URL ws://(host):8088/ari/events?app=dialer and it works. The problem is that I only get events from calls that are made over ARI. Calls made from other clients like Zoiper are not registered. On the other hand, Asterisk has AJAM which uses long polling on http://(host):8088/rawman?action=waitevent and it registers calls from all the clients, (ARI, Zoiper and others) but there's only information who is calling (caller), not whom (callee).
So, my question is, how can I get real time call events that show who is calling who, from all the clients, (preferably) with WebSockets. Thanks.
ARI uses a subscription based model for events. Quoting from the documentation on the wiki:
Resources in Asterisk do not, by default, send events about themselves to a connected ARI application. In order to get events about resources, one of three things must occur:
The resource must be a channel that entered into a Stasis dialplan application. A subscription is implicitly created in this case. The
subscription is implicitly destroyed when the channel leaves the
Stasis dialplan application.
While a channel is in a Stasis dialplan application, the channel may interact with other resources - such as a bridge. While channels
interact with the resource, a subscription is made to that resource.
When no more channels in a Stasis dialplan application are interacting
with the resource, the implicit subscription is destroyed.
At any time, an ARI application may make a subscription to a resource in Asterisk through application operations. While that
resource exists, the ARI application owns the subscription.
So, the reason you get events about a channel over your ARI WebSocket is because it went into the Stasis dialplan application. That isn't, however, the only way to get events.
If you're interested in events from other event sources, you can subscribe to those resources using the applications resource. For example, if I wanted to receive all events that were in relation to PJSIP endpoint "Alice", I would subscribe using the following:
POST https://localhost:8080/ari/applications/my_app/subscription?eventSource=endpoint:PJSIP%2FAlice
Note that subscriptions to endpoints implicitly subscribe you to all channels that are created for that endpoint. If you want to subscribe to all endpoints of a particular technology, you can also subscribe to the resource itself:
POST https://localhost:8080/ari/applications/my_app/subscription?eventSource=endpoint:PJSIP
ws://(host):8088/ari/events?app=dialer&subscibeAll=true
Adding SubscribeAll=true make what you want =)
May be help someone:
Subscribe to all events on channels, bridge and endpoints
POST http://localhost:8088/ari/applications/appName/subscription?api_key=user:password&eventSource=channel:,bridge:,endpoint:
Unsubscribe
DELETE http://localhost:8088/ari/applications/appName/subscription?api_key=user:password&eventSource=channel:__AST_CHANNEL_ALL_TOPIC,bridge:__AST_BRIDGE_ALL_TOPIC,endpoint:__AST_ENDPOINT_ALL_TOPIC
For more clarity regarding what Matt Jordan has already provided, here's an example of doing what he suggests with ari-py:
import ari
import logging
logging.basicConfig(level=logging.ERROR)
client = ari.connect('http://localhost:8088', 'username', 'password')
postRequest=client.applications.subscribe(applicationName=["NameOfAppThatWillReapThisEvent-ThisAppShouldBeRunning"], eventSource="endpoint:PJSIP/alice")
print postRequest

asterisk send event to a web app when the phone ring

I have a hardphone that register to asterisk 11.8. When someone call this phone, information about user input ivr and user phone number is inside asterisk, is it possible to expose these information to the outside app. For example, I have a webapp, that when the user type in the account number via ivr, the web app, can pull this information back to display the user information. I am a bit new to asterisk and was previously use Freeswitch.
I start reading something about Asterisk AMI, that there are manager event that sending from asterisk to AMI client. So can it be like this. When the phone rang, there will be an event that send to me web app, this event contain information about the phone number of the caller, and what he/she type in for IVR? Can AMI do something like that? I check asterisk AMI event documentation https://wiki.asterisk.org/wiki/display/AST/AMI+Event+Documentation, but I dont see any event like "calling"
Please guide me, you can just provide me high level general information and I can start looking further. THank you
Yes. Asterisk does store that kind of information - the incoming number, the duration of the call etc. It is present in the form of a csv file that can be accessed at:
/var/log/asterisk/cdr-*
You can write code to access these logs and get needed information about them.
EDIT to answer comment:
While I am not sure if this information is stored after a call is disconnected, you can write a dialplan to get what you are doing. As soon as a call is received on the extension, the dialplan should:
- Get the incoming call number and send that to a webapp. I think this should be very easy.

call phone by clicking on number in web

Im newbie from asterisk but professional in PHP programming!, so
I want to call mobile number in my users panel in web. exactly when user click on a number, connect to asterisk and call selected mobile number via specified internal extension.
is there any solution? I don't know about using any softphone or not. I don't want to use any client softphone if possible.
edit:
I used some php code with AMI and shift8, but my problem is when user calling and how can user talk with another without softphone?
You can use various API's to place a phone call. As you already learned about the AMI you might find http://code.google.com/p/asterisk-php-api/ helpful.
Regarding your phone question: placing a phone call using the AMI Originate Action will first ring the extension's associated phone and when you take of the hook, asterisk will dial the target number. Therefore it's not importent which kind of phone (hard- or softphone, brand, ...) you're using. As long as the phone is registered in asterisk and bound to a certain extension it'll work.
If I understand correctly, the doddle web phone or webrtc may be an example of what your looking for.

Resources