[asterisk-users] Debugging Asterisk

Atis Lezdins atis at iq-labs.net
Mon Nov 17 09:08:21 CST 2008


On Mon, Nov 17, 2008 at 10:26 AM, Mikel Lindsaar <raasdnil at gmail.com> wrote:
> Hello all,
> Two questions:
> 1) What do people on the list do to debug phone quality issues.  Phone
> quality seems to be a very subjective thing.  But are there metrics that you
> can work against?  Like maybe generating a tone and measuring the return
> quality etc?  It looks like all trial and error right now.  If that is the
> way it is, then fine.  But anything more accurate / scientific?

For this you should search RTCP, recently there was a topic here. It's
not perfect, but at least gives you some data.

> 2) Also wondering what people do when parsing asterisk verbose output in the
> log.  Specifically, following a certain call.  Asterisk's verbose output
> logs in sequence of action, which is good, but if you have 40-50
> workstations going at once, tracking the progress of one call you are trying
> to make can be difficult.  Obviously you can follow the channel as it goes
> through.  But I am wondering if there is a smarter way, like telling
> asterisk to only log on certain numbers etc.
> Any hints or tricks on this would be appreciated.

For me, the trick is to pass uniqueid from first channel down to child
channels. So, in child channels all you have to do, is print inherited
id. For example, this should do:

context incoming {
  _X. => {
    Set(__call_id=${UNIQUEID});
    // do whatever
  }
}

context queue_ring {
  _X. => {
    Verbose(${call_id});
    // ring agent
  }
}

So, for example queue creates child channel, which lives in separate
thread, but it will at beginning display parent's call_id.

As i do also register that call_id with CDR, my call log viewer allows
also to click on call_id and open new window with full log of this
call.

But anyway, as soon as you've found out call_id, you can do:

1) grep on log for this call_id
  # cat  /var/log/asterisk/full | grep 1234567890.123 > /tmp/callid.txt
2) sort results, and get ony process id's of threads:
  # cat /tmp/callid.txt | grep -o -P
"(?:ERROR|WARNING|VERBOSE|DEBUG)\[([0-9]*)\]" | grep -o "\[[0-9]*\]" |
uniq | sort | uniq > /tmp/callid_pids.txt

So, now you have all unique process id's involved in this call.
Now you can do:

  # cat  /var/log/asterisk/full | grep -F -f /tmp/callid_pids.txt >
callid_$1.log

Well, that's the genera, in result you get file containing log only
for one call. Then this can be improved by adding date filters (one
"full" file might contain repeating call id's). Also if using log
rotating, you'll have to find out in which log this call is, and then
do a "zcat" on compressed logs.

Also, i've heard that this approach of one uniqeid for all child
channels has been committed in trunk, it's called "linked_id" there.

Regards,
Atis

-- 
Atis Lezdins,
VoIP Project Manager / Developer,
atis at iq-labs.net
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835



More information about the asterisk-users mailing list