Dev-scatch
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>