Title: OriginateCallback receives inconsistent callbacks · Issue #537 · asterisk-java/asterisk-java · GitHub
Open Graph Title: OriginateCallback receives inconsistent callbacks · Issue #537 · asterisk-java/asterisk-java
X Title: OriginateCallback receives inconsistent callbacks · Issue #537 · asterisk-java/asterisk-java
Description: I have been testing a simple integration between our web app and an asterisk box. We originate calls using originateToExtensionAsync, using a local channel and a dialplan, and then record the outcome using a combination of OriginateCallb...
Open Graph Description: I have been testing a simple integration between our web app and an asterisk box. We originate calls using originateToExtensionAsync, using a local channel and a dialplan, and then record the outco...
X Description: I have been testing a simple integration between our web app and an asterisk box. We originate calls using originateToExtensionAsync, using a local channel and a dialplan, and then record the outco...
Opengraph URL: https://github.com/asterisk-java/asterisk-java/issues/537
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"OriginateCallback receives inconsistent callbacks","articleBody":"I have been testing a simple integration between our web app and an asterisk box. We originate calls using `originateToExtensionAsync`, using a local channel and a dialplan, and then record the outcome using a combination of `OriginateCallback` and `AbstractManagerEventListener` instances.\r\n\r\nIn particular, we are interested in recording:\r\n* the outcome of the calls (Answered, Not Answered, Busy)\r\n* the duration of the answered calls\r\n\r\nTo record the duration, we are watching for the `HangupEvent` (from the `AbstractManagerEventListener`), and then calculating the time between that and the `onSuccess` callback (from the `OriginateCallback`).\r\n\r\nThe issue is that *sometimes*, instead of calling `onSuccess`, the `onNoAnswer` callback is instead called. In these cases, the `HangupEvent` eventually shows up as well, but because no `onSuccess` ever fired, we are unable to record a duration. Further, our call records are inaccurate, as the call was answered!\r\n\r\nAfter puzzling over this and looking carefully at the logs, I went searching in the closed issues here and see what seems to be a collection of issues that all describe the exact same problem:\r\n\r\nhttps://github.com/asterisk-java/asterisk-java/pull/255\r\nhttps://github.com/asterisk-java/asterisk-java/issues/207 (note that a commenter here suggests a fix which looks like it was later committed to the mainline: https://github.com/agamezg/asterisk-java/commit/7ef4d04c634a924e5d3bdab37f4effdf18e3baf6)\r\nhttps://github.com/asterisk-java/asterisk-java/issues/145\r\n\r\nI will admit that I am not an asterisk expert, but what seems to be happening is that the `NewStateEvent` that updates the channel state is sometimes arriving *after* the `OriginateResponseEvent` which relies on that `NewStateEvent` to determine whether the channel is up or not. \r\n\r\nMoreover, from reading through the past bug reports, this may be particular to local channels? In this case, we are running some prerequisites in the dialplan, so we don't want to dial the call until the dialplan is ready -- I believe we need the local channels in this case?\r\n\r\nI'm hoping to reopen the discussion and determine the best way to make `OriginateCallback` behave correctly. One MR suggests adding a sleep at the top of `handleOriginateEvent`, for instance, presumably to allow the `NewStateEvent`s to arrive. Others suggest adding additional clauses inside `handleOriginateEvent` to cover the states of the multiple channels involved. This is all a bit above my level of understanding, so I'm hoping to get some input.\r\n\r\nI'm attaching a bit of the logs around this event; you can see the `OriginateResponseEvent` arriving about halfway through and causing our app to log `IVRNoAnswer`. There are several `NewStateEvent`s which arrive before and after, but the ones for the channel named in the `OriginateResponseEvent`, `Local/960@zambiaivr-0000013d;1'`, arrive after, while events for `Local/960@zambiaivr-0000013d;2'` arrive before...\r\n\r\n[asterisk-java.log](https://github.com/asterisk-java/asterisk-java/files/12805926/asterisk-java.log)\r\n\r\n","author":{"url":"https://github.com/elijahsmith","@type":"Person","name":"elijahsmith"},"datePublished":"2023-10-04T16:34:33Z","url":"https://github.com/asterisk-java/asterisk-java/issues/537"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:36649d01-9351-8643-26c8-cf232ad6c8d0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 81CC:1ACDEA:B7531:F4425:6AFD0C92 |
| html-safe-nonce | 326bc7f0829800ba5580b4807b2ce0dc5f98ff761592896d6a0014122a268e88 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MUNDOjFBQ0RFQTpCNzUzMTpGNDQyNTo2QUZEMEM5MiIsInZpc2l0b3JfaWQiOiI5MTczOTI1MTQ1MzIyNzg1OTM4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d9ad61a549b36e364c7854c4618b22871ae9b7f05b46c8c05038aa8f4915942b |
| hovercard-subject-tag | issue:1926596751 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/asterisk-java/asterisk-java/537/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0192eb7e66c5eebdb5b20b4b7c114f427a550c4677e7fde3bc458bba70c958e6/asterisk-java/asterisk-java/issues/537 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0192eb7e66c5eebdb5b20b4b7c114f427a550c4677e7fde3bc458bba70c958e6/asterisk-java/asterisk-java/issues/537 |
| og:image:alt | I have been testing a simple integration between our web app and an asterisk box. We originate calls using originateToExtensionAsync, using a local channel and a dialplan, and then record the outco... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | elijahsmith |
| hostname | github.com |
| expected-hostname | github.com |
| None | b29de2abb97b6307b16270785efeb58b51a117d5a9b659acf00b77aa00e7043b |
| turbo-cache-control | no-preview |
| go-import | github.com/asterisk-java/asterisk-java git https://github.com/asterisk-java/asterisk-java.git |
| octolytics-dimension-user_id | 12164530 |
| octolytics-dimension-user_login | asterisk-java |
| octolytics-dimension-repository_id | 1195396 |
| octolytics-dimension-repository_nwo | asterisk-java/asterisk-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1195396 |
| octolytics-dimension-repository_network_root_nwo | asterisk-java/asterisk-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c9e619def6d670dc18a45d3b02cea938c1c7e47 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width