Comments (19)
Workaround: You can inspect the PlayResult
object returned from a .Play()
call to determine if it succeeded or not.
I did actually implement FileNotFound exceptions from .Play()
a long time ago, along with exceptions thrown on dialplan application failures but I decided against it - my code was becoming cluttered with the indentation caused by lots of nested try{} catch{}
blocks inside .Subscribe()
callbacks. The top priority for this library is to allow me to write comms applications with clean code.
For now, NEventSocket only throws OperationCanceledException
s to abort any awaited Task
s when the connection closes down, which keeps error handling simple.
I'm having a think about whether to expose a static config option, eg. EventSocket.ThrowOnApplicationFailure = true
to make the proposed behaviour opt-in.
from neventsocket.
Channel.Play
returns a simple Task
object, not a Task<PlayResult>
?
I'm using the latest Nuget release (v. 1.1.0)
from neventsocket.
Ah. The Channel implementation is slightly different from the low-level one - if a Channel is bridged you need to do a displace_session
rather than a play
operation, and they return different results.
Could you paste me a trace level log and I can see what we can do about returning something useful from this method.
from neventsocket.
The channel is not bridged, I just have an incoming channel caught using the OutboundListener.Channels.Subscribe
method. I can just receive a new incoming Channel
and then (after answering it) I do channel.Play(...)
with a non-existent file and it just does not play anything. I can see errors in the log, just not in code. The returned object is a plain Task
which seems to not have Faulted.
This is in the logs:
2016-06-09 13:40:25,528 [16] DEBUG NEventSocket.OutboundSocket (1) - Messages Received [text/event-plain].
2016-06-09 13:40:25,530 [16] DEBUG NEventSocket.OutboundSocket (1) - 5633daec-9fb6-45fd-8984-218357955bbe ChannelExecuteComplete [Answered answer _none_]
2016-06-09 13:40:25,958 [16] DEBUG NEventSocket.OutboundSocket (1) - Sending [sendmsg 5633daec-9fb6-45fd-8984-218357955bbe
Event-UUID: 521c3e84-b77b-4223-b37d-2fe876d6031f
call-command: execute
execute-app-name: playback
content-type: text/plain
content-length: 65
/usr/local/freeswitch/sounds/customers/2378/prompts/nl/Intros.wav
]
2016-06-09 13:40:25,962 [19] DEBUG NEventSocket.OutboundSocket (1) - Messages Received [command/reply].
2016-06-09 13:40:25,962 [19] DEBUG NEventSocket.OutboundSocket (1) - CommandReply received [+OK] for [sendmsg 5633daec-9fb6-45fd-8984-218357955bbe
Event-UUID: 521c3e84-b77b-4223-b37d-2fe876d6031f
call-command: execute
execute-app-name: playback
content-type: text/plain
content-length: 65
/usr/local/freeswitch/sounds/customers/2378/prompts/nl/Intros.wav
]
2016-06-09 13:40:25,982 [15] DEBUG NEventSocket.OutboundSocket (1) - Messages Received [text/event-plain].
2016-06-09 13:40:25,983 [15] DEBUG NEventSocket.OutboundSocket (1) - 5633daec-9fb6-45fd-8984-218357955bbe ChannelExecuteComplete [Answered playback FILE NOT FOUND]
2016-06-09 13:40:25,985 [15] ERROR NEventSocket.OutboundSocket - Application playback /usr/local/freeswitch/sounds/customers/2378/prompts/nl/Intros.wav failed - FILE NOT FOUND
from neventsocket.
Yep cool, I can easily return the PlayResult
from the underlying low-level .Play()
call - which works in the case of a single-leg call. It looks like displace_session
doesn't return any useful error responses however which is what we'd need in the case of a bridged channel. I'll go looking in the FreeSwitch source code to see what I can find.
from neventsocket.
It seems the PlayGetDigits
method is having the same issue when I give it non-existant files as a PromptAudioFile
or as a BadInputAudioFile
.
from neventsocket.
I've had a look at PlayGetDigits
- if the PromptAudioFile
is invalid it will attempt to play the BadInputAudioFile
(upto MaxTries
times) and then return a failure.
Unfortunately, there is nothing in the application response from FreeSwitch that we can use to determine why the application failed. :(
from neventsocket.
Try the latest pre-release build:
nuget install NEventSocket -PreRelease -Source "https://www.myget.org/F/neventsocket-prerelease/api/v3/index.json"
from neventsocket.
I am trying that version, but it won't do a play file at all now. No matter if the file exists or not, I get a KeyNotFoundException
.
from neventsocket.
Woops, I thought I'd fixed that. Have you got a stacktrace?
from neventsocket.
I already reverted to the 1.1.0 version for development reasons. Going to retry with 2.0 now.
from neventsocket.
Hmm, this is just weird. Now it works without any problems.
Can't test anymore at the moment, as the FreeSWITCH servers need to be rebooted ... I'll keep you posted when I can get back on it.
from neventsocket.
It seems to be working okay now, I get the expected results for an existing file and a non-existing file. But now, after the call has been disconnected, I get the following error, which seems to come from the library itself:
2016-06-10 09:32:26,875 [16] FATAL CM.Voice.VoiceAPI.Service - Internal error: unhandled exception
System.NullReferenceException: Object reference not set to an instance of an object.
at NEventSocket.Channels.Channel.<<InitializeSubscriptions>b__41>d__55.MoveNext() in c:\projects\neventsocket\src\NEventSocket\Channels\Channel.cs:line 372
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_1(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
from neventsocket.
Just to confirm, is this with 2.0.0-build00208
?
from neventsocket.
Yes, or at least, the latest version from nuget install NEventSocket -PreRelease -Source "https://www.myget.org/F/neventsocket-prerelease/api/v3/index.json"
from neventsocket.
Can you try 2.0.0-build00209
?
from neventsocket.
Seems to be working like a charm now. Thanks!
from neventsocket.
@m-jepson happy to close this?
from neventsocket.
Closing due to inactivity.
from neventsocket.
Related Issues (20)
- Public member 'Where' on type 'Select(Of BasicMessage,EventMessage)' not found. HOT 14
- Not all CHANNEL_HANGUP_COMPLETE are received HOT 6
- ApiResponse.ErrorMessage returns a trailing "\n" HOT 2
- ApiResponse: Is "-ERR no reply" an error? HOT 3
- Use Logging/Diagnostics context for Channels
- Split Channel Events into separate message type/observable HOT 1
- Feature: Add Event helpers for Sofia custom events HOT 1
- socket disconnect HOT 1
- ChannelHangupComplete event HOT 8
- BridgedChannels and OtherLeg HOT 1
- BridgeTo hangs when called multiple times HOT 6
- BridgeTo does not return BridgeResult HOT 3
- Cannot access a disposed object. Object name: 'NEventSocket.InboundSocket'. HOT 3
- All calls return HangupCause.UnallocatedNumber HOT 2
- PlayGetDigitsResult is not Success when no digits is provided by user HOT 2
- Cancel networkStream.ReadAscync() on socket shutdown
- Bridge simultaneous ring multiple endpoints HOT 1
- I will pay for good help configuring freeswitch and making the demo code work.
- Hangup call after number of seconds
- Transfer audio between two legs of call
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neventsocket.