Get how long device on hold state in call - asterisk

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.

Related

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.

Get call duration of active calls in Asterisk 13

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.

Get time since Call start in AGI

When I have call request in AGI script, is it possible to get time since call was created? For example, if it was routed sequentially through several softswitches can I get whole time sinse first softswitch or since generation in remote softphone ?
SIP only is used.
I also use AMI, and in CDR event I see that (Duration - BillableSeconds) is sometimes longer (for 10-20 seconds) then time from AGI request to Up, so duration may be already includes some time before call passed to my Asterisk.
No, there are no way determine any history of call before it go your switch unless other switch inform you about by special headers.
No, CDR(duration) is counted from time when call arived to asterisk. CDR(billsec) always less or equal to duration.

Directshow- ISampleGrabberCB::SampleCB callback frequency

I am working on an application which requires video frame capture from different frame-grabber cards. I am using directshow ISampleGrabberCB::SampleCB callback to receive pointer to the new frame. Now I want to know when exactly this callback gets called ? Is it guaranteed that every time frame-grabber receives a new frame it will automatically get called ?
I was trying for 120Hz signals with various resolutions but I this callback is only getting called 50-55 times. So there is a possibility that my frame-grabber is not able to capture at that rate (although theoretically its capable). I want to find out whether this callback is bottleneck or framegrabber card.
Thank You
SampleCB is immediately called called from streaming thread, you have one call for every frame. While in callback, you block further streaming, that is you need to return control from your callback in order to resume (in particular, if your callback is "slow", it can reduce effective FPS).

Servlet getParameter

I have a servlet program for counting numbers, I want to control it through an html interface.
by pressing the start button the program must start running and by pressing pause button the servlet program must be paused and by clicking on the restart button it must restart again. by the way i used thread. My problem is that each time I should click one button and send its value to the servlet, and when I'm getting the buttons values inside the servlet a NullPointerException is occur... any help ??
I wouldn't use a Thread for that purpose and in general is not usually a good idea to create threads in servlets.
Say we count one number per millisecond meaning: it will give me the time between one click and another in milliseconds.
One work around could be:
Click on start = save the start time in the session.
click on stop = to get the count we do currentTime-StartTime (saved in session)
Now if you really must use Threads be sure then to create it using another class.
One suggestion might be create a ThreadManager class and store it in the session (use a listener for this) and then start it in that session object.
Even better store the ThreadManager inside the servletContext and have a way to create your thread per session.
To create Threads favor the Executor classes instead of the Thread classes.
Also make sure you stop your threads since having threads created by us inside a web container may prevent it from stoping entirely.
If you provide some code I can help you further.
Good luck, have fun.

Resources