Summary:ASTERISK-06685: Peer registration timeout doesn't send manager event
Reporter:Wojtek Kaniewski (wojtekka)Labels:
Date Opened:2006-04-03 08:52:45Date Closed:2006-04-04 11:16:06
Versions:Frequency of
Environment:Attachments:( 0) 2chan_iax2.c.diff
( 1) chan_iax2.c.diff
Description:I've been playing with manager API for a while and noticed, that IAX2 peers registration timeout is impossible to detect without using IAXpeers action. For SIP peers I get:

   Event: PeerStatus
   Privilege: system,all
   Peer: SIP/1019
   PeerStatus: Unregistered
   Cause: Expired

but no similar information for IAX2 peers.


I've compared both channel drivers -- function expire_register() in chan_sip.c and __expire_registry() in chan_iax2.c. The former calls:

   manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: SIP/%s\r\nPeerStatus: Unregistered\r\nCause: Expired\r\n", peer->name);

but the latter doesn't do anything like this. Adding the following line helped:

   manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: IAX2/%s\r\nPeerStatus: Unregistered\r\nCause: Expired\r\n", p->name);

There's no disclaimer, because the code isn't mine. It's a trivial one-line copy and paste modification.
Comments:By: Andrey S Pankov (casper) 2006-04-03 15:21:37

Look at update_registry()... The event is there...

By: Wojtek Kaniewski (wojtekka) 2006-04-03 15:51:30

The event in update_registry() is AFAIK sent when the peer _requests_ unregistration. When the client is closed properly, everything's fine. But when there's a network failure or client dies unexpectedly, the listener of manager events won't be aware of that.

By: Andrey S Pankov (casper) 2006-04-03 16:13:58

I come again with ONE BIG SUPER-PATCH, sorry... Disclaimer is on file.

By: Wojtek Kaniewski (wojtekka) 2006-04-04 04:00:10

"Cause: Expired" would be nice.

By: Andrey S Pankov (casper) 2006-04-04 09:26:05

Happy now? :)

By: Wojtek Kaniewski (wojtekka) 2006-04-04 10:43:14

Seems fine to me (-:

By: Matt O'Gorman (mogorman) 2006-04-04 11:15:52

Committed revision 17311.

By: Matt O'Gorman (mogorman) 2006-04-04 11:16:05

feature added to trunk