Dev-scatch

From 탱이의 잡동사니
Revision as of 13:53, 15 April 2019 by Pchero (Talk | contribs) (Asterisk)

Jump to: navigation, search

Overview

Simple development scatch for myself.

Asterisk

Make reason for mandatory

Currently, the Asterisk doesn't set the reason field as a requirement. It makes hard to use the ChannelHangupRequest and ChannelDestroyed event.

Add more Hangup reason

  • Currently, DELETE /ari/channels/<channelID> supports only few hangup reason.

res/ari/resource_channels.c

	if (ast_strlen_zero(args->reason) || !strcmp(args->reason, "normal")) {
		cause = AST_CAUSE_NORMAL;
	} else if (!strcmp(args->reason, "busy")) {
		cause = AST_CAUSE_BUSY;
	} else if (!strcmp(args->reason, "congestion")) {
		cause = AST_CAUSE_CONGESTION;
	} else if (!strcmp(args->reason, "no_answer")) {
		cause = AST_CAUSE_NOANSWER;
	} else if(!strcmp(args->reason, "answered_elsewhere")) {
		cause = AST_CAUSE_ANSWERED_ELSEWHERE;
	} else {
		ast_ari_response_error(
			response, 400, "Invalid Reason",
			"Invalid reason for hangup provided");
		return;
	}