I have a calling application developed in PHP with AGI on Asterisk framework, below is the basic flow of application.
We receive a call from user at our Asterisk ss7 server and forward the same call to another user from our server.
I want to know the status of call forward to another user. Status means what happen with call between both users e.g. Hangup, Busy, Not Answered etc.
Not much detail on how you are placing the call or anything else but if you are performing a Dial() and want to know at the end of the call the result try ${DIALSTATUS}.
This will contain something like 'ANSWER', 'NOANSWER' or 'BUSY'. For the full list and more info check out http://www.voip-info.org/wiki/view/Asterisk+variable+DIALSTATUS
you can use CDR feature or use a diaplan to get the dialed status
http://www.voip-info.org/wiki/view/Asterisk+variable+DIALSTATUS
http://www.voip-info.org/wiki/view/Asterisk+cdr+mysql
Related
I logged in using agc (agent) panel in vicidial and just to test manual dial, I just executed following MySql query fron cmd.
UPDATE vicidial_live_agents set external_dial='12122351880!!YES!NO!YES!!1478530720!!!!!!' where user='1001';
After this , i got a a call on my softphone (already configured).
I am unable to understand one thing, How can an explicit entry to the vicidial_live_agents table of mysql, make a call ?
You shouldn't be messing with the database for calls.
If you configured everything correctly, you should recieve a call as soon as you log-in which will send you to a conference, you should hear a voice confirming it (you are the only one in this conference), all future calls will be connected to that conference, you should keep that call at all times and not control anything in the softphone.
If you need to make a manual calls you can either set the "Manual Dial Override" option in the campaign to "ALLOW ALL", which will enable a link in the agent screen labeled "Manual Dial" or you can use the agent_api with the external_dial function.
What you have found is the raw method that the Agent API uses to implement a manual dial call. For more information on how the Agent API works, and for all of the options you can use with the "external_dial" function, take a look at the Agent API documentation:
http://vicidial.org/docs/AGENT_API.txt
I want to execute an AGI script for calling party after called party hangs up. For example, for doing a survey for customers I am going to run an AGI script after agent hangs up.
Unfortunately, when AGI scripts runs the agi debug output says:
"511: The command cannot be executed on a dead channel"
I use commands like "ANSWER" or "STREAM FILE" in my agi script which need a channel to run on.
I know that calling channel hangs up as soon as called party hangs up.
I tried DeadAGI instead of AGI and also "g" option in dial command but none of them works.
So, I think I have to search for a solution that keep the calling channel up so that I can run my script on that.
Any suggestion please?
You should not use "g" param for this case, because it is CALLER hangup. You should use "F"
F([[context^]exten^]priority): When the caller hangs up, transfer
the *called* party to the specified destination and *start* execution
at that location.
NOTE: Any channel variables you want the called channel to inherit
from the caller channel must be prefixed with one or two underbars ('_').
F: When the caller hangs up, transfer the *called* party to the next
priority of the current extension and *start* execution at that location.
NOTE: Any channel variables you want the called channel to inherit
from the caller channel must be prefixed with one or two underbars ('_').
NOTE: Using this option from a Macro() or GoSub() might not make
sense as there would be no return points.
g: Proceed with dialplan execution at the next priority in the current
extension if the destination channel hangs up.
Finally I found the answer. The problem is that we don't have to execute agi script in h extension otherwise we get an error for some functions like answer or streamfile in agi. we have to redirect the call to some extension before h extension and for that in elastix I had to change extensions.conf.
I am developing a custom application to control an Asterisk based pbx using ami/agi interface. What I have to do is:
receive a call from a pstn external line
answer the call
play a welcome message
transfer the call to a specific extension
park the call
reconnect to the call from a different extension
Everything should be done using ami/agi interfaces. I succesfully developed everything up to point 5) but I am unable to understand how to transfer (using ami/agi) the parked call to a runtime-defined extension.
Can someone give me an idea on how to do it ?
you should originate from Local/XXX#parked_context to the extension you want.
something like this..
Action: Originate Channel: Local/XXX#parked_context (XXX is the number of parked call)
Context: default (here you put the context where you can reach the second party)
Exten: 123 (number who will receive the call)
Priority: 1
Callerid: 3125551212
Timeout: 30000
Variable:
ActionID:
Simplest way is just use async agi or conference or Wait extension instead of parking, i.e redo parking-like logic yourself.
That way you will 100% know channel name and how to transfer it back.
Considering you are gooing use ami - AsyncAGI is best option for you.
I'm trying to find answer how to make Asterisk execute some command (my script) after confbridge's recording is finished
There is the next info in confbridge.conf:
record_conference=yes
Records the conference call starting when the first user enters the
room, and ending when the last user exits the room.
It records file well but I want it sending wav file via email.
Could anybody help me?
My config now looks like this (if it's necessary):
exten => 333,1,ConfBridge(100010,100010_bridge_profile,100010_user_profile)
Dialplan scripting is limited to events relating to each call channel. To get event info for other parts of asterisk (such as the ConfBridge application) you should hook into the Asterisk Manager Interface (AMI).
There are many libraries already created to make working with the AMI easier. (That site may be outdated. Refer to the official Asterisk Wiki whenever possible.)
The AMI event you're interested in is "ConfBridgeEnd". Docs here.
You can use h-extension after confbridge, in which you have check if confbridge still active(last user).
If yes, run your script via System call.
I want to pickup call in Asterisk using AMI. I can originate call, but totally don't know, how to answer the phone...
Script for calling:
#login
sock = socket.socket(af, socktype, proto)
sock.connect(sockaddr)
sock.send('Action: login\r\n')
sock.send('Events: off\r\n')
sock.send('Username: '+str(ast_server.login)+'\r\n')
sock.send('Secret: '+str(ast_server.password)+'\r\n\r\n')
#originate call
sock.send('Action: originate\r\n')
sock.send('Channel: ' + str(user.asterisk_chan_type) + '/' + str(user.internal_number)+'\r\n')
sock.send('Timeout: '+str(ast_server.wait_time*1000)+'\r\n')
sock.send('CallerId: '+str(user.callerid)+'\r\n')
sock.send('Exten: '+str(ast_number)+'\r\n')
sock.send('Context: '+str(ast_server.context)+'\r\n')
if ast_server.alert_info and user.asterisk_chan_type == 'SIP':
sock.send('Variable: SIPAddHeader=Alert-Info: '+str(ast_server.alert_info)+'\r\n')
sock.send('Priority: '+str(ast_server.extension_priority)+'\r\n\r\n')
#logout
sock.send('Action: Logoff\r\n\r\n')
time.sleep(1)
sock.close()
I need something similar, but for answering calls.
Can't find any useful command in *CLI> manager show command
Halp me, plox
You can't answer a call directly via AMI. This is because a new call will "arrive" at the given context/priority/extension configured in the dialplan (or it will be rejected if cant find one that applies). So whatever happens with that call will start at the given context/priority/extension in the dialplan.
If you want to handle calls via AMI, try using asynchronous AGI, like this:
exten => _X.,1,AGI(agi:async)
This will handle all calls to any extension that has at least 1 digit, by issuing an event (AsyncAGI) that you can handle with your AMI client.
Then, from your AMI client, you can send AGIAction's, like:
Action: AGI
Channel: SIP/adevice
Command: ANSWER
CommandID: MyCommandID
This will effectively allow you to run AGI commands (and handle a call like you would normally do in any AGI script) from your AMI client.
Hope it helps!