[Home]

Summary:ASTERISK-02089: [Patch] add manager events in sip and IAX. Back port from chan_sip2x.c.
Reporter:Matthias Endler (endler)Labels:
Date Opened:2004-07-22 17:34:56Date Closed:2008-01-15 15:07:38.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) chan_sip.c_manager_patch_corrected.txt
( 1) iax2_notifications.patch
( 2) notifications.txt
( 3) sipmgr.txt
Description:These patches adds the following manager events to chan_sip.c and chan_iax2:

PeerRegistration
PeerStatus
Registry

Original work was done by Olle Johansson in chan_sip2x.c, I just did the typing for the back port to sip_chan.c :).
Comments:By: Mark Spencer (markster) 2004-07-22 19:34:33

Something is wrong with this patch.  It shouldn't be 267k to add three manager events.

By: Matthias Endler (endler) 2004-07-22 20:34:03

Sorry my fault! I should have noticed the size of the patch. Used the wrong version to diff.

By: schurig (schurig) 2004-07-23 03:15:13

Sometimes you use

  Peer: xxxxx

and sometimes you use

  Peername. xxxxx

edited on: 07-23-04 07:00

By: schurig (schurig) 2004-07-23 05:46:10

There is now a sipmgr.txt after talking over details of the names with 'oej' on asterisk-users and #asterisk-dev

edited on: 07-23-04 07:00

By: Olle Johansson (oej) 2004-07-23 05:49:30

The new patch takes away "SIP" from the event names, making it more generic. Anyone that wants to implement this in IAX2?

By: nicolasg (nicolasg) 2004-07-28 19:11:37

My attempt to add notifications for IAX2. As I do not use IAX2 clients myself it is not well tested, and it also might be incomplete. I think this patch belongs here in spite the category.

By: Olle Johansson (oej) 2004-08-08 15:55:22

Anyone tested these patches? Feedback? Are they ready for cvs?

By: nicolasg (nicolasg) 2004-08-09 13:58:35

I'm using both patches without ill effects. A couple of comments: the events are usefull, but I still need to issue a 'sip show peers' to fetch initial status from the manager. Maybe we can add manager events to the show_peers command both for sip or iax. Another comment: if you have hundreds of peers, the events will be too many, maybe we can add a keyword to manager.conf to filter registration/reachability events for those users that don't need them.

By: Olle Johansson (oej) 2004-08-14 16:48:30

nicolasg: I don't understand why you need a "sip show peers" for the initial status? Please explain more.

How would a filter work? A linked list of regular expressions for [peer] names? Or a filter on IP adresses? Or a flag in the [peer] definition? The latter is much easier and not so resourceful.

If in manager.conf, we need to create a standard function in manager.c that can be called from chan_iax2 and chan_sip. But first, we need to find out what kind of filter is needed and the price for that.

By: nicolasg (nicolasg) 2004-08-19 19:08:59

Hi Oej, sorry for the delay.

When I connect to the manager with my application, I need to know the status of each peer. The only way to do it now is using 'sip show peers'. It would be nice to add the peer status information in the reply when you send a 'status' request to the manager. If I dont send the initial status request, I do not know what peers are available or not until one of the events is dispatched. If a peer is offline, I do not receive any events. The event is only sent when the status changes.

About the filter, the problem is my limited english and my lazyness when reading the code. I meant to have a new 'flag' (EVENT_FLAG_XXX). The flags are already implemented, you can have read/write access control to events based on those flags, and you can filter events based on them using the manager commnad 'Events'.

The flags already defined are: system,call,log,verbose,command,agent,user

The patches use the flag 'call', that I believe is incorrect. Maybe its better to use 'user' or 'log', and not create a new flag. I see that the 'user' flag is not used at all, its just there.

My propossal is to change the flag of the events, and add another way to request initial status by creating a new manager command or extending an existing one, maybe 'ExtensionState' that I hardly understand what it is for..

By: Mark Spencer (markster) 2004-09-15 15:42:41

Last two sip/iax patches look fine, have these been properly disclaimed?

By: Olle Johansson (oej) 2004-09-15 15:57:20

My part of the work (chan_sip) is disclaimed.

By: nicolasg (nicolasg) 2004-09-15 16:59:04

Mi part (IAX) is also disclaimed. I'm running both patches without problems.

But should'nt we change the FLAG to be EVENT_FLAG_LOG or EVENT_FLAG_USER instead of using EVENT_FLAG_CALL?

edited on: 09-15-04 16:59

By: Mark Spencer (markster) 2004-09-15 17:06:11

I'd say USER or SYSTEM probably, definitely not call, yah.  Do you want a new category?  Anyway, if you can get this updated (mind as well combine the sip and iax ones together) i'll go ahead and get it applied as soon as possible.

By: nicolasg (nicolasg) 2004-09-15 17:45:32

Ok, I will put together both patches tonight and change the flag to: USER or SYSTEM?

On SYSTEM we have shutdown and reload events, and zap alarms.
On USER there is no events defined.

Just let me know where do you want them to be...

By: Mark Spencer (markster) 2004-09-15 17:46:16

SYSTEM seems fine, if alarms are going there.  This would be something along those lines.

By: nicolasg (nicolasg) 2004-09-15 21:02:15

Merged SIP and IAX patches and updated to use EVENT_FLAG_SYSTEM and apply cleanly to current CVS.

By: Mark Spencer (markster) 2004-09-16 12:17:53

Added to CVS, thanks!

By: Philipp Kolmann (pkolmann) 2004-09-16 13:55:46

Reminder sent to markster

Hi!

just did a cvs update and now the chan_sip.c has some bugs in compilation:

make[1]: Entering directory
`/home/admin/swadmin/asterisk/asterisk/channels'
gcc -pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g  -Iinclude -I../include -I/pd/asterisk/usr/include -D_REENTRANT -D_GNU_SOURCE  -O6 -march=i686   -DZAPTEL_OPTIMIZATIONS  -DASTERISK_VERSION=\"CVS-HEAD-09/15/04-09:46:48\" -DINSTALL_PREFIX=\"/pd/asterisk\" -DASTETCDIR=\"/pd/asterisk/etc/asterisk\" -DASTLIBDIR=\"/pd/asterisk/usr/lib/asterisk\" -DASTVARLIBDIR=\"/pd/asterisk/var/lib/asterisk\" -DASTVARRUNDIR=\"/pd/asterisk/var/run\" -DASTSPOOLDIR=\"/pd/asterisk/var/spool/asterisk\" -DASTLOGDIR=\"/pd/asterisk/var/log/asterisk\" -DASTCONFPATH=\"/pd/asterisk/etc/asterisk/asterisk.conf\" -DASTMODDIR=\"/pd/asterisk/usr/lib/asterisk/modules\" -DASTAGIDIR=\"/pd/asterisk/var/lib/asterisk/agi-bin\"     -DBUSYDETECT_MARTIN      -Wno-missing-prototypes -Wno-missing-declarations   -DZAPATA_PRI   -DIAX_TRUNKING   -DCRYPTO -fPIC    -c -o chan_sip.o chan_sip.c
chan_sip.c: In function `sip_reg_timeout':
chan_sip.c:4023: warning: implicit declaration of function `regstate2str'
chan_sip.c:4023: warning: format argument is not a pointer (arg 5)
chan_sip.c: At top level:
chan_sip.c:5681: warning: `regstate2str' was declared implicitly `extern' and later `static'
chan_sip.c:4023: warning: previous declaration of `regstate2str'
chan_sip.c:5681: warning: type mismatch with previous implicit declaration
chan_sip.c:4023: warning: previous implicit declaration of `regstate2str'
chan_sip.c:5681: warning: `regstate2str' was previously implicitly declared to return `int'
gcc -shared -Xlinker -x -o chan_sip.so chan_sip.o
make[1]: Leaving directory `/home/admin/swadmin/asterisk/asterisk/channels'

Thanks
Philipp


By: Digium Subversion (svnbot) 2008-01-15 15:07:38.000-0600

Repository: asterisk
Revision: 3792

U   trunk/channels/chan_iax2.c
U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r3792 | markster | 2008-01-15 15:07:38 -0600 (Tue, 15 Jan 2008) | 2 lines

Add IAX2/SIP register events to system (bug ASTERISK-2089)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=3792