Is it possible to track a call backwards beyond the last PBX? - asterisk

We receive international calls into an Asterisk server (13.20) where some of the calls are automated, meaning there is no person involved, sort of M2M.
It is important for us to know where those automated call are coming from. Since it is easy to generate a call with faked ID we want to strengthen the authentication by identifying the original network from where the call was made.
When looking at the Asterisk logs I can see that a call came from Twilio for example, but that's it, no more tracking information.
My question:
Is it possible to track a call backwards beyond the last PBX who transferred the call to my server?

Some operators send some tracking in sip headers
For see more info, check sip debug.
asterisk -r
sip set debug on
However most of operators not provide for clients info about path of calls, some even not store it for internal use.

Related

Simulring with Voicemails

I've got a basic twilio setup using studio for a simple IVR (like less than 20 minute setup kind of simple).
One thing I'm doing is using simulring to hit multiple parties and whoever answers. The issue I'm having is that if there is a voicemail to be hit, it appears to be ok with that and then plays the endpoints custom voicemail.
That's not really good with our setup.
Do you guys know how I can trigger the calls to multiple phones, detect a real person and then transfer the call, otherwise trigger a voicemail?
I can't imagine this is unique.
Twilio developer evangelist here.
There are two options you can use here, either call screening/human detection, in which you ask the person answering the phone to, for example, dial 1. A voicemail won't do this and you can leave a message or hang up, a human will dial the number and you can then take them on to the rest of the call. Or there is answering machine detection (AMD). When making an outbound call with AMD, once detected Twilio will make the webhook callback with a parameter that describes whether the call was answered by a human or a machine.
I recommend reading this article on both options, which should help you to understand what will work best for your use-case.

use webservice in same project or handle it with code?

This is a theoretical question.
imagine an aspnet website. by clicking a button site sends mail.now:
I can send mail async with code
I can send mail using QueueBackgroundWorkItem
I can call a ONEWAY webservice located in same website
I can call a ONEWAY webservice located in ANOTHER website (or another subdomain)
none of above solutions wait for mail operation to be completed.so they are fine.
my question is why I should use service solution instead of other solutions. is there an advantage ?
4th solution adds additional tcpip traffic to use service its not efficient right ?
if so, using service under same web site (3rd solution) also generates additional traffic. is that correct ?
I need to understand why people using services under same website ? Is there any reason besides make something available to ajax calls ?
any information would be great. I really need to get opinions.
best
The most appropriate architecture will depend on several factors:
the volume of emails that needs to be sent
the need to reuse the email sending capability beyond the use case described
the simplicity of implementation, deployment, and maintenance of the code
Separating out the sending of emails in a service either in the same or another web application will make it available to other applications and from client side code. It also adds some complexity to the code calling the service as it will need to deal with the case when the service is not available and handle errors that may occur when placing the call.
Using a separate web application for the service is useful if the volume of emails sent is really large as it allows to offload the work to one or servers if needed. Given the use case given (user clicks on a button), this seems rather unlikely, unless the web site will have really large traffic. Creating a separate web application adds significant development, deployment and maintenance work, initially and over time.
Unless the volume of emails to be sent is really large (millions per day) or there is a need to reuse the email capability in other systems, creating the email sending function within the same web application (first two options listed in the question) is almost certainly the best way to go. It will result in the least amount of initial work, is easy to deploy, and (perhaps most importantly) will be the easiest to maintain.
An important concern to pay significant attention to when implementing an email sending function is the issue of robustness. Robustness can be achieved with any of the possible architectures and is somewhat of an different concern as the one emphasized by the question. However, it is important to consider the proper course of action needed if (1) the receiving SMTP refuses the take the message (e.g., mailbox full; non-existent account; rejection as spam) and (2) an NDR is generated after the message is sent (e.g., rejection as spam). Depending on the kind of email sent, it may be OK to ignore these errors or some corrective action may be needed (e.g., retry sending, alert the user at the origination of the emails, ...)

asterisk get credit card info

I`m trying to build a script that will capture the credit card info like card number,cvc and expiration date using asterisk 11.x and asterisk-java library for AMI/AGI integration.
Right now I am able to build a script that will acquire that info if it is called via dialplan but i have a different scenario:
1. A call enters a queue.
2. An agent from the specific queue answer the call
3. The caller wants to input the card details
4. After the caller has entered the card details is redirected back to agent to continue the call.
My specific problem is related to step 3 as I do not know how to route the caller to my AGI and then back to the same agent. (eventually the agents has to be still involved in (some) call to guarantee that when the caller returns from agi it is still available)
Any idea how can I achieve that ? I know that this is a common practice so I think that there has to be a way.
When the call is delivered to the agent, use a macro to set a custom channel variable with the agent ID or extension in it.
Then, when your credit-card authentication function is done, read the variable and use an AGI command to transfer the call back to the agent.
Further Reading
http://www.voip-info.org/wiki/view/Asterisk+variables
http://www.voip-info.org/wiki/view/Asterisk+manager+Example:+Transfer
Note if this solution solves your problem, please 'accept' it to make it easier for others with the same issue to find it. thanks!
There are no any common practice for business process like you have. That depend of you and your client only.
You can use features conf or transfer. Can transfer to special extension or to conference room.
No way say what suite you better.
For sure you need understand how asterisk work before write any AGI/AMI or dialplan application. I can recommend ORelly's "Asterisk the future of telephony" book as start point.

Twilio and queues

Is there a way with Twilio to:
have a customer call in and be placed in a hold queue
Twilio would then dial our CSR's telephone numbers sequentially (or all at once)
Connect whichever CSR answered to the customer
I can get the system to answer the phone, place the caller into a queue, but then dialing the CSR and then connecting the CSR to the caller is where I am stuck.
I can get the system to answer, play a message, and then dial a sequence of CSR numbers, but that is it.
BTW: I am using classic ASP, not that it really matters.
Twilio evangelist here.
To make Twilio dial out to your CSR's you're going to need to use the REST API, specifically POSTing to the Calls endpoint. Check out the docs for making calls.
In order to know if the CSR did not answer and you need to call another, you can use the StatusCallback parameter. This lets you specify a URL that Twilio will request when the call ends, letting you know why it ended. If the CSR does not answer then you can find that out in the StatusCallback request by checking the Status parameter and start a call to another CSR.
You could also start a bunch of outbound calls to a bunch of CSR's at the same time. If you do this you would need to track all of the calls (I'd just store each calls CallSid somewhere) and then when the call starts use the <Gather> verb to have the CSR indicate they want to accept the customers call. You would then just hangup on all of the other in-progress outbound calls and <Dial> that CSR into the Queue which would connect them to the customer.
Hope that helps.

Asterisk Web API to calculate Wait Times

I would like to know if there is a web api for asterisk. I would also like to know if the average wait time to talk to a customer service agent is exposed through the api.
I have looked around online, but could not get an firm answer.
Any pointers are appreciated.
AFAIK, no, there is no such thing in Asterisk.
What does exist is the ability of parsing the queue_log file. You can get the moment the call started, the moment the call was answered by an agent, and subtract them - this will give you the wait time. Also, the first extra data value of the CONNECT event contains the time waited.
(If you are not in the mood for parsing a text file, you can register the queue logs in the database and use SQL to generate reports based on the logs. This is in fact my preferred approach.)
If you want to provide this information to other apps, you can write your own application which reads queue_log file/table and provides a webservice which returns wait times. In the case you decide to do it, we can try some more robust answers.

Resources