variables in extensions_custom.conf - asterisk

I am using Queues to handle incoming calls which works pretty well.
What I would like to do now is to get the info which extensions has answered a call in "sub-queue-answer" context of extensions_custom.conf to hand over this information via CURL to another - e.g. CRM-server via:
exten => s,n,Set(foo=${CURL(https://hostname/voipcr.php?device=pbx1.xxx\&agent=${???}...)})
anyone any idea which variable can be set in the spaceholder of the three ??? to hand over the extension number of the agent who has answered that call?

i usually use ${CUT(DIALEDPEERNUMBER,#,1)}

You can not do that using extensions. Queues are sending calls to users without passing through the dialplan (a queue will call a agent directly).
To access data about who answered the call (and also when that happened) you need to listen for the AgentConnect event on Asterisk Manager Interface. As you can see in the documentation, the AgentConnect event will pass a lot of properties that you can parse, to extract the information you need. Probably you want to check MemberName and Interface properties, but that is subject to your particular setup.
Queue logs / CDR will help you only if you want to send the data after the call has been completed, but, to do that, you probably need to create a pooling system (an undesirable solution, from my point of view).

Related

How to execute code before making a call on Asterisk

I have an asterisk pbx server. I’m new to asterisk, I know there are dial plans extensions groups etc.
My goal is to handle a dial event do some checks then decide whether to let the call go through or not.
I read about ARI AGI AMI and dial plan but I got confused and don’t know how to proceed.
I just want to execute code (call an API for example) when any number is dialed, and drop the call or let it through according to that.
I know if I do more research I can get something working, but honestly I don’t have time. I just need to know where to look.
So I solved it. In case anyone needs this, here's what I did.
I used AsterNET fastAGI and created my service script, which does whatever checks I need and calls HangUp() when needed, else just returns and lets the call go through.
Then I called the fastAGI script in the dial plan and it's working perfectly.

Asterisk - Quit call after 10 minutes if there's no input

I have an Asterisk server running where a lot of people will call on in the future.
Is it possible to configure the server that if the caller doesn't press a number (or * and #) on his phone for like 10 minutes it automatically hangs up?
Thanks for your help and best regards
I am not aware of any builtin functionality which would adresses your usecase.
There is the parameter L() of the Dial application which allows to limit the call duration and plays announcements before the limit is reached.
But that does not fit your usecase.
I expect you have to write a custom application which listens on the manager interface and track incoming calls and Events to hangup the channels by yourself...
You can use:
s,n,ResponseTimeout(600)
Or:
s,n,Set(TIMEOUT(response)=600)
Then add an extension to the dial plan to hang up the call:
t,1,Hangup()
You have two options.
1) use TIMEOUT(response). This one is exactly for your case, but not work for some dialplan.
2) Use TIMEOUT(absolute) and update it after any new input. This work for any dialplan, but it absolute(i.e will hangup even if you have input).
http://www.voip-info.org/wiki/view/Asterisk+func+timeout

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.

TcpCatcher: send HTTP request from hook

Is it possible, with TcpCatcher to send an HTTP request from a custom hook (a Java class)? I know the GUI let someone edit and resend any given request, but I want this process to be automatic on certain conditions (and log the results, etc.)
So, I know it's possible, but no documentation for it. I'm asking if anyone had done this, or know how to do this? I'm looking at the tcpcatcher.jar file, but many classes are named a.class, b.class, etc. So if the knowledge exists somewhere around this community, it would be great.
TcpCatcher allows you to provide your own java class and calls it when an HTTP packet goes though the proxy.
You can do anything within the hook including sending an other HTTP request (but why would you want do that by the way ?)
Here is an example of a synchronous hook (it allows you to modify the packet on the fly)
http://www.tcpcatcher.org/hook_to_change_html.php
just implement the "modifyPacket" method
If you do not intend to modify the packet on the fly, you can prefer an asynchronous hook.
Here is an example :
http://www.tcpcatcher.org/logging.php

"select" in Racket

I want to write an event loop single threaded web server to deal with each request in Racket.
I see there are select method in unix that I can call,
Is there anything similar in Racket API that I can call? or I should write my own select method which is to polling the ready fds?
Thanks in advance!
Apologies if I'm misunderstanding your question, but it sounds like you'll probably want to use tcp-listen on certain ports; success here will create input ports. In order to synchronize on multiple open input ports, check out "synchronizable events"; you can use 'sync' on a whole bunch of open ports simultaneously.
I would be remiss if I failed to add that there's a complete web server included with Racket; I'm assuming that you have your own reasons for wanting to re-implement this.

Resources