Dev-scatch: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
(Created page with "== Overview == Simple development scatch for myself. == Asterisk == === Make reason for mandatory == Currently, the Asterisk doesn't set the reason field as a requirement. It...")
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:


== Asterisk ==
== Asterisk ==
=== Make reason for mandatory ==
=== 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.
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
<source lang=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;
}
</source>


[[category:etc]]
[[category:etc]]

Revision as of 14:19, 15 April 2019

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 <source lang=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; } </source>