i'd like to know if there's a much cleaner way to know if a specific chan is on hold.<br>The goal behind is simpler: make a new CLI command to list all the channels that are currently on hold.<br><br>Based on that, i could use the ast_channel struct with music_state, since all on hold starts it, right (if res_musiconhold.so is loaded) ?
<br>Something like:<br>if ( chan->music_state) {<br> //the call is onhold<br>}<br><br>if yes, I've noticed the chan->music_state stays there, even after the chan has been taken back from hold.<br>Why the chan->music_state still allocated after the channel has been taken back from hold? To resume the MOH where it has been left the previous time?
<br><br>before posting my patch for this new cli command, i'd like some feedback.<br><br>Here's the patch to clean the chan->music_state. is that viable?<br>Index: res/res_musiconhold.c<br>===================================================================
<br>--- res/res_musiconhold.c (revision 80239)<br>+++ res/res_musiconhold.c (working copy)<br>@@ -214,6 +214,7 @@<br> ast_log(LOG_WARNING, "Unable to restore channel '%s' to format '%d'\n", chan->name, state->origwfmt);
<br> }<br> state->save_pos = state->pos;<br>+ chan->music_state = NULL;<br> }<br> if (state->class->delete && ast_atomic_dec_and_test(&state->class->inuse))
<br> ast_moh_destroy_one(state->class);<br>@@ -700,6 +701,7 @@<br> ast_log(LOG_WARNING, "Unable to restore channel '%s' to format %s\n", chan->name, ast_getformatname(oldwfmt));
<br> if (option_verbose > 2)<br> ast_verbose(VERBOSE_PREFIX_3 "Stopped music on hold on %s\n", chan->name);<br>+ chan->music_state = NULL;<br> }
<br> }<br><br clear="all"><br>-- <br>Clod Patry