Re: [asterisk-users] Branch based on call volume
On 27Jun, 2015, at 15:34, Michelle Dupuis mdup...@ocg.ca wrote: Is there a simple way to get call volume from a particular trunk within the dialplan (for conditional branching)? Do you mean large number of calls or how loud the call is? -- Cheers, Matt Riddell ___ http://www.venturevoip.com/news.php (Daily Asterisk News) http://www.venturevoip.com/pabx_on_disk.php (PABX on a Disk) http://www.venturevoip.com/exchange.php (Full ITSP Solution) http://www.venturevoip.com/cc.php (Call Centre Solutions)-- _ -- 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] Branch based on call volume
?I meant how many calls are in progress on a particular trunk. (Sorry - I didn't even think of the other interpretation). From: asterisk-users-boun...@lists.digium.com asterisk-users-boun...@lists.digium.com on behalf of Matt Riddell li...@venturevoip.com Sent: Sunday, June 28, 2015 9:26 AM To: Asterisk Users List Subject: Re: [asterisk-users] Branch based on call volume On 27Jun, 2015, at 15:34, Michelle Dupuis mdup...@ocg.camailto:mdup...@ocg.ca wrote: Is there a simple way to get call volume from a particular trunk within the dialplan (for conditional branching)? Do you mean large number of calls or how loud the call is? -- Cheers, Matt Riddell ___ http://www.venturevoip.com/news.php (Daily Asterisk News) http://www.venturevoip.com/pabx_on_disk.php (PABX on a Disk) http://www.venturevoip.com/exchange.php (Full ITSP Solution) http://www.venturevoip.com/cc.php (Call Centre Solutions) -- _ -- 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 dialplan best practices syntax
2015-06-26 17:11 GMT+02:00 Steve Edwards asterisk@sedwards.com: On Fri, 26 Jun 2015, Ludovic Gasc wrote: 1. What's the official notation of each line: = or = ? In the wiki of Asterisk, I see very often =, however, what's the reason for both syntaxes authorized ? Historical ? I'm not 'official,' but I have a strong preference for just '=.' Using '=' seems clunky, ugly, and unnecessary. It's interesting because from my point of view, I prefer to use '=', because, to me, '=' is for config files. The dialplan is a programming language, not a config file. If you like buzzwords, it's a Domain Specific Language. However, it's completely a religious point of view, Asterisk will process exactly the same dialplan with '=' or with '='. I was interested in by the story that will explain to me why Asterisk support both syntaxes, if somebody remembers. Thank you Steve for your answers in point 2., any tips to improve readability of dialplan is interesting to me. 2. To write info in logs/console, you have two commands: NoOp and Verbose. Verbose seems to be better, because you can define a log level. Are you agree or another command fits better for logs ? This is kind of a pet peeve of mine. Why use the misguided 'side effect' of an application when there is a specific, 'more featured,' application for that purpose? A 'noop' is a contraction of 'no operation' meaning it should do nothing but act as a placeholder. Two other areas of 'best practices' I'm a strong believer in are: alphabetize wherever possible, and use white space to improve readability. For example, here's a 'sanitized' sip.conf snippet from a popular provider's web site: [xxx-inbound] type=friend dtmfmode=auto host=xxx.yyy.zzz context=inbound username=xxx secret=yyy allow=all insecure=port,invite canreinvite=no [xxx-outbound] type=friend dtmfmode=auto host=xxx.yyy.zzz username=xxx fromuser=xxx secret=xxx trustrpid=yes sendrpid=yes allow=all canreinvite=no Pretty ugly and difficult to read. With a little whitespace and alphabetizing we get: [xxx-inbound] allow = all canreinvite = no context = inbound dtmfmode= auto host= xxx.yyy.zzz insecure= port,invite secret = yyy type= friend username= xxx [xxx-outbound] allow = all canreinvite = no dtmfmode= auto fromuser= xxx host= xxx.yyy.zzz secret = xxx sendrpid= yes trustrpid = yes type= friend username= xxx Now, the major sections are easy to 'visually delineated.' Finding the 'secret' is much easier now. Comparing a 'working' extension with a 'broken' extension will be much easier as well. I use the same formatting in the dialplan. This snippet is from extensions.conf.sample: [outbound-freenum2] exten = _X!,1,Verbose(2,Performing ISN lookup for ${EXTEN}) same = n,Set(SUFFIX=${CUT(EXTEN,*,2-)}) same = n,GotoIf($[${FILTER(0-9,${SUFFIX})} != ${SUFFIX}]?fn-CONGESTION,1) same = n,Set(TIMEOUT(absolute)=10800) same = n,Set(isnresult=${ENUMLOOKUP(${EXTEN},sip,,1,freenum.org)}) same = n,GotoIf($[${isnresult} != ]?from) same = n,Set(DIALSTATUS=CONGESTION) same = n,Goto(fn-CONGESTION,1) same = n(from),Set(__SIPFROMUSER=${CALLERID(num)}) same = n,GotoIf($[${GLOBAL(FREENUMDOMAIN)} = ]?dial) same = n,Set(__SIPFROMDOMAIN=${GLOBAL(FREENUMDOMAIN)}) same = n(dial),Dial(SIP/${isnresult},40) same = n,Goto(fn-${DIALSTATUS},1) exten = fn-BUSY,1,Busy() exten = _f[n]-.,1,NoOp(ISN: ${DIALSTATUS}) same = n,Congestion() With a little whitespace, this becomes much more readable: [outbound-freenum2] exten = _X!,1, Verbose(2,Performing ISN lookup for ${EXTEN}) same = n, Set(SUFFIX=${CUT(EXTEN,*,2-)}) same = n, GotoIf($[${FILTER(0-9,${SUFFIX})} != ${SUFFIX}]?fn-CONGESTION,1) same = n, Set(TIMEOUT(absolute)=10800) same = n, Set(isnresult=${ENUMLOOKUP(${EXTEN},sip,,1,freenum.org)}) same = n, GotoIf($[${isnresult} != ]?from) same = n, Set(DIALSTATUS=CONGESTION) same = n, Goto(fn-CONGESTION,1) same = n(from), Set(__SIPFROMUSER=${CALLERID(num)}) same = n, GotoIf($[${GLOBAL(FREENUMDOMAIN)} = ]?dial) same = n, Set(__SIPFROMDOMAIN=${GLOBAL(FREENUMDOMAIN)}) same =
Re: [asterisk-users] Asterisk dialplan best practices syntax
On Sun, 28 Jun 2015, Ludovic Gasc wrote: It's interesting because from my point of view, I prefer to use '=', because, to me, '=' is for config files. The dialplan is a programming language, not a config file. The only language I'm familiar with (I'm primarily a 'c' guy) that uses '=' is PHP. In PHP, '=' is used with associative arrays. I tend to think of a dialplan as a group of one dimensional linear arrays with the name of the array being the context concatenated with the exten so for me, a simple assignment makes sense. -- 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 dialplan best practices syntax
Hey; Don't forget Perl. I'm not sure what everyone else calls it, but most Perl programmers call it a fat comma. From Chromatic's Modern Perl book: One of the simplest but most useful examples of TIMTOWTDI in the design of Perl is the fat comma operator (=), which acts like a regular comma except that it automatically quotes barewords used as its left operands. It also looks like an arrow, so it leads from left to right and implies a stronger association between its operands than the normal comma does. You can see this in hash initializers: my %dogs = ( alpha = 'Rodney', clown = 'Lucky', puppy = 'Rosie', ); Regards; John V. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Edwards Sent: Sunday, June 28, 2015 11:08 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Asterisk dialplan best practices syntax On Sun, 28 Jun 2015, Ludovic Gasc wrote: It's interesting because from my point of view, I prefer to use '=', because, to me, '=' is for config files. The dialplan is a programming language, not a config file. The only language I'm familiar with (I'm primarily a 'c' guy) that uses '=' is PHP. In PHP, '=' is used with associative arrays. I tend to think of a dialplan as a group of one dimensional linear arrays with the name of the array being the context concatenated with the exten so for me, a simple assignment makes sense. -- 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] Branch based on call volume
On 28Jun, 2015, at 10:19, Michelle Dupuis mdup...@ocg.ca wrote: I meant how many calls are in progress on a particular trunk. (Sorry - I didn't even think of the other interpretation). Then yeah group and group count functions: https://wiki.asterisk.org/wiki/display/AST/Function_GROUP https://wiki.asterisk.org/wiki/display/AST/Function_GROUP https://wiki.asterisk.org/wiki/display/AST/Function_GROUP_COUNT https://wiki.asterisk.org/wiki/display/AST/Function_GROUP_COUNT Just in case you’re wondering, the function to change the loudness of a channel is volume :-) https://wiki.asterisk.org/wiki/display/AST/Function_VOLUME https://wiki.asterisk.org/wiki/display/AST/Function_VOLUME -- Cheers, Matt Riddell ___ http://www.venturevoip.com/news.php (Daily Asterisk News) http://www.venturevoip.com/pabx_on_disk.php (PABX on a Disk) http://www.venturevoip.com/exchange.php (Full ITSP Solution) http://www.venturevoip.com/cc.php (Call Centre Solutions)-- _ -- 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