title: PJSUA changing between two or more different audio sound cards
body: <p>I am working on this new project with pjsua2 which has two sound devices on computer, I wanted to work with both of them independently, but in linux when I plug the other sound card the second became the default sound card. So I am not able to transmit on the first sound card, I tried to get the count of audio devices as described here:
  <a href="https://www.pjsip.org/pjmedia/docs/html/group__audio__device__api.htm" rel="nofollow noreferrer">Audio Device API</a></p>
  
  <p>the source is:</p>
  
  <pre><code>int dev_count;
  pjmedia_aud_dev_index dev_idx;
  pj_status_t status;
  dev_count = pjmedia_aud_dev_count();
  printf("Got %d audio devices\n", dev_count);
  for (dev_idx=0; dev_idx&lt;dev_count; ++i) {
   pjmedia_aud_dev_info info;
   status = pjmedia_aud_dev_get_info(dev_idx, &amp;info);
   printf("%d. %s (in=%d, out=%d)\n",
   dev_idx, info.name,
   info.input_count, info.output_count);
  }
  </code></pre>
  
  <p>I got the following output:</p>
  
  <pre><code>Got 32 audio devices
  0. default (in=1, out=1)
  1. jack (in=0, out=0)
  2. pulse (in=1, out=1)
  3. hdmi:CARD=HDMI,DEV=0 (in=0, out=1)
  4. hdmi:CARD=HDMI,DEV=1 (in=0, out=1)
  5. hdmi:CARD=HDMI,DEV=2 (in=0, out=1)
  6. hdmi:CARD=HDMI,DEV=3 (in=0, out=1)
  7. hdmi:CARD=HDMI,DEV=4 (in=0, out=1)
  8. dmix:CARD=HDMI,DEV=3 (in=0, out=1)
  9. dmix:CARD=HDMI,DEV=7 (in=0, out=1)
  10. dmix:CARD=HDMI,DEV=8 (in=0, out=1)
  11. dmix:CARD=HDMI,DEV=9 (in=0, out=1)
  12. dmix:CARD=HDMI,DEV=10 (in=0, out=1)
  13. dsnoop:CARD=HDMI,DEV=3 (in=0, out=0)
  14. dsnoop:CARD=HDMI,DEV=7 (in=0, out=0)
  15. dsnoop:CARD=HDMI,DEV=8 (in=0, out=0)
  16. dsnoop:CARD=HDMI,DEV=9 (in=0, out=0)
  17. dsnoop:CARD=HDMI,DEV=10 (in=0, out=0)
  18. hw:CARD=HDMI,DEV=3 (in=0, out=1)
  19. hw:CARD=HDMI,DEV=7 (in=0, out=1)
  20. hw:CARD=HDMI,DEV=8 (in=0, out=1)
  21. hw:CARD=HDMI,DEV=9 (in=0, out=1)
  22. hw:CARD=HDMI,DEV=10 (in=0, out=1)
  23. plughw:CARD=HDMI,DEV=3 (in=0, out=1)
  24. plughw:CARD=HDMI,DEV=7 (in=0, out=1)
  25. plughw:CARD=HDMI,DEV=8 (in=0, out=1)
  26. plughw:CARD=HDMI,DEV=9 (in=0, out=1)
  27. plughw:CARD=HDMI,DEV=10 (in=0, out=1)
  28. usbstream:CARD=HDMI (in=0, out=0)
  29. sysdefault:CARD=PCH (in=0, out=1)
  30. front:CARD=PCH,DEV=0 (in=0, out=1)
  31. surround21:CARD=PCH,DEV=0 (in=0, out=0)
  </code></pre>
  
  <p>but when I unplugged the second Audio sound card, the result was the same.</p>
  
  <p>Is there any way to switch and select between two sound cards in PJSUA and select one of them to make phone call? the goal of my project is to use one sound card to transmit sometimes and use the other in other times, both for making voice calls.</p>
  
  <p>the PJSUA Documentation described how to get audio media devices as described <a href="https://www.pjsip.org/docs/book-latest/html/media.html#normal-call" rel="nofollow noreferrer">Here</a>, but when I call the get media size function, I always receive 1!, therefor I can not switch or select between my two sound cards.</p>