portaudio.conf.xml 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <configuration name="portaudio.conf" description="Soundcard Endpoint">
  2. <settings>
  3. <!-- indev, outdev, ringdev:
  4. partial case sensitive string match on something in the name
  5. or the device number prefixed with # eg "#1" (or blank for default) -->
  6. <!-- device to use for input -->
  7. <param name="indev" value=""/>
  8. <!-- device to use for output -->
  9. <param name="outdev" value=""/>
  10. <!--device to use for inbound ring -->
  11. <!--<param name="ringdev" value=""/>-->
  12. <!--File to play as the ring sound -->
  13. <!--<param name="ring-file" value="/sounds/ring.wav"/>-->
  14. <!--Number of seconds to pause between rings -->
  15. <!--<param name="ring-interval" value="5"/>-->
  16. <!--Enable or Disable dual_streams-->
  17. <!--<param name="dual-streams" value="true"/>-->
  18. <!--file to play when calls are on hold-->
  19. <param name="hold-file" value="$${hold_music}"/>
  20. <!--Timer to use for hold music (i'd leave this one commented)-->
  21. <!--<param name="timer-name" value="soft"/>-->
  22. <!--Default dialplan and caller-id info -->
  23. <param name="dialplan" value="XML"/>
  24. <param name="cid-name" value="$${outbound_caller_name}"/>
  25. <param name="cid-num" value="$${outbound_caller_id}"/>
  26. <!--audio sample rate and interval -->
  27. <param name="sample-rate" value="48000"/>
  28. <param name="codec-ms" value="20"/>
  29. <!--uncomment the following line to make mod_portaudio fail to load if it fails to find a device-->
  30. <!-- <param name="unload-on-device-fail" value="true"/> -->
  31. </settings>
  32. <!--
  33. mod_portaudio "streams"
  34. The portaudio streams were introduced to support multiple devices and multiple channels in mod_portaudio.
  35. For example, if you have a sound card that supports multiple channels or have multiple sound cards and you
  36. want to use them at the same time, you can do it configuring streams and endpoints here.
  37. A "stream" is just a logical container for some settings required by portaudio in order to stream audio and
  38. define a friendly name for that configuration. Streams in itself do not do anything else than contain configs.
  39. Once you have your streams defined you can proceed to define "endpoints". Go to the "<endpoints>" section
  40. for more information on endpoints.
  41. You can use the command "pa shstreams" (portaudio shared streams) to show the configured streams.
  42. -->
  43. <streams>
  44. <!--
  45. In this example we define 2 streams, one for a usb audio device and another for the usual Mac defaults
  46. The name="" attribute in the <stream> tag must uniquely identify the stream configuration and can be
  47. later used when creating endpoints in the "instream" and "outstream" parameters of the endpoint.
  48. -->
  49. <!-- This sample "usb1" configuration was tested with a USB Griffin iMic device -->
  50. <stream name="usb1">
  51. <!--
  52. Which device to use for input in this stream
  53. The value for this parameter must be either in the form '#devno',
  54. for example '#2' for device number 2, or 'device-name', like 'iMic USB audio system'
  55. The output of command "pa devlist" will show you device names and numbers as enumerated
  56. by portaudio.
  57. -->
  58. <param name="indev" value="#2" />
  59. <!--
  60. Same as the indev but for output. In this case the device is capable of input and output
  61. Some devices are capable of input only or output only (see the default example)
  62. -->
  63. <param name="outdev" value="#2" />
  64. <!-- The sample rate to use for this stream -->
  65. <param name="sample-rate" value="48000" />
  66. <!--
  67. Size of the packets in milliseconds. The smaller the number the less latency you'll have
  68. The minimum value is 10ms
  69. -->
  70. <param name="codec-ms" value="10" />
  71. <!--
  72. How many channels to open for this stream.
  73. If you're device is stereo, you can choose 2 here. However, bear in mind that then
  74. your left and right channels will be separated and when creating endpoints you will have
  75. to either choose the left or right channel. This may or may not be what you want. This separation
  76. means that you can have 2 separate FreeSWITCH calls, listening to one of them in your left channel
  77. and the other in the right chanel.
  78. -->
  79. <param name="channels" value="2" />
  80. </stream>
  81. <!-- This default stream was tested using the default Macbook Pro input/output devices -->
  82. <stream name="default">
  83. <!-- The default system input device -->
  84. <param name="indev" value="#0" />
  85. <!-- The default system output device -->
  86. <param name="outdev" value="#1" />
  87. <!-- CD quality sampling rate ftw -->
  88. <param name="sample-rate" value="48000" />
  89. <!-- Low latency -->
  90. <param name="codec-ms" value="10" />
  91. <!-- Choosing 1 channel allows to hear in both left-right channel when using a headset -->
  92. <param name="channels" value="1" />
  93. </stream>
  94. </streams>
  95. <!--
  96. mod_portaudio "endpoints"
  97. Endpoints is a way to define the input and output that a given portaudio channel will use.
  98. There is a lot of flexibility. You can create endpoints which are "send-only", which means
  99. audio will be read from FreeSWITCH and sent down to the provided stream, but no audio will
  100. be read from that stream and only silence provided back to FreeSWITCH.
  101. send-only endpoint:
  102. (FS CORE) ->-> audio ->-> sound-card-x
  103. You can also create a read-only endpoint.
  104. read-only-endpoint:
  105. (FS CORE) <-<- audio <-<- sound-card-x
  106. And of course you can create a bidirectional endpoint:
  107. bidirectional-endpoint:
  108. (FS CORE) <-> audio <-> sound-card-x
  109. You can also define a stream which uses only the left or only the right channel of a given device stream.
  110. This means you can have 2 SIP calls connected to the same device haring one call in your left ear and
  111. the other call to your right ear :-)
  112. The name="parameter" of the endpoint allows you to use it in the FreeSWITCH dial plan to dial, ie:
  113. <action application="bridge" data="portaudio/endpoint/usb1out-left" />
  114. You can use the command "pa endpoints" to show the configured endpoints.
  115. -->
  116. <endpoints>
  117. <!--
  118. An endpoint is a handle name to refer to a configuration that determines where to read media from
  119. and write media to. The endpoint can use any input/output stream combination for that purpose as
  120. long as the streams match the sampling rate and codec-ms (see <streams> XML tag).
  121. You can also omit the instream or the outstream parameter (but obviously not both).
  122. -->
  123. <!--
  124. Configuration for a "default" bidirectional endpoint that uses the default stream defined previously in
  125. the <streams> section.
  126. -->
  127. <endpoint name="default">
  128. <!--
  129. The instream, outstream is the name of the stream and channel to use. The stream
  130. name is the same you configured in the <streams> section. This parameters follow
  131. the syntax <stream-name>:<channel index>. You can omit either the outstream
  132. or the instream, but not both! The channel index is zero-based and must be consistent
  133. with the number of channels available for that stream (as configured in the <stream> section).
  134. You cannot use index 1 if you chose channels=1 in the stream configuration.
  135. -->
  136. <param name="instream" value="default:0" />
  137. <param name="outstream" value="default:0" />
  138. </endpoint>
  139. <!--
  140. This endpoint uses the USB stream defined previously in the <streams> section and
  141. is 'send-only' or 'output-only' and uses the channel index 0 (left channel in a stereo device)
  142. -->
  143. <endpoint name="usb1out-left">
  144. <param name="outstream" value="usb1:0" />
  145. </endpoint>
  146. <!--
  147. This endpoint uses the USB stream defined previously in the <streams> section and
  148. is 'send-only' or 'output-only' and uses the channel index 1 (right channel in a stereo device)
  149. -->
  150. <endpoint name="usb1out-right">
  151. <param name="outstream" value="usb1:1" />
  152. </endpoint>
  153. <!--
  154. This endpoint uses the USB stream defined previously in the <streams> section and
  155. is 'receive-only' or 'input-only' and uses the channel index 0 (left channel in a stereo device)
  156. -->
  157. <endpoint name="usb1in-left">
  158. <param name="instream" value="usb1:0" />
  159. </endpoint>
  160. <!--
  161. This endpoint uses the USB stream defined previously in the <streams> section and
  162. is 'receive-only' or 'input-only' and uses the channel index 1 (right channel in a stereo device)
  163. -->
  164. <endpoint name="usb1in-right">
  165. <param name="instream" value="usb1:1" />
  166. </endpoint>
  167. <!--
  168. This endpoint uses the USB stream defined previously in the <streams> section and
  169. is 'bidirectional' or 'send-receive' and uses the channel index 0 (left channel in a stereo device)
  170. -->
  171. <endpoint name="usb1-left">
  172. <param name="instream" value="usb1:0" />
  173. <param name="outstream" value="usb1:0" />
  174. </endpoint>
  175. <!--
  176. This endpoint uses the USB stream defined previously in the <streams> section and
  177. is 'bidirectional' or 'send-receive' and uses the channel index 1 (right channel in a stereo device)
  178. -->
  179. <endpoint name="usb1-right">
  180. <param name="instream" value="usb1:1" />
  181. <param name="outstream" value="usb1:1" />
  182. </endpoint>
  183. </endpoints>
  184. </configuration>