Summary:ASTERISK-07309: [branch] New channel state transition to "Ringing" erroneously reported as Newchannel event
Reporter:capouch (capouch)Labels:
Date Opened:2006-07-08 18:12:16Date Closed:2006-11-07 17:49:55.000-0600
Versions:Frequency of
Environment:Attachments:( 0) bug-7745.patch
Description:When Asterisk is setting up a new channel as part of the Dial command, the channel-aborning is first reported in state down.  As the channel makes the transition to "Ringing" the manager interface incorrectly reports this as a "Newchannel" event.


I have talked with Russell on this; he concurs it is a bug and is working on a fix.

It appears to affect all versions.
Comments:By: Serge Vecher (serge-v) 2006-07-10 08:59:10

wasn't that change done in trunk?

By: Russell Bryant (russell) 2006-08-05 04:03:40

Fixed in 1.2 and the trunk in revisions 38982 and 38994, Thanks!

By: Russell Bryant (russell) 2006-08-17 11:39:51

I have reverted the change I made to try to fix this, as it was completely bogus.  It caused half of the channels not to get "Newchannel" events at all.  :(

By: Moises Silva (moy) 2006-09-01 14:13:52

Patch with a quick hack to fix this issue in asterisk-1.2.11 uploaded. I will be working tonight in trying to implement Russell suggestion to fix it in trunk.

By: Moises Silva (moy) 2006-09-01 14:14:51

i forgot: disclaimer already signed and faxed :)

By: Serge Vecher (serge-v) 2006-10-02 15:52:55

moy: any luck with a better patch here?

By: Moises Silva (moy) 2006-10-02 16:27:43

serge-v: I must confess im afraid of doing russell changes into trunk, so many code in Asterisk currently makes use of ast_channel_alloc() that I dont think I have enough knoledge to not break something, specially on technologies I have not used like chan_skinny, chan_mgcp etc. I think the best approach would be post in asterisk-dev for more opinions on this.


By: Steve Murphy (murf) 2006-11-02 08:09:41.000-0600

What's the status here?

By: Russell Bryant (russell) 2006-11-02 08:19:42.000-0600

The status is that it still needs to be fixed.  :)

The patch proposed here for 1.2 is a potential way to fix the issue without any API changes.

The solution I proposed for 1.4 and trunk is that ast_channel_alloc() be changed to pass the channel's name as an argument instead of the name getting set by the calling function after the channel is allocated.     This is the ideal place to send the NewChannel event since it is called for every channel that is created.  Not having the channel name available is the only reason why we can't do it yet.  Once this change is made, the NewChannel event should not be sent from anywhere else in the code.

By: Steve Murphy (murf) 2006-11-02 09:23:24.000-0600

OK, then, armed with this basic knowledge, a proposed patch, and a ton of naivete, I hereby sally forth to deal death and destruction to this bug.

By: Steve Murphy (murf) 2006-11-03 10:00:04.000-0600

Holy moly! what did I get myself into? I'm almost done.

By: Olle Johansson (oej) 2006-11-04 11:56:53.000-0600

murf: Please add the address of your branch for review...

By: Steve Murphy (murf) 2006-11-04 12:42:19.000-0600

branches are:

svn/asterisk/team/murf/bug_7506  (trunk)
svn/asterisk/team/murf/bug_7506_1.4  (1.4)
svn/asterisk/team/murf/bug_7506_1.2  (1.2)

At this moment, trunk and 1.4 branches are updated. trunk seems to work;
1.4 is compiling, but not tested yet. 1.2 is different enough, that the
implementation needs to be done from scratch; I've only just started that.

By: Steve Murphy (murf) 2006-11-06 12:27:25.000-0600

OK, All 3 branches are committed and ready for merge. It'd be nice for somebody besides myself to review the mods and test them, etc. Before I merge them to their respective branches. I'll take a day of silence, and then commit them tomorrow, in the perhaps vain hope that somebody has the time to check this out.

By: Nic Bellamy (nic_bellamy) 2006-11-06 15:18:22.000-0600

Tested on 1.2 branch - SIP phone calling via Asterisk to a SIP provider.

Only difference in manager output, ignoring channel names and unique IDs, is:

--- typescript-pre-7506 2006-11-07 09:34:47.000000000 +1300
+++ typescript  2006-11-07 09:34:49.000000000 +1300
@@ -47,7 +47,7 @@
Uniqueid: bbbbbbbbbb.b
CID-CallingPres: 0 (Presentation Allowed, Not Screened)

-Event: Newchannel
+Event: Newstate
Privilege: call,all
Channel: SIP/provider-xxxx
State: Up

Looking good so far.

By: Steve Murphy (murf) 2006-11-07 17:49:16.000-0600

OK, I've committed my changes.

1.2 = 47274 (just the patch applied).
1.4 = 47303 (modified ast_channel_alloc())
trnk= 47290 (same as 1.4)

By: Steve Murphy (murf) 2006-11-07 17:49:54.000-0600

TIme to close this bug.