Asterisk ERROR astobj2.c: user_data is NULL

@david551 is right in that fixing the issue where the forward fails would prevent the error from occurring. That being said, I think the continual errors that occur after failing to forward the Local channel occur are due to an improperly handled off-nominal condition.

I took a look at the log statement just prior to the errors being reported from astobj2:

	if (ast_call(o->chan, stuff, 0)) {
		ast_log(LOG_NOTICE, "Forwarding failed to dial '%s/%s'\n",
			tech, stuff);
		do_hang(o);
		numnochan++;
	}
}

ast_channel_publish_dial(qe->chan, o->chan, stuff, NULL);
ast_channel_publish_dial_forward(qe->chan, original, o->chan, NULL,
	"CANCEL", ast_channel_call_forward(original));

You can see that if we log out Forwarding failed to dial ..., we immediately hangup the o channel:

static void do_hang(struct callattempt *o)
{
	o->stillgoing = 0;
	ast_hangup(o->chan);
	o->chan = NULL;
}

Note that o->chan is now NULL.

Immediately after this, we attempt to raise events about the now cancelled dial:

	ast_channel_publish_dial(qe->chan, o->chan, stuff, NULL);
	ast_channel_publish_dial_forward(qe->chan, original, o->chan, NULL,
		"CANCEL", ast_channel_call_forward(original));

Those function calls are going to try and interact with o->chan, which is now quite NULL.

Please file a bug report for this, as there should be enough information in your CLI snippet to figure out what is happening. Attaching a full log, along with your queues.conf and extensions.conf, however, would be appreciated, as it will make verifying that I’m right a lot easier :slight_smile: