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.
Related
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.
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.
I wrote a piece of code which sends messages to a Telegram bot. In order to do so, I use the chat_id of the last conversation retrieved via the getUpdates method.
id = requests.get(f"https://api.telegram.org/bot{token}/getUpdates").json()['result'][-1]['message']['chat']['id']
My understanding is that the a conversation exists if someone started one with the bot via /start.
How can I initiate, from my code, a conversation to make sure a chat_id is available? (= that there is a conversion I can query).
I am also sure that the conversations, should they exist, are not kept indefinitely (this is another reason why requesting an update can yield empty results)
My understanding is that the a conversation exists if someone started one with the bot via /start.
Yes, conversation is always initiated by a user:
Bots can't initiate conversations with users. A user must either add them to a group or send them a message first. People can use telegram.me/ links or username search to find your bot.
Note that /start is not the only option here.
If you try to send a message for user, who didn't start conversation with bot, you will receive something like this: {"ok":false,"error_code":400,"description":"Bad Request: chat not found"}.
How can I initiate, from my code, a conversation to make sure a chat_id is available? (= that there is a conversion I can query).
Normally, you shouldn't worry about that. Bot does not query specific user actions/requests with getUpdates, it queries all interactions from all users and then decides what to do according to internal logic you provide.
You may want to store information about users and/or their requests in a database every time you receive an Update from particular user in getUpdates.
Based on that, bot can make a decision to send for example, a message to him.
I am also sure that the conversations, should they exist, are not kept indefinitely (this is another reason why requesting an update can yield empty results)
Yes, docs clearly state that
Incoming updates are stored on the server until the bot receives them either way, but they will not be kept longer than 24 hours.
An Update on a Telegram servers is an entity with a short life period.
If you haven't saved information about existing users, or lost a database, there's no way to retrieve that data from telegram servers.
P.S.: as a side note, I'd suggest using long polling, as Telegram Bot API is designed to be used with long polling if you're using getUpdates. The most important thing is the timeout request parameter of getUpdates method:
(timeout is) Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.
As written in question, you're using short polling.
I am trying to use the SFB UWCA API to start a conversation to create a click-to-call experience on an internal web app. The workflow look like the following:
Click on phone number on web app and make callback to server to execute API code on the server.
Make request to UCWA API to using the startPhoneAudio resource with the following attributes: phoneNumber = tel:+1205xxxxxxx, to = tel:+1205xxxxxxx along with a few other attributes.
UCWA then starts dials the number supplied in the phoneNumber property. After the user picks up the phone the outbound call is started.
Here is where I am having an issue. I have been playing around with some sample projects linked below to test some flows. Using the callviaphone codeplex project I have am able to use the startPhoneAudio to start a call.
Basically when using the UCWA resource startPhoneAudio, it will not work when the phoneNumber property is set to an internal SFB number assigned to an enterprise voice user. If you put in any external number for the phoneNumber property (i.e.: cell phone) startPhoneAudio will work. It will call you and when you pick it will dial the number supplied in the "to" property of the startPhoneAudio resource. Here is the crazy part, the number used for the "t" property can actually be a one of your internal numbers associated with you SFB topology.
With the referenced callviawork project, when our use your internal SFB number in the phoneNumber property it will start the conversation, but when you pickup your desk phone assigned to your SFB account the call disconnects.
I am trying to figure out why the call just disconnects. It only disconnects when you use the internal phone numbers assigned to SFB users. I know that the startPhoneAudio was made to support the call-via-work option inside of SFB. This allows you to utilize your existing legacy PBX. However, I don't understand why the call disconnects once the user picks up there phone.
http://callviaphone.codeplex.com/
Here is an old question that was never answered, but hopefully we can figure out what is going on this time.
Initiating a phone call using UCWA
I think it does not work for the same reason why you cannot call yourself with Skype for Business.
It does not matter whether you try to call your own SIP URI or your landline number associated with your SIP URI. This is exactly what happens in your scenario - you as a user are calling your own PSTN phone number in the first call leg before you start the second leg to the second number. Skype for Business does a reverse number lookup of your Skype for Business PSTN number and tries to call your SIP URI which is not a valid case for a successful call.
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.