[Asterisk-java-users] Missing events through the manager
Brought to you by:
srt
From: Gaëtan M. <gm...@ea...> - 2008-05-23 16:46:26
|
Hi Stefan I'm running across a problem I never noticed before with asterisk. I think it worked as expected with asterisk 1.2 but seems to have changed somewhere between 1.4 and 1.4.11. The problem I'm facing is related to outgoing legs from queues, where the caller ID is (now ?) missing in the live API's channel object. This is most probably a problem on the asterisk side (although as the manager api is not officially documented I can't really blame them). When a leg (with a correct caller id) arrives in a queue, except usual queue events, here is what I see on the manager: 1/ One event for a new channel to the queue member, sate down and caller id unknown Event: Newchannel. Privilege: call,all. Channel: SIP/1002-09829228. State: Down. CallerIDNum: <unknown>. CallerIDName: <unknown>. Uniqueid: 1211559337.1. 2/ NewState event when the outboud leg starts to ring Event: Newstate. Privilege: call,all. Channel: SIP/1002-09829228. State: Ringing. CallerID: 1001. CallerIDName: TESTQUEUE:Gaetan Minet. Uniqueid: 1211559337.1. (Following events are useless). So there is no newCallerId event and as a consequence the live api never updates the channel information. In the past (pre-1.4) , iirc, we got a newcallerid event between (1) and (2). I don't know if the real problem is - the "unknown" in (1) (Maybe asterisk sends the event before the callerid is set on the channel ??) , - the missing newcallerid event between (1) and (2) that I thing I received with 1.2.x - or simply maybe the newstate event setting the caller id is the expected behavior for recent asterisk. Has someone already encountered this ? As a workaround, could we modify the live api to compare the current callerid recrded in the channel with the callerid received in a newstate event, and update the channel if necessary (thus firing a PCE on the channel too), or even generate and handle a virtual "newcallerid" even ? Any clue ? Thanks Kind regards Gaetan NB: Just saw this in the ChannelManager.java, maybe you already had to face a similar problem ? Maybe just ignoring the event (1) could also fix the problem then ? AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId()); if (channel == null) { // NewStateEvent can occur instead of a NewChannelEvent channel = addNewChannel( event.getUniqueId(), event.getChannel(), event.getDateReceived(), event.getCallerIdNum(), event.getCallerIdName(), ChannelState.valueOf(event.getChannelState()), null /* account code not available */); } |