Get call duration of active calls in Asterisk 13 - asterisk

Please, I want to implement billing in asterisk 13.
i want to be able monitor an active call of a particular extension ( say extension 0001) and Hangup call once the extension have used 10mins. How do I achieve this in dailplan ( i.e extensions.conf)
...appreciations for any input.

First of all i can recommend you use already created billings like a2billing.org or CCGrates.
If you have not much resources and experience, that will be just wast of time(alot of things can go not as you expect).
For see currently active calls you can use ForkCDR functions of CEL events(like some commercial billing systems use).
You also can use AMI events+dialplan for track that(like fop/fop2 use), but tat is not easy way.
Most easy way is CEL probably.
For hangup call you can use function TIMEOUT(absolute) or params of Dial command.

Related

Get how long device on hold state in call

Is there a way to get the value of how long the extension on hold state when call is happen ? I know there is rtp_holdtimeout in pjsip context option endpoints type, but i need only the value without having hangup the extension. Thank
Yes, each hold produce event on start/stop.
You have read events via AMI Events routine, record for this call ID all start/stop and calculate.
No, it is not doable without external program.

How To Set up Call Hold and Pick Up In Asterisk

I am quit new in asterisk.
My problem is: I have to implement call hold and pick up in asterisk.
Let's say we have an incoming call called incomingCallA.
As an operator I want to hold incomingCallA for a while to deal with other works, then come back soon, If i am not come back, others operator will pick up my held call.
I have done some researches that told me:
Call hold is sip client function, dont need to changes at asterisk server.
I can use call parking to dial to others operator if i am not come back.
Please help me to about the solution to deal with above problem.
Many thanks.
Simplest for begginer is create 100 conference rooms using Meetme after that just send to first availible room and record room number.
You can forward call using Transfer AMI function.

How to know if you missed an incoming call in AT commands

I am using Putty to simulate my phone's modem connected via serial. When my phone receives a call it outputs 'RING' into putty but when the caller cancel the call Putty doesn't out put any response or result.
How would the modem know that the caller disconnect/cancelled the call, but not output it in putty?
Thanks
To detect missed calls you can try three things.
Check if there is a suitable AT+CIND indicator you can turn on. I do not think call will do since I assume it only goes to 1 when the call is answered. If your phone supports callsetup or something similar that should be what you need (you will have to implement logic to detect when a call does not go to state active).
For an example of enabling AT+CIND indicators, see chapter "8.57 Informative examples" in 27.007 for more explanation, and pay close attention to The subparameter order in the command is defined by the query command order, e.g.
if AT+CIND=? returns
+CIND: ("abc",(0-1)),("xyz",(0,1)),("call",(0,1))
then call is index 3, and for
+CIND: ("abc",(0-1)),("call",(0,1)),("xyz",(0,1))
call is index 2. Do not hard code any assumptions here, this should be parsed and checked run-time (one check at the beginning is enough).
Alternatively you can upon RING start polling call status with AT+CLCC until the call is no longer listed.
Or you could poll the MC phonebook storage and detect changes.
Most modems show the incoming phone number and a RING when a call is received and an END when the call is cancelled. To view the missed calls, you may use the following AT Commands.
AT+CPBS="MC"
AT+CPBR=1,99
First command tells the modem to look in the missed call phone book and the second command loads entries from 1 to 99. Note that this behavior is not standard. I was able to replicate this on a GSM module but not on my 3G modem. Try it on your modem and check if this works. All the best.

Detect silence while playing sound

I am developing an java-asterisk application that is calling subscribers to deliver messages. At some moments during the call, I need to monitor whether the subscriber is talking or is silent. I need to monitor that for a fairly long time (1-3 seconds) but don't want to interrupt the flow of the outgoing message.
The way I am doing it now is as below
streamFile(*file A*);
exec("WaitForSilence","300,1,1");
waitStatus=getVariable("WAITSTATUS");
streamFile(*file B*);
This works fine but it is only a 300ms detect and a 1s timeout, so from the subscriber point of view the silence between file A and file B is almost unnoticeable. But if I want to listen for longer (say 3 seconds for example) then the subscriber's experience will be ruined.
What I would need is a function similar to "WaitForSilence" but that:
runs in parallel to the script;
delivers its outcome in a variable channel with a name that I define (as there might be several calls to the function, and I need to get all the results)
I've been looking for more than aweek now and couldn't find a way to do that. Any ideas?
Code you provided will do wait, after that will do playback.
There are no way do that simple in one application.
Posible ways:
1) create c/c++ application(asterisk guru skill required) for that.
2) create enother channel, mix it with ChanSpy and in that channel do silence detect. Complexity - expert in asterisk.
Both are not so short(more then 2-3 screens of code), so can't be described in this site.
You can also try use Background application, but i am afraid it will not work too.

automatic call distribution or call forwarding in asterisk

Can we do automatic call distribution in asterisk(in built conf or something)?
Means as per consideration of
there is x,y,z are 3 call receivers & a,b,c are call dialer & all dialer dont know about x,y,z they always consider they are calling x only.
Now if x busy with a,& same time b try to call to x then its call should divert to y or z(any one who free).
So for achieve this should i use only call divert method which example in
http://www.voip-info.org/wiki/view/Asterisk+call+forwarding
Or should i go for as http://www.voip-info.org/wiki/view/Automatic+Call+Distributor
But for automatic call distribution or call forwarding can i use asterisk old version which currently i am using 1.6.2.6 or i have to upgrade it?
You can use queue application or ringgroup or create your own diaplan as you wish.
http://www.voip-info.org/wiki/view/Asterisk+call+forwarding
Also any asterisk-related book will help, for example
http://cdn.oreilly.com/books/9780596510480.pdf
If standard Asterisk ACD tools such as:
http://ofps.oreilly.com/titles/9781449332426/asterisk-ACD.html
http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/ACD_id288932.html
... then another alternative is to use an AGI to get the effect you are looking for. Instead of queuing the call via Asterisk, use call parking or dynamic meetme and have your AGI "do the right thing" to get the call to the agent.

Resources