Re: [asterisk-users] Asterisk AMI - Create a daemon (background process)
On Tue, 26 Feb 2013, Paul Belanger wrote: You don't want to use PHP for your daemon, change to another scripting language (EG: python). Why? I'm just a 'c' weenie, but why would Python be a better choice than PHP? -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Asterisk AMI - Create a daemon (background process)
PHP has had memory leak issues in the past, though modern versions are apparently much better. The thing is, when you write a daemon you must EXPECT it to exit at some point, maybe the socket went away or the system restarted or you are out of memory, whatever. You need to make sure you handle these situations regardless of which language you write in. Using inittab is one way, daemon-tools is another. For me, PHP with its C-like syntax, decent string handling, Perl Regex, and POSIX process control (including fork), it is good enough for most stuff that I do. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Edwards Sent: Tuesday, February 26, 2013 11:12 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Asterisk AMI - Create a daemon (background process) On Tue, 26 Feb 2013, Paul Belanger wrote: You don't want to use PHP for your daemon, change to another scripting language (EG: python). Why? I'm just a 'c' weenie, but why would Python be a better choice than PHP? -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Asterisk AMI - Create a daemon (background process)
On Tuesday 26 February 2013, Steve Edwards wrote: On Tue, 26 Feb 2013, Paul Belanger wrote: You don't want to use PHP for your daemon, change to another scripting language (EG: python). Why? I'm just a 'c' weenie, but why would Python be a better choice than PHP? Because that poster likes Python. They're both wrong, of course. Perl is always the correct language to use :D (In case anyone mistakes the above for a serious remark, it hardly matters what scripting language you use as long as it has an AGI library. PHP has outgrown powering web pages and is now a fully-fledged scripting language. Use whatever you feel comfortable with and if you don't feel comfortable with it, use something else; or at least, abstract out the scariest parts. You don't get prizes depending on the language you use, at least not in the parts of the real world I've lived in.) -- AJS Answers come *after* questions. -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Asterisk AMI - Create a daemon (background process)
On Tue, 26 Feb 2013, Eric Wieling wrote: For me, PHP with its C-like syntax... For me, C with it's C-like syntax... -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Asterisk AMI - Create a daemon (background process)
On Tue, Feb 26, 2013 at 11:29:44AM -0500, Eric Wieling wrote: PHP has had memory leak issues in the past, though modern versions are apparently much better. The thing is, when you write a daemon you must EXPECT it to exit at some point, maybe the socket went away or the system restarted or you are out of memory, whatever. You need to make sure you handle these situations regardless of which language you write in. Using inittab is one way, daemon-tools is another. Some Linux distributions nowadays have upstart or systemd. That makes writing an extra daemon simpler. Regardless of the language. For me, PHP with its C-like syntax, decent string handling, Perl Regex, and POSIX process control (including fork), it is good enough for most stuff that I do. Gah. Just write it in Perl. Or, if it's a glorified script, maybe it just needs to be a shell script. -- Tzafrir Cohen icq#16849755 jabber:tzafrir.co...@xorcom.com +972-50-7952406 mailto:tzafrir.co...@xorcom.com http://www.xorcom.com iax:gu...@local.xorcom.com/tzafrir -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Asterisk AMI - Create a daemon (background process)
On Tue, 26 Feb 2013, Eric Wieling wrote: For me, PHP with its C-like syntax... Steve Edward said: For me, C with it's C-like syntax... So that brings up the question I have. Shouldn't a daemon be a compiled process? --Don -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Asterisk AMI - Create a daemon (background process)
On Tue, 26 Feb 2013, Don Kelly wrote: So that brings up the question I have. Shouldn't a daemon be a compiled process? Since C is my sharpest tool, the question is somewhat moot :) Once you get past the overhead of parsing a scripting language like PHP or Python, I think the efficiency advantage of C is minimal and the actual execution time will be dominated by whatever the daemon is 'talking to' -- i.e. Asterisk or MySQL or ... For smaller, frequently executed programs, C will be at home enjoying a cold one with friends and family before scripting programs get out of the starting gate. -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Asterisk AMI - Create a daemon (background process)
El 24/02/13 07:30, Shahid H escribió: I wanted to create a daemon (background process) in PHP. A daemon will use socket to connect with Asterisk AMI to send events and listen the actions. A daemon will also listen the commands from agents via HTTP, for example: A agent pressed a hang up button on a browser - it will send http command to a daemon. A daemon received a command and will then send Hang Up Action to AMI. How should a daemon process be designed to listen multiple actions and events? For example: 50 agents currently on the calls and how should a daemon to monitor the Actions/Events from 50 agents? You may want to take a look to the Elastix CallCenter code. This project has a daemon component to implement the autodialer, written in PHP. This code already solves the AMI connection issue and the multiple agent issue. http://elastix.svn.sourceforge.net/viewvc/elastix/trunk/apps/extras/callcenter/ -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Asterisk AMI - Create a daemon (background process)
On 13-02-24 07:30 AM, Shahid H wrote: I wanted to create a daemon (background process) in PHP. A daemon will use socket to connect with Asterisk AMI to send events and listen the actions. A daemon will also listen the commands from agents via HTTP, for example: A agent pressed a hang up button on a browser - it will send http command to a daemon. A daemon received a command and will then send Hang Up Action to AMI. How should a daemon process be designed to listen multiple actions and events? For example: 50 agents currently on the calls and how should a daemon to monitor the Actions/Events from 50 agents? You don't want to use PHP for your daemon, change to another scripting language (EG: python). -- Paul Belanger | PolyBeacon, Inc. Jabber: paul.belan...@polybeacon.com | IRC: pabelanger (Freenode) Github: https://github.com/pabelanger | Twitter: https://twitter.com/pabelanger -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
[asterisk-users] Asterisk AMI - Create a daemon (background process)
I wanted to create a daemon (background process) in PHP. A daemon will use socket to connect with Asterisk AMI to send events and listen the actions. A daemon will also listen the commands from agents via HTTP, for example: A agent pressed a hang up button on a browser - it will send http command to a daemon. A daemon received a command and will then send Hang Up Action to AMI. How should a daemon process be designed to listen multiple actions and events? For example: 50 agents currently on the calls and how should a daemon to monitor the Actions/Events from 50 agents? -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users