Page 1 of 1

SIP Registration log

PostPosted: Tue Feb 24, 2015 3:49 pm
by klept24
Hi,

Is it possible in CLI to show only the SIP Registration when a phone is being registered or being unregistered. Or any script showing only the SIP Registration.

Thanks!

Re: SIP Registration log

PostPosted: Thu Feb 26, 2015 9:25 am
by mav2287
Go to the command line and put in the following
Code: Select all
grep 'Registered SIP' /var/log/asterisk/messages
That will go through your log and only show you all the lines where "Registered SIP" appeared in the log. Keep in mind that is only going to show within the time frame the log has. For example when I ran it I only had back to Feb 1, because that is the start of my log on that server. This can also be used to get just about anything you want out of a log just change out 'Registered SIP' for whatever you are looking for. In my case you are using something other than SIP phones you can change SIP out for IAX or whaterver you are looking for. Using just Registered all by itself brings up all kinds of log items that are not phones.

You can also use
Code: Select all
grep --after-context=1 --before-context=1 'Registered SIP' /var/log/asterisk/messages
In this case it will give you the line prior to the search phrase in the log and the line after the search phrase in the log. This is useful if you looking for an event and you are looking for cause and result. You can just change the 1's to however many lines you want before the search result "--before-context" or however many you want after the search result "--after-context"

Hope this helps!

Re: SIP Registration log

PostPosted: Tue Mar 03, 2015 9:26 am
by klept24
Do you have any idea of what script that is responsible for generating the logs on /var/log/asterisk/full, because we need to insert it to database for reporting purposes.

Thanks

Re: SIP Registration log

PostPosted: Tue Mar 10, 2015 3:56 pm
by mav2287
Not sure I think it takes place on the asterisk side.

Re: SIP Registration log

PostPosted: Tue Mar 10, 2015 4:32 pm
by williamconley
klept24 wrote:Do you have any idea of what script that is responsible for generating the logs on /var/log/asterisk/full, because we need to insert it to database for reporting purposes.

Thanks

/etc/asterisk/logger.conf

you can create a new log with any content in it that you like (by category, of course, not down to which events occur)

when we're curious about this, we run a 5 minute script that checks this way:

Code: Select all
asterisk -rx "sip show registry"

and/or
Code: Select all
asterisk -rx "sip show peers"

performing this in php and then parsing the resulting array for specific entries is fairly easy. we have a watch script that does this and creates DB entries every 5 minutes just before another script checks to see if everyone who belongs in that table is there (and sends an email if one disappears, and a text message if they aren't back within six minutes, allowing for reboots).

Re: SIP Registration log

PostPosted: Thu Mar 12, 2015 8:00 am
by richardroi
Hi Sir William, any chance of sharing the script?

Thank you.

Re: SIP Registration log

PostPosted: Thu Mar 12, 2015 12:52 pm
by williamconley
This one is proprietary (has some information in it that's rather sensitive ...). And there's more than one script involved (two scripts and a table). But they are tiny scripts. We may be able to remove the sensitive data and post them at some point. Or perhaps pieces of them if you can't quite complete yours without problems.

Re: SIP Registration log

PostPosted: Thu Mar 12, 2015 1:31 pm
by richardroi
Thank you sir William.