How to detect in PJSUA2 that a call was unsuccessfull? - c#-4.0

If i start a call in SIP / PJSUA2 using the CALL function, the OnIncomingCall event in the SIPAccount fires. However, a call CAN fail (non existing target account, or the callee does not answer). Where in SIP or PJSUA2 can i detect, this? Preferably with an event?

You might have got the solution, but answering late so that someone can get help from this post.
If the user didn't answer or not reachable, the state goes to CONNECTED state, you should detect the voice mail activity by writing a separate function. It will go to CONNECTED state in order to enable you to hear the voice message by the provider or by the user.

Related

How to disconnect all clients for a session in opentok?

I am trying to disconnect all clients from a session in opentok. i Know for this i have to call forceDisconnect() method of opentk sdk but the thing is forceDisconnect() method take connection object as a parameter. All clients should be disconnected when presenter leave the call.
Now what i tried till now when presenter leave the room i call get OT.listStreams() method to get all the streams and i am getting all the streams but the stream object doesn't have connection property. so i am not able to call forceDisconnect() method to remove all client. I am using nodejs opentok sdk. Any help is appreciated.
OpenTok Developer Advocate here.
The best way to implement this functionality would be to utilize signaling. This will allow you to send a command to each client to forceDisconnect themselves.
For additional help, reach out in the Vonage Community Slack.

What config option allows bot to respond to commands posted by itself?

If I have en external process post a message as bot, let's say !help how can make Errbot respond to it? Currently it ignores messages coming from errbot itself. I could not find a configuration option for this.
Good question: It is in the contract of each backend to detect and filter out the messages coming from the bot itself.
This design choice is mainly to avoid weird infinite loop behavior etc.
In general if the bot emits something and needs to react from it, why not doing that at that point instead of waiting for its own response?

Using PubNub, is Unsubscribe a dual use command for Publish and Subscribe?

Yes, I know it seems like a simple question but I just recently started using PubNub and I am confused on how to disconnect from a channel. I think the command to use is "Unsubscribe" and my misunderstanding relates to the dual use of the word.
Logically, I understand that once you initialize PubNub and publish a message a separate process can subscribe to the establish channel. When it's done it unsubscribes. Got it!
Now we want to completely disconnect from PubNub. That is end the channel.
Do I use the command "Unsubscribe" to do this? I guess I am logically looking for an "End" or "Disconnect" command and not an "Unsubscribe" command because it did not subscribe to the channel, it established the channel. I know it seems petty but until I understand this it's difficult to move forward. So is this a dual use command?
Thanks
You are on the right track here. Depending on the client platform in question, an unsubscribe resulting in an empty channel list will completely disconnect you.
On the more sophisticated clients, advanced/smart frameworks, there are the API calls of un/subscribe (which as you described subs /unsubs you to a specific channel), and separately, the public and/or private method calls defining/detecting being "connected" or "online".
For example, iOS has specific connect and disconnect calls, separate from subscribe/unsubscribe calls. On JS, there is no explicit connect/disconnect, but regardless if you are subbed or not to an active channel list, there may be background "pings/heartbeats" being made to the PN cloud to detect connectivity/online/offline state.
If you give more info on the client platform and version you are on, we can give you more info on how to completely sever all connects to the PN cloud and achieve a "complete disconnect".
geremy

How to handle external events in CQRS?

Supposed I have a CQRS-based system with a web UI that I want to integrate with some external device, let's say an Arduino board.
Basically, I can think of three scenarios:
When the user clicks on a button in the web UI, the Arduino shall do something.
When the user pushes a hardware button, the domain shall react and the UI shall update.
When the user pushes a hardware button, the UI shall update.
How do I model these scenarios?
This is quite easy IMHO: UI emits a command, business logic runs, emits an event, and Arduino is listening for events. Basically, the Arduino is nothing but an event denormalizer. Is this the correct approach?
This is quite easy IMHO as well: Arduino emits a command, sends it to the command bus, and the same procedure runs as with scenario 1. Basically, there's no difference for the CQRS-system whether the command comes from the web UI of from anything else.
This is where I'm really unsure: Supposed the Arduino handles the button press itself, and flashes an LED in response. I just want to make sure that my application takes notice of "the LED has been flashing". This is no command (as the flashing already happened), instead it's an event. What do I do with this event? Do I simply store it in the event store and bypass my domain? This seems horribly wrong to me. Do I emit a pseudo-command which is turned 1:1 into a matching event? This will work and does not bypass the domain, but it feels wrong as well, as it actually is no command. What should I do?
Any advice on these things?
1.Just use an event handler( updating ui maybe using websocket ) listening on Arduino event if no state should change in your domain.
2. Use a saga listening on Arduino event and fire a command if state should change in your domain.
UI is not a domain concern. So I prefer option 1.

How to handle external and internal event in j2me

i am developing game in j2me. In that i have to handle external and internal event.. I studied in some of websites that we can handle the event with the help of hidenotify() and shownotify().
But it dont know where to use these two methods? whether in hidenotify() in pauseApp() and shownotify() in startApp() or somewhere else..
Please anyone give me a clear idea about handling the event in mobile.
In J2ME world, external events resemble the following:
In coming SMS message. This is used trigger application specific action caused by a message sent from a pre-defined and well known sender. This feature is known as "push".
Media card inserted and the application needs to recognize it and act upon it.
If the phone is NFC enabled, launching an application when the phone is taken to a card reader.
When a server is attempting to connect to the phone, launch the application and perform some specific action. This requires that phone is addressable on network; very few of them support it.
Launching the application at a specific time.
I hope you get the idea. Most of the above are achieved by making use Push Registry.
The events that you are talking about are the callbacks to application that AMS (Application Management Software) notifies before the component is being shown and before the component is being hidden.
And pauseApp will be called by AMS when the application is about to be paused; this typically happens when there is an incoming phone call, or the flip is closed (on a flip phone) etc.
Hope it answers your question.

Resources