+static void send_talking_event(struct ast_channel *chan, struct ast_conference *conf, struct ast_conf_user *user, int talking)
+{
+ ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeTalking",
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n"
+ "Meetme: %s\r\n"
+ "Usernum: %d\r\n"
+ "Status: %s\r\n",
+ chan->name, chan->uniqueid, conf->confno, user->user_no, talking ? "on" : "off");
+}
+
+static void set_user_talking(struct ast_channel *chan, struct ast_conference *conf, struct ast_conf_user *user, int talking, int monitor)
+{
+ int last_talking = user->talking;
+ if (last_talking == talking)
+ return;
+
+ user->talking = talking;
+
+ if (monitor) {
+ /* Check if talking state changed. Take care of -1 which means unmonitored */
+ int was_talking = (last_talking > 0);
+ int now_talking = (talking > 0);
+ if (was_talking != now_talking) {
+ send_talking_event(chan, conf, user, now_talking);
+ }
+ }
+}
+