Re: [asterisk-users] Is Asterisk a Linux only system?

2015-02-12 Thread David M . Lee
 On Feb 12, 2015, at 9:11 AM, Joshua Colp jc...@digium.com wrote:
 
 Justin Sherrill wrote:
 I would love to run Asterisk on a BSD system.  I do not know of any
 developers actively working on Asterisk on a BSD platform, though my
 knowledge isn't comprehensive.
 
 I'm also unaware of anyone developing on BSD like that. Linux of course and a 
 smattering of folks on OSX doing the odd thing.


/me is an odd developer occasionally doing odd things on OS X.

If anyone wants to improve Asterisk on any non-Linux system, a good place to 
start is to run it with some of the common developer flags enabled (pass 
--enable-dev-mode to configure, enable DO_CRASH, enable the TEST_FRAMEWORK and 
run the tests).

The increased warning level on GCC catches a few portability bugs, that are 
usually straightforward to fix. The tests can be harder, since you don’t know 
if it’s a problem in the test itself, or in Asterisk.

Unfortunately, I doubt the Python test suite would run on non-Linux. I don’t 
even bother trying to run it on Ubuntu; I have a CentOS VM specifically for 
running the test suite to avoid platform problems.

-- 
David M. Lee
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com http://www.digium.com/   www.asterisk.org 
http://www.asterisk.org/-- 
_
-- 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] Is Asterisk a Linux only system?

2015-02-12 Thread David M. Lee

 On Feb 12, 2015, at 10:42 AM, Matthew Jordan mjor...@digium.com wrote:
 
 On Thu, Feb 12, 2015 at 10:38 AM, David M. Lee d...@digium.com 
 mailto:d...@digium.com wrote:
 
 Unfortunately, I doubt the Python test suite would run on non-Linux. I don’t 
 even bother trying to run it on Ubuntu; I have a CentOS VM specifically for 
 running the test suite to avoid platform problems.
 
 
 It runs just fine on Debian based systems. Most issues you will run into are 
 just making sure the dependencies are set up correctly.
 
 It does require Python 2.6+ (recommended: Python 2.7 just in case something 
 has slipped in that we missed.) 
 


I was sure it would. But the instructions are for CentOS/EL, and I used up all 
of my sense of adventure just getting Asterisk running on OS X.

-- 
David M. Lee
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com http://www.digium.com/   www.asterisk.org 
http://www.asterisk.org/-- 
_
-- 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] AMI timeouts

2013-07-12 Thread David M. Lee

On Jul 11, 2013, at 2:40 AM, Alexander Frolkin a...@eldamar.org.uk wrote:

 The Java process has an AMI connection to Asterisk which it keeps open
 continuously.  When sending an AMI request, the process will wait a
 certain amount of time for a response (I think the timeout is 5 seconds)
 and if it hasn't received it, will retry the request up to 5 times.

Timeout based retries on AMI is probably going to be a problem.

AMI uses TCP, which has its own retry/retransmission logic. While the
TCP connection is alive, you can safely assume that the message is
either on its way to Asterisk, Asterisk is processing the message, or
the response is heading back to you.

Now if the TCP connection fails after you've sent a request, but
before you receive a response, then you really have no way of knowing
if the request was received/processed/rejected/etc. At that point, the
best you can do is reestablish the AMI connection and retry the
action.

 Occasionally, the Java process logs show AMI requests timing out (after
 5 tries).  What I see in packet captures of the AMI traffic is:
 
  1. Java process sends a request (e.g., add member to queue)

Do you see the TCP ACK coming back from Asterisk?

  2. Retries 5 seconds later
  3. Retries again 5 seconds later
  4. Retries again 5 seconds later
  5. Retries again 5 seconds later
  6. Logs a timeout
  7. After a few more seconds, Asterisk replies to all five requests
 in one go (in a single packet; so, e.g., for add member to queue
 it would reply success, then four failures because the member is
 already added); however at this stage, the Java process has given
 up

During the quiet period while you're waiting for the response, do you
receive events over that AMI connection? Are there other actions that
you're attempting to execute? Is there any consistency as to which
commands are getting delayed?

 It feels like Asterisk queues up the AMI responses and then
 periodically sends out all the responses in the queue in one go.  Is
 something like this going on?  Does the frequency at which Asterisk
 flushes the queue depend on load?  Are there any tunable in the config
 for this?

No, there's no response queue in Asterisk. For the action's I've
looked at, it pretty much immediately processes the request and sends
the response.

There are any number of reasons why the response would be delayed, but
the 25 seconds delay you're seeing is excessive for any of the
reasons I can think of. The resource you're using AMI to access may be
busy doing something else. Or the request is simply taking that long
to process. Packet loss could cause delays in getting responses, but
usually not for the lengths of times you're talking about.

I know it's not a lot of info, but hopefully you can turn up some
logging or packet captures to narrow down what's going on.

 Thanks in advance,
 
 Alex

-- 
David M. Lee
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com   www.asterisk.org


--
_
-- 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 11.3.0 - Mask for new file not correct

2013-04-29 Thread David M. Lee

On Apr 29, 2013, at 10:51 AM, Ludovic Boué wrote:

 The fact is we want to use the RECORDED_FILE function from Application_Record 
 module and create a file with 666 permissions. But when I check the created 
 file, rights are not what I expected.
 
 [root@STD1-SRVASTSVI-03 pseudos]$ ll
 -rw-r--r-- 1 asterisk asterisk 51244 mars 29 16:04 Pseudo_2_.wav
 
 I checked the doc on 
 https://wiki.asterisk.org/wiki/display/AST/Application_Record but I didn't 
 find anything about umask permissions. I checked Doxygen, I can see file 
 creation permissions is set to 666
 #define AST_FILE_MODE 0666
 http://doxygen.asterisk.org/trunk/asterisk_8h.html#a6293b2dae52a2b470494df672a26c42
 
 What can I do to fix that or debug?

The AST_FILE_MODE works by the same rules as mode parameter in open(2): The 
effective permissions are modified by the process's umask in the usual way: The 
permissions of the created file are (mode  ~umask).[1]

My guess is that the umask of your asterisk process is 022, which is very 
typical. You'll have to play around with your umask settings and file 
permissions to get things the way you want them.

 [1]: http://linux.die.net/man/2/open

 Ludovic BOUÉ

-- 
David M. Lee
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com   www.asterisk.org


--
_
-- 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] pipe character in CDR user field

2012-11-29 Thread David M. Lee
On Nov 29, 2012, at 3:54 AM, Vieri wrote:

 I'm trying to set a CDR userfield to a custom value. This value may contain a 
 '|' but it's really just part of the value.
 However, Asterisk keeps warning me about the application delimiter not being 
 a pipe.
 It's NOT an application delimiter (it's just part of a variable value) so I'm 
 expecting Asterisk not to warn me about it.
 Is it expected behavior?

Well, you certainly didn't expect it. I would not have expected it either :-D

 Why?

So, back in the early days, Asterisk inconsistently used different delimiters 
depending upon context. Sometimes it used pipes, sometimes commas. 
Inconsistency is never good, so we picked a winner (commas) and put in code to 
look for the loser (pipes) in the dial plan and warn if they show up. ('We' in 
this case would be Asterisk developers of long ago, by the way).

The code that does this checking[1] isn't the smartest code in the world. It 
basically looks at the data passed to the application, and if it contains a 
pipe, and no comma, and warnings are enabled, it warns you.

So you could disable warnings, but that would turn off other warnings that 
might be useful.

Another option would be a small hack in your dial plan: add a comma.

MSet(CDR(userfield)=|usr_r=vieri,PIPE_HACK=true) ; Asterisk warns if it 
sees a pipe without a comma.

Since you're not trying to use a pipe as a delimiter, displaying the warning is 
a mistake in Asterisk. The whole pipe/comma thing happened so long ago[2], it's 
time to just lose the warning altogether.

 [1]: 
https://code.asterisk.org/code/browse/asterisk/branches/11/main/pbx.c?u=3r=376690#to1583
 [2]: https://code.asterisk.org/code/changelog/asterisk?cs=188210

 See the following log:
 
 SIP/4053-007bAGI Rx  EXEC Set CDR(userfield)=|usr_r=vieri
-- AGI Script Executing Application: (Set) Options: 
 (CDR(userfield)=|usr_r=vieri)
 [Nov 29 10:53:08] WARNING[4815]: pbx.c:1563 pbx_exec: The application 
 delimiter is now the comma, not the pipe.  Did you forget to convert your 
 dialplan?  (Set(CDR(userfield)=|usr_r=vieri))
 SIP/4053-007bAGI Tx  200 result=0
 
 SIP/4053-007dAGI Rx  EXEC Set CDR(userfield)=\|usr_r=vieri\
-- AGI Script Executing Application: (Set) Options: 
 (CDR(userfield)=|usr_r=vieri)
 [Nov 29 10:54:57] WARNING[4838]: pbx.c:1563 pbx_exec: The application 
 delimiter is now the comma, not the pipe.  Did you forget to convert your 
 dialplan?  (Set(CDR(userfield)=|usr_r=vieri))
 SIP/4053-007dAGI Tx  200 result=0
 
 Thanks,
 
 Vieri

-- 
David M. Lee
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com   www.asterisk.org

--
_
-- 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] Questions about extension.conf

2012-11-29 Thread David M. Lee

On Nov 29, 2012, at 11:18 AM, Ron Wheeler wrote:

 That is a good answer.
 Thanks.
 Any reason why it is not documented?

It's documented on the Asterisk wiki:
  
https://wiki.asterisk.org/wiki/display/AST/Contexts,+Extensions,+and+Priorities

 Ron

-- 
David M. Lee
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com   www.asterisk.org

--
_
-- 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] AGI and AMI stuff.

2012-11-15 Thread David M. Lee

On Nov 15, 2012, at 10:54 AM, Ken D'Ambrosio wrote:

 Hey, all.  I'm interested in doing some simple, very specific web pages for 
 some of my users -- things like call groups, setting forwarding, and for the 
 receptionist to transfer calls and see calls.  Probably do this in Ruby or 
 PHP, though I'm open-minded.  Anyway, if someone could point me to some 
 documentation -- dead tree, electronic, whatever -- that gives some fairly 
 in-depth detail on this, I'd be most appreciative.

AGI commands and AMI actions and events are documented on the wiki - 
https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Command+Reference

The wiki also has command references for 1.8 and 10.

Asterisk: The Definitive Guide has good chapters on the protocols:

* Book - http://shop.oreilly.com/product/9780596517342.do
* AMI - http://ofps.oreilly.com/titles/9780596517342/asterisk-AMI.html
* AGI - http://ofps.oreilly.com/titles/9780596517342/AGI.html

There are client libraries that handle the protocol details for you. StarPy for 
Python is a fairly low-level wrapper around AMI/AGI. Adhearsion for Ruby is a 
fairly high level wrapper for building voice applications. I believe some exist 
for PHP, but I know nothing about them.

 Thanks!
 
 -Ken


Good luck!
-- 
David M. Lee
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com   www.asterisk.org

--
_
-- 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] AMI Permissions, all means different things?

2012-09-10 Thread David M. Lee
On Sep 10, 2012, at 2:38 AM, Johan Wilfer wrote:

 Thank you David for the feedback.
 
 I reported the following bugs:
 
 https://issues.asterisk.org/jira/browse/ASTERISK-20397 (all bug)
 https://issues.asterisk.org/jira/browse/ASTERISK-20396 (cropped col)

Thanks!
-- 
David M. Lee
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com   www.asterisk.org

--
_
-- 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] Async AGI

2012-09-10 Thread David M. Lee
On Sep 10, 2012, at 11:16 AM, Pavel Siderov wrote:

 Danny as I mentioned in the first message the dialplan execution stops after 
 AGI(agi:async). So the provided example doesn't help. 
 
 Regards,
 Pavel

Pavel,

This may be due to the asynchronous nature of Async AGI. The AGI(agi:async) 
command will continue to run until the channel is hung up, the 'asyncagi break' 
command is sent over AMI, or some sort of fatal error is encountered.

When a call comes in, the AGI(agi:async) command sill send out a start event 
over AMI. But if Adhearsion isn't there to hear it, it's also not there to tell 
Asterisk what to do with the channel. So it will sit there, waiting for a break 
or hangup.

I'm sure the Adhearsion guys have run into this sort of thing before. You may 
want to ask on their forum[1] for how they handle the situation.

 [1]: https://groups.google.com/forum/?fromgroups=#!forum/adhearsion

-- 
David M. Lee
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com   www.asterisk.org

--
_
-- 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] AMI Permissions, all means different things?

2012-09-07 Thread David M. Lee
On Sep 7, 2012, at 1:49 AM, Johan Wilfer wrote:

 Hi!
 
 I'm trying to limit the permissions for a AMI-account. But I'm a little bit 
 confused by the permissions. The commands I use are (output from manager 
 show commands, btw: privilege col seems cropped?):

Yes, sadly it is.

  Action   PrivilegeSynopsis
  Redirect call,all Redirect (transfer) a call.
  Originateoriginate,allOriginate a call.
  Getvar   call,reporting,  Gets a channel variable.
 
 
 If I put this in my manager.conf:
 
 [pbx_ami]
 secret = ***
 deny=0.0.0.0/0.0.0.0
 permit = x.x.x.x/255.255.255.255
 write=originate,call
 read=
 
 
 I get this (manager show user pbx_ami):
 
   username: pbx_ami
 secret: Set
acl: yes
  read perm: none
 write perm: call,originate,all
 displayconnects: yes
 
 Where does the all permission come from?

Probably just a bug in the 'manager show user' command. The user doesn't have 
all the permissions, so 'all' shouldn't show up in the list. If it's not 
already in the issue tracker, please file a bug[1].

 [1]: https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines

 However, If I change the row in manager.conf to write=originate,call,all 
 the output is:
 
   username: pbx_ami
 secret: Set
acl: yes
  read perm: none
 write perm: 
 system,call,log,verbose,command,agent,user,config,dtmf,reporting,cdr,dialplan,originate,agi,cc,aoc,test,all
 displayconnects: yes
 
 Can someone explain this please?

This is at least looks correct. The 'all' permission is a superset of, well, 
all the permissions. The 'write=all' line in manager.conf assigns all of these 
permissions to the user.

 Thanks!
 
 -- 
 Johan Wilfer

-- 
David M. Lee
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com   www.asterisk.org


--
_
-- 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