Dev-scatch

From 탱이의 잡동사니
Jump to: navigation, search

Overview

Simple development scatch for myself.

Asterisk

POST /channels/<channelId>/dtmf doing wrong

When it's getting the negative duration/between, it doesn't accept the call hangup.

POST /channels codec not in order

When the ARI application originating the channel with ARI, it doesn't respect the codec order in /etc/asterisk/pjsip.conf file.

Fixing Dial event

For the first Dial ARI event, it comes with dialstate: "", always.

This should be fixed to dialsatate: "initial" something.

The Dial application doesn't send the DialEnd event.


This is fine. It was already explained.

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;
	}