<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 15, 2017 at 1:10 PM, Tzafrir Cohen <span dir="ltr"><<a href="mailto:tzafrir.cohen@xorcom.com" target="_blank">tzafrir.cohen@xorcom.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">diff --git a/src/r2chan.c b/src/r2chan.c<br>
index a0ffc7c..fecf9d1 100755<br>
--- a/src/r2chan.c<br>
+++ b/src/r2chan.c<br>
@@ -281,6 +281,10 @@ static int openr2_chan_handle_zap_event(<wbr>openr2_chan_t *r2chan<br>
r2chan->inalarm = (event == OR2_HW_EVENT_ALARM) ? 1 : 0;<br>
EMI(r2chan)->on_hardware_<wbr>alarm(r2chan, r2chan->inalarm);<br>
break;<br>
+ case OR2_HW_EVENT_REMOVED:<br>
+ openr2_log(r2chan, OR2_LOG_DEBUG, "Channel removed\n");<br>
+ /* FIXME: remove span */<br>
+ break;<br>
default:<br>
openr2_log(r2chan, OR2_LOG_DEBUG, "Unhandled hardware event %d\n",<br>
break;<br>
<br>
But I suspect it should the fix should be done in Asterisk. Any hint on<br>
how to proceed?<br></blockquote><div><br></div><div>I'd probably modify the event interface so you do there EMI(r2chan)->on_device_removed(); which then can be handled in Asterisk by stop polling that channel (setting a "suspended" flag or whatever). If a call was in progress on the device I suppose it should be hung up and the read/write routines should check for the 'suspended'. I guess openr2 internally could also track the state of the channel (removed/suspended) and return an error if the application tries to perform I/O on such channel.</div><div><br></div><div>Note the patch you wrote seems to be for master, which is good, but is not the branch where openr2 releases for Asterisk are made from. I never fully qualified master for Asterisk. I think it's supposed to work, but I'm not sure. The master branch aimed to become openr2 version 2 that would support both Asterisk and FreeSWITCH. It was tested well with FreeSWITCH but since release 1 had been working well for Asterisk, I never found the motivation to release it.</div><div><br></div><div>If you open a PR on github and/or an issue we can discuss and merge your changes. If you don't like or want to use github I can make my private openr2 gitlab repo public as well.</div></div></div></div>