Recognize call answer event in Asterisk AMI - events

Which event shall I use to recognize the end of conversation with employee?
There are some events: Unlink, Hangup, Dial (Subevent: End)
As I understood, Unlink event (without following Bridge event) suits best, but it can be fired a lot of times during conversation.
Dial (Subevent: End) and Hangup doesnt fire when call is transferred to another employee.

1) Listen for every bridge event and save uniqueid somewhere.
2) Then, on every Hangup event, look if you have uniqueid in that list from brigde events.
Hangup event does not fire on transfer because the channel is still active.

Related

How to trigger the event in AnyLogic and then make it cyclic?

I would like to make the cyclic event. This event periodically calculates some parameters of the model. However, the event should be triggered once by a condition. I have no idea how to do that.
I tried to make the event.reset() at the beginning and then restart it after the appropriate condition is met.
However, I received the errors:" agent cannot be resolved to a variable"
If I delete the reset and restart functions for the event, everything will be ok. The event is cyclic and works fine.
The double click on the error shows the stings where the error is occurred (highlighted with red color):
On model start-up, suspend the event by using:
event.reset();
Once the condition you have is met, use:
event.restart();

MQ | Sender LONGRTR

I see SENDER channel goes into RETRY mode after LONGRTS start. It remains in RETRY mode and re-started after LONGMTR(1200) seconds. My question is - does Sender channel comes back to RUNNING as soon as message come, without completion of LONGMTR or it waits for LONGMTR time?
A SENDER channel will go into STATUS(RETRY) - a.k.a. Retry Mode - when the connection to its partner fails.
To begin with, on the assumption that many network failures are very short lived, a SENDER channel will try a small number of fairly close together attempts to re-make the network connection. It will try 10 times at 60 seconds apart, to re-make the connection. This is known as the "short retries".
This 10 times and 60 seconds apart, are coded in the SENDER channel fields called SHORTRTY and SHORTTMR.
If after these first 10 attempts, the SENDER channel has still not managed to get reconnected to the network partner, it will now move to "long retries". It is now operating with the assumption that the network outage is a longer one, for example the partner queue manager machine is having maintenance applied, or there has been some other major outage, and not just a network blip.
The SENDER channel will now try what it hopes is an infinite number of slightly more spaced apart attempts to re-make the connection. It will try 999999999 times at 1200 seconds apart, to re-make the connection.
This 999999999 and 1200, are coded in the SENDER channel fields called LONGRTY and LONGTMR.
You can see how many attempts are left by using the DISPLAY CHSTATUS command and looking at the SHORTRTS and LONGRTS fields. These should how many of the 10 or 999999999 are left. If SHORTRTS(0) then you know the SENDER is into "long retry mode".
If, on any of these attempts to re-make the connection, it is successful, it will stop retrying and you will see the SENDER channel show STATUS(RUNNING). Note that the success is due to the network connection having been successfully made, and is nothing to do with whether a message arrives or not.
It will not continue making retry attempts after it successfully connects to the partner (until the next time the connection is lost of course).
If your channel is in STATUS(RETRY) you should look in the AMQERR01.LOG to discover the reason for the failure. It may be something you can fix at the SENDER end or it may be something that needs to be fixed at the RECEIVER end, for example restarting the queue manager or the listener.

Stop casting on the receiver

I need to disconnect from the sender and return to receiver's main ("ready to cast" screen).
Receiver decides when and how to do that (e.g. 10 mins idling after media playback was paused)
I've tried to stop receiver explicitly
receiver.stop()
and disconnecting the connection service
cs = receiver.getConnectionService()
cs.disconnect()
That didn't work as I wanted, it doesn't return to the main screen and all senders still see it as an ongoing cast session
So how can I force disconnecting on the receiver? Receiver API page seems to be describing only these two methods.
You shouldn't call receiver.stop(), nor calling cs.disconnect(); instead try using window.close().

How to disable BackgroundTransferRequest's TransferStatusChanged event handler after I unsubscribed it?

I'm using background transfer to download videos and I subscribed each request's TransferStatusChanged and TransferProgressChanged event to monitor it's status and download progress. When I cancelled one background transfer request using BackgroundTransferService.Remove() method, it fired TransferStatusChanged event as msdn mentioned. I don't want to execute event handlers, so I try to unsubscribe event before removed the request, like code below:
BackgroundTransferRequest transferToRemove = BackgroundTransferService.Find(requestId);
if (transferToRemove != null)
{
transferToRemove.TransferStatusChanged -= transfer_TransferStatusChanged;
transferToRemove.TransferProgressChanged -= transfer_TransferProgressChanged;
BackgroundTransferService.Remove(transferToRemove);
}
but TransferStatusChanged event handler still fired. Can anyone help me?
BackgroundTransferService.Remove(transferToRemove); only Accepts the request. It will take sometime to remove it. Meanwhile, you again call the Add() function and thus you got one more event i.e. transfer_TransferProgressChanged.
In event transfer_TransferProgressChanged, first check BackgroundTransferService contains your request or not.
if(BackgroundTransferService.Requests.Contains(m_currentRequest))
{
BackgroundTransferService.Remove(m_currentRequest);
UnsubscribeYourEvents();
DoOtherStuffRealtedToDownload();
}

Why would a WCF OracleDB receive location be triggered by its FK instead of an actual update on its table?

Strange behavior in our receive locations:
RL_REPRESENTATIVE is waiting for a notification from the REPRESENTATIVE table (fields: (PK)id, fname, lname, etc).
RL_CLIENT_REPRESENTATIVE is waiting for a notification from the CLIENT_REPRESENTATIVE table (fields: (FK)id_rep, (FK)id_client).
When both of the locations are active and I commit a change in the CLIENT_REPRESENTATIVE.id_rep table I get a couple of warnings (apparently from RL_REPRESENTATIVE).
The adapter "WCF OracleDB" raised an error message. Details "System.InvalidOperationException: The notification query returned an error. Info="Error". Source="Data". Type="Change".
at Microsoft.Adapters.OracleDB.OracleDBInboundContract.Notification_TryReceive(OracleCommonExecutionHelper executionHelper, Message& wcfMessage)
at Microsoft.Adapters.OracleDB.OracleDBInboundContract.TryReceive(TimeSpan timeout, Message& message, IInboundReply& reply)
at Microsoft.ServiceModel.Channels.Common.Channels.AdapterInputChannel.TryReceive(TimeSpan timeout, Message& message)
at System.ServiceModel.Dispatcher.InputChannelBinder.TryReceive(TimeSpan timeout, RequestContext& requestContext)
at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.TryReceive(TimeSpan timeout, RequestContext& requestContext)".
and
The adapter "WCF OracleDB" raised an error message. Details "The WCF service host at address oracledb://d01-isis:1521/D01ISIS/Dedicated?CallingTable=REPRESENTATIVE has faulted and as a result no more messages can be received on the corresponding receive location. To fix the issue, BizTalk Server will automatically attempt to restart the service host.".
Otherwise the process that is activated by a modification in CLIENT_REPRESENTATIVE takes place with no problems.
(If I update, instead, id_client in CLIENT_REPRESENTATIVE - the error comes from another receive location that subscribes to notifications from the CLIENT table.)
Two further clues:
If I disable RL_REPRESENTATIVE, the warnings won't appear.
If I update both CLIENT_REPRESENTATIVE.id_rep and REPRESENTATIVE.fname and commit both in the same transaction, the warnings won't appear.
Note that there are no triggers in either tables and all my timeouts are set to almost 24 hours.
I suspect that the FK constraint does its job in a way that ends up sending a notification to the port but I never get the actual message that I'm supposed to receive.
Question: Is there a parameter in Oracle that controls this behavior? Have any Biztalk devs ever run into this problem?
It could be:
the order in which things are saved.
a transactional problem, receive locations on seperate transactions, therefore it looks like related items are missing
a locking problem related to the transactional problem
The way to track it down would be to setup profiling on the database, and see exactly which commands are sent in which order.
In the end, the solution was to change a flag in all the receive locations (NotifyOnListenerStart) to "false".
After further development, this solution was not complete - the errant triggering is occurring again - so I'm toggling the check to off until I (or someone else) finds the correct solution.
Edit: This is a side-effect of the FK, changing its value seems to trigger a notification of a change in the table containing the PK (despite there not being any).

Resources