# # patch "channel.c" # from [df9a85d9eece1117aa16d1ebc676a1e92bc93aa2] # to [53257e8b3ac7024cf2daae31119a4223bec16518] # --- channel.c +++ channel.c @@ -966,6 +966,7 @@ int ast_hangup(struct ast_channel *chan) { int res = 0; + char *exit_status = NULL; /* Don't actually hang up a channel that will masquerade as someone else, or if someone is going to masquerade as us */ ast_mutex_lock(&chan->lock); @@ -1022,13 +1023,26 @@ ast_log(LOG_DEBUG, "Hanging up zombie '%s'\n", chan->name); ast_mutex_unlock(&chan->lock); - manager_event(EVENT_FLAG_CALL, "Hangup", - "Channel: %s\r\n" - "Uniqueid: %s\r\n" - "Cause: %d\r\n", - chan->name, - chan->uniqueid, - chan->hangupcause); + if(!(exit_status = pbx_builtin_getvar_helper(chan, "ExitStatus"))) { + manager_event(EVENT_FLAG_CALL, "Hangup", + "Channel: %s\r\n" + "Uniqueid: %s\r\n" + "Cause: %d\r\n", + chan->name, + chan->uniqueid, + chan->hangupcause); + } else { + manager_event(EVENT_FLAG_CALL, "Hangup", + "Channel: %s\r\n" + "Uniqueid: %s\r\n" + "Cause: %d\r\n" + "ExitStatus: %s\r\n", + chan->name, + chan->uniqueid, + chan->hangupcause, + exit_status); + + } ast_channel_free(chan); return res; }