Skip to main content

mod_sonar

About

NOTE: This is just a stub page. Seven Du described this mod on the ML. I just did a C&P here to overcome the blank page effect:

Looks like mod_sonar is just like a real Sonar that:

  • You setup a remote server which can echo
  • Generate some tones on the local server and call the remote server
  • When the echo back use some tone_detect or VAD things to help check possible network problems

-- Seven Du

Click here to expand Table of Contents

Usage

To use this, you need two FS servers in different places, e.g.

FS1 ------------------------- FS2 (remote)

The remote server doesn't need mod_sonar, actually it dones't need to be a FS, any server can echo back the audio should work.

Or use only one server, and deploy some loops

FS ---->------Carrier------ PSTN ---->-------- SOME WHERE ELSE --->----- PSTN ----->------ DID ---->---------- | | |(echo)--------<-------------------------------<------------------------------------------<------------------|

Create an echo dialplan on FS2 (or the same FS that receive the DID side) and let it echo:

<extension name="test-sonar">
<condition field="destination_number" expression="^echo$">
<action application="answer" data=""/>
<action application="echo" data=""/>
</condition>
</extension>

then on FS1, do

originate sofia/external/echo@FS2:5080 &sonar(10)

It will call FS2, and send some tone streams to it, and FS2 will just echo back, and FS1 should can detect the tone echoed back and then do some statistics!

Event

It fires a sonar::ping CUSTOM event on finish.

RECV EVENT
Event-Subclass: sonar::ping
Event-Name: CUSTOM
Core-UUID: 6ee351da-f3d3-4cc1-ab32-d99a24e20b80
FreeSWITCH-Hostname: seven.local
FreeSWITCH-Switchname: seven.local
FreeSWITCH-IPv4: 192.168.0.100
FreeSWITCH-IPv6: ::1
Event-Date-Local: 2013-09-27 06:31:55
Event-Date-GMT: Thu, 26 Sep 2013 22:31:55 GMT
Event-Date-Timestamp: 1380234715430108
Event-Calling-File: mod_sonar.c
Event-Calling-Function: sonar_app
Event-Calling-Line-Number: 172
Event-Sequence: 4962
ping_min: 619
ping_max: 680
ping_avg: 649
ping_mdev: 43
ping_sent: 2
ping_recv: 2
ping_lost: 0
lost_rate: 0.00%

Channel Variables

It will call the remote FS, so it is a channel.

  • sonar_ping_ref

Set a reference string so you can get it back at the sonar::ping event

  • sonar_channel_event

Set to true to get all Channel Vars attached to sonar::ping

example:

originate {sonar_channel_event=true,sonar_ping_ref=ping_test_1}sofia/external/echo@FS2:5080 &sonar(40)

Maybe add ignore_early_media=true if you test against PSTN and the path send you early media.