I have a script that I want to leave running in the background to handle specific manager events. I'm running into a problem where it gets stuck in the wait_response function in phpagi-asmanager.php and the PHP maximum execute timeout kills the script. The script doesn't interact with the dialplan, so I cannot launch it from within Asterisk. Any pointers would be appreciated. I did look through the wiki and gave google a chance, but the results found didn't really suggest a solution. Dan
im not familiar with phpagi-asmanager.php, but i guess thats because asterisk has nothing to send you and you are using blocking mode sockets, hence socket_read() is blocking. phpagi-asmanager.php give us more pointings about what you want to do and we will be able to help you. Currently im developing a php daemon to listen events and work as proxy for other clients that do "real" work depending on the events, something like that you want to do? On 1/13/06, Dan Austin <Dan_Austin@phoenix.com> wrote:> I have a script that I want to leave running in the background to handle > specific manager events. > > I'm running into a problem where it gets stuck in the wait_response > function in phpagi-asmanager.php and the PHP maximum execute > timeout kills the script. > > The script doesn't interact with the dialplan, so I cannot launch it > from within > Asterisk. Any pointers would be appreciated. > > I did look through the wiki and gave google a chance, but the results > found > didn't really suggest a solution. > > Dan > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > Asterisk-Users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-- "Su nombre es GNU/Linux, no solamente Linux, mas info en http://www.gnu.org"
The script has two functions- 1. Once a minute check to see if any MeetMe conferences are active and list the participants of any active conferences. 2. It registers an event_handler for MeetMeLeave and processes the output. The script simply loops issues manager commands. If command fails, it exits the inner loop, sleeps for awhile and tries to reconnect to the manager. If it fails, it sleeps more and repeats the process. Dan -----Original Message----- From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Moises Silva Sent: Friday, January 13, 2006 6:14 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] PHPAGI daemon/background task? im not familiar with phpagi-asmanager.php, but i guess thats because asterisk has nothing to send you and you are using blocking mode sockets, hence socket_read() is blocking. phpagi-asmanager.php give us more pointings about what you want to do and we will be able to help you. Currently im developing a php daemon to listen events and work as proxy for other clients that do "real" work depending on the events, something like that you want to do? On 1/13/06, Dan Austin <Dan_Austin@phoenix.com> wrote:> I have a script that I want to leave running in the background tohandle> specific manager events. > > I'm running into a problem where it gets stuck in the wait_response > function in phpagi-asmanager.php and the PHP maximum execute > timeout kills the script. > > The script doesn't interact with the dialplan, so I cannot launch it > from within > Asterisk. Any pointers would be appreciated. > > I did look through the wiki and gave google a chance, but the results > found > didn't really suggest a solution. > > Dan > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > Asterisk-Users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-- "Su nombre es GNU/Linux, no solamente Linux, mas info en http://www.gnu.org" _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
> Hum, i still have not a clear idea about where it gets stuck. Letssee. I may have glossed over this detail, I am using the php-asmanager.php library/script.> 1. Once a minut, check to see if any meetme conferences are active. > This is done by connecting each minute to the manager, or it stays > connected between each minute?It stays connected. Every five seconds I issue an empty command, as it appeared that the Events were only delivered after a recent command results.> 2. It registers an event handler for MeetMeLeave.... it waits until > the event arrives then? how do you wait? are you using socket_select() > call to prevent you from calling socket_read() when nothing to read?Good question. The samples I found for php-asmanager seemed to indicate that it handled triggering the handler when the registered event arrived. My code never calls the handler directly, but the function is launched when I receive the registered event. I can provide the code if that would help, but we might want to take that part of the discussion of the list. Dan
yep, i think that i can take some time to look at your code. Please contact me off-list, im available usually only early in the morning or in the night. Regards MSN: sism82 at hotmail dot com On 1/16/06, Dan Austin <Dan_Austin@phoenix.com> wrote:> > Hum, i still have not a clear idea about where it gets stuck. Lets > see. > > I may have glossed over this detail, I am using the php-asmanager.php > library/script. > > > 1. Once a minut, check to see if any meetme conferences are active. > > This is done by connecting each minute to the manager, or it stays > > connected between each minute? > It stays connected. Every five seconds I issue an empty command, > as it appeared that the Events were only delivered after a recent > command results. > > > 2. It registers an event handler for MeetMeLeave.... it waits until > > the event arrives then? how do you wait? are you using socket_select() > > call to prevent you from calling socket_read() when nothing to read? > Good question. The samples I found for php-asmanager seemed to indicate > that it handled triggering the handler when the registered event > arrived. > My code never calls the handler directly, but the function is launched > when I receive the registered event. > > I can provide the code if that would help, but we might want to take > that part of the discussion of the list. > > Dan > > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > Asterisk-Users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-- "Su nombre es GNU/Linux, no solamente Linux, mas info en http://www.gnu.org"