Manager's Events fail to report useful real-time information

Hi guys,

(I’m using asterisk server 1.2.7.1 extracted from source, and asterisk-java 0.3-m1)

I’m developing a Java GUI to show in real-time what is happening with the active channels on the asterisk server. I want to show each channel ringing, dialing, up, hungup, as soon as the state changes. I also need to show accurately what channel dialed to what channel, the phone numbers of each channel and what channel is being charged by the call. I’m using the Events sent by the manager interface to get the real-time info.

But my tests are showing the Events sent by the manager cannot report clearly what the asterisk server is actually doing. The Events get particularly confusing whenever a channel masquerading process is involved.

My GUI application is aimed for the regular end-user, so it need to be able to show for the user information like this: “Extension 3025 is dialing extension 3026” and “Extension 3026 is ringing (receiving a call from extension 3025)”. After the person on the extension 3026 answers the phone, I need to show “Extension 3025(being charged) is talking to 3026”.

This should be simple to accomplish but when the Local channels are involved, the Events issued by the asterisk server are totally meaningless.

I have some ideas of how these events could be more meaningful so I’ll show some Events bellow and I’ll give my suggestions of how they could be more meaningful.

In this example, the asterisk server dials extension 3026 and transfers the call to extension 3025. For doing this, it creates 2 Local channels, 1 dials to 3025, after the person at 3025 answers, the other channel dials to 3026. When the person at 3026 answers the call the Local channel that dialed 3025 is masqueraded into 3026.

The first two events are these “Newchannel” bellow:

Event: Newchannel
Privilege: call,all
Channel: Local/3025@agente_out-6caa,2
State: Ring
CallerID:
CallerIDName:
Uniqueid: 1161291771.918
Server: localhost

Event: Newchannel
Privilege: call,all
Channel: Local/3025@agente_out-6caa,1
State: Down
CallerID:
CallerIDName:
Uniqueid: 1161291771.917
Server: localhost

Why are they meaningless? Because they don’t tell what were they created for.

They should state, somehow, that they were created because 3025 will talk to 3026, and 3025 will be charged.
If the Account header showed up, we could say what extension is on charge.
Also, if the Originate-Channel and Originate-Exten (headers used on the Originate action that created these channels) showed up, we could affirm which extension is calling which one.

Without this information these Newchannel Events are empty of “human-useful” information. The “real-time” goal is defeated. A developer will only find some useful information after he strove to make sense from the bunch of subsequent Events thrown.

Also on this case, after the masquerade process finished, by following the events, it seems that extension 3026 dialed to 3025, not the opposite. Although this is technically correct, this is not what a human needs to know about this call.

If at least the Events showed the Account header, we could tell who is being charged by the call.

And by following the Events, the ending channel SIP/3026 (former Local/3025@agente_out-6caa,2) stays with the callerId 3025, instead of 3026. I believe the manager Interface should issue a Newcallerid to inform this change.

I’d like to know from you what do you think about these points and how are you dealing with these difficulties.

Thank you.

About the callerId is not being notified after the masquerading process, I was inspecting the code of ast_do_masquerade() (from channel.c) and I saw it does not use the ast_set_callerId() to change the callerId of the cloned channel, this way nobody following the Events were notified about this change.

The lines in ast_do_masquerade() that change the callerId directly are pasted bellow:

03237 /* Just swap the whole structures, nevermind the allocations, they’ll work themselves
03238 out. */
03239 tmpcid = original->cid;
03240 original->cid = clone->cid;
03241 clone->cid = tmpcid;

Why not sending a Newcallerid Event right here?

thank you,
bruno