[asterisk-dev] Channel Driver's Write callback called with 140ms intervals
Hi, I'm doing some performance tests in our channel driver and I realized that in calls between our channel and a SIP phone, the write callback is called almost the time in 20ms intervals, which is correct. However, sometimes the callback is called with longer intervals between each call: 60ms, 80ms and reaching 140ms. First I thought that as a SIP call, due to network conditions, the frame can be buffered somewhere and then when the write callback is called after, e.g., 60ms, I would have a frame 3 times greater then the regular one (480 samples rather than 160) but the frame size is always of 160 samples. In my test, we receive a SIP call and the dialplan starts another call to a digital channel. After the call is answered in the other side wait a while and then hangup. During this time, I saw that the interval between the last write callback call and the current one can be longer than 20ms. I'm using a powerful machine and my asterisk process during the test uses less than 15% CPU. I'm also verifying my channel driver code to check if there is something that can cause this delay but I didn't find anything so far. It doesn't happens so often but I'm concerned this is happening. Any thoughts to help me find out where to looking at? Thanks in advance! -- -- Paulo Garcia ___ --Bandwidth and Colocation Provided by http://www.api-digital.com-- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
Re: [asterisk-dev] MeetMe huge delays
Hi Tony, first, thank you for your well-done explanation for me. I checked my channel driver code and it is using an approach to get the samples from our card using our own method and write to a pipe to wakeup the read call back. I saw that during the announcing message in conference, the Asterisk doesn't process any queued VOICE_FRAME sent by my read callback. After changing my code to avoid using read callback (which isnt necessary) the delay doesn't occurs anymore but I had warning messages that my voice frames are being dropped because the thread is to big, which proves that Asterisk stops to read the frames during those playback messages. I'll try your patch today to see if those behaviors disappear and I'll post the results here. Thanks On 9/20/07, Tony Mountifield [EMAIL PROTECTED] wrote: Hi Paulo, In article [EMAIL PROTECTED], Paulo Garcia [EMAIL PROTECTED] wrote: I'm having some strange behavior using our channel driver with MeetMe application. I'm testing using Asterisk 1.2.24 and zaptel/ztdummy 1.2.20.1. After some research, I've find an old issue in bugtrack http://bugs.digium.com/bug_view_advanced_page.php?bug_id=0003599 that discribes exactly the problem I'm having. That bug report is one of mine. 1 Using the i parameter in MeetMe, I have a huge delay between two participants. The delay is exacly the time of the enter message in the conference with the name of the participant. 2 Removing the i, using only cM, for example I still have a little delay (about 500ms) 3 Using the q parameter, I have no delays at all. The http://bugs.digium.com/bug_view_advanced_page.php?bug_id=0003599seems to be closed and fixed but I'm wonder to know if the problem still exists using non-zaptel channels or if I missed something to handle this in my channel driver. Although the bug was closed and fixed, I was never satisfied that it was fixed correctly. The powers that be never adopted the asynchronous thread approach that I submitted as my fix. Life was too short to keep arguing about it. I build a lot of MeetMe systems and incorporate my own patch into them all. I expect I will still have to do so when I move to 1.4, but I haven't tested 1.4 yet. It certainly doesn't appear to have asynchronous play. Please try applying the last patch listed under that bug (head-v4). You may need to apply quite a bit of it by hand, as I expect the patch doesn't apply cleanly any more. If it fixes your problem (as I expect it will), I can only suggest you do as I do, and keep your own working version of app_meetme.c. Something else that I found helped enormously was another patch that was too late to be included in 1.2 (pity). You can find it at bug 5374: http://bugs.digium.com/view.php?id=5374 There are various patches there, but the one I find best, and include in all 1.2 systems that I build, is called 2005-10-04-3-asynchronous.patch It is the channel.c mods that are important. The changes to app_milliwatt, app_sms and app_chanspy will only matter if you use those modules. Any ideas? Thanks in advance! Hope this helps. Please let the list know how you get on with the patches. Cheers Tony -- Tony Mountifield Work: [EMAIL PROTECTED] - http://www.softins.co.uk Play: [EMAIL PROTECTED] - http://tony.mountifield.org ___ Sign up now for AstriCon 2007! September 25-28th. http://www.astricon.net/ --Bandwidth and Colocation Provided by http://www.api-digital.com-- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev -- -- Paulo Garcia Pika Technologies Inc ___ Sign up now for AstriCon 2007! September 25-28th. http://www.astricon.net/ --Bandwidth and Colocation Provided by http://www.api-digital.com-- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
[asterisk-dev] ast_readaudio_callback() called just one time
Hi, I have the following behavior (Asterisk 1.2.24): Using my channel driver, If my dialplan starts directly with a playback functions, for example: exten = 4020,1,VoicemailMain(${CALLERID(num)[EMAIL PROTECTED]); the first messages wasn't played (in this case vm-login). The vm-password file is played normally. However, If I insert a Wait() function before: exten = 4020,1,Wait(1) exten = 4020,1,VoicemailMain(${CALLERID(num)[EMAIL PROTECTED]); both vm-login and vm-password are played normally. In the first case (without Wait()), checking the Asterisk code, I saw that the ast_write() function is called just one time when the vm-login is played. I found in file.c the ast_readaudio_callback() that should be called several times until the file finishes. However, it is called just one time. I checked that in my side, the audio is already enabled, the channel is UP but my write callback is never called more than one (since ast_write() is not called as well). What is the difference using Wait or not? Why the vm-login fails to play in the first case? Any idea where to find the cause ? Thanks! -- -- Paulo Garcia Pika Technologies Inc ___ Sign up now for AstriCon 2007! September 25-28th. http://www.astricon.net/ --Bandwidth and Colocation Provided by http://www.api-digital.com-- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
[asterisk-dev] Alternative Clock Souce and SIP - Trunk huge latency
Hi, We created our own clock source using the patched ztdummy approach ( http://bugs.digium.com/view.php?id=8896). It seems to working well, with ztdummy receiving our clock each specified time. During our tests, we created the following scenario: From SIP Phone we made an outgoing call using a trunk port that was extended to another trunk port (same card) that answered the call and transferred it to another SIP phone. The first analysis shown a good latency time, but after 1 hour we got about 600ms of latency and after 12 hours we got 11 seconds of latency! It is a unique long duration call. (Asterisk 1.2.22 was used) I had done the same test before create the clock source and I thought that this huge latency was caused by different clocks. Now, if the clock implemented, I got the same results than before. Do I misunderstood the problem with SIP/Trunk latency? It is caused by another problem? Any help will be appreciated! Thanks! -- -- Paulo Garcia ___ --Bandwidth and Colocation Provided by http://www.api-digital.com-- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
Re: [asterisk-dev] Alternative Clock Source
Tzafrir, thanks for your answer. I'll try to implement and test the patch you point because it seems to be the best solution for my needs. When I was waiting for the answers here, someone has come up about another question I could figure out how to answer: Is it possible to do exactly the opposite? Instead of providing my own clock source, is it possible the get this clock from the zaptel layer. I'm thinking on using our software layers with another vendor cards like Digium and Sangoma. We don't use zaptel so I'm wondering to know if it is some kind of way to get this clock . Can you or someone help me? Thanks Paulo On 7/10/07, Tzafrir Cohen [EMAIL PROTECTED] wrote: On Tue, Jul 10, 2007 at 02:52:32PM -0300, Paulo Garcia wrote: Hi All, After some research I decided to patch the ztdummy to provide the clock source for Asterisk. Please help test http://bugs.digium.com/8896 It is essentially qhat you describe. Now, I'm wondering with a scenario where I have my card and another vendor card (e.g. Digium or Sangoma). How the clock will work in this situation? The true-zaptel-card (Digium or Sangoma) will overwrite my patched ztdummy and use its own clock? Is there a way to my clock have high priority in this case? The patch there also adds the option 'prefmaster' to ztdummy. This will make ztdummy try to take the sync mastership by force when it loads. However a digital span can still take timing on certain circumstnaces if it is configured as a timing source. But then again, in setups where you're supposed to provide timing, no other device should be a timing source (a value other that '0' for the 'timing' parameter in the span= line in ztcfg). -- Tzafrir Cohen icq#16849755jabber:[EMAIL PROTECTED] +972-50-7952406 mailto:[EMAIL PROTECTED] http://www.xorcom.com iax:[EMAIL PROTECTED]/tzafrir ___ --Bandwidth and Colocation Provided by http://www.api-digital.com-- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev -- -- Paulo Garcia Pika Technologies Inc ___ --Bandwidth and Colocation Provided by http://www.api-digital.com-- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
Re: [asterisk-dev] Asterisk channels limit
Thank you for all. All information was great! Regards On 5/9/07, Kevin P. Fleming [EMAIL PROTECTED] wrote: Jared Smith wrote: As far as I know, there are no hard-coded channel limits in the *open source* version of Asterisk. As I understand it, Digium's Business There wouldn't be any point in having a channel limit in open source Asterisk, since it is by definition open source and users would just remove the limits :-) ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev -- -- Paulo Garcia Pika Technologies Inc ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
Re: [asterisk-dev] Implementation using libpri and socketpair()
Hi, just for feedback. I choose to create the fifo kernel module to accomplish the task since I found more suitable to my needs. If someone wants to check this kernel module, it is available at http://dgvchannel.cvs.sourceforge.net/dgvchannel/unstable/fifodev/. I'm testing it now and probably needs improvements but I think it is very stable and solve the intermixing problem. Thanks for all Paulo Garcia On 2/8/07, Christian [EMAIL PROTECTED] wrote: yeah my approach works only if you can modify the write as well. the only way i know which would definitely work is: you need to write a kernel module which creates a char device, there each write results in a single copy_from_user and you won't have intermixing of packets. then you could send the packet either directly to your hardware or you use another character device to send it up to your process which will also send the exact amount of data, like: /dev/packetloopIN + /dev/packetloopOUT but that's probably as much work as interpreting the q.921 header ;-) Paulo Garcia wrote: Hi Christian, I think I understand what you are saying but the data read comes directly from libpri and I cannot realize how can I put some data before the package, because I saw that into libpri there are two writes to my socket file descriptor but in the read part (inside my program thread) there are only one read with both packets togheter. After I receive the packet from libpri, I can send it directly to my card and the packet arrives at other side perfectly since my hardware already prepared to do it. The only problem is when I get two packets joint togheter. I´m thinking if using another kind of interprocess communication I can avoid this socketpair behaviour. Thanks in advance! Paulo On 2/7/07, * Christian* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi Paulo, i have had similar issues with a quite different use-case ;-) the problem is that you need to frame your messages and transmit these frames instead of the transparent data. you can use hdlc for example, i believe there are some simple implementations out there, but that is sort of overkill. The most simple thing would be to just put the length of the frame before each packet, the length could be of maximum 4 bytes, then do a read of just as much bytes which you know from this length, like: uint32 len; char buf[1024]; read(fd, len, 4); read(fd,buf,len); then you can be sure that you've got only this single frame in buf, (well if read returns less then len you need to reread of course). Besides that i have somewhere read that you can set a HDLC Property via fcntl to terminals, but i haven't had ever the time to test that out. cheers, christian Paulo Garcia wrote: Hi, in my own channel, I'm implementing ISDN support using Libpri. The implementation is completely independent from zaptel then I'm trying to do all communications between my hardware and libpri using socketpair function. The idea is to create a socketpair, passing fd[0] to pri_new function and writing to fd[1] to pass data to libpri. So far so good... To receive data from libpri, I have a thread checking for all file descriptors fd[1] using select() function and when I receive something, I pass it to my card. This approach also works well but sometimes I receive two messages (from libpri) in only one read() call. I think this is because of libpri writes two messages so fast then when the read is called, there are already two messages in socket buffer... How can I avoid this behavior? Maybe using another way different of socketpair ? This communication will be used only inside the same process, between different threads. Any path or idea will be appreciated. Regards Paulo Garcia ___ --Bandwidth and Colocation provided by Easynews.com http://Easynews.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev ___ --Bandwidth and Colocation provided by Easynews.com http://Easynews.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com
[asterisk-dev] Channel dev question - getting ringback tone from PSTN
Hi, my channel to our card uses R2D/MFC (built in, not unicall) and I have the followinf scenario (Asterisk 1.2.13) : E1-A - connected to PSTN E1-B - connected to PBX My user starts a call from PBX - E1-B, then the channel allocates one port of E1-A to dial to PSTN. When the E1-A receives answer, Asterisk bridges both channel and audio can be listen normally. This works well, but I'm having some requirements to allow the user to listen the PSTN tones (ringback, busy, unavailable messages, etc). My initial idea is to send to Asterisk a AST_CONTROL_ANSWER just after dial, then Asterisk will bridge both channels and the user will be listen PSTN's tones. Any sugestion? Best Regards Paulo Garcia ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
Re: [asterisk-dev] Digium Card - E1 signalling give weird error
Hi, I 've found this problem when I make a mistake configuring the clock source in zaptel.conf. Paulo Garcia Digivoice Eletronica On 11/29/06, Cheow Han Hoong [EMAIL PROTECTED] wrote: Dear all , I'd encountered such problem during configuring TE407P card,after we have up the asterisk, with zaptel and zapata configured.Once we connect the isdn pri into TE407P, asterisk cli show below every 2 second:- primary d-channel on span 1 up Appreciate you guys can explains the reason of the happening. thank you. Regards, Joe Thang msn: [EMAIL PROTECTED] Send instant messages to your online friends http://asia.messenger.yahoo.com ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
Re: [asterisk-dev] DTMF Gereration duplicated. Why?
Hi,I understood. Thanks for replies!Paulo GarciaDigivoice EletrônicaOn 10/3/06, Paul Cadach [EMAIL PROTECTED] wrote: Hello, I'm not sure but at least RFC2833 allows to not mute audio stream when sending RFC2833-coded DTMFs. But if you have enabled inband DTMF detection together with another sort of DTMF information - you will have duplicates, of course. WBR,Paul. - Original Message - From: Paulo Garcia To: Asterisk Developers Mailing List Sent: Tuesday, October 03, 2006 10:29 PM Subject: Re: [asterisk-dev] DTMF Gereration duplicated. Why? Hi,no, I don 't... My callback receives from hardware the DTMF signal as soon as it is detected. Checking another channels implementations, I think I need to *mute* my channel during dtmf... Is it correct?Regards Paulo Garcia On 10/3/06, Paul Cadach [EMAIL PROTECTED] wrote: Hello, Do youhave support for variable-length DTMF with BEGIN and END events of DTMFs? WBR,Paul. - Original Message - From: Paulo Garcia To: Asterisk Developers Mailing List Sent: Tuesday, October 03, 2006 8:42 PM Subject: [asterisk-dev] DTMF Gereration duplicated. Why? Hi,In my custom channel, when it detects a DTMF, it sends a AST_FRAME_DTMF to Asterisk. My problem is when I have to bridged channels. When the user press a DTMF in channel A, channel B receives it duplicated (or splitted??). My *send_digit* callback always returns -1 to avoid Asterisk to generate DTMF.Someone has an ideia about?Best RegardsPaulo Garcia ___--Bandwidth and Colocation provided by Easynews.com --asterisk-dev mailing listTo UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev ___--Bandwidth and Colocation provided by Easynews.com --asterisk-dev mailing listTo UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev ___--Bandwidth and Colocation provided by Easynews.com --asterisk-dev mailing listTo UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev ___--Bandwidth and Colocation provided by Easynews.com -- asterisk-dev mailing listTo UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
Re: [asterisk-dev] Solution allowing Asterisk send and receiving serial data from/to pbx
Kevin, Thank you. I´ll try 1.4 beta to see these features. Regards Paulo On 9/22/06, Kevin P. Fleming [EMAIL PROTECTED] wrote: - Paulo Garcia [EMAIL PROTECTED] wrote: In some cases, it is necessary to use Asterisk only as IVR and VoiceMail, without pbx functionalities. Several pbx use serial port to send and receive messages to interact with voicemail systems (start correct extension mailbox, KS leds on/off and so on). Which is called SMDI, and is already supported in the beta releases of Asterisk 1.4.--Kevin P. FlemingSenior Software EngineerDigium, Inc.___ --Bandwidth and Colocation provided by Easynews.com --asterisk-dev mailing listTo UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev