[asterisk-dev] [Code Review] 4010: General option to musiconhold.conf, to make applications MOH override channels musicclass.

wdoekes reviewboard at asterisk.org
Mon Sep 22 07:59:03 CDT 2014



> On Sept. 22, 2014, 8:48 a.m., wdoekes wrote:
> > /trunk/res/res_musiconhold.c, lines 1428-1433
> > <https://reviewboard.asterisk.org/r/4010/diff/1/?file=67441#file67441line1428>
> >
> >     (A) If !MOH_APPOVERRIDECHANNEL, then you're loading this twice. Don't do that, especially not when there is realtime involved. Add a MOH_APPOVERRIDECHANNEL test.
> >     
> >     (B) chan->musicclass? Looks like old code. Did this compile on trunk? You mean ast_channel_musicclass(chan)..
> 
> Kristian Høgh wrote:
>     (A) Do I need that? mohclass is set, right?
>     (B) fixed.

No. Not if it isn't found.

I agree that that's a non-standard configuration. But the code looks awkward as it is.


Perhaps you should refactor the whole thing to something like this instead. Pseudocode:

const char *classes[4];
if (!ast_test_flag(global_flags, MOH_APPOVERRIDECHANNEL)) {
    classes = {mclass, ast_channel_musicclass(chan)), interpclass, "default"};
} else {
    classes = {ast_channel_musicclass(chan)), mclass, interpclass, "default"};
}

for (i = 0; i < ARRAY_LEN(classes); ++i)
    if (!ast_strlen_zero(classes[i]))
        // attempt loading and break when found


- wdoekes


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4010/#review13370
-----------------------------------------------------------


On Sept. 22, 2014, 12:23 p.m., Kristian Høgh wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4010/
> -----------------------------------------------------------
> 
> (Updated Sept. 22, 2014, 12:23 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-24276
>     https://issues.asterisk.org/jira/browse/ASTERISK-24276
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> General option to musiconhold.conf, to make applications MOH override channels musicclass.
> Defaults to no, as it is current behavior.
> 
> 
> We use a single trunk for multiple users. The default musicclass from sip.conf is therefore the same for all calls.
> The trunk is connected to a kamailio server, where all in- and outgoing calls are send/received.
> Each customer (identified by custom headers) can choose a musicclass for MOH, which we apply to the channel.
> When a user dials an extension, which point to a queue, we want the user to receive the queue music.
> But we still want the user to keep the preferred musicclass, if the call is put on hold later.
> Therefore we cant unset musicclass before calling the queue.
> Company A prefer musicclass heavy-metal.
> That musicclass is therefore applied to incoming calls.
> The customer service need to calm people down. Therefore they use other music as queue music.
> 
> 
> Diffs
> -----
> 
>   /trunk/res/res_musiconhold.c 423656 
>   /trunk/configs/samples/musiconhold.conf.sample 423656 
> 
> Diff: https://reviewboard.asterisk.org/r/4010/diff/
> 
> 
> Testing
> -------
> 
> Whithout this patch or new option appoverridechannel=no or no appoverridechannel set in musiconhold.conf:
> - The queue "myqueue", has musicclass=queueclass
> - Set(CHANNEL(musiconhold)=mohclass) followed by Queue(myqueue), makes caller hear "mohclass" while waiting for agent to answer.
> 
> Whith appoverridechannel=yes in musiconhold.conf:
> - The queue "myqueue", has musicclass=queueclass
> - Set(CHANNEL(musiconhold)=myclass) followed by Queue(myqueue), makes caller hear "queueclass" while waiting for agent to answer.
> 
> 
> Thanks,
> 
> Kristian Høgh
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140922/652e4a31/attachment.html>


More information about the asterisk-dev mailing list