Customized moh per extension

Discussion in 'General' started by jgutierrez, Mar 6, 2009.

  1. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    This will let you set a category of moh per extension, and override the default one.

    1. backup /var/www/html/admin/modules/core/functions.inc.php
    2. edit the file and find the following sections and leave them like:

    in function core_devices_addsip($account)

    Code:
    ...
    array($account,'permit',(isset($_REQUEST['permit']))?$_REQUEST['permit']:''),
    array($account,'disallow',(isset($_REQUEST['disallow']))?$_REQUEST['disallow']:''),
    array($account,'mohsuggest',(isset($_REQUEST['mohsuggest']))?$_REQUEST['mohsuggest']:'default'),
    array($account,'allow',(isset($_REQUEST['allow']))?$_REQUEST['allow']:'')
    //array($account,'record_in',(isset($_REQUEST['record_in']))?$_REQUEST['record_in']:'On-Demand'),
    ...
    
    
    in function core_devices_addiax2($account)
    Code:
    ...
    array($account,'disallow',($_REQUEST['disallow'])?$_REQUEST['disallow']:''),
    array($account,'allow',($_REQUEST['allow'])?$_REQUEST['allow']:''),
    array($account,'mohsuggest',($_REQUEST['mohsuggest'])?$_REQUEST['mohsuggest']:'default'),
    array($account,'accountcode',($_REQUEST['accountcode'])?$_REQUEST['accountcode']:'')
    //array($account,'record_in',($_REQUEST['record_in'])?$_REQUEST['record_in']:'On-Demand'),
    ...
    
    in function core_devices_configpageinit($dispnum)
    under
    //iax2
    Code:
    ...
    $tmparr['deny'] = array('value' => '0.0.0.0/0.0.0.0', 'level' => 1);
    $tmparr['permit'] = array('value' => '0.0.0.0/0.0.0.0', 'level' => 1);
    $tmparr['mohsuggest'] = array('value' => 'default', 'level' => 1);
    $currentcomponent->addgeneralarrayitem('devtechs', 'iax2', $tmparr);
    ...
    
    in function core_devices_configpageinit($dispnum)
    under
    //sip
    Code:
    ...
    $tmparr['deny'] = array('value' => '0.0.0.0/0.0.0.0', 'level' => 1);
    $tmparr['permit'] = array('value' => '0.0.0.0/0.0.0.0', 'level' => 1);
    $tmparr['mohsuggest'] = array('value' => 'deault', 'level' => 1);
    $currentcomponent->addgeneralarrayitem('devtechs', 'sip', $tmparr);
    ...
    

    once you have finished, save the file and execute the following commands on the shell:
    Code:
    /var/lib/asterisk/bin/retrieve_conf
    asterisk -rx "reload"
    
    Now when you edit any of your extensions (sip or iax2) on the web interface, under "Device Options" you will see a new option "mohsuggest" in here you may put the music on hold category that will be used for that extension, just take into account that case is taken into account (pop is different that Pop).

    If you write a moh category that doesn't exists or if you leave on blank this box, your extension will use the "default category"
     
  2. Patrick_elx

    Joined:
    Dec 14, 2008
    Messages:
    1,120
    Likes Received:
    0
    Good job. Hope it will go in the next release.
     
  3. dack

    Joined:
    May 29, 2009
    Messages:
    1
    Likes Received:
    0
    Excellent! I would love to see this in the next release.
     
  4. mcfee

    Joined:
    Oct 28, 2008
    Messages:
    141
    Likes Received:
    0
    Thats awesome trick, Thanks for your post.


    Bye
     
  5. ElasMex

    Joined:
    Oct 22, 2007
    Messages:
    493
    Likes Received:
    0
    Hello jgutierrez

    Is there any way to put music to external Elastix moh?

    Greetings
     
  6. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    Yes, it is possible, you may use streaming MOH, he is a link that may guide you
     
  7. henryksm

    Joined:
    Aug 24, 2009
    Messages:
    9
    Likes Received:
    0
    Dear All,

    We are newbie on VOIP, and now we have study with elastix software (elastix 1.5.2). We interest with topic moh per extension, so we have try it using guide that give in this topic. We have follow step-by-step that give.
    When we try it (fill mohsuggest for some extension with another than default), we find trouble that moh for extension is still run on default.
    We hope you can give us suggest to solve moh per extension problem.

    Note: Asterisk verison 1.4.24

    Thanks For Your Attention
     
  8. Megabyte

    Joined:
    Mar 28, 2009
    Messages:
    327
    Likes Received:
    0
    Hi, yesterday i was trying to follow this sugestion about MoH per extension but i cant do it. please can you explain a little more how we can do it or can you upload a sample file of how we need to modify the file.

    Thanks.
     
  9. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    Did you got any error? What happened on the extension menu? Have you executed retrieve_conf? Have you done the reload step? Attach your modified file
     
  10. Megabyte

    Joined:
    Mar 28, 2009
    Messages:
    327
    Likes Received:
    0
    Ok, right now i did it but i have one question


    $tmparr['deny'] = array('value' => '0.0.0.0/0.0.0.0', 'level' => 1);
    $tmparr['permit'] = array('value' => '0.0.0.0/0.0.0.0', 'level' => 1);

    Now i can see in the created extensions too those fields.

    When i add those lines i can define here and static ip here from what ip the phone its registering right?


    Because the default install dosent have that option, but i think its a great plus for the security of thge system
     
  11. henryksm

    Joined:
    Aug 24, 2009
    Messages:
    9
    Likes Received:
    0
    Dear all

    we have following guide on this topic to create mohsuggest per extension. Our step is same as guide:
    1. backup /var/www/html/admin/modules/core/functions.inc.php

    2. /var/lib/asterisk/bin/retrieve_conf
    3. asterisk -rx "reload"

    After apply it, we find permit, deny and mohsuggest field in extension page. Mohsuggest filled with default value. We have try change mohsuggest from default to another value (ex: lagu). After change and appy configuration change, we have try it. Weh we try it, we still have default moh played. It seems that mohsuggest that we set earlier doesn't have affect.

    Pelase help me to solve this problem. Thanks For Your Attention
    Note: We attach funcions.inc.php that have mohsuggest field.
     
  12. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    What version of Elastix are you using? If I'm not mistaken, changes where for Elastix 1.5
     
  13. henryksm

    Joined:
    Aug 24, 2009
    Messages:
    9
    Likes Received:
    0
    Dear All,

    Elastix version that we use is elastix 1.5.2
    Thx
     

Share This Page