Asterisks locks alsa device if chan_alsa is loaded












0















I am implementing an extension 900 which routes the audio to alsa device. I am also using mpd which plays music through alsa.



Asterisk 15, Openwrt 18.06



mpd.conf



>> cat /etc/mpd.conf 
log_file "syslog"

bind_to_address "127.0.0.1"
bind_to_address "192.168.1.18"

input {
plugin "curl"
}

audio_output {
type "alsa"
name "sun4icodec"
device "hw:0,0"
mixer_control "Power Amplifier"
}


Here is the section of extensions.conf related to the extension



;SIP 900
exten => 900,1,NoOp(Testing calls to speakers. Dialing ${EXTEN} from ${CALLERID})
same => n,System(kill -9 `pgrep mpg123`)
same => n,System(amixer set 'Power Amplifier' 80%)
same => n,System(/usr/bin/aplay /var/lib/myapp/sounds/tone3.wav &)
same => n,System(sleep(4))
same => n,NoOp(Testing calls to speakers. Dialing ${EXTEN} from ${CALLERID})
same => n,Dial(CONSOLE/ALSA)
same => n,Hangup()
same => n,System(sleep(1))
same => n,System(amixer set 'Power Amplifier' 80%;)
same => n,System(sleep(4))


When chan_alsa is loaded it locks the alsa device and when something is played on mpd I get the following error



aplay: main:722: audio open error: Resource busy


I came across this on a website but I am not sure how to implement this. Can please guide me how to solve this… twiddle software and/or hardware mixing




output_device = Indicates the name of the ALSA
device to use for playing sound, i.e. for listening. A device name
specified here is passed, unchanged, to the ALSA sound layer, so any
ALSA device name should work. Warning : Asterisk may lock the ALSA
device specified here for the entire duration the Asterisk process is
running. You may have to twiddle software and/or hardware mixing
settings to keep Asterisk from hogging your output device.










share



























    0















    I am implementing an extension 900 which routes the audio to alsa device. I am also using mpd which plays music through alsa.



    Asterisk 15, Openwrt 18.06



    mpd.conf



    >> cat /etc/mpd.conf 
    log_file "syslog"

    bind_to_address "127.0.0.1"
    bind_to_address "192.168.1.18"

    input {
    plugin "curl"
    }

    audio_output {
    type "alsa"
    name "sun4icodec"
    device "hw:0,0"
    mixer_control "Power Amplifier"
    }


    Here is the section of extensions.conf related to the extension



    ;SIP 900
    exten => 900,1,NoOp(Testing calls to speakers. Dialing ${EXTEN} from ${CALLERID})
    same => n,System(kill -9 `pgrep mpg123`)
    same => n,System(amixer set 'Power Amplifier' 80%)
    same => n,System(/usr/bin/aplay /var/lib/myapp/sounds/tone3.wav &)
    same => n,System(sleep(4))
    same => n,NoOp(Testing calls to speakers. Dialing ${EXTEN} from ${CALLERID})
    same => n,Dial(CONSOLE/ALSA)
    same => n,Hangup()
    same => n,System(sleep(1))
    same => n,System(amixer set 'Power Amplifier' 80%;)
    same => n,System(sleep(4))


    When chan_alsa is loaded it locks the alsa device and when something is played on mpd I get the following error



    aplay: main:722: audio open error: Resource busy


    I came across this on a website but I am not sure how to implement this. Can please guide me how to solve this… twiddle software and/or hardware mixing




    output_device = Indicates the name of the ALSA
    device to use for playing sound, i.e. for listening. A device name
    specified here is passed, unchanged, to the ALSA sound layer, so any
    ALSA device name should work. Warning : Asterisk may lock the ALSA
    device specified here for the entire duration the Asterisk process is
    running. You may have to twiddle software and/or hardware mixing
    settings to keep Asterisk from hogging your output device.










    share

























      0












      0








      0








      I am implementing an extension 900 which routes the audio to alsa device. I am also using mpd which plays music through alsa.



      Asterisk 15, Openwrt 18.06



      mpd.conf



      >> cat /etc/mpd.conf 
      log_file "syslog"

      bind_to_address "127.0.0.1"
      bind_to_address "192.168.1.18"

      input {
      plugin "curl"
      }

      audio_output {
      type "alsa"
      name "sun4icodec"
      device "hw:0,0"
      mixer_control "Power Amplifier"
      }


      Here is the section of extensions.conf related to the extension



      ;SIP 900
      exten => 900,1,NoOp(Testing calls to speakers. Dialing ${EXTEN} from ${CALLERID})
      same => n,System(kill -9 `pgrep mpg123`)
      same => n,System(amixer set 'Power Amplifier' 80%)
      same => n,System(/usr/bin/aplay /var/lib/myapp/sounds/tone3.wav &)
      same => n,System(sleep(4))
      same => n,NoOp(Testing calls to speakers. Dialing ${EXTEN} from ${CALLERID})
      same => n,Dial(CONSOLE/ALSA)
      same => n,Hangup()
      same => n,System(sleep(1))
      same => n,System(amixer set 'Power Amplifier' 80%;)
      same => n,System(sleep(4))


      When chan_alsa is loaded it locks the alsa device and when something is played on mpd I get the following error



      aplay: main:722: audio open error: Resource busy


      I came across this on a website but I am not sure how to implement this. Can please guide me how to solve this… twiddle software and/or hardware mixing




      output_device = Indicates the name of the ALSA
      device to use for playing sound, i.e. for listening. A device name
      specified here is passed, unchanged, to the ALSA sound layer, so any
      ALSA device name should work. Warning : Asterisk may lock the ALSA
      device specified here for the entire duration the Asterisk process is
      running. You may have to twiddle software and/or hardware mixing
      settings to keep Asterisk from hogging your output device.










      share














      I am implementing an extension 900 which routes the audio to alsa device. I am also using mpd which plays music through alsa.



      Asterisk 15, Openwrt 18.06



      mpd.conf



      >> cat /etc/mpd.conf 
      log_file "syslog"

      bind_to_address "127.0.0.1"
      bind_to_address "192.168.1.18"

      input {
      plugin "curl"
      }

      audio_output {
      type "alsa"
      name "sun4icodec"
      device "hw:0,0"
      mixer_control "Power Amplifier"
      }


      Here is the section of extensions.conf related to the extension



      ;SIP 900
      exten => 900,1,NoOp(Testing calls to speakers. Dialing ${EXTEN} from ${CALLERID})
      same => n,System(kill -9 `pgrep mpg123`)
      same => n,System(amixer set 'Power Amplifier' 80%)
      same => n,System(/usr/bin/aplay /var/lib/myapp/sounds/tone3.wav &)
      same => n,System(sleep(4))
      same => n,NoOp(Testing calls to speakers. Dialing ${EXTEN} from ${CALLERID})
      same => n,Dial(CONSOLE/ALSA)
      same => n,Hangup()
      same => n,System(sleep(1))
      same => n,System(amixer set 'Power Amplifier' 80%;)
      same => n,System(sleep(4))


      When chan_alsa is loaded it locks the alsa device and when something is played on mpd I get the following error



      aplay: main:722: audio open error: Resource busy


      I came across this on a website but I am not sure how to implement this. Can please guide me how to solve this… twiddle software and/or hardware mixing




      output_device = Indicates the name of the ALSA
      device to use for playing sound, i.e. for listening. A device name
      specified here is passed, unchanged, to the ALSA sound layer, so any
      ALSA device name should work. Warning : Asterisk may lock the ALSA
      device specified here for the entire duration the Asterisk process is
      running. You may have to twiddle software and/or hardware mixing
      settings to keep Asterisk from hogging your output device.








      embedded alsa openwrt asterisk alsamixer





      share












      share










      share



      share










      asked 6 mins ago









      dmSherazidmSherazi

      1034




      1034






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502636%2fasterisks-locks-alsa-device-if-chan-alsa-is-loaded%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502636%2fasterisks-locks-alsa-device-if-chan-alsa-is-loaded%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Accessing regular linux commands in Huawei's Dopra Linux

          Can't connect RFCOMM socket: Host is down

          Kernel panic - not syncing: Fatal Exception in Interrupt