Open Reikooters opened 4 years ago
first, have a look at where ansible looks for its configuration files.
Your problem is that ansible is not finding your ansible-role-fsmrf
folder.
In my case, put my ansible config file under my home directory, and configure it to look for roles under a 'git' folder where I have them all checked out:
$ more ~/.ansible.cfg
[defaults]
roles_path = /Users/dhorton/beachdog-enterprises/beachdog-networks/git
and you can see that I have that role in the configured location:
$ ls -lrt ~/beachdog-enterprises/beachdog-networks/git/ansible-role-fsmrf/
total 16
drwxr-xr-x 3 dhorton staff 96 Feb 13 2018 vars
drwxr-xr-x 3 dhorton staff 96 Feb 13 2018 handlers
drwxr-xr-x 4 dhorton staff 128 Feb 13 2018 tests
-rw-r--r-- 1 dhorton staff 1068 Mar 14 2018 LICENSE
drwxr-xr-x 9 dhorton staff 288 Oct 25 2019 templates
-rw-r--r-- 1 dhorton staff 3304 Oct 4 14:06 README.md
drwxr-xr-x 3 dhorton staff 96 Oct 4 14:06 defaults
drwxr-xr-x 11 dhorton staff 352 Oct 4 14:06 files
drwxr-xr-x 4 dhorton staff 128 Oct 4 14:06 tasks
With that in place, you can run ansible-playbook from any folder and it will find your roles.
(By the way, running ansible locally is not something I do, so I am not sure how that will work out for you. I find it easier to run ansible from my laptop against the server(s) that I want to configure)
Thanks for the fast response. What I had to do was set up my folders like so:
/ (install.yml I created here)
/roles/ansible-role-fsmrf/ (checked out code here)
Basically it was looking for a roles folder under the current directory, and then a folder under that matching the role name. Then it started working.
Sorry if this is the wrong place to ask - but what would be the next steps I should take?
My goal is to have incoming calls on Freeswitch handled by IVRs (these will be different applications based on the number called). Users will interact with the IVRs using voice, so I want to use google text to speech/speech to text/dialogflow, which is how I found your freeswitch modules repository originally.
Based on the examples in your modules repo (I'm looking at the google_tts.js as a basic example), I'll need drachtio-server, so I've installed that using your ansible-role-drachtio repo. So I have drachtio-fsmrf and drachtio-server installed.
What I'm confused about now is how I configure freeswitch (or drachtio) so that it knows what application to run to handle the call when a call comes in, so I can actually get developing. For example, if I dial extension 4000 I want the call to be handled by application A, where as if I dial extension 4001 I want the call to be handled by application B. etc. In plain Freeswitch this can be done by setting up a dialplan for each extension that uses a javascript action, but I'm not sure how to do this using drachtio. I saw the mrf.xml file in the freeswitch dialplan folder, but it looks like I shouldn't be touching this and instead I should configure it somewhere else.
Can you please point me in the right direction?
Hi there,
I think I've made a little progress. In /etc/drachtio.conf.xml I've uncommented the request-handlers tag and put the url to an API I've created, as per https://drachtio.org/docs/drachtio-server#request-handlers-section
My API is receiving the request when I try to make a call which is good. Currently my API just logs the requests and responds with the below rejection (example from the link above).
{"reject":{"data":{"status":"503","reason":"reason goes here"}}}
In the logged request, the fromUser seems to be 0000000000000001 followed by the server IP address, and the toUser 0000000000000001 followed by some other numbers I don't recognise. The toUser number seems to be the same no matter what extension I dial.
How would I determine what extension number was called in Freeswitch so I can respond with the appropriate "route" response with the url to the application which should handle the call?
I had a look at your sample app here (https://github.com/davehorton/drachtio-sample-webapp) and it looks like the toUser should be the field I want, just not sure how to get the matching number dialled from freeswitch.
I'm unclear on your scenario and where freeswitch fits into it. Is freeswitch generating an inbound call to the drachtio server?
Hi Dave
Thanks for your time. I'll try to explain a bit better. What I want to achieve:
1) Receive incoming calls on freeswitch and have the call routed to an IVR based on the DID. Calls on different DIDs would be handled by different IVR applications. 2) User will interact with the IVRs using voice. Planning to use Google text-to-speech and speech-to-text to achieve this, and possibly Google Dialogflow (also considering Rasa) for intent recognition based on what the caller is saying.
I don't have any SIP trunks configured on Freeswitch yet. Our call centre uses a different phone system currently, but we're looking at using Freeswitch for IVRs due to technical limitations with our current phone system. So for now, I just want to be able to log into Freeswitch with a softphone and call an extension to test an IVR (once the IVRs are developed).
I started out building a regular Javascript Freeswitch application (mod_v8) which worked in a naive way - play an announcement, record audio for x seconds, then send the wav file to google to transcribe it and take action. But I would like to do the transcribing in real time instead to give a better user experience. I couldn't see an easy way to access the call audio and do speech-to-text in real time, which is how I came across Drachtio and your related projects. And as far as google integration with freeswitch goes, it looks like you've already built it.
Apologies if I'm going about this the wrong way or mixed up how your projects work but here's what I've done from the beginning:
1) Installed freeswitch using ansible-role-fsmrf including the google modules. 2) Installed drachtio using ansible-role-drachtio. 3) Created a 4000.xml file in /usr/local/freeswitch/conf/directory/default which is just a copy of 1000.xml with the extension 4000 and a password I chose (so I can log into freeswitch with a softphone using extension 4000). 4) Created an API which takes a request and gives a JSON response as per https://drachtio.org/docs/drachtio-server#request-handlers-section. Currently always returns a reject response for testing, but I will change this to do a database lookup and give an appropriate route response later. By the way, the example JSON responses on that page aren't actually valid JSON, so I'm not sure my response is right yet. 5) Updated /etc/drachtio.conf.xml to uncomment the request-handlers tag, and set the url to the API I created in step 4
Haven't touched any other configuration anywhere apart from above. Once test calls are working I then plan to build IVR applications as per https://drachtio.org/docs/developer-guide/#outbound-connections.
I tried making a call to a random number (5001) from a softphone using extension 4000 (Zoiper softphone) and I see this in the freeswitch logs (I changed server IP to __ServerIP__
and my IP to __MyIP__
).
eceaee9c-0dca-11eb-bc27-b523ca158164 Dialplan: sofia/drachtio_mrf/4000@__ServerIP__:5080 Regex (FAIL) [socket] ${sip_user_agent}(Z 5.4.6 rv2.10.10.2) =~ /^drachtio-fsmrf:(.*)$/ break=on-false
Based on this line it doesn't seem to be routing the call to Drachtio. How would I configure freeswitch send the call to drachtio server? Do I need to add a dialplan, if yes what would it look like?
Also - am I understanding the way it works overall correctly (that the call goes from freeswitch to drachtio then is handled by drachtio), or should I be using your freeswitch modules without drachtio?
Full freeswitch log for the test call if its of any use
recv 911 bytes from tcp/[__MyIP__]:63578 at 03:11:17.430169:
------------------------------------------------------------------------
INVITE sip:5001@__ServerIP__:5080;transport=TCP SIP/2.0
Via: SIP/2.0/TCP 192.168.1.105:42573;branch=z9hG4bK-524287-1---ff1fa67e62b458e7;rport
Max-Forwards: 70
Contact: <sip:4000@__MyIP__:42573;transport=TCP>
To: <sip:5001@__ServerIP__:5080>
From: <sip:4000@__ServerIP__:5080;transport=TCP>;tag=57604b00
Call-ID: OZbvIc9Ef48eRmTYKvSp8w..
CSeq: 1 INVITE
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Content-Type: application/sdp
User-Agent: Z 5.4.6 rv2.10.10.2
Allow-Events: presence, kpml, talk
Content-Length: 336
v=0
o=Z 1602645078438 1 IN IP4 __MyIP__
s=Z
c=IN IP4 __MyIP__
t=0 0
m=audio 8000 RTP/AVP 106 9 98 101 0 8 3
a=rtpmap:106 opus/48000/2
a=fmtp:106 sprop-maxcapturerate=16000; minptime=20; useinbandfec=1
a=rtpmap:98 telephone-event/48000
a=fmtp:98 0-16
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [NOTICE] switch_channel.c:1118 New Channel sofia/drachtio_mrf/4000@__ServerIP__:5080 [eceaee9c-0dca-11eb-bc27-b523ca158164]
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:585 (sofia/drachtio_mrf/4000@__ServerIP__:5080) Running State Change CS_NEW (Cur 1 Tot 1)
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] sofia.c:10243 sofia/drachtio_mrf/4000@__ServerIP__:5080 receiving invite from __MyIP__:63578 version: 1.10.1-release git f999022 2019-08-20 16:54:04Z 64bit
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] sofia.c:11433 Setting NAT mode based on nat.auto
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] sofia.c:7290 Channel sofia/drachtio_mrf/4000@__ServerIP__:5080 entering state [received][100]
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] sofia.c:7300 Remote SDP:
eceaee9c-0dca-11eb-bc27-b523ca158164 v=0
eceaee9c-0dca-11eb-bc27-b523ca158164 o=Z 1602645078438 1 IN IP4 __MyIP__
eceaee9c-0dca-11eb-bc27-b523ca158164 s=Z
eceaee9c-0dca-11eb-bc27-b523ca158164 c=IN IP4 __MyIP__
eceaee9c-0dca-11eb-bc27-b523ca158164 t=0 0
eceaee9c-0dca-11eb-bc27-b523ca158164 m=audio 8000 RTP/AVP 106 9 98 101 0 8 3
eceaee9c-0dca-11eb-bc27-b523ca158164 a=rtpmap:106 opus/48000/2
eceaee9c-0dca-11eb-bc27-b523ca158164 a=fmtp:106 sprop-maxcapturerate=16000; minptime=20; useinbandfec=1
eceaee9c-0dca-11eb-bc27-b523ca158164 a=rtpmap:98 telephone-event/48000
eceaee9c-0dca-11eb-bc27-b523ca158164 a=fmtp:98 0-16
eceaee9c-0dca-11eb-bc27-b523ca158164 a=rtpmap:101 telephone-event/8000
eceaee9c-0dca-11eb-bc27-b523ca158164 a=fmtp:101 0-16
eceaee9c-0dca-11eb-bc27-b523ca158164
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] sofia.c:7703 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State Change CS_NEW -> CS_INIT
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:604 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State NEW
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:585 (sofia/drachtio_mrf/4000@__ServerIP__:5080) Running State Change CS_INIT (Cur 1 Tot 1)
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:628 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State INIT
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] mod_sofia.c:93 sofia/drachtio_mrf/4000@__ServerIP__:5080 SOFIA INIT
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:40 sofia/drachtio_mrf/4000@__ServerIP__:5080 Standard INIT
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:48 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State Change CS_INIT -> CS_ROUTING
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:628 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State INIT going to sleep
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:585 (sofia/drachtio_mrf/4000@__ServerIP__:5080) Running State Change CS_ROUTING (Cur 1 Tot 1)
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_channel.c:2332 (sofia/drachtio_mrf/4000@__ServerIP__:5080) Callstate Change DOWN -> RINGING
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:644 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State ROUTING
send 334 bytes to tcp/[__MyIP__]:63578 at 03:11:17.432085:
------------------------------------------------------------------------
SIP/2.0 100 Trying
Via: SIP/2.0/TCP 192.168.1.105:42573;branch=z9hG4bK-524287-1---ff1fa67e62b458e7;rport=63578;received=__MyIP__
From: <sip:4000@__ServerIP__:5080;transport=TCP>;tag=57604b00
To: <sip:5001@__ServerIP__:5080>
Call-ID: OZbvIc9Ef48eRmTYKvSp8w..
CSeq: 1 INVITE
User-Agent: drachtio MRF
Content-Length: 0
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] mod_sofia.c:154 sofia/drachtio_mrf/4000@__ServerIP__:5080 SOFIA ROUTING
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:236 sofia/drachtio_mrf/4000@__ServerIP__:5080 Standard ROUTING
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [INFO] mod_dialplan_xml.c:637 Processing 4000 <4000>->5001 in context mrf
eceaee9c-0dca-11eb-bc27-b523ca158164 Dialplan: sofia/drachtio_mrf/4000@__ServerIP__:5080 parsing [mrf->socket] continue=false
eceaee9c-0dca-11eb-bc27-b523ca158164 Dialplan: sofia/drachtio_mrf/4000@__ServerIP__:5080 Regex (FAIL) [socket] ${sip_user_agent}(Z 5.4.6 rv2.10.10.2) =~ /^drachtio-fsmrf:(.*)$/ break=on-false
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [INFO] switch_core_state_machine.c:312 No Route, Aborting
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [NOTICE] switch_core_state_machine.c:313 Hangup sofia/drachtio_mrf/4000@__ServerIP__:5080 [CS_ROUTING] [NO_ROUTE_DESTINATION]
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:644 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State ROUTING going to sleep
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:585 (sofia/drachtio_mrf/4000@__ServerIP__:5080) Running State Change CS_HANGUP (Cur 1 Tot 1)
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:848 (sofia/drachtio_mrf/4000@__ServerIP__:5080) Callstate Change RINGING -> HANGUP
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:850 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State HANGUP
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] mod_sofia.c:460 Channel sofia/drachtio_mrf/4000@__ServerIP__:5080 hanging up, cause: NO_ROUTE_DESTINATION
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] mod_sofia.c:605 Responding to INVITE with: 404
send 697 bytes to tcp/[__MyIP__]:63578 at 03:11:17.432893:
------------------------------------------------------------------------
SIP/2.0 404 Not Found
Via: SIP/2.0/TCP 192.168.1.105:42573;branch=z9hG4bK-524287-1---ff1fa67e62b458e7;rport=63578;received=__MyIP__
Max-Forwards: 70
From: <sip:4000@__ServerIP__:5080;transport=TCP>;tag=57604b00
To: <sip:5001@__ServerIP__:5080>;tag=c9eBm9FZ6NyKN
Call-ID: OZbvIc9Ef48eRmTYKvSp8w..
CSeq: 1 INVITE
User-Agent: drachtio MRF
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: path, replaces
Allow-Events: talk, hold, conference, refer
Reason: Q.850;cause=3;text="NO_ROUTE_DESTINATION"
Content-Length: 0
Remote-Party-ID: "5001" <sip:5001@__ServerIP__>;party=calling;privacy=off;screen=no
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:60 sofia/drachtio_mrf/4000@__ServerIP__:5080 Standard HANGUP, cause: NO_ROUTE_DESTINATION
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:850 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State HANGUP going to sleep
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:620 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State Change CS_HANGUP -> CS_REPORTING
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:585 (sofia/drachtio_mrf/4000@__ServerIP__:5080) Running State Change CS_REPORTING (Cur 1 Tot 1)
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:936 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State REPORTING
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:174 sofia/drachtio_mrf/4000@__ServerIP__:5080 Standard REPORTING, cause: NO_ROUTE_DESTINATION
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:936 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State REPORTING going to sleep
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:611 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State Change CS_REPORTING -> CS_DESTROY
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_session.c:1726 Session 1 (sofia/drachtio_mrf/4000@__ServerIP__:5080) Locked, Waiting on external entities
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [NOTICE] switch_core_session.c:1744 Session 1 (sofia/drachtio_mrf/4000@__ServerIP__:5080) Ended
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [NOTICE] switch_core_session.c:1748 Close Channel sofia/drachtio_mrf/4000@__ServerIP__:5080 [CS_DESTROY]
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:739 (sofia/drachtio_mrf/4000@__ServerIP__:5080) Running State Change CS_DESTROY (Cur 0 Tot 1)
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:749 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State DESTROY
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] mod_sofia.c:365 sofia/drachtio_mrf/4000@__ServerIP__:5080 SOFIA DESTROY
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:181 sofia/drachtio_mrf/4000@__ServerIP__:5080 Standard DESTROY
eceaee9c-0dca-11eb-bc27-b523ca158164 2020-10-14 03:11:17.421192 [DEBUG] switch_core_state_machine.c:749 (sofia/drachtio_mrf/4000@__ServerIP__:5080) State DESTROY going to sleep
OK, if you want to use drachtio in this scenario, you would need to do things in a completely different fashion:
So this is a very different way of working with freeswitch, and it may not be for you.
Hi there
I'm new to Freeswitch and have been playing around with it recently. I saw your repository https://github.com/davehorton/drachtio-freeswitch-modules and wanted to try it out, which lead me to this repository.
How would I install this? I have never used ansible before.
I did a bit of googling and here is what I tried.
I have a clean install of Debian 10. I installed ansible as per below:
I saw you posted this playbook on this issue (https://github.com/davehorton/ansible-role-fsmrf/issues/6), which appears to be more current than the one on the readme:
I created a file with the above content called install.yml in the root directory of where I extracted the files to, and tried the following command (found online for running a playbook locally)
ansible-playbook -c local -i localhost, install.yml
But I got the following error:
I noticed there is no roles folder in the repository. Should this file be in a specific folder, is there another file I need to create, or am I way off?
Any guidance would be appreciated.