Dev-scatch: Difference between revisions

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


=== Add more Hangup reason ===
=== Add more Hangup reason ===
* Currently, DELETE /ari/channels/<channelID> supports only few hangup reason.
Currently, DELETE /ari/channels/<channelID> supports only few hangup reason.


res/ari/resource_channels.c
res/ari/resource_channels.c

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>