[asterisk-dev] MusicOnHold start/stop event.

Chris Maciejewski chris at wima.co.uk
Sat Jun 21 05:30:52 CDT 2008


Hi,

Can someone please verify my code below, and if it looks OK commit to 
the trunk?

Regards,
Chris

---------%<-----------------------------------------------------------------------------------------
Index: res/res_musiconhold.c
===================================================================
--- res/res_musiconhold.c    (revision 124504)
+++ res/res_musiconhold.c    (working copy)
@@ -62,6 +62,7 @@
 #include "asterisk/cli.h"
 #include "asterisk/stringfields.h"
 #include "asterisk/linkedlists.h"
+#include "asterisk/manager.h"
 
 #define INITIAL_NUM_FILES   8
 
@@ -1289,7 +1290,13 @@
 
     if (!mohclass)
         return -1;
-
+   
+    manager_event(EVENT_FLAG_CALL, "MusicOnHold",
+        "State: Start\r\n"
+        "Channel: %s\r\n"
+        "UniqueID: %s\r\n",
+        chan->name, chan->uniqueid);
+   
     ast_set_flag(chan, AST_FLAG_MOH);
     if (mohclass->total_files) {
         return ast_activate_generator(chan, &moh_file_stream, mohclass);
@@ -1309,6 +1316,12 @@
             chan->stream = NULL;
         }
     }
+   
+    manager_event(EVENT_FLAG_CALL, "MusicOnHold",
+        "State: Stop\r\n"
+        "Channel: %s\r\n"
+        "UniqueID: %s\r\n",
+        chan->name, chan->uniqueid);
 }
 
 static int load_moh_classes(int reload)
---------%<-----------------------------------------------------------------------------------------



More information about the asterisk-dev mailing list